]> Freerunner's - dotfiles.git/commitdiff
kak: add horizontal, vertical sorting and clean-up
authorAndre Ramnitz <tux.rising@gmail.com>
Sat, 17 Aug 2024 09:31:06 +0000 (11:31 +0200)
committerAndre Ramnitz <tux.rising@gmail.com>
Mon, 26 Aug 2024 13:52:01 +0000 (15:52 +0200)
config/kak/kakrc

index e6aa37fd81170d754d12d926c31fdf397e4b6430..69be1fb37523a7aa5759f07d5383d7b443aa9e65 100644 (file)
@@ -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+$<ret>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+$<ret>d
 } }
-# Bring back <c-a> and <c-x> 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"_/\d<ret><a-i>na' "$2($count)<esc>|{<space>cat<semicolon>echo<semicolon>}|bc<ret>"
-#     }
-# } catch %{
-#     execute-keys l
-# }}
-
-
-# Various mappings
-# ──────────────────────────────────────────────────────────────────────────────
-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 global normal q Q
-unmap global normal q
-map global normal -docstring 'Next buffer '     <c-n> ': buffer-next<ret>'
-map global normal -docstring 'Previous buffer'  <c-p> ': buffer-previous<ret>'
 
 
-# kks mappings
+# normal mode kks mappings
 # ──────────────────────────────────────────────────────────────────────────────
 map global normal -docstring 'terminal'         <c-t> ': kks-connect terminal<ret>'
 map global normal -docstring 'files'            <c-f> ': kks-connect terminal-popup kks-files<ret>'
@@ -188,18 +168,26 @@ map global normal -docstring 'recent files'     <c-r> ': kks-connect terminal-po
 map global normal -docstring 'vcs client'       <c-v> ': kks-connect terminal-popup lazygit<ret>'
 map global normal -docstring 'file browser'     <c-h> ': kks-connect terminal-panel kks-lf<ret>'
 
+# normal mode additional mappings
+# ──────────────────────────────────────────────────────────────────────────────
+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 global normal q Q
+unmap global normal q
+map global normal -docstring 'Next buffer '     <c-n> ': buffer-next<ret>'
+map global normal -docstring 'Previous buffer'  <c-p> ': buffer-previous<ret>'
 
 # default user mode
 # ──────────────────────────────────────────────────────────────────────────────
 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 'edit kakrc'                    e      ': e ~/.config/kak/kakrc<ret>'
+map global user -docstring 'edit kakrc'                    E      ': e ~/.config/kak/kakrc<ret>'
 map global user -docstring 'relative line numbers enable'  r      ': add-highlighter window/nl number-lines -min-digits 3 -relative -hlcursor<ret>'
 map global user -docstring 'relative line numbers disable' R      ': remove-highlighter window/nl<ret>'
 map global user -docstring 'decrease value'                d      ': inc %val{count} -<ret>'
 map global user -docstring 'increase value'                i      ': inc %val{count} +<ret>'
 
-
 # buffer user mode
 # ──────────────────────────────────────────────────────────────────────────────
 declare-user-mode buffermode
@@ -214,20 +202,20 @@ map global buffermode -docstring 'Previous buffer' p ': buffer-previous<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>'
-
+map global selectionmode -docstring 'sort words (H)orizontally in selection ' h '| xargs -n1 | sort -u | xargs <ret>'
+map global selectionmode -docstring 'sort words (V)ertically in selection ' v '| sort -n  <ret>'
 
 # 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
 # ──────────────────────────────────────────────────────────────────────────────