Change cleanup of extra/ languages to use a simpler hook -once

This commit is contained in:
Olivier Perret 2018-11-28 10:39:18 +01:00
parent 898d45f5d5
commit f5a2ded44b
30 changed files with 174 additions and 176 deletions

View File

@ -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-.+
}

View File

@ -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 }
}

View File

@ -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-.+ }
}

View File

@ -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-.+ }
}

View File

@ -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-.+ }
}

View File

@ -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 }
}

View File

@ -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 }

View File

@ -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-.+ }
}

View File

@ -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 }
}

View File

@ -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

View File

@ -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-.+ }
}

View File

@ -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-.+ }
}

View File

@ -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 <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
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-.+
}

View File

@ -28,25 +28,21 @@ add-highlighter shared/justfile/comment region '#' '$' fill comment
add-highlighter shared/justfile/double_string region '"' (?<!\\)(\\\\)*" fill string
add-highlighter shared/justfile/single_string region "'" (?<!\\)(\\\\)*' fill string
add-highlighter shared/justfile/inline region '`' '`' ref sh
add-highlighter shared/justfile/shell region '^\h+' '^[^\h]' group
add-highlighter shared/justfile/shell region '^\h+' '^[^\h]' group
add-highlighter shared/justfile/shell/ ref sh
add-highlighter shared/justfile/shell/ regex '(\{{2})([\w-]+)(\}{2})' 1:operator 2:variable 3:operator
add-highlighter shared/justfile/content/ regex '^(@)?([\w-]+)(?:\s(.+))?\s?(:)(.+)?$' 1:operator 2:function 3:value 4:operator 5:type
add-highlighter shared/justfile/content/ regex '([=+])' 1:operator
add-highlighter shared/justfile/content/ regex '^([\w-]+)\s=' 1:value
hook -group justfile-highlight global WinSetOption filetype=justfile %{
add-highlighter window/justfile ref justfile
hook -once -always window WinSetOption filetype=(?!justfile).* %{ remove-highlighter window/justfile }
}
hook global WinSetOption filetype=justfile %{
hook window InsertChar \n -group justfile-indent just-indent-on-new-line
add-highlighter window/justfile ref justfile
# variable substititution highlighting
add-highlighter shared/justfile/shell regex '(\{{2})([\w-]+)(\}{2})' 1:operator 2:variable 3:operator
hook -once -always window WinSetOption filetype=(?!justfile).* %{ remove-hooks window justfile-.+ }
}
hook global WinSetOption filetype=(?!justfile).* %{
remove-highlighter window/justfile
remove-hooks window justfile-indent
}

View File

@ -24,5 +24,7 @@ add-highlighter shared/kickstart/shell/ regex '^\h*%end\b' 0:type
add-highlighter shared/kickstart/shell/ ref sh
hook -group kickstart-highlight global WinSetOption filetype=kickstart %{ add-highlighter window/kickstart ref kickstart }
hook -group kickstart-highlight global WinSetOption filetype=(?!kickstart).* %{ remove-highlighter window/kickstart }
hook -group kickstart-highlight global WinSetOption filetype=kickstart %{
add-highlighter window/kickstart ref kickstart
hook -once -always window WinSetOption filetype=(?!kickstart).* %{ remove-highlighter window/kickstart }
}

View File

@ -29,6 +29,7 @@ add-highlighter shared/latex/content/ regex '\\textbf\{([^}]+)\}' 1:default+b
# Initialization
# ‾‾‾‾‾‾‾‾‾‾‾‾‾‾
hook -group latex-highlight global WinSetOption filetype=latex %{ add-highlighter window/latex ref latex }
hook -group latex-highlight global WinSetOption filetype=(?!latex).* %{ remove-highlighter window/latex }
hook -group latex-highlight global WinSetOption filetype=latex %{
add-highlighter window/latex ref latex
hook -once -always window WinSetOption filetype=(?!latex).* %{ remove-highlighter window/latex }
}

View File

@ -88,7 +88,10 @@ define-command -hidden moon-indent-on-new-line %{
# Initialization
# ‾‾‾‾‾‾‾‾‾‾‾‾‾‾
hook -group moon-highlight global WinSetOption filetype=moon %{ add-highlighter window/moon ref moon }
hook -group moon-highlight global WinSetOption filetype=moon %{
add-highlighter window/moon ref moon
hook -once -always window WinSetOption filetype=(?!moon).* %{ remove-highlighter window/moon }
}
hook global WinSetOption filetype=moon %{
hook window ModeChange insert:.* -group moon-hooks moon-filter-around-selections
@ -96,12 +99,9 @@ hook global WinSetOption filetype=moon %{
hook window InsertChar \n -group moon-indent moon-indent-on-new-line
alias window alt moon-alternative-file
}
hook -group moon-highlight global WinSetOption filetype=(?!moon).* %{ remove-highlighter window/moon }
hook global WinSetOption filetype=(?!moon).* %{
remove-hooks window moon-.+
unalias window alt moon-alternative-file
hook global WinSetOption filetype=(?!moon).* %{
remove-hooks window moon-.+
unalias window alt moon-alternative-file
}
}

View File

@ -71,16 +71,15 @@ def -hidden nim-indent-on-new-line %{
# Initialization
# ‾‾‾‾‾‾‾‾‾‾‾‾‾‾
hook -group nim-highlight global WinSetOption filetype=nim %{ add-highlighter window/nim ref nim }
hook -group nim-highlight global WinSetOption filetype=nim %{
add-highlighter window/nim ref nim
hook -once -always window WinSetOption filetype=(?!nim).* %{ remove-highlighter window/nim }
}
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-indent %{ try %{ exec -draft \; <a-x> s ^\h+$ <ret> 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-.+ }
}

View File

@ -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-.+ }
}

View File

@ -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 \; <a-x> s ^\h+$ <ret> 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-.+ }
}

View File

@ -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-.+
}

View File

@ -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-.+ }
}

View File

@ -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-.+ }
}

View File

@ -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-.+ }
}

View File

@ -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-.+ }
}

View File

@ -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-.+
}

View File

@ -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-.+ }
}

View File

@ -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-.+
}

View File

@ -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 }
}

View File

@ -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 }
}