diff --git a/kakrc b/kakrc index 1b34cd4..c88833c 100644 --- a/kakrc +++ b/kakrc @@ -1,5 +1,6 @@ # Load plug.kak source "%val{config}/plugins/plug.kak/rc/plug.kak" +plug "alexherbo2/auto-pairs.kak" plug "andreyorst/plug.kak" noload # plug kakoune-snippets plug "occivink/kakoune-snippets" @@ -42,7 +43,7 @@ plug "kak-lsp/kak-lsp" do %{ 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|sh|python|go|java) %{ + hook global WinSetOption filetype=(c|cpp|sh|cc|rust|javascript|typescript|go|python|java) %{ set-option window lsp_auto_highlight_references true set-option window lsp_hover_anchor false lsp-auto-hover-enable @@ -50,8 +51,30 @@ plug "kak-lsp/kak-lsp" do %{ lsp-enable-window } + 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 + } + } + } + + map global user l %{:enter-user-mode lsp} -docstring "LSP mode" + map global insert ':try lsp-snippets-select-next-placeholders catch %{ execute-keys -with-hooks tab> }' -docstring 'Select next snippet placeholder' + map global object a 'lsp-object' -docstring 'LSP any symbol' + map global object 'lsp-object' -docstring 'LSP any symbol' + map global object e 'lsp-object Function Method' -docstring 'LSP function or method' + map global object k 'lsp-object Class Interface Struct' -docstring 'LSP class interface or struct' + map global object d 'lsp-diagnostic-object --include-warnings' -docstring 'LSP errors and warnings' + map global object D 'lsp-diagnostic-object' -docstring 'LSP errors' + hook global KakEnd .* lsp-exit } +define-command ide %{ tmux-terminal-horizontal "KAK_SESSION=%val{session} KAK_CLIENT=%val{client} nnn" } # Substitute c-n with tab hook global InsertCompletionShow .* %{ try %{ @@ -93,6 +116,15 @@ set global tabstop 4 add-highlighter global/ number-lines add-highlighter global/ wrap +plug "andreyorst/kaktree" config %{ + hook global WinSetOption filetype=kaktree %{ + remove-highlighter buffer/numbers + remove-highlighter buffer/matching + remove-highlighter buffer/wrap + remove-highlighter buffer/show-whitespaces + } + kaktree-enable +} # system clipboard usermode map global user y 'xclip -in -selection clipboard >&- 2>&-' \ -docstring 'Copy selected text to system clipboard'