Plug.kak: Note about Versioning, new features as of today, plans for the future

I’ve thought about release of new version of plug.kak but wasn’t able to do an actual release of new stable version, which is explained below. So I’ve wrote this changelog or news-post, if you can call it so, about new features, plans for the future and overall state of the plugin itself.

There will be no new “releases” of plug.kak

Seems that there’s no way of keeping single version of this plugin, because it is using many of Kakoune’s features, and those features are being changed rapidly without keeping backwards compatibility. For example, plug.kak provides you a list of currently installed plugins in command prompt, so you could update or clean single plugin, without guessing correct naming. This feature uses -shell-candidates flag, which was changed in v2018.10.27 release to -shell-script-candidates and the older variant is no longer working. Therefore I need to keep two different versions of plug.kak because not all distributions will update to latest release right after it is being released on Kakoune GitHub releases page.

For now I think it will be correct choice to support two latest stable releases of Kakoune, and Kakoune master branch in three different plug.kak branches. It is little more time consuming but, any user would be able to find a version of plug.kak that suits his needs.

These branches are currently available:

  • kakoune-git - this branch is up to date with changes in Kakoune master branch. All new features of plug.kak are being developed and tested here.
  • v2018.10.27 - this branch is up to date with stable changes in kakoune-git branch. Those changes are being backported to work in Kakoune 2018.10.27 release. This is default branch.
  • v2018.09.04 - this branch is up to date with changes in kakoune-git branch. Those changes are being backported to work in Kakoune 2018.09.04 release.

So if you’re using current latest release of Kakoune, then you don’t need to do anything. This repo is set up to use latest release as default branch. If you’re using Kakoune builds from GitHub repo, then you need to switch to kakoune-git branch. If your distribution didn’t updated to latest release, you need to switch to a branch named accordingly to your installed release of Kakoune. I hope that this will be convenient enough and everyone will be satisfied.

New features as of Oct 28 2018

As of today, there are several new features in plug.kak.

  • Configuration of plugins is now handled by plug command.
    The last parameter of plug command is treated as configurations of plugin. This code will be executed only if plugin is installed. For example:
    plug "andreyorst/fzf.kak" %{
        map global normal <c-p> ": fzf-mode<ret>" -docstring "enter fzf mode"
    }
    
    So if fzf.kak is installed, plug.kak will automatically load it’s configuration, which in this case is execution of fzf-mode command when pressing Ctrl+P. If fzf.kak isn’t installed, configurations will not be loaded, and therefore there will be no error at Kakoune startup that there is no such command fzf-mode.
  • Automatically load plugin and it’s configuration after installation.
    This means that if you store your Kakoune configuration somewhere, and you’ve decided to install it on new machine, all you’ll need to do is install plug.kak and load your Kakoune. After execution of plug-install all plugins will be installed, loaded, and configured automatically. This also means that if you’ve added new plugin to your kakrc, or any other Kakoune configuration file, after sourcing this file and execution of plug-install this plugin will be loaded and ready for use.
  • Post-install and post-update hooks.
    This feature allows plug.kak to keep track on certain actions that should be done after update of plugin. For example, if kak-lsp gets an update, you need to rebuild the core of the plugin. With plug.kak you can use do %{..} syntax to automatically execute shell commands after every successful update of certain plugin. For example:
    plug "ul/kak-lsp" noload do %{ cargo build --release } %{
        evaluate-commands %sh{ kak-lsp --kakoune -s $kak_session }
    }
    
    After execution of plug-update if there were changes to kak-lsp repository, plug.kak will automatically execute cargo build --release command in the background. You can keep track of executed post-update hooks in *debug* buffer.
  • Skipping loading of plugin files with noload attribute.
    This is somewhat a workaround of current situation with Kakoune plugin file-structure layout, but it essentially allows you to skip loading entire plugin files, and specify parts of plugin that you need to load. Like in example with kak-lsp, kak-lsp executable takes care of loading lsp.kak file, therefore we tell plug.kak not to load it. Instead plug.kak will only load plugin configurations.
    This also can be used to load parts of repository that contains lots of scripts for Kakoune, like kakoune-extra by @lenormf:
    plug "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
    }
    
    Though it is a planned as separate feature for future release of plug.kak.

Future plans

  • Implement FIFO instead of relying on echo and *debug* buffer.
  • Implement mechanism that allows loading parts of plugin without relying on noload
  • More to come from Issues. If you think that plug.kak needs some feature feel free to open feature request at **plug.kak GitHub repository.
2 Likes

I suspect you could get by with two branches (last stable / master) – but I admire you trying to support all your users.

I don’t think so. I think that there are distributions that will provide old Kakoune packages for long time. Therefore I’ll keep old branches too, just will mark them as discounted, and will not backport features there.

1 Like