diff --git a/rc/core/kakrc.kak b/rc/core/kakrc.kak index d9f91238..5eed883d 100644 --- a/rc/core/kakrc.kak +++ b/rc/core/kakrc.kak @@ -74,19 +74,19 @@ define-command -hidden kak-indent-on-new-line %{ try %{ execute-keys -draft \; K } # cleanup trailing whitespaces from previous line try %{ execute-keys -draft k s \h+$ d } - # indent after line ending with %[\W\S] or %sh[\W\S] - try %{ execute-keys -draft k \%(sh)?(?=\S)\W$ j } + # indent after line ending with %\w*[^\s\w] + try %{ execute-keys -draft k \%\w*[^\s\w]$ j } } } define-command -hidden kak-indent-on-closing-matching %~ # align to opening matching brace when alone on a line - try %= execute-keys -draft -itersel \h*[>)}\]]$ mGi s \A|.\z gi 1 = + try %= execute-keys -draft -itersel \h*\Q %val{hook_param} \E$ mGi s \A|.\z gi 1 = ~ define-command -hidden kak-indent-on-closing-char %{ # align to opening matching character when alone on a line - try %{ execute-keys -draft -itersel \h*\Q %val{hook_param} \E$gi %val{hook_param} %(sh)?\Q %val{hook_param} \E$ s \A|.\z gi 1 } + try %{ execute-keys -draft -itersel \h*\Q %val{hook_param} \E$gi %val{hook_param} %\w*\Q %val{hook_param} \E$ s \A|.\z gi 1 } } # Initialization @@ -97,7 +97,7 @@ hook -group kak-highlight global WinSetOption filetype=kak %{ add-highlighter wi hook global WinSetOption filetype=kak %~ hook window InsertChar \n -group kak-indent kak-indent-on-new-line hook window InsertChar [>)}\]] -group kak-indent kak-indent-on-closing-matching - hook window InsertChar (?![>)}\]])(?=\S)\W -group kak-indent kak-indent-on-closing-char + hook window InsertChar (?![>)}\]])[^\s\w] -group kak-indent kak-indent-on-closing-char # cleanup trailing whitespaces on current line insert end hook window ModeChange insert:.* -group kak-indent %{ try %{ execute-keys -draft \; s ^\h+$ d } } set-option buffer extra_word_chars '-'