diff --git a/.config/kak/kakrc b/.config/kak/kakrc new file mode 100644 index 0000000..5754210 --- /dev/null +++ b/.config/kak/kakrc @@ -0,0 +1,117 @@ +######### +# Plugins +# Install plug.kak with: git clone https://github.com/andreyorst/plug.kak.git ~/.config/kak/plugins/plug.kak +source "%val{config}/plugins/plug.kak/rc/plug.kak" +plug "andreyorst/plug.kak" +plug "andreyorst/fzf.kak" +plug "alexherbo2/search-highlighter.kak" +plug "alexherbo2/auto-pairs.kak" +plug "alexherbo2/move-line.kak" +plug "jwhett/sxhkdrc-kak" +plug "occivink/kakoune-expand" + + +############ +# Appearance +colorscheme gruvbox +# Make everything transparent +set-face global Default default,default +set-face global BufferPadding default,default +set-face global StatusLine default,default+bu +set-face global StatusLineMode default,default +set-face global StatusLineInfo default,default +set-face global StatusLineValue default,default + +add-highlighter global/ number-lines -hlcursor +add-highlighter global/ wrap -word -indent +add-highlighter global/ regex \b(TODO|FIXME|XXX|NOTE|BUG|DEBUG|TBD|HACK)\b 0:default+rb + +set-option global tabstop 2 +set-option global indentwidth 2 +set-option global aligntab false +set-option global ui_options ncurses_assistant=none + +############## +# Key bindings +# map global normal p "xsel --output --clipboard" -docstring "insert from clipboard" +# map global normal P "!xsel --output --clipboard" -docstring "append from clipboard" + +map global normal "" " ;" -docstring "remove all selections except main and reduce it to cursor" +map global normal "#" ": comment-line" -docstring "toggle line comment" +map global normal ": comment-line" -docstring "toggle line comment" +map global normal ": fzf-mode" -docstring "show fzf" + +# Arrows bindings +map global normal "w" +map global normal "b" + +# Case insensitive search +map global normal / "/(?i)" +map global normal ? "?(?i)" + +# map global user s ": surround" -docstring "surround text" + +map global normal "" ": move-line-above" -docstring "move line above" +map global normal "'" ": move-line-below" -docstring "move line below" + +map global normal + ": expand" -docstring "expand selection" + + +####### +# Hooks +# Yank copies text to X clipboard +# hook global NormalKey y|d|c %{ nop %sh{ +# printf %s "$kak_main_reg_dquote" | xsel --input --clipboard +# }} + +# Spaces instead of tabs +hook global InsertChar \t %{ try %{ + execute-keys -draft h %opt{indentwidth}@ +}} + +# Enable / for insert completion selection +hook global InsertCompletionShow .* %{ + map window insert + map window insert +} +hook global InsertCompletionHide .* %{ + unmap window insert + unmap window insert +} + +# Remove trailing whitespace on save +hook global BufWritePre .* %{ + try %{ execute-keys -draft \%s\h+$d } +} + +# Hightlight word under the cursor +declare-option -hidden regex curword +set-face global CurWord default,rgb:4a4a4a + +hook global NormalIdle .* %{ + eval -draft %{ try %{ + exec w \A\w+\z + set-option buffer curword "\b\Q%val{selection}\E\b" + } catch %{ + set-option buffer curword "" + } } +} +add-highlighter global/ dynregex "%opt{curword}" 0:CurWord + + +############ +# File types +hook global WinSetOption filetype=python %{ + set-option buffer tabstop 4 + set-option buffer indentwidth 4 + set-option buffer autowrap_column 80 + autowrap-enable +} + +hook global WinSetOption filetype=(markdown|asciidoc) %{ + add-highlighter buffer/ regex \b__(\S+)__\b 0:default+u + # add-highlighter buffer/ regex \*(\w+(?!\*\*))\* 0:default+i + add-highlighter buffer/ regex (?