diff --git a/rc/extra/cabal.kak b/rc/extra/cabal.kak index 058f9d17..fd75a5a6 100644 --- a/rc/extra/cabal.kak +++ b/rc/extra/cabal.kak @@ -58,17 +58,17 @@ define-command -hidden cabal-indent-on-closing-curly-brace %[ # Initialization # ‾‾‾‾‾‾‾‾‾‾‾‾‾‾ -hook -group cabal-highlight global WinSetOption filetype=cabal %{ add-highlighter window/cabal ref cabal } +hook -group cabal-highlight global WinSetOption filetype=cabal %{ + add-highlighter window/cabal ref cabal + hook -once -always window WinSetOption filetype=(?!cabal).* %{ remove-highlighter window/cabal } + +} hook global WinSetOption filetype=cabal %[ 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 + + hook -once -always window WinSetOption filetype=(?!cabal).* %{ remove-hooks window cabal-.+ } ] - -hook -group cabal-highlight global WinSetOption filetype=(?!cabal).* %{ remove-highlighter window/cabal } - -hook global WinSetOption filetype=(?!cabal).* %{ - remove-hooks window cabal-.+ -} diff --git a/rc/extra/cmake.kak b/rc/extra/cmake.kak index 7c43cbdc..ee16b27e 100644 --- a/rc/extra/cmake.kak +++ b/rc/extra/cmake.kak @@ -21,5 +21,7 @@ add-highlighter shared/cmake/argument/quoted/ fill string add-highlighter shared/cmake/argument/quoted/ regex '\$\{\w+\}' 0:variable add-highlighter shared/cmake/argument/quoted/ regex '\w+\h*(?=\()' 0:function -hook -group cmake-highlight global WinSetOption filetype=cmake %{ add-highlighter window/cmake ref cmake } -hook -group cmake-highlight global WinSetOption filetype=(?!cmake).* %{ remove-highlighter window/cmake } +hook -group cmake-highlight global WinSetOption filetype=cmake %{ + add-highlighter window/cmake ref cmake + hook -once -always window WinSetOption filetype=(?!cmake).* %{ remove-highlighter window/cmake } +} diff --git a/rc/extra/coffee.kak b/rc/extra/coffee.kak index 351f91f1..e091f3c6 100644 --- a/rc/extra/coffee.kak +++ b/rc/extra/coffee.kak @@ -66,15 +66,14 @@ define-command -hidden coffee-indent-on-new-line %{ # Initialization # ‾‾‾‾‾‾‾‾‾‾‾‾‾‾ -hook -group coffee-highlight global WinSetOption filetype=coffee %{ add-highlighter window/coffee ref coffee } +hook -group coffee-highlight global WinSetOption filetype=coffee %{ + add-highlighter window/coffee ref coffee + hook -once -always window WinSetOption filetype=(?!coffee).* %{ remove-highlighter window/coffee } +} hook global WinSetOption filetype=coffee %{ hook window ModeChange insert:.* -group coffee-hooks coffee-filter-around-selections hook window InsertChar \n -group coffee-indent coffee-indent-on-new-line -} -hook -group coffee-highlight global WinSetOption filetype=(?!coffee).* %{ remove-highlighter window/coffee } - -hook global WinSetOption filetype=(?!coffee).* %{ - remove-hooks window coffee-.+ + hook -once -always window WinSetOption filetype=(?!coffee).* %{ remove-hooks window coffee-.+ } } diff --git a/rc/extra/cucumber.kak b/rc/extra/cucumber.kak index aa2081c3..9f1d8f07 100644 --- a/rc/extra/cucumber.kak +++ b/rc/extra/cucumber.kak @@ -76,15 +76,14 @@ define-command -hidden cucumber-indent-on-new-line %{ # Initialization # ‾‾‾‾‾‾‾‾‾‾‾‾‾‾ -hook -group cucumber-highlight global WinSetOption filetype=cucumber %{ add-highlighter window/cucumber ref cucumber } +hook -group cucumber-highlight global WinSetOption filetype=cucumber %{ + add-highlighter window/cucumber ref cucumber + hook -once -always window WinSetOption filetype=(?!cucumber).* %{ remove-highlighter window/cucumber } +} hook global WinSetOption filetype=cucumber %{ hook window ModeChange insert:.* -group cucumber-hooks cucumber-filter-around-selections hook window InsertChar \n -group cucumber-indent cucumber-indent-on-new-line -} -hook -group cucumber-highlight global WinSetOption filetype=(?!cucumber).* %{ remove-highlighter window/cucumber } - -hook global WinSetOption filetype=(?!cucumber).* %{ - remove-hooks window cucumber-.+ + hook -once -always window WinSetOption filetype=(?!cucumber).* %{ remove-hooks window cucumber-.+ } } diff --git a/rc/extra/dart.kak b/rc/extra/dart.kak index 0dba128c..58fa3d29 100644 --- a/rc/extra/dart.kak +++ b/rc/extra/dart.kak @@ -90,7 +90,10 @@ define-command -hidden dart-indent-on-closing-curly-brace %[ # Initialization # ‾‾‾‾‾‾‾‾‾‾‾‾‾‾ -hook -group dart-highlight global WinSetOption filetype=dart %{ add-highlighter window/dart ref dart } +hook -group dart-highlight global WinSetOption filetype=dart %{ + add-highlighter window/dart ref dart + hook -once -always window WinSetOption filetype=(?!dart).* %{ remove-highlighter window/dart } +} hook global WinSetOption filetype=dart %{ # cleanup trailing whitespaces when exiting insert mode @@ -98,10 +101,6 @@ hook global WinSetOption filetype=dart %{ 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 -} -hook -group dart-highlight global WinSetOption filetype=(?!dart).* %{ remove-highlighter window/dart } - -hook global WinSetOption filetype=(?!dart).* %{ - remove-hooks window dart-.+ + hook -once -always window WinSetOption filetype=(?!dart).* %{ remove-hooks window dart-.+ } } diff --git a/rc/extra/dockerfile.kak b/rc/extra/dockerfile.kak index fcc4c5c3..0532479b 100644 --- a/rc/extra/dockerfile.kak +++ b/rc/extra/dockerfile.kak @@ -42,5 +42,7 @@ add-highlighter shared/dockerfile/code/ regex '\$[\w_]+' 0:value # Initialization # ‾‾‾‾‾‾‾‾‾‾‾‾‾‾ -hook -group dockerfile-highlight global WinSetOption filetype=dockerfile %{ add-highlighter window/dockerfile ref dockerfile } -hook -group dockerfile-highlight global WinSetOption filetype=(?!dockerfile).* %{ remove-highlighter window/dockerfile } +hook -group dockerfile-highlight global WinSetOption filetype=dockerfile %{ + add-highlighter window/dockerfile ref dockerfile + hook -once -always window WinSetOption filetype=(?!dockerfile).* %{ remove-highlighter window/dockerfile } +} diff --git a/rc/extra/elixir.kak b/rc/extra/elixir.kak index 86799213..70a3a676 100644 --- a/rc/extra/elixir.kak +++ b/rc/extra/elixir.kak @@ -64,12 +64,14 @@ define-command -hidden elixir-indent-on-new-line %{ # Initialization # ‾‾‾‾‾‾‾‾‾‾‾‾‾‾ -hook -group elixir-highlight global WinSetOption filetype=elixir %{ add-highlighter window/elixir ref elixir } +hook -group elixir-highlight global WinSetOption filetype=elixir %{ + add-highlighter window/elixir ref elixir + hook -once -always window WinSetOption filetype=(?!elixir).* %{ remove-highlighter window/elixir } +} hook global WinSetOption filetype=elixir %{ hook window ModeChange insert:.* -group elixir-hooks elixir-filter-around-selections hook window InsertChar \n -group elixir-indent elixir-indent-on-new-line + + hook -once -always window WinSetOption filetype=(?!elixir).* %{ remove-hooks window elixir-.+ } } - -hook -group elixir-highlight global WinSetOption filetype=(?!elixir).* %{ remove-highlighter window/elixir } - diff --git a/rc/extra/elm.kak b/rc/extra/elm.kak index 0817fb5a..65db1dbd 100644 --- a/rc/extra/elm.kak +++ b/rc/extra/elm.kak @@ -54,15 +54,14 @@ define-command -hidden elm-indent-on-new-line %{ # Initialization # ‾‾‾‾‾‾‾‾‾‾‾‾‾‾ -hook -group elm-highlight global WinSetOption filetype=elm %{ add-highlighter window/elm ref elm } +hook -group elm-highlight global WinSetOption filetype=elm %{ + add-highlighter window/elm ref elm + hook -once -always window WinSetOption filetype=(?!elm).* %{ remove-highlighter window/elm } +} hook global WinSetOption filetype=elm %{ hook window ModeChange insert:.* -group elm-hooks elm-filter-around-selections hook window InsertChar \n -group elm-indent elm-indent-on-new-line -} -hook -group elm-highlight global WinSetOption filetype=(?!elm).* %{ remove-highlighter window/elm } - -hook global WinSetOption filetype=(?!elm).* %{ - remove-hooks window elm-.+ + hook -once -always window WinSetOption filetype=(?!elm).* %{ remove-hooks window elm-.+ } } diff --git a/rc/extra/exherbo.kak b/rc/extra/exherbo.kak index a383c426..2e54c499 100644 --- a/rc/extra/exherbo.kak +++ b/rc/extra/exherbo.kak @@ -34,8 +34,10 @@ add-highlighter shared/exheres-0-metadata/ regex ^(?:[\s\t]+)?[\S]+[\s\t]+=[\s\t add-highlighter shared/exheres-0-metadata/ regex ^(?:[\s\t]+)?(\S+)\s\[\[$ 0:type add-highlighter shared/exheres-0-metadata/ regex ^(?:[\s\t]+)?\]\]$ 0:type -hook -group exheres-0-metadata-highlight global WinSetOption filetype=exheres-0-metadata %{ add-highlighter window/exheres-0-metadata ref exheres-0-metadata } -hook -group exheres-0-metadata-highlight global WinSetOption filetype=(?!exheres-0-metadata).* %{ remove-highlighter window/exheres-0-metadata } +hook -group exheres-0-metadata-highlight global WinSetOption filetype=exheres-0-metadata %{ + add-highlighter window/exheres-0-metadata ref exheres-0-metadata + hook -once -always window WinSetOption filetype=(?!exheres-0-metadata).* %{ remove-highlighter window/exheres-0-metadata } +} ## exheres-0 options descriptions add-highlighter shared/exheres-0-options-descriptions group @@ -44,8 +46,10 @@ add-highlighter shared/exheres-0-options-descriptions/ regex ^(?:[\s\t]+)?[\S]+[ add-highlighter shared/exheres-0-options-descriptions/ regex ^(?:[\s\t]+)?(\S+)\s\[\[$ 0:type add-highlighter shared/exheres-0-options-descriptions/ regex ^(?:[\s\t]+)?\]\]$ 0:type -hook -group exheres-0-options-descriptions-highlight global WinSetOption filetype=exheres-0-options-descriptions %{ add-highlighter window/exheres-0-options-descriptions ref exheres-0-options-descriptions } -hook -group exheres-0-options-descriptions-highlight global WinSetOption filetype=(?!exheres-0-options-descriptions).* %{ remove-highlighter window/exheres-0-options-descriptions } +hook -group exheres-0-options-descriptions-highlight global WinSetOption filetype=exheres-0-options-descriptions %{ + add-highlighter window/exheres-0-options-descriptions ref exheres-0-options-descriptions + hook -once -always window WinSetOption filetype=(?!exheres-0-options-descriptions).* %{ remove-highlighter window/exheres-0-options-descriptions } +} ## metadata/licence_groups.conf add-highlighter shared/exheres-0-licence-groups group @@ -53,8 +57,10 @@ add-highlighter shared/exheres-0-licence-groups/ regex [\s\t]+(\S+(?:[\s\t]+))*$ add-highlighter shared/exheres-0-licence-groups/ regex ^(\S+) 0:type add-highlighter shared/exheres-0-licence-groups/ regex ^#.*?$ 0:comment -hook -group exheres-0-licence-groups-highlight global WinSetOption filetype=exheres-0-licence-groups %{ add-highlighter window/exheres-0-licence-groups ref exheres-0-licence-groups } -hook -group exheres-0-licence-groups-highlight global WinSetOption filetype=(?!exheres-0-licence-groups).* %{ remove-highlighter window/exheres-0-licence-groups } +hook -group exheres-0-licence-groups-highlight global WinSetOption filetype=exheres-0-licence-groups %{ + add-highlighter window/exheres-0-licence-groups ref exheres-0-licence-groups + hook -once -always window WinSetOption filetype=(?!exheres-0-licence-groups).* %{ remove-highlighter window/exheres-0-licence-groups } +} ## Paludis configurations ### options.conf @@ -67,24 +73,30 @@ add-highlighter shared/paludis-options-conf/ regex [\s\t](-\S+)(.*?) 1:red add-highlighter shared/paludis-options-conf/ regex ^(\S+/\S+) 0:type add-highlighter shared/paludis-options-conf/ regex ^#.*?$ 0:comment -hook -group paludis-options-conf-highlight global WinSetOption filetype=paludis-options-conf %{ add-highlighter window/paludis-options-conf ref paludis-options-conf } -hook -group paludis-options-conf-highlight global WinSetOption filetype=(?!paludis-options-conf).* %{ remove-highlighter window/paludis-options-conf } +hook -group paludis-options-conf-highlight global WinSetOption filetype=paludis-options-conf %{ + add-highlighter window/paludis-options-conf ref paludis-options-conf + hook -once -always window WinSetOption filetype=(?!paludis-options-conf).* %{ remove-highlighter window/paludis-options-conf } +} ## general.conf, repository.template add-highlighter shared/paludis-key-value-conf group add-highlighter shared/paludis-key-value-conf/ regex ^[\s\t]?(\S+)[\s\t+]=[\s\t+](.*?)$ 1:attribute 2:value add-highlighter shared/paludis-key-value-conf/ regex ^#.*?$ 0:comment -hook -group paludis-key-value-conf-highlight global WinSetOption filetype=paludis-key-value-conf %{ add-highlighter window/paludis-key-value-conf ref paludis-key-value-conf } -hook -group paludis-key-value-conf-highlight global WinSetOption filetype=(?!paludis-key-value-conf).* %{ remove-highlighter window/paludis-key-value-conf } +hook -group paludis-key-value-conf-highlight global WinSetOption filetype=paludis-key-value-conf %{ + add-highlighter window/paludis-key-value-conf ref paludis-key-value-conf + hook -once -always window WinSetOption filetype=(?!paludis-key-value-conf).* %{ remove-highlighter window/paludis-key-value-conf } +} ## mirrors.conf add-highlighter shared/paludis-mirrors-conf group add-highlighter shared/paludis-mirrors-conf/ regex ^[\s\t+]?(\S+)[\s\t+](.*?)$ 1:type 2:value add-highlighter shared/paludis-mirrors-conf/ regex ^#.*?$ 0:comment -hook -group paludis-mirrors-conf-highlight global WinSetOption filetype=paludis-mirrors-conf %{ add-highlighter window/paludis-mirrors-conf ref paludis-mirrors-conf } -hook -group paludis-mirrors-conf-highlight global WinSetOption filetype=(?!paludis-mirrors-conf).* %{ remove-highlighter window/paludis-mirrors-conf } +hook -group paludis-mirrors-conf-highlight global WinSetOption filetype=paludis-mirrors-conf %{ + add-highlighter window/paludis-mirrors-conf ref paludis-mirrors-conf + hook -once -always window WinSetOption filetype=(?!paludis-mirrors-conf).* %{ remove-highlighter window/paludis-mirrors-conf } +} ## package_(unmask|mask).conf, platforms.conf add-highlighter shared/paludis-specs-conf group @@ -92,8 +104,10 @@ add-highlighter shared/paludis-specs-conf/ regex [\s\t]+(\S+(?:[\s\t]+))*$ 0:att add-highlighter shared/paludis-specs-conf/ regex ^(\S+/\S+) 0:type add-highlighter shared/paludis-specs-conf/ regex ^#.*?$ 0:comment -hook -group paludis-specs-conf-highlight global WinSetOption filetype=paludis-specs-conf %{ add-highlighter window/paludis-specs-conf ref paludis-specs-conf } -hook -group paludis-specs-conf-highlight global WinSetOption filetype=(?!paludis-specs-conf).* %{ remove-highlighter window/paludis-specs-conf } +hook -group paludis-specs-conf-highlight global WinSetOption filetype=paludis-specs-conf %{ + add-highlighter window/paludis-specs-conf ref paludis-specs-conf + hook -once -always window WinSetOption filetype=(?!paludis-specs-conf).* %{ remove-highlighter window/paludis-specs-conf } +} ## News items (GLEP42) add-highlighter shared/glep42 group @@ -101,5 +115,7 @@ add-highlighter shared/glep42/ regex ^(Title|Author|Translator|Content-Type|Post add-highlighter shared/glep42/ regex <[^@>]+@.*?> 0:string add-highlighter shared/glep42/ regex ^>.*?$ 0:comment -hook -group glep42-highlight global WinSetOption filetype=glep42 %{ add-highlighter window/glep42 ref glep42 } -hook -group glep42-highlight global WinSetOption filetype=(?!glep42).* %{ remove-highlighter window/glep42 } +hook -group glep42-highlight global WinSetOption filetype=glep42 %{ + add-highlighter window/glep42 ref glep42 + hook -once -always window WinSetOption filetype=(?!glep42).* %{ remove-highlighter window/glep42 } +} diff --git a/rc/extra/git-tools.kak b/rc/extra/git-tools.kak index 55d5cf53..2f030b6e 100644 --- a/rc/extra/git-tools.kak +++ b/rc/extra/git-tools.kak @@ -6,16 +6,18 @@ hook -group git-log-highlight global WinSetOption filetype=git-log %{ add-highlighter window/git-log/ regex '^(commit) ([0-9a-f]+)$' 1:yellow 2:red add-highlighter window/git-log/ regex '^([a-zA-Z_-]+:) (.*?)$' 1:green 2:magenta add-highlighter window/git-log/ ref diff # highlight potential diffs from the -p option + + hook -once -always window WinSetOption filetype=(?!git-log).* %{ remove-highlighter window/git-log } } -hook -group git-log-highlight global WinSetOption filetype=(?!git-log).* %{ remove-highlighter window/git-log } hook -group git-status-highlight global WinSetOption filetype=git-status %{ add-highlighter window/git-status group add-highlighter window/git-status/ regex '^\h+(?:((?:both )?modified:)|(added:|new file:)|(deleted(?: by \w+)?:)|(renamed:)|(copied:))(?:.*?)$' 1:yellow 2:green 3:red 4:cyan 5:blue 6:magenta + + hook -once -always window WinSetOption filetype=(?!git-status).* %{ remove-highlighter window/git-status } } -hook -group git-status-highlight global WinSetOption filetype=(?!git-status).* %{ remove-highlighter window/git-status } declare-option -hidden line-specs git_blame_flags declare-option -hidden line-specs git_diff_flags diff --git a/rc/extra/haml.kak b/rc/extra/haml.kak index 7bf309f6..a672e4a0 100644 --- a/rc/extra/haml.kak +++ b/rc/extra/haml.kak @@ -49,15 +49,14 @@ define-command -hidden haml-indent-on-new-line %{ # Initialization # ‾‾‾‾‾‾‾‾‾‾‾‾‾‾ -hook -group haml-highlight global WinSetOption filetype=haml %{ add-highlighter window/haml ref haml } +hook -group haml-highlight global WinSetOption filetype=haml %{ + add-highlighter window/haml ref haml + hook -once -always window WinSetOption filetype=(?!haml).* %{ remove-highlighter window/haml } +} hook global WinSetOption filetype=haml %{ hook window ModeChange insert:.* -group haml-hooks haml-filter-around-selections hook window InsertChar \n -group haml-indent haml-indent-on-new-line -} -hook -group haml-highlight global WinSetOption filetype=(?!haml).* %{ remove-highlighter window/haml } - -hook global WinSetOption filetype=(?!haml).* %{ - remove-hooks window haml-.+ + hook -once -always window WinSetOption filetype=(?!haml).* %{ remove-hooks window haml-.+ } } diff --git a/rc/extra/hbs.kak b/rc/extra/hbs.kak index 6f02ca32..8d8467cd 100644 --- a/rc/extra/hbs.kak +++ b/rc/extra/hbs.kak @@ -83,6 +83,7 @@ define-command -hidden maybe-add-hbs-to-html %{ evaluate-commands %sh{ hook -group hbs-highlight global WinSetOption filetype=hbs %{ maybe-add-hbs-to-html add-highlighter window/hbs-file ref hbs-file + hook -once -always window WinSetOption filetype=(?!hbs).* %{ remove-highlighter window/hbs-file } } hook global WinSetOption filetype=hbs %{ @@ -92,12 +93,6 @@ hook global WinSetOption filetype=hbs %{ hook window ModeChange insert:.* -group hbs-hooks html-filter-around-selections hook window InsertChar '>' -group hbs-indent html-indent-on-greater-than hook window InsertChar \n -group hbs-indent html-indent-on-new-line -} -hook -group hbs-highlight global WinSetOption filetype=(?!hbs).* %{ - remove-highlighter window/hbs-file -} - -hook global WinSetOption filetype=(?!hbs).* %{ - remove-hooks window hbs-.+ + hook -once -always window WinSetOption filetype=(?!hbs).* %{ remove-hooks window hbs-.+ } } diff --git a/rc/extra/i3.kak b/rc/extra/i3.kak index 7e35ace3..2a4bd349 100644 --- a/rc/extra/i3.kak +++ b/rc/extra/i3.kak @@ -66,17 +66,16 @@ define-command -hidden i3-indent-on-closing-curly-brace %[ # Initialization # ‾‾‾‾‾‾‾‾‾‾‾‾‾‾ -hook -group i3-highlight global WinSetOption filetype=i3 %{ add-highlighter window/i3 ref i3 } +hook -group i3-highlight global WinSetOption filetype=i3 %{ + add-highlighter window/i3 ref i3 + hook -once -always window WinSetOption filetype=(?!i3).* %{ remove-highlighter window/i3 } +} hook global WinSetOption filetype=i3 %[ # cleanup trailing whitespaces when exiting insert mode hook window ModeChange insert:.* -group i3-hooks %{ try %{ execute-keys -draft s^\h+$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 + + hook -once -always window WinSetOption filetype=(?!i3).* %{ remove-hooks window i3-.+ } ] - -hook -group i3-highlight global WinSetOption filetype=(?!i3).* %{ remove-highlighter window/i3 } - -hook global WinSetOption filetype=(?!i3).* %{ - remove-hooks window i3-.+ -} diff --git a/rc/extra/just.kak b/rc/extra/just.kak index e8dc19b6..cee68a9c 100644 --- a/rc/extra/just.kak +++ b/rc/extra/just.kak @@ -28,25 +28,21 @@ add-highlighter shared/justfile/comment region '#' '$' fill comment add-highlighter shared/justfile/double_string region '"' (? s ^\h+$ d } } -} -hook -group nim-highlight global WinSetOption filetype=(?!nim).* %{ remove-highlighter window/nim } - -hook global WinSetOption filetype=(?!nim).* %{ - remove-hooks window nim-indent + hook -once -always window WinSetOption filetype=(?!nim).* %{ remove-hooks window nim-.+ } } diff --git a/rc/extra/php.kak b/rc/extra/php.kak index 1a2b4228..be3dfd26 100644 --- a/rc/extra/php.kak +++ b/rc/extra/php.kak @@ -76,16 +76,15 @@ define-command -hidden php-indent-on-new-line %< # Initialization # ‾‾‾‾‾‾‾‾‾‾‾‾‾‾ -hook -group php-highlight global WinSetOption filetype=php %{ add-highlighter window/php-file ref php-file } +hook -group php-highlight global WinSetOption filetype=php %{ + add-highlighter window/php-file ref php-file + hook -once -always window WinSetOption filetype=(?!php).* %{ remove-highlighter window/php-file } +} hook global WinSetOption filetype=php %{ 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 -} -hook -group php-highlight global WinSetOption filetype=(?!php).* %{ remove-highlighter window/php-file } - -hook global WinSetOption filetype=(?!php).* %{ - remove-hooks window php-.+ + hook -once -always window WinSetOption filetype=(?!php).* %{ remove-hooks window php-.+ } } diff --git a/rc/extra/pony.kak b/rc/extra/pony.kak index 3c8d105d..69010e4f 100644 --- a/rc/extra/pony.kak +++ b/rc/extra/pony.kak @@ -78,16 +78,15 @@ define-command -hidden pony-indent-on-new-line %{ # Initialization # ‾‾‾‾‾‾‾‾‾‾‾‾‾‾ -hook -group pony-highlight global WinSetOption filetype=pony %{ add-highlighter window/pony ref pony } +hook -group pony-highlight global WinSetOption filetype=pony %{ + add-highlighter window/pony ref pony + hook -once -always window WinSetOption filetype=(?!pony).* %{ remove-highlighter pony } +} 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-indent %{ try %{ execute-keys -draft \; s ^\h+$ d } } -} -hook -group pony-highlight global WinSetOption filetype=(?!pony).* %{ remove-highlighter pony } - -hook global WinSetOption filetype=(?!pony).* %{ - remove-hooks window pony-indent + hook -once -always window WinSetOption filetype=(?!pony).* %{ remove-hooks window pony-.+ } } diff --git a/rc/extra/protobuf.kak b/rc/extra/protobuf.kak index c18e6dc7..670bfca8 100644 --- a/rc/extra/protobuf.kak +++ b/rc/extra/protobuf.kak @@ -71,16 +71,15 @@ define-command -hidden protobuf-indent-on-closing-curly-brace %[ # Initialization # ‾‾‾‾‾‾‾‾‾‾‾‾‾‾ -hook -group protobuf-highlight global WinSetOption filetype=protobuf %{ add-highlighter window/protobuf ref protobuf } +hook -group protobuf-highlight global WinSetOption filetype=protobuf %{ + add-highlighter window/protobuf ref protobuf + hook -once -always window WinSetOption filetype=(?!protobuf).* %{ remove-highlighter window/protobuf } +} hook global WinSetOption filetype=protobuf %[ hook -group protobuf-indent window InsertChar \n protobuf-indent-on-newline hook -group protobuf-indent window InsertChar \{ protobuf-indent-on-opening-curly-brace hook -group protobuf-indent window InsertChar \} protobuf-indent-on-closing-curly-brace + + hook -once -always window WinSetOption filetype=(?!protobuf).* %{ remove-hooks window protobuf-.+ } ] - -hook -group protobuf-highlight global WinSetOption filetype=(?!protobuf).* %{ remove-highlighter window/protobuf } - -hook global WinSetOption filetype=(?!protobuf).* %{ - remove-hooks window protobuf-.+ -} diff --git a/rc/extra/pug.kak b/rc/extra/pug.kak index e279d96b..2711b766 100644 --- a/rc/extra/pug.kak +++ b/rc/extra/pug.kak @@ -61,15 +61,14 @@ define-command -hidden pug-indent-on-new-line %{ # Initialization # ‾‾‾‾‾‾‾‾‾‾‾‾‾‾ -hook -group pug-highlight global WinSetOption filetype=pug %{ add-highlighter window/pug ref pug } +hook -group pug-highlight global WinSetOption filetype=pug %{ + add-highlighter window/pug ref pug + hook -once -always window WinSetOption filetype=(?!pug).* %{ remove-highlighter window/pug } +} hook global WinSetOption filetype=pug %{ hook window ModeChange insert:.* -group pug-hooks pug-filter-around-selections hook window InsertChar \n -group pug-indent pug-indent-on-new-line -} -hook -group pug-highlight global WinSetOption filetype=(?!pug).* %{ remove-highlighter window/pug } - -hook global WinSetOption filetype=(?!pug).* %{ - remove-hooks window pug-.+ + hook -once -always window WinSetOption filetype=(?!pug).* %{ remove-hooks window pug-.+ } } diff --git a/rc/extra/ragel.kak b/rc/extra/ragel.kak index b6f1fd68..ffa84a9d 100644 --- a/rc/extra/ragel.kak +++ b/rc/extra/ragel.kak @@ -56,16 +56,15 @@ define-command -hidden ragel-indent-on-new-line %< # Initialization # ‾‾‾‾‾‾‾‾‾‾‾‾‾‾ -hook -group ragel-highlight global WinSetOption filetype=ragel %{ add-highlighter window/ragel ref ragel } +hook -group ragel-highlight global WinSetOption filetype=ragel %{ + add-highlighter window/ragel ref ragel + hook -once -always window WinSetOption filetype=(?!ragel).* %{ remove-highlighter window/ragel } +} hook global WinSetOption filetype=ragel %{ 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 -} -hook -group ragel-highlight global WinSetOption filetype=(?!ragel).* %{ remove-highlighter window/ragel } - -hook global WinSetOption filetype=(?!ragel).* %{ - remove-hooks window ragel-.+ + hook -once -always window WinSetOption filetype=(?!ragel).* %{ remove-hooks window ragel-.+ } } diff --git a/rc/extra/sass.kak b/rc/extra/sass.kak index df4929fa..9960eac1 100644 --- a/rc/extra/sass.kak +++ b/rc/extra/sass.kak @@ -48,16 +48,15 @@ define-command -hidden sass-indent-on-new-line %{ # Initialization # ‾‾‾‾‾‾‾‾‾‾‾‾‾‾ -hook -group sass-highlight global WinSetOption filetype=sass %{ add-highlighter window/sass ref sass } +hook -group sass-highlight global WinSetOption filetype=sass %{ + add-highlighter window/sass ref sass + hook -once -always window WinSetOption filetype=(?!sass).* %{ remove-highlighter window/sass } +} hook global WinSetOption filetype=sass %{ hook window ModeChange insert:.* -group sass-hooks sass-filter-around-selections hook window InsertChar \n -group sass-indent sass-indent-on-new-line set-option buffer extra_word_chars '_' '-' -} -hook -group sass-highlight global WinSetOption filetype=(?!sass).* %{ remove-highlighter window/sass } - -hook global WinSetOption filetype=(?!sass).* %{ - remove-hooks window sass-.+ + hook -once -always window WinSetOption filetype=(?!sass).* %{ remove-hooks window sass-.+ } } diff --git a/rc/extra/scheme.kak b/rc/extra/scheme.kak index 4c38f8a5..ca3b5afe 100644 --- a/rc/extra/scheme.kak +++ b/rc/extra/scheme.kak @@ -114,18 +114,14 @@ evaluate-commands %sh{ hook -group scheme-highlight global WinSetOption filetype=scheme %{ add-highlighter window/scheme ref scheme + hook -once -always window WinSetOption filetype=(?!scheme).* %{ remove-highlighter window/scheme } } -hook -group scheme-highlight global WinSetOption filetype=(?!scheme).* %{ - remove-highlighter window/scheme -} hook global WinSetOption filetype=scheme %{ set-option buffer extra_word_chars '_' '-' '!' '%' '?' '<' '>' '=' hook window InsertEnd .* -group scheme-hooks lisp-filter-around-selections hook window InsertChar \n -group scheme-indent lisp-indent-on-new-line -} -hook global WinSetOption filetype=(?!scheme).* %{ - remove-hooks window scheme-.+ + hook -once -always window WinSetOption filetype=(?!scheme).* %{ remove-hooks window scheme-.+ } } diff --git a/rc/extra/scss.kak b/rc/extra/scss.kak index 9dbd1fe3..abb8a13f 100644 --- a/rc/extra/scss.kak +++ b/rc/extra/scss.kak @@ -30,17 +30,16 @@ define-command -hidden scss-indent-on-closing-curly-brace css-indent-on-closing- # Initialization # ‾‾‾‾‾‾‾‾‾‾‾‾‾‾ -hook -group scss-highlight global WinSetOption filetype=scss %{ add-highlighter window/scss ref scss } +hook -group scss-highlight global WinSetOption filetype=scss %{ + add-highlighter window/scss ref scss + hook -once -always window WinSetOption filetype=(?!scss).* %{ remove-highlighter window/scss } +} hook global WinSetOption filetype=scss %[ 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 set-option buffer extra_word_chars '_' '-' + + hook -once -always window WinSetOption filetype=(?!scss).* %{ remove-hooks window scss-.+ } ] - -hook -group scss-highlight global WinSetOption filetype=(?!scss).* %{ remove-highlighter window/scss } - -hook global WinSetOption filetype=(?!scss).* %{ - remove-hooks window scss-.+ -} diff --git a/rc/extra/taskpaper.kak b/rc/extra/taskpaper.kak index 4b3c860e..4370bc14 100644 --- a/rc/extra/taskpaper.kak +++ b/rc/extra/taskpaper.kak @@ -38,9 +38,10 @@ define-command -hidden taskpaper-indent-on-new-line %{ hook -group taskpaper-highlight global WinSetOption filetype=taskpaper %{ add-highlighter window/taskpaper ref taskpaper + hook -once -always window WinSetOption filetype=(?!taskpaper).* %{ remove-highlighter window/taskpaper } +} + +hook global WinSetOption filetype=taskpaper %{ hook window InsertChar \n -group taskpaper-indent taskpaper-indent-on-new-line -} -hook -group taskpaper-highlight global WinSetOption filetype=(?!taskpaper).* %{ - remove-highlighter window/taskpaper - remove-hooks window taskpaper-indent + hook -once -always window WinSetOption filetype=(?!taskpaper).* %{ remove-hooks window taskpaper-.+ } } diff --git a/rc/extra/toml.kak b/rc/extra/toml.kak index 5f5a217a..0528eef4 100644 --- a/rc/extra/toml.kak +++ b/rc/extra/toml.kak @@ -52,18 +52,12 @@ define-command -hidden toml-indent-on-new-line %{ hook -group toml-highlight global WinSetOption filetype=toml %{ add-highlighter window/toml ref toml + hook -once -always window WinSetOption filetype=(?!toml).* %{ remove-highlighter window/toml } } hook global WinSetOption filetype=toml %{ hook window ModeChange insert:.* -group toml-hooks toml-filter-around-selections hook window InsertChar \n -group toml-indent toml-indent-on-new-line -} -hook -group toml-highlight global WinSetOption filetype=(?!toml).* %{ - remove-highlighter window/toml + hook -once -always window WinSetOption filetype=(?!toml).* %{ remove-hooks window toml-.+ } } - -hook global WinSetOption filetype=(?!toml).* %{ - remove-hooks window toml-.+ -} - diff --git a/rc/extra/troff.kak b/rc/extra/troff.kak index 91755643..44fd6472 100644 --- a/rc/extra/troff.kak +++ b/rc/extra/troff.kak @@ -24,6 +24,7 @@ add-highlighter shared/troff/ regex '^\.B\s+([^\n]+)' 1:+b # Initialization # ‾‾‾‾‾‾‾‾‾‾‾‾‾‾ -hook -group troff-highlight global WinSetOption filetype=troff %{ add-highlighter window/troff ref troff } - -hook -group troff-highlight global WinSetOption filetype=(?!troff).* %{ remove-highlighter window/troff } +hook -group troff-highlight global WinSetOption filetype=troff %{ + add-highlighter window/troff ref troff + hook -once -always window WinSetOption filetype=(?!troff).* %{ remove-highlighter window/troff } +} diff --git a/rc/extra/tupfile.kak b/rc/extra/tupfile.kak index 0f38180a..b8246148 100644 --- a/rc/extra/tupfile.kak +++ b/rc/extra/tupfile.kak @@ -27,5 +27,7 @@ add-highlighter shared/tupfile/code/ regex '`[^`\n]+`' 0:meta # Initialization # ‾‾‾‾‾‾‾‾‾‾‾‾‾‾ -hook -group tupfile-highlight global WinSetOption filetype=tupfile %{ add-highlighter window/tupfile ref tupfile } -hook -group tupfile-highlight global WinSetOption filetype=(?!tupfile).* %{ remove-highlighter window/tupfile } +hook -group tupfile-highlight global WinSetOption filetype=tupfile %{ + add-highlighter window/tupfile ref tupfile + hook -once -always window WinSetOption filetype=(?!tupfile).* %{ remove-highlighter window/tupfile } +}