You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
153 lines
3.9 KiB
153 lines
3.9 KiB
2 years ago
|
###########
|
||
|
# plugins #
|
||
|
###########
|
||
|
source "%val{config}/plugins/plug.kak/rc/plug.kak"
|
||
|
plug "andreyorst/plug.kak" noload
|
||
|
|
||
|
#########################
|
||
|
# colors and appearance #
|
||
|
#########################
|
||
|
add-highlighter global/ number-lines -relative
|
||
|
add-highlighter -override global/number-lines number-lines -hlcursor
|
||
|
|
||
|
colorscheme one
|
||
|
|
||
|
####################
|
||
|
# system clipboard #
|
||
|
####################
|
||
|
plug "lePerdu/kakboard" %{
|
||
|
hook global WinCreate .* %{ kakboard-enable }
|
||
|
}
|
||
|
|
||
|
hook global NormalKey y|d|c %{ nop %sh{
|
||
|
printf "%s" "$kak_reg_dquote" | xclip -selection clipboard >&- 2>&-
|
||
|
} }
|
||
|
|
||
|
############
|
||
|
# snippets #
|
||
|
############
|
||
|
# plug "occivink/kakoune-snippets" config %{
|
||
|
# set-option -add global snippets_directories "%opt{plug_install_dir}/kakoune-snippet-collection/snippets"
|
||
|
# # some other kakoune-snippets related configurations
|
||
|
# }
|
||
|
#
|
||
|
# plug "andreyorst/kakoune-snippet-collection"
|
||
|
|
||
|
|
||
|
###########
|
||
|
# buffers #
|
||
|
###########
|
||
|
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)'
|
||
|
}
|
||
|
|
||
|
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
|
||
|
|
||
|
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 (dick)'
|
||
|
|
||
|
|
||
|
##################
|
||
|
# tabs expansion #
|
||
|
##################
|
||
|
plug "andreyorst/smarttab.kak"
|
||
|
hook global WinSetOption filetype=(python|rust) expandtab
|
||
|
map global insert <tab> '<a-;><a-gt>'
|
||
|
|
||
|
#######
|
||
|
# lsp #
|
||
|
#######
|
||
|
eval %sh{kak-lsp --kakoune -s $kak_session} # Not needed if you load it with plug.kak.
|
||
|
lsp-enable
|
||
|
|
||
|
|
||
|
map global user l %{: enter-user-mode lsp<ret>} -docstring "LSP mode"
|
||
|
|
||
|
# vim migration
|
||
|
# <https://discuss.kakoune.com/t/annoyances-when-migrating-from-vim/690/9>
|
||
|
define-command -hidden alt-x %{
|
||
|
evaluate-commands %sh{
|
||
|
width=$kak_window_width
|
||
|
printf "%s\n" "execute-keys <a-:>'$width'l<a-b>hl"
|
||
|
unset width
|
||
|
}
|
||
|
}
|
||
|
define-command -hidden alt-X %{
|
||
|
evaluate-commands %sh{
|
||
|
width=$kak_window_width
|
||
|
printf "%s\n" "execute-keys <a-\;>'$width'h<a-b>lh"
|
||
|
unset width
|
||
|
}
|
||
|
}
|
||
|
|
||
|
|
||
|
##############
|
||
|
# formatters #
|
||
|
##############
|
||
|
# indentation
|
||
|
set-option global indentwidth 4
|
||
|
|
||
|
hook global WinSetOption filetype=python %{
|
||
|
set-option window formatcmd 'black -q -'
|
||
|
|
||
|
hook -group python-auto-format window BufWritePre .* format
|
||
|
|
||
|
hook -once WinSetOption filetype=.* %{
|
||
|
unset-option window formatcmd
|
||
|
remove-hooks window python-auto-format
|
||
|
}
|
||
|
}
|
||
|
|
||
|
hook global WinSetOption filetype=rust %{
|
||
|
set-option window formatcmd 'rustfmt'
|
||
|
|
||
|
hook -group rust-autoformat window BufWritePre .* format
|
||
|
|
||
|
hook -once WinSetOption filetype=.* %{
|
||
|
unset-option window formatcmd
|
||
|
remove-hooks window rust-autoformat
|
||
|
}
|
||
|
}
|
||
|
|
||
|
hook global BufSetOption filetype=markdown %{
|
||
|
set-option buffer formatcmd 'pandoc -f commonmark -t commonmark'
|
||
|
}
|
||
|
|
||
|
|
||
|
hook global WinSetOption filetype=(nix|latex|yaml|markdown|haskell) %{
|
||
|
set-option buffer indentwidth 2
|
||
|
set window autowrap_column 80
|
||
|
autowrap-enable
|
||
|
}
|
||
|
|
||
|
map global user W '|fmt --width 80<ret>' -docstring "Wrap to 80 columns"
|
||
|
|
||
|
############
|
||
|
# spelling #
|
||
|
############
|
||
|
# thesaurus langauge switchers?
|
||
|
map global normal <a-=> ' :synonyms-set-thesaurus th_ru_RU_v2<ret> :echo set ru thesaurus<ret>'
|
||
|
map global normal <a-+> ' :synonyms-set-thesaurus th_en_US_v2<ret> :echo set en thesaurus<ret>'
|
||
|
|
||
|
hook global WinDisplay .* %{ synonyms-enable-on <a-n> }
|
||
|
|
||
|
|
||
|
###############
|
||
|
# file search #
|
||
|
###############
|
||
|
plug "andreyorst/fzf.kak"
|
||
|
map global normal <F5> ': fzf-mode<ret>'
|