hook global WinSetOption filetype=(c|cpp) smarttab
}
plug "whereswaldon/shellcheck.kak"
- plug "occivink/kakoune-filetree"
plug "occivink/kakoune-sudo-write"
plug "occivink/kakoune-find"
plug "foot.kak"
hook -once window WinDisplay .* %{
hook window WinResize [0-9]*\.[0-9]* %{
set-option window scrolloff %sh{
- printf '%u,%u' "$(($kak_window_height / 6))" "$(($kak_window_width / 8))"
+ printf '%u,%u' "$(($kak_window_height / 5))" "$(($kak_window_width / 8))"
}
}
}
map global normal '#' :comment-line<ret> -docstring 'comment line'
map global normal '<a-#>' :comment-block<ret> -docstring 'comment block'
map global goto m '<esc>m;' -docstring 'matching char'
-map -docstring 'select lines downwards' global normal X T<ret>Lx
-# see #inc
map global normal <c-a> ': inc %val{count} +<ret>'
map global normal <c-x> ': inc %val{count} -<ret>'
-map global normal Q q # map q to Q
-#map global normal q -docstring 'tabs mode' ': enter-user-mode tabs<ret>' # map q to tabs mode
-
# default user mode
# ──────────────────────────────────────────────────────────────────────────────
-map global user -docstring 'enable autocomplete' a ': set-option -add buffer autocomplete insert<ret>'
-map global user -docstring 'disable autocomplete' A ': set-option -remove buffer autocomplete insert<ret>'
+map global user -docstring 'Buffer mode' b ':enter-user-mode buffermode<ret>'
+map global user -docstring 'Selection mode' s ':enter-user-mode selectionmode<ret>'
+#map global user -docstring 'bookMarks mode' m ':enter-user-mode bookmarks<ret>'
+
map global user -docstring 'edit kakrc' e ': e ~/.config/kak/kakrc<ret>'
-map global user -docstring 'clean tabs and trailing whitespace in selections' c ': clean-selections<ret>'
-map global user -docstring 'clean tabs and trailing whitespace in the buffer' C ': clean-buffer<ret>'
-map global user -docstring 'buffer backward' b ': buffer-previous<ret>'
-map global user -docstring 'buffer forward' n ': buffer-next<ret>'
-map global user -docstring 'lint-buffer' L ': buffer *lint-output*<ret>'
-map global user -docstring 'relative line numbers enable' r ': add-highlighter window/nl number-lines -relative -hlcursor<ret>'
-map global user -docstring 'relative line numbers disable' R ': remove-highlighter window/nl<ret>'
-map global user -docstring 'wrap enable' w ': add-highlighter buffer/bw wrap<ret>'
-map global user -docstring 'wrap disable' W ': remove-highlighter buffer/bw<ret>'
+# buffer user mode
+# ──────────────────────────────────────────────────────────────────────────────
+declare-user-mode buffermode
+map global buffermode -docstring 'enable autocomplete' a ': set-option -add buffer autocomplete insert<ret>'
+map global buffermode -docstring 'disable autocomplete' A ': set-option -remove buffer autocomplete insert<ret>'
+map global buffermode -docstring 'Lint buffer' L ': buffer *lint-output*<ret>'
+map global buffermode -docstring 'buffer picker' l ': connect terminal-popup kcr fzf buffers<ret>'
+map global buffermode -docstring 'Next buffer ' n ': buffer-next<ret>'
+map global buffermode -docstring 'Previous buffer' p ': buffer-previous<ret>'
+map global buffermode -docstring 'clean tabs and trailing whitespace in the buffer' c ': clean-buffer<ret>'
+map global buffermode -docstring 'wrap enable' w ': add-highlighter buffer/bw wrap<ret>'
+map global buffermode -docstring 'wrap disable' W ': remove-highlighter buffer/bw<ret>'
+
+# selection user mode
+# ──────────────────────────────────────────────────────────────────────────────
+declare-user-mode selectionmode
+map global selectionmode -docstring 'clean tabs and trailing whitespace in selections' c ': clean-selections<ret>'
+
+# window user mode
+# ──────────────────────────────────────────────────────────────────────────────
+declare-user-mode windowmode
+map global windowmode -docstring 'relative line numbers enable' r ': add-highlighter window/nl number-lines -relative -hlcursor<ret>'
+map global windowmode -docstring 'relative line numbers disable' R ': remove-highlighter window/nl<ret>'
# terminal config (via foot.kak)
# ──────────────────────────────────────────────────────────────────────────────