Move highlighters into Scopes

That means we can now have highlighters active at global, buffer, and
window scope. The add-highlighter and remove-highlighter syntax changed
to take the parent path (scope/group/...) as a mandatory argument,
superseeding the previous -group switch.
This commit is contained in:
Maxime Coste 2017-10-28 11:00:51 +08:00
parent 9a449a3344
commit d49555fc75
80 changed files with 908 additions and 901 deletions

View File

@ -13,11 +13,11 @@ hook global BufCreate .*[.](cljs?) %{
# Highlighters # Highlighters
# ‾‾‾‾‾‾‾‾‾‾‾‾ # ‾‾‾‾‾‾‾‾‾‾‾‾
add-highlighter -group / group clojure add-highlighter shared/ group clojure
add-highlighter -group /clojure ref lisp add-highlighter shared/clojure ref lisp
add-highlighter -group /clojure regex \b(clojure.core/['/\w]+)\b 0:keyword add-highlighter shared/clojure regex \b(clojure.core/['/\w]+)\b 0:keyword
# Commands # Commands
# ‾‾‾‾‾‾‾‾ # ‾‾‾‾‾‾‾‾
@ -27,14 +27,14 @@ def -hidden clojure-indent-on-new-line lisp-indent-on-new-line
# Initialization # Initialization
# ‾‾‾‾‾‾‾‾‾‾‾‾‾‾ # ‾‾‾‾‾‾‾‾‾‾‾‾‾‾
hook -group clojure-highlight global WinSetOption filetype=clojure %{ add-highlighter ref clojure } hook -group clojure-highlight global WinSetOption filetype=clojure %{ add-highlighter window ref clojure }
hook global WinSetOption filetype=clojure %[ hook global WinSetOption filetype=clojure %[
hook window InsertEnd .* -group clojure-hooks clojure-filter-around-selections hook window InsertEnd .* -group clojure-hooks clojure-filter-around-selections
hook window InsertChar \n -group clojure-indent clojure-indent-on-new-line hook window InsertChar \n -group clojure-indent clojure-indent-on-new-line
] ]
hook -group clojure-highlight global WinSetOption filetype=(?!clojure).* %{ remove-highlighter clojure } hook -group clojure-highlight global WinSetOption filetype=(?!clojure).* %{ remove-highlighter window/clojure }
hook global WinSetOption filetype=(?!clojure).* %{ hook global WinSetOption filetype=(?!clojure).* %{
remove-hooks window clojure-indent remove-hooks window clojure-indent

View File

@ -11,29 +11,29 @@ hook global BufCreate .*[.](css) %{
# Highlighters # Highlighters
# ‾‾‾‾‾‾‾‾‾‾‾‾ # ‾‾‾‾‾‾‾‾‾‾‾‾
add-highlighter -group / regions -default selector css \ add-highlighter shared/ regions -default selector css \
declaration [{] [}] '' \ declaration [{] [}] '' \
comment /[*] [*]/ '' comment /[*] [*]/ ''
add-highlighter -group /css/comment fill comment add-highlighter shared/css/comment fill comment
add-highlighter -group /css/declaration regions content \ add-highlighter shared/css/declaration regions content \
string '"' (?<!\\)(\\\\)*" '' \ string '"' (?<!\\)(\\\\)*" '' \
string "'" "'" '' string "'" "'" ''
add-highlighter -group /css/declaration/content/string fill string add-highlighter shared/css/declaration/content/string fill string
# https://developer.mozilla.org/en-US/docs/Web/CSS/length # https://developer.mozilla.org/en-US/docs/Web/CSS/length
add-highlighter -group /css/declaration regex (#[0-9A-Fa-f]+)|((\d*\.)?\d+(ch|cm|em|ex|mm|pc|pt|px|rem|vh|vmax|vmin|vw)) 0:value add-highlighter shared/css/declaration regex (#[0-9A-Fa-f]+)|((\d*\.)?\d+(ch|cm|em|ex|mm|pc|pt|px|rem|vh|vmax|vmin|vw)) 0:value
add-highlighter -group /css/declaration regex ([A-Za-z][A-Za-z0-9_-]*)\h*: 1:keyword add-highlighter shared/css/declaration regex ([A-Za-z][A-Za-z0-9_-]*)\h*: 1:keyword
add-highlighter -group /css/declaration regex :(before|after) 0:attribute add-highlighter shared/css/declaration regex :(before|after) 0:attribute
add-highlighter -group /css/declaration regex !important 0:keyword add-highlighter shared/css/declaration regex !important 0:keyword
# element#id element.class # element#id element.class
# universal selector # universal selector
add-highlighter -group /css/selector regex [A-Za-z][A-Za-z0-9_-]* 0:keyword add-highlighter shared/css/selector regex [A-Za-z][A-Za-z0-9_-]* 0:keyword
add-highlighter -group /css/selector regex [*]|[#.][A-Za-z][A-Za-z0-9_-]* 0:variable add-highlighter shared/css/selector regex [*]|[#.][A-Za-z][A-Za-z0-9_-]* 0:variable
# Commands # Commands
# ‾‾‾‾‾‾‾‾ # ‾‾‾‾‾‾‾‾
@ -64,7 +64,7 @@ def -hidden css-indent-on-closing-curly-brace %[
# Initialization # Initialization
# ‾‾‾‾‾‾‾‾‾‾‾‾‾‾ # ‾‾‾‾‾‾‾‾‾‾‾‾‾‾
hook -group css-highlight global WinSetOption filetype=css %{ add-highlighter ref css } hook -group css-highlight global WinSetOption filetype=css %{ add-highlighter window ref css }
hook global WinSetOption filetype=css %[ hook global WinSetOption filetype=css %[
hook window InsertEnd .* -group css-hooks css-filter-around-selections hook window InsertEnd .* -group css-hooks css-filter-around-selections
@ -72,7 +72,7 @@ hook global WinSetOption filetype=css %[
hook window InsertChar \} -group css-indent css-indent-on-closing-curly-brace hook window InsertChar \} -group css-indent css-indent-on-closing-curly-brace
] ]
hook -group css-highlight global WinSetOption filetype=(?!css).* %{ remove-highlighter css } hook -group css-highlight global WinSetOption filetype=(?!css).* %{ remove-highlighter window/css }
hook global WinSetOption filetype=(?!css).* %{ hook global WinSetOption filetype=(?!css).* %{
remove-hooks window css-indent remove-hooks window css-indent

View File

@ -11,7 +11,7 @@ hook global BufCreate .*\.di? %{
# Highlighters # Highlighters
# ‾‾‾‾‾‾‾‾‾‾‾‾ # ‾‾‾‾‾‾‾‾‾‾‾‾
add-highlighter -group / regions -default code d \ add-highlighter shared/ regions -default code d \
string '"' (?<!\\)(\\\\)*" '' \ string '"' (?<!\\)(\\\\)*" '' \
verbatim_string ` ` '' \ verbatim_string ` ` '' \
verbatim_string_prefixed 'r"' '"' '' \ verbatim_string_prefixed 'r"' '"' '' \
@ -20,17 +20,17 @@ add-highlighter -group / regions -default code d \
comment /\* \*/ '' \ comment /\* \*/ '' \
comment '//' $ '' comment '//' $ ''
add-highlighter -group /d/string fill string add-highlighter shared/d/string fill string
add-highlighter -group /d/verbatim_string fill magenta add-highlighter shared/d/verbatim_string fill magenta
add-highlighter -group /d/verbatim_string_prefixed fill magenta add-highlighter shared/d/verbatim_string_prefixed fill magenta
add-highlighter -group /d/token fill meta add-highlighter shared/d/token fill meta
add-highlighter -group /d/disabled fill rgb:777777 add-highlighter shared/d/disabled fill rgb:777777
add-highlighter -group /d/comment fill comment add-highlighter shared/d/comment fill comment
add-highlighter -group /d/string regex %{\\(x[0-9a-fA-F]{2}|[0-7]{1,3}|u[0-9a-fA-F]{4}|U[0-9a-fA-F]{8})\b} 0:value add-highlighter shared/d/string regex %{\\(x[0-9a-fA-F]{2}|[0-7]{1,3}|u[0-9a-fA-F]{4}|U[0-9a-fA-F]{8})\b} 0:value
add-highlighter -group /d/code regex %{'((\\.)?|[^'\\])'} 0:value add-highlighter shared/d/code regex %{'((\\.)?|[^'\\])'} 0:value
add-highlighter -group /d/code regex "-?([0-9_]*\.(?!0[xXbB]))?\b([0-9_]+|0[xX][0-9a-fA-F_]*\.?[0-9a-fA-F_]+|0[bb][01_]+)([ep]-?[0-9_]+)?[fFlLuUi]*\b" 0:value add-highlighter shared/d/code regex "-?([0-9_]*\.(?!0[xXbB]))?\b([0-9_]+|0[xX][0-9a-fA-F_]*\.?[0-9a-fA-F_]+|0[bb][01_]+)([ep]-?[0-9_]+)?[fFlLuUi]*\b" 0:value
add-highlighter -group /d/code regex "\b(this)\b\s*[^(]" 1:value add-highlighter shared/d/code regex "\b(this)\b\s*[^(]" 1:value
%sh{ %sh{
# Grammar # Grammar
@ -68,13 +68,13 @@ add-highlighter -group /d/code regex "\b(this)\b\s*[^(]" 1:value
# Highlight keywords # Highlight keywords
printf %s " printf %s "
add-highlighter -group /d/code regex \b(${keywords})\b 0:keyword add-highlighter shared/d/code regex \b(${keywords})\b 0:keyword
add-highlighter -group /d/code regex \b(${attributes})\b 0:attribute add-highlighter shared/d/code regex \b(${attributes})\b 0:attribute
add-highlighter -group /d/code regex \b(${types})\b 0:type add-highlighter shared/d/code regex \b(${types})\b 0:type
add-highlighter -group /d/code regex \b(${values})\b 0:value add-highlighter shared/d/code regex \b(${values})\b 0:value
add-highlighter -group /d/code regex @(${decorators})\b 0:attribute add-highlighter shared/d/code regex @(${decorators})\b 0:attribute
add-highlighter -group /d/code regex \b(${tokens})\b 0:builtin add-highlighter shared/d/code regex \b(${tokens})\b 0:builtin
add-highlighter -group /d/code regex \.(${properties})\b 1:builtin add-highlighter shared/d/code regex \.(${properties})\b 1:builtin
" "
} }
@ -113,7 +113,7 @@ def -hidden d-indent-on-closing-curly-brace %[
# Initialization # Initialization
# ‾‾‾‾‾‾‾‾‾‾‾‾‾‾ # ‾‾‾‾‾‾‾‾‾‾‾‾‾‾
hook -group d-highlight global WinSetOption filetype=d %{ add-highlighter ref d } hook -group d-highlight global WinSetOption filetype=d %{ add-highlighter window ref d }
hook global WinSetOption filetype=d %{ hook global WinSetOption filetype=d %{
# cleanup trailing whitespaces when exiting insert mode # cleanup trailing whitespaces when exiting insert mode
@ -123,7 +123,7 @@ hook global WinSetOption filetype=d %{
hook window InsertChar \} -group d-indent d-indent-on-closing-curly-brace hook window InsertChar \} -group d-indent d-indent-on-closing-curly-brace
} }
hook -group d-highlight global WinSetOption filetype=(?!d).* %{ remove-highlighter d } hook -group d-highlight global WinSetOption filetype=(?!d).* %{ remove-highlighter window/d }
hook global WinSetOption filetype=(?!d).* %{ hook global WinSetOption filetype=(?!d).* %{
remove-hooks window d-hooks remove-hooks window d-hooks

View File

@ -13,54 +13,54 @@ hook global BufCreate .*/etc/profile\.d/.* %{ set buffer filetype s
# Highlighters # Highlighters
## /etc/resolv.conf ## /etc/resolv.conf
add-highlighter -group / group etc-resolv-conf add-highlighter shared/ group etc-resolv-conf
add-highlighter -group /etc-resolv-conf regex ^#.*?$ 0:comment add-highlighter shared/etc-resolv-conf regex ^#.*?$ 0:comment
add-highlighter -group /etc-resolv-conf regex ^(nameserver|server|domain|sortlist|options)[\s\t]+(.*?)$ 1:type 2:attribute add-highlighter shared/etc-resolv-conf regex ^(nameserver|server|domain|sortlist|options)[\s\t]+(.*?)$ 1:type 2:attribute
hook -group etc-resolv-conf-highlight global WinSetOption filetype=etc-resolv-conf %{ add-highlighter ref etc-resolv-conf } hook -group etc-resolv-conf-highlight global WinSetOption filetype=etc-resolv-conf %{ add-highlighter window ref etc-resolv-conf }
hook -group etc-resolv-conf-highlight global WinSetOption filetype=(?!etc-resolv-conf).* %{ remove-highlighter etc-resolv-conf } hook -group etc-resolv-conf-highlight global WinSetOption filetype=(?!etc-resolv-conf).* %{ remove-highlighter window/etc-resolv-conf }
## /etc/hosts ## /etc/hosts
add-highlighter -group / group etc-hosts add-highlighter shared/ group etc-hosts
add-highlighter -group /etc-hosts regex ^(.+?)[\s\t]+?(.*?)$ 1:type 2:attribute add-highlighter shared/etc-hosts regex ^(.+?)[\s\t]+?(.*?)$ 1:type 2:attribute
add-highlighter -group /etc-hosts regex '#.*?$' 0:comment add-highlighter shared/etc-hosts regex '#.*?$' 0:comment
hook -group etc-hosts-highlight global WinSetOption filetype=etc-hosts %{ add-highlighter ref etc-hosts } hook -group etc-hosts-highlight global WinSetOption filetype=etc-hosts %{ add-highlighter window ref etc-hosts }
hook -group etc-hosts-highlight global WinSetOption filetype=(?!etc-hosts).* %{ remove-highlighter etc-hosts } hook -group etc-hosts-highlight global WinSetOption filetype=(?!etc-hosts).* %{ remove-highlighter window/etc-hosts }
## /etc/fstab ## /etc/fstab
add-highlighter -group / group etc-fstab add-highlighter shared/ group etc-fstab
add-highlighter -group /etc-fstab regex ^(\S{1,})\s+?(\S{1,})\s+?(\S{1,})\s+?(\S{1,})\s+?(\S{1,})\s+?(\S{1,})(?:\s+)?$ 1:keyword 2:value 3:type 4:string 5:attribute 6:attribute add-highlighter shared/etc-fstab regex ^(\S{1,})\s+?(\S{1,})\s+?(\S{1,})\s+?(\S{1,})\s+?(\S{1,})\s+?(\S{1,})(?:\s+)?$ 1:keyword 2:value 3:type 4:string 5:attribute 6:attribute
add-highlighter -group /etc-fstab regex '#.*?$' 0:comment add-highlighter shared/etc-fstab regex '#.*?$' 0:comment
hook -group etc-fstab-highlight global WinSetOption filetype=etc-fstab %{ add-highlighter ref etc-fstab } hook -group etc-fstab-highlight global WinSetOption filetype=etc-fstab %{ add-highlighter window ref etc-fstab }
hook -group etc-fstab-highlight global WinSetOption filetype=(?!etc-fstab).* %{ remove-highlighter etc-fstab } hook -group etc-fstab-highlight global WinSetOption filetype=(?!etc-fstab).* %{ remove-highlighter window/etc-fstab }
## /etc/group ## /etc/group
add-highlighter -group / group etc-group add-highlighter shared/ group etc-group
add-highlighter -group /etc-group regex ^(\S+?):(\S+?)?:(\S+?)?:(\S+?)?$ 1:keyword 2:type 3:value 4:string add-highlighter shared/etc-group regex ^(\S+?):(\S+?)?:(\S+?)?:(\S+?)?$ 1:keyword 2:type 3:value 4:string
hook -group etc-group-highlight global WinSetOption filetype=etc-group %{ add-highlighter ref etc-group } hook -group etc-group-highlight global WinSetOption filetype=etc-group %{ add-highlighter window ref etc-group }
hook -group etc-group-highlight global WinSetOption filetype=(?!etc-group).* %{ remove-highlighter etc-group } hook -group etc-group-highlight global WinSetOption filetype=(?!etc-group).* %{ remove-highlighter window/etc-group }
## /etc/gshadow ## /etc/gshadow
add-highlighter -group / group etc-gshadow add-highlighter shared/ group etc-gshadow
add-highlighter -group /etc-gshadow regex ^(\S+?):(\S+?)?:(\S+?)?:(\S+?)?$ 1:keyword 2:type 3:value 4:string add-highlighter shared/etc-gshadow regex ^(\S+?):(\S+?)?:(\S+?)?:(\S+?)?$ 1:keyword 2:type 3:value 4:string
hook -group etc-gshadow-highlight global WinSetOption filetype=etc-gshadow %{ add-highlighter ref etc-gshadow } hook -group etc-gshadow-highlight global WinSetOption filetype=etc-gshadow %{ add-highlighter window ref etc-gshadow }
hook -group etc-gshadow-highlight global WinSetOption filetype=(?!etc-gshadow).* %{ remove-highlighter etc-gshadow } hook -group etc-gshadow-highlight global WinSetOption filetype=(?!etc-gshadow).* %{ remove-highlighter window/etc-gshadow }
## /etc/shadow ## /etc/shadow
add-highlighter -group / group etc-shadow add-highlighter shared/ group etc-shadow
add-highlighter -group /etc-shadow regex ^(\S+?):(\S+?):([0-9]+?):([0-9]+?)?:([0-9]+?)?:([0-9]+?)?:([0-9]+?)?:([0-9]+?)?:(.*?)?$ 1:keyword 2:type 3:value 4:value 5:value 6:value 7:value 8:value add-highlighter shared/etc-shadow regex ^(\S+?):(\S+?):([0-9]+?):([0-9]+?)?:([0-9]+?)?:([0-9]+?)?:([0-9]+?)?:([0-9]+?)?:(.*?)?$ 1:keyword 2:type 3:value 4:value 5:value 6:value 7:value 8:value
hook -group etc-shadow-highlight global WinSetOption filetype=etc-shadow %{ add-highlighter ref etc-shadow } hook -group etc-shadow-highlight global WinSetOption filetype=etc-shadow %{ add-highlighter window ref etc-shadow }
hook -group etc-shadow-highlight global WinSetOption filetype=(?!etc-shadow).* %{ remove-highlighter etc-shadow } hook -group etc-shadow-highlight global WinSetOption filetype=(?!etc-shadow).* %{ remove-highlighter window/etc-shadow }
## /etc/passwd ## /etc/passwd
add-highlighter -group / group etc-passwd add-highlighter shared/ group etc-passwd
add-highlighter -group /etc-passwd regex ^(\S+?):(\S+?):([0-9]+?):([0-9]+?):(.*?)?:(.+?):(.+?)$ 1:keyword 2:type 3:value 4:value 5:string 6:attribute 7:attribute add-highlighter shared/etc-passwd regex ^(\S+?):(\S+?):([0-9]+?):([0-9]+?):(.*?)?:(.+?):(.+?)$ 1:keyword 2:type 3:value 4:value 5:string 6:attribute 7:attribute
hook -group etc-passwd-highlight global WinSetOption filetype=etc-passwd %{ add-highlighter ref etc-passwd } hook -group etc-passwd-highlight global WinSetOption filetype=etc-passwd %{ add-highlighter window ref etc-passwd }
hook -group etc-passwd-highlight global WinSetOption filetype=(?!etc-passwd).* %{ remove-highlighter etc-passwd } hook -group etc-passwd-highlight global WinSetOption filetype=(?!etc-passwd).* %{ remove-highlighter window/etc-passwd }

View File

@ -11,20 +11,20 @@ hook global BufCreate .*[.](fish) %{
# Highlighters # Highlighters
# ‾‾‾‾‾‾‾‾‾‾‾‾ # ‾‾‾‾‾‾‾‾‾‾‾‾
add-highlighter -group / regions -default code fish \ add-highlighter shared/ regions -default code fish \
double_string '"' (?<!\\)(\\\\)*" '' \ double_string '"' (?<!\\)(\\\\)*" '' \
single_string "'" "'" '' \ single_string "'" "'" '' \
comment '#' '$' '' comment '#' '$' ''
add-highlighter -group /fish/double_string fill string add-highlighter shared/fish/double_string fill string
add-highlighter -group /fish/double_string regex (\$\w+)|(\{\$\w+\}) 0:variable add-highlighter shared/fish/double_string regex (\$\w+)|(\{\$\w+\}) 0:variable
add-highlighter -group /fish/single_string fill string add-highlighter shared/fish/single_string fill string
add-highlighter -group /fish/comment fill comment add-highlighter shared/fish/comment fill comment
add-highlighter -group /fish/code regex (\$\w+)|(\{\$\w+\}) 0:variable add-highlighter shared/fish/code regex (\$\w+)|(\{\$\w+\}) 0:variable
# Command names are collected using `builtin --names` and 'eval' from `functions --names` # Command names are collected using `builtin --names` and 'eval' from `functions --names`
add-highlighter -group /fish/code regex \b(and|begin|bg|bind|block|break|breakpoint|builtin|case|cd|command|commandline|complete|contains|continue|count|echo|else|emit|end|eval|exec|exit|fg|for|function|functions|history|if|jobs|not|or|printf|pwd|random|read|return|set|set_color|source|status|switch|test|ulimit|while)\b 0:keyword add-highlighter shared/fish/code regex \b(and|begin|bg|bind|block|break|breakpoint|builtin|case|cd|command|commandline|complete|contains|continue|count|echo|else|emit|end|eval|exec|exit|fg|for|function|functions|history|if|jobs|not|or|printf|pwd|random|read|return|set|set_color|source|status|switch|test|ulimit|while)\b 0:keyword
# Commands # Commands
# ‾‾‾‾‾‾‾‾ # ‾‾‾‾‾‾‾‾
@ -71,7 +71,7 @@ def -hidden fish-insert-on-new-line %{
# Initialization # Initialization
# ‾‾‾‾‾‾‾‾‾‾‾‾‾‾ # ‾‾‾‾‾‾‾‾‾‾‾‾‾‾
hook -group fish-highlight global WinSetOption filetype=fish %{ add-highlighter ref fish } hook -group fish-highlight global WinSetOption filetype=fish %{ add-highlighter window ref fish }
hook global WinSetOption filetype=fish %{ hook global WinSetOption filetype=fish %{
hook window InsertChar .* -group fish-indent fish-indent-on-char hook window InsertChar .* -group fish-indent fish-indent-on-char
@ -79,7 +79,7 @@ hook global WinSetOption filetype=fish %{
hook window InsertChar \n -group fish-indent fish-indent-on-new-line hook window InsertChar \n -group fish-indent fish-indent-on-new-line
} }
hook -group fish-highlight global WinSetOption filetype=(?!fish).* %{ remove-highlighter fish } hook -group fish-highlight global WinSetOption filetype=(?!fish).* %{ remove-highlighter window/fish }
hook global WinSetOption filetype=(?!fish).* %{ hook global WinSetOption filetype=(?!fish).* %{
remove-hooks window fish-indent remove-hooks window fish-indent

View File

@ -5,34 +5,34 @@ hook global BufCreate .*\.(s|S|asm)$ %{
} }
add-highlighter -group / regions -default code gas \ add-highlighter shared/ regions -default code gas \
string '"' (?<!\\)(\\\\)*" '' \ string '"' (?<!\\)(\\\\)*" '' \
commentMulti /\* \*/ '' \ commentMulti /\* \*/ '' \
commentSingle1 '#' '$' '' \ commentSingle1 '#' '$' '' \
commentSingle2 ';' '$' '' commentSingle2 ';' '$' ''
add-highlighter -group /gas/string fill string add-highlighter shared/gas/string fill string
add-highlighter -group /gas/commentMulti fill comment add-highlighter shared/gas/commentMulti fill comment
add-highlighter -group /gas/commentSingle1 fill comment add-highlighter shared/gas/commentSingle1 fill comment
add-highlighter -group /gas/commentSingle2 fill comment add-highlighter shared/gas/commentSingle2 fill comment
# Constant # Constant
add-highlighter -group /gas/code regex (0[xX][0-9]+|\b[0-9]+)\b 0:value add-highlighter shared/gas/code regex (0[xX][0-9]+|\b[0-9]+)\b 0:value
# Labels # Labels
add-highlighter -group /gas/code regex ^\h*([A-Za-z0-9_.-]+): 0:operator add-highlighter shared/gas/code regex ^\h*([A-Za-z0-9_.-]+): 0:operator
# ARM Directives # ARM Directives
add-highlighter -group /gas/code regex ((^|\s+)\.([248]byte|align|arch(_extension)?|arm|bsscantunwind|code|[cf]pu|[dq]n|eabi_attribute|even|extend|ldouble|fnend|fnstart|force_thumb|handlerdata|inst(\.[nw])?|ltorg|movsp|object_arch|packed|pad|personality(index)?|pool|req|save|setfp|screl32|syntax|thumb(_func|_set)?|tlsdescseq|unreq|unwind_raw|vsave)(\h+|$)) 0:type add-highlighter shared/gas/code regex ((^|\s+)\.([248]byte|align|arch(_extension)?|arm|bsscantunwind|code|[cf]pu|[dq]n|eabi_attribute|even|extend|ldouble|fnend|fnstart|force_thumb|handlerdata|inst(\.[nw])?|ltorg|movsp|object_arch|packed|pad|personality(index)?|pool|req|save|setfp|screl32|syntax|thumb(_func|_set)?|tlsdescseq|unreq|unwind_raw|vsave)(\h+|$)) 0:type
# Assembler Directives # Assembler Directives
add-highlighter -group /gas/code regex ((^|\s+)\.(abort|ABORT|align|app-file|ascii|asciz|balign[wl]|byte|comm|data|def|desc|dim|double|eject|else|endif|equ|extern|file|fill|float|global|globl|hword|ident|if|include|int|irp|irpc|lcomm|iflags|line|linkonce|ln|mri|list|loc|local|long|macro|nolist|octa|org|print|purgem|p2align[wl]|psize|quad|rept|sbttl|section|set|short|single|size|skip|space|stab[dns]|string|struct|tag|text|title|type|title|uleb128|val|vtable_entry|weak|word|rodata|zero)(\h+|$)) 0:type add-highlighter shared/gas/code regex ((^|\s+)\.(abort|ABORT|align|app-file|ascii|asciz|balign[wl]|byte|comm|data|def|desc|dim|double|eject|else|endif|equ|extern|file|fill|float|global|globl|hword|ident|if|include|int|irp|irpc|lcomm|iflags|line|linkonce|ln|mri|list|loc|local|long|macro|nolist|octa|org|print|purgem|p2align[wl]|psize|quad|rept|sbttl|section|set|short|single|size|skip|space|stab[dns]|string|struct|tag|text|title|type|title|uleb128|val|vtable_entry|weak|word|rodata|zero)(\h+|$)) 0:type
# Registers # Registers
add-highlighter -group /gas/code regex \%(([re](ax|bx|cx|dx|si|di|bp|sp))|(al|bl|cl|dl|sil|dil|bpl|spl)|(r[8-9][dwb])|(r1[0-5][dwb])|(cs|ds|es|fs|gs|ss|ip|eflags)|([xy]mm[0-9]|[xy]mm1[0-5]))\b 0:variable add-highlighter shared/gas/code regex \%(([re](ax|bx|cx|dx|si|di|bp|sp))|(al|bl|cl|dl|sil|dil|bpl|spl)|(r[8-9][dwb])|(r1[0-5][dwb])|(cs|ds|es|fs|gs|ss|ip|eflags)|([xy]mm[0-9]|[xy]mm1[0-5]))\b 0:variable
# General Instructions # General Instructions
add-highlighter -group /gas/code regex \ add-highlighter shared/gas/code regex \
^\h*(mov|lea|call|test|cmp)([bwlq])?\b|\ ^\h*(mov|lea|call|test|cmp)([bwlq])?\b|\
^\h*(bswap[lq]|cmpxchg[bwlq]|cmpxchg8b|cwt[ld]|movabs([bwlq])?|popa([lw])?|pusha([wl])?)\b|\ ^\h*(bswap[lq]|cmpxchg[bwlq]|cmpxchg8b|cwt[ld]|movabs([bwlq])?|popa([lw])?|pusha([wl])?)\b|\
^\h*(and|or|not|xor|sar|sal|shr|shl|sub|add|(i)?mul|(i)?div|inc|dec|adc|sbb)([bwlq])?\b|\ ^\h*(and|or|not|xor|sar|sal|shr|shl|sub|add|(i)?mul|(i)?div|inc|dec|adc|sbb)([bwlq])?\b|\
@ -53,7 +53,7 @@ add-highlighter -group /gas/code regex \
^\h*(bound([wl])?|enter|int(o)?|lcall|loop(n)?[ez]|pause)\b 0:keyword ^\h*(bound([wl])?|enter|int(o)?|lcall|loop(n)?[ez]|pause)\b 0:keyword
#Floating Point Instructions #Floating Point Instructions
add-highlighter -group /gas/code regex \ add-highlighter shared/gas/code regex \
^\h*f(add|sub|mul|com|comp|sub|subr|div|divr|ld|xch|st|nop|stp|ldenv|chs|abs)\b|\ ^\h*f(add|sub|mul|com|comp|sub|subr|div|divr|ld|xch|st|nop|stp|ldenv|chs|abs)\b|\
^\h*f(tst|xam|ldcw|ld1|ld2[te]|ldpi|ld[gn]2|ldz|(n)?stenv|2xm1|yl2x|p(a)?tan)\b|\ ^\h*f(tst|xam|ldcw|ld1|ld2[te]|ldpi|ld[gn]2|ldz|(n)?stenv|2xm1|yl2x|p(a)?tan)\b|\
^\h*f(xtract|prem(1)?|(dec|inc)stp|(n)?stcw|yl2xp1|sqrt|sincos|rndint|scale|sin|cos|iadd)\b|\ ^\h*f(xtract|prem(1)?|(dec|inc)stp|(n)?stcw|yl2xp1|sqrt|sincos|rndint|scale|sin|cos|iadd)\b|\
@ -85,13 +85,13 @@ def -hidden gas-indent-on-new-line %~
> >
~ ~
hook -group gas-highlight global WinSetOption filetype=gas %{ add-highlighter ref gas } hook -group gas-highlight global WinSetOption filetype=gas %{ add-highlighter window ref gas }
hook global WinSetOption filetype=gas %{ hook global WinSetOption filetype=gas %{
hook window InsertChar \n -group gas-indent gas-indent-on-new-line hook window InsertChar \n -group gas-indent gas-indent-on-new-line
} }
hook -group gas-highlight global WinSetOption filetype=(?!gas).* %{ remove-highlighter gas } hook -group gas-highlight global WinSetOption filetype=(?!gas).* %{ remove-highlighter window/gas }
hook global WinSetOption filetype=(?!gas).* %{ hook global WinSetOption filetype=(?!gas).* %{
remove-hooks window gas-indent remove-hooks window gas-indent

View File

@ -3,22 +3,22 @@ hook global BufCreate .*(COMMIT_EDITMSG|MERGE_MSG) %{
} }
hook -group git-commit-highlight global WinSetOption filetype=git-commit %{ hook -group git-commit-highlight global WinSetOption filetype=git-commit %{
add-highlighter group git-commit-highlight add-highlighter window group git-commit-highlight
add-highlighter -group git-commit-highlight regex "^\h*#[^\n]*\n" 0:cyan,default add-highlighter window/git-commit-highlight regex "^\h*#[^\n]*\n" 0:cyan,default
add-highlighter -group git-commit-highlight regex "\b(?:(modified)|(deleted)|(new file)|(renamed|copied)):([^\n]*)\n" 1:yellow 2:red 3:green 4:blue 5:magenta add-highlighter window/git-commit-highlight regex "\b(?:(modified)|(deleted)|(new file)|(renamed|copied)):([^\n]*)\n" 1:yellow 2:red 3:green 4:blue 5:magenta
add-highlighter -group git-commit-highlight ref diff # highlight potential diffs from the -v option add-highlighter window/git-commit-highlight ref diff # highlight potential diffs from the -v option
} }
hook -group git-commit-highlight global WinSetOption filetype=(?!git-commit).* %{ remove-highlighter git-commit-highlight } hook -group git-commit-highlight global WinSetOption filetype=(?!git-commit).* %{ remove-highlighter window/git-commit-highlight }
hook global BufCreate .*git-rebase-todo %{ hook global BufCreate .*git-rebase-todo %{
set buffer filetype git-rebase set buffer filetype git-rebase
} }
hook -group git-rebase-highlight global WinSetOption filetype=git-rebase %{ hook -group git-rebase-highlight global WinSetOption filetype=git-rebase %{
add-highlighter group git-rebase-highlight add-highlighter window group git-rebase-highlight
add-highlighter -group git-rebase-highlight regex "#[^\n]*\n" 0:cyan,default add-highlighter window/git-rebase-highlight regex "#[^\n]*\n" 0:cyan,default
add-highlighter -group git-rebase-highlight regex "^(pick|edit|reword|squash|fixup|exec|[persfx]) (\w+)" 1:green 2:magenta add-highlighter window/git-rebase-highlight regex "^(pick|edit|reword|squash|fixup|exec|[persfx]) (\w+)" 1:green 2:magenta
} }
hook -group git-rebase-highlight global WinSetOption filetype=(?!git-rebase).* %{ remove-highlighter git-rebase-highlight } hook -group git-rebase-highlight global WinSetOption filetype=(?!git-rebase).* %{ remove-highlighter window/git-rebase-highlight }

View File

@ -11,19 +11,19 @@ hook global BufCreate .*\.go %{
# Highlighters # Highlighters
# ‾‾‾‾‾‾‾‾‾‾‾‾ # ‾‾‾‾‾‾‾‾‾‾‾‾
add-highlighter -group / regions -default code go \ add-highlighter shared/ regions -default code go \
back_string '`' '`' '' \ back_string '`' '`' '' \
double_string '"' (?<!\\)(\\\\)*" '' \ double_string '"' (?<!\\)(\\\\)*" '' \
single_string "'" (?<!\\)(\\\\)*' '' \ single_string "'" (?<!\\)(\\\\)*' '' \
comment /\* \*/ '' \ comment /\* \*/ '' \
comment '//' $ '' comment '//' $ ''
add-highlighter -group /go/back_string fill string add-highlighter shared/go/back_string fill string
add-highlighter -group /go/double_string fill string add-highlighter shared/go/double_string fill string
add-highlighter -group /go/single_string fill string add-highlighter shared/go/single_string fill string
add-highlighter -group /go/comment fill comment add-highlighter shared/go/comment fill comment
add-highlighter -group /go/code regex %{-?([0-9]*\.(?!0[xX]))?\b([0-9]+|0[xX][0-9a-fA-F]+)\.?([eE][+-]?[0-9]+)?i?\b} 0:value add-highlighter shared/go/code regex %{-?([0-9]*\.(?!0[xX]))?\b([0-9]+|0[xX][0-9a-fA-F]+)\.?([eE][+-]?[0-9]+)?i?\b} 0:value
%sh{ %sh{
# Grammar # Grammar
@ -42,11 +42,11 @@ add-highlighter -group /go/code regex %{-?([0-9]*\.(?!0[xX]))?\b([0-9]+|0[xX][0-
# Highlight keywords # Highlight keywords
printf %s " printf %s "
add-highlighter -group /go/code regex \b(${keywords})\b 0:keyword add-highlighter shared/go/code regex \b(${keywords})\b 0:keyword
add-highlighter -group /go/code regex \b(${attributes})\b 0:attribute add-highlighter shared/go/code regex \b(${attributes})\b 0:attribute
add-highlighter -group /go/code regex \b(${types})\b 0:type add-highlighter shared/go/code regex \b(${types})\b 0:type
add-highlighter -group /go/code regex \b(${values})\b 0:value add-highlighter shared/go/code regex \b(${values})\b 0:value
add-highlighter -group /go/code regex \b(${functions})\b 0:builtin add-highlighter shared/go/code regex \b(${functions})\b 0:builtin
" "
} }
@ -85,7 +85,7 @@ def -hidden go-indent-on-closing-curly-brace %[
# Initialization # Initialization
# ‾‾‾‾‾‾‾‾‾‾‾‾‾‾ # ‾‾‾‾‾‾‾‾‾‾‾‾‾‾
hook -group go-highlight global WinSetOption filetype=go %{ add-highlighter ref go } hook -group go-highlight global WinSetOption filetype=go %{ add-highlighter window ref go }
hook global WinSetOption filetype=go %{ hook global WinSetOption filetype=go %{
# cleanup trailing whitespaces when exiting insert mode # cleanup trailing whitespaces when exiting insert mode
@ -95,7 +95,7 @@ hook global WinSetOption filetype=go %{
hook window InsertChar \} -group go-indent go-indent-on-closing-curly-brace hook window InsertChar \} -group go-indent go-indent-on-closing-curly-brace
} }
hook -group go-highlight global WinSetOption filetype=(?!go).* %{ remove-highlighter go } hook -group go-highlight global WinSetOption filetype=(?!go).* %{ remove-highlighter window/go }
hook global WinSetOption filetype=(?!go).* %{ hook global WinSetOption filetype=(?!go).* %{
remove-hooks window go-hooks remove-hooks window go-hooks

View File

@ -11,24 +11,24 @@ hook global BufCreate .*[.](hs) %{
# Highlighters # Highlighters
# ‾‾‾‾‾‾‾‾‾‾‾‾ # ‾‾‾‾‾‾‾‾‾‾‾‾
add-highlighter -group / regions -default code haskell \ add-highlighter shared/ regions -default code haskell \
string '(?<!\'\\)(?<!\')"' (?<!\\)(\\\\)*" '' \ string '(?<!\'\\)(?<!\')"' (?<!\\)(\\\\)*" '' \
macro ^\h*?\K# (?<!\\)\n '' \ macro ^\h*?\K# (?<!\\)\n '' \
pragma \{-# '#-\}' \{- \ pragma \{-# '#-\}' \{- \
comment \{- -\} \{- \ comment \{- -\} \{- \
comment --(?:[^!#$%&*+./<>?@\\\^|~=]|$) $ '' comment --(?:[^!#$%&*+./<>?@\\\^|~=]|$) $ ''
add-highlighter -group /haskell/string fill string add-highlighter shared/haskell/string fill string
add-highlighter -group /haskell/comment fill comment add-highlighter shared/haskell/comment fill comment
add-highlighter -group /haskell/pragma fill meta add-highlighter shared/haskell/pragma fill meta
add-highlighter -group /haskell/macro fill meta add-highlighter shared/haskell/macro fill meta
add-highlighter -group /haskell/code regex (?<!')\b0x+[A-Fa-f0-9]+ 0:value add-highlighter shared/haskell/code regex (?<!')\b0x+[A-Fa-f0-9]+ 0:value
add-highlighter -group /haskell/code regex (?<!')\b\d+([.]\d+)? 0:value add-highlighter shared/haskell/code regex (?<!')\b\d+([.]\d+)? 0:value
add-highlighter -group /haskell/code regex (?<!')\b(import|hiding|qualified|module)(?!')\b 0:keyword add-highlighter shared/haskell/code regex (?<!')\b(import|hiding|qualified|module)(?!')\b 0:keyword
add-highlighter -group /haskell/code regex (?<!')\b(import)(?!')\b[^\n]+(?<!')\b(as)(?!')\b 2:keyword add-highlighter shared/haskell/code regex (?<!')\b(import)(?!')\b[^\n]+(?<!')\b(as)(?!')\b 2:keyword
add-highlighter -group /haskell/code regex (?<!')\b(class|data|default|deriving|infix|infixl|infixr|instance|module|newtype|pattern|type|where)(?!')\b 0:keyword add-highlighter shared/haskell/code regex (?<!')\b(class|data|default|deriving|infix|infixl|infixr|instance|module|newtype|pattern|type|where)(?!')\b 0:keyword
add-highlighter -group /haskell/code regex (?<!')\b(case|do|else|if|in|let|mdo|of|proc|rec|then)(?!')\b 0:attribute add-highlighter shared/haskell/code regex (?<!')\b(case|do|else|if|in|let|mdo|of|proc|rec|then)(?!')\b 0:attribute
# The complications below is because period has many uses: # The complications below is because period has many uses:
# As function composition operator (possibly without spaces) like "." and "f.g" # As function composition operator (possibly without spaces) like "." and "f.g"
@ -39,32 +39,32 @@ add-highlighter -group /haskell/code regex (?<!')\b(case|do|else|if|in|let|mdo|o
# matches uppercase identifiers: Monad Control.Monad # matches uppercase identifiers: Monad Control.Monad
# not non-space separated dot: Just.const # not non-space separated dot: Just.const
add-highlighter -group /haskell/code regex \b([A-Z]['\w]*\.)*[A-Z]['\w]*(?!\.) 0:variable add-highlighter shared/haskell/code regex \b([A-Z]['\w]*\.)*[A-Z]['\w]*(?!\.) 0:variable
# matches infix identifier: `mod` `Apa._T'M` # matches infix identifier: `mod` `Apa._T'M`
add-highlighter -group /haskell/code regex `\b([A-Z]['\w]*\.)*[\w]['\w]*` 0:operator add-highlighter shared/haskell/code regex `\b([A-Z]['\w]*\.)*[\w]['\w]*` 0:operator
# matches imported operators: M.! M.. Control.Monad.>> # matches imported operators: M.! M.. Control.Monad.>>
# not operator keywords: M... M.-> # not operator keywords: M... M.->
add-highlighter -group /haskell/code regex \b[A-Z]['\w]*\.[~<=>|:!?/.@$*&#%+\^\-\\]+ 0:operator add-highlighter shared/haskell/code regex \b[A-Z]['\w]*\.[~<=>|:!?/.@$*&#%+\^\-\\]+ 0:operator
# matches dot: . # matches dot: .
# not possibly incomplete import: a. # not possibly incomplete import: a.
# not other operators: !. .! # not other operators: !. .!
add-highlighter -group /haskell/code regex (?<![\w~<=>|:!?/.@$*&#%+\^\-\\])\.(?![~<=>|:!?/.@$*&#%+\^\-\\]) 0:operator add-highlighter shared/haskell/code regex (?<![\w~<=>|:!?/.@$*&#%+\^\-\\])\.(?![~<=>|:!?/.@$*&#%+\^\-\\]) 0:operator
# matches other operators: ... > < <= ^ <*> <$> etc # matches other operators: ... > < <= ^ <*> <$> etc
# not dot: . # not dot: .
# not operator keywords: @ .. -> :: ~ # not operator keywords: @ .. -> :: ~
add-highlighter -group /haskell/code regex (?<![~<=>|:!?/.@$*&#%+\^\-\\])[~<=>|:!?/.@$*&#%+\^\-\\]+ 0:operator add-highlighter shared/haskell/code regex (?<![~<=>|:!?/.@$*&#%+\^\-\\])[~<=>|:!?/.@$*&#%+\^\-\\]+ 0:operator
# matches operator keywords: @ -> # matches operator keywords: @ ->
add-highlighter -group /haskell/code regex (?<![~<=>|:!?/.@$*&#%+\^\-\\])(@|~|<-|->|=>|::|=|:|[|])(?![~<=>|:!?/.@$*&#%+\^\-\\]) 1:keyword add-highlighter shared/haskell/code regex (?<![~<=>|:!?/.@$*&#%+\^\-\\])(@|~|<-|->|=>|::|=|:|[|])(?![~<=>|:!?/.@$*&#%+\^\-\\]) 1:keyword
# matches: forall [..variables..] . # matches: forall [..variables..] .
# not the variables # not the variables
add-highlighter -group /haskell/code regex \b(forall)\b[^.\n]*?(\.) 1:keyword 2:keyword add-highlighter shared/haskell/code regex \b(forall)\b[^.\n]*?(\.) 1:keyword 2:keyword
# matches 'x' '\\' '\'' '\n' '\0' # matches 'x' '\\' '\'' '\n' '\0'
# not incomplete literals: '\' # not incomplete literals: '\'
# not valid identifiers: w' _' # not valid identifiers: w' _'
add-highlighter -group /haskell/code regex \B'([^\\]|[\\]['"\w\d\\])' 0:string add-highlighter shared/haskell/code regex \B'([^\\]|[\\]['"\w\d\\])' 0:string
# this has to come after operators so '-' etc is correct # this has to come after operators so '-' etc is correct
# Commands # Commands
@ -95,7 +95,7 @@ def -hidden haskell-indent-on-new-line %{
# Initialization # Initialization
# ‾‾‾‾‾‾‾‾‾‾‾‾‾‾ # ‾‾‾‾‾‾‾‾‾‾‾‾‾‾
hook -group haskell-highlight global WinSetOption filetype=haskell %{ add-highlighter ref haskell } hook -group haskell-highlight global WinSetOption filetype=haskell %{ add-highlighter window ref haskell }
hook global WinSetOption filetype=haskell %{ hook global WinSetOption filetype=haskell %{
set window extra_word_chars "'" set window extra_word_chars "'"
@ -103,7 +103,7 @@ hook global WinSetOption filetype=haskell %{
hook window InsertChar \n -group haskell-indent haskell-indent-on-new-line hook window InsertChar \n -group haskell-indent haskell-indent-on-new-line
} }
hook -group haskell-highlight global WinSetOption filetype=(?!haskell).* %{ remove-highlighter haskell } hook -group haskell-highlight global WinSetOption filetype=(?!haskell).* %{ remove-highlighter window/haskell }
hook global WinSetOption filetype=(?!haskell).* %{ hook global WinSetOption filetype=(?!haskell).* %{
remove-hooks window haskell-indent remove-hooks window haskell-indent

View File

@ -15,26 +15,26 @@ hook global BufCreate .*\.xml %{
# Highlighters # Highlighters
# ‾‾‾‾‾‾‾‾‾‾‾‾ # ‾‾‾‾‾‾‾‾‾‾‾‾
add-highlighter -group / regions html \ add-highlighter shared/ regions html \
comment <!-- --> '' \ comment <!-- --> '' \
tag < > '' \ tag < > '' \
style <style\b.*?>\K (?=</style>) '' \ style <style\b.*?>\K (?=</style>) '' \
script <script\b.*?>\K (?=</script>) '' script <script\b.*?>\K (?=</script>) ''
add-highlighter -group /html/comment fill comment add-highlighter shared/html/comment fill comment
add-highlighter -group /html/style ref css add-highlighter shared/html/style ref css
add-highlighter -group /html/script ref javascript add-highlighter shared/html/script ref javascript
add-highlighter -group /html/tag regex \b([a-zA-Z0-9_-]+)=? 1:attribute add-highlighter shared/html/tag regex \b([a-zA-Z0-9_-]+)=? 1:attribute
add-highlighter -group /html/tag regex </?(\w+) 1:keyword add-highlighter shared/html/tag regex </?(\w+) 1:keyword
add-highlighter -group /html/tag regex <(!DOCTYPE(\h+\w+)+) 1:meta add-highlighter shared/html/tag regex <(!DOCTYPE(\h+\w+)+) 1:meta
add-highlighter -group /html/tag regions content \ add-highlighter shared/html/tag regions content \
string '"' (?<!\\)(\\\\)*" '' \ string '"' (?<!\\)(\\\\)*" '' \
string "'" "'" '' string "'" "'" ''
add-highlighter -group /html/tag/content/string fill string add-highlighter shared/html/tag/content/string fill string
# Commands # Commands
# ‾‾‾‾‾‾‾‾ # ‾‾‾‾‾‾‾‾
@ -65,7 +65,7 @@ def -hidden html-indent-on-new-line %{
# Initialization # Initialization
# ‾‾‾‾‾‾‾‾‾‾‾‾‾‾ # ‾‾‾‾‾‾‾‾‾‾‾‾‾‾
hook -group html-highlight global WinSetOption filetype=(?:html|xml) %{ add-highlighter ref html } hook -group html-highlight global WinSetOption filetype=(?:html|xml) %{ add-highlighter window ref html }
hook global WinSetOption filetype=(?:html|xml) %{ hook global WinSetOption filetype=(?:html|xml) %{
hook window InsertEnd .* -group html-hooks html-filter-around-selections hook window InsertEnd .* -group html-hooks html-filter-around-selections
@ -73,7 +73,7 @@ hook global WinSetOption filetype=(?:html|xml) %{
hook window InsertChar \n -group html-indent html-indent-on-new-line hook window InsertChar \n -group html-indent html-indent-on-new-line
} }
hook -group html-highlight global WinSetOption filetype=(?!html)(?!xml).* %{ remove-highlighter html } hook -group html-highlight global WinSetOption filetype=(?!html)(?!xml).* %{ remove-highlighter window/html }
hook global WinSetOption filetype=(?!html)(?!xml).* %{ hook global WinSetOption filetype=(?!html)(?!xml).* %{
remove-hooks window html-indent remove-hooks window html-indent

View File

@ -2,13 +2,13 @@ hook global BufCreate .*\.(repo|service|target|socket|ini|cfg) %{
set buffer filetype ini set buffer filetype ini
} }
add-highlighter -group / regions -default code ini \ add-highlighter shared/ regions -default code ini \
comment '(^|\h)\K[#;]' $ '' comment '(^|\h)\K[#;]' $ ''
add-highlighter -group /ini/code regex "^\h*\[[^\]]*\]" 0:title add-highlighter shared/ini/code regex "^\h*\[[^\]]*\]" 0:title
add-highlighter -group /ini/code regex "^\h*([^\[][^=\n]*=)([^\n]*)" 1:variable 2:value add-highlighter shared/ini/code regex "^\h*([^\[][^=\n]*=)([^\n]*)" 1:variable 2:value
add-highlighter -group /ini/comment fill comment add-highlighter shared/ini/comment fill comment
hook -group ini-highlight global WinSetOption filetype=ini %{ add-highlighter ref ini } hook -group ini-highlight global WinSetOption filetype=ini %{ add-highlighter window ref ini }
hook -group ini-highlight global WinSetOption filetype=(?!ini).* %{ remove-highlighter ini } hook -group ini-highlight global WinSetOption filetype=(?!ini).* %{ remove-highlighter window/ini }

View File

@ -2,18 +2,18 @@ hook global BufCreate .*\.java %{
set buffer filetype java set buffer filetype java
} }
add-highlighter -group / regions -default code java \ add-highlighter shared/ regions -default code java \
string %{(?<!')"} %{(?<!\\)(\\\\)*"} '' \ string %{(?<!')"} %{(?<!\\)(\\\\)*"} '' \
comment /\* \*/ '' \ comment /\* \*/ '' \
comment // $ '' comment // $ ''
add-highlighter -group /java/string fill string add-highlighter shared/java/string fill string
add-highlighter -group /java/comment fill comment add-highlighter shared/java/comment fill comment
add-highlighter -group /java/code regex %{\b(this|true|false|null)\b} 0:value add-highlighter shared/java/code regex %{\b(this|true|false|null)\b} 0:value
add-highlighter -group /java/code regex "\b(void|int|char|unsigned|float|boolean|double)\b" 0:type add-highlighter shared/java/code regex "\b(void|int|char|unsigned|float|boolean|double)\b" 0:type
add-highlighter -group /java/code regex "\b(while|for|if|else|do|static|switch|case|default|class|interface|enum|goto|break|continue|return|import|try|catch|throw|new|package|extends|implements|instanceof)\b" 0:keyword add-highlighter shared/java/code regex "\b(while|for|if|else|do|static|switch|case|default|class|interface|enum|goto|break|continue|return|import|try|catch|throw|new|package|extends|implements|instanceof)\b" 0:keyword
add-highlighter -group /java/code regex "\b(final|public|protected|private|abstract|synchronized|native|transient|volatile)\b" 0:attribute add-highlighter shared/java/code regex "\b(final|public|protected|private|abstract|synchronized|native|transient|volatile)\b" 0:attribute
# Commands # Commands
# ‾‾‾‾‾‾‾‾ # ‾‾‾‾‾‾‾‾
@ -61,5 +61,5 @@ hook global WinSetOption filetype=(?!java).* %{
remove-hooks window java-hooks remove-hooks window java-hooks
remove-hooks window java-indent remove-hooks window java-indent
} }
hook -group java-highlight global WinSetOption filetype=java %{ add-highlighter ref java } hook -group java-highlight global WinSetOption filetype=java %{ add-highlighter window ref java }
hook -group java-highlight global WinSetOption filetype=(?!java).* %{ remove-highlighter java } hook -group java-highlight global WinSetOption filetype=(?!java).* %{ remove-highlighter window/java }

View File

@ -8,7 +8,7 @@ hook global BufCreate .*[.](js) %{
# Highlighters # Highlighters
# ‾‾‾‾‾‾‾‾‾‾‾‾ # ‾‾‾‾‾‾‾‾‾‾‾‾
add-highlighter -group / regions -default code javascript \ add-highlighter shared/ regions -default code javascript \
double_string '"' (?<!\\)(\\\\)*" '' \ double_string '"' (?<!\\)(\\\\)*" '' \
single_string "'" (?<!\\)(\\\\)*' '' \ single_string "'" (?<!\\)(\\\\)*' '' \
literal "`" (?<!\\)(\\\\)*` '' \ literal "`" (?<!\\)(\\\\)*` '' \
@ -20,21 +20,21 @@ add-highlighter -group / regions -default code javascript \
# Regular expression flags are: g → global match, i → ignore case, m → multi-lines, u → unicode, y → sticky # Regular expression flags are: g → global match, i → ignore case, m → multi-lines, u → unicode, y → sticky
# https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp # https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp
add-highlighter -group /javascript/double_string fill string add-highlighter shared/javascript/double_string fill string
add-highlighter -group /javascript/single_string fill string add-highlighter shared/javascript/single_string fill string
add-highlighter -group /javascript/regex fill meta add-highlighter shared/javascript/regex fill meta
add-highlighter -group /javascript/comment fill comment add-highlighter shared/javascript/comment fill comment
add-highlighter -group /javascript/literal fill string add-highlighter shared/javascript/literal fill string
add-highlighter -group /javascript/literal regex \$\{.*?\} 0:value add-highlighter shared/javascript/literal regex \$\{.*?\} 0:value
add-highlighter -group /javascript/code regex \$\w* 0:variable add-highlighter shared/javascript/code regex \$\w* 0:variable
add-highlighter -group /javascript/code regex \b(document|false|null|parent|self|this|true|undefined|window)\b 0:value add-highlighter shared/javascript/code regex \b(document|false|null|parent|self|this|true|undefined|window)\b 0:value
add-highlighter -group /javascript/code regex "-?[0-9]*\.?[0-9]+" 0:value add-highlighter shared/javascript/code regex "-?[0-9]*\.?[0-9]+" 0:value
add-highlighter -group /javascript/code regex \b(Array|Boolean|Date|Function|Number|Object|RegExp|String|Symbol)\b 0:type add-highlighter shared/javascript/code regex \b(Array|Boolean|Date|Function|Number|Object|RegExp|String|Symbol)\b 0:type
# Keywords are collected at # Keywords are collected at
# https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Lexical_grammar#Keywords # https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Lexical_grammar#Keywords
add-highlighter -group /javascript/code regex \b(async|await|break|case|catch|class|const|continue|debugger|default|delete|do|else|export|extends|finally|for|function|if|import|in|instanceof|let|new|of|return|super|switch|throw|try|typeof|var|void|while|with|yield)\b 0:keyword add-highlighter shared/javascript/code regex \b(async|await|break|case|catch|class|const|continue|debugger|default|delete|do|else|export|extends|finally|for|function|if|import|in|instanceof|let|new|of|return|super|switch|throw|try|typeof|var|void|while|with|yield)\b 0:keyword
# Commands # Commands
# ‾‾‾‾‾‾‾‾ # ‾‾‾‾‾‾‾‾
@ -67,7 +67,7 @@ def -hidden javascript-indent-on-new-line %<
# Initialization # Initialization
# ‾‾‾‾‾‾‾‾‾‾‾‾‾‾ # ‾‾‾‾‾‾‾‾‾‾‾‾‾‾
hook -group javascript-highlight global WinSetOption filetype=javascript %{ add-highlighter ref javascript } hook -group javascript-highlight global WinSetOption filetype=javascript %{ add-highlighter window ref javascript }
hook global WinSetOption filetype=javascript %{ hook global WinSetOption filetype=javascript %{
hook window InsertEnd .* -group javascript-hooks javascript-filter-around-selections hook window InsertEnd .* -group javascript-hooks javascript-filter-around-selections
@ -75,7 +75,7 @@ hook global WinSetOption filetype=javascript %{
hook window InsertChar \n -group javascript-indent javascript-indent-on-new-line hook window InsertChar \n -group javascript-indent javascript-indent-on-new-line
} }
hook -group javascript-highlight global WinSetOption filetype=(?!javascript).* %{ remove-highlighter javascript } hook -group javascript-highlight global WinSetOption filetype=(?!javascript).* %{ remove-highlighter window/javascript }
hook global WinSetOption filetype=(?!javascript).* %{ hook global WinSetOption filetype=(?!javascript).* %{
remove-hooks window javascript-indent remove-hooks window javascript-indent

View File

@ -11,12 +11,12 @@ hook global BufCreate .*[.](json) %{
# Highlighters # Highlighters
# ‾‾‾‾‾‾‾‾‾‾‾‾ # ‾‾‾‾‾‾‾‾‾‾‾‾
add-highlighter -group / regions -default code json \ add-highlighter shared/ regions -default code json \
string '"' (?<!\\)(\\\\)*" '' string '"' (?<!\\)(\\\\)*" ''
add-highlighter -group /json/string fill string add-highlighter shared/json/string fill string
add-highlighter -group /json/code regex \b(true|false|null|\d+(?:\.\d+)?(?:[eE][+-]?\d*)?)\b 0:value add-highlighter shared/json/code regex \b(true|false|null|\d+(?:\.\d+)?(?:[eE][+-]?\d*)?)\b 0:value
# Commands # Commands
# ‾‾‾‾‾‾‾‾ # ‾‾‾‾‾‾‾‾
@ -47,7 +47,7 @@ def -hidden json-indent-on-new-line %<
# Initialization # Initialization
# ‾‾‾‾‾‾‾‾‾‾‾‾‾‾ # ‾‾‾‾‾‾‾‾‾‾‾‾‾‾
hook -group json-highlight global WinSetOption filetype=json %{ add-highlighter ref json } hook -group json-highlight global WinSetOption filetype=json %{ add-highlighter window ref json }
hook global WinSetOption filetype=json %{ hook global WinSetOption filetype=json %{
hook window InsertEnd .* -group json-hooks json-filter-around-selections hook window InsertEnd .* -group json-hooks json-filter-around-selections
@ -55,7 +55,7 @@ hook global WinSetOption filetype=json %{
hook window InsertChar \n -group json-indent json-indent-on-new-line hook window InsertChar \n -group json-indent json-indent-on-new-line
} }
hook -group json-highlight global WinSetOption filetype=(?!json).* %{ remove-highlighter json } hook -group json-highlight global WinSetOption filetype=(?!json).* %{ remove-highlighter window/json }
hook global WinSetOption filetype=(?!json).* %{ hook global WinSetOption filetype=(?!json).* %{
remove-hooks window json-indent remove-hooks window json-indent

View File

@ -11,20 +11,20 @@ hook global BufCreate .*\.(jl) %{
# Highlighters # Highlighters
# ‾‾‾‾‾‾‾‾‾‾‾‾ # ‾‾‾‾‾‾‾‾‾‾‾‾
add-highlighter -group / regions -default code julia \ add-highlighter shared/ regions -default code julia \
string '"' (?<!\\)(\\\\)*" '' \ string '"' (?<!\\)(\\\\)*" '' \
comment '#' '$' '' comment '#' '$' ''
add-highlighter -group /julia/string fill string add-highlighter shared/julia/string fill string
add-highlighter -group /julia/comment fill comment add-highlighter shared/julia/comment fill comment
# taken from https://github.com/JuliaLang/julia/blob/master/contrib/julia-mode.el # taken from https://github.com/JuliaLang/julia/blob/master/contrib/julia-mode.el
add-highlighter -group /julia/code regex %{\b(true|false|C_NULL|Inf|NaN|Inf32|NaN32|nothing|\b-?\d+[fdiu]?)\b} 0:value add-highlighter shared/julia/code regex %{\b(true|false|C_NULL|Inf|NaN|Inf32|NaN32|nothing|\b-?\d+[fdiu]?)\b} 0:value
add-highlighter -group /julia/code regex \b(if|else|elseif|while|for|begin|end|quote|try|catch|return|local|abstract|function|macro|ccall|finally|typealias|break|continue|type|global|module|using|import|export|const|let|bitstype|do|in|baremodule|importall|immutable)\b 0:keyword add-highlighter shared/julia/code regex \b(if|else|elseif|while|for|begin|end|quote|try|catch|return|local|abstract|function|macro|ccall|finally|typealias|break|continue|type|global|module|using|import|export|const|let|bitstype|do|in|baremodule|importall|immutable)\b 0:keyword
add-highlighter -group /julia/code regex \b(Number|Real|BigInt|Integer|UInt|UInt8|UInt16|UInt32|UInt64|UInt128|Int|Int8|Int16|Int32|Int64|Int128|BigFloat|FloatingPoint|Float16|Float32|Float64|Complex128|Complex64|Bool|Cuchar|Cshort|Cushort|Cint|Cuint|Clonglong|Culonglong|Cintmax_t|Cuintmax_t|Cfloat|Cdouble|Cptrdiff_t|Cssize_t|Csize_t|Cchar|Clong|Culong|Cwchar_t|Char|ASCIIString|UTF8String|ByteString|SubString|Array|DArray|AbstractArray|AbstractVector|AbstractMatrix|AbstractSparseMatrix|SubArray|StridedArray|StridedVector|StridedMatrix|VecOrMat|StridedVecOrMat|DenseArray|SparseMatrixCSC|BitArray|Range|OrdinalRange|StepRange|UnitRange|FloatRange|Tuple|NTuple|Vararg|DataType|Symbol|Function|Vector|Matrix|Union|Type|Any|Complex|String|Ptr|Void|Exception|Task|Signed|Unsigned|Associative|Dict|IO|IOStream|Rational|Regex|RegexMatch|Set|IntSet|Expr|WeakRef|ObjectIdDict|AbstractRNG|MersenneTwister)\b 0:type add-highlighter shared/julia/code regex \b(Number|Real|BigInt|Integer|UInt|UInt8|UInt16|UInt32|UInt64|UInt128|Int|Int8|Int16|Int32|Int64|Int128|BigFloat|FloatingPoint|Float16|Float32|Float64|Complex128|Complex64|Bool|Cuchar|Cshort|Cushort|Cint|Cuint|Clonglong|Culonglong|Cintmax_t|Cuintmax_t|Cfloat|Cdouble|Cptrdiff_t|Cssize_t|Csize_t|Cchar|Clong|Culong|Cwchar_t|Char|ASCIIString|UTF8String|ByteString|SubString|Array|DArray|AbstractArray|AbstractVector|AbstractMatrix|AbstractSparseMatrix|SubArray|StridedArray|StridedVector|StridedMatrix|VecOrMat|StridedVecOrMat|DenseArray|SparseMatrixCSC|BitArray|Range|OrdinalRange|StepRange|UnitRange|FloatRange|Tuple|NTuple|Vararg|DataType|Symbol|Function|Vector|Matrix|Union|Type|Any|Complex|String|Ptr|Void|Exception|Task|Signed|Unsigned|Associative|Dict|IO|IOStream|Rational|Regex|RegexMatch|Set|IntSet|Expr|WeakRef|ObjectIdDict|AbstractRNG|MersenneTwister)\b 0:type
# Initialization # Initialization
# ‾‾‾‾‾‾‾‾‾‾‾‾‾‾ # ‾‾‾‾‾‾‾‾‾‾‾‾‾‾
hook -group julia-highlight global WinSetOption filetype=julia %{ add-highlighter ref julia } hook -group julia-highlight global WinSetOption filetype=julia %{ add-highlighter window ref julia }
hook -group julia-highlight global WinSetOption filetype=(?!julia).* %{ remove-highlighter julia } hook -group julia-highlight global WinSetOption filetype=(?!julia).* %{ remove-highlighter window/julia }

View File

@ -72,12 +72,12 @@ def -hidden lint-show %{
} } } }
def lint-enable -docstring "Activate automatic diagnostics of the code" %{ def lint-enable -docstring "Activate automatic diagnostics of the code" %{
add-highlighter flag_lines default lint_flags add-highlighter window flag_lines default lint_flags
hook window -group lint-diagnostics NormalIdle .* %{ lint-show } hook window -group lint-diagnostics NormalIdle .* %{ lint-show }
} }
def lint-disable -docstring "Disable automatic diagnostics of the code" %{ def lint-disable -docstring "Disable automatic diagnostics of the code" %{
remove-highlighter hlflags_lint_flags remove-highlighter window/hlflags_lint_flags
remove-hooks window lint-diagnostics remove-hooks window lint-diagnostics
} }

View File

@ -11,17 +11,17 @@ hook global BufCreate .*[.](lisp) %{
# Highlighters # Highlighters
# ‾‾‾‾‾‾‾‾‾‾‾‾ # ‾‾‾‾‾‾‾‾‾‾‾‾
add-highlighter -group / regions -default code lisp \ add-highlighter shared/ regions -default code lisp \
string '"' (?<!\\)(\\\\)*" '' \ string '"' (?<!\\)(\\\\)*" '' \
comment ';' '$' '' comment ';' '$' ''
add-highlighter -group /lisp/string fill string add-highlighter shared/lisp/string fill string
add-highlighter -group /lisp/comment fill comment add-highlighter shared/lisp/comment fill comment
add-highlighter -group /lisp/code regex \b(nil|true|false)\b 0:value add-highlighter shared/lisp/code regex \b(nil|true|false)\b 0:value
add-highlighter -group /lisp/code regex (((\Q***\E)|(///)|(\Q+++\E)){1,3})|(1[+-])|(<|>|<=|=|>=) 0:operator add-highlighter shared/lisp/code regex (((\Q***\E)|(///)|(\Q+++\E)){1,3})|(1[+-])|(<|>|<=|=|>=) 0:operator
add-highlighter -group /lisp/code regex \b(([':]\w+)|([*]\H+[*]))\b 0:variable add-highlighter shared/lisp/code regex \b(([':]\w+)|([*]\H+[*]))\b 0:variable
add-highlighter -group /lisp/code regex \b(def[a-z]+|if|do|let|lambda|catch|and|assert|while|def|do|fn|finally|let|loop|new|quote|recur|set!|throw|try|var|case|if-let|if-not|when|when-first|when-let|when-not|(cond(->|->>)?))\b 0:keyword add-highlighter shared/lisp/code regex \b(def[a-z]+|if|do|let|lambda|catch|and|assert|while|def|do|fn|finally|let|loop|new|quote|recur|set!|throw|try|var|case|if-let|if-not|when|when-first|when-let|when-not|(cond(->|->>)?))\b 0:keyword
# Commands # Commands
# ‾‾‾‾‾‾‾‾ # ‾‾‾‾‾‾‾‾
@ -43,14 +43,14 @@ def -hidden lisp-indent-on-new-line %{
# Initialization # Initialization
# ‾‾‾‾‾‾‾‾‾‾‾‾‾‾ # ‾‾‾‾‾‾‾‾‾‾‾‾‾‾
hook -group lisp-highlight global WinSetOption filetype=lisp %{ add-highlighter ref lisp } hook -group lisp-highlight global WinSetOption filetype=lisp %{ add-highlighter window ref lisp }
hook global WinSetOption filetype=lisp %{ hook global WinSetOption filetype=lisp %{
hook window InsertEnd .* -group lisp-hooks lisp-filter-around-selections hook window InsertEnd .* -group lisp-hooks lisp-filter-around-selections
hook window InsertChar \n -group lisp-indent lisp-indent-on-new-line hook window InsertChar \n -group lisp-indent lisp-indent-on-new-line
} }
hook -group lisp-highlight global WinSetOption filetype=(?!lisp).* %{ remove-highlighter lisp } hook -group lisp-highlight global WinSetOption filetype=(?!lisp).* %{ remove-highlighter window/lisp }
hook global WinSetOption filetype=(?!lisp).* %{ hook global WinSetOption filetype=(?!lisp).* %{
remove-hooks window lisp-indent remove-hooks window lisp-indent

View File

@ -11,17 +11,17 @@ hook global BufCreate .*[.](lua) %{
# Highlighters # Highlighters
# ‾‾‾‾‾‾‾‾‾‾‾‾ # ‾‾‾‾‾‾‾‾‾‾‾‾
add-highlighter -group / regions -default code lua \ add-highlighter shared/ regions -default code lua \
string '"' (?<!\\)(\\\\)*" '' \ string '"' (?<!\\)(\\\\)*" '' \
string "'" (?<!\\)(\\\\)*' '' \ string "'" (?<!\\)(\\\\)*' '' \
comment '--' '$' '' \ comment '--' '$' '' \
comment '--\[\[' '\]\]' '' \ comment '--\[\[' '\]\]' '' \
add-highlighter -group /lua/string fill string add-highlighter shared/lua/string fill string
add-highlighter -group /lua/comment fill comment add-highlighter shared/lua/comment fill comment
add-highlighter -group /lua/code regex \b(and|break|do|else|elseif|end|false|for|function|goto|if|in|local|nil|not|or|repeat|return|then|true|until|while)\b 0:keyword add-highlighter shared/lua/code regex \b(and|break|do|else|elseif|end|false|for|function|goto|if|in|local|nil|not|or|repeat|return|then|true|until|while)\b 0:keyword
# Commands # Commands
# ‾‾‾‾‾‾‾‾ # ‾‾‾‾‾‾‾‾
@ -92,7 +92,7 @@ def -hidden lua-insert-on-new-line %{
# Initialization # Initialization
# ‾‾‾‾‾‾‾‾‾‾‾‾‾‾ # ‾‾‾‾‾‾‾‾‾‾‾‾‾‾
hook -group lua-highlight global WinSetOption filetype=lua %{ add-highlighter ref lua } hook -group lua-highlight global WinSetOption filetype=lua %{ add-highlighter window ref lua }
hook global WinSetOption filetype=lua %{ hook global WinSetOption filetype=lua %{
hook window InsertChar .* -group lua-indent lua-indent-on-char hook window InsertChar .* -group lua-indent lua-indent-on-char
@ -102,7 +102,7 @@ hook global WinSetOption filetype=lua %{
alias window alt lua-alternative-file alias window alt lua-alternative-file
} }
hook -group lua-highlight global WinSetOption filetype=(?!lua).* %{ remove-highlighter lua } hook -group lua-highlight global WinSetOption filetype=(?!lua).* %{ remove-highlighter window/lua }
hook global WinSetOption filetype=(?!lua).* %{ hook global WinSetOption filetype=(?!lua).* %{
remove-hooks window lua-indent remove-hooks window lua-indent

View File

@ -2,10 +2,10 @@ hook global BufCreate .+\.eml %{
set buffer filetype mail set buffer filetype mail
} }
add-highlighter -group / group mail add-highlighter shared/ group mail
add-highlighter -group /mail regex ^(From|To|Cc|Bcc|Subject|Reply-To|In-Reply-To):([^\n]*(?:\n\h+[^\n]+)*)$ 1:keyword 2:attribute add-highlighter shared/mail regex ^(From|To|Cc|Bcc|Subject|Reply-To|In-Reply-To):([^\n]*(?:\n\h+[^\n]+)*)$ 1:keyword 2:attribute
add-highlighter -group /mail regex <[^@>]+@.*?> 0:string add-highlighter shared/mail regex <[^@>]+@.*?> 0:string
add-highlighter -group /mail regex ^>.*?$ 0:comment add-highlighter shared/mail regex ^>.*?$ 0:comment
hook -group mail-highlight global WinSetOption filetype=mail %{ add-highlighter ref mail } hook -group mail-highlight global WinSetOption filetype=mail %{ add-highlighter window ref mail }
hook -group mail-highlight global WinSetOption filetype=(?!mail).* %{ remove-highlighter mail } hook -group mail-highlight global WinSetOption filetype=(?!mail).* %{ remove-highlighter window/mail }

View File

@ -11,7 +11,7 @@ hook global BufCreate .*[.](markdown|md|mkd) %{
# Highlighters # Highlighters
# ‾‾‾‾‾‾‾‾‾‾‾‾ # ‾‾‾‾‾‾‾‾‾‾‾‾
add-highlighter -group / regions -default content markdown \ add-highlighter shared/ regions -default content markdown \
c ```\h*c ``` '' \ c ```\h*c ``` '' \
cabal ```\h*cabal ``` '' \ cabal ```\h*cabal ``` '' \
clojure ```\h*clojure ``` '' \ clojure ```\h*clojure ``` '' \
@ -58,67 +58,67 @@ add-highlighter -group / regions -default content markdown \
code `` `` '' \ code `` `` '' \
code ` ` '' code ` ` ''
add-highlighter -group /markdown/code fill meta add-highlighter shared/markdown/code fill meta
add-highlighter -group /markdown/c ref c add-highlighter shared/markdown/c ref c
add-highlighter -group /markdown/cabal ref cabal add-highlighter shared/markdown/cabal ref cabal
add-highlighter -group /markdown/clojure ref clojure add-highlighter shared/markdown/clojure ref clojure
add-highlighter -group /markdown/coffee ref coffee add-highlighter shared/markdown/coffee ref coffee
add-highlighter -group /markdown/cpp ref cpp add-highlighter shared/markdown/cpp ref cpp
add-highlighter -group /markdown/css ref css add-highlighter shared/markdown/css ref css
add-highlighter -group /markdown/cucumber ref cucumber add-highlighter shared/markdown/cucumber ref cucumber
add-highlighter -group /markdown/d ref d add-highlighter shared/markdown/d ref d
add-highlighter -group /markdown/diff ref diff add-highlighter shared/markdown/diff ref diff
add-highlighter -group /markdown/dockerfile ref dockerfile add-highlighter shared/markdown/dockerfile ref dockerfile
add-highlighter -group /markdown/fish ref fish add-highlighter shared/markdown/fish ref fish
add-highlighter -group /markdown/gas ref gas add-highlighter shared/markdown/gas ref gas
add-highlighter -group /markdown/go ref go add-highlighter shared/markdown/go ref go
add-highlighter -group /markdown/haml ref haml add-highlighter shared/markdown/haml ref haml
add-highlighter -group /markdown/haskell ref haskell add-highlighter shared/markdown/haskell ref haskell
add-highlighter -group /markdown/html ref html add-highlighter shared/markdown/html ref html
add-highlighter -group /markdown/ini ref ini add-highlighter shared/markdown/ini ref ini
add-highlighter -group /markdown/java ref java add-highlighter shared/markdown/java ref java
add-highlighter -group /markdown/javascript ref javascript add-highlighter shared/markdown/javascript ref javascript
add-highlighter -group /markdown/json ref json add-highlighter shared/markdown/json ref json
add-highlighter -group /markdown/julia ref julia add-highlighter shared/markdown/julia ref julia
add-highlighter -group /markdown/kak ref kakrc add-highlighter shared/markdown/kak ref kakrc
add-highlighter -group /markdown/kickstart ref kickstart add-highlighter shared/markdown/kickstart ref kickstart
add-highlighter -group /markdown/latex ref latex add-highlighter shared/markdown/latex ref latex
add-highlighter -group /markdown/lisp ref lisp add-highlighter shared/markdown/lisp ref lisp
add-highlighter -group /markdown/lua ref lua add-highlighter shared/markdown/lua ref lua
add-highlighter -group /markdown/makefile ref makefile add-highlighter shared/markdown/makefile ref makefile
add-highlighter -group /markdown/moon ref moon add-highlighter shared/markdown/moon ref moon
add-highlighter -group /markdown/objc ref objc add-highlighter shared/markdown/objc ref objc
add-highlighter -group /markdown/perl ref perl add-highlighter shared/markdown/perl ref perl
add-highlighter -group /markdown/pug ref pug add-highlighter shared/markdown/pug ref pug
add-highlighter -group /markdown/python ref python add-highlighter shared/markdown/python ref python
add-highlighter -group /markdown/ragel ref ragel add-highlighter shared/markdown/ragel ref ragel
add-highlighter -group /markdown/ruby ref ruby add-highlighter shared/markdown/ruby ref ruby
add-highlighter -group /markdown/rust ref rust add-highlighter shared/markdown/rust ref rust
add-highlighter -group /markdown/sass ref sass add-highlighter shared/markdown/sass ref sass
add-highlighter -group /markdown/scala ref scala add-highlighter shared/markdown/scala ref scala
add-highlighter -group /markdown/scss ref scss add-highlighter shared/markdown/scss ref scss
add-highlighter -group /markdown/sh ref sh add-highlighter shared/markdown/sh ref sh
add-highlighter -group /markdown/swift ref swift add-highlighter shared/markdown/swift ref swift
add-highlighter -group /markdown/tupfile ref tupfile add-highlighter shared/markdown/tupfile ref tupfile
add-highlighter -group /markdown/yaml ref yaml add-highlighter shared/markdown/yaml ref yaml
# Setext-style header # Setext-style header
add-highlighter -group /markdown/content regex (\A|\n\n)[^\n]+\n={2,}\h*\n\h*$ 0:title add-highlighter shared/markdown/content regex (\A|\n\n)[^\n]+\n={2,}\h*\n\h*$ 0:title
add-highlighter -group /markdown/content regex (\A|\n\n)[^\n]+\n-{2,}\h*\n\h*$ 0:header add-highlighter shared/markdown/content regex (\A|\n\n)[^\n]+\n-{2,}\h*\n\h*$ 0:header
# Atx-style header # Atx-style header
add-highlighter -group /markdown/content regex ^(#+)(\h+)([^\n]+) 1:header add-highlighter shared/markdown/content regex ^(#+)(\h+)([^\n]+) 1:header
add-highlighter -group /markdown/content regex ^\h?((?:[\s\t]+)?[-\*])\h+[^\n]*(\n\h+[^-\*]\S+[^\n]*\n)*$ 0:list 1:bullet add-highlighter shared/markdown/content regex ^\h?((?:[\s\t]+)?[-\*])\h+[^\n]*(\n\h+[^-\*]\S+[^\n]*\n)*$ 0:list 1:bullet
add-highlighter -group /markdown/content regex \B\+[^\n]+?\+\B 0:mono add-highlighter shared/markdown/content regex \B\+[^\n]+?\+\B 0:mono
add-highlighter -group /markdown/content regex \B\*[^\n]+?\*\B 0:italic add-highlighter shared/markdown/content regex \B\*[^\n]+?\*\B 0:italic
add-highlighter -group /markdown/content regex \b_[^\n]+?_\b 0:italic add-highlighter shared/markdown/content regex \b_[^\n]+?_\b 0:italic
add-highlighter -group /markdown/content regex \B\*\*[^\n]+?\*\*\B 0:bold add-highlighter shared/markdown/content regex \B\*\*[^\n]+?\*\*\B 0:bold
add-highlighter -group /markdown/content regex \B__[^\n]+?__\B 0:bold add-highlighter shared/markdown/content regex \B__[^\n]+?__\B 0:bold
add-highlighter -group /markdown/content regex <(([a-z]+://.*?)|((mailto:)?[\w+-]+@[a-z]+[.][a-z]+))> 0:link add-highlighter shared/markdown/content regex <(([a-z]+://.*?)|((mailto:)?[\w+-]+@[a-z]+[.][a-z]+))> 0:link
add-highlighter -group /markdown/content regex ^\h*(>\h*)+ 0:comment add-highlighter shared/markdown/content regex ^\h*(>\h*)+ 0:comment
add-highlighter -group /markdown/content regex \H\K\h\h$ 0:PrimarySelection add-highlighter shared/markdown/content regex \H\K\h\h$ 0:PrimarySelection
# Commands # Commands
# ‾‾‾‾‾‾‾‾ # ‾‾‾‾‾‾‾‾
@ -137,13 +137,13 @@ def -hidden markdown-indent-on-new-line %{
# Initialization # Initialization
# ‾‾‾‾‾‾‾‾‾‾‾‾‾‾ # ‾‾‾‾‾‾‾‾‾‾‾‾‾‾
hook -group markdown-highlight global WinSetOption filetype=markdown %{ add-highlighter ref markdown } hook -group markdown-highlight global WinSetOption filetype=markdown %{ add-highlighter window ref markdown }
hook global WinSetOption filetype=markdown %{ hook global WinSetOption filetype=markdown %{
hook window InsertChar \n -group markdown-indent markdown-indent-on-new-line hook window InsertChar \n -group markdown-indent markdown-indent-on-new-line
} }
hook -group markdown-highlight global WinSetOption filetype=(?!markdown).* %{ remove-highlighter markdown } hook -group markdown-highlight global WinSetOption filetype=(?!markdown).* %{ remove-highlighter window/markdown }
hook global WinSetOption filetype=(?!markdown).* %{ hook global WinSetOption filetype=(?!markdown).* %{
remove-hooks window markdown-indent remove-hooks window markdown-indent

View File

@ -14,13 +14,13 @@ hook global BufCreate .*hg-editor-\w+\.txt$ %{
} }
hook -group hg-commit-highlight global WinSetOption filetype=(?!hg-commit).* %{ hook -group hg-commit-highlight global WinSetOption filetype=(?!hg-commit).* %{
remove-highlighter hg-commit-highlight remove-highlighter window/hg-commit-highlight
} }
# Highlighters # Highlighters
# ‾‾‾‾‾‾‾‾‾‾‾‾ # ‾‾‾‾‾‾‾‾‾‾‾‾
hook -group hg-commit-highlight global WinSetOption filetype=hg-commit %{ hook -group hg-commit-highlight global WinSetOption filetype=hg-commit %{
add-highlighter group hg-commit-highlight add-highlighter window group hg-commit-highlight
add-highlighter -group hg-commit-highlight regex '^HG:[^\n]*' 0:MercurialCommitComment add-highlighter window/hg-commit-highlight regex '^HG:[^\n]*' 0:MercurialCommitComment
} }

View File

@ -13,12 +13,12 @@ hook global BufCreate .*\.mli? %{
# Highlighters # Highlighters
# ‾‾‾‾‾‾‾‾‾‾‾‾ # ‾‾‾‾‾‾‾‾‾‾‾‾
add-highlighter -group / regions -default code ocaml \ add-highlighter shared/ regions -default code ocaml \
string '"' (?<!\\)(\\\\)*" '' \ string '"' (?<!\\)(\\\\)*" '' \
comment \Q(* \Q*) '' \ comment \Q(* \Q*) '' \
add-highlighter -group /ocaml/string fill string add-highlighter shared/ocaml/string fill string
add-highlighter -group /ocaml/comment fill comment add-highlighter shared/ocaml/comment fill comment
# Commands # Commands
# ‾‾‾‾‾‾‾‾ # ‾‾‾‾‾‾‾‾
@ -32,13 +32,13 @@ def -hidden ocaml-indent-on-char %{
# Initialization # Initialization
# ‾‾‾‾‾‾‾‾‾‾‾‾‾‾ # ‾‾‾‾‾‾‾‾‾‾‾‾‾‾
hook -group ocaml-highlight global WinSetOption filetype=ocaml %{ add-highlighter ref ocaml } hook -group ocaml-highlight global WinSetOption filetype=ocaml %{ add-highlighter window ref ocaml }
hook global WinSetOption filetype=ocaml %{ hook global WinSetOption filetype=ocaml %{
hook window InsertChar [|\n] -group ocaml-indent ocaml-indent-on-char hook window InsertChar [|\n] -group ocaml-indent ocaml-indent-on-char
} }
hook -group ocaml-highlight global WinSetOption filetype=(?!ocaml).* %{ remove-highlighter ocaml } hook -group ocaml-highlight global WinSetOption filetype=(?!ocaml).* %{ remove-highlighter window/ocaml }
hook global WinSetOption filetype=(?!ocaml).* %{ hook global WinSetOption filetype=(?!ocaml).* %{
remove-hooks window ocaml-indent remove-hooks window ocaml-indent
@ -50,7 +50,7 @@ hook global WinSetOption filetype=(?!ocaml).* %{
%sh{ %sh{
keywords=and:as:asr:assert:begin:class:constraint:do:done:downto:else:end:exception:external:false:for:fun:function:functor:if:in:include:inherit:initializer:land:lazy:let:lor:lsl:lsr:lxor:match:method:mod:module:mutable:new:nonrec:object:of:open:or:private:rec:sig:struct:then:to:true:try:type:val:virtual:when:while:with keywords=and:as:asr:assert:begin:class:constraint:do:done:downto:else:end:exception:external:false:for:fun:function:functor:if:in:include:inherit:initializer:land:lazy:let:lor:lsl:lsr:lxor:match:method:mod:module:mutable:new:nonrec:object:of:open:or:private:rec:sig:struct:then:to:true:try:type:val:virtual:when:while:with
echo " echo "
add-highlighter -group /ocaml/code regex \b($(printf $keywords | tr : '|'))\b 0:keyword add-highlighter shared/ocaml/code regex \b($(printf $keywords | tr : '|'))\b 0:keyword
hook global WinSetOption filetype=ocaml %{ hook global WinSetOption filetype=ocaml %{
set window static_words $keywords set window static_words $keywords
} }

View File

@ -11,16 +11,16 @@ hook global BufCreate .*\.p[lm] %{
# Highlighters # Highlighters
# ‾‾‾‾‾‾‾‾‾‾‾‾ # ‾‾‾‾‾‾‾‾‾‾‾‾
add-highlighter -group / regions -default code perl \ add-highlighter shared/ regions -default code perl \
command '(?<!\$)(?<!\\)`' (?<!\\)(\\\\)*` '' \ command '(?<!\$)(?<!\\)`' (?<!\\)(\\\\)*` '' \
double_string '(?<!\$)(?<!\\)"' (?<!\\)(\\\\)*" '' \ double_string '(?<!\$)(?<!\\)"' (?<!\\)(\\\\)*" '' \
single_string "(?<!\\$)(?<!\\\\)'" (?<!\\)(\\\\)*' '' \ single_string "(?<!\\$)(?<!\\\\)'" (?<!\\)(\\\\)*' '' \
comment '(?<!\$)(?<!\\)#' $ '' comment '(?<!\$)(?<!\\)#' $ ''
add-highlighter -group /perl/command fill magenta add-highlighter shared/perl/command fill magenta
add-highlighter -group /perl/double_string fill string add-highlighter shared/perl/double_string fill string
add-highlighter -group /perl/single_string fill string add-highlighter shared/perl/single_string fill string
add-highlighter -group /perl/comment fill comment add-highlighter shared/perl/comment fill comment
%sh{ %sh{
# Grammar # Grammar
@ -46,26 +46,26 @@ add-highlighter -group /perl/comment fill comment
# Highlight keywords # Highlight keywords
printf %s " printf %s "
add-highlighter -group /perl/code regex \b(${keywords})\b 0:keyword add-highlighter shared/perl/code regex \b(${keywords})\b 0:keyword
add-highlighter -group /perl/code regex \b(${attributes})\b 0:attribute add-highlighter shared/perl/code regex \b(${attributes})\b 0:attribute
add-highlighter -group /perl/code regex \b(${values})\b 0:value add-highlighter shared/perl/code regex \b(${values})\b 0:value
" "
} }
add-highlighter -group /perl/code regex (?!\$)-?([0-9]*\.(?!0[xXbB]))?\b([0-9]+|0[xX][0-9a-fA-F]+|0[bb][01_]+)\.?([eE][+-]?[0-9]+)?i?\b 0:value add-highlighter shared/perl/code regex (?!\$)-?([0-9]*\.(?!0[xXbB]))?\b([0-9]+|0[xX][0-9a-fA-F]+|0[bb][01_]+)\.?([eE][+-]?[0-9]+)?i?\b 0:value
add-highlighter -group /perl/code regex %{\$!|\$"|\$#|\$\$|\$%|\$&|\$'|\$\(|\$\)|\$\*|\$\+|\$,|\$_|\$-|\$`|\$\.|\$/|\$:|\$;|\$<|\$=|\$>|\$\?|\$@|\$\[|\$\\|\$\]|\$\^|\$\||\$~|%!|@\+|@-|@_} 0:value add-highlighter shared/perl/code regex %{\$!|\$"|\$#|\$\$|\$%|\$&|\$'|\$\(|\$\)|\$\*|\$\+|\$,|\$_|\$-|\$`|\$\.|\$/|\$:|\$;|\$<|\$=|\$>|\$\?|\$@|\$\[|\$\\|\$\]|\$\^|\$\||\$~|%!|@\+|@-|@_} 0:value
add-highlighter -group /perl/code regex (%ENV|%INC|%OVERLOAD|%SIG|@ARGV|@INC|@LAST_MATCH_START) 0:value add-highlighter shared/perl/code regex (%ENV|%INC|%OVERLOAD|%SIG|@ARGV|@INC|@LAST_MATCH_START) 0:value
add-highlighter -group /perl/code regex %{%\^(H)\b} 0:value add-highlighter shared/perl/code regex %{%\^(H)\b} 0:value
add-highlighter -group /perl/code regex \$\^(S|T|V|W|X|A|C|D|E|F|H|I|L|M|N|O|P|R)\b 0:value add-highlighter shared/perl/code regex \$\^(S|T|V|W|X|A|C|D|E|F|H|I|L|M|N|O|P|R)\b 0:value
add-highlighter -group /perl/code regex \$\^(RE_TRIE_MAXBUF|TAINT|UNICODE|UTF8LOCALE|WARNING_BITS|WIDE_SYSTEM_CALLS|CHILD_ERROR_NATIVE|ENCODING|OPEN|RE_DEBUG_FLAGS)\b 0:value add-highlighter shared/perl/code regex \$\^(RE_TRIE_MAXBUF|TAINT|UNICODE|UTF8LOCALE|WARNING_BITS|WIDE_SYSTEM_CALLS|CHILD_ERROR_NATIVE|ENCODING|OPEN|RE_DEBUG_FLAGS)\b 0:value
add-highlighter -group /perl/code regex \$[0-9]+ 0:attribute add-highlighter shared/perl/code regex \$[0-9]+ 0:attribute
add-highlighter -group /perl/code regex \b-(B|b|C|c|d|e|f|g|k|l|M|O|o|p|r|R|S|s|T|t|u|w|W|X|x|z)\b 0:attribute add-highlighter shared/perl/code regex \b-(B|b|C|c|d|e|f|g|k|l|M|O|o|p|r|R|S|s|T|t|u|w|W|X|x|z)\b 0:attribute
add-highlighter -group /perl/code regex \$[a-zA-Z_][a-zA-Z0-9_]* 0:variable add-highlighter shared/perl/code regex \$[a-zA-Z_][a-zA-Z0-9_]* 0:variable
add-highlighter -group /perl/code regex \$(a|b|LAST_REGEXP_CODE_RESULT|LIST_SEPARATOR|MATCH|MULTILINE_MATCHING|NR|OFMT|OFS|ORS|OS_ERROR|OSNAME|OUTPUT_AUTO_FLUSH|OUTPUT_FIELD_SEPARATOR|OUTPUT_RECORD_SEPARATOR)\b 0:value add-highlighter shared/perl/code regex \$(a|b|LAST_REGEXP_CODE_RESULT|LIST_SEPARATOR|MATCH|MULTILINE_MATCHING|NR|OFMT|OFS|ORS|OS_ERROR|OSNAME|OUTPUT_AUTO_FLUSH|OUTPUT_FIELD_SEPARATOR|OUTPUT_RECORD_SEPARATOR)\b 0:value
add-highlighter -group /perl/code regex \$(LAST_REGEXP_CODE_RESULT|LIST_SEPARATOR|MATCH|MULTILINE_MATCHING|NR|OFMT|OFS|ORS|OS_ERROR|OSNAME|OUTPUT_AUTO_FLUSH|OUTPUT_FIELD_SEPARATOR|OUTPUT_RECORD_SEPARATOR|PERL_VERSION|ACCUMULATOR|PERLDB|ARG|PID|ARGV|POSTMATCH|PREMATCH|BASETIME|PROCESS_ID|CHILD_ERROR|PROGRAM_NAME|COMPILING|REAL_GROUP_ID|DEBUGGING|REAL_USER_ID|EFFECTIVE_GROUP_ID|RS|EFFECTIVE_USER_ID|SUBSCRIPT_SEPARATOR|EGID|SUBSEP|ERRNO|SYSTEM_FD_MAX|EUID|UID|EVAL_ERROR|WARNING|EXCEPTIONS_BEING_CAUGHT|EXECUTABLE_NAME|EXTENDED_OS_ERROR|FORMAT_FORMFEED|FORMAT_LINE_BREAK_CHARACTERS|FORMAT_LINES_LEFT|FORMAT_LINES_PER_PAGE|FORMAT_NAME|FORMAT_PAGE_NUMBER|FORMAT_TOP_NAME|GID|INPLACE_EDIT|INPUT_LINE_NUMBER|INPUT_RECORD_SEPARATOR|LAST_MATCH_END|LAST_PAREN_MATCH)\b 0:value add-highlighter shared/perl/code regex \$(LAST_REGEXP_CODE_RESULT|LIST_SEPARATOR|MATCH|MULTILINE_MATCHING|NR|OFMT|OFS|ORS|OS_ERROR|OSNAME|OUTPUT_AUTO_FLUSH|OUTPUT_FIELD_SEPARATOR|OUTPUT_RECORD_SEPARATOR|PERL_VERSION|ACCUMULATOR|PERLDB|ARG|PID|ARGV|POSTMATCH|PREMATCH|BASETIME|PROCESS_ID|CHILD_ERROR|PROGRAM_NAME|COMPILING|REAL_GROUP_ID|DEBUGGING|REAL_USER_ID|EFFECTIVE_GROUP_ID|RS|EFFECTIVE_USER_ID|SUBSCRIPT_SEPARATOR|EGID|SUBSEP|ERRNO|SYSTEM_FD_MAX|EUID|UID|EVAL_ERROR|WARNING|EXCEPTIONS_BEING_CAUGHT|EXECUTABLE_NAME|EXTENDED_OS_ERROR|FORMAT_FORMFEED|FORMAT_LINE_BREAK_CHARACTERS|FORMAT_LINES_LEFT|FORMAT_LINES_PER_PAGE|FORMAT_NAME|FORMAT_PAGE_NUMBER|FORMAT_TOP_NAME|GID|INPLACE_EDIT|INPUT_LINE_NUMBER|INPUT_RECORD_SEPARATOR|LAST_MATCH_END|LAST_PAREN_MATCH)\b 0:value
# Commands # Commands
# ‾‾‾‾‾‾‾‾ # ‾‾‾‾‾‾‾‾
@ -102,7 +102,7 @@ def -hidden perl-indent-on-closing-curly-brace %[
# Initialization # Initialization
# ‾‾‾‾‾‾‾‾‾‾‾‾‾‾ # ‾‾‾‾‾‾‾‾‾‾‾‾‾‾
hook -group perl-highlight global WinSetOption filetype=perl %{ add-highlighter ref perl } hook -group perl-highlight global WinSetOption filetype=perl %{ add-highlighter window ref perl }
hook global WinSetOption filetype=perl %{ hook global WinSetOption filetype=perl %{
# cleanup trailing whitespaces when exiting insert mode # cleanup trailing whitespaces when exiting insert mode
@ -112,7 +112,7 @@ hook global WinSetOption filetype=perl %{
hook window InsertChar \} -group perl-indent perl-indent-on-closing-curly-brace hook window InsertChar \} -group perl-indent perl-indent-on-closing-curly-brace
} }
hook -group perl-highlight global WinSetOption filetype=(?!perl).* %{ remove-highlighter perl } hook -group perl-highlight global WinSetOption filetype=(?!perl).* %{ remove-highlighter window/perl }
hook global WinSetOption filetype=(?!perl).* %{ hook global WinSetOption filetype=(?!perl).* %{
remove-hooks window perl-hooks remove-hooks window perl-hooks

View File

@ -11,7 +11,7 @@ hook global BufCreate .*(([.](rb))|(irbrc)|(pryrc)|(Capfile|[.]cap)|(Gemfile)|(G
# Highlighters # Highlighters
# ‾‾‾‾‾‾‾‾‾‾‾‾ # ‾‾‾‾‾‾‾‾‾‾‾‾
add-highlighter -group / regions -default code ruby \ add-highlighter shared/ regions -default code ruby \
double_string '"' (?<!\\)(\\\\)*" '' \ double_string '"' (?<!\\)(\\\\)*" '' \
single_string "'" (?<!\\)(\\\\)*' '' \ single_string "'" (?<!\\)(\\\\)*' '' \
backtick '`' (?<!\\)(\\\\)*` '' \ backtick '`' (?<!\\)(\\\\)*` '' \
@ -27,25 +27,25 @@ add-highlighter -group / regions -default code ruby \
# Regular expression flags are: i → ignore case, m → multi-lines, o → only interpolate #{} blocks once, x → extended mode (ignore white spaces) # Regular expression flags are: i → ignore case, m → multi-lines, o → only interpolate #{} blocks once, x → extended mode (ignore white spaces)
# Literals are: i → array of symbols, q → string, r → regular expression, s → symbol, w → array of words, x → capture shell result # Literals are: i → array of symbols, q → string, r → regular expression, s → symbol, w → array of words, x → capture shell result
add-highlighter -group /ruby/double_string fill string add-highlighter shared/ruby/double_string fill string
add-highlighter -group /ruby/double_string regions regions interpolation \Q#{ \} \{ add-highlighter shared/ruby/double_string regions regions interpolation \Q#{ \} \{
add-highlighter -group /ruby/double_string/regions/interpolation fill meta add-highlighter shared/ruby/double_string/regions/interpolation fill meta
add-highlighter -group /ruby/single_string fill string add-highlighter shared/ruby/single_string fill string
add-highlighter -group /ruby/backtick fill meta add-highlighter shared/ruby/backtick fill meta
add-highlighter -group /ruby/backtick regions regions interpolation \Q#{ \} \{ add-highlighter shared/ruby/backtick regions regions interpolation \Q#{ \} \{
add-highlighter -group /ruby/backtick/regions/interpolation fill meta add-highlighter shared/ruby/backtick/regions/interpolation fill meta
add-highlighter -group /ruby/regex fill meta add-highlighter shared/ruby/regex fill meta
add-highlighter -group /ruby/regex regions regions interpolation \Q#{ \} \{ add-highlighter shared/ruby/regex regions regions interpolation \Q#{ \} \{
add-highlighter -group /ruby/regex/regions/interpolation fill meta add-highlighter shared/ruby/regex/regions/interpolation fill meta
add-highlighter -group /ruby/comment fill comment add-highlighter shared/ruby/comment fill comment
add-highlighter -group /ruby/literal fill meta add-highlighter shared/ruby/literal fill meta
add-highlighter -group /ruby/code regex \b([A-Za-z]\w*:(?!:))|([$@][A-Za-z]\w*)|((?<!:):(([A-Za-z]\w*[=?!]?)|(\[\]=?)))|([A-Z]\w*|^|\h)\K::(?=[A-Z]) 0:variable add-highlighter shared/ruby/code regex \b([A-Za-z]\w*:(?!:))|([$@][A-Za-z]\w*)|((?<!:):(([A-Za-z]\w*[=?!]?)|(\[\]=?)))|([A-Z]\w*|^|\h)\K::(?=[A-Z]) 0:variable
%sh{ %sh{
# Grammar # Grammar
@ -65,10 +65,10 @@ add-highlighter -group /ruby/code regex \b([A-Za-z]\w*:(?!:))|([$@][A-Za-z]\w*)|
# Highlight keywords # Highlight keywords
printf %s " printf %s "
add-highlighter -group /ruby/code regex \b(${keywords})\b 0:keyword add-highlighter shared/ruby/code regex \b(${keywords})\b 0:keyword
add-highlighter -group /ruby/code regex \b(${attributes})\b 0:attribute add-highlighter shared/ruby/code regex \b(${attributes})\b 0:attribute
add-highlighter -group /ruby/code regex \b(${values})\b 0:value add-highlighter shared/ruby/code regex \b(${values})\b 0:value
add-highlighter -group /ruby/code regex \b(${meta})\b 0:meta add-highlighter shared/ruby/code regex \b(${meta})\b 0:meta
" "
} }
@ -144,7 +144,7 @@ def -hidden ruby-insert-on-new-line %{
# Initialization # Initialization
# ‾‾‾‾‾‾‾‾‾‾‾‾‾‾ # ‾‾‾‾‾‾‾‾‾‾‾‾‾‾
hook -group ruby-highlight global WinSetOption filetype=ruby %{ add-highlighter ref ruby } hook -group ruby-highlight global WinSetOption filetype=ruby %{ add-highlighter window ref ruby }
hook global WinSetOption filetype=ruby %{ hook global WinSetOption filetype=ruby %{
hook window InsertChar .* -group ruby-indent ruby-indent-on-char hook window InsertChar .* -group ruby-indent ruby-indent-on-char
@ -154,7 +154,7 @@ hook global WinSetOption filetype=ruby %{
alias window alt ruby-alternative-file alias window alt ruby-alternative-file
} }
hook -group ruby-highlight global WinSetOption filetype=(?!ruby).* %{ remove-highlighter ruby } hook -group ruby-highlight global WinSetOption filetype=(?!ruby).* %{ remove-highlighter window/ruby }
hook global WinSetOption filetype=(?!ruby).* %{ hook global WinSetOption filetype=(?!ruby).* %{
remove-hooks window ruby-indent remove-hooks window ruby-indent

View File

@ -11,25 +11,25 @@ hook global BufCreate .*[.](rust|rs) %{
# Highlighters # Highlighters
# ‾‾‾‾‾‾‾‾‾‾‾‾ # ‾‾‾‾‾‾‾‾‾‾‾‾
add-highlighter -group / regions -default code rust \ add-highlighter shared/ regions -default code rust \
string %{(?<!')"} (?<!\\)(\\\\)*" '' \ string %{(?<!')"} (?<!\\)(\\\\)*" '' \
comment // $ '' \ comment // $ '' \
comment /\* \*/ /\* comment /\* \*/ /\*
add-highlighter -group /rust/string fill string add-highlighter shared/rust/string fill string
add-highlighter -group /rust/comment fill comment add-highlighter shared/rust/comment fill comment
add-highlighter -group /rust/code regex \b[A-z0-9_]+! 0:meta add-highlighter shared/rust/code regex \b[A-z0-9_]+! 0:meta
# the number literals syntax is defined here: # the number literals syntax is defined here:
# https://doc.rust-lang.org/reference.html#number-literals # https://doc.rust-lang.org/reference.html#number-literals
add-highlighter -group /rust/code regex \b(?:self|true|false|[0-9][_0-9]*(?:\.[0-9][_0-9]*|(?:\.[0-9][_0-9]*)?E[\+\-][_0-9]+)(?:f(?:32|64))?|(?:0x[_0-9a-fA-F]+|0o[_0-7]+|0b[_01]+|[0-9][_0-9]*)(?:(?:i|u)(?:8|16|32|64|size))?)\b 0:value add-highlighter shared/rust/code regex \b(?:self|true|false|[0-9][_0-9]*(?:\.[0-9][_0-9]*|(?:\.[0-9][_0-9]*)?E[\+\-][_0-9]+)(?:f(?:32|64))?|(?:0x[_0-9a-fA-F]+|0o[_0-7]+|0b[_01]+|[0-9][_0-9]*)(?:(?:i|u)(?:8|16|32|64|size))?)\b 0:value
add-highlighter -group /rust/code regex \b(?:&&|\|\|)\b 0:operator add-highlighter shared/rust/code regex \b(?:&&|\|\|)\b 0:operator
# the language keywords are defined here, but many of them are reserved and unused yet: # the language keywords are defined here, but many of them are reserved and unused yet:
# https://doc.rust-lang.org/grammar.html#keywords # https://doc.rust-lang.org/grammar.html#keywords
add-highlighter -group /rust/code regex \b(?:crate|use|extern)\b 0:meta add-highlighter shared/rust/code regex \b(?:crate|use|extern)\b 0:meta
add-highlighter -group /rust/code regex \b(?:let|as|fn|return|match|if|else|loop|for|in|while|break|continue|move|box|where|impl|pub|unsafe)\b 0:keyword add-highlighter shared/rust/code regex \b(?:let|as|fn|return|match|if|else|loop|for|in|while|break|continue|move|box|where|impl|pub|unsafe)\b 0:keyword
add-highlighter -group /rust/code regex \b(?:mod|trait|struct|enum|type|mut|ref|static|const)\b 0:attribute add-highlighter shared/rust/code regex \b(?:mod|trait|struct|enum|type|mut|ref|static|const)\b 0:attribute
add-highlighter -group /rust/code regex \b(?:u8|u16|u32|u64|usize|i8|i16|i32|i64|isize|f32|f64|bool|char|str|Self)\b 0:type add-highlighter shared/rust/code regex \b(?:u8|u16|u32|u64|usize|i8|i16|i32|i64|isize|f32|f64|bool|char|str|Self)\b 0:type
# Commands # Commands
# ‾‾‾‾‾‾‾‾ # ‾‾‾‾‾‾‾‾
@ -71,7 +71,7 @@ def -hidden rust-indent-on-closing-curly-brace %[
# Initialization # Initialization
# ‾‾‾‾‾‾‾‾‾‾‾‾‾‾ # ‾‾‾‾‾‾‾‾‾‾‾‾‾‾
hook -group rust-highlight global WinSetOption filetype=rust %{ add-highlighter ref rust } hook -group rust-highlight global WinSetOption filetype=rust %{ add-highlighter window ref rust }
hook global WinSetOption filetype=rust %[ hook global WinSetOption filetype=rust %[
hook window InsertEnd .* -group rust-hooks rust-filter-around-selections hook window InsertEnd .* -group rust-hooks rust-filter-around-selections
@ -80,7 +80,7 @@ hook global WinSetOption filetype=rust %[
hook window InsertChar \} -group rust-indent rust-indent-on-closing-curly-brace hook window InsertChar \} -group rust-indent rust-indent-on-closing-curly-brace
] ]
hook -group rust-highlight global WinSetOption filetype=(?!rust).* %{ remove-highlighter rust } hook -group rust-highlight global WinSetOption filetype=(?!rust).* %{ remove-highlighter window/rust }
hook global WinSetOption filetype=(?!rust).* %{ hook global WinSetOption filetype=(?!rust).* %{
remove-hooks window rust-indent remove-hooks window rust-indent

View File

@ -11,25 +11,25 @@ hook global BufCreate .*[.](scala) %{
# Highlighters # Highlighters
# ‾‾‾‾‾‾‾‾‾‾‾‾ # ‾‾‾‾‾‾‾‾‾‾‾‾
add-highlighter -group / regions -default code scala \ add-highlighter shared/ regions -default code scala \
string '"' (?<!\\)(\\\\)*" '' \ string '"' (?<!\\)(\\\\)*" '' \
literal ` ` '' \ literal ` ` '' \
comment // $ '' \ comment // $ '' \
comment /[*] [*]/ /[*] comment /[*] [*]/ /[*]
add-highlighter -group /scala/string fill string add-highlighter shared/scala/string fill string
add-highlighter -group /scala/literal fill variable add-highlighter shared/scala/literal fill variable
add-highlighter -group /scala/comment fill comment add-highlighter shared/scala/comment fill comment
# Keywords are collected at # Keywords are collected at
# http://tutorialspoint.com/scala/scala_basic_syntax.htm # http://tutorialspoint.com/scala/scala_basic_syntax.htm
add-highlighter -group /scala/code regex \b(import|package)\b 0:meta add-highlighter shared/scala/code regex \b(import|package)\b 0:meta
add-highlighter -group /scala/code regex \b(this|true|false|null)\b 0:value add-highlighter shared/scala/code regex \b(this|true|false|null)\b 0:value
add-highlighter -group /scala/code regex \b(become|case|catch|class|def|do|else|extends|final|finally|for|forSome|goto|if|initialize|macro|match|new|object|onTransition|return|startWith|stay|throw|trait|try|unbecome|using|val|var|when|while|with|yield)\b 0:keyword add-highlighter shared/scala/code regex \b(become|case|catch|class|def|do|else|extends|final|finally|for|forSome|goto|if|initialize|macro|match|new|object|onTransition|return|startWith|stay|throw|trait|try|unbecome|using|val|var|when|while|with|yield)\b 0:keyword
add-highlighter -group /scala/code regex \b(abstract|final|implicit|implicitly|lazy|override|private|protected|require|sealed|super)\b 0:attribute add-highlighter shared/scala/code regex \b(abstract|final|implicit|implicitly|lazy|override|private|protected|require|sealed|super)\b 0:attribute
add-highlighter -group /scala/code regex \b(⇒|=>|<:|:>|=:=|::|&&|\|\|)\b 0:operator add-highlighter shared/scala/code regex \b(⇒|=>|<:|:>|=:=|::|&&|\|\|)\b 0:operator
add-highlighter -group /scala/code regex "'[_A-Za-z0-9$]+" 0:variable add-highlighter shared/scala/code regex "'[_A-Za-z0-9$]+" 0:variable
# Commands # Commands
# ‾‾‾‾‾‾‾‾ # ‾‾‾‾‾‾‾‾
@ -62,7 +62,7 @@ def -hidden scala-indent-on-closing-curly-brace %[
# Initialization # Initialization
# ‾‾‾‾‾‾‾‾‾‾‾‾‾‾ # ‾‾‾‾‾‾‾‾‾‾‾‾‾‾
hook -group scala-highlight global WinSetOption filetype=scala %{ add-highlighter ref scala } hook -group scala-highlight global WinSetOption filetype=scala %{ add-highlighter window ref scala }
hook global WinSetOption filetype=scala %[ hook global WinSetOption filetype=scala %[
hook window InsertEnd .* -group scala-hooks scala-filter-around-selections hook window InsertEnd .* -group scala-hooks scala-filter-around-selections
@ -70,7 +70,7 @@ hook global WinSetOption filetype=scala %[
hook window InsertChar \} -group scala-indent scala-indent-on-closing-curly-brace hook window InsertChar \} -group scala-indent scala-indent-on-closing-curly-brace
] ]
hook -group scala-highlight global WinSetOption filetype=(?!scala).* %{ remove-highlighter scala } hook -group scala-highlight global WinSetOption filetype=(?!scala).* %{ remove-highlighter window/scala }
hook global WinSetOption filetype=(?!scala).* %{ hook global WinSetOption filetype=(?!scala).* %{
remove-hooks window scala-indent remove-hooks window scala-indent

View File

@ -9,7 +9,7 @@ Formats of language supported:
- ISO language code, e.g. 'en' - ISO language code, e.g. 'en'
- language code above followed by a dash or underscore with an ISO country code, e.g. 'en-US'} \ - language code above followed by a dash or underscore with an ISO country code, e.g. 'en-US'} \
spell %{ spell %{
try %{ add-highlighter ranges 'spell_regions' } try %{ add-highlighter window ranges 'spell_regions' }
%sh{ %sh{
file=$(mktemp -d "${TMPDIR:-/tmp}"/kak-spell.XXXXXXXX)/buffer file=$(mktemp -d "${TMPDIR:-/tmp}"/kak-spell.XXXXXXXX)/buffer
printf 'eval -no-hooks write %s\n' "${file}" printf 'eval -no-hooks write %s\n' "${file}"

View File

@ -11,7 +11,7 @@ hook global BufCreate .*/?(?i)sql %{
# Highlighters # Highlighters
# ‾‾‾‾‾‾‾‾‾‾‾‾ # ‾‾‾‾‾‾‾‾‾‾‾‾
add-highlighter -group / regions -default code sql \ add-highlighter shared/ regions -default code sql \
string '"' (?<!\\)(\\\\)*" '' \ string '"' (?<!\\)(\\\\)*" '' \
string "'" (?<!\\)(\\\\)*' '' \ string "'" (?<!\\)(\\\\)*' '' \
comment '--' '$' '' \ comment '--' '$' '' \
@ -85,27 +85,27 @@ add-highlighter -group / regions -default code sql \
# Highlight keywords # Highlight keywords
printf %s " printf %s "
add-highlighter -group /sql/code regex '\b(${functions})\(.*\)' 0:function add-highlighter shared/sql/code regex '\b(${functions})\(.*\)' 0:function
add-highlighter -group /sql/code regex '\b(${data_types_fn})\(.*?\)' 0:type add-highlighter shared/sql/code regex '\b(${data_types_fn})\(.*?\)' 0:type
add-highlighter -group /sql/code regex '\b(${keywords})\b' 0:keyword add-highlighter shared/sql/code regex '\b(${keywords})\b' 0:keyword
add-highlighter -group /sql/code regex '\b(${operators})\b' 0:operator add-highlighter shared/sql/code regex '\b(${operators})\b' 0:operator
add-highlighter -group /sql/code regex '\b(${data_types})\b' 0:type add-highlighter shared/sql/code regex '\b(${data_types})\b' 0:type
" "
} }
add-highlighter -group /sql/code regex '\+|-|\*|/|%|&|\||^|=|>|<|>=|<=|<>|\+=|-=|\*=|/=|%=|&=|^-=|\|\*=' 0:operator add-highlighter shared/sql/code regex '\+|-|\*|/|%|&|\||^|=|>|<|>=|<=|<>|\+=|-=|\*=|/=|%=|&=|^-=|\|\*=' 0:operator
add-highlighter -group /sql/code regex \bNULL\b 0:value add-highlighter shared/sql/code regex \bNULL\b 0:value
add-highlighter -group /sql/code regex \b\d+(?:\.\d+)?\b 0:value add-highlighter shared/sql/code regex \b\d+(?:\.\d+)?\b 0:value
add-highlighter -group /sql/string fill string add-highlighter shared/sql/string fill string
add-highlighter -group /sql/comment fill comment add-highlighter shared/sql/comment fill comment
# Initialization # Initialization
# ‾‾‾‾‾‾‾‾‾‾‾‾‾‾ # ‾‾‾‾‾‾‾‾‾‾‾‾‾‾
hook -group sql-highlight global WinSetOption filetype=sql %{ hook -group sql-highlight global WinSetOption filetype=sql %{
add-highlighter ref sql add-highlighter window ref sql
} }
hook -group sql-highlight global WinSetOption filetype=(?!sql).* %{ hook -group sql-highlight global WinSetOption filetype=(?!sql).* %{
remove-highlighter sql remove-highlighter window/sql
} }

View File

@ -2,26 +2,26 @@ hook global BufCreate .*\.(swift) %{
set buffer filetype swift set buffer filetype swift
} }
add-highlighter -group / regions -default code swift \ add-highlighter shared/ regions -default code swift \
string %{(?<!')"} %{(?<!\\)(\\\\)*"} '' \ string %{(?<!')"} %{(?<!\\)(\\\\)*"} '' \
comment /\* \*/ '' \ comment /\* \*/ '' \
comment // $ '' comment // $ ''
add-highlighter -group /swift/string fill string add-highlighter shared/swift/string fill string
add-highlighter -group /swift/comment fill comment add-highlighter shared/swift/comment fill comment
add-highlighter -group /swift/comment regex "\b(TODO|XXX|MARK)\b" 0:red add-highlighter shared/swift/comment regex "\b(TODO|XXX|MARK)\b" 0:red
add-highlighter -group /swift/code regex %{\b(true|false|nil)\b|\b-?(?!\$)\d+[fdiu]?|'((\\.)?|[^'\\])'} 0:value add-highlighter shared/swift/code regex %{\b(true|false|nil)\b|\b-?(?!\$)\d+[fdiu]?|'((\\.)?|[^'\\])'} 0:value
add-highlighter -group /swift/code regex "\b(let|var|while|in|for|if|else|do|switch|case|default|break|continue|return|try|catch|throw|new|delete|and|or|not|operator|explicit|func|import|return|init|deinit|get|set)\b" 0:keyword add-highlighter shared/swift/code regex "\b(let|var|while|in|for|if|else|do|switch|case|default|break|continue|return|try|catch|throw|new|delete|and|or|not|operator|explicit|func|import|return|init|deinit|get|set)\b" 0:keyword
add-highlighter -group /swift/code regex "\bas\b[!?]?" 0:keyword add-highlighter shared/swift/code regex "\bas\b[!?]?" 0:keyword
add-highlighter -group /swift/code regex "(\$[0-9])\b" 0:keyword add-highlighter shared/swift/code regex "(\$[0-9])\b" 0:keyword
add-highlighter -group /swift/code regex "\b(const|mutable|auto|namespace|inline|static|volatile|class|struct|enum|union|public|protected|private|typedef|virtual|friend|extern|typename|override|final|required|convenience|dynamic)\b" 0:attribute add-highlighter shared/swift/code regex "\b(const|mutable|auto|namespace|inline|static|volatile|class|struct|enum|union|public|protected|private|typedef|virtual|friend|extern|typename|override|final|required|convenience|dynamic)\b" 0:attribute
add-highlighter -group /swift/code regex "\b(self|nil|id|super)\b" 0:value add-highlighter shared/swift/code regex "\b(self|nil|id|super)\b" 0:value
add-highlighter -group /swift/code regex "\b(Bool|String|UInt|UInt16|UInt32|UInt64|UInt8)\b" 0:type add-highlighter shared/swift/code regex "\b(Bool|String|UInt|UInt16|UInt32|UInt64|UInt8)\b" 0:type
add-highlighter -group /swift/code regex "\b(IBAction|IBOutlet)\b" 0:attribute add-highlighter shared/swift/code regex "\b(IBAction|IBOutlet)\b" 0:attribute
add-highlighter -group /swift/code regex "@\w+\b" 0:attribute add-highlighter shared/swift/code regex "@\w+\b" 0:attribute
hook -group swift-highlight global WinSetOption filetype=swift %{ add-highlighter ref swift } hook -group swift-highlight global WinSetOption filetype=swift %{ add-highlighter window ref swift }
hook -group swift-highlight global WinSetOption filetype=(?!swift).* %{ remove-highlighter swift } hook -group swift-highlight global WinSetOption filetype=(?!swift).* %{ remove-highlighter window/swift }

View File

@ -11,19 +11,19 @@ hook global BufCreate .*[.](ya?ml) %{
# Highlighters # Highlighters
# ‾‾‾‾‾‾‾‾‾‾‾‾ # ‾‾‾‾‾‾‾‾‾‾‾‾
add-highlighter -group / regions -default code yaml \ add-highlighter shared/ regions -default code yaml \
double_string '"' (?<!\\)(\\\\)*" '' \ double_string '"' (?<!\\)(\\\\)*" '' \
single_string "'" "'" '' \ single_string "'" "'" '' \
comment '#' '$' '' comment '#' '$' ''
add-highlighter -group /yaml/double_string fill string add-highlighter shared/yaml/double_string fill string
add-highlighter -group /yaml/single_string fill string add-highlighter shared/yaml/single_string fill string
add-highlighter -group /yaml/comment fill comment add-highlighter shared/yaml/comment fill comment
add-highlighter -group /yaml/code regex ^(---|\.\.\.)$ 0:meta add-highlighter shared/yaml/code regex ^(---|\.\.\.)$ 0:meta
add-highlighter -group /yaml/code regex ^(\h*:\w*) 0:keyword add-highlighter shared/yaml/code regex ^(\h*:\w*) 0:keyword
add-highlighter -group /yaml/code regex \b(true|false|null)\b 0:value add-highlighter shared/yaml/code regex \b(true|false|null)\b 0:value
add-highlighter -group /yaml/code regex ^\h*-?\h*(\S+): 1:attribute add-highlighter shared/yaml/code regex ^\h*-?\h*(\S+): 1:attribute
# Commands # Commands
# ‾‾‾‾‾‾‾‾ # ‾‾‾‾‾‾‾‾
@ -49,14 +49,14 @@ def -hidden yaml-indent-on-new-line %{
# Initialization # Initialization
# ‾‾‾‾‾‾‾‾‾‾‾‾‾‾ # ‾‾‾‾‾‾‾‾‾‾‾‾‾‾
hook -group yaml-highlight global WinSetOption filetype=yaml %{ add-highlighter ref yaml } hook -group yaml-highlight global WinSetOption filetype=yaml %{ add-highlighter window ref yaml }
hook global WinSetOption filetype=yaml %{ hook global WinSetOption filetype=yaml %{
hook window InsertEnd .* -group yaml-hooks yaml-filter-around-selections hook window InsertEnd .* -group yaml-hooks yaml-filter-around-selections
hook window InsertChar \n -group yaml-indent yaml-indent-on-new-line hook window InsertChar \n -group yaml-indent yaml-indent-on-new-line
} }
hook -group yaml-highlight global WinSetOption filetype=(?!yaml).* %{ remove-highlighter yaml } hook -group yaml-highlight global WinSetOption filetype=(?!yaml).* %{ remove-highlighter window/yaml }
hook global WinSetOption filetype=(?!yaml).* %{ hook global WinSetOption filetype=(?!yaml).* %{
remove-hooks window yaml-indent remove-hooks window yaml-indent

View File

@ -11,21 +11,21 @@ hook global BufCreate .+\.(a(scii)?doc|asc) %{
# Highlighters # Highlighters
# ‾‾‾‾‾‾‾‾‾‾‾‾ # ‾‾‾‾‾‾‾‾‾‾‾‾
add-highlighter -group / group asciidoc add-highlighter shared/ group asciidoc
add-highlighter -group /asciidoc regex (\A|\n\n)[^\n]+\n={2,}\h*$ 0:title add-highlighter shared/asciidoc regex (\A|\n\n)[^\n]+\n={2,}\h*$ 0:title
add-highlighter -group /asciidoc regex (\A|\n\n)[^\n]+\n-{2,}\h*$ 0:header add-highlighter shared/asciidoc regex (\A|\n\n)[^\n]+\n-{2,}\h*$ 0:header
add-highlighter -group /asciidoc regex (\A|\n\n)[^\n]+\n~{2,}\h*$ 0:header add-highlighter shared/asciidoc regex (\A|\n\n)[^\n]+\n~{2,}\h*$ 0:header
add-highlighter -group /asciidoc regex (\A|\n\n)[^\n]+\n\^{2,}\h*$ 0:header add-highlighter shared/asciidoc regex (\A|\n\n)[^\n]+\n\^{2,}\h*$ 0:header
add-highlighter -group /asciidoc regex ^\h+([-\*])\h+[^\n]*(\n\h+[^-\*]\S+[^\n]*)*$ 0:list 1:bullet add-highlighter shared/asciidoc regex ^\h+([-\*])\h+[^\n]*(\n\h+[^-\*]\S+[^\n]*)*$ 0:list 1:bullet
add-highlighter -group /asciidoc regex ^(-{3,})\n[^\n\h].*?\n(-{3,})$ 0:block add-highlighter shared/asciidoc regex ^(-{3,})\n[^\n\h].*?\n(-{3,})$ 0:block
add-highlighter -group /asciidoc regex ^(={3,})\n[^\n\h].*?\n(={3,})$ 0:block add-highlighter shared/asciidoc regex ^(={3,})\n[^\n\h].*?\n(={3,})$ 0:block
add-highlighter -group /asciidoc regex ^(~{3,})\n[^\n\h].*?\n(~{3,})$ 0:block add-highlighter shared/asciidoc regex ^(~{3,})\n[^\n\h].*?\n(~{3,})$ 0:block
add-highlighter -group /asciidoc regex ^(\*{3,})\n[^\n\h].*?\n(\*{3,})$ 0:block add-highlighter shared/asciidoc regex ^(\*{3,})\n[^\n\h].*?\n(\*{3,})$ 0:block
add-highlighter -group /asciidoc regex \B(?:\+[^\n]+?\+|`[^\n]+?`)\B 0:mono add-highlighter shared/asciidoc regex \B(?:\+[^\n]+?\+|`[^\n]+?`)\B 0:mono
add-highlighter -group /asciidoc regex \B_[^\n]+?_\B 0:italic add-highlighter shared/asciidoc regex \B_[^\n]+?_\B 0:italic
add-highlighter -group /asciidoc regex \B\*[^\n]+?\*\B 0:bold add-highlighter shared/asciidoc regex \B\*[^\n]+?\*\B 0:bold
add-highlighter -group /asciidoc regex ^:[-\w]+: 0:meta add-highlighter shared/asciidoc regex ^:[-\w]+: 0:meta
# Commands # Commands
# ‾‾‾‾‾‾‾‾ # ‾‾‾‾‾‾‾‾
@ -33,5 +33,5 @@ add-highlighter -group /asciidoc regex ^:[-\w]+: 0:meta
# Initialization # Initialization
# ‾‾‾‾‾‾‾‾‾‾‾‾‾‾ # ‾‾‾‾‾‾‾‾‾‾‾‾‾‾
# #
hook -group asciidoc-highlight global WinSetOption filetype=asciidoc %{ add-highlighter ref asciidoc } hook -group asciidoc-highlight global WinSetOption filetype=asciidoc %{ add-highlighter window ref asciidoc }
hook -group asciidoc-highlight global WinSetOption filetype=(?!asciidoc).* %{ remove-highlighter asciidoc } hook -group asciidoc-highlight global WinSetOption filetype=(?!asciidoc).* %{ remove-highlighter window/asciidoc }

View File

@ -133,7 +133,7 @@ def -hidden c-family-insert-on-newline %[ eval -draft %[
fi fi
printf %s\\n ' printf %s\\n '
add-highlighter -group / regions -default code -match-capture FT \ add-highlighter shared/ regions -default code -match-capture FT \
string %{MAYBEAT(?<!QUOTE)"} %{(?<!\\)(?:\\\\)*"} "" \ string %{MAYBEAT(?<!QUOTE)"} %{(?<!\\)(?:\\\\)*"} "" \
string %{R"([^(]*)\(} %{\)([^)]*)"} "" \ string %{R"([^(]*)\(} %{\)([^)]*)"} "" \
comment /\* \*/ "" \ comment /\* \*/ "" \
@ -141,17 +141,17 @@ def -hidden c-family-insert-on-newline %[ eval -draft %[
disabled ^\h*?#\h*if\h+(?:0|FALSE)\b "#\h*(?:else|elif|endif)" "#\h*if(?:def)?" \ disabled ^\h*?#\h*if\h+(?:0|FALSE)\b "#\h*(?:else|elif|endif)" "#\h*if(?:def)?" \
macro %{^\h*?\K#} %{(?<!\\)\n} "" macro %{^\h*?\K#} %{(?<!\\)\n} ""
add-highlighter -group /FT/string fill string add-highlighter shared/FT/string fill string
add-highlighter -group /FT/comment fill comment add-highlighter shared/FT/comment fill comment
add-highlighter -group /FT/disabled fill rgb:666666 add-highlighter shared/FT/disabled fill rgb:666666
add-highlighter -group /FT/macro fill meta add-highlighter shared/FT/macro fill meta
add-highlighter -group /FT/macro regex ^\h*#include\h+(\S*) 1:module add-highlighter shared/FT/macro regex ^\h*#include\h+(\S*) 1:module
' | sed -e "s/FT/${ft}/g; s/QUOTE/'/g; s/MAYBEAT/${maybe_at}/;" ' | sed -e "s/FT/${ft}/g; s/QUOTE/'/g; s/MAYBEAT/${maybe_at}/;"
done done
} }
# c specific # c specific
add-highlighter -group /c/code regex %{\b-?(0x[0-9a-fA-F]+|\d+)[fdiu]?|'((\\.)?|[^'\\])'} 0:value add-highlighter shared/c/code regex %{\b-?(0x[0-9a-fA-F]+|\d+)[fdiu]?|'((\\.)?|[^'\\])'} 0:value
%sh{ %sh{
# Grammar # Grammar
keywords="while|for|if|else|do|switch|case|default|goto|asm|break|continue|return|sizeof" keywords="while|for|if|else|do|switch|case|default|goto|asm|break|continue|return|sizeof"
@ -166,15 +166,15 @@ add-highlighter -group /c/code regex %{\b-?(0x[0-9a-fA-F]+|\d+)[fdiu]?|'((\\.)?|
# Highlight keywords # Highlight keywords
printf %s " printf %s "
add-highlighter -group /c/code regex \b(${keywords})\b 0:keyword add-highlighter shared/c/code regex \b(${keywords})\b 0:keyword
add-highlighter -group /c/code regex \b(${attributes})\b 0:attribute add-highlighter shared/c/code regex \b(${attributes})\b 0:attribute
add-highlighter -group /c/code regex \b(${types})\b 0:type add-highlighter shared/c/code regex \b(${types})\b 0:type
add-highlighter -group /c/code regex \b(${values})\b 0:value add-highlighter shared/c/code regex \b(${values})\b 0:value
" "
} }
# c++ specific # c++ specific
add-highlighter -group /cpp/code regex %{\b-?(0x[0-9a-fA-F]+|\d+)[fdiu]?|'((\\.)?|[^'\\])'} 0:value add-highlighter shared/cpp/code regex %{\b-?(0x[0-9a-fA-F]+|\d+)[fdiu]?|'((\\.)?|[^'\\])'} 0:value
%sh{ %sh{
# Grammar # Grammar
@ -197,10 +197,10 @@ add-highlighter -group /cpp/code regex %{\b-?(0x[0-9a-fA-F]+|\d+)[fdiu]?|'((\\.)
# Highlight keywords # Highlight keywords
printf %s " printf %s "
add-highlighter -group /cpp/code regex \b(${keywords})\b 0:keyword add-highlighter shared/cpp/code regex \b(${keywords})\b 0:keyword
add-highlighter -group /cpp/code regex \b(${attributes})\b 0:attribute add-highlighter shared/cpp/code regex \b(${attributes})\b 0:attribute
add-highlighter -group /cpp/code regex \b(${types})\b 0:type add-highlighter shared/cpp/code regex \b(${types})\b 0:type
add-highlighter -group /cpp/code regex \b(${values})\b 0:value add-highlighter shared/cpp/code regex \b(${values})\b 0:value
" "
} }
@ -209,13 +209,13 @@ add-highlighter -group /cpp/code regex %{\b-?(0x[0-9a-fA-F]+|\d+)[fdiu]?|'((\\.)
builtin_macros="__cplusplus|__STDC_HOSTED__|__FILE__|__LINE__|__DATE__|__TIME__|__STDCPP_DEFAULT_NEW_ALIGNMENT__" builtin_macros="__cplusplus|__STDC_HOSTED__|__FILE__|__LINE__|__DATE__|__TIME__|__STDCPP_DEFAULT_NEW_ALIGNMENT__"
printf %s " printf %s "
add-highlighter -group /c/code regex \b(${builtin_macros})\b 0:builtin add-highlighter shared/c/code regex \b(${builtin_macros})\b 0:builtin
add-highlighter -group /cpp/code regex \b(${builtin_macros})\b 0:builtin add-highlighter shared/cpp/code regex \b(${builtin_macros})\b 0:builtin
" "
} }
# objective-c specific # objective-c specific
add-highlighter -group /objc/code regex %{\b-?\d+[fdiu]?|'((\\.)?|[^'\\])'} 0:value add-highlighter shared/objc/code regex %{\b-?\d+[fdiu]?|'((\\.)?|[^'\\])'} 0:value
%sh{ %sh{
# Grammar # Grammar
@ -236,11 +236,11 @@ add-highlighter -group /objc/code regex %{\b-?\d+[fdiu]?|'((\\.)?|[^'\\])'} 0:va
# Highlight keywords # Highlight keywords
printf %s " printf %s "
add-highlighter -group /objc/code regex \b(${keywords})\b 0:keyword add-highlighter shared/objc/code regex \b(${keywords})\b 0:keyword
add-highlighter -group /objc/code regex \b(${attributes})\b 0:attribute add-highlighter shared/objc/code regex \b(${attributes})\b 0:attribute
add-highlighter -group /objc/code regex \b(${types})\b 0:type add-highlighter shared/objc/code regex \b(${types})\b 0:type
add-highlighter -group /objc/code regex \b(${values})\b 0:value add-highlighter shared/objc/code regex \b(${values})\b 0:value
add-highlighter -group /objc/code regex @(${decorators})\b 0:attribute add-highlighter shared/objc/code regex @(${decorators})\b 0:attribute
" "
} }
@ -269,14 +269,14 @@ hook global WinSetOption filetype=(?!c)(?!cpp)(?!objc).* %[
unalias window alt c-family-alternative-file unalias window alt c-family-alternative-file
] ]
hook -group c-highlight global WinSetOption filetype=c %[ add-highlighter ref c ] hook -group c-highlight global WinSetOption filetype=c %[ add-highlighter window ref c ]
hook -group c-highlight global WinSetOption filetype=(?!c).* %[ remove-highlighter c ] hook -group c-highlight global WinSetOption filetype=(?!c).* %[ remove-highlighter window/c ]
hook -group cpp-highlight global WinSetOption filetype=cpp %[ add-highlighter ref cpp ] hook -group cpp-highlight global WinSetOption filetype=cpp %[ add-highlighter window ref cpp ]
hook -group cpp-highlight global WinSetOption filetype=(?!cpp).* %[ remove-highlighter cpp ] hook -group cpp-highlight global WinSetOption filetype=(?!cpp).* %[ remove-highlighter window/cpp ]
hook -group objc-highlight global WinSetOption filetype=objc %[ add-highlighter ref objc ] hook -group objc-highlight global WinSetOption filetype=objc %[ add-highlighter window ref objc ]
hook -group objc-highlight global WinSetOption filetype=(?!objc).* %[ remove-highlighter objc ] hook -group objc-highlight global WinSetOption filetype=(?!objc).* %[ remove-highlighter window/objc ]
decl -docstring %{control the type of include guard to be inserted in empty headers decl -docstring %{control the type of include guard to be inserted in empty headers
Can be one of the following: Can be one of the following:

View File

@ -2,10 +2,10 @@ hook global BufCreate .*\.(diff|patch) %{
set buffer filetype diff set buffer filetype diff
} }
add-highlighter -group / group diff add-highlighter shared/ group diff
add-highlighter -group /diff regex "^\+[^\n]*\n" 0:green,default add-highlighter shared/diff regex "^\+[^\n]*\n" 0:green,default
add-highlighter -group /diff regex "^-[^\n]*\n" 0:red,default add-highlighter shared/diff regex "^-[^\n]*\n" 0:red,default
add-highlighter -group /diff regex "^@@[^\n]*@@" 0:cyan,default add-highlighter shared/diff regex "^@@[^\n]*@@" 0:cyan,default
hook -group diff-highlight global WinSetOption filetype=diff %{ add-highlighter ref diff } hook -group diff-highlight global WinSetOption filetype=diff %{ add-highlighter window ref diff }
hook -group diff-highlight global WinSetOption filetype=(?!diff).* %{ remove-highlighter diff } hook -group diff-highlight global WinSetOption filetype=(?!diff).* %{ remove-highlighter window/diff }

View File

@ -28,16 +28,16 @@ All the optional arguments are forwarded to the grep utility} \
}} }}
hook -group grep-highlight global WinSetOption filetype=grep %{ hook -group grep-highlight global WinSetOption filetype=grep %{
add-highlighter group grep add-highlighter window group grep
add-highlighter -group grep regex "^((?:\w:)?[^:]+):(\d+):(\d+)?" 1:cyan 2:green 3:green add-highlighter window/grep regex "^((?:\w:)?[^:]+):(\d+):(\d+)?" 1:cyan 2:green 3:green
add-highlighter -group grep line %{%opt{grep_current_line}} default+b add-highlighter window/grep line %{%opt{grep_current_line}} default+b
} }
hook global WinSetOption filetype=grep %{ hook global WinSetOption filetype=grep %{
hook buffer -group grep-hooks NormalKey <ret> grep-jump hook buffer -group grep-hooks NormalKey <ret> grep-jump
} }
hook -group grep-highlight global WinSetOption filetype=(?!grep).* %{ remove-highlighter grep } hook -group grep-highlight global WinSetOption filetype=(?!grep).* %{ remove-highlighter window/grep }
hook global WinSetOption filetype=(?!grep).* %{ hook global WinSetOption filetype=(?!grep).* %{
remove-hooks buffer grep-hooks remove-hooks buffer grep-hooks

View File

@ -11,7 +11,7 @@ hook global BufCreate (.*/)?(kakrc|.*.kak) %{
# Highlighters & Completion # Highlighters & Completion
# ‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾ # ‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾
add-highlighter -group / regions -default code kakrc \ add-highlighter shared/ regions -default code kakrc \
comment (^|\h)\K# $ '' \ comment (^|\h)\K# $ '' \
double_string %{(^|\h)\K"} %{(?<!\\)(\\\\)*"} '' \ double_string %{(^|\h)\K"} %{(?<!\\)(\\\\)*"} '' \
single_string %{(^|\h)\K'} %{(?<!\\)(\\\\)*'} '' \ single_string %{(^|\h)\K'} %{(?<!\\)(\\\\)*'} '' \
@ -47,18 +47,18 @@ add-highlighter -group / regions -default code kakrc \
}" }"
# Highlight keywords (which are always surrounded by whitespace) # Highlight keywords (which are always surrounded by whitespace)
printf '%s\n' "add-highlighter -group /kakrc/code regex [\s\A]\K($(join "${keywords}" '|'))(?=[\s\z])\b 0:keyword printf '%s\n' "add-highlighter shared/kakrc/code regex [\s\A]\K($(join "${keywords}" '|'))(?=[\s\z])\b 0:keyword
add-highlighter -group /kakrc/code regex [\s\A]\K($(join "${attributes}" '|'))(?=[\s\z])\b 0:attribute add-highlighter shared/kakrc/code regex [\s\A]\K($(join "${attributes}" '|'))(?=[\s\z])\b 0:attribute
add-highlighter -group /kakrc/code regex [\s\A]\K($(join "${types}" '|'))(?=[\s\z])\b 0:type add-highlighter shared/kakrc/code regex [\s\A]\K($(join "${types}" '|'))(?=[\s\z])\b 0:type
add-highlighter -group /kakrc/code regex [\s\A]\K($(join "${values}" '|'))(?=[\s\z])\b 0:value" add-highlighter shared/kakrc/code regex [\s\A]\K($(join "${values}" '|'))(?=[\s\z])\b 0:value"
} }
add-highlighter -group /kakrc/code regex \brgb:[0-9a-fA-F]{6}\b 0:value add-highlighter shared/kakrc/code regex \brgb:[0-9a-fA-F]{6}\b 0:value
add-highlighter -group /kakrc/double_string fill string add-highlighter shared/kakrc/double_string fill string
add-highlighter -group /kakrc/single_string fill string add-highlighter shared/kakrc/single_string fill string
add-highlighter -group /kakrc/comment fill comment add-highlighter shared/kakrc/comment fill comment
add-highlighter -group /kakrc/shell ref sh add-highlighter shared/kakrc/shell ref sh
# Commands # Commands
# ‾‾‾‾‾‾‾‾ # ‾‾‾‾‾‾‾‾
@ -79,7 +79,7 @@ def -hidden kak-indent-on-new-line %{
# Initialization # Initialization
# ‾‾‾‾‾‾‾‾‾‾‾‾‾‾ # ‾‾‾‾‾‾‾‾‾‾‾‾‾‾
hook -group kak-highlight global WinSetOption filetype=kak %{ add-highlighter ref kakrc } hook -group kak-highlight global WinSetOption filetype=kak %{ add-highlighter window ref kakrc }
hook global WinSetOption filetype=kak %{ hook global WinSetOption filetype=kak %{
hook window InsertChar \n -group kak-indent kak-indent-on-new-line hook window InsertChar \n -group kak-indent kak-indent-on-new-line
@ -87,5 +87,5 @@ hook global WinSetOption filetype=kak %{
hook window InsertEnd .* -group kak-indent %{ try %{ exec -draft \; <a-x> s ^\h+$ <ret> d } } hook window InsertEnd .* -group kak-indent %{ try %{ exec -draft \; <a-x> s ^\h+$ <ret> d } }
} }
hook -group kak-highlight global WinSetOption filetype=(?!kak).* %{ remove-highlighter kakrc } hook -group kak-highlight global WinSetOption filetype=(?!kak).* %{ remove-highlighter window/kakrc }
hook global WinSetOption filetype=(?!kak).* %{ remove-hooks window kak-indent } hook global WinSetOption filetype=(?!kak).* %{ remove-hooks window kak-indent }

View File

@ -26,18 +26,18 @@ All the optional arguments are forwarded to the make utility} \
}" }"
}} }}
add-highlighter -group / group make add-highlighter shared/ group make
add-highlighter -group /make regex "^((?:\w:)?[^:\n]+):(\d+):(?:(\d+):)?\h+(?:((?:fatal )?error)|(warning)|(note)|(required from(?: here)?))?.*?$" 1:cyan 2:green 3:green 4:red 5:yellow 6:blue 7:yellow add-highlighter shared/make regex "^((?:\w:)?[^:\n]+):(\d+):(?:(\d+):)?\h+(?:((?:fatal )?error)|(warning)|(note)|(required from(?: here)?))?.*?$" 1:cyan 2:green 3:green 4:red 5:yellow 6:blue 7:yellow
add-highlighter -group /make regex "^\h*(~*(?:(\^)~*)?)$" 1:green 2:cyan+b add-highlighter shared/make regex "^\h*(~*(?:(\^)~*)?)$" 1:green 2:cyan+b
add-highlighter -group /make line '%opt{make_current_error_line}' default+b add-highlighter shared/make line '%opt{make_current_error_line}' default+b
hook -group make-highlight global WinSetOption filetype=make %{ add-highlighter ref make } hook -group make-highlight global WinSetOption filetype=make %{ add-highlighter window ref make }
hook global WinSetOption filetype=make %{ hook global WinSetOption filetype=make %{
hook buffer -group make-hooks NormalKey <ret> make-jump hook buffer -group make-hooks NormalKey <ret> make-jump
} }
hook -group make-highlight global WinSetOption filetype=(?!make).* %{ remove-highlighter make } hook -group make-highlight global WinSetOption filetype=(?!make).* %{ remove-highlighter window/make }
hook global WinSetOption filetype=(?!make).* %{ hook global WinSetOption filetype=(?!make).* %{
remove-hooks buffer make-hooks remove-hooks buffer make-hooks

View File

@ -8,15 +8,15 @@ hook global BufCreate .*/?[mM]akefile %{
# Highlighters # Highlighters
# ‾‾‾‾‾‾‾‾‾‾‾‾ # ‾‾‾‾‾‾‾‾‾‾‾‾
add-highlighter -group / regions -default content makefile \ add-highlighter shared/ regions -default content makefile \
comment '#' '$' '' \ comment '#' '$' '' \
eval '\$\(' '\)' '\(' eval '\$\(' '\)' '\('
add-highlighter -group /makefile/comment fill comment add-highlighter shared/makefile/comment fill comment
add-highlighter -group /makefile/eval fill value add-highlighter shared/makefile/eval fill value
add-highlighter -group /makefile/content regex ^[\w.%-]+\h*:\s 0:variable add-highlighter shared/makefile/content regex ^[\w.%-]+\h*:\s 0:variable
add-highlighter -group /makefile/content regex [+?:]= 0:operator add-highlighter shared/makefile/content regex [+?:]= 0:operator
%sh{ %sh{
# Grammar # Grammar
@ -28,7 +28,7 @@ add-highlighter -group /makefile/content regex [+?:]= 0:operator
}" | sed 's,|,:,g' }" | sed 's,|,:,g'
# Highlight keywords # Highlight keywords
printf %s "add-highlighter -group /makefile/content regex \b(${keywords})\b 0:keyword" printf %s "add-highlighter shared/makefile/content regex \b(${keywords})\b 0:keyword"
} }
# Commands # Commands
@ -50,13 +50,13 @@ def -hidden makefile-indent-on-new-line %{
# Initialization # Initialization
# ‾‾‾‾‾‾‾‾‾‾‾‾‾‾ # ‾‾‾‾‾‾‾‾‾‾‾‾‾‾
hook -group makefile-highlight global WinSetOption filetype=makefile %{ add-highlighter ref makefile } hook -group makefile-highlight global WinSetOption filetype=makefile %{ add-highlighter window ref makefile }
hook global WinSetOption filetype=makefile %{ hook global WinSetOption filetype=makefile %{
hook window InsertChar \n -group makefile-indent makefile-indent-on-new-line hook window InsertChar \n -group makefile-indent makefile-indent-on-new-line
} }
hook -group makefile-highlight global WinSetOption filetype=(?!makefile).* %{ remove-highlighter makefile } hook -group makefile-highlight global WinSetOption filetype=(?!makefile).* %{ remove-highlighter window/makefile }
hook global WinSetOption filetype=(?!makefile).* %{ hook global WinSetOption filetype=(?!makefile).* %{
remove-hooks window makefile-indent remove-hooks window makefile-indent

View File

@ -4,15 +4,15 @@ decl -docstring "name of the client in which documentation is to be displayed" \
decl -hidden str manpage decl -hidden str manpage
hook -group man-highlight global WinSetOption filetype=man %{ hook -group man-highlight global WinSetOption filetype=man %{
add-highlighter group man-highlight add-highlighter window group man-highlight
# Sections # Sections
add-highlighter -group man-highlight regex ^\S.*?$ 0:blue add-highlighter window/man-highlight regex ^\S.*?$ 0:blue
# Subsections # Subsections
add-highlighter -group man-highlight regex '^ {3}\S.*?$' 0:default+b add-highlighter window/man-highlight regex '^ {3}\S.*?$' 0:default+b
# Command line options # Command line options
add-highlighter -group man-highlight regex '^ {7}-[^\s,]+(,\s+-[^\s,]+)*' 0:yellow add-highlighter window/man-highlight regex '^ {7}-[^\s,]+(,\s+-[^\s,]+)*' 0:yellow
# References to other manpages # References to other manpages
add-highlighter -group man-highlight regex [-a-zA-Z0-9_.]+\([a-z0-9]+\) 0:green add-highlighter window/man-highlight regex [-a-zA-Z0-9_.]+\([a-z0-9]+\) 0:green
} }
hook global WinSetOption filetype=man %{ hook global WinSetOption filetype=man %{
@ -21,7 +21,7 @@ hook global WinSetOption filetype=man %{
} }
} }
hook -group man-highlight global WinSetOption filetype=(?!man).* %{ remove-highlighter man-highlight } hook -group man-highlight global WinSetOption filetype=(?!man).* %{ remove-highlighter window/man-highlight }
hook global WinSetOption filetype=(?!man).* %{ hook global WinSetOption filetype=(?!man).* %{
remove-hooks window man-hooks remove-hooks window man-hooks

View File

@ -11,16 +11,16 @@ hook global BufCreate .*[.](py) %{
# Highlighters & Completion # Highlighters & Completion
# ‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾ # ‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾
add-highlighter -group / regions -default code python \ add-highlighter shared/ regions -default code python \
double_string '"""' '"""' '' \ double_string '"""' '"""' '' \
single_string "'''" "'''" '' \ single_string "'''" "'''" '' \
double_string '"' (?<!\\)(\\\\)*" '' \ double_string '"' (?<!\\)(\\\\)*" '' \
single_string "'" (?<!\\)(\\\\)*' '' \ single_string "'" (?<!\\)(\\\\)*' '' \
comment '#' '$' '' comment '#' '$' ''
add-highlighter -group /python/double_string fill string add-highlighter shared/python/double_string fill string
add-highlighter -group /python/single_string fill string add-highlighter shared/python/single_string fill string
add-highlighter -group /python/comment fill comment add-highlighter shared/python/comment fill comment
%sh{ %sh{
# Grammar # Grammar
@ -47,16 +47,16 @@ add-highlighter -group /python/comment fill comment
# Highlight keywords # Highlight keywords
printf %s " printf %s "
add-highlighter -group /python/code regex '\b(${values})\b' 0:value add-highlighter shared/python/code regex '\b(${values})\b' 0:value
add-highlighter -group /python/code regex '\b(${meta})\b' 0:meta add-highlighter shared/python/code regex '\b(${meta})\b' 0:meta
add-highlighter -group /python/code regex '\b(${keywords})\b' 0:keyword add-highlighter shared/python/code regex '\b(${keywords})\b' 0:keyword
add-highlighter -group /python/code regex '\b(${functions})\b\(' 1:builtin add-highlighter shared/python/code regex '\b(${functions})\b\(' 1:builtin
" "
# Highlight types and attributes # Highlight types and attributes
printf %s " printf %s "
add-highlighter -group /python/code regex '\b(${types})\b' 0:type add-highlighter shared/python/code regex '\b(${types})\b' 0:type
add-highlighter -group /python/code regex '@[\w_]+\b' 0:attribute add-highlighter shared/python/code regex '@[\w_]+\b' 0:attribute
" "
} }
@ -79,7 +79,7 @@ def -hidden python-indent-on-new-line %{
# Initialization # Initialization
# ‾‾‾‾‾‾‾‾‾‾‾‾‾‾ # ‾‾‾‾‾‾‾‾‾‾‾‾‾‾
hook -group python-highlight global WinSetOption filetype=python %{ add-highlighter ref python } hook -group python-highlight global WinSetOption filetype=python %{ add-highlighter window ref python }
hook global WinSetOption filetype=python %{ hook global WinSetOption filetype=python %{
hook window InsertChar \n -group python-indent python-indent-on-new-line hook window InsertChar \n -group python-indent python-indent-on-new-line
@ -87,7 +87,7 @@ hook global WinSetOption filetype=python %{
hook window InsertEnd .* -group python-indent %{ try %{ exec -draft \; <a-x> s ^\h+$ <ret> d } } hook window InsertEnd .* -group python-indent %{ try %{ exec -draft \; <a-x> s ^\h+$ <ret> d } }
} }
hook -group python-highlight global WinSetOption filetype=(?!python).* %{ remove-highlighter python } hook -group python-highlight global WinSetOption filetype=(?!python).* %{ remove-highlighter window/python }
hook global WinSetOption filetype=(?!python).* %{ hook global WinSetOption filetype=(?!python).* %{
remove-hooks window python-indent remove-hooks window python-indent

View File

@ -2,16 +2,16 @@ hook global BufCreate .*\.(z|ba|c|k)?sh(rc|_profile)? %{
set buffer filetype sh set buffer filetype sh
} }
add-highlighter -group / regions -default code -match-capture sh \ add-highlighter shared/ regions -default code -match-capture sh \
double_string %{(?<!\\)(?:\\\\)*\K"} %{(?<!\\)(?:\\\\)*"} '' \ double_string %{(?<!\\)(?:\\\\)*\K"} %{(?<!\\)(?:\\\\)*"} '' \
single_string %{(?<!\\)(?:\\\\)*\K'} %{'} '' \ single_string %{(?<!\\)(?:\\\\)*\K'} %{'} '' \
comment '(?<!\$)#' '$' '' \ comment '(?<!\$)#' '$' '' \
heredoc '<<-?(\w+)' '^\t*(\w+)$' '' heredoc '<<-?(\w+)' '^\t*(\w+)$' ''
add-highlighter -group /sh/double_string fill string add-highlighter shared/sh/double_string fill string
add-highlighter -group /sh/single_string fill string add-highlighter shared/sh/single_string fill string
add-highlighter -group /sh/comment fill comment add-highlighter shared/sh/comment fill comment
add-highlighter -group /sh/heredoc fill string add-highlighter shared/sh/heredoc fill string
%sh{ %sh{
# Grammar # Grammar
@ -27,15 +27,15 @@ add-highlighter -group /sh/heredoc fill string
}" | sed 's,|,:,g' }" | sed 's,|,:,g'
# Highlight keywords # Highlight keywords
printf %s "add-highlighter -group /sh/code regex \b(${keywords})\b 0:keyword" printf %s "add-highlighter shared/sh/code regex \b(${keywords})\b 0:keyword"
} }
add-highlighter -group /sh/code regex [\[\]\(\)&|]{1,2} 0:operator add-highlighter shared/sh/code regex [\[\]\(\)&|]{1,2} 0:operator
add-highlighter -group /sh/code regex (\w+)= 1:variable add-highlighter shared/sh/code regex (\w+)= 1:variable
add-highlighter -group /sh/code regex ^\h*(\w+)\h*\(\) 1:variable add-highlighter shared/sh/code regex ^\h*(\w+)\h*\(\) 1:variable
add-highlighter -group /sh/code regex \$(\w+|\{.+?\}|#|@|\?|\$|!|-|\*) 0:value add-highlighter shared/sh/code regex \$(\w+|\{.+?\}|#|@|\?|\$|!|-|\*) 0:value
add-highlighter -group /sh/double_string regex \$(\w+|\{.+?\}) 0:value add-highlighter shared/sh/double_string regex \$(\w+|\{.+?\}) 0:value
hook -group sh-highlight global WinSetOption filetype=sh %{ add-highlighter ref sh } hook -group sh-highlight global WinSetOption filetype=sh %{ add-highlighter window ref sh }
hook -group sh-highlight global WinSetOption filetype=(?!sh).* %{ remove-highlighter sh } hook -group sh-highlight global WinSetOption filetype=(?!sh).* %{ remove-highlighter window/sh }

View File

@ -11,15 +11,15 @@ hook global BufCreate .*[.](cabal) %{
# Highlighters # Highlighters
# ‾‾‾‾‾‾‾‾‾‾‾‾ # ‾‾‾‾‾‾‾‾‾‾‾‾
add-highlighter -group / regions -default code cabal \ add-highlighter shared/ regions -default code cabal \
comment (--) $ '' \ comment (--) $ '' \
comment \{- -\} \{- comment \{- -\} \{-
add-highlighter -group /cabal/comment fill comment add-highlighter shared/cabal/comment fill comment
add-highlighter -group /cabal/code regex \b(true|false)\b|(([<>]?=?)?\d+(\.\d+)+) 0:value add-highlighter shared/cabal/code regex \b(true|false)\b|(([<>]?=?)?\d+(\.\d+)+) 0:value
add-highlighter -group /cabal/code regex \b(if|else)\b 0:keyword add-highlighter shared/cabal/code regex \b(if|else)\b 0:keyword
add-highlighter -group /cabal/code regex ^\h*([A-Za-z][A-Za-z0-9_-]*)\h*: 1:variable add-highlighter shared/cabal/code regex ^\h*([A-Za-z][A-Za-z0-9_-]*)\h*: 1:variable
# Commands # Commands
# ‾‾‾‾‾‾‾‾ # ‾‾‾‾‾‾‾‾
@ -59,7 +59,7 @@ def -hidden cabal-indent-on-closing-curly-brace %[
# Initialization # Initialization
# ‾‾‾‾‾‾‾‾‾‾‾‾‾‾ # ‾‾‾‾‾‾‾‾‾‾‾‾‾‾
hook -group cabal-highlight global WinSetOption filetype=cabal %{ add-highlighter ref cabal } hook -group cabal-highlight global WinSetOption filetype=cabal %{ add-highlighter window ref cabal }
hook global WinSetOption filetype=cabal %[ hook global WinSetOption filetype=cabal %[
hook window InsertEnd .* -group cabal-hooks cabal-filter-around-selections hook window InsertEnd .* -group cabal-hooks cabal-filter-around-selections
@ -68,7 +68,7 @@ hook global WinSetOption filetype=cabal %[
hook window InsertChar \} -group cabal-indent cabal-indent-on-closing-curly-brace hook window InsertChar \} -group cabal-indent cabal-indent-on-closing-curly-brace
] ]
hook -group cabal-highlight global WinSetOption filetype=(?!cabal).* %{ remove-highlighter cabal } hook -group cabal-highlight global WinSetOption filetype=(?!cabal).* %{ remove-highlighter window/cabal }
hook global WinSetOption filetype=(?!cabal).* %{ hook global WinSetOption filetype=(?!cabal).* %{
remove-hooks window cabal-indent remove-hooks window cabal-indent

View File

@ -147,13 +147,13 @@ def -hidden clang-show-error-info %{
def clang-enable-diagnostics -docstring %{Activate automatic error reporting and diagnostics def clang-enable-diagnostics -docstring %{Activate automatic error reporting and diagnostics
Information about the analysis are showned after the buffer has been parsed with the clang-parse function} \ Information about the analysis are showned after the buffer has been parsed with the clang-parse function} \
%{ %{
add-highlighter flag_lines default clang_flags add-highlighter window flag_lines default clang_flags
hook window -group clang-diagnostics NormalIdle .* %{ clang-show-error-info } hook window -group clang-diagnostics NormalIdle .* %{ clang-show-error-info }
hook window -group clang-diagnostics WinSetOption ^clang_errors=.* %{ info; clang-show-error-info } hook window -group clang-diagnostics WinSetOption ^clang_errors=.* %{ info; clang-show-error-info }
} }
def clang-disable-diagnostics -docstring "Disable automatic error reporting and diagnostics" %{ def clang-disable-diagnostics -docstring "Disable automatic error reporting and diagnostics" %{
remove-highlighter hlflags_clang_flags remove-highlighter window/hlflags_clang_flags
remove-hooks window clang-diagnostics remove-hooks window clang-diagnostics
} }

View File

@ -11,7 +11,7 @@ hook global BufCreate .*[.](coffee) %{
# Highlighters # Highlighters
# ‾‾‾‾‾‾‾‾‾‾‾‾ # ‾‾‾‾‾‾‾‾‾‾‾‾
add-highlighter -group / regions -default code coffee \ add-highlighter shared/ regions -default code coffee \
double_string '"""' '"""' '' \ double_string '"""' '"""' '' \
single_string "'''" "'''" '' \ single_string "'''" "'''" '' \
comment '###' '###' '' \ comment '###' '###' '' \
@ -24,23 +24,23 @@ add-highlighter -group / regions -default code coffee \
# Regular expression flags are: g → global match, i → ignore case, m → multi-lines, y → sticky # Regular expression flags are: g → global match, i → ignore case, m → multi-lines, y → sticky
# https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp # https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp
add-highlighter -group /coffee/double_string fill string add-highlighter shared/coffee/double_string fill string
add-highlighter -group /coffee/double_string regions regions interpolation \Q#{ \} \{ add-highlighter shared/coffee/double_string regions regions interpolation \Q#{ \} \{
add-highlighter -group /coffee/double_string/regions/interpolation fill meta add-highlighter shared/coffee/double_string/regions/interpolation fill meta
add-highlighter -group /coffee/single_string fill string add-highlighter shared/coffee/single_string fill string
add-highlighter -group /coffee/regex fill meta add-highlighter shared/coffee/regex fill meta
add-highlighter -group /coffee/regex regions regions interpolation \Q#{ \} \{ add-highlighter shared/coffee/regex regions regions interpolation \Q#{ \} \{
add-highlighter -group /coffee/regex/regions/interpolation fill meta add-highlighter shared/coffee/regex/regions/interpolation fill meta
add-highlighter -group /coffee/comment fill comment add-highlighter shared/coffee/comment fill comment
# Keywords are collected at # Keywords are collected at
# https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Lexical_grammar#Keywords # https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Lexical_grammar#Keywords
# http://coffeescript.org/documentation/docs/lexer.html#section-63 # http://coffeescript.org/documentation/docs/lexer.html#section-63
add-highlighter -group /coffee/code regex [$@]\w* 0:variable add-highlighter shared/coffee/code regex [$@]\w* 0:variable
add-highlighter -group /coffee/code regex \b(Array|Boolean|Date|Function|Number|Object|RegExp|String)\b 0:type add-highlighter shared/coffee/code regex \b(Array|Boolean|Date|Function|Number|Object|RegExp|String)\b 0:type
add-highlighter -group /coffee/code regex \b(document|false|no|null|off|on|parent|self|this|true|undefined|window|yes)\b 0:value add-highlighter shared/coffee/code regex \b(document|false|no|null|off|on|parent|self|this|true|undefined|window|yes)\b 0:value
add-highlighter -group /coffee/code regex \b(and|is|isnt|not|or)\b 0:operator add-highlighter shared/coffee/code regex \b(and|is|isnt|not|or)\b 0:operator
add-highlighter -group /coffee/code regex \b(break|case|catch|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally|for|function|if|implements|import|in|instanceof|interface|let|native|new|package|private|protected|public|return|static|super|switch|throw|try|typeof|var|void|while|with|yield)\b 0:keyword add-highlighter shared/coffee/code regex \b(break|case|catch|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally|for|function|if|implements|import|in|instanceof|interface|let|native|new|package|private|protected|public|return|static|super|switch|throw|try|typeof|var|void|while|with|yield)\b 0:keyword
# Commands # Commands
# ‾‾‾‾‾‾‾‾ # ‾‾‾‾‾‾‾‾
@ -69,14 +69,14 @@ def -hidden coffee-indent-on-new-line %{
# Initialization # Initialization
# ‾‾‾‾‾‾‾‾‾‾‾‾‾‾ # ‾‾‾‾‾‾‾‾‾‾‾‾‾‾
hook -group coffee-highlight global WinSetOption filetype=coffee %{ add-highlighter ref coffee } hook -group coffee-highlight global WinSetOption filetype=coffee %{ add-highlighter window ref coffee }
hook global WinSetOption filetype=coffee %{ hook global WinSetOption filetype=coffee %{
hook window InsertEnd .* -group coffee-hooks coffee-filter-around-selections hook window InsertEnd .* -group coffee-hooks coffee-filter-around-selections
hook window InsertChar \n -group coffee-indent coffee-indent-on-new-line hook window InsertChar \n -group coffee-indent coffee-indent-on-new-line
} }
hook -group coffee-highlight global WinSetOption filetype=(?!coffee).* %{ remove-highlighter coffee } hook -group coffee-highlight global WinSetOption filetype=(?!coffee).* %{ remove-highlighter window/coffee }
hook global WinSetOption filetype=(?!coffee).* %{ hook global WinSetOption filetype=(?!coffee).* %{
remove-hooks window coffee-indent remove-hooks window coffee-indent

View File

@ -11,14 +11,14 @@ hook global BufCreate .*[.](feature|story) %{
# Highlighters # Highlighters
# ‾‾‾‾‾‾‾‾‾‾‾‾ # ‾‾‾‾‾‾‾‾‾‾‾‾
add-highlighter -group / regions -default code cucumber \ add-highlighter shared/ regions -default code cucumber \
language ^\h*#\h*language: $ '' \ language ^\h*#\h*language: $ '' \
comment ^\h*# $ '' comment ^\h*# $ ''
add-highlighter -group /cucumber/language fill meta add-highlighter shared/cucumber/language fill meta
add-highlighter -group /cucumber/comment fill comment add-highlighter shared/cucumber/comment fill comment
add-highlighter -group /cucumber/language regex \S+$ 0:value add-highlighter shared/cucumber/language regex \S+$ 0:value
# Spoken languages # Spoken languages
# ‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾ # ‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾
@ -51,7 +51,7 @@ add-highlighter -group /cucumber/language regex \S+$ 0:value
# … # …
# } # }
add-highlighter -group /cucumber/code regex \b(Feature|Business\h+Need|Ability|Background|Scenario|Scenario\h+Outline|Scenario\h+Template|Examples|Scenarios|Given|When|Then|And|But)\b 0:keyword add-highlighter shared/cucumber/code regex \b(Feature|Business\h+Need|Ability|Background|Scenario|Scenario\h+Outline|Scenario\h+Template|Examples|Scenarios|Given|When|Then|And|But)\b 0:keyword
# Commands # Commands
# ‾‾‾‾‾‾‾‾ # ‾‾‾‾‾‾‾‾
@ -77,14 +77,14 @@ def -hidden cucumber-indent-on-new-line %{
# Initialization # Initialization
# ‾‾‾‾‾‾‾‾‾‾‾‾‾‾ # ‾‾‾‾‾‾‾‾‾‾‾‾‾‾
hook -group cucumber-highlight global WinSetOption filetype=cucumber %{ add-highlighter ref cucumber } hook -group cucumber-highlight global WinSetOption filetype=cucumber %{ add-highlighter window ref cucumber }
hook global WinSetOption filetype=cucumber %{ hook global WinSetOption filetype=cucumber %{
hook window InsertEnd .* -group cucumber-hooks cucumber-filter-around-selections hook window InsertEnd .* -group cucumber-hooks cucumber-filter-around-selections
hook window InsertChar \n -group cucumber-indent cucumber-indent-on-new-line hook window InsertChar \n -group cucumber-indent cucumber-indent-on-new-line
} }
hook -group cucumber-highlight global WinSetOption filetype=(?!cucumber).* %{ remove-highlighter cucumber } hook -group cucumber-highlight global WinSetOption filetype=(?!cucumber).* %{ remove-highlighter window/cucumber }
hook global WinSetOption filetype=(?!cucumber).* %{ hook global WinSetOption filetype=(?!cucumber).* %{
remove-hooks window cucumber-indent remove-hooks window cucumber-indent

View File

@ -13,30 +13,30 @@ hook global BufCreate .*Dockerfile %{
# Highlighters # Highlighters
# ‾‾‾‾‾‾‾‾‾‾‾‾ # ‾‾‾‾‾‾‾‾‾‾‾‾
add-highlighter -group / regions dockerfile \ add-highlighter shared/ regions dockerfile \
instruction '^(?i)(ONBUILD\h+)?(FROM|MAINTAINER|RUN|CMD|LABEL|EXPOSE|ENV|ADD|COPY|ENTRYPOINT|VOLUME|USER|WORKDIR)' '$' '' \ instruction '^(?i)(ONBUILD\h+)?(FROM|MAINTAINER|RUN|CMD|LABEL|EXPOSE|ENV|ADD|COPY|ENTRYPOINT|VOLUME|USER|WORKDIR)' '$' '' \
comment '#' '$' '' comment '#' '$' ''
add-highlighter -group /dockerfile/instruction regex '^(?i)(ONBUILD\h+)?(FROM|MAINTAINER|RUN|CMD|LABEL|EXPOSE|ENV|ADD|COPY|ENTRYPOINT|VOLUME|USER|WORKDIR)' 0:keyword add-highlighter shared/dockerfile/instruction regex '^(?i)(ONBUILD\h+)?(FROM|MAINTAINER|RUN|CMD|LABEL|EXPOSE|ENV|ADD|COPY|ENTRYPOINT|VOLUME|USER|WORKDIR)' 0:keyword
add-highlighter -group /dockerfile/instruction regions regions \ add-highlighter shared/dockerfile/instruction regions regions \
plain '^(?i)(ONBUILD\h+)?(LABEL|ENV)' '$' '' \ plain '^(?i)(ONBUILD\h+)?(LABEL|ENV)' '$' '' \
json '^(?i)(ONBUILD\h+)?(RUN|CMD|ADD|COPY|ENTRYPOINT|VOLUME)\h+\[' \] \[ \ json '^(?i)(ONBUILD\h+)?(RUN|CMD|ADD|COPY|ENTRYPOINT|VOLUME)\h+\[' \] \[ \
sh '^(?i)(ONBUILD\h+)?(RUN|CMD|ENTRYPOINT)\h+([A-Z/a-z])+' '$' '' sh '^(?i)(ONBUILD\h+)?(RUN|CMD|ENTRYPOINT)\h+([A-Z/a-z])+' '$' ''
add-highlighter -group /dockerfile/instruction/regions/plain regions regions \ add-highlighter shared/dockerfile/instruction/regions/plain regions regions \
string '"' '(?<!\\)(\\\\)*"' '' \ string '"' '(?<!\\)(\\\\)*"' '' \
string "'" "'" '' string "'" "'" ''
add-highlighter -group /dockerfile/instruction/regions/plain/regions/string fill string add-highlighter shared/dockerfile/instruction/regions/plain/regions/string fill string
add-highlighter -group /dockerfile/instruction/regions/json ref json add-highlighter shared/dockerfile/instruction/regions/json ref json
add-highlighter -group /dockerfile/instruction/regions/sh ref sh add-highlighter shared/dockerfile/instruction/regions/sh ref sh
add-highlighter -group /dockerfile/comment fill comment add-highlighter shared/dockerfile/comment fill comment
# Initialization # Initialization
# ‾‾‾‾‾‾‾‾‾‾‾‾‾‾ # ‾‾‾‾‾‾‾‾‾‾‾‾‾‾
hook -group dockerfile-highlight global WinSetOption filetype=dockerfile %{ add-highlighter ref dockerfile } hook -group dockerfile-highlight global WinSetOption filetype=dockerfile %{ add-highlighter window ref dockerfile }
hook -group dockerfile-highlight global WinSetOption filetype=(?!dockerfile).* %{ remove-highlighter dockerfile } hook -group dockerfile-highlight global WinSetOption filetype=(?!dockerfile).* %{ remove-highlighter window/dockerfile }

View File

@ -12,32 +12,32 @@ hook global BufCreate .*[.](ex|exs) %{
# Highlighters # Highlighters
# ‾‾‾‾‾‾‾‾‾‾‾‾ # ‾‾‾‾‾‾‾‾‾‾‾‾
add-highlighter -group / regions -default code elixir \ add-highlighter shared/ regions -default code elixir \
double_string '"' (?<!\\)(\\\\)*" '' \ double_string '"' (?<!\\)(\\\\)*" '' \
double_string '"""' (?<!\\)(\\\\)*""" '' \ double_string '"""' (?<!\\)(\\\\)*""" '' \
single_string "'" (?<!\\)(\\\\)*' '' \ single_string "'" (?<!\\)(\\\\)*' '' \
comment '#' '$' '' comment '#' '$' ''
add-highlighter -group /elixir/comment fill comment add-highlighter shared/elixir/comment fill comment
add-highlighter -group /elixir/double_string fill string add-highlighter shared/elixir/double_string fill string
add-highlighter -group /elixir/double_string regions regions interpolation \Q#{ \} \{ add-highlighter shared/elixir/double_string regions regions interpolation \Q#{ \} \{
add-highlighter -group /elixir/double_string/regions/interpolation fill builtin add-highlighter shared/elixir/double_string/regions/interpolation fill builtin
add-highlighter -group /elixir/single_string fill string add-highlighter shared/elixir/single_string fill string
add-highlighter -group /elixir/code regex ':[\w_]+\b' 0:type add-highlighter shared/elixir/code regex ':[\w_]+\b' 0:type
add-highlighter -group /elixir/code regex '[\w_]+:' 0:type add-highlighter shared/elixir/code regex '[\w_]+:' 0:type
add-highlighter -group /elixir/code regex '[A-Z][\w_]+\b' 0:module add-highlighter shared/elixir/code regex '[A-Z][\w_]+\b' 0:module
add-highlighter -group /elixir/code regex '(:[\w_]+)(\.)' 1:module add-highlighter shared/elixir/code regex '(:[\w_]+)(\.)' 1:module
add-highlighter -group /elixir/code regex '\b_\b' 0:default add-highlighter shared/elixir/code regex '\b_\b' 0:default
add-highlighter -group /elixir/code regex '\b_[\w_]+\b' 0:default add-highlighter shared/elixir/code regex '\b_[\w_]+\b' 0:default
add-highlighter -group /elixir/code regex '~[a-zA-Z]\(.*\)' 0:string add-highlighter shared/elixir/code regex '~[a-zA-Z]\(.*\)' 0:string
add-highlighter -group /elixir/code regex \b(true|false|nil)\b 0:value add-highlighter shared/elixir/code regex \b(true|false|nil)\b 0:value
add-highlighter -group /elixir/code regex (->|<-|<<|>>|=>) 0:builtin add-highlighter shared/elixir/code regex (->|<-|<<|>>|=>) 0:builtin
add-highlighter -group /elixir/code regex \b(require|alias|use|import)\b 0:keyword add-highlighter shared/elixir/code regex \b(require|alias|use|import)\b 0:keyword
add-highlighter -group /elixir/code regex \b(__MODULE__|__DIR__|__ENV__|__CALLER__)\b 0:value add-highlighter shared/elixir/code regex \b(__MODULE__|__DIR__|__ENV__|__CALLER__)\b 0:value
add-highlighter -group /elixir/code regex \b(def|defp|defmacro|defmacrop|defstruct|defmodule|defimpl|defprotocol|defoverridable)\b 0:keyword add-highlighter shared/elixir/code regex \b(def|defp|defmacro|defmacrop|defstruct|defmodule|defimpl|defprotocol|defoverridable)\b 0:keyword
add-highlighter -group /elixir/code regex \b(fn|do|end|when|case|if|else|unless|var!|for|cond|quote|unquote|receive|with|raise|reraise|try|catch)\b 0:keyword add-highlighter shared/elixir/code regex \b(fn|do|end|when|case|if|else|unless|var!|for|cond|quote|unquote|receive|with|raise|reraise|try|catch)\b 0:keyword
add-highlighter -group /elixir/code regex '@[\w_]+\b' 0:attribute add-highlighter shared/elixir/code regex '@[\w_]+\b' 0:attribute
add-highlighter -group /elixir/code regex '\b\d+[\d_]*\b' 0:value add-highlighter shared/elixir/code regex '\b\d+[\d_]*\b' 0:value
# Commands # Commands
# ‾‾‾‾‾‾‾‾ # ‾‾‾‾‾‾‾‾
@ -65,12 +65,12 @@ def -hidden elixir-indent-on-new-line %{
# Initialization # Initialization
# ‾‾‾‾‾‾‾‾‾‾‾‾‾‾ # ‾‾‾‾‾‾‾‾‾‾‾‾‾‾
hook -group elixir-highlight global WinSetOption filetype=elixir %{ add-highlighter ref elixir } hook -group elixir-highlight global WinSetOption filetype=elixir %{ add-highlighter window ref elixir }
hook global WinSetOption filetype=elixir %{ hook global WinSetOption filetype=elixir %{
hook window InsertEnd .* -group elixir-hooks elixir-filter-around-selections hook window InsertEnd .* -group elixir-hooks elixir-filter-around-selections
hook window InsertChar \n -group elixir-indent elixir-indent-on-new-line hook window InsertChar \n -group elixir-indent elixir-indent-on-new-line
} }
hook -group elixir-highlight global WinSetOption filetype=(?!elixir).* %{ remove-highlighter elixir } hook -group elixir-highlight global WinSetOption filetype=(?!elixir).* %{ remove-highlighter window/elixir }

View File

@ -11,18 +11,18 @@ hook global BufCreate .*[.](elm) %{
# Highlighters # Highlighters
# ‾‾‾‾‾‾‾‾‾‾‾‾ # ‾‾‾‾‾‾‾‾‾‾‾‾
add-highlighter -group / regions -default code elm \ add-highlighter shared/ regions -default code elm \
string '"' (?<!\\)(\\\\)*" '' \ string '"' (?<!\\)(\\\\)*" '' \
comment (--) $ '' \ comment (--) $ '' \
comment \{- -\} \{- \ comment \{- -\} \{- \
add-highlighter -group /elm/string fill string add-highlighter shared/elm/string fill string
add-highlighter -group /elm/comment fill comment add-highlighter shared/elm/comment fill comment
add-highlighter -group /elm/code regex \b(import|exposing|as|module|where)\b 0:meta add-highlighter shared/elm/code regex \b(import|exposing|as|module|where)\b 0:meta
add-highlighter -group /elm/code regex \b(True|False)\b 0:value add-highlighter shared/elm/code regex \b(True|False)\b 0:value
add-highlighter -group /elm/code regex \b(if|then|else|case|of|let|in|type|port|alias)\b 0:keyword add-highlighter shared/elm/code regex \b(if|then|else|case|of|let|in|type|port|alias)\b 0:keyword
add-highlighter -group /elm/code regex \b(Array|Bool|Char|Float|Int|String)\b 0:type add-highlighter shared/elm/code regex \b(Array|Bool|Char|Float|Int|String)\b 0:type
# Commands # Commands
# ‾‾‾‾‾‾‾‾ # ‾‾‾‾‾‾‾‾
@ -56,14 +56,14 @@ def -hidden elm-indent-on-new-line %{
# Initialization # Initialization
# ‾‾‾‾‾‾‾‾‾‾‾‾‾‾ # ‾‾‾‾‾‾‾‾‾‾‾‾‾‾
hook -group elm-highlight global WinSetOption filetype=elm %{ add-highlighter ref elm } hook -group elm-highlight global WinSetOption filetype=elm %{ add-highlighter window ref elm }
hook global WinSetOption filetype=elm %{ hook global WinSetOption filetype=elm %{
hook window InsertEnd .* -group elm-hooks elm-filter-around-selections hook window InsertEnd .* -group elm-hooks elm-filter-around-selections
hook window InsertChar \n -group elm-indent elm-indent-on-new-line hook window InsertChar \n -group elm-indent elm-indent-on-new-line
} }
hook -group elm-highlight global WinSetOption filetype=(?!elm).* %{ remove-highlighter elm } hook -group elm-highlight global WinSetOption filetype=(?!elm).* %{ remove-highlighter window/elm }
hook global WinSetOption filetype=(?!elm).* %{ hook global WinSetOption filetype=(?!elm).* %{
remove-hooks window elm-indent remove-hooks window elm-indent

View File

@ -27,79 +27,79 @@ hook global BufCreate .*/etc/paludis(-.*)?/suggestions(\.conf.d/.*.conf|\.conf)
# Highlighters # Highlighters
## exheres-0 Repository metadata files ## exheres-0 Repository metadata files
add-highlighter -group / group exheres-0-metadata add-highlighter shared/ group exheres-0-metadata
add-highlighter -group /exheres-0-metadata regex ^#.*?$ 0:comment add-highlighter shared/exheres-0-metadata regex ^#.*?$ 0:comment
add-highlighter -group /exheres-0-metadata regex ^(?:[\s\t]+)?(\*)?(\S+)(?:[\s\t]+)?=(?:[\s\t]+)?(.+?)?$ 1:type 2:attribute 3:string add-highlighter shared/exheres-0-metadata regex ^(?:[\s\t]+)?(\*)?(\S+)(?:[\s\t]+)?=(?:[\s\t]+)?(.+?)?$ 1:type 2:attribute 3:string
add-highlighter -group /exheres-0-metadata regex ^(?:[\s\t]+)?[\S]+[\s\t]+=[\s\t]+\[.+?[\s\t]+\] 0:string add-highlighter shared/exheres-0-metadata regex ^(?:[\s\t]+)?[\S]+[\s\t]+=[\s\t]+\[.+?[\s\t]+\] 0:string
add-highlighter -group /exheres-0-metadata regex ^(?:[\s\t]+)?(\S+)\s\[\[$ 0:type add-highlighter shared/exheres-0-metadata regex ^(?:[\s\t]+)?(\S+)\s\[\[$ 0:type
add-highlighter -group /exheres-0-metadata regex ^(?:[\s\t]+)?\]\]$ 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 ref exheres-0-metadata } hook -group exheres-0-metadata-highlight global WinSetOption filetype=exheres-0-metadata %{ add-highlighter window ref exheres-0-metadata }
hook -group exheres-0-metadata-highlight global WinSetOption filetype=(?!exheres-0-metadata).* %{ remove-highlighter exheres-0-metadata } hook -group exheres-0-metadata-highlight global WinSetOption filetype=(?!exheres-0-metadata).* %{ remove-highlighter window/exheres-0-metadata }
## exheres-0 options descriptions ## exheres-0 options descriptions
add-highlighter -group / group exheres-0-options-descriptions add-highlighter shared/ group exheres-0-options-descriptions
add-highlighter -group /exheres-0-options-descriptions regex ^#.*?$ 0:comment add-highlighter shared/exheres-0-options-descriptions regex ^#.*?$ 0:comment
add-highlighter -group /exheres-0-options-descriptions regex ^(?:[\s\t]+)?[\S]+[\s\t]+-[\s\t]+\[.+?[\s\t]+\] 0:string add-highlighter shared/exheres-0-options-descriptions regex ^(?:[\s\t]+)?[\S]+[\s\t]+-[\s\t]+\[.+?[\s\t]+\] 0:string
add-highlighter -group /exheres-0-options-descriptions regex ^(?:[\s\t]+)?(\S+)\s\[\[$ 0:type add-highlighter shared/exheres-0-options-descriptions regex ^(?:[\s\t]+)?(\S+)\s\[\[$ 0:type
add-highlighter -group /exheres-0-options-descriptions regex ^(?:[\s\t]+)?\]\]$ 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 ref exheres-0-options-descriptions } hook -group exheres-0-options-descriptions-highlight global WinSetOption filetype=exheres-0-options-descriptions %{ add-highlighter window ref exheres-0-options-descriptions }
hook -group exheres-0-options-descriptions-highlight global WinSetOption filetype=(?!exheres-0-options-descriptions).* %{ remove-highlighter 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 }
## metadata/licence_groups.conf ## metadata/licence_groups.conf
add-highlighter -group / group exheres-0-licence-groups add-highlighter shared/ group exheres-0-licence-groups
add-highlighter -group /exheres-0-licence-groups regex [\s\t]+(\S+(?:[\s\t]+))*$ 0:attribute add-highlighter shared/exheres-0-licence-groups regex [\s\t]+(\S+(?:[\s\t]+))*$ 0:attribute
add-highlighter -group /exheres-0-licence-groups regex ^(\S+) 0:type add-highlighter shared/exheres-0-licence-groups regex ^(\S+) 0:type
add-highlighter -group /exheres-0-licence-groups regex ^#.*?$ 0:comment 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 ref exheres-0-licence-groups } hook -group exheres-0-licence-groups-highlight global WinSetOption filetype=exheres-0-licence-groups %{ add-highlighter window ref exheres-0-licence-groups }
hook -group exheres-0-licence-groups-highlight global WinSetOption filetype=(?!exheres-0-licence-groups).* %{ remove-highlighter 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 }
## Paludis configurations ## Paludis configurations
### options.conf ### options.conf
add-highlighter -group / group paludis-options-conf add-highlighter shared/ group paludis-options-conf
add-highlighter -group /paludis-options-conf regex [\s\t]+(\S+(?:[\s\t]+))*$ 0:attribute add-highlighter shared/paludis-options-conf regex [\s\t]+(\S+(?:[\s\t]+))*$ 0:attribute
add-highlighter -group /paludis-options-conf regex (?::)(?:[\s\t]+)(.*?$) 1:attribute add-highlighter shared/paludis-options-conf regex (?::)(?:[\s\t]+)(.*?$) 1:attribute
add-highlighter -group /paludis-options-conf regex [\s\t]+(\S+=)(\S+) 1:attribute 2:value add-highlighter shared/paludis-options-conf regex [\s\t]+(\S+=)(\S+) 1:attribute 2:value
add-highlighter -group /paludis-options-conf regex [\s\t](\S+:) 0:keyword add-highlighter shared/paludis-options-conf regex [\s\t](\S+:) 0:keyword
add-highlighter -group /paludis-options-conf regex [\s\t](-\S+)(.*?) 1:red add-highlighter shared/paludis-options-conf regex [\s\t](-\S+)(.*?) 1:red
add-highlighter -group /paludis-options-conf regex ^(\S+/\S+) 0:type add-highlighter shared/paludis-options-conf regex ^(\S+/\S+) 0:type
add-highlighter -group /paludis-options-conf regex ^#.*?$ 0:comment add-highlighter shared/paludis-options-conf regex ^#.*?$ 0:comment
hook -group paludis-options-conf-highlight global WinSetOption filetype=paludis-options-conf %{ add-highlighter ref paludis-options-conf } hook -group paludis-options-conf-highlight global WinSetOption filetype=paludis-options-conf %{ add-highlighter window ref paludis-options-conf }
hook -group paludis-options-conf-highlight global WinSetOption filetype=(?!paludis-options-conf).* %{ remove-highlighter paludis-options-conf } hook -group paludis-options-conf-highlight global WinSetOption filetype=(?!paludis-options-conf).* %{ remove-highlighter window/paludis-options-conf }
## general.conf, repository.template ## general.conf, repository.template
add-highlighter -group / group paludis-key-value-conf add-highlighter shared/ group paludis-key-value-conf
add-highlighter -group /paludis-key-value-conf regex ^[\s\t]?(\S+)[\s\t+]=[\s\t+](.*?)$ 1:attribute 2:value add-highlighter shared/paludis-key-value-conf regex ^[\s\t]?(\S+)[\s\t+]=[\s\t+](.*?)$ 1:attribute 2:value
add-highlighter -group /paludis-key-value-conf regex ^#.*?$ 0:comment 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 ref paludis-key-value-conf } hook -group paludis-key-value-conf-highlight global WinSetOption filetype=paludis-key-value-conf %{ add-highlighter window ref paludis-key-value-conf }
hook -group paludis-key-value-conf-highlight global WinSetOption filetype=(?!paludis-key-value-conf).* %{ remove-highlighter 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 }
## mirrors.conf ## mirrors.conf
add-highlighter -group / group paludis-mirrors-conf add-highlighter shared/ group paludis-mirrors-conf
add-highlighter -group /paludis-mirrors-conf regex ^[\s\t+]?(\S+)[\s\t+](.*?)$ 1:type 2:value add-highlighter shared/paludis-mirrors-conf regex ^[\s\t+]?(\S+)[\s\t+](.*?)$ 1:type 2:value
add-highlighter -group /paludis-mirrors-conf regex ^#.*?$ 0:comment add-highlighter shared/paludis-mirrors-conf regex ^#.*?$ 0:comment
hook -group paludis-mirrors-conf-highlight global WinSetOption filetype=paludis-mirrors-conf %{ add-highlighter ref paludis-mirrors-conf } hook -group paludis-mirrors-conf-highlight global WinSetOption filetype=paludis-mirrors-conf %{ add-highlighter window ref paludis-mirrors-conf }
hook -group paludis-mirrors-conf-highlight global WinSetOption filetype=(?!paludis-mirrors-conf).* %{ remove-highlighter paludis-mirrors-conf } hook -group paludis-mirrors-conf-highlight global WinSetOption filetype=(?!paludis-mirrors-conf).* %{ remove-highlighter window/paludis-mirrors-conf }
## package_(unmask|mask).conf, platforms.conf ## package_(unmask|mask).conf, platforms.conf
add-highlighter -group / group paludis-specs-conf add-highlighter shared/ group paludis-specs-conf
add-highlighter -group /paludis-specs-conf regex [\s\t]+(\S+(?:[\s\t]+))*$ 0:attribute add-highlighter shared/paludis-specs-conf regex [\s\t]+(\S+(?:[\s\t]+))*$ 0:attribute
add-highlighter -group /paludis-specs-conf regex ^(\S+/\S+) 0:type add-highlighter shared/paludis-specs-conf regex ^(\S+/\S+) 0:type
add-highlighter -group /paludis-specs-conf regex ^#.*?$ 0:comment add-highlighter shared/paludis-specs-conf regex ^#.*?$ 0:comment
hook -group paludis-specs-conf-highlight global WinSetOption filetype=paludis-specs-conf %{ add-highlighter ref paludis-specs-conf } hook -group paludis-specs-conf-highlight global WinSetOption filetype=paludis-specs-conf %{ add-highlighter window ref paludis-specs-conf }
hook -group paludis-specs-conf-highlight global WinSetOption filetype=(?!paludis-specs-conf).* %{ remove-highlighter paludis-specs-conf } hook -group paludis-specs-conf-highlight global WinSetOption filetype=(?!paludis-specs-conf).* %{ remove-highlighter window/paludis-specs-conf }
## News items (GLEP42) ## News items (GLEP42)
add-highlighter -group / group glep42 add-highlighter shared/ group glep42
add-highlighter -group /glep42 regex ^(Title|Author|Translator|Content-Type|Posted|Revision|News-Item-Format|Display-If-Installed|Display-If-Keyword|Display-If-Profile):([^\n]*(?:\n\h+[^\n]+)*)$ 1:keyword 2:attribute add-highlighter shared/glep42 regex ^(Title|Author|Translator|Content-Type|Posted|Revision|News-Item-Format|Display-If-Installed|Display-If-Keyword|Display-If-Profile):([^\n]*(?:\n\h+[^\n]+)*)$ 1:keyword 2:attribute
add-highlighter -group /glep42 regex <[^@>]+@.*?> 0:string add-highlighter shared/glep42 regex <[^@>]+@.*?> 0:string
add-highlighter -group /glep42 regex ^>.*?$ 0:comment add-highlighter shared/glep42 regex ^>.*?$ 0:comment
hook -group glep42-highlight global WinSetOption filetype=glep42 %{ add-highlighter ref glep42 } hook -group glep42-highlight global WinSetOption filetype=glep42 %{ add-highlighter window ref glep42 }
hook -group glep42-highlight global WinSetOption filetype=(?!glep42).* %{ remove-highlighter glep42 } hook -group glep42-highlight global WinSetOption filetype=(?!glep42).* %{ remove-highlighter window/glep42 }

View File

@ -2,20 +2,20 @@ decl -docstring "name of the client in which documentation is to be displayed" \
str docsclient str docsclient
hook -group git-log-highlight global WinSetOption filetype=git-log %{ hook -group git-log-highlight global WinSetOption filetype=git-log %{
add-highlighter group git-log-highlight add-highlighter window group git-log-highlight
add-highlighter -group git-log-highlight regex '^(commit) ([0-9a-f]+)$' 1:yellow 2:red add-highlighter window/git-log-highlight regex '^(commit) ([0-9a-f]+)$' 1:yellow 2:red
add-highlighter -group git-log-highlight regex '^([a-zA-Z_-]+:) (.*?)$' 1:green 2:magenta add-highlighter window/git-log-highlight regex '^([a-zA-Z_-]+:) (.*?)$' 1:green 2:magenta
add-highlighter -group git-log-highlight ref diff # highlight potential diffs from the -p option add-highlighter window/git-log-highlight ref diff # highlight potential diffs from the -p option
} }
hook -group git-log-highlight global WinSetOption filetype=(?!git-log).* %{ remove-highlighter git-log-highlight } hook -group git-log-highlight global WinSetOption filetype=(?!git-log).* %{ remove-highlighter window/git-log-highlight }
hook -group git-status-highlight global WinSetOption filetype=git-status %{ hook -group git-status-highlight global WinSetOption filetype=git-status %{
add-highlighter group git-status-highlight add-highlighter window group git-status-highlight
add-highlighter -group git-status-highlight regex '^\h+(?:((?:both )?modified:)|(added:|new file:)|(deleted(?: by \w+)?:)|(renamed:)|(copied:))(?:.*?)$' 1:yellow 2:green 3:red 4:cyan 5:blue 6:magenta add-highlighter window/git-status-highlight 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 -group git-status-highlight global WinSetOption filetype=(?!git-status).* %{ remove-highlighter git-status-highlight } hook -group git-status-highlight global WinSetOption filetype=(?!git-status).* %{ remove-highlighter window/git-status-highlight }
decl -hidden line-specs git_blame_flags decl -hidden line-specs git_blame_flags
decl -hidden line-specs git_diff_flags decl -hidden line-specs git_diff_flags
@ -56,7 +56,7 @@ Available commands:\n-add\n-rm\n-blame\n-commit\n-checkout\n-diff\n-hide-blame\n
run_git_blame() { run_git_blame() {
( (
printf %s "eval -client '$kak_client' %{ printf %s "eval -client '$kak_client' %{
try %{ add-highlighter flag_lines GitBlame git_blame_flags } try %{ add-highlighter window flag_lines GitBlame git_blame_flags }
set buffer=$kak_bufname git_blame_flags '$kak_timestamp' set buffer=$kak_bufname git_blame_flags '$kak_timestamp'
}" | kak -p ${kak_session} }" | kak -p ${kak_session}
git blame "$@" --incremental ${kak_buffile} | awk ' git blame "$@" --incremental ${kak_buffile} | awk '
@ -143,11 +143,11 @@ Available commands:\n-add\n-rm\n-blame\n-commit\n-checkout\n-diff\n-hide-blame\n
hide-blame) hide-blame)
printf %s "try %{ printf %s "try %{
set buffer=$kak_bufname git_blame_flags '' set buffer=$kak_bufname git_blame_flags ''
remove-highlighter hlflags_git_blame_flags remove-highlighter window/hlflags_git_blame_flags
}" }"
;; ;;
show-diff) show-diff)
echo 'try %{ add-highlighter flag_lines GitDiffFlags git_diff_flags }' echo 'try %{ add-highlighter window flag_lines GitDiffFlags git_diff_flags }'
update_diff update_diff
;; ;;
update-diff) update_diff ;; update-diff) update_diff ;;

View File

@ -11,7 +11,7 @@ hook global BufCreate .*[.](haml) %{
# Highlighters # Highlighters
# ‾‾‾‾‾‾‾‾‾‾‾‾ # ‾‾‾‾‾‾‾‾‾‾‾‾
add-highlighter -group / regions -default code haml \ add-highlighter shared/ regions -default code haml \
comment ^\h*/ $ '' \ comment ^\h*/ $ '' \
eval ^\h*%([A-Za-z][A-Za-z0-9_-]*)([#.][A-Za-z][A-Za-z0-9_-]*)?\{\K|#\{\K (?=\}) \{ \ eval ^\h*%([A-Za-z][A-Za-z0-9_-]*)([#.][A-Za-z][A-Za-z0-9_-]*)?\{\K|#\{\K (?=\}) \{ \
eval ^\h*[=-]\K (?<!\|)(?=\n) '' \ eval ^\h*[=-]\K (?<!\|)(?=\n) '' \
@ -21,14 +21,14 @@ add-highlighter -group / regions -default code haml
# Filters # Filters
# http://haml.info/docs/yardoc/file.REFERENCE.html#filters # http://haml.info/docs/yardoc/file.REFERENCE.html#filters
add-highlighter -group /haml/comment fill comment add-highlighter shared/haml/comment fill comment
add-highlighter -group /haml/eval ref ruby add-highlighter shared/haml/eval ref ruby
add-highlighter -group /haml/coffee ref coffee add-highlighter shared/haml/coffee ref coffee
add-highlighter -group /haml/sass ref sass add-highlighter shared/haml/sass ref sass
add-highlighter -group /haml/code regex ^\h*(:[a-z]+|-|=)|^(!!!)$ 0:meta add-highlighter shared/haml/code regex ^\h*(:[a-z]+|-|=)|^(!!!)$ 0:meta
add-highlighter -group /haml/code regex ^\h*%([A-Za-z][A-Za-z0-9_-]*)([#.][A-Za-z][A-Za-z0-9_-]*)? 1:keyword 2:variable add-highlighter shared/haml/code regex ^\h*%([A-Za-z][A-Za-z0-9_-]*)([#.][A-Za-z][A-Za-z0-9_-]*)? 1:keyword 2:variable
# Commands # Commands
# ‾‾‾‾‾‾‾‾ # ‾‾‾‾‾‾‾‾
@ -54,14 +54,14 @@ def -hidden haml-indent-on-new-line %{
# Initialization # Initialization
# ‾‾‾‾‾‾‾‾‾‾‾‾‾‾ # ‾‾‾‾‾‾‾‾‾‾‾‾‾‾
hook -group haml-highlight global WinSetOption filetype=haml %{ add-highlighter ref haml } hook -group haml-highlight global WinSetOption filetype=haml %{ add-highlighter window ref haml }
hook global WinSetOption filetype=haml %{ hook global WinSetOption filetype=haml %{
hook window InsertEnd .* -group haml-hooks haml-filter-around-selections hook window InsertEnd .* -group haml-hooks haml-filter-around-selections
hook window InsertChar \n -group haml-indent haml-indent-on-new-line hook window InsertChar \n -group haml-indent haml-indent-on-new-line
} }
hook -group haml-highlight global WinSetOption filetype=(?!haml).* %{ remove-highlighter haml } hook -group haml-highlight global WinSetOption filetype=(?!haml).* %{ remove-highlighter window/haml }
hook global WinSetOption filetype=(?!haml).* %{ hook global WinSetOption filetype=(?!haml).* %{
remove-hooks window haml-indent remove-hooks window haml-indent

View File

@ -11,25 +11,25 @@ hook global BufCreate .*[.](hbs) %{
# Highlighters # Highlighters
# ‾‾‾‾‾‾‾‾‾‾‾‾ # ‾‾‾‾‾‾‾‾‾‾‾‾
add-highlighter -group / regions -default html hbs \ add-highlighter shared/ regions -default html hbs \
comment \{\{!-- --\}\} '' \ comment \{\{!-- --\}\} '' \
comment \{\{! \}\} '' \ comment \{\{! \}\} '' \
block-expression \{\{ \}\} '' block-expression \{\{ \}\} ''
add-highlighter -group /hbs/html ref html add-highlighter shared/hbs/html ref html
add-highlighter -group /hbs/comment fill comment add-highlighter shared/hbs/comment fill comment
add-highlighter -group /hbs/block-expression regex \{\{((#|/|)(\w|-)+) 1:meta add-highlighter shared/hbs/block-expression regex \{\{((#|/|)(\w|-)+) 1:meta
# some hbs tags have a special meaning # some hbs tags have a special meaning
add-highlighter -group /hbs/block-expression regex \{\{((#|/|)(if|else|unless|with|lookup|log)) 1:keyword add-highlighter shared/hbs/block-expression regex \{\{((#|/|)(if|else|unless|with|lookup|log)) 1:keyword
# 'each' is special as it really is two words 'each' and 'as' # 'each' is special as it really is two words 'each' and 'as'
add-highlighter -group /hbs/block-expression regex \{\{((#|/|)((each).*(as))) 2:keyword 4:keyword 5:keyword add-highlighter shared/hbs/block-expression regex \{\{((#|/|)((each).*(as))) 2:keyword 4:keyword 5:keyword
add-highlighter -group /hbs/block-expression regex ((\w|-)+)= 1:attribute add-highlighter shared/hbs/block-expression regex ((\w|-)+)= 1:attribute
# highlight the string values of attributes as a bonus # highlight the string values of attributes as a bonus
add-highlighter -group /hbs/block-expression regex ((\w|-)+)=(('|").*?('|")) 1:attribute 3:value add-highlighter shared/hbs/block-expression regex ((\w|-)+)=(('|").*?('|")) 1:attribute 3:value
# Commands # Commands
# ‾‾‾‾‾‾‾‾ # ‾‾‾‾‾‾‾‾
@ -56,7 +56,7 @@ def -hidden hbs-indent-on-new-line %{
# ‾‾‾‾‾‾‾‾‾‾‾‾‾‾ # ‾‾‾‾‾‾‾‾‾‾‾‾‾‾
hook -group hbs-highlight global WinSetOption filetype=hbs %{ hook -group hbs-highlight global WinSetOption filetype=hbs %{
add-highlighter ref hbs add-highlighter window ref hbs
} }
hook global WinSetOption filetype=hbs %{ hook global WinSetOption filetype=hbs %{
@ -65,7 +65,7 @@ hook global WinSetOption filetype=hbs %{
} }
hook -group hbs-highlight global WinSetOption filetype=(?!hbs).* %{ hook -group hbs-highlight global WinSetOption filetype=(?!hbs).* %{
remove-highlighter hbs remove-highlighter window/hbs
} }
hook global WinSetOption filetype=(?!hbs).* %{ hook global WinSetOption filetype=(?!hbs).* %{

View File

@ -2,29 +2,29 @@ hook global BufCreate .*\.ks %{
set buffer filetype kickstart set buffer filetype kickstart
} }
add-highlighter -group / regions -default code kickstart \ add-highlighter shared/ regions -default code kickstart \
comment '(^|\h)\K#' $ '' \ comment '(^|\h)\K#' $ '' \
double_string '"' (?<!\\)(\\\\)*" '' \ double_string '"' (?<!\\)(\\\\)*" '' \
single_string "'" (?<!\\)(\\\\)*' '' \ single_string "'" (?<!\\)(\\\\)*' '' \
packages '^\h*\K%packages\b' '^\h*\K%end\b' '' \ packages '^\h*\K%packages\b' '^\h*\K%end\b' '' \
shell '^\h*\K%(pre|pre-install|post)\b' '^\h*\K%end\b' '' shell '^\h*\K%(pre|pre-install|post)\b' '^\h*\K%end\b' ''
add-highlighter -group /kickstart/code regex "^\h*\b(auth|authconfig|autopart|autostep|bootloader|btrfs|clearpart|cmdline|device|dmraid|driverdisk|fcoe|firewall|firstboot|group|graphical|halt|ignoredisk|install|cdrom|harddrive|liveimg|nfs|url|iscsi|iscsiname|keyboard|lang|logvol|logging|mediacheck|monitor|multipath|network|part|partition|poweroff|raid|realm|reboot|repo|rescue|rootpw|selinux|services|shutdown|sshkey|sshpw|skipx|text|timezone|updates|upgrade|user|vnc|volgroup|xconfig|zerombr|zfcp)\b" 1:keyword add-highlighter shared/kickstart/code regex "^\h*\b(auth|authconfig|autopart|autostep|bootloader|btrfs|clearpart|cmdline|device|dmraid|driverdisk|fcoe|firewall|firstboot|group|graphical|halt|ignoredisk|install|cdrom|harddrive|liveimg|nfs|url|iscsi|iscsiname|keyboard|lang|logvol|logging|mediacheck|monitor|multipath|network|part|partition|poweroff|raid|realm|reboot|repo|rescue|rootpw|selinux|services|shutdown|sshkey|sshpw|skipx|text|timezone|updates|upgrade|user|vnc|volgroup|xconfig|zerombr|zfcp)\b" 1:keyword
add-highlighter -group /kickstart/code regex '(--[\w-]+=? ?)([^-"\n][^\h\n]*)?' 1:attribute 2:string add-highlighter shared/kickstart/code regex '(--[\w-]+=? ?)([^-"\n][^\h\n]*)?' 1:attribute 2:string
add-highlighter -group /kickstart/code regex '%(include|ksappend)\b' 0:keyword add-highlighter shared/kickstart/code regex '%(include|ksappend)\b' 0:keyword
add-highlighter -group /kickstart/comment fill comment add-highlighter shared/kickstart/comment fill comment
add-highlighter -group /kickstart/single_string fill string add-highlighter shared/kickstart/single_string fill string
add-highlighter -group /kickstart/double_string fill string add-highlighter shared/kickstart/double_string fill string
add-highlighter -group /kickstart/packages regex "^\h*[\w-]*" 0:value add-highlighter shared/kickstart/packages regex "^\h*[\w-]*" 0:value
add-highlighter -group /kickstart/packages regex "#[^\n]*" 0:comment add-highlighter shared/kickstart/packages regex "#[^\n]*" 0:comment
add-highlighter -group /kickstart/packages regex "^\h*@\^?[\h\w-]*" 0:attribute add-highlighter shared/kickstart/packages regex "^\h*@\^?[\h\w-]*" 0:attribute
add-highlighter -group /kickstart/packages regex '\A\h*\K%packages\b' 0:type add-highlighter shared/kickstart/packages regex '\A\h*\K%packages\b' 0:type
add-highlighter -group /kickstart/packages regex '^\h*%end\b' 0:type add-highlighter shared/kickstart/packages regex '^\h*%end\b' 0:type
add-highlighter -group /kickstart/shell regex '\A\h*\K%(pre-install|pre|post)\b' 0:type add-highlighter shared/kickstart/shell regex '\A\h*\K%(pre-install|pre|post)\b' 0:type
add-highlighter -group /kickstart/shell regex '^\h*%end\b' 0:type add-highlighter shared/kickstart/shell regex '^\h*%end\b' 0:type
add-highlighter -group /kickstart/shell ref sh add-highlighter shared/kickstart/shell ref sh
hook -group kickstart-highlight global WinSetOption filetype=kickstart %{ add-highlighter ref kickstart } hook -group kickstart-highlight global WinSetOption filetype=kickstart %{ add-highlighter window ref kickstart }
hook -group kickstart-highlight global WinSetOption filetype=(?!kickstart).* %{ remove-highlighter kickstart } hook -group kickstart-highlight global WinSetOption filetype=(?!kickstart).* %{ remove-highlighter window/kickstart }

View File

@ -11,24 +11,24 @@ hook global BufCreate .*\.tex %{
# Highlighters # Highlighters
# ‾‾‾‾‾‾‾‾‾‾‾‾ # ‾‾‾‾‾‾‾‾‾‾‾‾
add-highlighter -group / regions -default content latex \ add-highlighter shared/ regions -default content latex \
comment '(?<!\\)%' '\n' '' comment '(?<!\\)%' '\n' ''
add-highlighter -group /latex/comment fill comment add-highlighter shared/latex/comment fill comment
# Scopes, starting with a backslash # Scopes, starting with a backslash
add-highlighter -group /latex/content regex '\\(?!_)\w+\b' 0:keyword add-highlighter shared/latex/content regex '\\(?!_)\w+\b' 0:keyword
# Options passed to scopes, between brackets # Options passed to scopes, between brackets
add-highlighter -group /latex/content regex '\\(?!_)\w+\b\[([^\]]+)\]' 1:value add-highlighter shared/latex/content regex '\\(?!_)\w+\b\[([^\]]+)\]' 1:value
# Content between dollar signs/pairs # Content between dollar signs/pairs
add-highlighter -group /latex/content regex '(\$(\\\$|[^$])+\$)|(\$\$(\\\$|[^$])+\$\$)' 0:magenta add-highlighter shared/latex/content regex '(\$(\\\$|[^$])+\$)|(\$\$(\\\$|[^$])+\$\$)' 0:magenta
# Emphasized text # Emphasized text
add-highlighter -group /latex/content regex '\\(emph|textit)\{([^}]+)\}' 2:default+i add-highlighter shared/latex/content regex '\\(emph|textit)\{([^}]+)\}' 2:default+i
# Bold text # Bold text
add-highlighter -group /latex/content regex '\\textbf\{([^}]+)\}' 1:default+b add-highlighter shared/latex/content regex '\\textbf\{([^}]+)\}' 1:default+b
# Initialization # Initialization
# ‾‾‾‾‾‾‾‾‾‾‾‾‾‾ # ‾‾‾‾‾‾‾‾‾‾‾‾‾‾
hook -group latex-highlight global WinSetOption filetype=latex %{ add-highlighter ref latex } hook -group latex-highlight global WinSetOption filetype=latex %{ add-highlighter window ref latex }
hook -group latex-highlight global WinSetOption filetype=(?!latex).* %{ remove-highlighter latex } hook -group latex-highlight global WinSetOption filetype=(?!latex).* %{ remove-highlighter window/latex }

View File

@ -11,21 +11,21 @@ hook global BufCreate .*[.](moon) %{
# Highlighters # Highlighters
# ‾‾‾‾‾‾‾‾‾‾‾‾ # ‾‾‾‾‾‾‾‾‾‾‾‾
add-highlighter -group / regions -default code moon \ add-highlighter shared/ regions -default code moon \
double_string '"' (?<!\\)(\\\\)*" '' \ double_string '"' (?<!\\)(\\\\)*" '' \
single_string "'" (?<!\\)(\\\\)*' '' \ single_string "'" (?<!\\)(\\\\)*' '' \
comment '--' '$' '' \ comment '--' '$' '' \
add-highlighter -group /moon/double_string fill string add-highlighter shared/moon/double_string fill string
add-highlighter -group /moon/double_string regions regions interpolation \Q#{ \} \{ add-highlighter shared/moon/double_string regions regions interpolation \Q#{ \} \{
add-highlighter -group /moon/double_string/regions/interpolation fill meta add-highlighter shared/moon/double_string/regions/interpolation fill meta
add-highlighter -group /moon/single_string fill string add-highlighter shared/moon/single_string fill string
add-highlighter -group /moon/comment fill comment add-highlighter shared/moon/comment fill comment
add-highlighter -group /moon/code regex ([.\\](?=[A-Za-z]))|(\b[A-Za-z]\w*:)|(\b[A-Za-z]\w*\K!+)|(\W\K[@:][A-Za-z]\w*) 0:variable add-highlighter shared/moon/code regex ([.\\](?=[A-Za-z]))|(\b[A-Za-z]\w*:)|(\b[A-Za-z]\w*\K!+)|(\W\K[@:][A-Za-z]\w*) 0:variable
add-highlighter -group /moon/code regex \b(and|break|catch|class|continue|do|else(if)?|export|extends|false|finally|for|from|if|import|in|local|nil|not|or|return|super|switch|then|true|try|unless|using|when|while|with)\b 0:keyword add-highlighter shared/moon/code regex \b(and|break|catch|class|continue|do|else(if)?|export|extends|false|finally|for|from|if|import|in|local|nil|not|or|return|super|switch|then|true|try|unless|using|when|while|with)\b 0:keyword
# Commands # Commands
# ‾‾‾‾‾‾‾‾ # ‾‾‾‾‾‾‾‾
@ -92,7 +92,7 @@ def -hidden moon-indent-on-new-line %{
# Initialization # Initialization
# ‾‾‾‾‾‾‾‾‾‾‾‾‾‾ # ‾‾‾‾‾‾‾‾‾‾‾‾‾‾
hook -group moon-highlight global WinSetOption filetype=moon %{ add-highlighter ref moon } hook -group moon-highlight global WinSetOption filetype=moon %{ add-highlighter window ref moon }
hook global WinSetOption filetype=moon %{ hook global WinSetOption filetype=moon %{
hook window InsertEnd .* -group moon-hooks moon-filter-around-selections hook window InsertEnd .* -group moon-hooks moon-filter-around-selections
@ -102,7 +102,7 @@ hook global WinSetOption filetype=moon %{
alias window alt moon-alternative-file alias window alt moon-alternative-file
} }
hook -group moon-highlight global WinSetOption filetype=(?!moon).* %{ remove-highlighter moon } hook -group moon-highlight global WinSetOption filetype=(?!moon).* %{ remove-highlighter window/moon }
hook global WinSetOption filetype=(?!moon).* %{ hook global WinSetOption filetype=(?!moon).* %{
remove-hooks window moon-indent remove-hooks window moon-indent

View File

@ -8,26 +8,26 @@ hook global BufCreate .*[.](php) %{
# Highlighters # Highlighters
# ‾‾‾‾‾‾‾‾‾‾‾‾ # ‾‾‾‾‾‾‾‾‾‾‾‾
add-highlighter -group / regions -default code php \ add-highlighter shared/ regions -default code php \
double_string '"' (?<!\\)(\\\\)*" '' \ double_string '"' (?<!\\)(\\\\)*" '' \
single_string "'" (?<!\\)(\\\\)*' '' \ single_string "'" (?<!\\)(\\\\)*' '' \
comment // '$' '' \ comment // '$' '' \
comment /\* \*/ '' \ comment /\* \*/ '' \
comment '#' '$' '' comment '#' '$' ''
add-highlighter -group /php/double_string fill string add-highlighter shared/php/double_string fill string
add-highlighter -group /php/single_string fill string add-highlighter shared/php/single_string fill string
add-highlighter -group /php/comment fill comment add-highlighter shared/php/comment fill comment
add-highlighter -group /php/code regex \$\w* 0:variable add-highlighter shared/php/code regex \$\w* 0:variable
add-highlighter -group /php/code regex \b(false|null|parent|self|this|true)\b 0:value add-highlighter shared/php/code regex \b(false|null|parent|self|this|true)\b 0:value
add-highlighter -group /php/code regex "-?[0-9]*\.?[0-9]+" 0:value add-highlighter shared/php/code regex "-?[0-9]*\.?[0-9]+" 0:value
add-highlighter -group /php/code regex \b((string|int|bool)|[A-Z][a-z].*?)\b 0:type add-highlighter shared/php/code regex \b((string|int|bool)|[A-Z][a-z].*?)\b 0:type
add-highlighter -group /php/code regex \B/[^\n/]+/[gimy]* 0:meta add-highlighter shared/php/code regex \B/[^\n/]+/[gimy]* 0:meta
# Keywords are collected at # Keywords are collected at
# http://php.net/manual/en/reserved.keywords.php # http://php.net/manual/en/reserved.keywords.php
add-highlighter -group /php/code regex \b(__halt_compiler|abstract|and|array|as|break|callable|case|catch|class|clone|const|continue|declare|default|die|do|echo|else|elseif|empty|enddeclare|endfor|endforeach|endif|endswitch|endwhile|eval|exit|extends|final|finally|for|foreach|function|global|goto|if|implements|include|include_once|instanceof|insteadof|interface|isset|list|namespace|new|or|print|private|protected|public|require|require_once|return|static|switch|throw|trait|try|unset|use|var|while|xor|yield|__CLASS__|__DIR__|__FILE__|__FUNCTION__|__LINE__|__METHOD__|__NAMESPACE__|__TRAIT__)\b 0:keyword add-highlighter shared/php/code regex \b(__halt_compiler|abstract|and|array|as|break|callable|case|catch|class|clone|const|continue|declare|default|die|do|echo|else|elseif|empty|enddeclare|endfor|endforeach|endif|endswitch|endwhile|eval|exit|extends|final|finally|for|foreach|function|global|goto|if|implements|include|include_once|instanceof|insteadof|interface|isset|list|namespace|new|or|print|private|protected|public|require|require_once|return|static|switch|throw|trait|try|unset|use|var|while|xor|yield|__CLASS__|__DIR__|__FILE__|__FUNCTION__|__LINE__|__METHOD__|__NAMESPACE__|__TRAIT__)\b 0:keyword
# Commands # Commands
# ‾‾‾‾‾‾‾‾ # ‾‾‾‾‾‾‾‾
@ -60,7 +60,7 @@ def -hidden php-indent-on-new-line %<
# Initialization # Initialization
# ‾‾‾‾‾‾‾‾‾‾‾‾‾‾ # ‾‾‾‾‾‾‾‾‾‾‾‾‾‾
hook -group php-highlight global WinSetOption filetype=php %{ add-highlighter ref php } hook -group php-highlight global WinSetOption filetype=php %{ add-highlighter window ref php }
hook global WinSetOption filetype=php %{ hook global WinSetOption filetype=php %{
hook window InsertEnd .* -group php-hooks php-filter-around-selections hook window InsertEnd .* -group php-hooks php-filter-around-selections
@ -68,7 +68,7 @@ hook global WinSetOption filetype=php %{
hook window InsertChar \n -group php-indent php-indent-on-new-line hook window InsertChar \n -group php-indent php-indent-on-new-line
} }
hook -group php-highlight global WinSetOption filetype=(?!php).* %{ remove-highlighter php } hook -group php-highlight global WinSetOption filetype=(?!php).* %{ remove-highlighter window/php }
hook global WinSetOption filetype=(?!php).* %{ hook global WinSetOption filetype=(?!php).* %{
remove-hooks window php-indent remove-hooks window php-indent

View File

@ -11,15 +11,15 @@ hook global BufCreate .*[.](pony) %{
# Highlighters & Completion # Highlighters & Completion
# ‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾ # ‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾
addhl -group / regions -default code pony \ addhl shared/ regions -default code pony \
double_string '"""' '"""' '' \ double_string '"""' '"""' '' \
double_string '"' (?<!\\)(\\\\)*" '' \ double_string '"' (?<!\\)(\\\\)*" '' \
comment '/\*' '\*/' '' \ comment '/\*' '\*/' '' \
comment '//' '$' '' comment '//' '$' ''
addhl -group /pony/double_string fill string addhl shared/pony/double_string fill string
# addhl -group /pony/single_string fill string # addhl shared/pony/single_string fill string
addhl -group /pony/comment fill comment addhl shared/pony/comment fill comment
%sh{ %sh{
@ -43,21 +43,21 @@ addhl -group /pony/comment fill comment
# Highlight keywords # Highlight keywords
printf %s " printf %s "
addhl -group /pony/code regex '\b(${values})\b' 0:value addhl shared/pony/code regex '\b(${values})\b' 0:value
addhl -group /pony/code regex '\b(${meta})\b' 0:meta addhl shared/pony/code regex '\b(${meta})\b' 0:meta
addhl -group /pony/code regex '\b(${func_decl})(\s+(${capabilities}))?(\s+\w+)\(' 1:type 3:builtin 4:builtin addhl shared/pony/code regex '\b(${func_decl})(\s+(${capabilities}))?(\s+\w+)\(' 1:type 3:builtin 4:builtin
addhl -group /pony/code regex '\b(${func_decl})\b' 0:type addhl shared/pony/code regex '\b(${func_decl})\b' 0:type
addhl -group /pony/code regex '=>' 0:type addhl shared/pony/code regex '=>' 0:type
addhl -group /pony/code regex '\b(${keywords})\b' 0:keyword addhl shared/pony/code regex '\b(${keywords})\b' 0:keyword
addhl -group /pony/code regex ';' 0:keyword addhl shared/pony/code regex ';' 0:keyword
addhl -group /pony/code regex '^\s*|' 0:keyword addhl shared/pony/code regex '^\s*|' 0:keyword
addhl -group /pony/code regex '\b(${struct})\b' 0:variable addhl shared/pony/code regex '\b(${struct})\b' 0:variable
addhl -group /pony/code regex '\b(${capabilities})\b(!|^)?' 1:builtin 2:builtin addhl shared/pony/code regex '\b(${capabilities})\b(!|^)?' 1:builtin 2:builtin
" "
# Highlight types and attributes # Highlight types and attributes
printf %s " printf %s "
addhl -group /pony/code regex '@[\w_]+\b' 0:attribute addhl shared/pony/code regex '@[\w_]+\b' 0:attribute
" "
} }
@ -82,7 +82,7 @@ def -hidden pony-indent-on-new-line %{
# Initialization # Initialization
# ‾‾‾‾‾‾‾‾‾‾‾‾‾‾ # ‾‾‾‾‾‾‾‾‾‾‾‾‾‾
hook -group pony-highlight global WinSetOption filetype=pony %{ addhl ref pony } hook -group pony-highlight global WinSetOption filetype=pony %{ addhl window ref pony }
hook global WinSetOption filetype=pony %{ hook global WinSetOption filetype=pony %{
hook window InsertChar \n -group pony-indent pony-indent-on-new-line hook window InsertChar \n -group pony-indent pony-indent-on-new-line

View File

@ -15,7 +15,7 @@ hook global BufCreate .*[.](pug|jade) %{
# Highlighters # Highlighters
# ‾‾‾‾‾‾‾‾‾‾‾‾ # ‾‾‾‾‾‾‾‾‾‾‾‾
add-highlighter -group / regions -default code pug \ add-highlighter shared/ regions -default code pug \
text ^\h*\|\s $ '' \ text ^\h*\|\s $ '' \
text '^\h*([A-Za-z][A-Za-z0-9_-]*)?(#[A-Za-z][A-Za-z0-9_-]*)?((?:\.[A-Za-z][A-Za-z0-9_-]*)*)?(?<!\t)(?<! )(?<!\n)\h+\K.*' $ '' \ text '^\h*([A-Za-z][A-Za-z0-9_-]*)?(#[A-Za-z][A-Za-z0-9_-]*)?((?:\.[A-Za-z][A-Za-z0-9_-]*)*)?(?<!\t)(?<! )(?<!\n)\h+\K.*' $ '' \
javascript ^\h*[-=!] $ '' \ javascript ^\h*[-=!] $ '' \
@ -28,18 +28,18 @@ add-highlighter -group / regions -default code pug \
# Filters # Filters
# ‾‾‾‾‾‾‾ # ‾‾‾‾‾‾‾
add-highlighter -group /pug/double_string fill string add-highlighter shared/pug/double_string fill string
add-highlighter -group /pug/single_string fill string add-highlighter shared/pug/single_string fill string
add-highlighter -group /pug/comment fill comment add-highlighter shared/pug/comment fill comment
add-highlighter -group /pug/javascript ref javascript add-highlighter shared/pug/javascript ref javascript
add-highlighter -group /pug/attribute ref javascript add-highlighter shared/pug/attribute ref javascript
add-highlighter -group /pug/puglang ref javascript add-highlighter shared/pug/puglang ref javascript
add-highlighter -group /pug/puglang regex \b(\block|extends|include|append|prepend|if|unless|else|case|when|default|each|while|mixin|of|in)\b 0:keyword add-highlighter shared/pug/puglang regex \b(\block|extends|include|append|prepend|if|unless|else|case|when|default|each|while|mixin|of|in)\b 0:keyword
add-highlighter -group /pug/attribute regex [()=] 0:operator add-highlighter shared/pug/attribute regex [()=] 0:operator
add-highlighter -group /pug/text regex \h*(\|) 1:meta add-highlighter shared/pug/text regex \h*(\|) 1:meta
add-highlighter -group /pug/code regex ^\h*([A-Za-z][A-Za-z0-9_-]*) 1:type add-highlighter shared/pug/code regex ^\h*([A-Za-z][A-Za-z0-9_-]*) 1:type
add-highlighter -group /pug/code regex '(#[A-Za-z][A-Za-z0-9_-]*)' 1:variable add-highlighter shared/pug/code regex '(#[A-Za-z][A-Za-z0-9_-]*)' 1:variable
add-highlighter -group /pug/code regex ((?:\.[A-Za-z][A-Za-z0-9_-]*)*) 1:value add-highlighter shared/pug/code regex ((?:\.[A-Za-z][A-Za-z0-9_-]*)*) 1:value
# Commands # Commands
# ‾‾‾‾‾‾‾‾ # ‾‾‾‾‾‾‾‾
@ -65,14 +65,14 @@ def -hidden pug-indent-on-new-line %{
# Initialization # Initialization
# ‾‾‾‾‾‾‾‾‾‾‾‾‾‾ # ‾‾‾‾‾‾‾‾‾‾‾‾‾‾
hook -group pug-highlight global WinSetOption filetype=pug %{ add-highlighter ref pug } hook -group pug-highlight global WinSetOption filetype=pug %{ add-highlighter window ref pug }
hook global WinSetOption filetype=pug %{ hook global WinSetOption filetype=pug %{
hook window InsertEnd .* -group pug-hooks pug-filter-around-selections hook window InsertEnd .* -group pug-hooks pug-filter-around-selections
hook window InsertChar \n -group pug-indent pug-indent-on-new-line hook window InsertChar \n -group pug-indent pug-indent-on-new-line
} }
hook -group pug-highlight global WinSetOption filetype=(?!pug).* %{ remove-highlighter pug } hook -group pug-highlight global WinSetOption filetype=(?!pug).* %{ remove-highlighter window/pug }
hook global WinSetOption filetype=(?!pug).* %{ hook global WinSetOption filetype=(?!pug).* %{
remove-hooks window pug-indent remove-hooks window pug-indent

View File

@ -13,18 +13,18 @@ hook global BufCreate .*[.](ragel|rl) %{
# Highlighters # Highlighters
# ‾‾‾‾‾‾‾‾‾‾‾‾ # ‾‾‾‾‾‾‾‾‾‾‾‾
add-highlighter -group / regions -default code ragel \ add-highlighter shared/ regions -default code ragel \
string '"' (?<!\\)(\\\\)*" '' \ string '"' (?<!\\)(\\\\)*" '' \
string "'" "'" '' \ string "'" "'" '' \
comment '#' '$' '' comment '#' '$' ''
add-highlighter -group /ragel/string fill string add-highlighter shared/ragel/string fill string
add-highlighter -group /ragel/comment fill comment add-highlighter shared/ragel/comment fill comment
add-highlighter -group /ragel/code regex \b(true|false)\b 0:value add-highlighter shared/ragel/code regex \b(true|false)\b 0:value
add-highlighter -group /ragel/code regex '%%\{|\}%%|<\w+>' 0:variable add-highlighter shared/ragel/code regex '%%\{|\}%%|<\w+>' 0:variable
add-highlighter -group /ragel/code regex :=|=>|->|:>|:>>|<: 0:operator add-highlighter shared/ragel/code regex :=|=>|->|:>|:>>|<: 0:operator
add-highlighter -group /ragel/code regex \b(action|alnum|alpha|any|ascii|case|cntrl|contained|context|data|digit|empty|eof|err|error|exec|export|exports|extend|fblen|fbreak|fbuf|fc|fcall|fcurs|fentry|fexec|fgoto|fhold|first_final|fnext|fpc|fret|from|fstack|ftargs|graph|import|include|init|inwhen|lerr|lower|machine|nocs|noend|noerror|nofinal|noprefix|outwhen|postpop|prepush|print|punct|range|space|start|to|upper|when|write|xdigit|zlen)\b 0:keyword add-highlighter shared/ragel/code regex \b(action|alnum|alpha|any|ascii|case|cntrl|contained|context|data|digit|empty|eof|err|error|exec|export|exports|extend|fblen|fbreak|fbuf|fc|fcall|fcurs|fentry|fexec|fgoto|fhold|first_final|fnext|fpc|fret|from|fstack|ftargs|graph|import|include|init|inwhen|lerr|lower|machine|nocs|noend|noerror|nofinal|noprefix|outwhen|postpop|prepush|print|punct|range|space|start|to|upper|when|write|xdigit|zlen)\b 0:keyword
# Commands # Commands
# ‾‾‾‾‾‾‾‾ # ‾‾‾‾‾‾‾‾
@ -58,7 +58,7 @@ def -hidden ragel-indent-on-new-line %<
# Initialization # Initialization
# ‾‾‾‾‾‾‾‾‾‾‾‾‾‾ # ‾‾‾‾‾‾‾‾‾‾‾‾‾‾
hook -group ragel-highlight global WinSetOption filetype=ragel %{ add-highlighter ref ragel } hook -group ragel-highlight global WinSetOption filetype=ragel %{ add-highlighter window ref ragel }
hook global WinSetOption filetype=ragel %{ hook global WinSetOption filetype=ragel %{
hook window InsertEnd .* -group ragel-hooks ragel-filter-around-selections hook window InsertEnd .* -group ragel-hooks ragel-filter-around-selections
@ -66,7 +66,7 @@ hook global WinSetOption filetype=ragel %{
hook window InsertChar \n -group ragel-indent ragel-indent-on-new-line hook window InsertChar \n -group ragel-indent ragel-indent-on-new-line
} }
hook -group ragel-highlight global WinSetOption filetype=(?!ragel).* %{ remove-highlighter ragel } hook -group ragel-highlight global WinSetOption filetype=(?!ragel).* %{ remove-highlighter window/ragel }
hook global WinSetOption filetype=(?!ragel).* %{ hook global WinSetOption filetype=(?!ragel).* %{
remove-hooks window ragel-indent remove-hooks window ragel-indent

View File

@ -11,20 +11,20 @@ hook global BufCreate .*[.](sass) %{
# Highlighters # Highlighters
# ‾‾‾‾‾‾‾‾‾‾‾‾ # ‾‾‾‾‾‾‾‾‾‾‾‾
add-highlighter -group / regions -default code sass \ add-highlighter shared/ regions -default code sass \
string '"' (?<!\\)(\\\\)*" '' \ string '"' (?<!\\)(\\\\)*" '' \
string "'" "'" '' \ string "'" "'" '' \
comment '/' '$' '' comment '/' '$' ''
add-highlighter -group /sass/string fill string add-highlighter shared/sass/string fill string
add-highlighter -group /sass/comment fill comment add-highlighter shared/sass/comment fill comment
add-highlighter -group /sass/code regex [*]|[#.][A-Za-z][A-Za-z0-9_-]* 0:variable add-highlighter shared/sass/code regex [*]|[#.][A-Za-z][A-Za-z0-9_-]* 0:variable
add-highlighter -group /sass/code regex &|@[A-Za-z][A-Za-z0-9_-]* 0:meta add-highlighter shared/sass/code regex &|@[A-Za-z][A-Za-z0-9_-]* 0:meta
add-highlighter -group /sass/code regex (#[0-9A-Fa-f]+)|((\d*\.)?\d+(em|px)) 0:value add-highlighter shared/sass/code regex (#[0-9A-Fa-f]+)|((\d*\.)?\d+(em|px)) 0:value
add-highlighter -group /sass/code regex ([A-Za-z][A-Za-z0-9_-]*)\h*: 1:keyword add-highlighter shared/sass/code regex ([A-Za-z][A-Za-z0-9_-]*)\h*: 1:keyword
add-highlighter -group /sass/code regex :(before|after) 0:attribute add-highlighter shared/sass/code regex :(before|after) 0:attribute
add-highlighter -group /sass/code regex !important 0:keyword add-highlighter shared/sass/code regex !important 0:keyword
# Commands # Commands
# ‾‾‾‾‾‾‾‾ # ‾‾‾‾‾‾‾‾
@ -50,14 +50,14 @@ def -hidden sass-indent-on-new-line %{
# Initialization # Initialization
# ‾‾‾‾‾‾‾‾‾‾‾‾‾‾ # ‾‾‾‾‾‾‾‾‾‾‾‾‾‾
hook -group sass-highlight global WinSetOption filetype=sass %{ add-highlighter ref sass } hook -group sass-highlight global WinSetOption filetype=sass %{ add-highlighter window ref sass }
hook global WinSetOption filetype=sass %{ hook global WinSetOption filetype=sass %{
hook window InsertEnd .* -group sass-hooks sass-filter-around-selections hook window InsertEnd .* -group sass-hooks sass-filter-around-selections
hook window InsertChar \n -group sass-indent sass-indent-on-new-line hook window InsertChar \n -group sass-indent sass-indent-on-new-line
} }
hook -group sass-highlight global WinSetOption filetype=(?!sass).* %{ remove-highlighter sass } hook -group sass-highlight global WinSetOption filetype=(?!sass).* %{ remove-highlighter window/sass }
hook global WinSetOption filetype=(?!sass).* %{ hook global WinSetOption filetype=(?!sass).* %{
remove-hooks window sass-indent remove-hooks window sass-indent

View File

@ -13,14 +13,14 @@ hook global BufCreate .*[.](scss) %{
# Highlighters # Highlighters
# ‾‾‾‾‾‾‾‾‾‾‾‾ # ‾‾‾‾‾‾‾‾‾‾‾‾
add-highlighter -group / regions -default core scss \ add-highlighter shared/ regions -default core scss \
comment // $ '' comment // $ ''
add-highlighter -group /scss/comment fill comment add-highlighter shared/scss/comment fill comment
add-highlighter -group /scss/core ref css add-highlighter shared/scss/core ref css
add-highlighter -group /scss/core regex @[A-Za-z][A-Za-z0-9_-]* 0:meta add-highlighter shared/scss/core regex @[A-Za-z][A-Za-z0-9_-]* 0:meta
# Commands # Commands
# ‾‾‾‾‾‾‾‾ # ‾‾‾‾‾‾‾‾
@ -32,7 +32,7 @@ def -hidden scss-indent-on-closing-curly-brace css-indent-on-closing-curly-brace
# Initialization # Initialization
# ‾‾‾‾‾‾‾‾‾‾‾‾‾‾ # ‾‾‾‾‾‾‾‾‾‾‾‾‾‾
hook -group scss-highlight global WinSetOption filetype=scss %{ add-highlighter ref scss } hook -group scss-highlight global WinSetOption filetype=scss %{ add-highlighter window ref scss }
hook global WinSetOption filetype=scss %[ hook global WinSetOption filetype=scss %[
hook window InsertEnd .* -group scss-hooks scss-filter-around-selections hook window InsertEnd .* -group scss-hooks scss-filter-around-selections
@ -40,7 +40,7 @@ hook global WinSetOption filetype=scss %[
hook window InsertChar \} -group scss-indent scss-indent-on-closing-curly-brace hook window InsertChar \} -group scss-indent scss-indent-on-closing-curly-brace
] ]
hook -group scss-highlight global WinSetOption filetype=(?!scss).* %{ remove-highlighter scss } hook -group scss-highlight global WinSetOption filetype=(?!scss).* %{ remove-highlighter window/scss }
hook global WinSetOption filetype=(?!scss).* %{ hook global WinSetOption filetype=(?!scss).* %{
remove-hooks window scss-indent remove-hooks window scss-indent

View File

@ -11,13 +11,13 @@ hook global BufCreate .*\.taskpaper %{
# Highlighters # Highlighters
# ‾‾‾‾‾‾‾‾‾‾‾‾ # ‾‾‾‾‾‾‾‾‾‾‾‾
add-highlighter -group / group taskpaper add-highlighter shared/ group taskpaper
add-highlighter -group /taskpaper regex ^\h*([^:\n]+):\h*\n 1:header add-highlighter shared/taskpaper regex ^\h*([^:\n]+):\h*\n 1:header
add-highlighter -group /taskpaper regex \h@\w+(?:\(([^)]*)\))? 0:variable 1:value add-highlighter shared/taskpaper regex \h@\w+(?:\(([^)]*)\))? 0:variable 1:value
add-highlighter -group /taskpaper regex ^\h*([^-:\n]+)\n 1:+i add-highlighter shared/taskpaper regex ^\h*([^-:\n]+)\n 1:+i
add-highlighter -group /taskpaper regex ^\h*-\h+[^\n]*@done[^\n]* 0:+d add-highlighter shared/taskpaper regex ^\h*-\h+[^\n]*@done[^\n]* 0:+d
add-highlighter -group /taskpaper regex (([a-z]+://\S+)|((mailto:)[\w+-]+@\S+)) 0:link add-highlighter shared/taskpaper regex (([a-z]+://\S+)|((mailto:)[\w+-]+@\S+)) 0:link
# Commands # Commands
# ‾‾‾‾‾‾‾‾ # ‾‾‾‾‾‾‾‾
@ -37,10 +37,10 @@ def -hidden taskpaper-indent-on-new-line %{
# ‾‾‾‾‾‾‾‾‾‾‾‾‾‾ # ‾‾‾‾‾‾‾‾‾‾‾‾‾‾
hook -group taskpaper-highlight global WinSetOption filetype=taskpaper %{ hook -group taskpaper-highlight global WinSetOption filetype=taskpaper %{
add-highlighter ref taskpaper add-highlighter window ref taskpaper
hook window InsertChar \n -group taskpaper-indent taskpaper-indent-on-new-line hook window InsertChar \n -group taskpaper-indent taskpaper-indent-on-new-line
} }
hook -group taskpaper-highlight global WinSetOption filetype=(?!taskpaper).* %{ hook -group taskpaper-highlight global WinSetOption filetype=(?!taskpaper).* %{
remove-highlighter taskpaper remove-highlighter window/taskpaper
remove-hooks window taskpaper-indent remove-hooks window taskpaper-indent
} }

View File

@ -11,22 +11,22 @@ hook global BufCreate (.+/)?[Tt]upfile %{
# Highlighters # Highlighters
# ‾‾‾‾‾‾‾‾‾‾‾‾ # ‾‾‾‾‾‾‾‾‾‾‾‾
add-highlighter -group / regions -default code tupfile \ add-highlighter shared/ regions -default code tupfile \
string '"' (?<!\\)(\\\\)*" '' \ string '"' (?<!\\)(\\\\)*" '' \
comment '#' $ '' comment '#' $ ''
add-highlighter -group /tupfile/string fill string add-highlighter shared/tupfile/string fill string
add-highlighter -group /tupfile/comment fill comment add-highlighter shared/tupfile/comment fill comment
add-highlighter -group /tupfile/code regex "\%[fbBeoOdg]\b" 0:value add-highlighter shared/tupfile/code regex "\%[fbBeoOdg]\b" 0:value
add-highlighter -group /tupfile/code regex "\$\([\w_]+\)" 0:value add-highlighter shared/tupfile/code regex "\$\([\w_]+\)" 0:value
add-highlighter -group /tupfile/code regex ":\s*(foreach)\b" 1:keyword add-highlighter shared/tupfile/code regex ":\s*(foreach)\b" 1:keyword
add-highlighter -group /tupfile/code regex "\.gitignore\b" 0:keyword add-highlighter shared/tupfile/code regex "\.gitignore\b" 0:keyword
add-highlighter -group /tupfile/code regex "\b(ifn?eq|ifn?def|else|endif|error|include|include_rules|run|preload|export)\b" 0:keyword add-highlighter shared/tupfile/code regex "\b(ifn?eq|ifn?def|else|endif|error|include|include_rules|run|preload|export)\b" 0:keyword
add-highlighter -group /tupfile/code regex "\b(&?[\w_]+)\s*[:+]?=" 1:keyword add-highlighter shared/tupfile/code regex "\b(&?[\w_]+)\s*[:+]?=" 1:keyword
# Initialization # Initialization
# ‾‾‾‾‾‾‾‾‾‾‾‾‾‾ # ‾‾‾‾‾‾‾‾‾‾‾‾‾‾
hook -group tupfile-highlight global WinSetOption filetype=tupfile %{ add-highlighter ref tupfile } hook -group tupfile-highlight global WinSetOption filetype=tupfile %{ add-highlighter window ref tupfile }
hook -group tupfile-highlight global WinSetOption filetype=(?!tupfile).* %{ remove-highlighter tupfile } hook -group tupfile-highlight global WinSetOption filetype=(?!tupfile).* %{ remove-highlighter window/tupfile }

View File

@ -11,7 +11,7 @@ hook global BufCreate .*[.](ts)x? %{
# Highlighters # Highlighters
# ‾‾‾‾‾‾‾‾‾‾‾‾ # ‾‾‾‾‾‾‾‾‾‾‾‾
add-highlighter -group / regions -default code typescript \ add-highlighter shared/ regions -default code typescript \
double_string '"' (?<!\\)(\\\\)*" '' \ double_string '"' (?<!\\)(\\\\)*" '' \
single_string "'" (?<!\\)(\\\\)*' '' \ single_string "'" (?<!\\)(\\\\)*' '' \
literal "`" (?<!\\)(\\\\)*` '' \ literal "`" (?<!\\)(\\\\)*` '' \
@ -23,22 +23,22 @@ add-highlighter -group / regions -default code typescript \
# Regular expression flags are: g → global match, i → ignore case, m → multi-lines, u → unicode, y → sticky # Regular expression flags are: g → global match, i → ignore case, m → multi-lines, u → unicode, y → sticky
# https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp # https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp
add-highlighter -group /typescript/double_string ref javascript/double_string add-highlighter shared/typescript/double_string ref javascript/double_string
add-highlighter -group /typescript/single_string ref javascript/single_string add-highlighter shared/typescript/single_string ref javascript/single_string
add-highlighter -group /typescript/regex ref javascript/regex add-highlighter shared/typescript/regex ref javascript/regex
add-highlighter -group /typescript/comment ref javascript/comment add-highlighter shared/typescript/comment ref javascript/comment
add-highlighter -group /typescript/literal ref javascript/literal add-highlighter shared/typescript/literal ref javascript/literal
add-highlighter -group /typescript/code ref javascript/code add-highlighter shared/typescript/code ref javascript/code
add-highlighter -group /typescript/code regex \b(array|boolean|date|number|object|regexp|string|symbol)\b 0:type add-highlighter shared/typescript/code regex \b(array|boolean|date|number|object|regexp|string|symbol)\b 0:type
# Keywords grabbed from https://github.com/Microsoft/TypeScript/issues/2536 # Keywords grabbed from https://github.com/Microsoft/TypeScript/issues/2536
add-highlighter -group /typescript/code regex \b(enum|as|implements|interface|package|private|protected|public|static|constructor|declare|get|module|set|type|from|of|readonly)\b 0:keyword add-highlighter shared/typescript/code regex \b(enum|as|implements|interface|package|private|protected|public|static|constructor|declare|get|module|set|type|from|of|readonly)\b 0:keyword
# Initialization # Initialization
# ‾‾‾‾‾‾‾‾‾‾‾‾‾‾ # ‾‾‾‾‾‾‾‾‾‾‾‾‾‾
hook -group typescript-highlight global WinSetOption filetype=typescript %{ add-highlighter ref typescript } hook -group typescript-highlight global WinSetOption filetype=typescript %{ add-highlighter window ref typescript }
hook global WinSetOption filetype=javascript %{ hook global WinSetOption filetype=javascript %{
hook window InsertEnd .* -group typescript-hooks javascript-filter-around-selections hook window InsertEnd .* -group typescript-hooks javascript-filter-around-selections
@ -46,7 +46,7 @@ hook global WinSetOption filetype=javascript %{
hook window InsertChar \n -group typescript-indent javascript-indent-on-new-line hook window InsertChar \n -group typescript-indent javascript-indent-on-new-line
} }
hook -group typescript-highlight global WinSetOption filetype=(?!typescript).* %{ remove-highlighter typescript } hook -group typescript-highlight global WinSetOption filetype=(?!typescript).* %{ remove-highlighter window/typescript }
hook global WinSetOption filetype=(?!typescript).* %{ hook global WinSetOption filetype=(?!typescript).* %{
remove-hooks window typescript-indent remove-hooks window typescript-indent

View File

@ -633,112 +633,93 @@ const CommandDesc rename_buffer_cmd = {
} }
}; };
Completions complete_highlighter(const Context& context, static constexpr auto highlighter_scopes = { "global", "buffer", "window", "shared" };
StringView arg, ByteCount pos_in_token, bool only_group)
template<bool add>
Completions highlighter_cmd_completer(
const Context& context, CompletionFlags flags, CommandParameters params,
size_t token_to_complete, ByteCount pos_in_token)
{ {
const bool shared = not arg.empty() and arg[0_byte] == '/'; if (token_to_complete == 0)
if (shared)
{ {
auto& group = DefinedHighlighters::instance();
return offset_pos(group.complete_child(arg.substr(1_byte), pos_in_token-1, only_group), 1); StringView path = params[0];
auto sep_it = find(path, '/');
if (sep_it == path.end())
return { 0_byte, pos_in_token, complete(path, pos_in_token, highlighter_scopes) };
StringView scope{path.begin(), sep_it};
HighlighterGroup* root = nullptr;
if (scope == "shared")
root = &DefinedHighlighters::instance();
else if (auto* s = get_scope_ifp(scope, context))
root = &s->highlighters();
else
return {};
auto offset = scope.length() + 1;
return offset_pos(root->complete_child(StringView{sep_it+1, path.end()}, pos_in_token - offset, add), offset);
}
else if (add and token_to_complete == 1)
{
StringView name = params[1];
return { 0_byte, name.length(), complete(name, pos_in_token, HighlighterRegistry::instance() | transform(std::mem_fn(&HighlighterRegistry::Item::key))) };
} }
else else
{
auto& group = context.window().highlighters();
return group.complete_child(arg, pos_in_token, only_group);
}
}
Completions remove_highlighter_completer(
const Context& context, CompletionFlags flags, CommandParameters params,
size_t token_to_complete, ByteCount pos_in_token)
{
const String& arg = params[token_to_complete];
if (token_to_complete == 0 and not arg.empty() and arg.front() == '/')
{
auto& group = DefinedHighlighters::instance();
return offset_pos(group.complete_child(arg.substr(1_byte), pos_in_token-1, false), 1);
}
else if (token_to_complete == 0)
return context.window().highlighters().complete_child(arg, pos_in_token, false);
return {}; return {};
} }
Completions add_highlighter_completer(
const Context& context, CompletionFlags flags, CommandParameters params,
size_t token_to_complete, ByteCount pos_in_token)
{
StringView arg = params[token_to_complete];
if (token_to_complete == 1 and params[0] == "-group")
return complete_highlighter(context, params[1], pos_in_token, true);
else if (token_to_complete == 0 or (token_to_complete == 2 and params[0] == "-group"))
return { 0_byte, arg.length(), complete(arg, pos_in_token, HighlighterRegistry::instance() | transform(std::mem_fn(&HighlighterRegistry::Item::key))) };
return Completions{};
}
Highlighter& get_highlighter(const Context& context, StringView path) Highlighter& get_highlighter(const Context& context, StringView path)
{ {
if (path.empty()) if (not path.empty() and path.back() == '/')
throw runtime_error("group path should not be empty");
Highlighter* root = nullptr;
if (path[0_byte] == '/')
{
root = &DefinedHighlighters::instance();
path = path.substr(1_byte);
}
else
root = &context.window().highlighters();
if (path.back() == '/')
path = path.substr(0_byte, path.length() - 1); path = path.substr(0_byte, path.length() - 1);
if (not path.empty()) auto sep_it = find(path, '/');
return root->get_child(path); StringView scope{path.begin(), sep_it};
auto* root = (scope == "shared") ? (HighlighterGroup*)&DefinedHighlighters::instance()
: (HighlighterGroup*)&get_scope(scope, context).highlighters();
if (sep_it != path.end())
return root->get_child(StringView{sep_it+1, path.end()});
return *root; return *root;
} }
const CommandDesc add_highlighter_cmd = { const CommandDesc add_highlighter_cmd = {
"add-highlighter", "add-highlighter",
"addhl", "addhl",
"add-highlighter <type> <type params>...: add an highlighter", "add-highlighter <path> <type> <type params>...: add an highlighter to the group identified by <path>\n"
ParameterDesc{ " <path> is a '/' delimited path of highlighters, starting with either\n"
{ { "group", { true, "Set the group in which to put the highlighter. " " 'global', 'buffer', 'window' or 'shared'",
"If starting with /, search in shared highlighters, " ParameterDesc{ {}, ParameterDesc::Flags::SwitchesAsPositional, 2 },
"else search in the current window" } } },
ParameterDesc::Flags::SwitchesOnlyAtStart, 1
},
CommandFlags::None, CommandFlags::None,
[](const Context& context, CommandParameters params) -> String [](const Context& context, CommandParameters params) -> String
{ {
if (params.size() > 0) if (params.size() > 1)
{ {
HighlighterRegistry& registry = HighlighterRegistry::instance(); HighlighterRegistry& registry = HighlighterRegistry::instance();
auto it = registry.find(params[0]); auto it = registry.find(params[1]);
if (it != registry.end()) if (it != registry.end())
return format("{}:\n{}", params[0], indent(it->value.docstring)); return format("{}:\n{}", params[1], indent(it->value.docstring));
} }
return ""; return "";
}, },
add_highlighter_completer, highlighter_cmd_completer<true>,
[](const ParametersParser& parser, Context& context, const ShellContext&) [](const ParametersParser& parser, Context& context, const ShellContext&)
{ {
HighlighterRegistry& registry = HighlighterRegistry::instance(); HighlighterRegistry& registry = HighlighterRegistry::instance();
auto begin = parser.begin(); auto begin = parser.begin();
const String& name = *begin++; StringView path = *begin++;
StringView name = *begin++;
Vector<String> highlighter_params; Vector<String> highlighter_params;
for (; begin != parser.end(); ++begin) for (; begin != parser.end(); ++begin)
highlighter_params.push_back(*begin); highlighter_params.push_back(*begin);
auto group_name = parser.get_switch("group");
auto& group = group_name ? get_highlighter(context, *group_name)
: context.window().highlighters();
auto it = registry.find(name); auto it = registry.find(name);
if (it == registry.end()) if (it == registry.end())
throw runtime_error(format("No such highlighter factory '{}'", name)); throw runtime_error(format("No such highlighter factory '{}'", name));
group.add_child(it->value.factory(highlighter_params)); get_highlighter(context, path).add_child(it->value.factory(highlighter_params));
// TODO: better, this will fail if we touch scopes highlighters that impact multiple windows
if (context.has_window()) if (context.has_window())
context.window().force_redraw(); context.window().force_redraw();
} }
@ -747,20 +728,19 @@ const CommandDesc add_highlighter_cmd = {
const CommandDesc remove_highlighter_cmd = { const CommandDesc remove_highlighter_cmd = {
"remove-highlighter", "remove-highlighter",
"rmhl", "rmhl",
"remove-highlighter <name>: remove highlighter <name>", "remove-highlighter <path>: remove highlighter identified by <path>",
single_param, { {}, ParameterDesc::Flags::None, 1, 1 },
CommandFlags::None, CommandFlags::None,
CommandHelper{}, CommandHelper{},
remove_highlighter_completer, highlighter_cmd_completer<false>,
[](const ParametersParser& parser, Context& context, const ShellContext&) [](const ParametersParser& parser, Context& context, const ShellContext&)
{ {
StringView path = parser[0]; StringView path = parser[0];
auto sep_it = find(path | reverse(), '/'); auto rev_path = path | reverse();
auto& group = sep_it != path.rend() ? auto sep_it = find(rev_path, '/');
get_highlighter(context, {path.begin(), sep_it.base()}) if (sep_it == rev_path.end())
: context.window().highlighters(); return;
get_highlighter(context, {path.begin(), sep_it.base()}).remove_child({sep_it.base(), path.end()});
group.remove_child({sep_it.base(), path.end()});
if (context.has_window()) if (context.has_window())
context.window().force_redraw(); context.window().force_redraw();

View File

@ -69,4 +69,19 @@ Completions HighlighterGroup::complete_child(StringView path, ByteCount cursor_p
return { 0, 0, std::move(candidates) }; return { 0, 0, std::move(candidates) };
} }
void Highlighters::do_highlight(const Context& context, HighlightPass pass,
DisplayBuffer& display_buffer, BufferRange range)
{
if (m_parent)
m_parent->do_highlight(context, pass, display_buffer, range);
HighlighterGroup::do_highlight(context, pass, display_buffer, range);
}
void Highlighters::do_compute_display_setup(const Context& context, HighlightPass pass, DisplaySetup& setup)
{
if (m_parent)
m_parent->do_compute_display_setup(context, pass, setup);
HighlighterGroup::do_compute_display_setup(context, pass, setup);
}
} }

View File

@ -5,6 +5,7 @@
#include "hash_map.hh" #include "hash_map.hh"
#include "highlighter.hh" #include "highlighter.hh"
#include "utils.hh" #include "utils.hh"
#include "safe_ptr.hh"
namespace Kakoune namespace Kakoune
{ {
@ -27,7 +28,7 @@ public:
Completions complete_child(StringView path, ByteCount cursor_pos, bool group) const override; Completions complete_child(StringView path, ByteCount cursor_pos, bool group) const override;
private: protected:
void do_highlight(const Context& context, HighlightPass pass, DisplayBuffer& display_buffer, BufferRange range) override; void do_highlight(const Context& context, HighlightPass pass, DisplayBuffer& display_buffer, BufferRange range) override;
void do_compute_display_setup(const Context& context, HighlightPass pass, DisplaySetup& setup) override; void do_compute_display_setup(const Context& context, HighlightPass pass, DisplaySetup& setup) override;
@ -35,6 +36,21 @@ private:
HighlighterMap m_highlighters; HighlighterMap m_highlighters;
}; };
class Highlighters : public HighlighterGroup, public SafeCountable
{
public:
Highlighters(Highlighters& parent) : HighlighterGroup{HighlightPass::All}, SafeCountable{}, m_parent(&parent) {}
private:
void do_highlight(const Context& context, HighlightPass pass, DisplayBuffer& display_buffer, BufferRange range) override;
void do_compute_display_setup(const Context& context, HighlightPass pass, DisplaySetup& setup) override;
friend class Scope;
Highlighters() : HighlighterGroup{HighlightPass::All} {}
SafePtr<Highlighters> m_parent;
};
struct DefinedHighlighters : public HighlighterGroup, struct DefinedHighlighters : public HighlighterGroup,
public Singleton<DefinedHighlighters> public Singleton<DefinedHighlighters>
{ {

View File

@ -5,6 +5,7 @@
#include "hook_manager.hh" #include "hook_manager.hh"
#include "keymap_manager.hh" #include "keymap_manager.hh"
#include "option_manager.hh" #include "option_manager.hh"
#include "highlighter_group.hh"
#include "utils.hh" #include "utils.hh"
namespace Kakoune namespace Kakoune
@ -17,7 +18,8 @@ public:
: m_options(parent.options()), : m_options(parent.options()),
m_hooks(parent.hooks()), m_hooks(parent.hooks()),
m_keymaps(parent.keymaps()), m_keymaps(parent.keymaps()),
m_aliases(parent.aliases()) {} m_aliases(parent.aliases()),
m_highlighters(parent.highlighters()) {}
OptionManager& options() { return m_options; } OptionManager& options() { return m_options; }
const OptionManager& options() const { return m_options; } const OptionManager& options() const { return m_options; }
@ -27,6 +29,8 @@ public:
const KeymapManager& keymaps() const { return m_keymaps; } const KeymapManager& keymaps() const { return m_keymaps; }
AliasRegistry& aliases() { return m_aliases; } AliasRegistry& aliases() { return m_aliases; }
const AliasRegistry& aliases() const { return m_aliases; } const AliasRegistry& aliases() const { return m_aliases; }
Highlighters& highlighters() { return m_highlighters; }
const Highlighters& highlighters() const { return m_highlighters; }
private: private:
friend class GlobalScope; friend class GlobalScope;
@ -36,6 +40,7 @@ private:
HookManager m_hooks; HookManager m_hooks;
KeymapManager m_keymaps; KeymapManager m_keymaps;
AliasRegistry m_aliases; AliasRegistry m_aliases;
Highlighters m_highlighters;
}; };
class GlobalScope : public Scope, public Singleton<GlobalScope> class GlobalScope : public Scope, public Singleton<GlobalScope>

View File

@ -22,8 +22,7 @@ void setup_builtin_highlighters(HighlighterGroup& group);
Window::Window(Buffer& buffer) Window::Window(Buffer& buffer)
: Scope(buffer), : Scope(buffer),
m_buffer(&buffer), m_buffer(&buffer),
m_highlighters{HighlightPass::All}, m_builtin_highlighters{highlighters()}
m_builtin_highlighters{HighlightPass::All}
{ {
run_hook_in_own_context("WinCreate", buffer.name()); run_hook_in_own_context("WinCreate", buffer.name());
@ -144,10 +143,7 @@ const DisplayBuffer& Window::update_display_buffer(const Context& context)
m_display_buffer.compute_range(); m_display_buffer.compute_range();
BufferRange range{{0,0}, buffer().end_coord()}; BufferRange range{{0,0}, buffer().end_coord()};
for (auto pass : { HighlightPass::Wrap, HighlightPass::Move, HighlightPass::Colorize }) for (auto pass : { HighlightPass::Wrap, HighlightPass::Move, HighlightPass::Colorize })
{
m_highlighters.highlight(context, pass, m_display_buffer, range);
m_builtin_highlighters.highlight(context, pass, m_display_buffer, range); m_builtin_highlighters.highlight(context, pass, m_display_buffer, range);
}
m_display_buffer.optimize(); m_display_buffer.optimize();
@ -203,8 +199,6 @@ DisplaySetup Window::compute_display_setup(const Context& context)
offset, offset,
false false
}; };
for (auto pass : { HighlightPass::Move, HighlightPass::Wrap })
m_highlighters.compute_display_setup(context, pass, setup);
for (auto pass : { HighlightPass::Move, HighlightPass::Wrap }) for (auto pass : { HighlightPass::Move, HighlightPass::Wrap })
m_builtin_highlighters.compute_display_setup(context, pass, setup); m_builtin_highlighters.compute_display_setup(context, pass, setup);

View File

@ -40,8 +40,6 @@ public:
Optional<DisplayCoord> display_position(BufferCoord coord) const; Optional<DisplayCoord> display_position(BufferCoord coord) const;
BufferCoord buffer_coord(DisplayCoord coord) const; BufferCoord buffer_coord(DisplayCoord coord) const;
Highlighter& highlighters() { return m_highlighters; }
Buffer& buffer() const { return *m_buffer; } Buffer& buffer() const { return *m_buffer; }
bool needs_redraw(const Context& context) const; bool needs_redraw(const Context& context) const;
@ -67,8 +65,7 @@ private:
DisplayCoord m_dimensions; DisplayCoord m_dimensions;
DisplayBuffer m_display_buffer; DisplayBuffer m_display_buffer;
HighlighterGroup m_highlighters; Highlighters m_builtin_highlighters;
HighlighterGroup m_builtin_highlighters;
struct Setup struct Setup
{ {

View File

@ -1,5 +1,5 @@
add-highlighter number_lines add-highlighter window number_lines
set window tabstop 4 set window tabstop 4
add-highlighter column 3 default,red add-highlighter window column 3 default,red
add-highlighter column 7 default,green add-highlighter window column 7 default,green
add-highlighter column 5 default,blue add-highlighter window column 5 default,blue

View File

@ -1,7 +1,7 @@
add-highlighter regions -default code regions_test \ add-highlighter window regions -default code regions_test \
string %{"} %{(?<!\\)(\\\\)*"} '' \ string %{"} %{(?<!\\)(\\\\)*"} '' \
shell '\$\{' '\}' '\{' shell '\$\{' '\}' '\{'
add-highlighter -group regions_test/code fill yellow add-highlighter window/regions_test/code fill yellow
add-highlighter -group regions_test/string fill green add-highlighter window/regions_test/string fill green
add-highlighter -group regions_test/shell fill red add-highlighter window/regions_test/shell fill red

View File

@ -1 +1 @@
add-highlighter wrap -word add-highlighter window wrap -word

View File

@ -1,2 +1,2 @@
add-highlighter regions -default code -match-capture sh \ add-highlighter window regions -default code -match-capture sh \
heredoc '<<-?(\w+)' '^\t*(\w+)$' '' heredoc '<<-?(\w+)' '^\t*(\w+)$' ''

View File

@ -1 +1 @@
:addhl show_whitespaces<ret>i<space><esc>:addhl column 1 red<ret>A<backspace><esc> :addhl window show_whitespaces<ret>i<space><esc>:addhl window column 1 red<ret>A<backspace><esc>

View File

@ -1 +1 @@
add-highlighter column 20 default,blue add-highlighter window column 20 default,blue

View File

@ -1,2 +1,2 @@
add-highlighter wrap add-highlighter window wrap
set global scrolloff 1,0 set global scrolloff 1,0

View File

@ -1 +1 @@
add-highlighter show_whitespaces add-highlighter window show_whitespaces

View File

@ -1 +1 @@
add-highlighter show_whitespaces add-highlighter window show_whitespaces

View File

@ -1 +1 @@
add-highlighter wrap add-highlighter window wrap

View File

@ -1 +1 @@
add-highlighter regex '[“”]' 0:red add-highlighter window regex '[“”]' 0:red