summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSeerLite <seerlite@tuta.io>2020-08-14 23:43:43 -0400
committerSeerLite <seerlite@tuta.io>2020-08-14 23:43:43 -0400
commite0c756d9430baee8f0d53a28cf4dfe87e922ac0f (patch)
tree5cf5e88ab08dad58c7479c1b1e0fddbcda374288
parent1af4a1b1a86003310f26af0d0cdcc0e6669063e3 (diff)
kakrc.kak: Split auto-insert and auto-indent hooks
-rw-r--r--rc/filetype/kakrc.kak8
1 files changed, 7 insertions, 1 deletions
diff --git a/rc/filetype/kakrc.kak b/rc/filetype/kakrc.kak
index bf59cdbf..0f766d73 100644
--- a/rc/filetype/kakrc.kak
+++ b/rc/filetype/kakrc.kak
@@ -16,6 +16,7 @@ hook global WinSetOption filetype=kak %~
set-option window static_words %opt{kak_static_words}
+ hook window InsertChar \n -group kak-insert kak-insert-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 (?![[{(<>)}\]])[^\s\w] -group kak-indent kak-indent-on-closing-char
@@ -90,10 +91,15 @@ add-highlighter shared/kakrc/single_string/escape regex "''" 0:default+b
# Commands
# ‾‾‾‾‾‾‾‾
-define-command -hidden kak-indent-on-new-line %~
+define-command -hidden kak-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 }
+ =
+~
+
+define-command -hidden kak-indent-on-new-line %~
+ evaluate-commands -draft -itersel %=
# preserve previous line indent
try %{ execute-keys -draft <semicolon> K <a-&> }
# cleanup trailing whitespaces from previous line