diff --git a/dotfiles/kak/hooks.kak b/dotfiles/kak/hooks.kak index d3fcd26..d993484 100644 --- a/dotfiles/kak/hooks.kak +++ b/dotfiles/kak/hooks.kak @@ -5,10 +5,6 @@ hook global NormalIdle .* %{ try %{ git show-diff } } -hook global NormalIdle .* %{ - source ~/.config/kak/colors.kak -} -group source-colors - hook global BufOpenFile .* %{ modeline-parse } diff --git a/dotfiles/kak/kakrc b/dotfiles/kak/kakrc index c18f883..df9ee47 100644 --- a/dotfiles/kak/kakrc +++ b/dotfiles/kak/kakrc @@ -7,7 +7,7 @@ set global scrolloff 8,8 -add-highlighter global/ wrap +try %{add-highlighter global/ wrap} source "%val{config}/plug.kak" source "%val{config}/keys.kak" diff --git a/dotfiles/kak/plug.kak b/dotfiles/kak/plug.kak index 2092a86..696ebc6 100644 --- a/dotfiles/kak/plug.kak +++ b/dotfiles/kak/plug.kak @@ -38,7 +38,7 @@ plug 'kak-lsp/kak-lsp' config %{ # lsp-inlay-diagnostics-enable global hook global NormalIdle .* %{try lsp-highlight-references} - hook global BufCreate .* lsp-enable + hook global BufCreate .* %{try lsp-enable} hook global WinSetOption filetype=(c|cpp|rust|python) lsp-auto-hover-enable hook global WinSetOption filetype=rust %{ diff --git a/dotfiles/kak/usermode.kak b/dotfiles/kak/usermode.kak index a19753e..2bfab69 100644 --- a/dotfiles/kak/usermode.kak +++ b/dotfiles/kak/usermode.kak @@ -1,5 +1,13 @@ # {{@@ header() @@}} +try %{ + declare-user-mode surround + declare-user-mode git + declare-user-mode find +} + +map global user 'w' ': write' -docstring 'write buffer' +map global user 'u' ': config-source' -docstring 'source configuration' map global user 'g' ': enter-user-mode lsp' -docstring 'lsp mode' map global user 'z' ':zoxide ' -docstring 'zoxide' @@ -14,14 +22,12 @@ map global user 'p' ' wl-paste -n ' -docstring 'clipboard paste' map global user 'P' '! wl-paste -n ' -docstring 'clipboard paste before' map global user 'R' '"_d! wl-paste -n ' -docstring 'clipboard replace' -declare-user-mode surround map global user 's' ': enter-user-mode surround' -docstring 'surround mode' map global surround 's' ': surround' -docstring 'surround' map global surround 'c' ': change-surround' -docstring 'change' map global surround 'd' ': delete-surround' -docstring 'delete' map global surround 'x' ': select-surround' -docstring 'select surround' -declare-user-mode git map global user 'v' ': enter-user-mode git' -docstring 'git vcs mode' map global git 's' ': git status' -docstring 'status' map global git 'a' ': git add' -docstring 'add current' @@ -34,7 +40,6 @@ map global git 'c' ': git commit -v' -docstring 'commit' map global git 'n' ': git next-hunk ' -docstring 'next hunk' map global git 'p' ': git prev-hunk ' -docstring 'previous hunk' -declare-user-mode find map global user 'f' ': enter-user-mode find' -docstring 'find mode' map global find 'f' ': find_file' -docstring 'file' map global find 'r' ': find_ripgrep' -docstring 'ripgrep all file' @@ -43,43 +48,51 @@ map global find 'c' ': find_dir' -docstring 'change dir' map global find 'b' ': find_buffer' -docstring 'find buffer' map global find 'd' ': find_delete' -docstring 'file to delete' +try %{ -define-command -hidden find_file \ -%{ edit -existing %sh{ - test "$PWD" -ne "$HOME" && args="-H" - fd -HE .git -tf "$args" | sed "/.git\//d" | wdmenu -} } + define-command -hidden find_file \ + %{ edit -existing %sh{ + test "$PWD" -ne "$HOME" && args="-H" + fd -HE .git -tf "$args" | sed "/.git\//d" | wdmenu + } } -define-command -hidden find_delete \ -%{ nop %sh{ - test "$PWD" -ne "$HOME" && args="-H" - fd -tf "$args" | sed "/.git\//d" | wdmenu | xargs trash -} } + define-command -hidden find_delete \ + %{ nop %sh{ + test "$PWD" -ne "$HOME" && args="-H" + fd -tf "$args" | sed "/.git\//d" | wdmenu | xargs trash + } } -define-command -hidden find_git_file \ -%{ edit -existing %sh{ git ls-files | wdmenu } } + define-command -hidden find_git_file \ + %{ edit -existing %sh{ git ls-files | wdmenu } } -define-command -hidden find_dir \ -%{ cd %sh{ fd -Htd | wdmenu } } + define-command -hidden find_dir \ + %{ cd %sh{ fd -Htd | wdmenu } } -define-command -hidden find_buffer \ -%{ buffer %sh{ - printf "%s\n" $kak_buflist | wdmenu -} } + define-command -hidden find_buffer \ + %{ buffer %sh{ + printf "%s\n" $kak_buflist | wdmenu + } } -define-command -hidden find_ripgrep \ -%{ eval %sh{ - patter=$( wdmenu -p "Regex") - rg --column -n "$patter" | wdmenu | - perl -ne 'print "edit \"$1\" \"$2\" \"$3\" " if /(.+):(\d+):(\d+):/' -} } + define-command -hidden find_ripgrep \ + %{ eval %sh{ + patter=$( wdmenu -p "Regex") + rg --column -n "$patter" | wdmenu | + perl -ne 'print "edit \"$1\" \"$2\" \"$3\" " if /(.+):(\d+):(\d+):/' + } } + + + define-command -params .. \ + -shell-script-candidates 'zoxide query -l' \ + zoxide \ + %{ + cd %sh{ zoxide query -- "$@" || echo "$@" } + echo %sh{ pwd | sed "s|$HOME|~|" } + } + + define-command config-source \ + %{ + source "%val{config}/kakrc" + } -define-command -params .. \ --shell-script-candidates 'zoxide query -l' \ -zoxide \ -%{ - cd %sh{ zoxide query -- "$@" || echo "$@" } - echo %sh{ pwd | sed "s|$HOME|~|" } } -