From: Andre Ramnitz Date: Sat, 17 Aug 2024 09:31:06 +0000 (+0200) Subject: kak: add horizontal, vertical sorting and clean-up X-Git-Tag: v0.2~145 X-Git-Url: https://git.ramnitz.eu/?a=commitdiff_plain;h=ddda399e4bf07055cb1df32cd2d6063e798be2bc;p=dotfiles.git kak: add horizontal, vertical sorting and clean-up --- diff --git a/config/kak/kakrc b/config/kak/kakrc index e6aa37fd..69be1fb3 100644 --- a/config/kak/kakrc +++ b/config/kak/kakrc @@ -125,7 +125,7 @@ plug "andreyorst/plug.kak" noload add-highlighter global/trailing-whitespace regex '\h+$' 0:Error # trailing whitespaces in red add-highlighter global/todos regex '(//|#|/\*)\h*(TODO|WARNING|FIXME)[:]?[^\n]*' 2:+bu # highlight comment tags add-highlighter global/ show-matching # show matching brackets -add-highlighter global/ number-lines -hlcursor -min-digits 3 # absolute line nums everywhere +add-highlighter global/ number-lines -hlcursor -min-digits 3 # absolute line nums everywhere declare-option str dabruin_accent 'rgb:A1B56C' declare-option str dabruin_background 'rgb:242124' colorscheme dabruin @@ -136,48 +136,28 @@ add-highlighter global/ wrap -word -indent # Different Cursor color in insert mode # ────────────────────────────────────────────────────────────────────────────── # Shades of green/yellow for insert mode. -# hook global ModeChange (push|pop):.*:insert %{ -# set-face window StatusLine black,red -# } +hook global ModeChange (push|pop):.*:insert %{ + set-face window StatusLine black,blue +} # Undo colour changes when we leave insert mode. -# hook global ModeChange (push|pop):insert:.* %{ -# unset-face window StatusLine -# } +hook global ModeChange (push|pop):insert:.* %{ + unset-face window StatusLine +} # Extra editor commands # ────────────────────────────────────────────────────────────────────────────── # tab replacement -define-command clean-selections -docstring 'Replace tabs with spaces and trim trailing whitespace' %{ try %{ +define-command -hidden clean-selections -docstring 'Replace tabs with spaces and trim trailing whitespace' %{ try %{ execute-keys -draft @s\h+$d } } -define-command clean-buffer -docstring 'Replace tabs with spaces and trim trailing whitespace' %{ try %{ +define-command -hidden clean-buffer -docstring 'Replace tabs with spaces and trim trailing whitespace' %{ try %{ execute-keys -draft \%@s\h+$d } } -# Bring back and from Vim to increment/decrement the number under the cursor -# define-command -hidden -params 2 inc %{ try %{ -# evaluate-commands %sh{ -# [ "$1" = 0 ] && count=1 || count="$1" -# printf '%s%s' 'exec h"_/\dna' "$2($count)|{catecho}|bc" -# } -# } catch %{ -# execute-keys l -# }} - - -# Various mappings -# ────────────────────────────────────────────────────────────────────────────── -map global normal '#' :comment-line -docstring 'comment line' -map global normal '' :comment-block -docstring 'comment block' -map global goto m 'm;' -docstring 'matching char' -map global normal q Q -unmap global normal q -map global normal -docstring 'Next buffer ' ': buffer-next' -map global normal -docstring 'Previous buffer' ': buffer-previous' -# kks mappings +# normal mode kks mappings # ────────────────────────────────────────────────────────────────────────────── map global normal -docstring 'terminal' ': kks-connect terminal' map global normal -docstring 'files' ': kks-connect terminal-popup kks-files' @@ -188,18 +168,26 @@ map global normal -docstring 'recent files' ': kks-connect terminal-po map global normal -docstring 'vcs client' ': kks-connect terminal-popup lazygit' map global normal -docstring 'file browser' ': kks-connect terminal-panel kks-lf' +# normal mode additional mappings +# ────────────────────────────────────────────────────────────────────────────── +map global normal '#' :comment-line -docstring 'comment line' +map global normal '' :comment-block -docstring 'comment block' +map global goto m 'm;' -docstring 'matching char' +map global normal q Q +unmap global normal q +map global normal -docstring 'Next buffer ' ': buffer-next' +map global normal -docstring 'Previous buffer' ': buffer-previous' # default user mode # ────────────────────────────────────────────────────────────────────────────── map global user -docstring 'Buffer mode' b ':enter-user-mode buffermode' map global user -docstring 'Selection mode' s ':enter-user-mode selectionmode' -map global user -docstring 'edit kakrc' e ': e ~/.config/kak/kakrc' +map global user -docstring 'edit kakrc' E ': e ~/.config/kak/kakrc' map global user -docstring 'relative line numbers enable' r ': add-highlighter window/nl number-lines -min-digits 3 -relative -hlcursor' map global user -docstring 'relative line numbers disable' R ': remove-highlighter window/nl' map global user -docstring 'decrease value' d ': inc %val{count} -' map global user -docstring 'increase value' i ': inc %val{count} +' - # buffer user mode # ────────────────────────────────────────────────────────────────────────────── declare-user-mode buffermode @@ -214,20 +202,20 @@ map global buffermode -docstring 'Previous buffer' p ': buffer-previous' map global buffermode -docstring 'wrap enable' w ': add-highlighter buffer/bw wrap' map global buffermode -docstring 'wrap disable' W ': remove-highlighter buffer/bw' - # selection user mode # ────────────────────────────────────────────────────────────────────────────── declare-user-mode selectionmode map global selectionmode -docstring 'clean tabs and trailing whitespace in selections' c ': clean-selections' - +map global selectionmode -docstring 'sort words (H)orizontally in selection ' h '| xargs -n1 | sort -u | xargs ' +map global selectionmode -docstring 'sort words (V)ertically in selection ' v '| sort -n ' # terminal config (via foot.kak) # ────────────────────────────────────────────────────────────────────────────── -set-option global foot_normal_cmd 'foot' -set-option global foot_popup_cmd 'foot' +set-option global foot_normal_cmd 'footclient' +set-option global foot_popup_cmd 'footclient' set-option global foot_normal_flags '' set-option global foot_popup_flags '-a kakpopup' -set-option global foot_panel_cmd 'foot' +set-option global foot_panel_cmd 'footclient' # language config # ──────────────────────────────────────────────────────────────────────────────