Created
September 6, 2022 15:27
-
-
Save wycleffsean/c9a45bda9f9759cb9476e1dcb75d786c to your computer and use it in GitHub Desktop.
kakrc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
evaluate-commands %sh{ | |
plugins="$kak_config/plugins" | |
mkdir -p "$plugins" | |
[ ! -e "$plugins/plug.kak" ] && \ | |
git clone -q https://github.com/andreyorst/plug.kak.git "$plugins/plug.kak" | |
printf "%s\n" "source '$plugins/plug.kak/rc/plug.kak'" | |
} | |
plug "andreyorst/plug.kak" noload | |
plug "andreyorst/fzf.kak" config %{ | |
map -docstring 'fzf mode' global normal '<c-p>' ': fzf-mode<ret>' | |
} demand fzf %{ | |
set-option global fzf_file_command 'rg' # 'ag', 'fd', or 'find' | |
} | |
plug "andreyorst/powerline.kak" defer powerline_gruvbox %{ | |
powerline-theme gruvbox | |
} config %{ | |
powerline-start | |
} | |
# connect kak-lsp to the kakoune session | |
eval %sh{kak-lsp --kakoune -s $kak_session} | |
# enable line numbers | |
# only for normal buffers | |
#hook global WinCreate ^[^*]+$ %{ add-highlighter window number-lines } | |
add-highlighter global/ number-lines -relative -hlcursor -cursor-separator '>' | |
add-highlighter global/ wrap -word -indent | |
# enable for all languages that we want to use the LSP, here we're enabling C++ and Zig. | |
hook global WinSetOption filetype=(cpp|zig) %{ | |
lsp-enable-window | |
# the options below are optional (and self-explanatory) | |
lsp-code-actions-enable | |
lsp-auto-hover-enable | |
lsp-auto-signature-help-enable | |
lsp-auto-hover-insert-mode-disable | |
} | |
# configure zls: we enable zig fmt, reference and semantic highlighting | |
hook global WinSetOption filetype=zig %{ | |
set-option buffer formatcmd 'zig fmt --stdin' | |
set-option window lsp_auto_highlight_references true | |
set-option global lsp_server_configuration zls.zig_lib_path="/usr/lib/zig" | |
set-option -add global lsp_server_configuration zls.warn_style=true | |
set-option -add global lsp_server_configuration zls.enable_semantic_tokens=true | |
hook window -group semantic-tokens BufReload .* lsp-semantic-tokens | |
hook window -group semantic-tokens NormalIdle .* lsp-semantic-tokens | |
hook window -group semantic-tokens InsertIdle .* lsp-semantic-tokens | |
hook -once -always window WinSetOption filetype=.* %{ | |
remove-hooks window semantic-tokens | |
} | |
} | |
hook global BufSetOption filetype=zig %{ | |
set-option buffer lintcmd 'zig fmt --color off --ast-check 2>&1' | |
# To enable auto linting on buffer write | |
#hook -group zig-auto-lint buffer BufWritePre .* lint-buffer | |
hook -group zig-auto-lint buffer BufWritePre .* lsp-formatting-sync | |
} | |
map global user l %{:enter-user-mode lsp<ret>} -docstring "LSP mode" | |
map global insert <tab> '<a-;>:try lsp-snippets-select-next-placeholders catch %{ execute-keys -with-hooks <lt>tab> }<ret>' -docstring 'Select next snippet placeholder' | |
map global object a '<a-semicolon>lsp-object<ret>' -docstring 'LSP any symbol' | |
map global object <a-a> '<a-semicolon>lsp-object<ret>' -docstring 'LSP any symbol' | |
map global object e '<a-semicolon>lsp-object Function Method<ret>' -docstring 'LSP function or method' | |
map global object k '<a-semicolon>lsp-object Class Interface Struct<ret>' -docstring 'LSP class interface or struct' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment