Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

What's the current way to configure with plug.kak? #153

Closed
dpc opened this issue Jan 7, 2019 · 9 comments
Closed

What's the current way to configure with plug.kak? #153

dpc opened this issue Jan 7, 2019 · 9 comments

Comments

@dpc
Copy link
Contributor

dpc commented Jan 7, 2019

I was originally using this:

plug "ul/kak-lsp" do %{cargo build --release} load %{plugin.kak}

but today I did :plug-update and it no longer works.

@ul
Copy link
Collaborator

ul commented Jan 8, 2019

Please consult relevant README section: https://github.com/ul/kak-lsp/#with-plugkak

@dpc
Copy link
Contributor Author

dpc commented Jan 8, 2019

@ul Can you paste the rest of the stuff, that typically goes into %{ ... }? I am just unable to get it work again, and what readme says:

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

does not agree with what I used to have:

        lsp-enable-window

etc.

@dpc
Copy link
Contributor Author

dpc commented Jan 8, 2019

When starting like README.md would like me to, I'm getting: 6│error running hook WinSetOption(filetype=rust)/: 7:248: 'eval' 65:2791: 'define-command' command 'lsp-start' already defined

It seems to me that the load %{plugin.kak} is neccessary, and without it some wrong stuff is being loaded.

@dpc
Copy link
Contributor Author

dpc commented Jan 8, 2019

I've got some help, and this is my current config.

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

    set global lsp_diagnostic_line_error_sign '║'
    set global lsp_diagnostic_line_warning_sign '┊'

    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|rust) %{
        set-option window lsp_auto_highlight_references true
        set-option window lsp_hover_anchor false
        lsp-auto-hover-enable
        lsp-start
        lsp-enable
    }

    hook global WinSetOption filetype=(rust) %{
        set window lsp_server_configuration rust.clippy_preference="on"
    }

    hook global WinSetOption filetype=rust %{
        hook window BufWritePre .* %{
            evaluate-commands %sh{
                test -f rustfmt.toml && printf lsp-formatting-sync
            }
        }
    }

    hook global KakEnd .* lsp-exit
}

It seems to me that config keyword might have been important, and yet it is not shown in the README. I think it wouldn't hurt for the README to show a real-world example of some kind, instead of the current excerpt.

Anyway, thank you for help.

@ul
Copy link
Collaborator

ul commented Jan 8, 2019

Good to hear that you got it working and thanks for sharing config!

Tagging @andreyorst for potential README update. Meanwhile, I'm going to add your config to the wiki.

@andreyorst
Copy link
Contributor

@ul but README is just fine, only it's extremely minimalist. There were something wrong in configuration, and I don't know what it was, since I haven't seen non-working config.

@ul
Copy link
Collaborator

ul commented Jan 9, 2019

If it's okay then it's okay, I just wanted to double check.

Few notes on @dpc config: lsp-start shouldn't be required, and if you enable kak-lsp for specific filetypes in hook, it's better to run lsp-enable-window rather than lsp-enable.

@dpc
Copy link
Contributor Author

dpc commented Jan 9, 2019

@ul I used to have

lsp-enable-window

I copied lsp-start etc. from @andreyorst dotfiles and it worked.

I really think it's best to have one, advertised, featureful standard config. The ecosystem is tiny and new, and there might be bugs lurking around that noone even knows about.

@andreyorst
Copy link
Contributor

@dpc lsp-enable-window works just fine

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants