From 34b97cae068909ad2cd49fb142fbd42bbdac1653 Mon Sep 17 00:00:00 2001 From: Davide Oddone Date: Wed, 29 Nov 2023 14:57:11 +0000 Subject: [PATCH 1/2] kakrc modified --- kakrc | 39 +++++++++++---------------------------- 1 file changed, 11 insertions(+), 28 deletions(-) diff --git a/kakrc b/kakrc index 3c5c810..f57ef48 100644 --- a/kakrc +++ b/kakrc @@ -1,7 +1,7 @@ # Load plug.kak source "%val{config}/plugins/plug.kak/rc/plug.kak" +plug "alexherbo2/auto-pairs.kak" plug "andreyorst/plug.kak" noload -# plug kak-lsp plug "kak-lsp/kak-lsp" do %{ cargo build --release --locked cargo install --force --path . @@ -22,7 +22,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|cc|rust|javascript|typescript) %{ + hook global WinSetOption filetype=(c|cpp|sh|cc|rust|javascript|typescript|go) %{ set-option window lsp_auto_highlight_references true set-option window lsp_hover_anchor false lsp-auto-hover-enable @@ -85,6 +85,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' @@ -94,29 +103,3 @@ map global user p 'xclip -out -selection clipboard' \ -docstring 'Paste system clipboard after' map global user R '|xclip -out -selection clipboard' \ -docstring 'Replace selection from system clipboard' - -## TESTING: copy and paste from TMUX -#if [ -n "$DISPLAY" ]; then -## printf %s "$kak_main_reg_dquote" | xsel --input --clipboard -#elif [ -n "$TMUX" ]; then -# map global user y 'tmux set-buffer --' -#fi -## Enable different options depending if we are inside TMUX or not -#try %{ -# evaluate-commands %sh{ [ $tmux ] || echo "fail" } -# try %{ -# hook global registermodified '"' %{ nop %sh{ -# tmux set-buffer -- "$kak_main_reg_dquote" -# }} -# map global user p '!tmux show-buffer' -# map global user p 'tmux show-buffer' -# map global user r '|tmux show-buffer' -# } -#} catch %{ -# try %{ -# map global user y 'xclip -in -selection clipboard >&- 2>&-' -# map global user p '!xclip -out -selection clipboard' -# map global user p 'xclip -out -selection clipboard' -# map global user r '|xclip -out -selection clipboard' -# } -#} From 654fc2ee7b70028f3223540fbce41fe905828342 Mon Sep 17 00:00:00 2001 From: Davide Oddone Date: Thu, 7 Dec 2023 13:52:36 +0000 Subject: [PATCH 2/2] Cloud version of the kakrc --- kakrc | 34 ++++++++++++++++++++++------------ 1 file changed, 22 insertions(+), 12 deletions(-) diff --git a/kakrc b/kakrc index f57ef48..b712be8 100644 --- a/kakrc +++ b/kakrc @@ -22,9 +22,10 @@ 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|cc|rust|javascript|typescript|go) %{ + hook global WinSetOption filetype=(c|cpp|sh|cc|rust|javascript|typescript|go|python) %{ set-option window lsp_auto_highlight_references true set-option window lsp_hover_anchor false + map window insert lsp-next-location lsp-auto-hover-enable echo -debug "Enabling LSP for filtetype %opt{filetype}" lsp-enable-window @@ -42,20 +43,29 @@ plug "kak-lsp/kak-lsp" do %{ } } + 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 } # Substitute c-n with tab -hook global InsertCompletionShow .* %{ - try %{ - execute-keys -draft 'h\h' - map window insert - map window insert - hook -once -always window InsertCompletionHide .* %{ - map window insert - map window insert - } - } -} +#hook global InsertCompletionShow .* %{ +# try %{ +# execute-keys -draft 'h\h' +# map window insert +# map window insert +# hook -once -always window InsertCompletionHide .* %{ +# map window insert +# map window insert +# } +# } +#} # enable auto pair closing enable-auto-pairs # yaml linter