Convert bundled scripts to ModeChange hook

This commit is contained in:
Maxime Coste 2018-01-21 10:35:05 +11:00
parent d22c989984
commit 43f50c0852
33 changed files with 33 additions and 33 deletions

View File

@ -30,7 +30,7 @@ define-command -hidden clojure-indent-on-new-line lisp-indent-on-new-line
hook -group clojure-highlight global WinSetOption filetype=clojure %{ add-highlighter window ref clojure }
hook global WinSetOption filetype=clojure %[
hook window InsertEnd .* -group clojure-hooks clojure-filter-around-selections
hook window ModeChange insert:.* -group clojure-hooks clojure-filter-around-selections
hook window InsertChar \n -group clojure-indent clojure-indent-on-new-line
]

View File

@ -67,7 +67,7 @@ define-command -hidden css-indent-on-closing-curly-brace %[
hook -group css-highlight global WinSetOption filetype=css %{ add-highlighter window ref css }
hook global WinSetOption filetype=css %[
hook window InsertEnd .* -group css-hooks css-filter-around-selections
hook window ModeChange insert:.* -group css-hooks css-filter-around-selections
hook window InsertChar \n -group css-indent css-indent-on-new-line
hook window InsertChar \} -group css-indent css-indent-on-closing-curly-brace
]

View File

@ -117,7 +117,7 @@ hook -group d-highlight global WinSetOption filetype=d %{ add-highlighter window
hook global WinSetOption filetype=d %{
# cleanup trailing whitespaces when exiting insert mode
hook window InsertEnd .* -group d-hooks %{ try %{ execute-keys -draft <a-x>s^\h+$<ret>d } }
hook window ModeChange insert:.* -group d-hooks %{ 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

View File

@ -89,7 +89,7 @@ hook -group go-highlight global WinSetOption filetype=go %{ add-highlighter wind
hook global WinSetOption filetype=go %{
# cleanup trailing whitespaces when exiting insert mode
hook window InsertEnd .* -group go-hooks %{ try %{ execute-keys -draft <a-x>s^\h+$<ret>d } }
hook window ModeChange insert:.* -group go-hooks %{ 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

View File

@ -99,7 +99,7 @@ hook -group haskell-highlight global WinSetOption filetype=haskell %{ add-highli
hook global WinSetOption filetype=haskell %{
set-option window extra_word_chars "'"
hook window InsertEnd .* -group haskell-hooks haskell-filter-around-selections
hook window ModeChange insert:.* -group haskell-hooks haskell-filter-around-selections
hook window InsertChar \n -group haskell-indent haskell-indent-on-new-line
}

View File

@ -68,7 +68,7 @@ define-command -hidden html-indent-on-new-line %{
hook -group html-highlight global WinSetOption filetype=(?:html|xml) %{ add-highlighter window ref html }
hook global WinSetOption filetype=(?:html|xml) %{
hook window InsertEnd .* -group html-hooks html-filter-around-selections
hook window ModeChange insert:.* -group html-hooks html-filter-around-selections
hook window InsertChar '>' -group html-indent html-indent-on-greater-than
hook window InsertChar \n -group html-indent html-indent-on-new-line
}

View File

@ -51,7 +51,7 @@ define-command -hidden java-indent-on-closing-curly-brace %[
# ‾‾‾‾‾‾‾‾‾‾‾‾‾‾
hook global WinSetOption filetype=java %{
# cleanup trailing whitespaces when exiting insert mode
hook window InsertEnd .* -group java-hooks %{ try %{ execute-keys -draft <a-x>s^\h+$<ret>d } }
hook window ModeChange insert:.* -group java-hooks %{ 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

View File

@ -70,7 +70,7 @@ define-command -hidden javascript-indent-on-new-line %<
hook -group javascript-highlight global WinSetOption filetype=javascript %{ add-highlighter window ref javascript }
hook global WinSetOption filetype=javascript %{
hook window InsertEnd .* -group javascript-hooks javascript-filter-around-selections
hook window ModeChange insert:.* -group javascript-hooks javascript-filter-around-selections
hook window InsertChar .* -group javascript-indent javascript-indent-on-char
hook window InsertChar \n -group javascript-indent javascript-indent-on-new-line
}

View File

@ -50,7 +50,7 @@ define-command -hidden json-indent-on-new-line %<
hook -group json-highlight global WinSetOption filetype=json %{ add-highlighter window ref json }
hook global WinSetOption filetype=json %{
hook window InsertEnd .* -group json-hooks json-filter-around-selections
hook window ModeChange insert:.* -group json-hooks json-filter-around-selections
hook window InsertChar .* -group json-indent json-indent-on-char
hook window InsertChar \n -group json-indent json-indent-on-new-line
}

View File

@ -46,7 +46,7 @@ define-command -hidden lisp-indent-on-new-line %{
hook -group lisp-highlight global WinSetOption filetype=lisp %{ add-highlighter window ref lisp }
hook global WinSetOption filetype=lisp %{
hook window InsertEnd .* -group lisp-hooks lisp-filter-around-selections
hook window ModeChange insert:.* -group lisp-hooks lisp-filter-around-selections
hook window InsertChar \n -group lisp-indent lisp-indent-on-new-line
}

View File

@ -106,7 +106,7 @@ hook -group perl-highlight global WinSetOption filetype=perl %{ add-highlighter
hook global WinSetOption filetype=perl %{
# cleanup trailing whitespaces when exiting insert mode
hook window InsertEnd .* -group perl-hooks %{ try %{ execute-keys -draft <a-x>s^\h+$<ret>d } }
hook window ModeChange insert:.* -group perl-hooks %{ 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

View File

@ -74,7 +74,7 @@ define-command -hidden rust-indent-on-closing-curly-brace %[
hook -group rust-highlight global WinSetOption filetype=rust %{ add-highlighter window ref rust }
hook global WinSetOption filetype=rust %[
hook window InsertEnd .* -group rust-hooks rust-filter-around-selections
hook window ModeChange insert:.* -group rust-hooks rust-filter-around-selections
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-curly-brace

View File

@ -65,7 +65,7 @@ define-command -hidden scala-indent-on-closing-curly-brace %[
hook -group scala-highlight global WinSetOption filetype=scala %{ add-highlighter window ref scala }
hook global WinSetOption filetype=scala %[
hook window InsertEnd .* -group scala-hooks scala-filter-around-selections
hook window ModeChange insert:.* -group scala-hooks scala-filter-around-selections
hook window InsertChar \n -group scala-indent scala-indent-on-new-line
hook window InsertChar \} -group scala-indent scala-indent-on-closing-curly-brace
]

View File

@ -52,7 +52,7 @@ define-command -hidden yaml-indent-on-new-line %{
hook -group yaml-highlight global WinSetOption filetype=yaml %{ add-highlighter window ref yaml }
hook global WinSetOption filetype=yaml %{
hook window InsertEnd .* -group yaml-hooks yaml-filter-around-selections
hook window ModeChange insert:.* -group yaml-hooks yaml-filter-around-selections
hook window InsertChar \n -group yaml-indent yaml-indent-on-new-line
}

View File

@ -277,7 +277,7 @@ hook global WinSetOption filetype=(c|cpp|objc) %[
remove-hooks window c-family-insert
}
hook -group c-family-indent window InsertEnd .* c-family-trim-autoindent
hook -group c-family-indent window ModeChange insert:.* c-family-trim-autoindent
hook -group c-family-insert window InsertChar \n c-family-insert-on-newline
hook -group c-family-indent window InsertChar \n c-family-indent-on-newline
hook -group c-family-indent window InsertChar \{ c-family-indent-on-opening-curly-brace

View File

@ -85,7 +85,7 @@ hook -group kak-highlight global WinSetOption filetype=kak %{ add-highlighter wi
hook global WinSetOption filetype=kak %{
hook window InsertChar \n -group kak-indent kak-indent-on-new-line
# cleanup trailing whitespaces on current line insert end
hook window InsertEnd .* -group kak-indent %{ try %{ execute-keys -draft \; <a-x> s ^\h+$ <ret> d } }
hook window ModeChange insert:.* -group kak-indent %{ try %{ execute-keys -draft \; <a-x> s ^\h+$ <ret> d } }
set-option buffer extra_word_chars '-'
}

View File

@ -147,7 +147,7 @@ hook -group python-highlight global WinSetOption filetype=python %{ add-highligh
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 InsertEnd .* -group python-indent %{ try %{ execute-keys -draft \; <a-x> s ^\h+$ <ret> d } }
hook window ModeChange insert:.* -group python-indent %{ try %{ execute-keys -draft \; <a-x> s ^\h+$ <ret> d } }
}
hook -group python-highlight global WinSetOption filetype=(?!python).* %{ remove-highlighter window/python }

View File

@ -62,7 +62,7 @@ define-command -hidden cabal-indent-on-closing-curly-brace %[
hook -group cabal-highlight global WinSetOption filetype=cabal %{ add-highlighter window ref cabal }
hook global WinSetOption filetype=cabal %[
hook window InsertEnd .* -group cabal-hooks cabal-filter-around-selections
hook window ModeChange insert:.* -group cabal-hooks cabal-filter-around-selections
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

View File

@ -72,7 +72,7 @@ define-command -hidden coffee-indent-on-new-line %{
hook -group coffee-highlight global WinSetOption filetype=coffee %{ add-highlighter window ref coffee }
hook global WinSetOption filetype=coffee %{
hook window InsertEnd .* -group coffee-hooks coffee-filter-around-selections
hook window ModeChange insert:.* -group coffee-hooks coffee-filter-around-selections
hook window InsertChar \n -group coffee-indent coffee-indent-on-new-line
}

View File

@ -80,7 +80,7 @@ define-command -hidden cucumber-indent-on-new-line %{
hook -group cucumber-highlight global WinSetOption filetype=cucumber %{ add-highlighter window ref cucumber }
hook global WinSetOption filetype=cucumber %{
hook window InsertEnd .* -group cucumber-hooks cucumber-filter-around-selections
hook window ModeChange insert:.* -group cucumber-hooks cucumber-filter-around-selections
hook window InsertChar \n -group cucumber-indent cucumber-indent-on-new-line
}

View File

@ -68,7 +68,7 @@ define-command -hidden elixir-indent-on-new-line %{
hook -group elixir-highlight global WinSetOption filetype=elixir %{ add-highlighter window ref elixir }
hook global WinSetOption filetype=elixir %{
hook window InsertEnd .* -group elixir-hooks elixir-filter-around-selections
hook window ModeChange insert:.* -group elixir-hooks elixir-filter-around-selections
hook window InsertChar \n -group elixir-indent elixir-indent-on-new-line
}

View File

@ -59,7 +59,7 @@ define-command -hidden elm-indent-on-new-line %{
hook -group elm-highlight global WinSetOption filetype=elm %{ add-highlighter window ref elm }
hook global WinSetOption filetype=elm %{
hook window InsertEnd .* -group elm-hooks elm-filter-around-selections
hook window ModeChange insert:.* -group elm-hooks elm-filter-around-selections
hook window InsertChar \n -group elm-indent elm-indent-on-new-line
}

View File

@ -57,7 +57,7 @@ define-command -hidden haml-indent-on-new-line %{
hook -group haml-highlight global WinSetOption filetype=haml %{ add-highlighter window ref haml }
hook global WinSetOption filetype=haml %{
hook window InsertEnd .* -group haml-hooks haml-filter-around-selections
hook window ModeChange insert:.* -group haml-hooks haml-filter-around-selections
hook window InsertChar \n -group haml-indent haml-indent-on-new-line
}

View File

@ -60,7 +60,7 @@ hook -group hbs-highlight global WinSetOption filetype=hbs %{
}
hook global WinSetOption filetype=hbs %{
hook window InsertEnd .* -group hbs-hooks hbs-filter-around-selections
hook window ModeChange insert:.* -group hbs-hooks hbs-filter-around-selections
hook window InsertChar \n -group hbs-indent hbs-indent-on-new-line
}

View File

@ -95,7 +95,7 @@ define-command -hidden moon-indent-on-new-line %{
hook -group moon-highlight global WinSetOption filetype=moon %{ add-highlighter window ref moon }
hook global WinSetOption filetype=moon %{
hook window InsertEnd .* -group moon-hooks moon-filter-around-selections
hook window ModeChange insert:.* -group moon-hooks moon-filter-around-selections
hook window InsertChar .* -group moon-indent moon-indent-on-char
hook window InsertChar \n -group moon-indent moon-indent-on-new-line

View File

@ -77,7 +77,7 @@ hook -group nim-highlight global WinSetOption filetype=nim %{ add-highlighter wi
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 InsertEnd .* -group nim-indent %{ try %{ exec -draft \; <a-x> s ^\h+$ <ret> d } }
hook window ModeChange insert:.* -group nim-indent %{ try %{ exec -draft \; <a-x> s ^\h+$ <ret> d } }
}
hook -group nim-highlight global WinSetOption filetype=(?!nim).* %{ remove-highlighter window/nim }

View File

@ -63,7 +63,7 @@ define-command -hidden php-indent-on-new-line %<
hook -group php-highlight global WinSetOption filetype=php %{ add-highlighter window ref php }
hook global WinSetOption filetype=php %{
hook window InsertEnd .* -group php-hooks php-filter-around-selections
hook window ModeChange insert:.* -group php-hooks php-filter-around-selections
hook window InsertChar .* -group php-indent php-indent-on-char
hook window InsertChar \n -group php-indent php-indent-on-new-line
}

View File

@ -87,7 +87,7 @@ hook -group pony-highlight global WinSetOption filetype=pony %{ add-highlighter
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 InsertEnd .* -group pony-indent %{ try %{ execute-keys -draft \; <a-x> s ^\h+$ <ret> d } }
hook window ModeChange insert:.* -group pony-indent %{ try %{ execute-keys -draft \; <a-x> s ^\h+$ <ret> d } }
}
hook -group pony-highlight global WinSetOption filetype=(?!pony).* %{ remove-highlighter pony }

View File

@ -68,7 +68,7 @@ define-command -hidden pug-indent-on-new-line %{
hook -group pug-highlight global WinSetOption filetype=pug %{ add-highlighter window ref pug }
hook global WinSetOption filetype=pug %{
hook window InsertEnd .* -group pug-hooks pug-filter-around-selections
hook window ModeChange insert:.* -group pug-hooks pug-filter-around-selections
hook window InsertChar \n -group pug-indent pug-indent-on-new-line
}

View File

@ -61,7 +61,7 @@ define-command -hidden ragel-indent-on-new-line %<
hook -group ragel-highlight global WinSetOption filetype=ragel %{ add-highlighter window ref ragel }
hook global WinSetOption filetype=ragel %{
hook window InsertEnd .* -group ragel-hooks ragel-filter-around-selections
hook window ModeChange insert:.* -group ragel-hooks ragel-filter-around-selections
hook window InsertChar .* -group ragel-indent ragel-indent-on-char
hook window InsertChar \n -group ragel-indent ragel-indent-on-new-line
}

View File

@ -53,7 +53,7 @@ define-command -hidden sass-indent-on-new-line %{
hook -group sass-highlight global WinSetOption filetype=sass %{ add-highlighter window ref sass }
hook global WinSetOption filetype=sass %{
hook window InsertEnd .* -group sass-hooks sass-filter-around-selections
hook window ModeChange insert:.* -group sass-hooks sass-filter-around-selections
hook window InsertChar \n -group sass-indent sass-indent-on-new-line
}

View File

@ -35,7 +35,7 @@ define-command -hidden scss-indent-on-closing-curly-brace css-indent-on-closing-
hook -group scss-highlight global WinSetOption filetype=scss %{ add-highlighter window ref scss }
hook global WinSetOption filetype=scss %[
hook window InsertEnd .* -group scss-hooks scss-filter-around-selections
hook window ModeChange insert:.* -group scss-hooks scss-filter-around-selections
hook window InsertChar \n -group scss-indent scss-indent-on-new-line
hook window InsertChar \} -group scss-indent scss-indent-on-closing-curly-brace
]

View File

@ -41,7 +41,7 @@ add-highlighter shared/typescript/code regex \b(enum|as|implements|interface|pac
hook -group typescript-highlight global WinSetOption filetype=typescript %{ add-highlighter window ref typescript }
hook global WinSetOption filetype=javascript %{
hook window InsertEnd .* -group typescript-hooks javascript-filter-around-selections
hook window ModeChange insert:.* -group typescript-hooks javascript-filter-around-selections
hook window InsertChar .* -group typescript-indent javascript-indent-on-char
hook window InsertChar \n -group typescript-indent javascript-indent-on-new-line
}