rc filetype: add some missing ModeChange hooks for trim-indent

Some languages have a trim-indent command but don't use it (for no
apparent reason). Make them trim trailing spaces when exiting insert
mode, like most other languages support scripts do.
This commit is contained in:
Johannes Altmanninger 2022-04-30 11:27:12 +02:00
parent b929748f8e
commit fea851b78b
8 changed files with 10 additions and 6 deletions

View File

@ -17,6 +17,7 @@ hook global WinSetOption filetype=crystal %{
add-highlighter window/crystal ref crystal add-highlighter window/crystal ref crystal
evaluate-commands set-option window static_words %opt{crystal_keywords} %opt{crystal_attributes} %opt{crystal_objects} evaluate-commands set-option window static_words %opt{crystal_keywords} %opt{crystal_attributes} %opt{crystal_objects}
hook window ModeChange pop:insert:.* -group crystal-trim-indent crystal-trim-indent
hook window InsertChar .* -group crystal-indent crystal-indent-on-char hook window InsertChar .* -group crystal-indent crystal-indent-on-char
hook window InsertChar '\n' -group crystal-indent crystal-indent-on-new-line hook window InsertChar '\n' -group crystal-indent crystal-indent-on-new-line
hook window InsertChar '\n' -group crystal-insert crystal-insert-on-new-line hook window InsertChar '\n' -group crystal-insert crystal-insert-on-new-line

View File

@ -14,6 +14,7 @@ hook global BufCreate .*[.](fish) %{
hook global WinSetOption filetype=fish %{ hook global WinSetOption filetype=fish %{
require-module fish require-module fish
hook window ModeChange pop:insert:.* -group fish-trim-indent fish-trim-indent
hook window InsertChar .* -group fish-indent fish-indent-on-char 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-insert fish-insert-on-new-line
hook window InsertChar \n -group fish-indent fish-indent-on-new-line hook window InsertChar \n -group fish-indent fish-indent-on-new-line

View File

@ -7,6 +7,7 @@ hook global BufCreate .*\.(s|S|asm)$ %{
hook global WinSetOption filetype=gas %{ hook global WinSetOption filetype=gas %{
require-module gas require-module gas
hook window ModeChange pop:insert:.* -group gas-trim-indent gas-trim-indent
hook window InsertChar \n -group gas-indent gas-indent-on-new-line hook window InsertChar \n -group gas-indent gas-indent-on-new-line
hook -once -always window WinSetOption filetype=.* %{ remove-hooks window gas-.+ } hook -once -always window WinSetOption filetype=.* %{ remove-hooks window gas-.+ }
} }

View File

@ -16,6 +16,7 @@ hook global WinSetOption filetype=ruby %{
set-option window static_words %opt{ruby_static_words} set-option window static_words %opt{ruby_static_words}
hook window ModeChange pop:insert:.* -group ruby-trim-indent ruby-trim-indent
hook window InsertChar .* -group ruby-indent ruby-indent-on-char hook window InsertChar .* -group ruby-indent ruby-indent-on-char
hook window InsertChar \n -group ruby-indent ruby-indent-on-new-line hook window InsertChar \n -group ruby-indent ruby-indent-on-new-line
hook window InsertChar \n -group ruby-insert ruby-insert-on-new-line hook window InsertChar \n -group ruby-insert ruby-insert-on-new-line