My config dot files
# Plugin manager
source "%val{config}/plugins/plug.kak/rc/plug.kak"
plug "andreyorst/plug.kak" noload
plug "kak-lsp/kak-lsp" do %{
    cargo install --locked --force --path .
} config %{
    hook global WinSetOption filetype=(rust|haskell) %{
        lsp-enable-window
    }

    hook global WinSetOption filetype=rust %{
        hook window -group rust-inlay-hints BufReload .* rust-analyzer-inlay-hints
        hook window -group rust-inlay-hints NormalIdle .* rust-analyzer-inlay-hints
        hook window -group rust-inlay-hints InsertIdle .* rust-analyzer-inlay-hints
        hook -once -always window WinSetOption filetype=.* %{
            remove-hooks window rust-inlay-hints
        }
    }

    map global user l %{: enter-user-mode lsp<ret>} -docstring "LSP mode"

    set global lsp_auto_highlight_references true
}
plug "raiguard/one.kak" theme config %{
    colorscheme one-dark
}
plug "chambln/kakoune-kit" config %{
    map global user g ': git status -bs<ret>' -docstring 'git status'
    hook global WinSetOption filetype=git-status %{
        map window normal c ': git commit --verbose '
        map window normal l ': git log --oneline --graph<ret>'
        map window normal d ': -- %val{selections}<a-!><home> git diff '
        map window normal D ': -- %val{selections}<a-!><home> git diff --cached '
        map window normal a ': -- %val{selections}<a-!><home> git add '
        map window normal A ': -- %val{selections}<a-!><home> repl git add -p '
        map window normal r ': -- %val{selections}<a-!><home> git reset '
        map window normal R ': -- %val{selections}<a-!><home> repl git reset -p '
        map window normal o ': -- %val{selections}<a-!><home> git checkout '
    }
    hook global WinSetOption filetype=git-log %{
        map window normal d     ': %val{selections}<a-!><home> git diff '
        map window normal <ret> ': %val{selections}<a-!><home> git show '
        map window normal r     ': %val{selections}<a-!><home> git reset '
        map window normal R     ': %val{selections}<a-!><home> repl git reset -p '
        map window normal o     ': %val{selections}<a-!><home> git checkout '
    }
}

plug "alexherbo2/surround.kak" %{
    map global user s ':enter-surround-mode<ret>' -docstring "Surround selection"
}

plug "delapouite/kakoune-buffers" %{
    map global normal ^ q
    map global normal <a-^> Q
    map global normal q b
    map global normal Q B
    map global normal <a-q> <a-b>
    map global normal <a-Q> <a-B>
    map global normal b ': enter-buffers-mode<ret>' -docstring 'buffers'
    map global normal B ': enter-user-mode -lock buffers<ret>' -docstring 'buffers (lock)'

    hook global WinDisplay .* info-buffers

    map global user b ':enter-buffers-mode<ret>'              -docstring 'buffers…'
    map global user B ':enter-user-mode -lock buffers<ret>'   -docstring 'buffers (lock)…'

    alias global bd delete-buffer
    alias global bf buffer-first
    alias global bl buffer-last
    alias global bo buffer-only
    alias global bo! buffer-only-force
}

plug "alexherbo2/auto-pairs.kak" config %{
    enable-auto-pairs
}
plug "andreyorst/smarttab.kak" config %{
    hook global BufCreate .* expandtab
}
plug "TeddyDD/kakoune-wiki" config %{
    wiki-setup %sh{ echo $HOME/wiki }
}

plug "wgaffa/kak-unicode" %{
}

plug "occivink/kakoune-filetree" %{
    set global filetree_find_cmd 'find . -not -type d -and -not -path "*/.*" -and -not -path "./target/*"' 
    map global user f ':filetree-edit ' -docstring "Edit file"
}

# System clipboard
map global user y '<a-|>win32yank.exe -i<ret>' -docstring "Yank to system"
map global user P '!win32yank.exe -o --lf<ret>' -docstring "Paste before"
map global user p '<a-!>win32yank.exe -o --lf<ret>' -docstring "Paste after"
map global user R '|xsel --output --clipboard<ret>' -docstring "Replace with clipboard"

hook global RegisterModified '"' %{ nop %sh{
    printf %s "$kak_main_reg_dquote" | win32yank.exe -i
}}

# Remove indentation when pressing backspace
hook global WinCreate .* %{
    remove-hooks window manual-indent-spaces

    hook -group manual-indent-spaces window InsertDelete ' ' manual-indent-space-deleted
}

define-command -override -hidden manual-indent-space-deleted %{
    try %{
        execute-keys -draft 'h<a-h><a-k>\A\h+\z<ret>i<space><esc><lt>'
    }
}

# Snippet customization
map global insert <c-k> '<a-;>:lsp-snippets-select-next-placeholders<ret>' -docstring 'Select next snippet placeholder'

set-option global tabstop 4

hook global WinSetOption filetype=haskell %{
    set-option buffer indentwidth 2
    set-option buffer tabstop 2
}

set-option global ui_options terminal_assistant=none terminal_status_on_top=true

add-highlighter global/ show-matching
add-highlighter global/ number-lines -relative -min-digits 3
add-highlighter global/ column 90 MenuBackground

map global normal <c-space> <a-space>

define-command -override -docstring "vsplit [<commands>]: split tmux vertically" \
vsplit -params .. -command-completion %{
    tmux-terminal-horizontal kak -c %val{session} -e "%arg{@}"
}

define-command -override -docstring "split [<commands>]: split tmux horizontally" \
split -params .. -command-completion %{
    tmux-terminal-vertical kak -c %val{session} -e "%arg{@}"
}

define-command -override -docstring "tabnew [<commands>]: create new tmux window" \
tabnew -params .. -command-completion %{
    tmux-terminal-window kak -c %val{session} -e "%arg{@}"
}

# Uncomment if I ever need this again, atm I don't
# source "%val{config}/reschedule/reschedule.kak"

map -docstring "Replace word with it's corresponding unicode character" \
global normal <a-u> "<a-i>w|uecho<ret>"

map -docstring "Comment line" \
global user c ":comment-line<ret>"

set-option global autocomplete prompt