# OPTIONS set-option global startup_info_version 20260412 set-option global ui_options terminal_assistant=none set-option global idle_timeout 300 hook global WinCreate .* %{ add-highlighter window/number-lines number-lines -relative -hlcursor } add-highlighter global/ show-matching # LOCAL nop %sh{ mkdir -p "$kak_config/autoload" [ -e "$kak_config/autoload/stdlib" ] || ln -s "$kak_runtime/autoload" "$kak_config/autoload/stdlib" } map global -docstring 'Buffer' user ' ' ': b ' declare-user-mode file-mode map global -docstring 'Search/open' user 's' ': enter-user-mode file-mode' map global -docstring 'Open (git)' file-mode 'a' ': file-open-git' map global -docstring 'Open (fd)' file-mode 'f' ': file-open' map global -docstring 'Open (recent)' file-mode 'r' ': file-open-recent' map global -docstring 'Open (nnn)' file-mode 'n' ': nnn-open %val{buffile}' map global -docstring 'Open (nnn)' file-mode 'N' ': nnn-open .' map global -docstring 'Open/create in dir' file-mode 'c' ': open-create-in-dir' declare-user-mode git-mode map global -docstring 'Git' user 'g' ': enter-user-mode git-mode' map global -docstring 'Blame' git-mode 'b' ': git blame' map global -docstring 'Blame' git-mode 'B' ': git blame-jump' map global -docstring 'Diff file' git-mode 'd' ': git diff %val{buffile}' map global -docstring 'Diff' git-mode 'D' ': git diff' map global -docstring 'Grep' git-mode 'g' ': git grep ' map global -docstring 'Log' git-mode 'l' ': git log -- %val{buffile}' map global -docstring 'Log' git-mode 'L' ': git log' map global -docstring 'Show branch' git-mode 'c' ': git show-branch' map global -docstring 'Status' git-mode 't' ': git status' map global -docstring 'Show diff' git-mode 's' ': git-show-diff' map global -docstring 'Hide diff' git-mode 'h' ': git-hide-diff' map global -docstring 'Next hunk' git-mode 'n' ': git next-hunk' map global -docstring 'Prev hunk' git-mode 'p' ': git prev-hunk' declare-user-mode options-mode map global -docstring 'Options' user 'o' ': enter-user-mode options-mode' map global -docstring 'Five Dark mode' options-mode 'd' ': colorscheme five-colors-dark' map global -docstring 'Five Light mode' options-mode 'l' ': colorscheme five-colors-light' map global -docstring 'Light mode' options-mode 'L' ': colorscheme one-light' map global -docstring 'Dark mode' options-mode 'D' ': colorscheme one-darker' declare-user-mode make-mode map global -docstring 'Make' user 'k' ': enter-user-mode make-mode' map global -docstring 'Make' make-mode 'a' ':make ' map global -docstring 'Next' make-mode 'n' ': make-next-error' map global -docstring 'Previous' make-mode 'p' ': make-previous-error' map global -docstring 'General messages' make-mode 'g' ': set window make_error_pattern "^([^:\n]+):(\d+):(?:(\d+):)? ([^\n]+)?"' evaluate-commands %sh{ if [ -n "$WAYLAND_DISPLAY" ]; then echo " map global -docstring 'Paste clipboard (append)' user 'p' ' wl-paste -n' map global -docstring 'Paste clipboard (insert)' user 'P' '! wl-paste -n' map global -docstring 'Yank to clipboard' user 'y' ' wl-copy' " elif [ -n "$DISPLAY" ]; then echo " map global -docstring 'Paste clipboard (append)' user 'p' ' xsel -bo' map global -docstring 'Paste clipboard (insert)' user 'P' '! xsel -bo' map global -docstring 'Yank to clipboard' user 'y' ' xsel -bi' " fi } map global -docstring 'Replace jump mode' user 'j' ': enter_jump_mode_with_replace_select_mode' map global -docstring 'Extend jump mode' user 'e' ': enter_jump_mode_with_extend_select_mode' map global -docstring 'Append jump mode' user 'a' ': enter_jump_mode_with_append_select_mode' define-command -override file-open %{ prompt -menu -shell-script-candidates %{ fd -t f } 'File: ' %{ edit -- %val{text} } } define-command -override file-open-git %{ prompt -menu -shell-script-candidates %{ git ls-files } 'File (git): ' %{ edit -- %val{text} } } define-command -override file-open-recent %{ prompt -menu -shell-script-candidates %{ cat ~/.cache/kak-mru } 'File (recent): ' %{ edit -- %val{text} } } define-command -override -params 1 nnn-open %{ terminal nnn-kak-edit %arg{1} %val{session} %val{client} } define-command -override open-create-in-dir %{ execute-keys ': edit ' %sh{dirname "$kak_buffile"}/ } define-command git-log-show-current-commit %{ execute-keys ';^commit\s[0-9a-f]+b' git show %val{selection} } define-command -override git-show-diff %{ hook buffer -group git-show-diff NormalIdle .* %{ git update-diff } git show-diff } define-command -override git-hide-diff %{ remove-hooks buffer git-show-diff git hide-diff } set-face global JumpLabel 'rgb:faf8f5,rgb:af8842+F' # CHANGE STATUS BAR COLOR IN INSERT MODE hook global ModeChange push:.*:insert %{ set-face window StatusLine 'default,rgb:04785d' } hook global ModeChange pop:insert:.* %{ unset-face window StatusLine } # ODIN hook global BufSetOption filetype=odin %{ set-option buffer formatcmd 'odinfmt -stdin' } # LSP eval %sh{kak-lsp} lsp-enable set-option global modelinefmt "%opt{lsp_modeline} %opt{modelinefmt}" map global user l ': enter-user-mode lsp' -docstring 'LSP mode' map global goto d :lsp-definition -docstring 'LSP definition' map global goto r :lsp-references -docstring 'LSP references' map global goto y :lsp-type-definition -docstring 'LSP type definition' map global insert ':try lsp-snippets-select-next-placeholders catch %{ execute-keys -with-hooks tab> }' -docstring 'Select next snippet placeholder' map global object a 'lsp-object' -docstring 'LSP any symbol' map global object 'lsp-object' -docstring 'LSP any symbol' map global object f 'lsp-object Function Method' -docstring 'LSP function or method' map global object t 'lsp-object Class Interface Module Namespace Struct' -docstring 'LSP class or module' map global object d 'lsp-diagnostic-object error warning' -docstring 'LSP errors and warnings' map global object D 'lsp-diagnostic-object error' -docstring 'LSP errors' map global lsp p ': lsp-find-error --previous error' -docstring 'find previous error' # BUNDLE source "%val{config}/bundle/kak-bundle/rc/kak-bundle.kak" bundle-noload kak-bundle https://codeberg.org/jdugan6240/kak-bundle # COLORSCHEME bundle-theme kak-one 'https://codeberg.org/raiguard/kak-one' bundle-theme kakoune-themes 'https://codeberg.org/anhsirk0/kakoune-themes' # FZF bundle fzf.kak 'https://github.com/andreyorst/fzf.kak' %{ map global -docstring 'FZF menu' user 'f' ': fzf-mode' require-module fzf set-option global fzf_highlight_command "bat" } hook global BufCreate [^*].* %{ nop %sh{ mru=~/.cache/kak-mru echo "$kak_buffile" | awk '!seen[$0]++' - "$mru" | sponge "$mru" }} # MATCH bundle match 'https://github.com/kmafeni04/match.kak' %{ declare-user-mode match map global user m ': enter-user-mode match' -docstring 'Match' map global match m m -docstring 'Match next matching pair' map global match i ': match-inside' -docstring 'Match inside object' map global match a ': match-around' -docstring 'Match around object' map global match n ': match-next' -docstring 'Match next object' map global match p ': match-prev' -docstring 'Match previous object' map global match s ': match-surround-add' -docstring 'Surround selection with character' map global match d ': match-surround-delete' -docstring "Delete selection's surrounding character" map global match r ': match-surround-replace' -docstring "Replace selection's surrounding character" map global match u ': match-surround-undo' -docstring "Undo" map global match U ': match-surround-redo' -docstring "Redo" } # HARPOON bundle kak-harpoon 'https://codeberg.org/raiguard/kak-harpoon' %{ harpoon-add-bindings } # PENEIRA bundle 'luar' 'https://github.com/gustavo-hms/luar' %{ require-module luar } bundle 'peneira' 'https://github.com/gustavo-hms/peneira' %{ require-module peneira define-command buffers %{ peneira 'buffers: ' %{ eval "printf '%s\n' $kak_quoted_buflist" } %{ buffer %arg{1} } } define-command peneira-git-files %{ peneira 'git files: ' %{ git ls-files } %{ e %arg{1} } } define-command peneira-recent-files %{ peneira 'mru files: ' %{ cat ~/.cache/kak-mru } %{ e %arg{1} } } map global -docstring 'Buffer' user ' ' ': buffers' map global -docstring 'Git files' file-mode 'a' ': peneira-git-files' map global -docstring 'Buffers' file-mode 'b' ': buffers' map global -docstring 'Files' file-mode 'f' ': peneira-files' map global -docstring 'Files' file-mode 'F' ': peneira-local-files' map global -docstring 'Lines' file-mode 'l' ': peneira-lines' map global -docstring 'Symbols' file-mode 's' ': peneira-symbols' map global -docstring 'Recent files' file-mode 'r' ': peneira-recent-files' } # LOCAL colorscheme %sh{ if [ -e ~/.lightmode ]; then echo five-colors-light else echo five-colors-dark fi }