diff --git a/.config/kak/autoload/lsp.kak b/.config/kak/autoload/lsp.kak index cc264568..d1eb9caa 100644 --- a/.config/kak/autoload/lsp.kak +++ b/.config/kak/autoload/lsp.kak @@ -26,6 +26,28 @@ set-option global lsp_debug false # list of filetypes for which LSP will be activated in the window scope declare-option str-list lsp_filetypes python go rust bash fish c cpp typst markdown yaml json jsonc bash sh +declare-option -hidden bool inlay_enabled false + +define-command -hidden inlay-on %{ + lsp-inlay-hints-enable window + set-option window inlay_enabled true +} + +define-command -hidden inlay-off %{ + lsp-inlay-hints-disable window + set-option window inlay_enabled false +} + +define-command -hidden inlay-toggle %{ + evaluate-commands %sh{ + if [ "$kak_opt_inlay_enabled" = "true" ]; then + echo "inlay-off" + else + echo "inlay-on" + fi + } +} + define-command -hidden lsp-filetype-hooks-update %{ try %{ remove-hooks global lsp-filetypes } # convert the str-list into regex of form (a|b|c|...) @@ -34,7 +56,13 @@ define-command -hidden lsp-filetype-hooks-update %{ }~ %{ # commands to execute for lsp window settings lsp-enable-window - lsp-inlay-hints-enable window + inlay-on + try %{ + # only map to UI mode if that module is available + map -docstring 'toggle inlay hints' window ui h ': inlay-toggle' + } catch %{ + map -docstring 'toggle inlay hints' window lsp ': inlay-toggle' + } } } lsp-filetype-hooks-update diff --git a/.config/kak/autoload/toggle.kak b/.config/kak/autoload/toggle.kak new file mode 100644 index 00000000..505a4f0e --- /dev/null +++ b/.config/kak/autoload/toggle.kak @@ -0,0 +1,5 @@ +# module provides utils for toggling stuff lol +provide-module toggle %~ + + +~