From eb3beff9591001214ae6910fd6f92651aac3eb7c Mon Sep 17 00:00:00 2001 From: Johannes Altmanninger Date: Sat, 17 Apr 2021 18:18:43 +0200 Subject: [PATCH] rc: make insertion hooks more consistent --- rc/filetype/lua.kak | 2 +- rc/filetype/mercury.kak | 2 +- rc/filetype/moon.kak | 2 +- rc/filetype/python.kak | 1 + 4 files changed, 4 insertions(+), 3 deletions(-) diff --git a/rc/filetype/lua.kak b/rc/filetype/lua.kak index 6c3f9f52..05684c14 100644 --- a/rc/filetype/lua.kak +++ b/rc/filetype/lua.kak @@ -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 ks^\h*\K--\h*yghjP } + try %{ execute-keys -draft ks^\h*\K--\h* y gh j P } # wisely add end structure evaluate-commands -save-regs x %[ try %{ execute-keys -draft ks^\h+"xy } catch %{ reg x '' } # Save previous line indent in register x diff --git a/rc/filetype/mercury.kak b/rc/filetype/mercury.kak index 4605d84b..4292d146 100644 --- a/rc/filetype/mercury.kak +++ b/rc/filetype/mercury.kak @@ -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 s ^\h*\%\h* y jgh P } + try %{ execute-keys -draft k s ^\h*\%\h* y gh j P } } } diff --git a/rc/filetype/moon.kak b/rc/filetype/moon.kak index 28755be6..1e62f464 100644 --- a/rc/filetype/moon.kak +++ b/rc/filetype/moon.kak @@ -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 s ^ \h * \K -- \h * y gh j P } + try %{ execute-keys -draft k s ^\h*\K--\h* y gh j P } # preserve previous line indent try %{ execute-keys -draft K } # filter previous line diff --git a/rc/filetype/python.kak b/rc/filetype/python.kak index 7077b0cb..7f0e83d8 100644 --- a/rc/filetype/python.kak +++ b/rc/filetype/python.kak @@ -149,6 +149,7 @@ define-command -hidden python-insert-on-new-line %{ try %{ execute-keys -draft k s ^\h*#\h* y jgh P } } } + define-command -hidden python-indent-on-new-line %< evaluate-commands -draft -itersel %< # preserve previous line indent