kak: make it possible to source multiple times
This commit is contained in:
parent
338cf0147a
commit
71dc842211
|
@ -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
|
||||
}
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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 %{
|
||||
|
|
|
@ -1,5 +1,13 @@
|
|||
# {{@@ header() @@}}
|
||||
|
||||
try %{
|
||||
declare-user-mode surround
|
||||
declare-user-mode git
|
||||
declare-user-mode find
|
||||
}
|
||||
|
||||
map global user 'w' ': write<ret>' -docstring 'write buffer'
|
||||
map global user 'u' ': config-source<ret>' -docstring 'source configuration'
|
||||
map global user 'g' ': enter-user-mode lsp<ret>' -docstring 'lsp mode'
|
||||
map global user 'z' ':zoxide ' -docstring 'zoxide'
|
||||
|
||||
|
@ -14,14 +22,12 @@ map global user 'p' '<a-!> wl-paste -n <ret>' -docstring 'clipboard paste'
|
|||
map global user 'P' '! wl-paste -n <ret>' -docstring 'clipboard paste before'
|
||||
map global user 'R' '"_d! wl-paste -n <ret>' -docstring 'clipboard replace'
|
||||
|
||||
declare-user-mode surround
|
||||
map global user 's' ': enter-user-mode surround<ret>' -docstring 'surround mode'
|
||||
map global surround 's' ': surround<ret>' -docstring 'surround'
|
||||
map global surround 'c' ': change-surround<ret>' -docstring 'change'
|
||||
map global surround 'd' ': delete-surround<ret>' -docstring 'delete'
|
||||
map global surround 'x' ': select-surround<ret>' -docstring 'select surround'
|
||||
|
||||
declare-user-mode git
|
||||
map global user 'v' ': enter-user-mode git<ret>' -docstring 'git vcs mode'
|
||||
map global git 's' ': git status<ret>' -docstring 'status'
|
||||
map global git 'a' ': git add<ret>' -docstring 'add current'
|
||||
|
@ -34,7 +40,6 @@ map global git 'c' ': git commit -v<ret>' -docstring 'commit'
|
|||
map global git 'n' ': git next-hunk <ret>' -docstring 'next hunk'
|
||||
map global git 'p' ': git prev-hunk <ret>' -docstring 'previous hunk'
|
||||
|
||||
declare-user-mode find
|
||||
map global user 'f' ': enter-user-mode find<ret>' -docstring 'find mode'
|
||||
map global find 'f' ': find_file<ret>' -docstring 'file'
|
||||
map global find 'r' ': find_ripgrep<ret>' -docstring 'ripgrep all file'
|
||||
|
@ -43,43 +48,51 @@ map global find 'c' ': find_dir<ret>' -docstring 'change dir'
|
|||
map global find 'b' ': find_buffer<ret>' -docstring 'find buffer'
|
||||
map global find 'd' ': find_delete<ret>' -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|~|" }
|
||||
}
|
||||
|
||||
|
|
Reference in a new issue