evaluate-commands %sh{ kks init }
define-command -override kks-connect -params 1.. -command-completion %{
%arg{1} sh -c %{
- export EDITOR='kks edit'
- export VISUAL='kks edit'
export KKS_SESSION=$1
export KKS_CLIENT=$2
shift 3
bundle foot.kak https://github.com/kkga/foot.kak
bundle kakoune-surround https://github.com/h-youhei/kakoune-surround
bundle shadow.kak https://github.com/ftonneau/shadow.kak
+bundle small.kak https://git.sr.ht/~nasmevka/small.kak
bundle kakship https://github.com/eburghar/kakship %{
kakship-enable
}
echo ${kak_config}/languagecmd.kak # boilerplate from https://git.sr.ht/~nasmevka
}
+# Small.kak config
+# ───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
+define-command -hidden -docstring %{
+ enter-spacemode: transform all tabulations as spaces and launch small-spacetab.
+} enter-spacemode %{
+ try %{ execute-keys 'Z%s\t<ret>@z' }
+ small-spacetab-kak
+}
# Shadow.kak config
# ───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
# kak
shadow-set kak \
-comment ^# ^# nofirst nolast default
+comment ^# \n\h* first last default,rgb:1d1c1d
shadow-decorate kak \
-border ^# default,rgb:222222
+border ^\h# default,rgb:222222
# Look and Feel
# default normal mode kks mappings
# ───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
-map global normal -docstring 'terminal' <c-t> ': kks-connect terminal<ret>'
+map global normal -docstring 'terminal' <c-c> ': kks-connect terminal<ret>'
map global normal -docstring 'terminal' <F2> ': kks-connect terminal<ret>'
map global normal -docstring 'files' <c-f> ': kks-connect popup kks-files<ret>'
map global normal -docstring 'files' <F3> ': kks-connect popup kks-files<ret>'
map global user -docstring 'buffer mode' b ': enter-user-mode buffermode<ret>'
map global user -docstring 'git mode' g ': enter-user-mode gitmode<ret>'
map global user -docstring 'selection mode' s ': enter-user-mode selmode<ret>'
-# map global user -docstring 'LSP mode' l ': enter-user-mode lsp<ret>'
-map global user -docstring 'Table mode' t ': enter-user-mode table<ret>'
-map global user -docstring 'Table mode (locked)' T ': enter-user-mode -lock table<ret>'
+# map global user -docstring 'LSP mode' l ': enter-user-mode lsp<ret>'
+map global user -docstring 'Table mode' t ': enter-user-mode table<ret>'
+map global user -docstring 'Table mode (locked)' T ': enter-user-mode -lock table<ret>'
map global user -docstring ':::::::::::::::::::::::::::::::: ::' : ': <esc>'
map global user -docstring 'Edit kakrc' E ': e ~/.config/kak/kakrc<ret>'
map global user -docstring 'highlight hex color without leading #' p ': addhl global/hex_color_code2 ref hex_color_code2<ret>'
map global user -docstring 'case insensitive backward extend-search' '<a-?>' <a-?>(?i)
+# ui overrides
+# ───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
+map global prompt <c-n> <tab>
+map global prompt <c-p> <s-tab>
+
# kak-lsp keys
# ───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
# map global insert <tab> '<a-;>:try lsp-snippets-select-next-placeholders catch %{ execute-keys -with-hooks <lt>tab> }<ret>' -docstring 'Select next snippet placeholder'
## Languages
# ──────────────────────────────────────────────────────────────────────────────
# stolen from git.sr.ht/~nasmevka/kak
+### kak
+hook -group languagecmd global WinSetOption filetype=kakrc %{
+ set-option buffer tabstop 4
+ set-option buffer indentwidth 4
+ enter-spacemode
+ add-highlighter buffer/kakrc-whitespaces show-whitespaces -indent '¦' -spc ' ' -lf ' '
+}
+
### golang
hook -group languagecmd global WinSetOption filetype=go %{
set-option buffer formatcmd 'gofumpt'
- set-option buffer lintcmd "golangci-lint run --out-format=line-number --uniq-by-line=true --allow-parallel-runners | grep %val{bufname} #"
+ set-option buffer lintcmd "golangci-lint run --out-format=line-number --uniq-by-line=true --allow-parallel-runners | grep %val{bufname} #"
}
### json
### python
hook -group languagecmd global WinSetOption filetype=python %{
- set-option buffer formatcmd 'black --line-length 150 -'
- set-option buffer lintcmd 'ruff check --format=text --line-length=150'
+ set-option buffer formatcmd 'ruff format --line-length 150 -'
+ set-option buffer lintcmd 'ruff check --output-format=concise --line-length=150'
+ set-option buffer tabstop 4
+ set-option buffer indentwidth 4
+ enter-spacemode
+ add-highlighter buffer/python-whitespaces show-whitespaces -indent '¦' -spc ' ' -lf ' '
}
### shell
### Hare
hook -group languagecmd global WinSetOption filetype=hare %{
- set-option buffer tabstop 8
- set-option buffer indentwidth 8
+ set-option buffer tabstop 8
+ set-option buffer indentwidth 8
}
### CSS
yamllint -f parsable "$1" | sed 's/ \[\(.*\)\] / \1: /'
} && run }
set-option buffer formatcmd "npx prettier --parser yaml --stdin-filepath=%val{buffile}"
-
+ set-option buffer tabstop 2
+ set-option buffer indentwidth 2
}
### TODO: add corresponding linter