From 816bdc91f6e0fc3f934c2b37a0d029083e9b7d60 Mon Sep 17 00:00:00 2001 From: Johannes Altmanninger Date: Sat, 10 Oct 2020 12:15:57 +0200 Subject: [PATCH] rc fish.kak: split fish-insert hook out from fish-indent Same as in sh.kak; this allows to only disable the insert hook using %opt{disabled_hooks}. --- rc/filetype/fish.kak | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/rc/filetype/fish.kak b/rc/filetype/fish.kak index 80c677b98..1946e8892 100644 --- a/rc/filetype/fish.kak +++ b/rc/filetype/fish.kak @@ -15,6 +15,7 @@ hook global WinSetOption filetype=fish %{ require-module fish hook window InsertChar .* -group fish-indent fish-indent-on-char + hook window InsertChar \n -group fish-insert fish-insert-on-new-line hook window InsertChar \n -group fish-indent fish-indent-on-new-line hook -once -always window WinSetOption filetype=.* %{ remove-hooks window fish-.+ } @@ -64,10 +65,15 @@ define-command -hidden fish-indent-on-char %{ } } -define-command -hidden fish-indent-on-new-line %{ +define-command -hidden fish-insert-on-new-line %{ evaluate-commands -no-hooks -draft -itersel %{ # copy '#' comment prefix and following white spaces try %{ execute-keys -draft k s ^\h*#\h* y jgh P } + } +} + +define-command -hidden fish-indent-on-new-line %{ + evaluate-commands -no-hooks -draft -itersel %{ # preserve previous line indent try %{ execute-keys -draft K } # cleanup trailing whitespaces from previous line