diff options
| author | Johannes Altmanninger <aclopte@gmail.com> | 2020-10-10 12:15:57 +0200 |
|---|---|---|
| committer | Johannes Altmanninger <aclopte@gmail.com> | 2020-10-19 19:01:17 +0200 |
| commit | 816bdc91f6e0fc3f934c2b37a0d029083e9b7d60 (patch) | |
| tree | 9e927ae05ea35ab1a461376f4f4f2c8bbc9c1da2 /rc/filetype/fish.kak | |
| parent | 65587d1eee9eddedafbba0ecd9c102d87149554f (diff) | |
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}.
Diffstat (limited to 'rc/filetype/fish.kak')
| -rw-r--r-- | rc/filetype/fish.kak | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/rc/filetype/fish.kak b/rc/filetype/fish.kak index 80c677b9..1946e889 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 <a-x> s ^\h*#\h* <ret> 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 <semicolon> K <a-&> } # cleanup trailing whitespaces from previous line |
