|
# disable clippy |
|
set global ui_options ncurses_assistant=none |
|
|
|
# text |
|
set global indentwidth 4 |
|
set global tabstop 4 |
|
# tab to spaces |
|
hook global InsertChar \t %{ |
|
exec -draft h@ |
|
} |
|
# less info |
|
set global startup_info_version 20200901 |
|
# line numbers |
|
# add-highlighter global/ number-lines -relative -hlcursor -min-digits 2 |
|
# softwrap long lines |
|
# add-highlighter global/ wrap -word -indent |
|
# show matching |
|
add-highlighter global/ show-matching |
|
|
|
# plugins manager |
|
evaluate-commands %sh{ |
|
plugins="$HOME/.config/kak/plugins" |
|
mkdir -p $plugins |
|
[ ! -e "$plugins/plug.kak" ] && \ |
|
git clone -q https://github.com/andreyorst/plug.kak "$plugins/plug.kak" |
|
printf "%s\n" "source '$plugins/plug.kak/rc/plug.kak'" |
|
} |
|
plug "andreyorst/plug.kak" noload |
|
|
|
# colorscheme |
|
plug "raiguard/one.kak" theme %{ |
|
colorscheme one-dark |
|
} |
|
|
|
# relative/absolute line numbers in insert/normal mode |
|
plug "evanrelf/number-toggle.kak" config %{ |
|
require-module "number-toggle" |
|
set-option global number_toggle_params -hlcursor -separator '│' |
|
} |
|
|
|
# cursor crosshairs |
|
plug "insipx/kak-crosshairs" config %{ |
|
# no bold or dim, overrides crosshairs.kak |
|
set-face global crosshairs_line default,rgb:383838 |
|
set-face global crosshairs_column default,rgb:383838 |
|
} |
|
# crosshairs on in insert mode, off in normal; use '-always' for \o and \i |
|
hook -always global ModeChange 'push:normal:insert' %{ |
|
crosshairs |
|
} |
|
hook -always global ModeChange 'pop:insert:normal' %{ |
|
crosshairs |
|
} |
|
|
|
# cycle completions with <tab> |
|
# https://erik-engheim.medium.com/my-kakoune-editor-configuration-34cca61a1ba9 |
|
hook global InsertCompletionShow .* %{ |
|
try %{ |
|
execute-keys -draft 'h<a-K>\h<ret>' |
|
map window insert <tab> <c-n> |
|
map window insert <s-tab> <c-p> |
|
hook -once -always window InsertCompletionHide .* %{ |
|
map window insert <tab> <tab> |
|
map window insert <s-tab> <s-tab> |
|
} |
|
} |
|
} |
|
|
|
# kakoune.cr: https://github.com/alexherbo2/kakoune.cr |
|
evaluate-commands %sh{ |
|
kcr init kakoune |
|
} |
|
|
|
plug "alexherbo2/auto-pairs.kak" %{ |
|
require-module auto-pairs |
|
auto-pairs-enable |
|
} |
|
|
|
# surround |
|
plug "h-youhei/kakoune-surround" |
|
|
|
# lsp |
|
# https://github.com/kak-lsp/kak-lsp/wiki/Usage-with-plug.kak |
|
plug "kak-lsp/kak-lsp" do %{ |
|
cargo install --locked --force --path . |
|
} config %{ |
|
|
|
define-command ne -docstring 'go to next error/warning from lsp' %{ lsp-find-error --include-warnings } |
|
define-command pe -docstring 'go to previous error/warning from lsp' %{ lsp-find-error --previous --include-warnings } |
|
define-command ee -docstring 'go to current error/warning from lsp' %{ lsp-find-error --include-warnings; lsp-find-error --previous --include-warnings } |
|
|
|
define-command lsp-restart -docstring 'restart lsp server' %{ lsp-stop; lsp-start } |
|
|
|
hook global WinSetOption filetype=(go|javascript|typescript|html|css|markdown) %{ |
|
# set-option window lsp_auto_highlight_references true |
|
# set-option window lsp_hover_anchor false |
|
lsp-auto-hover-enable |
|
lsp-auto-signature-help-enable |
|
lsp-auto-hover-insert-mode-disable |
|
|
|
# clean gutter symbols |
|
set global lsp_diagnostic_line_error_sign '║' |
|
set global lsp_diagnostic_line_warning_sign '┊' |
|
# Tell lsp to insert spaces instead of tabs |
|
set-option global lsp_insert_spaces true |
|
|
|
|
|
echo -debug "Enabling LSP for filtetype %opt{filetype}" |
|
lsp-enable-window |
|
} |
|
|
|
hook global WinSetOption filetype=(go) %{ |
|
set-option buffer formatcmd 'gofmt' |
|
} |
|
|
|
hook global KakEnd .* lsp-exit |
|
} |
|
|