Trouble getting plugins to work

Very basic question, I am trying to use kak-lsp with LanguageServer.jl, and am getting this error:

*** This is the debug buffer, where debug info will be written ***
/home/peterj/.config/kak/kakrc:no such command: 'plug'
/usr/share/kak/kakrc:29:1: 'evaluate-commands' 116:1: 'source' no such command: 'plug'
error while parsing kakrc:
    1:1: 'source' 29:1: 'evaluate-commands' 116:1: 'source' no such command: 'plug'

I find the kakoune plugin system really confusing so I have no idea what to do with this.

The Kakoune plugin system is really easy: any .kak files anywhere inside ~/.config/kak/autoload will be loaded at startup. So you can stick your own .kak files in there, or download a plugin and copy it in there, or straight-up git clone a plugin directly into that directory and it should all work.

However, some people like to automate even these simple steps, so there’s a third-party plugin called plug.kak to help with downloading plugin files in the right place. This plugin adds a new :plug command you can stick in your kakrc (or any other plugin) to tell it to download plugins.

Since your *debug* buffer mentions “no such command: ‘plug’” I suspect you’ve tried to follow the plug.kak installation instructions without having plug.kak installed.

I suggest you follow the kak-lsp instructions for pre-built binaries. Once you can run kak-lsp in a terminal (to verify it’s installed correctly), follow the instructions under Usage to make language-server functionality available in Kakoune.

If you have any more problems, feel free to post more questions!

Thanks, the LanguageServer.jl (for Julia) tutorial is written assuming plug.kak, so I kept fiddling with getting that to work.

I ended up getting it to work by adding

source "/home/peterj/.config/kak/plugins/plug.kak/rc/plug.kak"

to the beginning of my kakrc. Not the nicest solution but it works at least!

Sorry, nevermind!
The error goes away when I remove require-module plug from my kakrc.

kak-lsp appears to be working, but I cannot get other plugins to work. I was fiddling around with other plugins to get better syntax highlighting for Julia.

Here is my kakrc:

source "/home/peterj/.config/kak/plugins/plug.kak/rc/plug.kak"

eval %sh{kak-lsp --kakoune -s $kak_session}

# Yank
hook global NormalKey '[ydc]' %{
  nop %sh{
    (printf '%s' "$kak_main_reg_dquote" | xclip -filter | xclip -selection clipboard) < /dev/null > /dev/null 2>&1 &

# Paste
map global user p -docstring 'Paste (After)' '<a-!>xclip -out -selection clipboard<ret>'
map global user P -docstring 'Paste (Before)' '!xclip -out -selection clipboard<ret>'
map global user R -docstring 'Replace' '|xclip -out -selection clipboard<ret>'

plug "jdugan6240/powerline.kak" defer powerline %{
    #Configure powerline.kak as desired
    powerline-theme gruvbox
} config %{

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

# uncomment to enable debugging

    set global lsp_diagnostic_line_error_sign '║'
    set global lsp_diagnostic_line_warning_sign '┊'
    set global lsp_hover_max_lines 40
    define-command ne -docstring 'go to next error/warning from lsp' %{ lsp-find-error --include-warnings }
    define-command pe -docstring 'go to previous error/warning from lsp' %{ lsp-find-error --previous --include-warnings }
    define-command ee -docstring 'go to current error/warning from lsp' %{ lsp-find-error --include-warnings; lsp-find-error --previous --include-warnings }

    define-command lsp-restart -docstring 'restart lsp server' %{ lsp-stop; lsp-start }
    hook global WinSetOption filetype=(c|cpp|cc|rust|javascript|typescript|julia) %{
        set-option window lsp_hover_anchor false
        echo -debug "Enabling LSP for filtetype %opt{filetype}"

    hook global KakEnd .* lsp-exit

Hi pcjentsch, powerline.kak maintainer here.

It’s odd that powerline.kak doesn’t seem to be working, as your kakrc looks fine. Did you run :plug-install after you edited your kakrc and restarted Kakoune?

I did, yep.

For some reason, everything seems to be working now?

I’m not sure what caused that honestly… but thanks!

If I had to guess, I’d say that you may have forgotten to source the powerline.kak files after running :plug-install. plug.kak won’t source the files right away once that function call is made - you need to reload your kakrc, which is usually done by restarting Kakoune.

In any case, I’m happy it worked, and welcome to the Kakoune community.

1 Like