changed opening matching regexes to be simpler
This commit is contained in:
parent
2f0b0d468c
commit
852d22a543
|
@ -74,19 +74,19 @@ define-command -hidden kak-indent-on-new-line %{
|
||||||
try %{ execute-keys -draft \; K <a-&> }
|
try %{ execute-keys -draft \; K <a-&> }
|
||||||
# cleanup trailing whitespaces from previous line
|
# cleanup trailing whitespaces from previous line
|
||||||
try %{ execute-keys -draft k <a-x> s \h+$ <ret> d }
|
try %{ execute-keys -draft k <a-x> s \h+$ <ret> d }
|
||||||
# indent after line ending with %[\W\S] or %sh[\W\S]
|
# indent after line ending with %\w*[^\s\w]
|
||||||
try %{ execute-keys -draft k <a-x> <a-k> \%(sh)?(?=\S)\W$ <ret> j <a-gt> }
|
try %{ execute-keys -draft k <a-x> <a-k> \%\w*[^\s\w]$ <ret> j <a-gt> }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
define-command -hidden kak-indent-on-closing-matching %~
|
define-command -hidden kak-indent-on-closing-matching %~
|
||||||
# align to opening matching brace when alone on a line
|
# align to opening matching brace when alone on a line
|
||||||
try %= execute-keys -draft -itersel <a-h><a-k>\h*[>)}\]]$<ret> mGi s \A|.\z<ret> gi 1<a-&> =
|
try %= execute-keys -draft -itersel <a-h><a-k>\h*\Q %val{hook_param} \E$<ret> mGi s \A|.\z<ret> gi 1<a-&> =
|
||||||
~
|
~
|
||||||
|
|
||||||
define-command -hidden kak-indent-on-closing-char %{
|
define-command -hidden kak-indent-on-closing-char %{
|
||||||
# align to opening matching character when alone on a line
|
# align to opening matching character when alone on a line
|
||||||
try %{ execute-keys -draft -itersel <a-h><a-k>\h*\Q %val{hook_param} \E$<ret>gi<a-f> %val{hook_param} <a-T>%<a-k>(sh)?\Q %val{hook_param} \E$<ret> s \A|.\z<ret> gi 1<a-&> }
|
try %{ execute-keys -draft -itersel <a-h><a-k>\h*\Q %val{hook_param} \E$<ret>gi<a-f> %val{hook_param} <a-T>%<a-k>\w*\Q %val{hook_param} \E$<ret> s \A|.\z<ret> gi 1<a-&> }
|
||||||
}
|
}
|
||||||
|
|
||||||
# Initialization
|
# Initialization
|
||||||
|
@ -97,7 +97,7 @@ hook -group kak-highlight global WinSetOption filetype=kak %{ add-highlighter wi
|
||||||
hook global WinSetOption filetype=kak %~
|
hook global WinSetOption filetype=kak %~
|
||||||
hook window InsertChar \n -group kak-indent kak-indent-on-new-line
|
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 [>)}\]] -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
|
# cleanup trailing whitespaces on current line insert end
|
||||||
hook window ModeChange insert:.* -group kak-indent %{ try %{ execute-keys -draft \; <a-x> s ^\h+$ <ret> d } }
|
hook window ModeChange insert:.* -group kak-indent %{ try %{ execute-keys -draft \; <a-x> s ^\h+$ <ret> d } }
|
||||||
set-option buffer extra_word_chars '-'
|
set-option buffer extra_word_chars '-'
|
||||||
|
|
Loading…
Reference in New Issue
Block a user