AutoYADM commit: 2025-05-23 17:35:15

This commit is contained in:
Daniel Fichtinger 2025-05-23 17:35:15 -04:00
parent f01b0d0052
commit 81ee9c4efd

View file

@ -18,6 +18,19 @@ define-command -hidden kdl-indent-closing-brace %|
try %= execute-keys -draft -itersel <a-h><a-k>^\h*\Q %val{hook_param} \E$<ret> mGi s \A|.\z<ret> 1<a-&> =
|
define-command -hidden kdl-indent-on-new-line %<
evaluate-commands -draft -itersel %<
# preserve prev indent
try %{ execute-keys -draft <semicolon> K <a-&> }
# filter prev line
# try %{ execute-keys -draft k : json-trim-indent <ret> }
# indent after lines ending with opener
try %< execute-keys -draft k x <a-k> [[}]\h*$ <ret> j <a-gt> >
# deindent closer when after cursor
try %< execute-keys -draft x <a-k> ^\h*[}\]] <ret> gh / [}\]] <ret> m <a-S> 1<a-&> >
>
>
~
hook global BufCreate .*[.](kdl) %{
@ -25,16 +38,18 @@ hook global BufCreate .*[.](kdl) %{
set-option buffer comment_line "//"
set-option buffer comment_block_begin "/*"
set-option buffer comment_block_end "*/"
set-option window formatcmd "kdlfmt format -"
# set-option window formatcmd "kdlfmt format -"
}
hook global WinSetOption filetype=kdl %|
require-module kdl
# hook window InsertChar \n -group kdl-indent %{ kdl-indent-newline }
hook window InsertChar [}{}] -group kdl-indent kdl-indent-closing-brace
# hook window InsertChar [}{}] -group kdl-indent kdl-indent-closing-brace
# hook window InsertChar '}' -group kdl-indent %{ kdl-indent-closing-brace }
hook window InsertChar \n -group kdl-indent kdl-indent-on-new-line
hook -once -always window WinSetOption filetype=.* %{ remove-hooks window kdl-indent }
hook -group kdl-auto-format window BufWritePre .* format