mirror of
https://gitlab.com/mlunax/dotfiles.git
synced 2025-04-19 16:55:36 +00:00
117 lines
3.5 KiB
Text
117 lines
3.5 KiB
Text
#########
|
|
# 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 "<a-!>xsel --output --clipboard<ret>" -docstring "insert from clipboard"
|
|
# map global normal P "!xsel --output --clipboard<ret>" -docstring "append from clipboard"
|
|
|
|
map global normal "<esc>" " ;<esc>" -docstring "remove all selections except main and reduce it to cursor"
|
|
map global normal "#" ": comment-line<ret>" -docstring "toggle line comment"
|
|
map global normal <a-/> ": comment-line<ret>" -docstring "toggle line comment"
|
|
map global normal <c-p> ": fzf-mode<ret>" -docstring "show fzf"
|
|
|
|
# Arrows bindings
|
|
map global normal <c-right> "w<esc>"
|
|
map global normal <c-left> "b<esc>"
|
|
|
|
# Case insensitive search
|
|
map global normal / "/(?i)"
|
|
map global normal ? "?(?i)"
|
|
|
|
# map global user s ": surround<ret>" -docstring "surround text"
|
|
|
|
map global normal "<a-'>" ": move-line-above<ret>" -docstring "move line above"
|
|
map global normal "'" ": move-line-below<ret>" -docstring "move line below"
|
|
|
|
map global normal + ": expand<ret>" -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 <tab>/<s-tab> for insert completion selection
|
|
hook global InsertCompletionShow .* %{
|
|
map window insert <tab> <c-n>
|
|
map window insert <s-tab> <c-p>
|
|
}
|
|
hook global InsertCompletionHide .* %{
|
|
unmap window insert <tab> <c-n>
|
|
unmap window insert <s-tab> <c-p>
|
|
}
|
|
|
|
# Remove trailing whitespace on save
|
|
hook global BufWritePre .* %{
|
|
try %{ execute-keys -draft \%s\h+$<ret>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 <space><a-i>w <a-k>\A\w+\z<ret>
|
|
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 (?<!\*)\*\w+\*(?!\*) 0:default+i
|
|
add-highlighter buffer/ regex \*\*(\w+)\*\* 0:default+b
|
|
|
|
}
|