rc: make insertion hooks more consistent

This commit is contained in:
Johannes Altmanninger 2021-04-17 18:18:43 +02:00
parent 3ab2b98ec3
commit eb3beff959
4 changed files with 4 additions and 3 deletions

View File

@ -112,7 +112,7 @@ define-command -hidden lua-indent-on-new-line %{
define-command -hidden lua-insert-on-new-line %[
evaluate-commands -no-hooks -draft -itersel %[
# copy -- comment prefix and following white spaces
try %{ execute-keys -draft k<a-x>s^\h*\K--\h*<ret>yghjP }
try %{ execute-keys -draft k<a-x>s^\h*\K--\h*<ret> y gh j P }
# wisely add end structure
evaluate-commands -save-regs x %[
try %{ execute-keys -draft k<a-x>s^\h+<ret>"xy } catch %{ reg x '' } # Save previous line indent in register x

View File

@ -97,7 +97,7 @@ evaluate-commands %sh{
define-command -hidden mercury-insert-on-new-line %{
evaluate-commands -draft -itersel %{
# copy '%' comment prefix and following white spaces
try %{ execute-keys -draft k <a-x> s ^\h*\%\h* <ret> y jgh P }
try %{ execute-keys -draft k <a-x> s ^\h*\%\h* <ret> y gh j P }
}
}

View File

@ -99,7 +99,7 @@ define-command -hidden moon-indent-on-char %{
define-command -hidden moon-indent-on-new-line %{
evaluate-commands -draft -itersel %{
# copy -- comment prefix and following white spaces
try %{ execute-keys -draft k <a-x> s ^ \h * \K -- \h * <ret> y gh j P }
try %{ execute-keys -draft k <a-x> s ^\h*\K--\h* <ret> y gh j P }
# preserve previous line indent
try %{ execute-keys -draft <semicolon> K <a-&> }
# filter previous line

View File

@ -149,6 +149,7 @@ define-command -hidden python-insert-on-new-line %{
try %{ execute-keys -draft k <a-x> s ^\h*#\h* <ret> y jgh P }
}
}
define-command -hidden python-indent-on-new-line %<
evaluate-commands -draft -itersel %<
# preserve previous line indent