eval %sh{ kak-tree-sitter -vvvvv -dks --init $kak_session } colorscheme ashen set-option global ashen_dynamic_cursor true set-option global ashen_eol_cursor true # disable clippy set-option global ui_options terminal_assistant=none hook global ModuleLoaded wayland %{ set-option global termcmd 'footclient sh -c' } # open tutor (needs curl) define-command trampoline -docstring "open a tutorial" %{ evaluate-commands %sh{ tramp_file=$(mktemp -t "kakoune-trampoline.XXXXXXXX") echo "edit -fifo $tramp_file *TRAMPOLINE*" curl -s https://raw.githubusercontent.com/mawww/kakoune/master/contrib/TRAMPOLINE -o "$tramp_file" } } set-option global tabstop 4 set-option global indentwidth 4 set-option global scrolloff 3,3 define-command -override tree-sitter-user-after-highlighter %{ add-highlighter -override buffer/show-matching show-matching # add-highlighter -override buffer/bracket regex [\[\]\(\)\{\}]{1} 0:rgb:737373 } # define-command -override tree-sitter-use-after-highlighter %{ # add-highlighter -override window/bracket regex [\[\]\(\)\{\}]{1} 0:red # } # add-highlighter global/bracket regex [\[\]\(\)\{\}]{1} 0:red add-highlighter global/bracket regex [\[\]\(\)\{\}]{1} 0:rgb:737373 add-highlighter global/ number-lines -hlcursor -relative -separator " " add-highlighter global/ show-whitespaces -lf "" -tab "" -only-trailing add-highlighter global/ show-matching # add-highlighter global/wrap wrap -word -indent declare-user-mode ui map -docstring "UI" global user u ": enter-user-mode ui" define-command ui-wrap-enable -docstring "enable wrap" %{ add-highlighter window/wrap wrap -word -indent echo -markup "{Information}wrap enabled" } define-command ui-wrap-disable -docstring "disable wrap" %{ remove-highlighter window/wrap echo -markup "{Information}wrap disabled" } define-command -override ui-wrap-toggle -docstring "toggle wrap" %{ try %{ ui-wrap-enable } catch %{ ui-wrap-disable } } map -docstring "toggle soft wrap" global ui w ": ui-wrap-toggle" declare-option str base_scrolloff %opt{scrolloff} define-command ui-scrolloff-toggle -docstring "toggle scrolloff" %{ evaluate-commands %sh{ CUR="$kak_opt_scrolloff" IFS=, read TARG HOR <<<$kak_opt_base_scrolloff IFS=, read VSCROLL _ <<<$kak_opt_scrolloff if [ "$VSCROLL" = 99 ]; then final="$TARG,$HOR" else final="99,$HOR" fi echo "set-option window scrolloff $final" } } map -docstring 'toggle screen centering' global ui z ": ui-scrolloff-toggle" declare-option bool autowrap false define-command autowrap-toggle -docstring "toggle autowrap" %{ evaluate-commands %sh{ if [ "$kak_opt_autowrap" = "true" ]; then echo "autowrap-disable" echo "set-option window autowrap false" else echo "autowrap-enable" echo "set-option window autowrap true" fi } } map -docstring "toggle autowrap" global ui a ": autowrap-toggle" hook global WinCreate .* %{ ui-wrap-enable ui-scrolloff-toggle } map -docstring "yank the selection into the clipboard" global user y " wl-copy" map -docstring "paste the clipboard" global user p " wl-paste -n" map -docstring "paste the clipboard before" global user P "! wl-paste -n" map -docstring "replace with the clipboard" global user R '"_d! wl-paste -n' map -docstring "quit" global user q ":q" map -docstring "save" global normal ": w" map -docstring "close current buffer" global user x ": db" map -docstring "goto previous buffer" global user m ": bp" map -docstring "goto next buffer" global user i ": bn" # map global normal X "x" # map global normal ":exec vv" # map global normal ":exec vv" map global normal _ # map global normal # map global normal 'p' map -docstring "commenct line" global normal ":comment-line" declare-user-mode git map -docstring "git" global user g ": enter-user-mode git" map -docstring "lazygit kak cwd" global git g ": terminal lazygit" map -docstring "lazygit buffer directory" global git G %{ evaluate-commands terminal "lazygit -w %sh{ dirname "$kak_buffile" }" } def git_blame %{ info %sh{ git -C $(dirname $(realpath $kak_buffile)) blame -L $kak_cursor_line,$kak_cursor_line $(realpath $kak_buffile) } } map -docstring "blame" global git b ": git_blame" map -docstring "format" global user F ": format" # Case-insensitive Search map -docstring 'case insensitive search' global user '/' /(?i) map -docstring 'case insensitive backward search' global user '' (?i) map -docstring 'case insensitive extend search' global user '?' ?(?i) map -docstring 'case insensitive backward extend-search' global user '' (?i) # Arrow keys for menu selections map -docstring 'Select next menu' global prompt map -docstring 'Select previous menu' global prompt hook global InsertCompletionShow .* %{ map window insert map window insert hook -once window InsertCompletionHide .* %{ unmap window insert unmap window insert } } # a comment # another # commented section