-
Notifications
You must be signed in to change notification settings - Fork 81
Kakoune
Maximilian Köhler edited this page Nov 24, 2020
·
4 revisions
Install a recent version of kakoune and kak-lsp. Note that in kak-lsp v8.0.0 and prior the LSP Integration won't work. Therefore, build the new-release v9.0.0 or use any dev version after v8.0.0.
- Create the file
~/.config/kak-lsp/kak-lsp.toml
and insert
[language.julia]
filetypes = ["julia"]
roots = [".git"]
command = "julia"
args = [
"--startup-file=no",
"--history-file=no",
"-e",
"""
using LanguageServer;
using Pkg;
import StaticLint;
import SymbolServer;
env_path = dirname(Pkg.Types.Context().env.project_file);
server = LanguageServer.LanguageServerInstance(stdin, stdout, env_path, "");
server.runlinter = true;
run(server);
""",
]
In your kakrc
append the following slightly adapted default config
plug "ul/kak-lsp" do %{
cargo build --release --locked
cargo install --force --path .
} config %{
# uncomment to enable debugging
# eval %sh{echo ${kak_opt_lsp_cmd} >> /tmp/kak-lsp.log}
# set global lsp_cmd "kak-lsp -s %val{session} -vvv --log /tmp/kak-lsp.log"
# this is not necessary; the `lsp-enable-window` will take care of it
# eval %sh{${kak_opt_lsp_cmd} --kakoune -s $kak_session}
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
lsp-auto-hover-enable
echo -debug "Enabling LSP for filtetype %opt{filetype}"
lsp-enable-window
}
hook global KakEnd .* lsp-exit
}
- Open a julia file of your choice, wait for a few secs and try
g r
which corresponds to goto references - If this doesn't work, check the comment lines in the
kakrc
config