1
1
mirror of https://github.com/mawww/kakoune.git synced 2024-09-20 09:19:24 +03:00

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}.
This commit is contained in:
Johannes Altmanninger 2020-10-10 12:15:57 +02:00
parent 65587d1eee
commit 816bdc91f6

View File

@ -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