Giter Club home page Giter Club logo

plug.kak's Introduction

plug.kak

GitHub issues license

plug.kak

plug.kak is a plugin manager for Kakoune, that was inspired by vim-plug and use-package. It can install and update plugins, run post-update actions, and helps to encapsulate the configuration within itself.

Installation

plug.kak can be installed anywhere in your system, but in order to update itself, it is required to install plug.kak in the plugin installation directory. By default, plug.kak installs plugins to the %val{config}/plugins, which is usually at $HOME/.config/kak/plugins:

mkdir -p $HOME/.config/kak/plugins
git clone https://github.com/andreyorst/plug.kak.git $HOME/.config/kak/plugins/plug.kak

Now, when plug.kak is installed, we need to tell Kakoune about it. Add this to the kakrc file:

source "%val{config}/plugins/plug.kak/rc/plug.kak"
plug "andreyorst/plug.kak" noload

Alternatively, this process can be automated, by adding the following snippet to the kakrc:

evaluate-commands %sh{
    plugins="$kak_config/plugins"
    mkdir -p "$plugins"
    [ ! -e "$plugins/plug.kak" ] && \
        git clone -q https://github.com/andreyorst/plug.kak.git "$plugins/plug.kak"
    printf "%s\n" "source '$plugins/plug.kak/rc/plug.kak'"
}
plug "andreyorst/plug.kak" noload

This will create all needed directories on Kakoune launch, and download plug.kak if it is not installed already.

Note: plug "andreyorst/plug.kak" noload is needed to register plug.kak as manually loaded plugin, so plug-clean will not delete plug.kak.

Usage

All plugins are installed and loaded with the plug command. This command accepts one-or-more arguments, which are keywords and attributes, that change how plug.kak behaves.

The first strict rule of the plug command is that the first argument is always the plugin name formatted as in GitHub URL: "author/repository".

plug "author/repository"

By default plug.kak will look for the plugin at GitHub.com, and download it. When the plugin is hosted on a different service, a URL can be used as the first argument. So in most cases it is enough to add this to the kakrc to use a plugin:

plug "delapouite/kakoune-text-objects"

Or with URL:

plug "https://gitlab.com/Screwtapello/kakoune-inc-dec"

After adding this, kakrc needs to be re-sourced to let plug.kak know that configuration was changed. Alternatively, Kakoune can be restarted. After that newly added plugins can be installed with the plug-install command. More information about other commands available in Commands section.

Keywords and attributes

The plug command accepts optional attributes, that change how plug.kak works, or add additional steps for plug to perform.

These keywords are supported:

Branch, Tag or Commit

plug can checkout a plugin to desired branch, commit or tag before loading it. It can be done by adding the following keywords with parameters: branch "branch_name", tag "tag_name" or commit "commit_hash".

Loading plugin from different path

Plugins can be loaded from arbitrary path by specifying the load-path keyword and providing the path as an argument:

plug "plugin_name" load-path "~/Development/plugin_dir"

However all plug related commands, like plug-update or plug-clean will not work for plugins that aren't installed to plug_install_dir.

Skipping loading of a plugin

If plugin needs to be loaded manually, the noload keyword can be used. This can also be used to avoid loading the plugin second time, like in the example with plug.kak from the installation section:

source "%val{config}/plugins/plug.kak/rc/plug.kak"
plug "andreyorst/plug.kak" noload

Note, that plugins with the noload keyword are still configured and managed. See handling-user-configuration for more details.

Automatically do certain tasks on install or update

When the plugin requires some additional steps to preform after installation or update, the do keyword can be used. This keyword expects the body which will be executed in the shell, thus it can only contain shell commands, not Kakoune commands.

plug "ul/kak-lsp" do %{
    cargo build --release --locked
    cargo install --force --path .
}

In the example above plug.kak will run these cargo commands after kak-lsp was installed or updated.

Note that even though this is technically a shell expansion, the %sh{} expansion can't be used with do, as it will be evaluated immediately each time kakrc loaded. Use %{} instead.

Installing color schemes

To register the plugin as a color scheme, use theme keyword. Such plugins will be copied to the %val{config}/colors directory.

plug "andreyorst/base16-gruvbox.kak" theme config %{
    colorscheme base16-gruvbox-dark-soft
}

Ensuring that plugins are installed

plug command can be explicitly told to install the plugin automatically with the ensure keyword. The plug_always_ensure option can be set to true to perform this for each and every plugin specified in the kakrc.

Note that ensure plugins are installed (if missing) in a background job; they are then only loaded when the install finishes. Thus, subsequent kakrc commands should not depend on functionality provided by such plugins. Only use ensure with non-essential plugins, which are not required for kakrc to complete loading.

Handling user configurations

The configuration of the plugin is performed only when the plugin is installed. There's a second strict rule of plug command: every parameter that doesn't have a keyword before it, is treated as plugin configuration. For example:

plug "andreyorst/fzf.kak" config %{
    map -docstring 'fzf mode' global normal '<c-p>' ': fzf-mode<ret>'
}

Here, plug will map Ctrl+p key only if the plugin is installed. Everything within the config %{} block is an ordinary kakscript.

The config keyword is optional, and can be skipped. Multiple config blocks are also supported.

Commenting out plug options

It may be tricky to "toggle" plug options, for debugging or testing purposes, because it is impossible to continue a command past a #... comment (also, config blocks usually span multiple lines). To solve this, plug supports a comment keyword that ignores its next argument. For example, to toggle a load-path option, wrap it in comment %{}; then remove the "wrapper" to turn it back on (without having to re-type the full path):

plug "andreyorst/fzf.kak" comment %{load-path /usr/local/src/fzf} config %{
    # ...
}

Deferring plugin configuration

With the introduction of the module system, some configurations have to be preformed after loading the module. The defer keyword is a shorthand to register a ModuleLoaded hook for given module. You need to require the module explicitly elsewhere.

Below is the configuration of fzf.kak plugin, which provides the fzf module:

plug "andreyorst/fzf.kak" config %{
    map -docstring 'fzf mode' global normal '<c-p>' ': fzf-mode<ret>'
} defer fzf %{
    set-option global fzf_preview_width '65%'
    set-option global fzf_project_use_tilda true
}

Note: the ModuleLoaded hook is defined as early as possible - before sourcing any of plugin files.

Demanding plugin module configuration

Works the same as defer except requires the module immediately:

plug "andreyorst/fzf.kak" config %{
    # config1 (evaluated before demanding the module)
} demand fzf %{
    # demand block (will generate `require-modlue fzf` call, and a respective hook)
    set-option global fzf_project_use_tilda true
} config %{
    # config2 (evaluated after demanding the module)
}

The above snippet is a shorthand for this code:

plug "andreyorst/fzf.kak" defer fzf %{
    # the body of demand block
    set-option global fzf_project_use_tilda true # demand block
} config %{
    # config1 (evaluated before demanding the module)
    require-module fzf # the demand hook
    # config2 (evaluated after demanding the module)
}

Note: the ModuleLoaded hook is defined as early as possible - before sourcing any of plugin files. The place where require-module call will be placed depends on the order of config blocks in the plug command. As soon as the module is required, the ModuleLoaded hook will execute.

plug.kak Configuration

Several configuration options are available:

Proper way to configure plug.kak is to load it with the plug command, and providing both noload and config blocks: This should be done before loading other plugins.

plug "andreyorst/plug.kak" noload config %{
    # configure plug.kak here
}

Plugin installation directory

By default plug.kak automatically detects its installation path and installs plugins to the same directory. To change this, use the plug_install_dir option:

plug "andreyorst/plug.kak" noload config %{
    set-option global plug_install_dir %sh{ echo $HOME/.cache/kakoune_plugins }
}

Maximum downloads

plug.kak downloads plugins from github.com asynchronously via git. By default it allows only 10 simultaneously active git processes. To change this, use the plug_max_simultaneous_downloads option.

Default git domain

If majority of plugins is installed from the service other than GitHub, default git domain can be changed to avoid specifying the domain keyword for each plugin, or using URLs.

Notify on configuration error

By default, plug.kak will display an info box when any plugin's config block has errors while being evaluated. To change this, use the plug_report_conf_errors option:

set-option global plug_report_conf_errors false

Commands

plug.kak adds five new commands to Kakoune.

plug-install

This command installs all plugins that were specified in any of the configuration files sourced after Kakoune launch. It accepts optional argument, which can be the plugin name or the URL, so it could be used to install a plugin from command prompt without restarting Kakoune. This plugin will be enabled automatically, but you still need to add plug command to your configuration files in order to use that plugin after the restart.

plug-list

Display the buffer with all installed plugins, and check for updates. The Enter key is remapped to execute plug-update or plug-install command for selected plugin, depending on its state. This command accepts an optional argument noupdate, and if it is specified, check for updates will not be performed.

plug-update

This command updates all installed plugins. It accepts one optional argument, which is a plugin name, so it could be used to update single plugin. When called from prompt, it shows all installed plugins in the completion menu.

plug-clean

Remove plugins, that are installed, but disabled or missing in configuration files. This command also accepts optional argument, which is a plugin name, and can be used to remove any installed plugin.

plug

Load plugin from plugin installation directory by its name.

plug-chain

This command can collapse separate plug invocations and thus saves startup time by reducing multiple shell calls; it may come in handy if you're invoking kak frequently (e.g. as the $EDITOR). Replace the first plug command in your kakrc with plug-chain, then append subsequent plug calls and their parameters, as in the following:

plug-chain https://github.com/Delapouite/kakoune-select-view config %{
  map global view s '<esc>: select-view<ret>' -docstring 'select view'
} plug https://github.com/occivink/kakoune-vertical-selection %{
} plug https://github.com/jbomanson/search-doc.kak demand search-doc %{
  alias global doc-search search-doc
}

Backslashes can also be used to separate individual plug "clauses" (which avoids the "visual hack" of empty config blocks, as above, serving as newlines). An initial plug redundant argument is also supported for symmetry. Either way, plug-chain simply figures out the parameters intended for each individual plug clause (using "plug" as a delimiter), and executes all implied plugs in a single shell call. All regular plug features are supported. Mix and match plug / plug-chain invocations in any order, any number of times.

Note, that if plug.kak own variables are altered in the plug-chain body, the chained plug commands won't get updated values. This happens because Kakoune reads its variables only once per shell invocation, and calling set-option won't update the value of a variable for current shell.

Alternative plugin managers

Here are some other plugin managers to consider as alternatives to plug.kak:

plug.kak's People

Contributors

abuffseagull avatar andreyorst avatar cole-h avatar delapouite avatar dontlaugh avatar krobelus avatar maxdevjs avatar mmlb avatar mralusw avatar schnilz avatar teddydd avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

plug.kak's Issues

Fails to load with latest master: 'define-command' unknown option '-shell-script-candidates'

Installing plug.kak as described in the README gets me this error on start-up:

/home/<sanitized>/.config/kak/plugins/plug.kak/rc/plug.kak:70:4171: 'define-command' unknown option '-shell-script-candidates'
/home/<sanitized>/.config/kak/kakrc:2:48: 'source' 70:4171: 'define-command' unknown option '-shell-script-candidates'
/home/<sanitized>/.local/share/kak/kakrc:5:846: 'evaluate-commands' 99:16501: 'source' 2:48: 'source' 70:4171: 'define-command' unknown option '-shell-script-candidates'
error while parsing kakrc:
    1:1: 'source' 5:846: 'evaluate-commands' 99:16501: 'source' 2:48: 'source' 70:4171: 'define-command' unknown option '-shell-script-candidates'

Kakoune version (master) 983a8f759a3a959c7712891e2180ab5357c139d2
plug.kak version 7a41cdf

My kakrc contains only one line:

source "%val{config}/plugins/plug.kak/rc/plug.kak"

There are two things which strike me as odd. Line 70 of plug.kak does not contain define-command. And second the -shell-script-candidates isn't new. It was added late 2018.

plug-chain problems

It seems that latest changes to plug_chain command broke something.

The variable plug_always_ensure doesn't work.

Installation of plugins seems broken as well. I get a lot of errors that username could not be read for https://gitlab.com for plugins that don't have domain set

@mralusw can you confirm?

demand doesn't work without a final %{}

plug plugin demand mod %{}

works, but if the final %{} is removed, the plugin is silently ignored. It is listed as up-to-date, but its code is not sourced. For example any options declared in the plugin are unavailable, and any module declared in the plugin cannot be require-module'd.

Feature request: add an option to plug-update to make it synchronous

I'd like to set up automated updates for my kakoune plugins, and I do this for all my other apps, such as vim, by running a script. For vim, I can just do vim +PlugUpdate +qa, and it works, but if I do something similar with plug.kak like kak -e 'plug-update; quit', it simply quits right away before it does any updating.

I am unsure what the cause is, but I can only assume it is because the actual update process is asynchronous and happens in the background, while the user is free to do whatever else in kakoune while the update process is going. While this may be desirable in an interactive setting, it makes it impossible to do updates in an automated way.

Plugin status breaks if reflog empty

In plug.sh / plug_list, the code checks for @{0}, which causes git to fail if the reflog is empty (can be triggered manually with git reflog expire, but probably can also happen automatically). Furthermore, plug_list interprets this failure as "Updates available".

Is there any reason to use @{0} instead of @ (the actual HEAD)? If yes, the code could still be fixed by changing to

LOCAL=$(git rev-parse '@{0}') || LOCAL=$(git rev-parse '@')

(and similarly for BASE=)

My use case is that I compact all kak (and vim) plugins by deleting tags, reflogs, inactive remote branches, setting git remote set-branches to only the current branch, and running git fsck to repack only reachable objects. Some people put images (or even videos!) in their repository, so the space savings can be quite substantial, as long as only a minimal set of objects are reachable.

Add a plug-doc command

Hello

Almost all plugins that I know of have a README.md file at their root.

So what about a plug-doc command, that would have the all the installed plugins as auto-completion and would automatically opens the associated README.md ?

Example:

:plug-doc<space>

I select ul/kak-lsp for instance, then press Enter, Kakoune opens kak-lsp's README.md

Bonus:

When the list of plugins is displayed in the *plug* buffer after a :plug-list, pressing a key like d would automatically call plug-doc for the plugin on the line.

Defer missing the hook

Hey,

I noticed this case where defer does not hook correctly.

hook global ModuleLoaded auto-pairs %{
        echo -debug 'this works'
}
plug 'alexherbo2/auto-pairs.kak' defer "auto-pairs" %{
	echo -debug 'this does not'
}

Maybe because it's required so soon? The module is declared and required in the same file.

Message when done installing

Currently when installing, I see a print: "Installing plugins in background". However I get no message when it is done installing.

So, currently I do not know when it is done.

nasty errors with `plug http://.../` (final slash)

If unsuspecting users leave a final / in the URL, really, really nasty things happen in plug_load. plugin_name becomes empty, path_to_plugin becomes the entire plugins folder, and all plugins get loaded (including double-loading of plug.kak itself).

I suggest something like 904e9b1 ...

Can't set `noload` and `(branch|tag|commit)` options simultaneously

This works without any errors:

plug 'andreyorst/plug.kak' noload

However, this gives me an error:

plug 'andreyorst/plug.kak' 'branch: v2018.10.27' noload
~/.config/kak/plugins.kak:3:54: 'plug' 3:57: 'evaluate-commands' 2:66: 'plug-configure' 1:2: 'evaluate-commands' no such command: 'noload'
/Users/evanrelf/.config/kak/kakrc:1:1: 'source' 3:54: 'plug' 3:57: 'evaluate-commands' 2:66: 'plug-configure' 1:2: 'evaluate-commands' no such command: 'noload'
/usr/local/Cellar/kakoune/2018.10.27/share/kak/kakrc:5:853: 'evaluate-commands' 97:20157: 'source' 1:1: 'source' 3:54: 'plug' 3:57: 'evaluate-commands' 2:66: 'plug-configure' 1:2: 'evaluate-commands' no such command: 'noload'
error while parsing kakrc:
    1:1: 'source' 5:853: 'evaluate-commands' 97:20157: 'source' 1:1: 'source' 3:54: 'plug' 3:57: 'evaluate-commands' 2:66: 'plug-configure' 1:2: 'evaluate-commands' no such command: 'noload'

I'm using kak-lsp with a noload parameter and it works fine; it's only when I try to combine noload and a (branch|tag|commit) parameter that it gives that error.

Tested on the latest commit (b3801d2) and one before that (98defec); both had this problem.

Enchance plug-list representation of manually loaded plugins

Currently plugins with load-path are shown as Not installed and invoking I on those results in download error. Instead we should show their load path, and prevent mappings from doing things not meant to be done on load-path loaded plugins, like updating and installing.

Syntax error when sourcing plug.kak

Just installed Kakoune and trying to set up plug.kak. My kakrc is empty. I've ran

mkdir -p ~/.config/kak/plugins/
git clone https://github.com/andreyorst/plug.kak.git ~/.config/kak/plugins/plug.kak

successfully, but when I try to run

source "~/.config/kak/plugins/plug.kak/rc/plug.kak"

I get the error:

plug.kak: line 56: syntax error near unexpected token `newline'
plug.kak: line 56: `try %<'

Fish is my default shell, and I tried running it in a bash shell as well. Not sure if that matters.

Use %val{config} ?

The current default path is '$HOME/.config/kak/plugins'.

Should the plugin use something like %val{config}/plugins for better flexibility and cross-platform compatibility?

plug-list command

Hi

A plug-list command would be handy to have a quick view of all the local plugins.
It could open a *plugins* buffer with the list a plugin names and some extra info like the date of the last update.

Also, by pressing <ret> on one of the line, it can try to update only this specific plugin.

We can even go further: plug-list remote, would display the list of available plugins on a provider like Github. Using the same API call that on this page: http://kakoune.org/plugins.html

This way the user can discover all the available plugins created by the community and decide to install them by pressing <ret>. This would add the corresponding plug 'username/repo' to their kakrc and a plug-install of this specific plugin.

`demand` switch

To allow automatically loading plugins without using require-mode in config block:

plug "author/plugin" defer module %{
     set-option global option value
} demand

instead of:

plug "author/plugin" defer module %{
    set-option global option value
} config %{
    require-module module
}

`disable` option?

Sometimes there's a need to disable a plugin (during kakrc debugging, testing or because it misbehaves). It would be nice to have a keyword that would just make plug.kak skip a given plugin, and options associated with it.

Spring Refactoring

Spring is coming, so I've decided to show some love to the code. I'm going to do bit of refactoring, some optimizations for performance hungry places, and simplify overall structure a bit. The plugin will act the same as before, but hopefully will be a bit faster on loading plugins and their configurations, and easier to maintain.

fd support?

Can you please add fd support?
When I set set-option global fzf_file_command 'fd --type f --follow', I got following:
Screen_Shot_2018-09-28_at_22.51.09.png

I suppose there should be info box message, instead of that line.

defer block not works as expected

i have configuration for fzf.kak(Kakoune v2020.09.01)

plug "andreyorst/fzf.kak" %{
    map global normal \' ': fzf-mode<ret>'  # works
} defer fzf %{
    set-option global fzf_file_command fd # not works
}

expected:

option fzf_file_command have value fd

actual:

option fzf_file_command not setted and have default value find
problem
also if set option after kakoune loaded it works.
am i doing something wrong?

Use FIFO instead of echo

Have a nice colored FIFO could be helpful to keep log.

Moreover, we could imagine some nice interactions on this buffer, like Re-update or Re-try by pressing Return on a given message.

It’s easy to implement and asynchronous by nature, so it could even simplify your implementation.

Implementation examples

Kakoune becomes unresponsive when requested git repo is wrong, could we get an error message instead?

Had this issue for weeks until I just fixed it. Over this time I thought this thought it was many things before I realised that I had pasted the repo name into the "plug" command wrong. To recreate put the following line into your kakrc:

plug "alexherbo2/auto-pairs"
(it should be auto-pairs.kak, yes this is the exact thing I have left in my kakrc for weeks it is really dumb for me to not have noticed this)

This also works with any git repo that doesnt exist, I've tested it. Would it at all possible for the fifo buffer to display an error instead? Because of a mistake which is reletively easy to make this issue has plagued me for ages and I couldnt work out why. Just thought I'd point out this bug. Otherwise I love this, keep up the good work !

download plugins to subdirectories

Currently plugins directory is quite messy, I propose that plug should install plugins to
author/repo or even hosting/author/repo subdirectories.

Not sure if this make things much more complex, maybe it's not worth it. WDYT?

Stray lock file is preventing plug.kak from performing actions

I have been having a blast tinkering with Kakoune, with no small thanks to you for this awesome plugin manager. However, at some point yesterday, something went wrong, because I can no longer install, clean, or update plugins:

image

This message appears every time, and never disappears. I have tried re-installing plug.kak from scratch twice, but that didn't help anything. This happens even if I reduce my kakrc to just the plug invocations.

Grepping over the source code led me to believe that it places this lock file in the plugins directory, but no such file exists there.

Features, Announcments

This issue will track features, announce updates, changelogs, etc.

Subscribe if you interested.

Suggestions for plugin authors?

Perhaps there should be a section for plugin authors in the README.

For example, suppose that, as a plugin author, I recommend that users install my plugin via plug. Normally, my module can be loaded optionally via require-module mymod. This translates to (AFAICT)

plug me/mymod demand mymod

But plug already has a mechanism to noload. Should the module autoload itself (e.g. add a KakBegin hook that require-module's), so that users can just add to their kakrc this and avoid two layers of optional loading?

plug me/mymod

Plug doesn't play nice with private repositories

I've been trying to get Plug to work with private Github repositories, but it doesn't really seem to work.

Authenticated HTTP checkout:
A regular plug "crote/kakoune-my-private-plugin" hangs on installation because it requires a username and password, which you can't provide. The only way to get out of this is by kill -9.

SSH checkout:
A plug "[email protected]:Crote/kakoune-my-private-plugin.git" does a proper checkout (but it probably only works for me because my machine prompts for a SSH passphrase using a GUI popup).
Afterwards, it never loads the plugin. Subsequent plug-install and plug-list invocations seem to indicate that it doesn't recognize that the cloned directory belongs to this url, so it's never recognised as properly installed. Renaming it to plug "crote/kakoune-my-private-plugin" after installation does make it work, including future updates.


I'm not sure if this is even worth fixing, but it would probably be nice to have the desired behaviour in this situation documented.

Local changes to color themes are not copied over

When I commit changes to a color theme repo in $XDG_CONFIG_HOME/kak/plugins, plug.kak identifies these changes with plug-list, but there doesn't seem to be a way of automatically replacing the .kak files in $XDG_CONFIG_HOME/kak/colors.

load subset of files from repository

I'm opening this issue as you asked.

Basically I'd like option that would allow to load subset of files from repo (single file/files matching pattern. This was show stopper for me.

I realized two things:

  • most common use case is loading single file from repo
  • it's possible in plug.kak using noload and config block
plug "https://github.com/lenormf/kakoune-extra" "noload" %{
    source "%val{config}/plugins/kakoune-extra/hatch_terminal.kak"
    source "%val{config}/plugins/kakoune-extra/lineindent.kak"
    alias global t hatch-terminal-x11
}

It's not perfect pretty but it does the job.

Rationale

  1. IIRC my plugin manager still lacks a feature of loading single script, because I think that this is plugin maintainer responsibility.

You can't except that every plugin autor will comply with single repo - single plugin rule. I think managing kakoune-extra as separate repos would be insane.

Manual management of those few plugins that don't comply is a hassle.

  1. It would allow you to load single script from repo that is not formally a plugin (dotfiles repo).

  2. It doesn't bring too much complexity. At first look - replacing find param: -name with -path and using optional parameter there would be enough. I haven't tested it yet.

for file in $(find -L $(eval echo $kak_opt_plug_install_dir/"${plugin##*/}") -type f -name '*.kak'); do

ensure: document deferred loading

It seems that when a plugin gets installed via ensure, it won't be immediately loaded before subsequent kakrc commands, but rather at an unspecified time, when the install finishes.

This will obviously not work if the rest of kakrc uses commands defined by the plugin (e.g. my k9s0ke-dbg.kak defines meta-programming commands which are subsequently used in my kakrc; but there could be other cases).

On the one hand, this behavior should be documented (and possibly configurable); on the other hand, though, I wonder if it's really useful to speed up kak startup for the one-time case of missing plugins?

Edit: never mind, blocking kak startup would be unacceptable. I guess only the documentation remains to be enhanced.

Wrong file order returned from find command

With such structure of the plugin:

some_plugin.kak
└── rc
    ├── submodules
    │   └── module.kak
    └──  plugin.kak

find -type f -name "*.kak" will either print:

./rc/plugin.kak
./rc/submodules/module.kak

or:

./rc/submodules/module.kak
./rc/plugin.kak

Which is critical, since if module depends on some thing that is being declared in the main plugin, it will throw an error on source. Therefore plugin must be sourced first, then all subdirectories must be sourced after it. So I think something like breadth-first search is needed here, however GNU Find isn't capable to do such search.

Wrong wildcard matching when file with kak extension exists in current dir

plug.kak/rc/plug.kak

Lines 347 to 352 in 4a011c8

for file in ${load_subset#*:}; do
file="${file#"${file%%[![:space:]]*}"}"
file="${file%"${file##*[![:space:]]}"}"
for script in $(find -L $(eval echo $kak_opt_plug_install_dir/"${1##*/}") -type f -name "$file" | awk -F/ '{print NF-1, $0}' | sort -n | cut -d' ' -f2); do
echo source "$script"
done

*.kak is default $file contents if no load were specified. It becomes anything named alike to any .kak file or dir if you launch kakoune in the same dir.

plug_install_dir only accepts full paths

My kakrc previously contained this exact line:

set-option global plug_install_dir '$HOME/.cache/kakoune_plugins'

I spent a couple hours trying to figure out why my plugins weren't installing, and what I found is that the above no longer works.
Instead, something like this, with a full path works:

set global plug_install_dir %sh{ echo "$HOME/.cache/kakoune_plugins" }

The documentation clearly states, that the former is functional, so that should be changed.

`color-scheme` switch

I'm thinking of adding a colors-cheme attribute, so instead of installing colorschemes like so:

plug "andreyorst/base16-gruvbox.kak" noload do %{
    find -type f -name "*.kak" -print0 | xargs -0 cp -t $HOME/.config/kak/colors
} config %{
    colorscheme base16-gruvbox-dark-soft
}

It will look like so:

plug "andreyorst/base16-gruvbox.kak" colors-cheme %{
    colorscheme base16-gruvbox-dark-soft
}

Where color-scheme switch will make plug copy schemes to colors folder on update for specific packages.

Error running hooks for 'WinSetOption' 'filetype=plug'

On OSX Catalina, with Kakoune brewed from source and suggested kakrc, plug returns an error on :plug-install or :plug-update, but loads normally when updated from the list manually.

Debug buffer:

plug.kak: Can't declare highlighters for 'kak' filetype.
          Detailed error: 2:10: 'add-highlighter' duplicate id: 'plug_keywords'
plug.kak: Can't declare highlighters for *plug* buffer.
          Detailed error: 2:6: 'add-highlighter' duplicate id: 'plug_buffer'
error running hook WinSetOption(filetype=plug)/plug-syntax: 2:6: 'add-highlighter' duplicate id: 'plug_buffer'

Load order

I'm thinking about supporting loading order. It's not quite the same as defer since it will allow to source plugins in different order. For example

We have plugins that provide powerline modules, for example langmap.kak and therefore rely on powerline.kak. So if we're going to load plugins we should load powerline before langmap. We can do it like so:

plug "andreyorst/powerline.kak"
plug "andreyorst/langmap.kak"

But if there are many plugins in kakrc it gets harder every time to figure out the order and move plugins around is a tedious task. So instead of keeping an order, it could be set with after keyword:

plug "andreyorst/langmap.kak" after "powerline.kak"
plug "andreyorst/powerline.kak"

This way the order load will be as follows:

source powerline.kak
source powerline-modules
source langmap.kak

Not sure how useful this feature will be, but there are some other plugins already that depend on other plugins, for example: kakoune-emmet depends on kakoune-snippets

File system loop detected

Hi, it's a bit hard to tell if this an issue with kakoune.cr or here but I think there is at least something strange going with plug.kak. I think there are actually two problems but they both appeared today after nothing for a few months. The *debug* buffer says this everytime I open kakoune:

Error: plug.kak: can't require 'kak' module to declare highlighters for plug.kak. Check if kakrc.kak is available in your autoload.
shell stderr: <<<
find: File system loop detected; ‘/home/uver/.config/kak/plugins/plug.kak/..//kakoune.cr/lib/fifo/lib’ is part of the same file system loop as ‘/home/uver/.config/kak/plugins/plug.kak/..//kakoune.cr/lib’.
find: File system loop detected; ‘/home/uver/.config/kak/plugins/plug.kak/..//kakoune.cr/lib/rsub/lib’ is part of the same file system loop as ‘/home/uver/.config/kak/plugins/plug.kak/..//kakoune.cr/lib’.
>>>

Like I mentioned, I think the first thing seems separate. Why would you need a kakrc in the autoload directory? As for the second and third messages, I popped open nnn on those directories and they keep opening infinitely. Maybe not a plug.kak issue but I'm not sure so was curious if anyone could offer some ideas.

Thank you so much.

`awk: illegal field $(), name "F"`

From *debug* buffer, after running plug-install:

awk: illegal field $(), name "F"
 input record number 1, file 
 source line number 1

I never get the Done installing plugins message, it just hangs on Installing plugins in background.

It seems the problem appeared in the latest commit (b3801d2). I can run plug-install with no problems on the previous commit (98defec).

My guess is that my version of awk on macOS is different from whatever version you're using on Linux (I have version 20070501 of awk installed on macOS 10.14 Mojave).

Weird error on Ubuntu 18.04

I've copied my kak setup (same config files, same kakoune version) to Ubuntu 18.10, and I get an error on startup.

*** This is the debug buffer, where debug info will be written ***                                                                                                                                                           
Dependency unmet: jq, please install it to use go-tools                                                                                                                                                                      
/home/dpc/.config/kak/kakrc:41:2140: 'plug' 3:57: 'evaluate-commands' 5:1388: 'plug-configure' 1:2: 'evaluate-commands' parse error: unterminated string '...'                                                               
/usr/local/share/kak/kakrc:5:853: 'evaluate-commands' 97:15217: 'source' 41:2140: 'plug' 3:57: 'evaluate-commands' 5:1388: 'plug-configure' 1:2: 'evaluate-commands' parse error: unterminated string '...'                  
error while parsing kakrc:                                                                                                                                                                                                   
    1:1: 'source' 5:853: 'evaluate-commands' 97:15217: 'source' 41:2140: 'plug' 3:57: 'evaluate-commands' 5:1388: 'plug-configure' 1:2: 'evaluate-commands' parse error: unterminated string '...'

Remove 'plug' highlighting when the filetype changes

The following hook adds hl to the plug keyword

hook global WinSetOption filetype=kak %{
	try %{ add-highlighter window/plug regex ^(\h+)?\bplug\b\h 0:keyword }
}

I think a hook to remove the hl is missing. Something like:

hook  global WinSetOption filetype=(?!kak).* %{ remove-highlighter window/plug }

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.