From 87a96e7c86ef7a718246dfe6fc37b219c66dc557 Mon Sep 17 00:00:00 2001 From: Akshay Nair Date: Mon, 20 Oct 2025 22:21:17 +0530 Subject: Refactored bits out into files --- autoload/+init.kak | 77 +++++++++++++----------------------------------------- 1 file changed, 18 insertions(+), 59 deletions(-) (limited to 'autoload/+init.kak') diff --git a/autoload/+init.kak b/autoload/+init.kak index b1290fb..243df1d 100644 --- a/autoload/+init.kak +++ b/autoload/+init.kak @@ -30,13 +30,23 @@ add-highlighter global/ line '%val{cursor_line}' RowLine add-highlighter global/ regex \h+$ 0:Error # Highlight trailing whitespaces add-highlighter global/ wrap -word -indent # Softwrap long lines add-highlighter global/ show-matching -previous -add-highlighter global/ show-whitespaces -spc ' ' -tab '│' -tabpad 'y' -lf '¬' -indent '│' +add-highlighter global/ show-whitespaces -spc ' ' -tab '│' -lf '¬' -indent '│' +hook global RegisterModified '/' %{ + # Highlight current searchterm + add-highlighter -override global/search regex "%reg{/}" 0:search +} -# Search -hook global RegisterModified '/' %{ add-highlighter -override global/search regex "%reg{/}" 0:search } -map global user '' ': set-register slash ""' -map global user '/' '/(?i)' -map global user 'r' '*%s' +# System keys +map global user '' ': set-register slash ""' -docstring 'Clear search highlighting' +map global normal '/' '/(?i)' # Remap / to case-insensitive search +map global user '/' '/' +map global user r '*%s' -docstring 'Replace selection' +map global user s ': w' -docstring 'Save' +map global normal 15j -docstring '15 down' +map global normal 15k -docstring '15 up' +# Clipboard management mappings +map global user y " xclip -selection clipboard" -docstring "yank the selection into the clipboard" +map global user p " xclip -selection clipboard -o" -docstring "paste the clipboard" declare-user-mode system map global user q ': enter-user-mode system' -docstring 'System mode' @@ -63,22 +73,6 @@ hook global ModeChange .*:insert:.* %{ try %{ unset-face window PrimaryCursorEol } } -# Tmux window mode -declare-user-mode win -map global normal ':enter-user-mode win' -docstring 'Window mode' -map global win q ': quit' -docstring 'Quit' -map global win v ': tmux-terminal-horizontal kak -c %val{session}' -docstring 'Split vertical' -map global win s ': tmux-terminal-vertical kak -c %val{session}' -docstring 'Split horizontal' -map global win h ': nop %sh{tmux select-pane -L}' -docstring 'Jump left' -map global win j ': nop %sh{tmux select-pane -D}' -docstring 'Jump down' -map global win k ': nop %sh{tmux select-pane -U}' -docstring 'Jump up' -map global win l ': nop %sh{tmux select-pane -R}' -docstring 'Jump right' -map global win z ': wq' - -# Clipboard management mappings -map global user y " xclip -selection clipboard" -docstring "yank the selection into the clipboard" -map global user p " xclip -selection clipboard -o" -docstring "paste the clipboard" - # Code mode declare-user-mode code map global user c ':enter-user-mode code' -docstring 'Code mode' @@ -91,41 +85,6 @@ map global code :casekebab -docstring 'kebab-casing' map global code :casesnake -docstring 'snake_casing' map global code :casecamel -docstring 'camelCasing' -# Quick move -map global normal 15j -map global normal 15k - # Editorconfig -hook global BufOpenFile .* %{ try %{editorconfig-load} } -hook global BufNewFile .* %{ try %{editorconfig-load} } - -declare-user-mode surround -declare-user-mode surround-append -declare-user-mode surround-delete -map global user s ': enter-user-mode surround' -map global surround a ': enter-user-mode surround-append' -map global surround d ': enter-user-mode surround-delete' - -define-command define-surround -params 3 %{ - evaluate-commands %sh{ - echo "map global surround-append %{${1}} %{i${2}a${3}}" - echo "map global surround-delete %{${1}} %{${2}d,}" - } -} - -# hook global KakBegin .* %{ -# define-surround ( ( ) -# define-surround [ [ ] -# # define-surround < < > -# # define-surround '{' '{' '}' -# # define-surround '<' '<' '>' -# # define-surround '`' '`' '`' -# define-surround '"' '"' '"' -# # define-surround "'" "'" "'" -# } - - -hook global BufCreate .*[.]mdx %{ - set-option buffer filetype markdown -} - +hook global BufOpenFile .* %{ try %{ editorconfig-load } } +hook global BufNewFile .* %{ try %{ editorconfig-load } } -- cgit v1.3.1