Skip to content

Commit 632f4ab

Browse files
committed
Add Kakoune and Helix configuration
1 parent 61cb76b commit 632f4ab

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

manual.adoc

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -427,6 +427,34 @@ Then click on apply, and restart the LSP server for your rust project.
427427

428428
https://gitlab.com/cppit/jucipp[juCi++] has built-in support for the language server protocol, and since version 1.7.0 offers installation of both Rust and rust-analyzer when opening a Rust file.
429429

430+
=== Kakoune
431+
432+
https://kakoune.org/[Kakoune] editor support LSP with the help of https://github.com/kak-lsp/kak-lsp[`kak-lsp`]. Follow the https://github.com/kak-lsp/kak-lsp#installation[instructions] to install `kak-lsp`. To configure `kak-lsp`, refer to the https://github.com/kak-lsp/kak-lsp#configuring-kak-lsp[configuration section] which is basically about copying the https://github.com/kak-lsp/kak-lsp/blob/master/kak-lsp.toml[configuration file] in the right place (latest versions should use `rust-analyzer` by default).
433+
434+
Finally, you need to configure Kakoune to talk to `kak-lsp` (see https://github.com/kak-lsp/kak-lsp#usage[Usage section]). A basic configuration will only get you LSP but you can also activate inlay diagnostics and auto-formatting on save. The following might help you get all of this.
435+
436+
[source,txt]
437+
----
438+
eval %sh{kak-lsp --kakoune -s $kak_session} # Not needed if you load it with plug.kak.
439+
hook global WinSetOption filetype=rust %{
440+
# Enable LSP
441+
lsp-enable-window
442+
443+
# Auto-formatting on save
444+
hook window BufWritePre .* lsp-formatting-sync
445+
446+
# Configure inlay hints (only on save)
447+
hook window -group rust-inlay-hints BufWritePost .* rust-analyzer-inlay-hints
448+
hook -once -always window WinSetOption filetype=.* %{
449+
remove-hooks window rust-inlay-hints
450+
}
451+
}
452+
----
453+
454+
=== Helix
455+
456+
https://docs.helix-editor.com/[Helix] editor (developed in Rust 😉) does support LSP by default. However, it won't install `rust-analyzer` automatically so you can follow instructions for installing <<rust-analyzer-language-server-binary,`rust-analyzer` binary>>.
457+
430458
== Troubleshooting
431459

432460
Start with looking at the rust-analyzer version.

0 commit comments

Comments
 (0)