mirror of
https://github.com/mawww/kakoune.git
synced 2024-12-23 19:46:33 +03:00
Replace ModeChange hooks by ModePush and ModePop
Remove deprecated InsertBegin, InsertEnd, NormalBegin, NormalEnd hooks. Closes #2545
This commit is contained in:
parent
3a36a2486e
commit
e4fb70ebec
@ -8,6 +8,10 @@ released versions.
|
||||
* Arrow keys and `<home>`, `<end>` are not normal mode commands
|
||||
anymore but default key mappings.
|
||||
|
||||
* `ModeChange` hook parameter now takes `push:` or `pop:` prefix,
|
||||
`InsertBegin`, `InsertEnd`, `NormalBegin` and `NormalEnd`
|
||||
were removed.
|
||||
|
||||
== Kakoune 2019.07.01
|
||||
|
||||
* Re-organized bundled script files directory hierarchy.
|
||||
|
@ -48,24 +48,12 @@ name. Hooks with no description will always use an empty string.
|
||||
*NormalIdle*::
|
||||
a certain duration has passed since the last keypress in normal mode
|
||||
|
||||
*NormalBegin*::
|
||||
entering normal mode
|
||||
|
||||
*NormalEnd*::
|
||||
leaving normal mode
|
||||
|
||||
*NormalKey* `key`::
|
||||
a key is received in normal mode
|
||||
|
||||
*InsertIdle*::
|
||||
a certain duration has passed since the last keypress in insert mode
|
||||
|
||||
*InsertBegin*::
|
||||
entering insert mode
|
||||
|
||||
*InsertEnd*::
|
||||
leaving insert mode
|
||||
|
||||
*InsertKey* `key`::
|
||||
a key is received in insert mode
|
||||
|
||||
@ -150,8 +138,8 @@ name. Hooks with no description will always use an empty string.
|
||||
*RuntimeError* `error message`::
|
||||
an error was encountered while executing a user command
|
||||
|
||||
*ModeChange* `<old mode>:<new mode>`::
|
||||
Triggered whenever the current input mode changes
|
||||
*ModeChange* `[push|pop]:<old mode>:<new mode>`::
|
||||
Triggered whenever a mode is pushed or removed from the mode stack.
|
||||
|
||||
*KakBegin* `session name`::
|
||||
kakoune has started, this hook is called just after reading the user
|
||||
|
@ -12,7 +12,7 @@ hook global WinSetOption filetype=awk %{
|
||||
require-module awk
|
||||
|
||||
hook window InsertChar \n -group awk-indent awk-indent-on-new-line
|
||||
hook window ModeChange insert:.* -group awk-trim-indent awk-trim-indent
|
||||
hook window ModeChange pop:insert:.* -group awk-trim-indent awk-trim-indent
|
||||
|
||||
hook -once -always window WinSetOption filetype=.* %{ remove-hooks window awk-.+ }
|
||||
}
|
||||
|
@ -29,7 +29,7 @@ hook global WinSetOption filetype=(c|cpp|objc) %[
|
||||
|
||||
evaluate-commands "set-option window static_words %%opt{%val{hook_param_capture_1}_static_words}"
|
||||
|
||||
hook -group "%val{hook_param_capture_1}-trim-indent" window ModeChange insert:.* c-family-trim-indent
|
||||
hook -group "%val{hook_param_capture_1}-trim-indent" window ModeChange pop:insert:.* c-family-trim-indent
|
||||
hook -group "%val{hook_param_capture_1}-insert" window InsertChar \n c-family-insert-on-newline
|
||||
hook -group "%val{hook_param_capture_1}-indent" window InsertChar \n c-family-indent-on-newline
|
||||
hook -group "%val{hook_param_capture_1}-indent" window InsertChar \{ c-family-indent-on-opening-curly-brace
|
||||
|
@ -14,7 +14,7 @@ hook global BufCreate .*[.](cabal) %{
|
||||
hook global WinSetOption filetype=cabal %[
|
||||
require-module cabal
|
||||
|
||||
hook window ModeChange insert:.* -group cabal-trim-indent cabal-trim-indent
|
||||
hook window ModeChange pop:insert:.* -group cabal-trim-indent cabal-trim-indent
|
||||
hook window InsertChar \n -group cabal-indent cabal-indent-on-new-line
|
||||
hook window InsertChar \{ -group cabal-indent cabal-indent-on-opening-curly-brace
|
||||
hook window InsertChar \} -group cabal-indent cabal-indent-on-closing-curly-brace
|
||||
|
@ -181,7 +181,7 @@ EOF
|
||||
define-command -hidden clojure-configure-window %{
|
||||
set-option window static_words %opt{clojure_static_words}
|
||||
|
||||
hook window ModeChange insert:.* -group clojure-trim-indent clojure-trim-indent
|
||||
hook window ModeChange pop:insert:.* -group clojure-trim-indent clojure-trim-indent
|
||||
hook window InsertChar \n -group clojure-indent clojure-indent-on-new-line
|
||||
|
||||
set-option buffer extra_word_chars '_' . / * ? + - < > ! : "'"
|
||||
|
@ -14,7 +14,7 @@ hook global BufCreate .*[.](coffee) %{
|
||||
hook global WinSetOption filetype=coffee %{
|
||||
require-module coffee
|
||||
|
||||
hook window ModeChange insert:.* -group coffee-trim-indent coffee-trim-indent
|
||||
hook window ModeChange pop:insert:.* -group coffee-trim-indent coffee-trim-indent
|
||||
hook window InsertChar \n -group coffee-indent coffee-indent-on-new-line
|
||||
|
||||
hook -once -always window WinSetOption filetype=.* %{ remove-hooks window coffee-.+ }
|
||||
|
@ -14,7 +14,7 @@ hook global BufCreate .*[.](css) %{
|
||||
hook global WinSetOption filetype=css %[
|
||||
require-module css
|
||||
|
||||
hook window ModeChange insert:.* -group css-trim-indent css-trim-indent
|
||||
hook window ModeChange pop:insert:.* -group css-trim-indent css-trim-indent
|
||||
hook window InsertChar \n -group css-indent css-indent-on-new-line
|
||||
hook window InsertChar \} -group css-indent css-indent-on-closing-curly-brace
|
||||
set-option buffer extra_word_chars '_' '-'
|
||||
|
@ -14,7 +14,7 @@ hook global BufCreate .*[.](feature|story) %{
|
||||
hook global WinSetOption filetype=cucumber %{
|
||||
require-module cucumber
|
||||
|
||||
hook window ModeChange insert:.* -group cucumber-trim-indent cucumber-trim-indent
|
||||
hook window ModeChange pop:insert:.* -group cucumber-trim-indent cucumber-trim-indent
|
||||
hook window InsertChar \n -group cucumber-indent cucumber-indent-on-new-line
|
||||
|
||||
hook -once -always window WinSetOption filetype=.* %{ remove-hooks window cucumber-.+ }
|
||||
|
@ -17,7 +17,7 @@ hook global WinSetOption filetype=d %{
|
||||
set-option window static_words %opt{d_static_words}
|
||||
|
||||
# cleanup trailing whitespaces when exiting insert mode
|
||||
hook window ModeChange insert:.* -group d-trim-indent %{ try %{ execute-keys -draft <a-x>s^\h+$<ret>d } }
|
||||
hook window ModeChange pop:insert:.* -group d-trim-indent %{ try %{ execute-keys -draft <a-x>s^\h+$<ret>d } }
|
||||
hook window InsertChar \n -group d-indent d-indent-on-new-line
|
||||
hook window InsertChar \{ -group d-indent d-indent-on-opening-curly-brace
|
||||
hook window InsertChar \} -group d-indent d-indent-on-closing-curly-brace
|
||||
@ -77,7 +77,7 @@ evaluate-commands %sh{
|
||||
types="${types}|string|ubyte|ucent|uint|ulong|ushort|void|wchar|wstring"
|
||||
values="true|false|null"
|
||||
tokens="__FILE__|__MODULE__|__LINE__|__FUNCTION__"
|
||||
tokens="${tokens}|__PRETTY_FUNCTION__|__DATE__|__EOF__|__TIME__"
|
||||
tokens="${tokens}|__Change|pop:__DATE__|__EOF__|__TIME__"
|
||||
tokens="${tokens}|__TIMESTAMP__|__VENDOR__|__VERSION__|#line"
|
||||
properties="this|init|sizeof|alignof|mangleof|stringof|infinity|nan|dig|epsilon|mant_dig"
|
||||
properties="${properties}|max_10_exp|min_exp|max|min_normal|re|im|classinfo"
|
||||
|
@ -17,7 +17,7 @@ hook global WinSetOption filetype=dart %{
|
||||
set-option window static_words %opt{dart_static_words}
|
||||
|
||||
# cleanup trailing whitespaces when exiting insert mode
|
||||
hook window ModeChange insert:.* -group dart-trim-indent %{ try %{ execute-keys -draft <a-x>s^\h+$<ret>d } }
|
||||
hook window ModeChange pop:insert:.* -group dart-trim-indent %{ try %{ execute-keys -draft <a-x>s^\h+$<ret>d } }
|
||||
hook window InsertChar \n -group dart-indent dart-indent-on-new-line
|
||||
hook window InsertChar \{ -group dart-indent dart-indent-on-opening-curly-brace
|
||||
hook window InsertChar \} -group dart-indent dart-indent-on-closing-curly-brace
|
||||
|
@ -14,7 +14,7 @@ hook global BufCreate .*[.](ex|exs) %{
|
||||
hook global WinSetOption filetype=elixir %{
|
||||
require-module elixir
|
||||
|
||||
hook window ModeChange insert:.* -group elixir-trim-indent elixir-trim-indent
|
||||
hook window ModeChange pop:insert:.* -group elixir-trim-indent elixir-trim-indent
|
||||
hook window InsertChar \n -group elixir-indent elixir-indent-on-new-line
|
||||
|
||||
hook -once -always window WinSetOption filetype=.* %{ remove-hooks window elixir-.+ }
|
||||
|
@ -14,7 +14,7 @@ hook global BufCreate .*[.](elm) %{
|
||||
hook global WinSetOption filetype=elm %{
|
||||
require-module elm
|
||||
|
||||
hook window ModeChange insert:.* -group elm-trim-indent elm-trim-indent
|
||||
hook window ModeChange pop:insert:.* -group elm-trim-indent elm-trim-indent
|
||||
hook window InsertChar \n -group elm-indent elm-indent-on-new-line
|
||||
|
||||
hook -once -always window WinSetOption filetype=.* %{ remove-hooks window elm-.+ }
|
||||
|
@ -17,7 +17,7 @@ hook global WinSetOption filetype=go %{
|
||||
set-option window static_words %opt{go_static_words}
|
||||
|
||||
# cleanup trailing whitespaces when exiting insert mode
|
||||
hook window ModeChange insert:.* -group go-trim-indent %{ try %{ execute-keys -draft <a-x>s^\h+$<ret>d } }
|
||||
hook window ModeChange pop:insert:.* -group go-trim-indent %{ try %{ execute-keys -draft <a-x>s^\h+$<ret>d } }
|
||||
hook window InsertChar \n -group go-indent go-indent-on-new-line
|
||||
hook window InsertChar \{ -group go-indent go-indent-on-opening-curly-brace
|
||||
hook window InsertChar \} -group go-indent go-indent-on-closing-curly-brace
|
||||
|
@ -14,7 +14,7 @@ hook global BufCreate .*[.](haml) %{
|
||||
hook global WinSetOption filetype=haml %{
|
||||
require-module haml
|
||||
|
||||
hook window ModeChange insert:.* -group haml-trim-indent haml-trim-indent
|
||||
hook window ModeChange pop:insert:.* -group haml-trim-indent haml-trim-indent
|
||||
hook window InsertChar \n -group haml-indent haml-indent-on-new-line
|
||||
|
||||
hook -once -always window WinSetOption filetype=.* %{ remove-hooks window haml-.+ }
|
||||
|
@ -15,7 +15,7 @@ hook global WinSetOption filetype=haskell %{
|
||||
require-module haskell
|
||||
|
||||
set-option buffer extra_word_chars '_' "'"
|
||||
hook window ModeChange insert:.* -group haskell-trim-indent haskell-trim-indent
|
||||
hook window ModeChange pop:insert:.* -group haskell-trim-indent haskell-trim-indent
|
||||
hook window InsertChar \n -group haskell-indent haskell-indent-on-new-line
|
||||
|
||||
hook -once -always window WinSetOption filetype=.* %{ remove-hooks window haskell-.+ }
|
||||
|
@ -11,7 +11,7 @@ hook global BufCreate .*[.](hbs) %{
|
||||
hook global WinSetOption filetype=hbs %{
|
||||
require-module hbs
|
||||
|
||||
hook window ModeChange insert:.* -group hbs-trim-indent hbs-trim-indent
|
||||
hook window ModeChange pop:insert:.* -group hbs-trim-indent hbs-trim-indent
|
||||
hook window InsertChar \n -group hbs-indent hbs-indent-on-new-line
|
||||
hook window InsertChar .* -group hbs-indent hbs-indent-on-char
|
||||
hook window InsertChar '>' -group hbs-indent html-indent-on-greater-than
|
||||
|
@ -18,7 +18,7 @@ hook global BufCreate .*\.xml %{
|
||||
hook global WinSetOption filetype=(html|xml) %{
|
||||
require-module html
|
||||
|
||||
hook window ModeChange insert:.* -group "%val{hook_param_capture_1}-trim-indent" html-trim-indent
|
||||
hook window ModeChange pop:insert:.* -group "%val{hook_param_capture_1}-trim-indent" html-trim-indent
|
||||
hook window InsertChar '>' -group "%val{hook_param_capture_1}-indent" html-indent-on-greater-than
|
||||
hook window InsertChar \n -group "%val{hook_param_capture_1}-indent" html-indent-on-new-line
|
||||
|
||||
|
@ -9,7 +9,7 @@ hook global WinSetOption filetype=i3 %[
|
||||
require-module i3
|
||||
|
||||
# cleanup trailing whitespaces when exiting insert mode
|
||||
hook window ModeChange insert:.* -group i3-trim-indent %{ try %{ execute-keys -draft <a-x>s^\h+$<ret>d } }
|
||||
hook window ModeChange pop:insert:.* -group i3-trim-indent %{ try %{ execute-keys -draft <a-x>s^\h+$<ret>d } }
|
||||
hook window InsertChar \n -group i3-indent i3-indent-on-new-line
|
||||
hook window InsertChar \} -group i3-indent i3-indent-on-closing-curly-brace
|
||||
|
||||
|
@ -9,7 +9,7 @@ hook global WinSetOption filetype=java %{
|
||||
require-module java
|
||||
|
||||
# cleanup trailing whitespaces when exiting insert mode
|
||||
hook window ModeChange insert:.* -group java-trim-indent %{ try %{ execute-keys -draft <a-x>s^\h+$<ret>d } }
|
||||
hook window ModeChange pop:insert:.* -group java-trim-indent %{ try %{ execute-keys -draft <a-x>s^\h+$<ret>d } }
|
||||
hook window InsertChar \n -group java-indent java-indent-on-new-line
|
||||
hook window InsertChar \{ -group java-indent java-indent-on-opening-curly-brace
|
||||
hook window InsertChar \} -group java-indent java-indent-on-closing-curly-brace
|
||||
|
@ -15,7 +15,7 @@ hook global BufCreate .*[.](ts)x? %{
|
||||
hook global WinSetOption filetype=(javascript|typescript) %{
|
||||
require-module javascript
|
||||
|
||||
hook window ModeChange insert:.* -group "%val{hook_param_capture_1}-trim-indent" javascript-trim-indent
|
||||
hook window ModeChange pop:insert:.* -group "%val{hook_param_capture_1}-trim-indent" javascript-trim-indent
|
||||
hook window InsertChar .* -group "%val{hook_param_capture_1}-indent" javascript-indent-on-char
|
||||
hook window InsertChar \n -group "%val{hook_param_capture_1}-indent" javascript-indent-on-new-line
|
||||
|
||||
|
@ -14,7 +14,7 @@ hook global BufCreate .*[.](json) %{
|
||||
hook global WinSetOption filetype=json %{
|
||||
require-module json
|
||||
|
||||
hook window ModeChange insert:.* -group json-trim-indent json-trim-indent
|
||||
hook window ModeChange pop:insert:.* -group json-trim-indent json-trim-indent
|
||||
hook window InsertChar .* -group json-indent json-indent-on-char
|
||||
hook window InsertChar \n -group json-indent json-indent-on-new-line
|
||||
|
||||
|
@ -20,7 +20,7 @@ hook global WinSetOption filetype=kak %~
|
||||
hook window InsertChar [>)}\]] -group kak-indent kak-indent-on-closing-matching
|
||||
hook window InsertChar (?![[{(<>)}\]])[^\s\w] -group kak-indent kak-indent-on-closing-char
|
||||
# cleanup trailing whitespaces on current line insert end
|
||||
hook window ModeChange insert:.* -group kak-trim-indent %{ try %{ execute-keys -draft \; <a-x> s ^\h+$ <ret> d } }
|
||||
hook window ModeChange pop:insert:.* -group kak-trim-indent %{ try %{ execute-keys -draft \; <a-x> s ^\h+$ <ret> d } }
|
||||
set-option buffer extra_word_chars '_' '-'
|
||||
|
||||
hook -once -always window WinSetOption filetype=.* %{ remove-hooks window kak-.+ }
|
||||
|
@ -16,7 +16,7 @@ hook global WinSetOption filetype=latex %(
|
||||
|
||||
hook window InsertChar \n -group latex-indent %{ latex-indent-newline }
|
||||
hook window InsertChar \} -group latex-indent %{ latex-indent-closing-brace }
|
||||
hook window ModeChange insert:.* -group latex-indent %{ latex-trim-indent }
|
||||
hook window ModeChange pop:insert:.* -group latex-indent %{ latex-trim-indent }
|
||||
hook -once -always window WinSetOption filetype=.* %{ remove-hooks latex-indent }
|
||||
)
|
||||
|
||||
|
@ -13,7 +13,7 @@ hook global WinSetOption filetype=ledger %{
|
||||
require-module ledger
|
||||
|
||||
hook window InsertChar \n -group ledger-indent ledger-indent-on-new-line
|
||||
hook window ModeChange insert:.* -group ledger-trim-indent ledger-trim-indent
|
||||
hook window ModeChange pop:insert:.* -group ledger-trim-indent ledger-trim-indent
|
||||
|
||||
hook -once -always window WinSetOption filetype=.* %{
|
||||
remove-hooks window ledger-.+
|
||||
|
@ -14,7 +14,7 @@ hook global BufCreate .*[.](lisp) %{
|
||||
hook global WinSetOption filetype=lisp %{
|
||||
require-module lisp
|
||||
|
||||
hook window ModeChange insert:.* -group lisp-trim-indent lisp-trim-indent
|
||||
hook window ModeChange pop:insert:.* -group lisp-trim-indent lisp-trim-indent
|
||||
hook window InsertChar \n -group lisp-indent lisp-indent-on-new-line
|
||||
set-option buffer extra_word_chars '_' '+' '-' '*' '/' '@' '$' '%' '^' '&' '_' '=' '<' '>' '~' '.'
|
||||
|
||||
|
@ -14,7 +14,7 @@ hook global BufCreate .*[.](moon) %{
|
||||
hook global WinSetOption filetype=moon %{
|
||||
require-module moon
|
||||
|
||||
hook window ModeChange insert:.* -group moon-trim-indent moon-trim-indent
|
||||
hook window ModeChange pop:insert:.* -group moon-trim-indent moon-trim-indent
|
||||
hook window InsertChar .* -group moon-indent moon-indent-on-char
|
||||
hook window InsertChar \n -group moon-indent moon-indent-on-new-line
|
||||
|
||||
|
@ -18,7 +18,7 @@ hook global WinSetOption filetype=nim %{
|
||||
|
||||
hook window InsertChar \n -group nim-indent nim-indent-on-new-line
|
||||
# cleanup trailing whitespaces on current line insert end
|
||||
hook window ModeChange insert:.* -group nim-trim-indent %{ try %{ exec -draft \; <a-x> s ^\h+$ <ret> d } }
|
||||
hook window ModeChange pop:insert:.* -group nim-trim-indent %{ try %{ exec -draft \; <a-x> s ^\h+$ <ret> d } }
|
||||
|
||||
hook -once -always window WinSetOption filetype=.* %{ remove-hooks window nim-.+ }
|
||||
}
|
||||
|
@ -14,7 +14,7 @@ hook global BufCreate .*[.](nix) %{
|
||||
hook global WinSetOption filetype=nix %{
|
||||
require-module nix
|
||||
|
||||
hook window ModeChange insert:.* -group nix-trim-indent nix-trim-indent
|
||||
hook window ModeChange pop:insert:.* -group nix-trim-indent nix-trim-indent
|
||||
hook window InsertChar .* -group nix-indent nix-indent-on-char
|
||||
hook window InsertChar \n -group nix-indent nix-indent-on-new-line
|
||||
|
||||
|
@ -17,7 +17,7 @@ hook global WinSetOption filetype=perl %{
|
||||
set-option window static_words %opt{perl_static_words}
|
||||
|
||||
# cleanup trailing whitespaces when exiting insert mode
|
||||
hook window ModeChange insert:.* -group perl-trim-indent %{ try %{ execute-keys -draft <a-x>s^\h+$<ret>d } }
|
||||
hook window ModeChange pop:insert:.* -group perl-trim-indent %{ try %{ execute-keys -draft <a-x>s^\h+$<ret>d } }
|
||||
hook window InsertChar \n -group perl-indent perl-indent-on-new-line
|
||||
hook window InsertChar \{ -group perl-indent perl-indent-on-opening-curly-brace
|
||||
hook window InsertChar \} -group perl-indent perl-indent-on-closing-curly-brace
|
||||
|
@ -11,7 +11,7 @@ hook global BufCreate .*[.](php) %{
|
||||
hook global WinSetOption filetype=php %{
|
||||
require-module php
|
||||
|
||||
hook window ModeChange insert:.* -group php-trim-indent php-trim-indent
|
||||
hook window ModeChange pop:insert:.* -group php-trim-indent php-trim-indent
|
||||
hook window InsertChar .* -group php-indent php-indent-on-char
|
||||
hook window InsertChar \n -group php-indent php-indent-on-new-line
|
||||
|
||||
|
@ -18,7 +18,7 @@ hook global WinSetOption filetype=pony %{
|
||||
|
||||
hook window InsertChar \n -group pony-indent pony-indent-on-new-line
|
||||
# cleanup trailing whitespaces on current line insert end
|
||||
hook window ModeChange insert:.* -group pony-trim-indent %{ try %{ execute-keys -draft \; <a-x> s ^\h+$ <ret> d } }
|
||||
hook window ModeChange pop:insert:.* -group pony-trim-indent %{ try %{ execute-keys -draft \; <a-x> s ^\h+$ <ret> d } }
|
||||
|
||||
hook -once -always window WinSetOption filetype=.* %{ remove-hooks window pony-.+ }
|
||||
}
|
||||
|
@ -18,7 +18,7 @@ hook global BufCreate .*[.](pug|jade) %{
|
||||
hook global WinSetOption filetype=pug %{
|
||||
require-module pug
|
||||
|
||||
hook window ModeChange insert:.* -group pug-trim-indent pug-trim-indent
|
||||
hook window ModeChange pop:insert:.* -group pug-trim-indent pug-trim-indent
|
||||
hook window InsertChar \n -group pug-indent pug-indent-on-new-line
|
||||
|
||||
hook -once -always window WinSetOption filetype=.* %{ remove-hooks window pug-.+ }
|
||||
|
@ -18,7 +18,7 @@ hook global WinSetOption filetype=python %{
|
||||
|
||||
hook window InsertChar \n -group python-indent python-indent-on-new-line
|
||||
# cleanup trailing whitespaces on current line insert end
|
||||
hook window ModeChange insert:.* -group python-trim-indent %{ try %{ execute-keys -draft \; <a-x> s ^\h+$ <ret> d } }
|
||||
hook window ModeChange pop:insert:.* -group python-trim-indent %{ try %{ execute-keys -draft \; <a-x> s ^\h+$ <ret> d } }
|
||||
hook -once -always window WinSetOption filetype=.* %{ remove-hooks window python-.+ }
|
||||
}
|
||||
|
||||
|
@ -133,7 +133,7 @@ hook -group r-highlight global WinSetOption filetype=r %{
|
||||
}
|
||||
|
||||
hook global WinSetOption filetype=r %~
|
||||
hook window ModeChange insert:.* r-trim-indent
|
||||
hook window ModeChange pop:insert:.* r-trim-indent
|
||||
hook window InsertChar \n r-insert-on-newline
|
||||
hook window InsertChar \n r-indent-on-newline
|
||||
hook window InsertChar \{ r-indent-on-opening-curly-brace
|
||||
|
@ -16,7 +16,7 @@ hook global BufCreate .*[.](ragel|rl) %{
|
||||
hook global WinSetOption filetype=ragel %{
|
||||
require-module ragel
|
||||
|
||||
hook window ModeChange insert:.* -group ragel-trim-indent ragel-trim-indent
|
||||
hook window ModeChange pop:insert:.* -group ragel-trim-indent ragel-trim-indent
|
||||
hook window InsertChar .* -group ragel-indent ragel-indent-on-char
|
||||
hook window InsertChar \n -group ragel-indent ragel-indent-on-new-line
|
||||
|
||||
|
@ -13,7 +13,7 @@ hook global BufCreate .*[.](rust|rs) %{
|
||||
|
||||
hook global WinSetOption filetype=rust %[
|
||||
require-module rust
|
||||
hook window InsertEnd .* -group rust-trim-indent rust-trim-indent
|
||||
hook window ModeChange pop:insert:.* -group rust-trim-indent rust-trim-indent
|
||||
hook window InsertChar \n -group rust-indent rust-indent-on-new-line
|
||||
hook window InsertChar \{ -group rust-indent rust-indent-on-opening-curly-brace
|
||||
hook window InsertChar [)}] -group rust-indent rust-indent-on-closing
|
||||
|
@ -14,7 +14,7 @@ hook global BufCreate .*[.](sass) %{
|
||||
hook global WinSetOption filetype=sass %{
|
||||
require-module sass
|
||||
|
||||
hook window ModeChange insert:.* -group sass-trim-indent sass-trim-indent
|
||||
hook window ModeChange pop:insert:.* -group sass-trim-indent sass-trim-indent
|
||||
hook window InsertChar \n -group sass-indent sass-indent-on-new-line
|
||||
set-option buffer extra_word_chars '_' '-'
|
||||
|
||||
|
@ -14,7 +14,7 @@ hook global BufCreate .*[.](scala) %{
|
||||
hook global WinSetOption filetype=scala %[
|
||||
require-module scala
|
||||
|
||||
hook window ModeChange insert:.* -group scala-trim-indent scala-trim-indent
|
||||
hook window ModeChange pop:insert:.* -group scala-trim-indent scala-trim-indent
|
||||
hook window InsertChar \n -group scala-indent scala-indent-on-new-line
|
||||
hook window InsertChar \} -group scala-indent scala-indent-on-closing-curly-brace
|
||||
|
||||
|
@ -17,7 +17,7 @@ hook global WinSetOption filetype=scheme %{
|
||||
set-option window static_words %opt{scheme_static_words}
|
||||
|
||||
set-option buffer extra_word_chars '_' '-' '!' '%' '?' '<' '>' '='
|
||||
hook window InsertEnd .* -group scheme-trim-indent lisp-trim-indent
|
||||
hook window ModeChange pop:insert:.* -group scheme-trim-indent lisp-trim-indent
|
||||
hook window InsertChar \n -group scheme-indent lisp-indent-on-new-line
|
||||
|
||||
hook -once -always window WinSetOption filetype=.* %{ remove-hooks window scheme-.+ }
|
||||
|
@ -14,7 +14,7 @@ hook global BufCreate .*[.](scss) %{
|
||||
hook global WinSetOption filetype=scss %[
|
||||
require-module scss
|
||||
|
||||
hook window ModeChange insert:.* -group scss-trim-indent scss-trim-indent
|
||||
hook window ModeChange pop:insert:.* -group scss-trim-indent scss-trim-indent
|
||||
hook window InsertChar \n -group scss-indent scss-indent-on-new-line
|
||||
hook window InsertChar \} -group scss-indent scss-indent-on-closing-curly-brace
|
||||
set-option buffer extra_word_chars '_' '-'
|
||||
|
@ -6,7 +6,7 @@ hook global WinSetOption filetype=sh %{
|
||||
require-module sh
|
||||
set-option window static_words %opt{sh_static_words}
|
||||
|
||||
hook window ModeChange insert:.* -group sh-trim-indent sh-trim-indent
|
||||
hook window ModeChange pop:insert:.* -group sh-trim-indent sh-trim-indent
|
||||
hook window InsertChar \n -group sh-indent sh-indent-on-new-line
|
||||
hook -once -always window WinSetOption filetype=.* %{ remove-hooks window sh-.+ }
|
||||
}
|
||||
|
@ -14,7 +14,7 @@ hook global BufCreate .*\.(toml) %{
|
||||
hook global WinSetOption filetype=toml %{
|
||||
require-module toml
|
||||
|
||||
hook window ModeChange insert:.* -group toml-trim-indent toml-trim-indent
|
||||
hook window ModeChange pop:insert:.* -group toml-trim-indent toml-trim-indent
|
||||
hook window InsertChar \n -group toml-indent toml-indent-on-new-line
|
||||
|
||||
hook -once -always window WinSetOption filetype=.* %{ remove-hooks window toml-.+ }
|
||||
|
@ -14,7 +14,7 @@ hook global BufCreate .*[.](ya?ml) %{
|
||||
hook global WinSetOption filetype=yaml %{
|
||||
require-module yaml
|
||||
|
||||
hook window ModeChange insert:.* -group yaml-trim-indent yaml-trim-indent
|
||||
hook window ModeChange pop:insert:.* -group yaml-trim-indent yaml-trim-indent
|
||||
hook window InsertChar \n -group yaml-indent yaml-indent-on-new-line
|
||||
hook -once -always window WinSetOption filetype=.* %{ remove-hooks window yaml-.+ }
|
||||
}
|
||||
|
@ -30,10 +30,8 @@ enum class Hook
|
||||
BufSetOption,
|
||||
ClientCreate,
|
||||
ClientClose,
|
||||
InsertBegin,
|
||||
InsertChar,
|
||||
InsertDelete,
|
||||
InsertEnd,
|
||||
InsertIdle,
|
||||
InsertKey,
|
||||
InsertMove,
|
||||
@ -46,8 +44,6 @@ enum class Hook
|
||||
GlobalSetOption,
|
||||
RuntimeError,
|
||||
PromptIdle,
|
||||
NormalBegin,
|
||||
NormalEnd,
|
||||
NormalIdle,
|
||||
NormalKey,
|
||||
ModeChange,
|
||||
@ -62,7 +58,7 @@ enum class Hook
|
||||
|
||||
constexpr auto enum_desc(Meta::Type<Hook>)
|
||||
{
|
||||
return make_array<EnumDesc<Hook>, 41>({
|
||||
return make_array<EnumDesc<Hook>, 38>({
|
||||
{Hook::BufCreate, "BufCreate"},
|
||||
{Hook::BufNewFile, "BufNewFile"},
|
||||
{Hook::BufOpenFile, "BufOpenFile"},
|
||||
@ -76,10 +72,8 @@ constexpr auto enum_desc(Meta::Type<Hook>)
|
||||
{Hook::BufSetOption, "BufSetOption"},
|
||||
{Hook::ClientCreate, "ClientCreate"},
|
||||
{Hook::ClientClose, "ClientClose"},
|
||||
{Hook::InsertBegin, "InsertBegin"},
|
||||
{Hook::InsertChar, "InsertChar"},
|
||||
{Hook::InsertDelete, "InsertDelete"},
|
||||
{Hook::InsertEnd, "InsertEnd"},
|
||||
{Hook::InsertIdle, "InsertIdle"},
|
||||
{Hook::InsertKey, "InsertKey"},
|
||||
{Hook::InsertMove, "InsertMove"},
|
||||
@ -92,8 +86,6 @@ constexpr auto enum_desc(Meta::Type<Hook>)
|
||||
{Hook::GlobalSetOption, "GlobalSetOption"},
|
||||
{Hook::RuntimeError, "RuntimeError"},
|
||||
{Hook::PromptIdle, "PromptIdle"},
|
||||
{Hook::NormalBegin, "NormalBegin"},
|
||||
{Hook::NormalEnd, "NormalEnd"},
|
||||
{Hook::NormalIdle, "NormalIdle"},
|
||||
{Hook::NormalKey, "NormalKey"},
|
||||
{Hook::ModeChange, "ModeChange"},
|
||||
|
@ -203,8 +203,6 @@ public:
|
||||
context().hooks_disabled().unset();
|
||||
m_hooks_disabled = false;
|
||||
}
|
||||
|
||||
context().hooks().run_hook(Hook::NormalBegin, "", context());
|
||||
}
|
||||
|
||||
void on_disabled(bool temporary) override
|
||||
@ -217,8 +215,6 @@ public:
|
||||
context().hooks_disabled().unset();
|
||||
m_hooks_disabled = false;
|
||||
}
|
||||
|
||||
context().hooks().run_hook(Hook::NormalEnd, "", context());
|
||||
}
|
||||
|
||||
void on_key(Key key) override
|
||||
@ -1153,7 +1149,6 @@ public:
|
||||
last_insert().keys.clear();
|
||||
last_insert().disable_hooks = context().hooks_disabled();
|
||||
last_insert().count = count;
|
||||
context().hooks().run_hook(Hook::InsertBegin, "", context());
|
||||
prepare(mode, count);
|
||||
}
|
||||
|
||||
@ -1197,11 +1192,6 @@ public:
|
||||
}
|
||||
else if (key == Key::Escape or key == ctrl('c'))
|
||||
{
|
||||
if (m_in_end)
|
||||
throw runtime_error("asked to exit insert mode while running InsertEnd hook");
|
||||
m_in_end = true;
|
||||
context().hooks().run_hook(Hook::InsertEnd, "", context());
|
||||
|
||||
m_completer.reset();
|
||||
pop_mode();
|
||||
}
|
||||
@ -1496,7 +1486,6 @@ private:
|
||||
const bool m_restore_cursor;
|
||||
bool m_auto_complete;
|
||||
Timer m_idle_timer;
|
||||
bool m_in_end = false;
|
||||
MouseHandler m_mouse_handler;
|
||||
ScopedSetBool m_disable_hooks;
|
||||
};
|
||||
@ -1520,7 +1509,7 @@ void InputHandler::push_mode(InputMode* new_mode)
|
||||
m_mode_stack.emplace_back(new_mode);
|
||||
new_mode->on_enabled();
|
||||
|
||||
context().hooks().run_hook(Hook::ModeChange, format("{}:{}", prev_name, new_mode->name()), context());
|
||||
context().hooks().run_hook(Hook::ModeChange, format("push:{}:{}", prev_name, new_mode->name()), context());
|
||||
}
|
||||
|
||||
void InputHandler::pop_mode(InputMode* mode)
|
||||
@ -1534,7 +1523,7 @@ void InputHandler::pop_mode(InputMode* mode)
|
||||
m_mode_stack.pop_back();
|
||||
current_mode().on_enabled();
|
||||
|
||||
context().hooks().run_hook(Hook::ModeChange, format("{}:{}", prev_name, current_mode().name()), context());
|
||||
context().hooks().run_hook(Hook::ModeChange, format("pop:{}:{}", prev_name, current_mode().name()), context());
|
||||
}
|
||||
|
||||
void InputHandler::reset_normal_mode()
|
||||
@ -1543,12 +1532,8 @@ void InputHandler::reset_normal_mode()
|
||||
if (m_mode_stack.size() == 1)
|
||||
return;
|
||||
|
||||
StringView prev_name = current_mode().name();
|
||||
current_mode().on_disabled(false);
|
||||
m_mode_stack.resize(1);
|
||||
current_mode().on_enabled();
|
||||
|
||||
context().hooks().run_hook(Hook::ModeChange, format("{}:{}", prev_name, current_mode().name()), context());
|
||||
while (m_mode_stack.size() > 1)
|
||||
pop_mode(m_mode_stack.back().get());
|
||||
}
|
||||
|
||||
void InputHandler::insert(InsertMode mode, int count)
|
||||
|
@ -44,6 +44,10 @@ struct {
|
||||
unsigned int version;
|
||||
const char* notes;
|
||||
} constexpr version_notes[] = { {
|
||||
0,
|
||||
"» ModeChange parameter has changed to contain push/pop\n"
|
||||
" ${Mode}Begin/${Mode}End hooks were removed\n"
|
||||
}, {
|
||||
20190701,
|
||||
"» %file{...} expansions to read files\n"
|
||||
"» echo -to-file <filename> to write to file\n"
|
||||
|
Loading…
Reference in New Issue
Block a user