Merge remote-tracking branch 'krobelus/extra-hook-for-fish-insert' into master

This commit is contained in:
Maxime Coste 2020-11-08 15:18:23 +11:00
commit 06b082da54

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