]> Freerunner's - dotfiles.git/commitdiff
kak: add kak-lsp, also fix kkga/kks
authorAndre Ramnitz <tux.rising@gmail.com>
Wed, 27 Nov 2024 23:00:49 +0000 (00:00 +0100)
committerAndre Ramnitz <tux.rising@gmail.com>
Wed, 27 Nov 2024 23:01:17 +0000 (00:01 +0100)
dot-config/kak/kakrc

index 759dc10067c2a742cbdad4523c67f4f700c12c1a..0875b5ac601110d740d4e39cbc907dafbeb1c752 100644 (file)
@@ -11,7 +11,6 @@ def import -override -params 1 %{
     source %sh{echo ${kak_config}/$1.kak}
 }
 
-
 # Clipboard (wayland) integration
 # ───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
 hook global NormalKey y %{ nop %sh{
@@ -50,9 +49,24 @@ hook global WinCreate [^*].* %{
 
 # session manager integration (kkga/kks)
 # ───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
-evaluate-commands %sh{
-    kks init
-}
+evaluate-commands %sh{ kks init }
+# define-command -override kks-connect -params 1.. -command-completion  %{
+#   %arg{1} sh -c %{
+#     export EDITOR='kks edit'
+#     export KKS_SESSION=$1
+#     export KKS_CLIENT=$2
+#     shift 3
+
+#     [ $# = 0 ] && set "$SHELL"
+
+#     "$@"
+#   } -- %val{session} %val{client} %arg{@}
+# }
+
+# kak-lsp integration
+# ───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
+evaluate-commands %sh{ kak-lsp }
+lsp-enable
 
 # Enable PLUGin manager
 # ───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
@@ -263,13 +277,13 @@ hook -always global PromptIdle '' update_hex_color_code_ranges2
 # normal mode kks mappings
 # ───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
 map global normal -docstring 'terminal'                                <c-t>  ': kks-connect terminal<ret>'
-map global normal -docstring 'files'                                   <c-f>  ': kks-connect terminal-popup kks-files<ret>'
-map global normal -docstring 'buffers'                                 <c-b>  ': kks-connect terminal-popup kks-buffers<ret>'
-map global normal -docstring 'live grep'                               <c-g>  ': kks-connect terminal-popup kks-grep<ret>'
-map global normal -docstring 'lines in buffer'                         <c-l>  ': kks-connect terminal-popup kks-lines<ret>'
-map global normal -docstring 'recent files'                            <c-r>  ': kks-connect terminal-popup kks-mru<ret>'
-map global normal -docstring 'vcs client'                              <c-v>  ': kks-connect terminal-popup lazygit<ret>'
-map global normal -docstring 'file browser'                            <c-h>  ': kks-connect terminal-panel kks-lf<ret>'
+map global normal -docstring 'files'                                   <c-f>  ': kks-connect popup kks-files<ret>'
+map global normal -docstring 'buffers'                                 <c-b>  ': kks-connect popup kks-buffers<ret>'
+map global normal -docstring 'live grep'                               <c-g>  ': kks-connect popup kks-grep<ret>'
+map global normal -docstring 'lines in buffer'                         <c-l>  ': kks-connect popup kks-lines<ret>'
+map global normal -docstring 'recent files'                            <c-r>  ': kks-connect popup kks-mru<ret>'
+map global normal -docstring 'vcs client'                              <c-v>  ': kks-connect popup lazygit<ret>'
+map global normal -docstring 'file browser'                            <c-h>  ': kks-connect popup kks-lf<ret>'
 
 # normal mode additional mappings
 # ───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
@@ -303,6 +317,17 @@ map global user -docstring 'relative line numbers enable'                r  ': a
 map global user -docstring 'relative line numbers disable'               R  ': rmhl window/nl<ret>'
 map global user -docstring 'help command mode enable'                    h  ': set -add global autoinfo normal<ret>'
 map global user -docstring 'help command mode disable'                   H  ': set -remove global autoinfo normal<ret>'
+map global user l ':enter-user-mode lsp<ret>' -docstring 'LSP mode'
+
+# kak-lsp keys
+# ───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
+map global insert <tab> '<a-;>:try lsp-snippets-select-next-placeholders catch %{ execute-keys -with-hooks <lt>tab> }<ret>' -docstring 'Select next snippet placeholder'
+map global object a '<a-semicolon>lsp-object<ret>' -docstring 'LSP any symbol'
+map global object <a-a> '<a-semicolon>lsp-object<ret>' -docstring 'LSP any symbol'
+map global object f '<a-semicolon>lsp-object Function Method<ret>' -docstring 'LSP function or method'
+map global object t '<a-semicolon>lsp-object Class Interface Struct<ret>' -docstring 'LSP class interface or struct'
+map global object d '<a-semicolon>lsp-diagnostic-object --include-warnings<ret>' -docstring 'LSP errors and warnings'
+map global object D '<a-semicolon>lsp-diagnostic-object<ret>' -docstring 'LSP errors'
 
 # buffer user mode
 # ───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
@@ -326,16 +351,17 @@ map global selmode -docstring 'clean tabs and trailing whitespaces'      C  ': c
 map global selmode -docstring 'sort words Horizontally in selection'     h  '| xargs -n1 | sort -u | xargs <ret>'
 map global selmode -docstring 'sort words Vertically in selection '      v  '| sort -n  <ret>'
 map global selmode -docstring 'surround'                                 s  ':surround<ret>'
-map global selmode -docstring 'change surround'                             c  ':change-surround<ret>'
-map global selmode -docstring 'delete surround'                             d  ':delete-surround<ret>'
-map global selmode -docstring 'select tag'                                  t  ':select-surrounding-tag<ret>'
+map global selmode -docstring 'change surround'                          c  ':change-surround<ret>'
+map global selmode -docstring 'delete surround'                          d  ':delete-surround<ret>'
+map global selmode -docstring 'select tag'                               t  ':select-surrounding-tag<ret>'
 
 # terminal config (via foot.kak)
 # ───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
-set-option global foot_normal_cmd 'footclient'
-set-option global foot_popup_cmd 'footclient'
-set-option global foot_panel_cmd 'footclient'
+set-option global foot_normal_cmd 'foot'
+set-option global foot_popup_cmd 'foot'
+set-option global foot_panel_cmd 'foot'
 set-option global foot_normal_flags ''
-set-option global foot_popup_flags '-a kakpopup' '-W 250x50'
-set-option global foot_panel_flags '-a kakpopup' '-W 400x1'
+set-option global foot_popup_flags '--app-id=kakpopup' '--window-size-chars=240x40'
+# set-option global foot_popup_flags '--app-id=kakpopup'
+set-option global foot_panel_flags '--app-id=kakpopup'