rc: make insertion hooks more consistent
This commit is contained in:
parent
3ab2b98ec3
commit
eb3beff959
|
@ -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
|
||||
|
|
|
@ -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 }
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue
Block a user