Fix remaining kak scripts to use the new highlighter syntax

This commit is contained in:
Maxime Coste 2018-07-01 19:53:35 +10:00
parent 6993b0f347
commit 9ea6b88c1f
42 changed files with 638 additions and 802 deletions

View File

@ -11,29 +11,26 @@ hook global BufCreate .*[.](css) %{
# Highlighters
# ‾‾‾‾‾‾‾‾‾‾‾‾
add-highlighter shared/ regions -default selector css \
declaration [{] [}] '' \
comment /[*] [*]/ ''
add-highlighter shared/css regions
add-highlighter shared/css/selector default-region group
add-highlighter shared/css/declaration region [{] [}] '' regions
add-highlighter shared/css/comment region /[*] [*]/ '' fill comment
add-highlighter shared/css/comment fill comment
add-highlighter shared/css/declaration regions content \
string '"' (?<!\\)(\\\\)*" '' \
string "'" "'" ''
add-highlighter shared/css/declaration/content/string fill string
add-highlighter shared/css/declaration/base default-region group
add-highlighter shared/css/declaration/double_string region '"' (?<!\\)(\\\\)*" '' fill string
add-highlighter shared/css/declaration/single_string region "'" "'" '' fill string
# https://developer.mozilla.org/en-US/docs/Web/CSS/length
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 shared/css/declaration/base/ 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 ([A-Za-z][A-Za-z0-9_-]*)\h*: 1:keyword
add-highlighter shared/css/declaration regex :(before|after) 0:attribute
add-highlighter shared/css/declaration regex !important 0:keyword
add-highlighter shared/css/declaration/base/ regex ([A-Za-z][A-Za-z0-9_-]*)\h*: 1:keyword
add-highlighter shared/css/declaration/base/ regex :(before|after) 0:attribute
add-highlighter shared/css/declaration/base/ regex !important 0:keyword
# element#id element.class
# universal selector
add-highlighter shared/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:variable
add-highlighter shared/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:variable
# Commands
# ‾‾‾‾‾‾‾‾
@ -64,7 +61,7 @@ define-command -hidden css-indent-on-closing-curly-brace %[
# Initialization
# ‾‾‾‾‾‾‾‾‾‾‾‾‾‾
hook -group css-highlight global WinSetOption filetype=css %{ add-highlighter window ref css }
hook -group css-highlight global WinSetOption filetype=css %{ add-highlighter window/css ref css }
hook global WinSetOption filetype=css %[
hook window ModeChange insert:.* -group css-hooks css-filter-around-selections

View File

@ -11,31 +11,26 @@ hook global BufCreate .*\.di? %{
# Highlighters
# ‾‾‾‾‾‾‾‾‾‾‾‾
add-highlighter shared/ regions -default code d \
string %{(?<!')(?<!'\\)"} %{(?<!\\)(?:\\\\)*"} "" \
verbatim_string ` ` '' \
verbatim_string %{(?<!')(?<!'\\)`} %{(?<!\\)(?:\\\\)*`} "" \
verbatim_string_prefixed %{r`([^(]*)\(} %{\)([^)]*)`} "" \
disabled '/\+[^+]?' '\+/' '' \
comment '/\*[^*]?' '\*/' '' \
comment '//[^/]?' $ '' \
docstring '/\+\+' '\+/' '' \
docstring '/\*\*' '\*/' '' \
docstring /// $ ''
add-highlighter shared/d regions
add-highlighter shared/d/code default-region group
add-highlighter shared/d/string region %{(?<!')(?<!'\\)"} %{(?<!\\)(?:\\\\)*"} "" group
add-highlighter shared/d/verbatim_string1 region ` ` '' fill magenta
add-highlighter shared/d/verbatim_string2 region %{(?<!')(?<!'\\)`} %{(?<!\\)(?:\\\\)*`} "" fill magenta
add-highlighter shared/d/verbatim_string_prefixed region %{r`([^(]*)\(} %{\)([^)]*)`} "" fill magenta
add-highlighter shared/d/disabled region '/\+[^+]?' '\+/' '' fill rgb:777777
add-highlighter shared/d/comment1 region '/\*[^*]?' '\*/' '' fill comment
add-highlighter shared/d/comment2 region '//[^/]?' $ '' fill comment
add-highlighter shared/d/docstring1 region '/\+\+' '\+/' '' fill blue
add-highlighter shared/d/docstring2 region '/\*\*' '\*/' '' fill blue
add-highlighter shared/d/docstring3 region /// $ '' fill blue
add-highlighter shared/d/string fill string
add-highlighter shared/d/verbatim_string fill magenta
add-highlighter shared/d/verbatim_string_prefixed fill magenta
add-highlighter shared/d/disabled fill rgb:777777
add-highlighter shared/d/comment fill comment
add-highlighter shared/d/docstring fill blue
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 shared/d/code regex %{'((\\.)?|[^'\\])'} 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 shared/d/code regex "\b(this)\b\s*[^(]" 1:value
add-highlighter shared/d/code regex "((?:~|\b)this)\b\s*\(" 1:function
add-highlighter shared/d/code regex '#\s*line\b.*' 0:meta
add-highlighter shared/d/string/ fill string
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 shared/d/code/ regex %{'((\\.)?|[^'\\])'} 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 shared/d/code/ regex "\b(this)\b\s*[^(]" 1:value
add-highlighter shared/d/code/ regex "((?:~|\b)this)\b\s*\(" 1:function
add-highlighter shared/d/code/ regex '#\s*line\b.*' 0:meta
evaluate-commands %sh{
# Grammar
@ -73,18 +68,18 @@ evaluate-commands %sh{
# Highlight keywords
printf %s "
add-highlighter shared/d/code regex \b(${keywords})\b 0:keyword
add-highlighter shared/d/code regex \b(${attributes})\b 0:attribute
add-highlighter shared/d/code regex \b(${types})\b 0:type
add-highlighter shared/d/code regex \b(${values})\b 0:value
add-highlighter shared/d/code regex @(${decorators})\b 0:attribute
add-highlighter shared/d/code regex \b(${tokens})\b 0:builtin
add-highlighter shared/d/code regex \.(${properties})\b 1:builtin
add-highlighter shared/d/code/ regex \b(${keywords})\b 0:keyword
add-highlighter shared/d/code/ regex \b(${attributes})\b 0:attribute
add-highlighter shared/d/code/ regex \b(${types})\b 0:type
add-highlighter shared/d/code/ regex \b(${values})\b 0:value
add-highlighter shared/d/code/ regex @(${decorators})\b 0:attribute
add-highlighter shared/d/code/ regex \b(${tokens})\b 0:builtin
add-highlighter shared/d/code/ regex \.(${properties})\b 1:builtin
"
}
add-highlighter shared/d/code regex "\bimport\s+([\w._-]+)(?:\s*=\s*([\w._-]+))?" 1:module 2:module
add-highlighter shared/d/code regex "\bmodule\s+([\w_-]+)\b" 1:module
add-highlighter shared/d/code/ regex "\bimport\s+([\w._-]+)(?:\s*=\s*([\w._-]+))?" 1:module 2:module
add-highlighter shared/d/code/ regex "\bmodule\s+([\w_-]+)\b" 1:module
# Commands
# ‾‾‾‾‾‾‾‾
@ -121,7 +116,7 @@ define-command -hidden d-indent-on-closing-curly-brace %[
# Initialization
# ‾‾‾‾‾‾‾‾‾‾‾‾‾‾
hook -group d-highlight global WinSetOption filetype=d %{ add-highlighter window ref d }
hook -group d-highlight global WinSetOption filetype=d %{ add-highlighter window/d ref d }
hook global WinSetOption filetype=d %{
# cleanup trailing whitespaces when exiting insert mode

View File

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

View File

@ -13,9 +13,9 @@ hook global BufCreate .*[.](fish) %{
add-highlighter shared/fish regions
add-highlighter shared/fish/code default-region group
add-highlighter shared/fish/double_string '"' (?<!\\)(\\\\)*" '' group
add-highlighter shared/fish/single_string "'" "'" '' fill string
add-highlighter shared/fish/comment '#' '$' '' fill comment
add-highlighter shared/fish/double_string region '"' (?<!\\)(\\\\)*" '' group
add-highlighter shared/fish/single_string region "'" "'" '' fill string
add-highlighter shared/fish/comment region '#' '$' '' fill comment
add-highlighter shared/fish/double_string/ fill string
add-highlighter shared/fish/double_string/ regex (\$\w+)|(\{\$\w+\}) 0:variable

View File

@ -5,34 +5,30 @@ hook global BufCreate .*\.(s|S|asm)$ %{
}
add-highlighter shared/ regions -default code gas \
string '"' (?<!\\)(\\\\)*" '' \
commentMulti /\* \*/ '' \
commentSingle1 '#' '$' '' \
commentSingle2 ';' '$' ''
add-highlighter shared/gas/string fill string
add-highlighter shared/gas/commentMulti fill comment
add-highlighter shared/gas/commentSingle1 fill comment
add-highlighter shared/gas/commentSingle2 fill comment
add-highlighter shared/gas regions
add-highlighter shared/gas/code default-region group
add-highlighter shared/gas/string region '"' (?<!\\)(\\\\)*" '' fill string
add-highlighter shared/gas/commentMulti region /\* \*/ '' fill comment
add-highlighter shared/gas/commentSingle1 region '#' '$' '' fill comment
add-highlighter shared/gas/commentSingle2 region ';' '$' '' fill comment
# Constant
add-highlighter shared/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
add-highlighter shared/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
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
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
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
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
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
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
add-highlighter shared/gas/code regex \
add-highlighter shared/gas/code/ regex \
^\h*(mov|lea|call|test|cmp)([bwlq])?\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|\
@ -53,7 +49,7 @@ add-highlighter shared/gas/code regex \
^\h*(bound([wl])?|enter|int(o)?|lcall|loop(n)?[ez]|pause)\b 0:keyword
#Floating Point Instructions
add-highlighter shared/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(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|\
@ -85,7 +81,7 @@ define-command -hidden gas-indent-on-new-line %~
>
~
hook -group gas-highlight global WinSetOption filetype=gas %{ add-highlighter window ref gas }
hook -group gas-highlight global WinSetOption filetype=gas %{ add-highlighter window/gas ref gas }
hook global WinSetOption filetype=gas %{
hook window InsertChar \n -group gas-indent gas-indent-on-new-line

View File

@ -11,19 +11,15 @@ hook global BufCreate .*\.go %{
# Highlighters
# ‾‾‾‾‾‾‾‾‾‾‾‾
add-highlighter shared/ regions -default code go \
back_string '`' '`' '' \
double_string '"' (?<!\\)(\\\\)*" '' \
single_string "'" (?<!\\)(\\\\)*' '' \
comment /\* \*/ '' \
comment '//' $ ''
add-highlighter shared/go regions
add-highlighter shared/go/code default-region group
add-highlighter shared/go/back_string region '`' '`' '' fill string
add-highlighter shared/go/double_string region '"' (?<!\\)(\\\\)*" '' fill string
add-highlighter shared/go/single_string region "'" (?<!\\)(\\\\)*' '' fill string
add-highlighter shared/go/comment region /\* \*/ '' fill comment
add-highlighter shared/go/comment_line region '//' $ '' fill comment
add-highlighter shared/go/back_string fill string
add-highlighter shared/go/double_string fill string
add-highlighter shared/go/single_string fill string
add-highlighter shared/go/comment fill comment
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
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
evaluate-commands %sh{
# Grammar
@ -42,11 +38,11 @@ evaluate-commands %sh{
# Highlight keywords
printf %s "
add-highlighter shared/go/code regex \b(${keywords})\b 0:keyword
add-highlighter shared/go/code regex \b(${attributes})\b 0:attribute
add-highlighter shared/go/code regex \b(${types})\b 0:type
add-highlighter shared/go/code regex \b(${values})\b 0:value
add-highlighter shared/go/code regex \b(${functions})\b 0:builtin
add-highlighter shared/go/code/ regex \b(${keywords})\b 0:keyword
add-highlighter shared/go/code/ regex \b(${attributes})\b 0:attribute
add-highlighter shared/go/code/ regex \b(${types})\b 0:type
add-highlighter shared/go/code/ regex \b(${values})\b 0:value
add-highlighter shared/go/code/ regex \b(${functions})\b 0:builtin
"
}
@ -85,7 +81,7 @@ define-command -hidden go-indent-on-closing-curly-brace %[
# Initialization
# ‾‾‾‾‾‾‾‾‾‾‾‾‾‾
hook -group go-highlight global WinSetOption filetype=go %{ add-highlighter window ref go }
hook -group go-highlight global WinSetOption filetype=go %{ add-highlighter window/go ref go }
hook global WinSetOption filetype=go %{
# cleanup trailing whitespaces when exiting insert mode

View File

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

View File

@ -2,19 +2,17 @@ hook global BufCreate .*\.java %{
set-option buffer filetype java
}
add-highlighter shared/ regions -default code java \
string %{(?<!')"} %{(?<!\\)(\\\\)*"} '' \
comment /\* \*/ '' \
comment // $ ''
add-highlighter shared/java regions
add-highlighter shared/java/code default-region group
add-highlighter shared/java/string region %{(?<!')"} %{(?<!\\)(\\\\)*"} '' fill string
add-highlighter shared/java/comment region /\* \*/ '' fill comment
add-highlighter shared/java/line_comment region // $ '' fill comment
add-highlighter shared/java/string fill string
add-highlighter shared/java/comment fill comment
add-highlighter shared/java/code regex %{\b(this|true|false|null)\b} 0:value
add-highlighter shared/java/code regex "\b(void|int|char|unsigned|float|boolean|double)\b" 0:type
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|throws|instanceof)\b" 0:keyword
add-highlighter shared/java/code regex "\b(final|public|protected|private|abstract|synchronized|native|transient|volatile)\b" 0:attribute
add-highlighter shared/java/code regex "(?<!\w)@\w+\b" 0:meta
add-highlighter shared/java/code/ regex %{\b(this|true|false|null)\b} 0:value
add-highlighter shared/java/code/ regex "\b(void|int|char|unsigned|float|boolean|double)\b" 0:type
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|throws|instanceof)\b" 0:keyword
add-highlighter shared/java/code/ regex "\b(final|public|protected|private|abstract|synchronized|native|transient|volatile)\b" 0:attribute
add-highlighter shared/java/code/ regex "(?<!\w)@\w+\b" 0:meta
# Commands
# ‾‾‾‾‾‾‾‾
@ -62,5 +60,5 @@ hook global WinSetOption filetype=(?!java).* %{
remove-hooks window java-hooks
remove-hooks window java-indent
}
hook -group java-highlight global WinSetOption filetype=java %{ add-highlighter window ref java }
hook -group java-highlight global WinSetOption filetype=java %{ add-highlighter window/java ref java }
hook -group java-highlight global WinSetOption filetype=(?!java).* %{ remove-highlighter window/java }

View File

@ -43,66 +43,57 @@ define-command -hidden init-javascript-filetype -params 1 %~
# Highlighters
# ‾‾‾‾‾‾‾‾‾‾‾‾
add-highlighter shared/ regions -default code %arg{1} \
double_string '"' (?<!\\)(\\\\)*" '' \
single_string "'" (?<!\\)(\\\\)*' '' \
literal "`" (?<!\\)(\\\\)*` '' \
comment // '$' '' \
comment /\* \*/ '' \
shebang ^#! $ '' \
regex / (?<!\\)(\\\\)*/[gimuy]* '' \
jsx (?<![\w<])<[a-zA-Z][\w:.-]*(?!\hextends)(?=[\s/>])(?!>\()) (</.*?>|/>) (?<![\w<])<[a-zA-Z][\w:.-]* \
division '[\w\)\]]\K(/|(\h+/\h+))' '(?=\w)' '' # Help Kakoune to better detect /…/ literals
add-highlighter "shared/%arg{1}" regions
add-highlighter "shared/%arg{1}/code" default-region group
add-highlighter "shared/%arg{1}/double_string" region '"' (?<!\\)(\\\\)*" '' fill string
add-highlighter "shared/%arg{1}/single_string" region "'" (?<!\\)(\\\\)*' '' fill string
add-highlighter "shared/%arg{1}/literal" region "`" (?<!\\)(\\\\)*` '' group
add-highlighter "shared/%arg{1}/comment_line" region // '$' '' fill comment
add-highlighter "shared/%arg{1}/comment" region /\* \*/ '' fill comment
add-highlighter "shared/%arg{1}/shebang" region ^#! $ '' fill meta
add-highlighter "shared/%arg{1}/regex" region / (?<!\\)(\\\\)*/[gimuy]* '' fill meta
add-highlighter "shared/%arg{1}/jsx" region (?<![\w<])<[a-zA-Z][\w:.-]*(?!\hextends)(?=[\s/>])(?!>\()) (</.*?>|/>) (?<![\w<])<[a-zA-Z][\w:.-]* regions
add-highlighter "shared/%arg{1}/division" region '[\w\)\]]\K(/|(\h+/\h+))' '(?=\w)' '' group # Help Kakoune to better detect /…/ literals
# 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
add-highlighter "shared/%arg{1}/double_string" fill string
add-highlighter "shared/%arg{1}/single_string" fill string
add-highlighter "shared/%arg{1}/regex" fill meta
add-highlighter "shared/%arg{1}/comment" fill comment
add-highlighter "shared/%arg{1}/shebang" fill meta
add-highlighter "shared/%arg{1}/literal/" fill string
add-highlighter "shared/%arg{1}/literal/" regex \$\{.*?\} 0:value
add-highlighter "shared/%arg{1}/literal" fill string
add-highlighter "shared/%arg{1}/literal" regex \$\{.*?\} 0:value
add-highlighter "shared/%arg{1}/code" regex [^$_]\b(document|false|null|parent|self|this|true|undefined|window)\b 1:value
add-highlighter "shared/%arg{1}/code" regex "-?\b[0-9]*\.?[0-9]+" 0:value
add-highlighter "shared/%arg{1}/code" regex \b(Array|Boolean|Date|Function|Number|Object|RegExp|String|Symbol)\b 0:type
add-highlighter "shared/%arg{1}/code/" regex [^$_]\b(document|false|null|parent|self|this|true|undefined|window)\b 1:value
add-highlighter "shared/%arg{1}/code/" regex "-?\b[0-9]*\.?[0-9]+" 0:value
add-highlighter "shared/%arg{1}/code/" regex \b(Array|Boolean|Date|Function|Number|Object|RegExp|String|Symbol)\b 0:type
# jsx: In well-formed xml the number of opening and closing tags match up regardless of tag name.
#
# We inline a small XML highlighter here since it anyway need to recurse back up to the starting highlighter.
# To make things simple we assume that jsx is always enabled.
add-highlighter "shared/%arg{1}/jsx" regions content \
tag <(?=[/a-zA-Z]) (?<!=)> < \
expr \{ \} \{
add-highlighter "shared/%arg{1}/jsx/tag" region <(?=[/a-zA-Z]) (?<!=)> < regions
add-highlighter "shared/%arg{1}/jsx/expr" region \{ \} \{ ref %arg{1}
add-highlighter "shared/%arg{1}/jsx/content/expr" ref %arg{1}
add-highlighter "shared/%arg{1}/jsx/tag/base" default-region group
add-highlighter "shared/%arg{1}/jsx/tag/double_string" region =\K" (?<!\\)(\\\\)*" '' fill string
add-highlighter "shared/%arg{1}/jsx/tag/single_string" region =\K' (?<!\\)(\\\\)*' '' fill string
add-highlighter "shared/%arg{1}/jsx/tag/expr" region \{ \} \{ group
add-highlighter "shared/%arg{1}/jsx/content/tag" regex (\w+) 1:attribute
add-highlighter "shared/%arg{1}/jsx/tag/base/" regex (\w+) 1:attribute
add-highlighter "shared/%arg{1}/jsx/tag/base/" regex </?([\w-$]+) 1:keyword
add-highlighter "shared/%arg{1}/jsx/tag/base/" regex (</?|/?>) 0:meta
add-highlighter "shared/%arg{1}/jsx/content/tag" regex </?([\w-$]+) 1:keyword
add-highlighter "shared/%arg{1}/jsx/content/tag" regex (</?|/?>) 0:meta
add-highlighter "shared/%arg{1}/jsx/content/tag" regions content \
string =\K" (?<!\\)(\\\\)*" '' \
string =\K' (?<!\\)(\\\\)*' '' \
expr \{ \} \{
add-highlighter "shared/%arg{1}/jsx/content/tag/content/string" fill string
add-highlighter "shared/%arg{1}/jsx/content/tag/content/expr" fill default,default+e
add-highlighter "shared/%arg{1}/jsx/content/tag/content/expr" ref %arg{1}
add-highlighter "shared/%arg{1}/jsx/tag/expr/" fill default,default+e
add-highlighter "shared/%arg{1}/jsx/tag/expr/" ref %arg{1}
# Keywords are collected at
# https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Lexical_grammar#Keywords
add-highlighter "shared/%arg{1}/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|static|super|switch|throw|try|typeof|var|void|while|with|yield)\b 0:keyword
add-highlighter "shared/%arg{1}/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|static|super|switch|throw|try|typeof|var|void|while|with|yield)\b 0:keyword
# Initialization
# ‾‾‾‾‾‾‾‾‾‾‾‾‾‾
hook -group "%arg{1}-highlight" global WinSetOption "filetype=%arg{1}" "add-highlighter window ref %arg{1}"
hook -group "%arg{1}-highlight" global WinSetOption "filetype=%arg{1}" "add-highlighter window/%arg{1} ref %arg{1}"
hook global WinSetOption "filetype=%arg{1}" "
hook window ModeChange insert:.* -group %arg{1}-hooks javascript-filter-around-selections
@ -123,7 +114,7 @@ init-javascript-filetype typescript
# Highlighting specific to TypeScript
# ‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾
add-highlighter shared/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
add-highlighter shared/typescript/code regex \b(as|constructor|declare|enum|from|implements|interface|module|namespace|package|private|protected|public|readonly|static|type)\b 0:keyword
add-highlighter shared/typescript/code/ regex \b(as|constructor|declare|enum|from|implements|interface|module|namespace|package|private|protected|public|readonly|static|type)\b 0:keyword

View File

@ -11,12 +11,11 @@ hook global BufCreate .*[.](json) %{
# Highlighters
# ‾‾‾‾‾‾‾‾‾‾‾‾
add-highlighter shared/ regions -default code json \
string '"' (?<!\\)(\\\\)*" ''
add-highlighter shared/json regions
add-highlighter shared/json/code default-region group
add-highlighter shared/json/string region '"' (?<!\\)(\\\\)*" '' fill string
add-highlighter shared/json/string fill string
add-highlighter shared/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
# ‾‾‾‾‾‾‾‾
@ -47,7 +46,7 @@ define-command -hidden json-indent-on-new-line %<
# Initialization
# ‾‾‾‾‾‾‾‾‾‾‾‾‾‾
hook -group json-highlight global WinSetOption filetype=json %{ add-highlighter window ref json }
hook -group json-highlight global WinSetOption filetype=json %{ add-highlighter window/json ref json }
hook global WinSetOption filetype=json %{
hook window ModeChange insert:.* -group json-hooks json-filter-around-selections

View File

@ -11,20 +11,18 @@ hook global BufCreate .*\.(jl) %{
# Highlighters
# ‾‾‾‾‾‾‾‾‾‾‾‾
add-highlighter shared/ regions -default code julia \
string '"' (?<!\\)(\\\\)*" '' \
comment '#' '$' ''
add-highlighter shared/julia/string fill string
add-highlighter shared/julia/comment fill comment
add-highlighter shared/julia regions
add-highlighter shared/julia/code default-region group
add-highlighter shared/julia/string region '"' (?<!\\)(\\\\)*" '' fill string
add-highlighter shared/julia/comment region '#' '$' '' fill comment
# taken from https://github.com/JuliaLang/julia/blob/master/contrib/julia-mode.el
add-highlighter shared/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(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(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|AbstractString|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(true|false|C_NULL|Inf|NaN|Inf32|NaN32|nothing|\b-?\d+[fdiu]?)\b} 0:value
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 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|AbstractString|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
# ‾‾‾‾‾‾‾‾‾‾‾‾‾‾
hook -group julia-highlight global WinSetOption filetype=julia %{ add-highlighter window ref julia }
hook -group julia-highlight global WinSetOption filetype=julia %{ add-highlighter window/julia ref julia }
hook -group julia-highlight global WinSetOption filetype=(?!julia).* %{ remove-highlighter window/julia }

View File

@ -13,8 +13,8 @@ hook global BufCreate .*[.](lisp) %{
add-highlighter shared/lisp regions
add-highlighter shared/lisp/code default-region group
add-highlighter shared/lisp/string '"' (?<!\\)(\\\\)*" '' fill string
add-highlighter shared/lisp/comment ';' '$' '' fill comment
add-highlighter shared/lisp/string region '"' (?<!\\)(\\\\)*" '' fill string
add-highlighter shared/lisp/comment region ';' '$' '' fill comment
add-highlighter shared/lisp/code/ regex \b(nil|true|false)\b 0:value
add-highlighter shared/lisp/code/ regex (((\Q***\E)|(///)|(\Q+++\E)){1,3})|(1[+-])|(<|>|<=|=|>=) 0:operator

View File

@ -2,10 +2,10 @@ hook global BufCreate .+\.eml %{
set-option buffer filetype mail
}
add-highlighter shared/ group mail
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 shared/mail regex <[^@>]+@.*?> 0:string
add-highlighter shared/mail regex ^>.*?$ 0:comment
add-highlighter shared/mail group
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 shared/mail/ regex <[^@>]+@.*?> 0:string
add-highlighter shared/mail/ regex ^>.*?$ 0:comment
hook -group mail-highlight global WinSetOption filetype=mail %{ add-highlighter window ref mail }
hook -group mail-highlight global WinSetOption filetype=mail %{ add-highlighter window/mail ref mail }
hook -group mail-highlight global WinSetOption filetype=(?!mail).* %{ remove-highlighter window/mail }

View File

@ -13,12 +13,10 @@ hook global BufCreate .*\.mli? %{
# Highlighters
# ‾‾‾‾‾‾‾‾‾‾‾‾
add-highlighter shared/ regions -default code ocaml \
string '"' (?<!\\)(\\\\)*" '' \
comment \Q(* \Q*) '' \
add-highlighter shared/ocaml/string fill string
add-highlighter shared/ocaml/comment fill comment
add-highlighter shared/ocaml regions
add-highlighter shared/ocaml/code default-region group
add-highlighter shared/ocaml/string region '"' (?<!\\)(\\\\)*" '' fill string
add-highlighter shared/ocaml/comment region \Q(* \Q*) '' fill comment
# Commands
# ‾‾‾‾‾‾‾‾
@ -32,7 +30,7 @@ define-command -hidden ocaml-indent-on-char %{
# Initialization
# ‾‾‾‾‾‾‾‾‾‾‾‾‾‾
hook -group ocaml-highlight global WinSetOption filetype=ocaml %{ add-highlighter window ref ocaml }
hook -group ocaml-highlight global WinSetOption filetype=ocaml %{ add-highlighter window/ocaml ref ocaml }
hook global WinSetOption filetype=ocaml %{
hook window InsertChar [|\n] -group ocaml-indent ocaml-indent-on-char
@ -50,7 +48,7 @@ hook global WinSetOption filetype=(?!ocaml).* %{
evaluate-commands %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
echo "
add-highlighter shared/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 %{
set-option window static_words $keywords
}

View File

@ -11,16 +11,12 @@ hook global BufCreate .*\.p[lm] %{
# Highlighters
# ‾‾‾‾‾‾‾‾‾‾‾‾
add-highlighter shared/ regions -default code perl \
command (?<!\$)(?<!\\)` (?<!\\)(\\\\)*` '' \
double_string (?<!\$)(?<!\\)" (?<!\\)(\\\\)*" '' \
single_string (?<!\$)(?<!\\\\)' (?<!\\)(\\\\)*' '' \
comment (?<!\$)(?<!\\)# $ ''
add-highlighter shared/perl/command fill magenta
add-highlighter shared/perl/double_string fill string
add-highlighter shared/perl/single_string fill string
add-highlighter shared/perl/comment fill comment
add-highlighter shared/perl regions
add-highlighter shared/perl/code default-region group
add-highlighter shared/perl/command region (?<!\$)(?<!\\)` (?<!\\)(\\\\)*` '' fill magenta
add-highlighter shared/perl/double_string region (?<!\$)(?<!\\)" (?<!\\)(\\\\)*" '' fill string
add-highlighter shared/perl/single_string region (?<!\$)(?<!\\\\)' (?<!\\)(\\\\)*' '' fill string
add-highlighter shared/perl/comment region (?<!\$)(?<!\\)# $ '' fill comment
evaluate-commands %sh{
# Grammar
@ -46,26 +42,26 @@ evaluate-commands %sh{
# Highlight keywords
printf %s "
add-highlighter shared/perl/code regex \b(${keywords})\b 0:keyword
add-highlighter shared/perl/code regex \b(${attributes})\b 0:attribute
add-highlighter shared/perl/code regex \b(${values})\b 0:value
add-highlighter shared/perl/code/ regex \b(${keywords})\b 0:keyword
add-highlighter shared/perl/code/ regex \b(${attributes})\b 0:attribute
add-highlighter shared/perl/code/ regex \b(${values})\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 shared/perl/code regex %{\$!|\$"|\$#|\$\$|\$%|\$&|\$'|\$\(|\$\)|\$\*|\$\+|\$,|\$_|\$-|\$`|\$\.|\$/|\$:|\$;|\$<|\$=|\$>|\$\?|\$@|\$\[|\$\\|\$\]|\$\^|\$\||\$~|%!|@\+|@-|@_} 0:value
add-highlighter shared/perl/code regex (%ENV|%INC|%OVERLOAD|%SIG|@ARGV|@INC|@LAST_MATCH_START) 0:value
add-highlighter shared/perl/code regex %{%\^(H)\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 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 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 shared/perl/code/ regex %{\$!|\$"|\$#|\$\$|\$%|\$&|\$'|\$\(|\$\)|\$\*|\$\+|\$,|\$_|\$-|\$`|\$\.|\$/|\$:|\$;|\$<|\$=|\$>|\$\?|\$@|\$\[|\$\\|\$\]|\$\^|\$\||\$~|%!|@\+|@-|@_} 0:value
add-highlighter shared/perl/code/ regex (%ENV|%INC|%OVERLOAD|%SIG|@ARGV|@INC|@LAST_MATCH_START) 0:value
add-highlighter shared/perl/code/ regex %{%\^(H)\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 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 shared/perl/code regex \$[0-9]+ 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 shared/perl/code/ regex \$[0-9]+ 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 shared/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 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 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
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 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
# ‾‾‾‾‾‾‾‾
@ -102,7 +98,7 @@ define-command -hidden perl-indent-on-closing-curly-brace %[
# Initialization
# ‾‾‾‾‾‾‾‾‾‾‾‾‾‾
hook -group perl-highlight global WinSetOption filetype=perl %{ add-highlighter window ref perl }
hook -group perl-highlight global WinSetOption filetype=perl %{ add-highlighter window/perl ref perl }
hook global WinSetOption filetype=perl %{
# cleanup trailing whitespaces when exiting insert mode

View File

@ -8,140 +8,65 @@ hook global BufCreate .*[.](rst) %{
# Highlighters
# ‾‾‾‾‾‾‾‾‾‾‾‾
add-highlighter shared/ regions -default content restructuredtext \
c \.\.\h*code::\h*c\h*\n ^\S '' \
cabal \.\.\h*code::\h*cabal\h*\n ^\S '' \
clojure \.\.\h*code::\h*clojure\h*\n ^\S '' \
coffee \.\.\h*code::\h*coffee\h*\n ^\S '' \
cpp \.\.\h*code::\h*cpp\h*\n ^\S '' \
css \.\.\h*code::\h*css\h*\n ^\S '' \
cucumber \.\.\h*code::\h*cucumber\h*\n ^\S '' \
d \.\.\h*code::\h*d\h*\n ^\S '' \
diff \.\.\h*code::\h*diff\h*\n ^\S '' \
dockerfile \.\.\h*code::\h*dockerfile\h*\n ^\S '' \
fish \.\.\h*code::\h*fish\h*\n ^\S '' \
gas \.\.\h*code::\h*gas\h*\n ^\S '' \
go \.\.\h*code::\h*go\h*\n ^\S '' \
haml \.\.\h*code::\h*haml\h*\n ^\S '' \
haskell \.\.\h*code::\h*haskell\h*\n ^\S '' \
html \.\.\h*code::\h*html\h*\n ^\S '' \
ini \.\.\h*code::\h*ini\h*\n ^\S '' \
java \.\.\h*code::\h*java\h*\n ^\S '' \
javascript \.\.\h*code::\h*javascript\h*\n ^\S '' \
json \.\.\h*code::\h*json\h*\n ^\S '' \
julia \.\.\h*code::\h*julia\h*\n ^\S '' \
kak \.\.\h*code::\h*kak\h*\n ^\S '' \
kickstart \.\.\h*code::\h*kickstart\h*\n ^\S '' \
latex \.\.\h*code::\h*latex\h*\n ^\S '' \
lisp \.\.\h*code::\h*lisp\h*\n ^\S '' \
lua \.\.\h*code::\h*lua\h*\n ^\S '' \
makefile \.\.\h*code::\h*makefile\h*\n ^\S '' \
moon \.\.\h*code::\h*moon\h*\n ^\S '' \
objc \.\.\h*code::\h*objc\h*\n ^\S '' \
perl \.\.\h*code::\h*perl\h*\n ^\S '' \
pug \.\.\h*code::\h*pug\h*\n ^\S '' \
python \.\.\h*code::\h*python\h*\n ^\S '' \
ragel \.\.\h*code::\h*ragel\h*\n ^\S '' \
ruby \.\.\h*code::\h*ruby\h*\n ^\S '' \
rust \.\.\h*code::\h*rust\h*\n ^\S '' \
sass \.\.\h*code::\h*sass\h*\n ^\S '' \
scala \.\.\h*code::\h*scala\h*\n ^\S '' \
scss \.\.\h*code::\h*scss\h*\n ^\S '' \
sh \.\.\h*code::\h*sh\h*\n ^\S '' \
swift \.\.\h*code::\h*swift\h*\n ^\S '' \
tupfile \.\.\h*code::\h*tupfile\h*\n ^\S '' \
yaml \.\.\h*code::\h*yaml\h*\n ^\S '' \
code ::\h*\n ^[^\s] ''
add-highlighter shared/restructuredtext regions
add-highlighter shared/restructuredtext/content default-region group
add-highlighter shared/restructuredtext/code region ::\h*\n ^[^\s] '' fill meta
add-highlighter shared/restructuredtext/code fill meta
add-highlighter shared/restructuredtext/c ref c
add-highlighter shared/restructuredtext/cabal ref cabal
add-highlighter shared/restructuredtext/clojure ref clojure
add-highlighter shared/restructuredtext/coffee ref coffee
add-highlighter shared/restructuredtext/cpp ref cpp
add-highlighter shared/restructuredtext/css ref css
add-highlighter shared/restructuredtext/cucumber ref cucumber
add-highlighter shared/restructuredtext/d ref d
add-highlighter shared/restructuredtext/diff ref diff
add-highlighter shared/restructuredtext/dockerfile ref dockerfile
add-highlighter shared/restructuredtext/fish ref fish
add-highlighter shared/restructuredtext/gas ref gas
add-highlighter shared/restructuredtext/go ref go
add-highlighter shared/restructuredtext/haml ref haml
add-highlighter shared/restructuredtext/haskell ref haskell
add-highlighter shared/restructuredtext/html ref html
add-highlighter shared/restructuredtext/ini ref ini
add-highlighter shared/restructuredtext/java ref java
add-highlighter shared/restructuredtext/javascript ref javascript
add-highlighter shared/restructuredtext/json ref json
add-highlighter shared/restructuredtext/julia ref julia
add-highlighter shared/restructuredtext/kak ref kakrc
add-highlighter shared/restructuredtext/kickstart ref kickstart
add-highlighter shared/restructuredtext/latex ref latex
add-highlighter shared/restructuredtext/lisp ref lisp
add-highlighter shared/restructuredtext/lua ref lua
add-highlighter shared/restructuredtext/makefile ref makefile
add-highlighter shared/restructuredtext/moon ref moon
add-highlighter shared/restructuredtext/objc ref objc
add-highlighter shared/restructuredtext/perl ref perl
add-highlighter shared/restructuredtext/pug ref pug
add-highlighter shared/restructuredtext/python ref python
add-highlighter shared/restructuredtext/ragel ref ragel
add-highlighter shared/restructuredtext/ruby ref ruby
add-highlighter shared/restructuredtext/rust ref rust
add-highlighter shared/restructuredtext/sass ref sass
add-highlighter shared/restructuredtext/scala ref scala
add-highlighter shared/restructuredtext/scss ref scss
add-highlighter shared/restructuredtext/sh ref sh
add-highlighter shared/restructuredtext/swift ref swift
add-highlighter shared/restructuredtext/tupfile ref tupfile
add-highlighter shared/restructuredtext/yaml ref yaml
evaluate-commands %sh{
for ft in c cabal clojure coffee cpp css cucumber ddiff dockerfile \
fish gas go haml haskell html ini java javascript json \
julia kak kickstart latex lisp lua makefile moon objc \
perl pug python ragel ruby rust sass scala scss sh swift \
tupfile yaml; do
ref=$(if [ "$ft" = kak ]; then echo "kakrc"; else echo "$ft"; fi)
printf 'add-highlighter shared/restructuredtext/%s region %s %s "" ref %s\n' "$ft" '\.\.\h*'$ft'::\h*c\h*\n' '^\S' "$ref"
done
}
# Setext-style header
# Valid header characters:
# # ! " $ % & ' ( ) * + , - . / : ; < = > ? @ [ \ ] ^ _ ` { | } ~
add-highlighter shared/restructuredtext/content regex (\A|\n\n)(#{3,}\n)?[^\n]+\n(#{3,})$ 0:title
add-highlighter shared/restructuredtext/content regex (\A|\n\n)(!{3,}\n)?[^\n]+\n(!{3,})$ 0:header
add-highlighter shared/restructuredtext/content regex (\A|\n\n)("{3,}\n)?[^\n]+\n("{3,})$ 0:header
add-highlighter shared/restructuredtext/content regex (\A|\n\n)(\${3,}\n)?[^\n]+\n(\${3,})$ 0:header
add-highlighter shared/restructuredtext/content regex (\A|\n\n)(%{3,}\n)?[^\n]+\n(%{3,})$ 0:header
add-highlighter shared/restructuredtext/content regex (\A|\n\n)(&{3,}\n)?[^\n]+\n(&{3,})$ 0:header
add-highlighter shared/restructuredtext/content regex (\A|\n\n)('{3,}\n)?[^\n]+\n('{3,})$ 0:header
add-highlighter shared/restructuredtext/content regex (\A|\n\n)(\({3,}\n)?[^\n]+\n(\({3,})$ 0:header
add-highlighter shared/restructuredtext/content regex (\A|\n\n)(\){3,}\n)?[^\n]+\n(\){3,})$ 0:header
add-highlighter shared/restructuredtext/content regex (\A|\n\n)(\*{3,}\n)?[^\n]+\n(\*{3,})$ 0:header
add-highlighter shared/restructuredtext/content regex (\A|\n\n)(\+{3,}\n)?[^\n]+\n(\+{3,})$ 0:header
add-highlighter shared/restructuredtext/content regex (\A|\n\n)(,{3,}\n)?[^\n]+\n(,{3,})$ 0:header
add-highlighter shared/restructuredtext/content regex (\A|\n\n)(-{3,}\n)?[^\n]+\n(-{3,})$ 0:header
add-highlighter shared/restructuredtext/content regex (\A|\n\n)(\.{3,}\n)?[^\n]+\n(\.{3,})$ 0:header
add-highlighter shared/restructuredtext/content regex (\A|\n\n)(/{3,}\n)?[^\n]+\n(/{3,})$ 0:header
add-highlighter shared/restructuredtext/content regex (\A|\n\n)(:{3,}\n)?[^\n]+\n(:{3,})$ 0:header
add-highlighter shared/restructuredtext/content regex (\A|\n\n)(\;{3,}\n)?[^\n]+\n(\;{3,})$ 0:header
add-highlighter shared/restructuredtext/content regex (\A|\n\n)(<{3,}\n)?[^\n]+\n(<{3,})$ 0:header
add-highlighter shared/restructuredtext/content regex (\A|\n\n)(={3,}\n)?[^\n]+\n(={3,})$ 0:header
add-highlighter shared/restructuredtext/content regex (\A|\n\n)(>{3,}\n)?[^\n]+\n(>{3,})$ 0:header
add-highlighter shared/restructuredtext/content regex (\A|\n\n)(\?{3,}\n)?[^\n]+\n(\?{3,})$ 0:header
add-highlighter shared/restructuredtext/content regex (\A|\n\n)(@{3,}\n)?[^\n]+\n(@{3,})$ 0:header
add-highlighter shared/restructuredtext/content regex (\A|\n\n)(\[{3,}\n)?[^\n]+\n(\[{3,})$ 0:header
add-highlighter shared/restructuredtext/content regex (\A|\n\n)(\\{3,}\n)?[^\n]+\n(\\{3,})$ 0:header
add-highlighter shared/restructuredtext/content regex (\A|\n\n)(\]{3,}\n)?[^\n]+\n(\]{3,})$ 0:header
add-highlighter shared/restructuredtext/content regex (\A|\n\n)(\^{3,}\n)?[^\n]+\n(\^{3,})$ 0:header
add-highlighter shared/restructuredtext/content regex (\A|\n\n)(_{3,}\n)?[^\n]+\n(_{3,})$ 0:header
add-highlighter shared/restructuredtext/content regex (\A|\n\n)(`{3,}\n)?[^\n]+\n(`{3,})$ 0:header
add-highlighter shared/restructuredtext/content regex (\A|\n\n)(\{{3,}\n)?[^\n]+\n(\{{3,})$ 0:header
add-highlighter shared/restructuredtext/content regex (\A|\n\n)(\|{3,}\n)?[^\n]+\n(\|{3,})$ 0:header
add-highlighter shared/restructuredtext/content regex (\A|\n\n)(\}{3,}\n)?[^\n]+\n(\}{3,})$ 0:header
add-highlighter shared/restructuredtext/content regex (\A|\n\n)(~{3,}\n)?[^\n]+\n(~{3,})$ 0:header
add-highlighter shared/restructuredtext/content/ regex (\A|\n\n)(#{3,}\n)?[^\n]+\n(#{3,})$ 0:title
add-highlighter shared/restructuredtext/content/ regex (\A|\n\n)(!{3,}\n)?[^\n]+\n(!{3,})$ 0:header
add-highlighter shared/restructuredtext/content/ regex (\A|\n\n)("{3,}\n)?[^\n]+\n("{3,})$ 0:header
add-highlighter shared/restructuredtext/content/ regex (\A|\n\n)(\${3,}\n)?[^\n]+\n(\${3,})$ 0:header
add-highlighter shared/restructuredtext/content/ regex (\A|\n\n)(%{3,}\n)?[^\n]+\n(%{3,})$ 0:header
add-highlighter shared/restructuredtext/content/ regex (\A|\n\n)(&{3,}\n)?[^\n]+\n(&{3,})$ 0:header
add-highlighter shared/restructuredtext/content/ regex (\A|\n\n)('{3,}\n)?[^\n]+\n('{3,})$ 0:header
add-highlighter shared/restructuredtext/content/ regex (\A|\n\n)(\({3,}\n)?[^\n]+\n(\({3,})$ 0:header
add-highlighter shared/restructuredtext/content/ regex (\A|\n\n)(\){3,}\n)?[^\n]+\n(\){3,})$ 0:header
add-highlighter shared/restructuredtext/content/ regex (\A|\n\n)(\*{3,}\n)?[^\n]+\n(\*{3,})$ 0:header
add-highlighter shared/restructuredtext/content/ regex (\A|\n\n)(\+{3,}\n)?[^\n]+\n(\+{3,})$ 0:header
add-highlighter shared/restructuredtext/content/ regex (\A|\n\n)(,{3,}\n)?[^\n]+\n(,{3,})$ 0:header
add-highlighter shared/restructuredtext/content/ regex (\A|\n\n)(-{3,}\n)?[^\n]+\n(-{3,})$ 0:header
add-highlighter shared/restructuredtext/content/ regex (\A|\n\n)(\.{3,}\n)?[^\n]+\n(\.{3,})$ 0:header
add-highlighter shared/restructuredtext/content/ regex (\A|\n\n)(/{3,}\n)?[^\n]+\n(/{3,})$ 0:header
add-highlighter shared/restructuredtext/content/ regex (\A|\n\n)(:{3,}\n)?[^\n]+\n(:{3,})$ 0:header
add-highlighter shared/restructuredtext/content/ regex (\A|\n\n)(\;{3,}\n)?[^\n]+\n(\;{3,})$ 0:header
add-highlighter shared/restructuredtext/content/ regex (\A|\n\n)(<{3,}\n)?[^\n]+\n(<{3,})$ 0:header
add-highlighter shared/restructuredtext/content/ regex (\A|\n\n)(={3,}\n)?[^\n]+\n(={3,})$ 0:header
add-highlighter shared/restructuredtext/content/ regex (\A|\n\n)(>{3,}\n)?[^\n]+\n(>{3,})$ 0:header
add-highlighter shared/restructuredtext/content/ regex (\A|\n\n)(\?{3,}\n)?[^\n]+\n(\?{3,})$ 0:header
add-highlighter shared/restructuredtext/content/ regex (\A|\n\n)(@{3,}\n)?[^\n]+\n(@{3,})$ 0:header
add-highlighter shared/restructuredtext/content/ regex (\A|\n\n)(\[{3,}\n)?[^\n]+\n(\[{3,})$ 0:header
add-highlighter shared/restructuredtext/content/ regex (\A|\n\n)(\\{3,}\n)?[^\n]+\n(\\{3,})$ 0:header
add-highlighter shared/restructuredtext/content/ regex (\A|\n\n)(\]{3,}\n)?[^\n]+\n(\]{3,})$ 0:header
add-highlighter shared/restructuredtext/content/ regex (\A|\n\n)(\^{3,}\n)?[^\n]+\n(\^{3,})$ 0:header
add-highlighter shared/restructuredtext/content/ regex (\A|\n\n)(_{3,}\n)?[^\n]+\n(_{3,})$ 0:header
add-highlighter shared/restructuredtext/content/ regex (\A|\n\n)(`{3,}\n)?[^\n]+\n(`{3,})$ 0:header
add-highlighter shared/restructuredtext/content/ regex (\A|\n\n)(\{{3,}\n)?[^\n]+\n(\{{3,})$ 0:header
add-highlighter shared/restructuredtext/content/ regex (\A|\n\n)(\|{3,}\n)?[^\n]+\n(\|{3,})$ 0:header
add-highlighter shared/restructuredtext/content/ regex (\A|\n\n)(\}{3,}\n)?[^\n]+\n(\}{3,})$ 0:header
add-highlighter shared/restructuredtext/content/ regex (\A|\n\n)(~{3,}\n)?[^\n]+\n(~{3,})$ 0:header
# Inline markup
add-highlighter shared/restructuredtext/content regex [^*](\*\*([^\s*]|([^\s*][^*]*[^\s*]))\*\*)[^*] 1:bold
add-highlighter shared/restructuredtext/content regex [^*](\*([^\s*]|([^\s*][^*]*[^\s*]))\*)[^*] 1:italic
add-highlighter shared/restructuredtext/content regex [^`](``([^\s`]|([^\s`][^`]*[^\s`]))``)[^`] 1:mono
add-highlighter shared/restructuredtext/content/ regex [^*](\*\*([^\s*]|([^\s*][^*]*[^\s*]))\*\*)[^*] 1:bold
add-highlighter shared/restructuredtext/content/ regex [^*](\*([^\s*]|([^\s*][^*]*[^\s*]))\*)[^*] 1:italic
add-highlighter shared/restructuredtext/content/ regex [^`](``([^\s`]|([^\s`][^`]*[^\s`]))``)[^`] 1:mono
# Initialization
# ‾‾‾‾‾‾‾‾‾‾‾‾‾‾
#
hook -group restructuredtext-highlight global WinSetOption filetype=restructuredtext %{ add-highlighter window ref restructuredtext }
hook -group restructuredtext-highlight global WinSetOption filetype=restructuredtext %{ add-highlighter window/restructuredtext ref restructuredtext }
hook -group restructuredtext-highlight global WinSetOption filetype=(?!restructuredtext).* %{ remove-highlighter window/restructuredtext }

View File

@ -11,29 +11,27 @@ hook global BufCreate .*[.](rust|rs) %{
# Highlighters
# ‾‾‾‾‾‾‾‾‾‾‾‾
add-highlighter shared/ regions -default code rust \
string %{(?<!')"} (?<!\\)(\\\\)*" '' \
comment // $ '' \
comment /\* \*/ /\*
add-highlighter shared/rust regions
add-highlighter shared/rust/code default-region group
add-highlighter shared/rust/string region %{(?<!')"} (?<!\\)(\\\\)*" '' fill string
add-highlighter shared/rust/comment region /\* \*/ /\* fill comment
add-highlighter shared/rust/line_comment region // $ '' fill comment
add-highlighter shared/rust/string fill string
add-highlighter shared/rust/comment fill comment
add-highlighter shared/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:
# https://doc.rust-lang.org/reference.html#number-literals
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|f)(?:8|16|32|64|128|size))?)\b 0:value
add-highlighter shared/rust/code regex \b(?:&&|\|\|)\b 0:operator
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|f)(?:8|16|32|64|128|size))?)\b 0:value
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:
# https://doc.rust-lang.org/grammar.html#keywords
add-highlighter shared/rust/code regex (?:#!?\[.*?\]) 0:meta
add-highlighter shared/rust/code regex \b(?:let|as|fn|return|match|if|else|loop|for|in|while|break|continue|move|box|where|impl|dyn|pub|unsafe)\b 0:keyword
add-highlighter shared/rust/code regex \b(?:trait|struct|enum|type|mut|ref|static|const)\b 0:attribute
add-highlighter shared/rust/code regex \b(?:u8|u16|u32|u64|u128|usize|i8|i16|i32|i64|i128|isize|f32|f64|bool|char|str|Self)\b 0:type
add-highlighter shared/rust/code regex \b(?:mod|crate|use|extern)\b 0:module
add-highlighter shared/rust/code regex \$\w+\b 0:variable
add-highlighter shared/rust/code regex "'\\\\?.'" 0:value
add-highlighter shared/rust/code regex "('\w+)[^']" 1:meta
add-highlighter shared/rust/code/ regex (?:#!?\[.*?\]) 0:meta
add-highlighter shared/rust/code/ regex \b(?:let|as|fn|return|match|if|else|loop|for|in|while|break|continue|move|box|where|impl|dyn|pub|unsafe)\b 0:keyword
add-highlighter shared/rust/code/ regex \b(?:trait|struct|enum|type|mut|ref|static|const)\b 0:attribute
add-highlighter shared/rust/code/ regex \b(?:u8|u16|u32|u64|u128|usize|i8|i16|i32|i64|i128|isize|f32|f64|bool|char|str|Self)\b 0:type
add-highlighter shared/rust/code/ regex \b(?:mod|crate|use|extern)\b 0:module
add-highlighter shared/rust/code/ regex \$\w+\b 0:variable
add-highlighter shared/rust/code/ regex "'\\\\?.'" 0:value
add-highlighter shared/rust/code/ regex "('\w+)[^']" 1:meta
# Commands
# ‾‾‾‾‾‾‾‾
@ -75,7 +73,7 @@ define-command -hidden rust-indent-on-closing-curly-brace %[
# Initialization
# ‾‾‾‾‾‾‾‾‾‾‾‾‾‾
hook -group rust-highlight global WinSetOption filetype=rust %{ add-highlighter window ref rust }
hook -group rust-highlight global WinSetOption filetype=rust %{ add-highlighter window/rust ref rust }
hook global WinSetOption filetype=rust %[
hook window ModeChange insert:.* -group rust-hooks rust-filter-around-selections

View File

@ -11,27 +11,24 @@ hook global BufCreate .*[.](scala) %{
# Highlighters
# ‾‾‾‾‾‾‾‾‾‾‾‾
add-highlighter shared/ regions -default code scala \
string '"' (?<!\\)(\\\\)*" '' \
literal ` ` '' \
comment // $ '' \
comment /[*] [*]/ /[*]
add-highlighter shared/scala/string fill string
add-highlighter shared/scala/literal fill variable
add-highlighter shared/scala/comment fill comment
add-highlighter shared/scala regions
add-highlighter shared/scala/code default-region group
add-highlighter shared/scala/string region '"' (?<!\\)(\\\\)*" '' fill string
add-highlighter shared/scala/literal region ` ` '' fill variable
add-highlighter shared/scala/comment region /[*] [*]/ /[*] fill comment
add-highlighter shared/scala/line_comment region // $ '' fill comment
# Keywords are collected at
# http://tutorialspoint.com/scala/scala_basic_syntax.htm
add-highlighter shared/scala/code regex (?:\b|\W)(@\w+|import|package)\b 0:meta
add-highlighter shared/scala/code regex \b(true|false|null)\b 0:value
add-highlighter shared/scala/code regex \b(?:class|extends|with)\s+(\w+) 0:type
add-highlighter shared/scala/code regex \b([A-Z]\w*)\b 0:type
add-highlighter shared/scala/code regex (?:def|var|val)\s+(\w+) 0:variable
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|this|super|throw|trait|try|unbecome|using|val|var|when|while|with|yield)\b 0:keyword
add-highlighter shared/scala/code regex \b(abstract|final|implicit|implicitly|lazy|override|private|protected|require|sealed)\b 0:attribute
add-highlighter shared/scala/code regex (\[|\]|=>|<:|:>|=:=|::|&&|\|\|) 0:operator
add-highlighter shared/scala/code/ regex (?:\b|\W)(@\w+|import|package)\b 0:meta
add-highlighter shared/scala/code/ regex \b(true|false|null)\b 0:value
add-highlighter shared/scala/code/ regex \b(?:class|extends|with)\s+(\w+) 0:type
add-highlighter shared/scala/code/ regex \b([A-Z]\w*)\b 0:type
add-highlighter shared/scala/code/ regex (?:def|var|val)\s+(\w+) 0:variable
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|this|super|throw|trait|try|unbecome|using|val|var|when|while|with|yield)\b 0:keyword
add-highlighter shared/scala/code/ regex \b(abstract|final|implicit|implicitly|lazy|override|private|protected|require|sealed)\b 0:attribute
add-highlighter shared/scala/code/ regex (\[|\]|=>|<:|:>|=:=|::|&&|\|\|) 0:operator
# Commands
# ‾‾‾‾‾‾‾‾
@ -64,7 +61,7 @@ define-command -hidden scala-indent-on-closing-curly-brace %[
# Initialization
# ‾‾‾‾‾‾‾‾‾‾‾‾‾‾
hook -group scala-highlight global WinSetOption filetype=scala %{ add-highlighter window ref scala }
hook -group scala-highlight global WinSetOption filetype=scala %{ add-highlighter window/scala ref scala }
hook global WinSetOption filetype=scala %[
hook window ModeChange insert:.* -group scala-hooks scala-filter-around-selections

View File

@ -11,12 +11,13 @@ hook global BufCreate .*/?(?i)sql %{
# Highlighters
# ‾‾‾‾‾‾‾‾‾‾‾‾
add-highlighter shared/ regions -default code sql \
string '"' (?<!\\)(\\\\)*" '' \
string "'" (?<!\\)(\\\\)*' '' \
comment '--' '$' '' \
comment '#' '$' '' \
comment '/\*' '\*/' ''
add-highlighter shared/sql regions
add-highlighter shared/sql/code default-region group
add-highlighter shared/sql/double_string region '"' (?<!\\)(\\\\)*" '' fill string
add-highlighter shared/sql/single_string region "'" (?<!\\)(\\\\)*' '' fill string
add-highlighter shared/sql/comment1 region '--' '$' '' fill comment
add-highlighter shared/sql/comment2 region '#' '$' '' fill comment
add-highlighter shared/sql/comment3 region '/\*' '\*/' '' fill comment
evaluate-commands %sh{
# Keywords
@ -85,25 +86,23 @@ evaluate-commands %sh{
# Highlight keywords
printf %s "
add-highlighter shared/sql/code regex '\b(${functions})\(.*\)' 0:function
add-highlighter shared/sql/code regex '\b(${data_types_fn})\(.*?\)' 0:type
add-highlighter shared/sql/code regex '\b(${keywords})\b' 0:keyword
add-highlighter shared/sql/code regex '\b(${operators})\b' 0:operator
add-highlighter shared/sql/code regex '\b(${data_types})\b' 0:type
add-highlighter shared/sql/code/ regex '\b(${functions})\(.*\)' 0:function
add-highlighter shared/sql/code/ regex '\b(${data_types_fn})\(.*?\)' 0:type
add-highlighter shared/sql/code/ regex '\b(${keywords})\b' 0:keyword
add-highlighter shared/sql/code/ regex '\b(${operators})\b' 0:operator
add-highlighter shared/sql/code/ regex '\b(${data_types})\b' 0:type
"
}
add-highlighter shared/sql/code regex '\+|-|\*|/|%|&|\||^|=|>|<|>=|<=|<>|\+=|-=|\*=|/=|%=|&=|^-=|\|\*=' 0:operator
add-highlighter shared/sql/code regex \bNULL\b 0:value
add-highlighter shared/sql/code regex \b\d+(?:\.\d+)?\b 0:value
add-highlighter shared/sql/string fill string
add-highlighter shared/sql/comment fill comment
add-highlighter shared/sql/code/ regex '\+|-|\*|/|%|&|\||^|=|>|<|>=|<=|<>|\+=|-=|\*=|/=|%=|&=|^-=|\|\*=' 0:operator
add-highlighter shared/sql/code/ regex \bNULL\b 0:value
add-highlighter shared/sql/code/ regex \b\d+(?:\.\d+)?\b 0:value
# Initialization
# ‾‾‾‾‾‾‾‾‾‾‾‾‾‾
hook -group sql-highlight global WinSetOption filetype=sql %{
add-highlighter window ref sql
add-highlighter window/sql ref sql
}
hook -group sql-highlight global WinSetOption filetype=(?!sql).* %{

View File

@ -2,26 +2,25 @@ hook global BufCreate .*\.(swift) %{
set-option buffer filetype swift
}
add-highlighter shared/ regions -default code swift \
string %{(?<!')"} %{(?<!\\)(\\\\)*"} '' \
comment /\* \*/ '' \
comment // $ ''
add-highlighter shared/swift regions
add-highlighter shared/swift/code default-region group
add-highlighter shared/swift/string region %{(?<!')"} %{(?<!\\)(\\\\)*"} '' fill string
add-highlighter shared/swift/comment region /\* \*/ '' group
add-highlighter shared/swift/line_comment region // $ '' ref swift/comment
add-highlighter shared/swift/string fill string
add-highlighter shared/swift/comment fill comment
add-highlighter shared/swift/comment/ fill comment
add-highlighter shared/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 shared/swift/code/ regex %{\b(true|false|nil)\b|\b-?(?!\$)\d+[fdiu]?|'((\\.)?|[^'\\])'} 0:value
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 shared/swift/code/ regex "\bas\b[!?]?" 0:keyword
add-highlighter shared/swift/code/ regex "(\$[0-9])\b" 0:keyword
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 shared/swift/code regex %{\b(true|false|nil)\b|\b-?(?!\$)\d+[fdiu]?|'((\\.)?|[^'\\])'} 0:value
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 shared/swift/code regex "\bas\b[!?]?" 0:keyword
add-highlighter shared/swift/code regex "(\$[0-9])\b" 0:keyword
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 shared/swift/code/ regex "\b(self|nil|id|super)\b" 0:value
add-highlighter shared/swift/code/ regex "\b(Bool|String|UInt|UInt16|UInt32|UInt64|UInt8)\b" 0:type
add-highlighter shared/swift/code/ regex "\b(IBAction|IBOutlet)\b" 0:attribute
add-highlighter shared/swift/code/ regex "@\w+\b" 0:attribute
add-highlighter shared/swift/code regex "\b(self|nil|id|super)\b" 0:value
add-highlighter shared/swift/code regex "\b(Bool|String|UInt|UInt16|UInt32|UInt64|UInt8)\b" 0:type
add-highlighter shared/swift/code regex "\b(IBAction|IBOutlet)\b" 0:attribute
add-highlighter shared/swift/code regex "@\w+\b" 0:attribute
hook -group swift-highlight global WinSetOption filetype=swift %{ add-highlighter window ref swift }
hook -group swift-highlight global WinSetOption filetype=swift %{ add-highlighter window/swift ref swift }
hook -group swift-highlight global WinSetOption filetype=(?!swift).* %{ remove-highlighter window/swift }

View File

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

View File

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

View File

@ -11,36 +11,33 @@ hook global BufCreate .*[.](coffee) %{
# Highlighters
# ‾‾‾‾‾‾‾‾‾‾‾‾
add-highlighter shared/ regions -default code coffee \
double_string '"""' '"""' '' \
single_string "'''" "'''" '' \
comment '###' '###' '' \
regex '///' ///[gimy]* '' \
double_string '"' (?<!\\)(\\\\)*" '' \
single_string "'" "'" '' \
regex '/' (?<!\\)(\\\\)*/[gimy]* '' \
comment '#' '$' ''
add-highlighter shared/coffee regions
add-highlighter shared/coffee/code default-region group
add-highlighter shared/coffee/single_string region "'" "'" '' fill string
add-highlighter shared/coffee/single_string_alt region "'''" "'''" '' fill string
add-highlighter shared/coffee/double_string region '"' (?<!\\)(\\\\)*" '' regions
add-highlighter shared/coffee/double_string_alt region '"""' '"""' '' ref shared/coffee/double_string
add-highlighter shared/coffee/regex region '/' (?<!\\)(\\\\)*/[gimy]* '' regions
add-highlighter shared/coffee/regex_alt region '///' ///[gimy]* '' ref shared/coffee/regex
add-highlighter shared/coffee/comment1 region '#' '$' '' fill comment
add-highlighter shared/coffee/comment2 region '###' '###' '' fill comment
# 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
add-highlighter shared/coffee/double_string fill string
add-highlighter shared/coffee/double_string regions regions interpolation \Q#{ \} \{
add-highlighter shared/coffee/double_string/regions/interpolation fill meta
add-highlighter shared/coffee/single_string fill string
add-highlighter shared/coffee/regex fill meta
add-highlighter shared/coffee/regex regions regions interpolation \Q#{ \} \{
add-highlighter shared/coffee/regex/regions/interpolation fill meta
add-highlighter shared/coffee/comment fill comment
add-highlighter shared/coffee/double_string/base default-region fill string
add-highlighter shared/coffee/double_string/interpolation region \Q#{ \} \{ fill meta
add-highlighter shared/coffee/regex/base default-region fill meta
add-highlighter shared/coffee/regex/interpolation region \Q#{ \} \{ fill meta
# Keywords are collected at
# https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Lexical_grammar#Keywords
# http://coffeescript.org/documentation/docs/lexer.html#section-63
add-highlighter shared/coffee/code regex [$@]\w* 0:variable
add-highlighter shared/coffee/code regex \b(Array|Boolean|Date|Function|Number|Object|RegExp|String)\b 0:type
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 shared/coffee/code regex \b(and|is|isnt|not|or)\b 0:operator
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
add-highlighter shared/coffee/code/ regex [$@]\w* 0:variable
add-highlighter shared/coffee/code/ regex \b(Array|Boolean|Date|Function|Number|Object|RegExp|String)\b 0:type
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 shared/coffee/code/ regex \b(and|is|isnt|not|or)\b 0:operator
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
# ‾‾‾‾‾‾‾‾
@ -69,7 +66,7 @@ define-command -hidden coffee-indent-on-new-line %{
# Initialization
# ‾‾‾‾‾‾‾‾‾‾‾‾‾‾
hook -group coffee-highlight global WinSetOption filetype=coffee %{ add-highlighter window ref coffee }
hook -group coffee-highlight global WinSetOption filetype=coffee %{ add-highlighter window/coffee ref coffee }
hook global WinSetOption filetype=coffee %{
hook window ModeChange insert:.* -group coffee-hooks coffee-filter-around-selections

View File

@ -11,14 +11,13 @@ hook global BufCreate .*[.](feature|story) %{
# Highlighters
# ‾‾‾‾‾‾‾‾‾‾‾‾
add-highlighter shared/ regions -default code cucumber \
language ^\h*#\h*language: $ '' \
comment ^\h*# $ ''
add-highlighter shared/cucumber regions
add-highlighter shared/cucumber/code default-region group
add-highlighter shared/cucumber/language region ^\h*#\h*language: $ '' group
add-highlighter shared/cucumber/comment region ^\h*# $ '' fill comment
add-highlighter shared/cucumber/language fill meta
add-highlighter shared/cucumber/comment fill comment
add-highlighter shared/cucumber/language regex \S+$ 0:value
add-highlighter shared/cucumber/language/ fill meta
add-highlighter shared/cucumber/language/ regex \S+$ 0:value
# Spoken languages
# ‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾
@ -51,7 +50,7 @@ add-highlighter shared/cucumber/language regex \S+$ 0:value
# …
# }
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
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
# ‾‾‾‾‾‾‾‾
@ -77,7 +76,7 @@ define-command -hidden cucumber-indent-on-new-line %{
# Initialization
# ‾‾‾‾‾‾‾‾‾‾‾‾‾‾
hook -group cucumber-highlight global WinSetOption filetype=cucumber %{ add-highlighter window ref cucumber }
hook -group cucumber-highlight global WinSetOption filetype=cucumber %{ add-highlighter window/cucumber ref cucumber }
hook global WinSetOption filetype=cucumber %{
hook window ModeChange insert:.* -group cucumber-hooks cucumber-filter-around-selections

View File

@ -12,32 +12,31 @@ hook global BufCreate .*[.](ex|exs) %{
# Highlighters
# ‾‾‾‾‾‾‾‾‾‾‾‾
add-highlighter shared/ regions -default code elixir \
double_string '"' (?<!\\)(\\\\)*" '' \
double_string '"""' (?<!\\)(\\\\)*""" '' \
single_string "'" (?<!\\)(\\\\)*' '' \
comment '#' '$' ''
add-highlighter shared/elixir regions
add-highlighter shared/elixir/code default-region group
add-highlighter shared/elixir/double_string region '"' (?<!\\)(\\\\)*" '' regions
add-highlighter shared/elixir/triple_string region '"""' (?<!\\)(\\\\)*""" '' ref shared/elixir/double_string
add-highlighter shared/elixir/single_string region "'" (?<!\\)(\\\\)*' '' fill string
add-highlighter shared/elixir/comment region '#' '$' '' fill comment
add-highlighter shared/elixir/comment fill comment
add-highlighter shared/elixir/double_string fill string
add-highlighter shared/elixir/double_string regions regions interpolation \Q#{ \} \{
add-highlighter shared/elixir/double_string/regions/interpolation fill builtin
add-highlighter shared/elixir/single_string fill string
add-highlighter shared/elixir/code regex ':[\w_]+\b' 0:type
add-highlighter shared/elixir/code regex '[\w_]+:' 0:type
add-highlighter shared/elixir/code regex '[A-Z][\w_]+\b' 0:module
add-highlighter shared/elixir/code regex '(:[\w_]+)(\.)' 1:module
add-highlighter shared/elixir/code regex '\b_\b' 0:default
add-highlighter shared/elixir/code regex '\b_[\w_]+\b' 0:default
add-highlighter shared/elixir/code regex '~[a-zA-Z]\(.*\)' 0:string
add-highlighter shared/elixir/code regex \b(true|false|nil)\b 0:value
add-highlighter shared/elixir/code regex (->|<-|<<|>>|=>) 0:builtin
add-highlighter shared/elixir/code regex \b(require|alias|use|import)\b 0:keyword
add-highlighter shared/elixir/code regex \b(__MODULE__|__DIR__|__ENV__|__CALLER__)\b 0:value
add-highlighter shared/elixir/code regex \b(def|defp|defmacro|defmacrop|defstruct|defmodule|defimpl|defprotocol|defoverridable)\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 shared/elixir/code regex '@[\w_]+\b' 0:attribute
add-highlighter shared/elixir/code regex '\b\d+[\d_]*\b' 0:value
add-highlighter shared/elixir/double_string/base default-region fill string
add-highlighter shared/elixir/double_string/interpolation region \Q#{ \} \{ fill builtin
add-highlighter shared/elixir/code/ regex ':[\w_]+\b' 0:type
add-highlighter shared/elixir/code/ regex '[\w_]+:' 0:type
add-highlighter shared/elixir/code/ regex '[A-Z][\w_]+\b' 0:module
add-highlighter shared/elixir/code/ regex '(:[\w_]+)(\.)' 1:module
add-highlighter shared/elixir/code/ regex '\b_\b' 0:default
add-highlighter shared/elixir/code/ regex '\b_[\w_]+\b' 0:default
add-highlighter shared/elixir/code/ regex '~[a-zA-Z]\(.*\)' 0:string
add-highlighter shared/elixir/code/ regex \b(true|false|nil)\b 0:value
add-highlighter shared/elixir/code/ regex (->|<-|<<|>>|=>) 0:builtin
add-highlighter shared/elixir/code/ regex \b(require|alias|use|import)\b 0:keyword
add-highlighter shared/elixir/code/ regex \b(__MODULE__|__DIR__|__ENV__|__CALLER__)\b 0:value
add-highlighter shared/elixir/code/ regex \b(def|defp|defmacro|defmacrop|defstruct|defmodule|defimpl|defprotocol|defoverridable)\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 shared/elixir/code/ regex '@[\w_]+\b' 0:attribute
add-highlighter shared/elixir/code/ regex '\b\d+[\d_]*\b' 0:value
# Commands
# ‾‾‾‾‾‾‾‾
@ -65,7 +64,7 @@ define-command -hidden elixir-indent-on-new-line %{
# Initialization
# ‾‾‾‾‾‾‾‾‾‾‾‾‾‾
hook -group elixir-highlight global WinSetOption filetype=elixir %{ add-highlighter window ref elixir }
hook -group elixir-highlight global WinSetOption filetype=elixir %{ add-highlighter window/elixir ref elixir }
hook global WinSetOption filetype=elixir %{
hook window ModeChange insert:.* -group elixir-hooks elixir-filter-around-selections

View File

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

View File

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

View File

@ -11,24 +11,19 @@ hook global BufCreate .*[.](haml) %{
# Highlighters
# ‾‾‾‾‾‾‾‾‾‾‾‾
add-highlighter shared/ regions -default code haml \
comment ^\h*/ $ '' \
eval ^\h*%([A-Za-z][A-Za-z0-9_-]*)([#.][A-Za-z][A-Za-z0-9_-]*)?\{\K|#\{\K (?=\}) \{ \
eval ^\h*[=-]\K (?<!\|)(?=\n) '' \
coffee ^\h*:coffee\K ^\h*[%=-]\K '' \
sass ^\h*:sass\K ^\h*[%=-]\K ''
add-highlighter shared/haml regions
add-highlighter shared/haml/code default-region group
add-highlighter shared/haml/comment region ^\h*/ $ '' fill comment
# Filters
# http://haml.info/docs/yardoc/file.REFERENCE.html#filters
add-highlighter shared/haml/eval1 region ^\h*%([A-Za-z][A-Za-z0-9_-]*)([#.][A-Za-z][A-Za-z0-9_-]*)?\{\K|#\{\K (?=\}) \{ ref ruby
add-highlighter shared/haml/eval2 region ^\h*[=-]\K (?<!\|)(?=\n) '' ref ruby
add-highlighter shared/haml/coffee region ^\h*:coffee\K ^\h*[%=-]\K '' ref coffee
add-highlighter shared/haml/sass region ^\h*:sass\K ^\h*[%=-]\K '' ref sass
add-highlighter shared/haml/comment fill comment
add-highlighter shared/haml/eval ref ruby
add-highlighter shared/haml/coffee ref coffee
add-highlighter shared/haml/sass ref sass
add-highlighter shared/haml/code regex ^\h*(:[a-z]+|-|=)|^(!!!)$ 0:meta
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
add-highlighter shared/haml/code/ regex ^\h*(:[a-z]+|-|=)|^(!!!)$ 0:meta
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
# ‾‾‾‾‾‾‾‾
@ -54,7 +49,7 @@ define-command -hidden haml-indent-on-new-line %{
# Initialization
# ‾‾‾‾‾‾‾‾‾‾‾‾‾‾
hook -group haml-highlight global WinSetOption filetype=haml %{ add-highlighter window ref haml }
hook -group haml-highlight global WinSetOption filetype=haml %{ add-highlighter window/haml ref haml }
hook global WinSetOption filetype=haml %{
hook window ModeChange insert:.* -group haml-hooks haml-filter-around-selections

View File

@ -11,25 +11,24 @@ hook global BufCreate .*[.](hbs) %{
# Highlighters
# ‾‾‾‾‾‾‾‾‾‾‾‾
add-highlighter shared/ regions -default html hbs \
comment \{\{!-- --\}\} '' \
comment \{\{! \}\} '' \
block-expression \{\{ \}\} ''
add-highlighter shared/hbs regions
add-highlighter shared/hbs/html default-region ref html
add-highlighter shared/hbs/comment region \{\{!-- --\}\} ' ' fill comment
add-highlighter shared/hbs/comment_alt region \{\{! \}\} '' fill comment
add-highlighter shared/hbs/block-expression region \{\{ \}\} '' group
add-highlighter shared/hbs/html ref html
add-highlighter shared/hbs/comment fill comment
add-highlighter shared/hbs/block-expression regex \{\{((#|/|)(\w|-)+) 1:meta
add-highlighter shared/hbs/block-expression/ regex \{\{((#|/|)(\w|-)+) 1:meta
# some hbs tags have a special meaning
add-highlighter shared/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'
add-highlighter shared/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 shared/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
add-highlighter shared/hbs/block-expression regex ((\w|-)+)=(('|").*?('|")) 1:attribute 3:value
add-highlighter shared/hbs/block-expression/ regex ((\w|-)+)=(('|").*?('|")) 1:attribute 3:value
# Commands
# ‾‾‾‾‾‾‾‾
@ -56,7 +55,7 @@ define-command -hidden hbs-indent-on-new-line %{
# ‾‾‾‾‾‾‾‾‾‾‾‾‾‾
hook -group hbs-highlight global WinSetOption filetype=hbs %{
add-highlighter window ref hbs
add-highlighter window/hbs ref hbs
}
hook global WinSetOption filetype=hbs %{

View File

@ -2,44 +2,45 @@ hook global BufCreate .*(sway|i3)/config %{
set buffer filetype i3
}
add-highlighter shared/ regions -default code i3 \
string %{"} %{"} "" \
string %{'} %{'} "" \
exec %{(?<=exec)} "$" "" \
comment "# " "$" ""
add-highlighter shared/i3 regions
add-highlighter shared/i3/code default-region group
add-highlighter shared/i3/double_string region %{"} %{"} "" group
add-highlighter shared/i3/single_string region %{'} %{'} "" group
add-highlighter shared/i3/exec region %{(?<=exec)} "$" "" fill string
add-highlighter shared/i3/comment region "# " "$" "" fill comment
add-highlighter shared/i3/string fill string
add-highlighter shared/i3/comment fill comment
add-highlighter shared/i3/exec fill string
add-highlighter shared/i3/double_string/ fill string
add-highlighter shared/i3/single_string/ fill string
# Symbols
add-highlighter shared/i3/code regex "[+|→]" 0:operator
add-highlighter shared/i3/code regex "\$\w+" 0:variable
add-highlighter shared/i3/code/ regex "[+|→]" 0:operator
add-highlighter shared/i3/code/ regex "\$\w+" 0:variable
# keys
add-highlighter shared/i3/code regex "\b(Shift|Control|Ctrl|Mod1|Mod2|Mod3|Mod4|Mod5|Mode_switch|Return|Escape|Print)\b" 0:value
add-highlighter shared/i3/code/ regex "\b(Shift|Control|Ctrl|Mod1|Mod2|Mod3|Mod4|Mod5|Mode_switch|Return|Escape|Print)\b" 0:value
# keywords
add-highlighter shared/i3/code regex "\b(bind|bindcode|bindsym|assign|new_window|popup_during_fullscreen|font|floating_modifier|default_orientation|workspace_layout|for_window|focus_follows_mouse|bar|position|colors|output|tray_output|workspace_buttons|workspace_auto_back_and_forth|binding_mode_indicator|debuglog|floating_minimum_size|floating_maximum_size|force_focus_wrapping|force_xinerama|force_display_urgency_hint|hidden_state|modifier|new_float|shmlog|socket_path|verbose|mouse_warping|strip_workspace_numbers|focus_on_window_activation|no_focus|set|mode|set_from_resource)\b" 0:keyword
add-highlighter shared/i3/code/ regex "\b(bind|bindcode|bindsym|assign|new_window|popup_during_fullscreen|font|floating_modifier|default_orientation|workspace_layout|for_window|focus_follows_mouse|bar|position|colors|output|tray_output|workspace_buttons|workspace_auto_back_and_forth|binding_mode_indicator|debuglog|floating_minimum_size|floating_maximum_size|force_focus_wrapping|force_xinerama|force_display_urgency_hint|hidden_state|modifier|new_float|shmlog|socket_path|verbose|mouse_warping|strip_workspace_numbers|focus_on_window_activation|no_focus|set|mode|set_from_resource)\b" 0:keyword
# function keywords
add-highlighter shared/i3/code regex "\b(exit|reload|restart|kill|fullscreen|global|layout|border|focus|move|open|split|append_layout|mark|unmark|resize|grow|shrink|show|nop|rename|title_format|sticky)\b" 0:function
add-highlighter shared/i3/code regex "\b(exec|exec_always|i3bar_command|status_command)\b" 0:function
add-highlighter shared/i3/code/ regex "\b(exit|reload|restart|kill|fullscreen|global|layout|border|focus|move|open|split|append_layout|mark|unmark|resize|grow|shrink|show|nop|rename|title_format|sticky)\b" 0:function
add-highlighter shared/i3/code/ regex "\b(exec|exec_always|i3bar_command|status_command)\b" 0:function
# " these are not keywords but we add them for consistency
add-highlighter shared/i3/code regex "\b(no|false|inactive)\b" 0:value
add-highlighter shared/i3/code/ regex "\b(no|false|inactive)\b" 0:value
# values
add-highlighter shared/i3/code regex "\b(1pixel|default|stacked|tabbed|normal|none|tiling|stacking|floating|enable|disable|up|down|horizontal|vertical|auto|up|down|left|right|parent|child|px|or|ppt|leave_fullscreen|toggle|mode_toggle|scratchpad|width|height|top|bottom|client|hide|primary|yes|all|active|window|container|to|absolute|center|on|off|ms|smart|ignore|pixel|splith|splitv|output|true)\b" 0:value
add-highlighter shared/i3/code regex "\b(next|prev|next_on_output|prev_on_output|back_and_forth|current|number|none|vertical|horizontal|both|dock|hide|invisible|gaps|smart_gaps|smart_borders|inner|outer|current|all|plus|minus|no_gaps)\b" 0:value
add-highlighter shared/i3/code/ regex "\b(1pixel|default|stacked|tabbed|normal|none|tiling|stacking|floating|enable|disable|up|down|horizontal|vertical|auto|up|down|left|right|parent|child|px|or|ppt|leave_fullscreen|toggle|mode_toggle|scratchpad|width|height|top|bottom|client|hide|primary|yes|all|active|window|container|to|absolute|center|on|off|ms|smart|ignore|pixel|splith|splitv|output|true)\b" 0:value
add-highlighter shared/i3/code/ regex "\b(next|prev|next_on_output|prev_on_output|back_and_forth|current|number|none|vertical|horizontal|both|dock|hide|invisible|gaps|smart_gaps|smart_borders|inner|outer|current|all|plus|minus|no_gaps)\b" 0:value
# double-dash arguments
add-highlighter shared/i3/code regex "--(release|border|whole-window|toggle|no-startup-id)" 0:attribute
add-highlighter shared/i3/code/ regex "--(release|border|whole-window|toggle|no-startup-id)" 0:attribute
# color
add-highlighter shared/i3/string regex "#[0-9a-fA-F]{6}" 0:value
add-highlighter shared/i3/double_string/ regex "#[0-9a-fA-F]{6}" 0:value
add-highlighter shared/i3/single_string/ regex "#[0-9a-fA-F]{6}" 0:value
# attributes
add-highlighter shared/i3/code regex "client\.(background|statusline|background|separator|statusline)" 1:attribute
add-highlighter shared/i3/code regex "client\.(focused_inactive|focused|unfocused|urgent|inactive_workspace|urgent_workspace|focused_workspace|active_workspace|placeholder)" 1:attribute
add-highlighter shared/i3/code/ regex "client\.(background|statusline|background|separator|statusline)" 1:attribute
add-highlighter shared/i3/code/ regex "client\.(focused_inactive|focused|unfocused|urgent|inactive_workspace|urgent_workspace|focused_workspace|active_workspace|placeholder)" 1:attribute
hook -group i3-highlight global WinSetOption filetype=i3 %{ add-highlighter window ref i3 }
hook -group i3-highlight global WinSetOption filetype=i3 %{ add-highlighter window/i3 ref i3 }
hook -group i3-highlight global WinSetOption filetype=(?!i3).* %{ remove-highlighter window/i3 }

View File

@ -22,26 +22,23 @@ define-command -hidden just-indent-on-new-line %{
# Highlighters
# ‾‾‾‾‾‾‾‾‾‾‾‾
add-highlighter shared/ regions -default content justfile \
comment '#' '$' '' \
double_string '"' (?<!\\)(\\\\)*" '' \
single_string "'" (?<!\\)(\\\\)*' '' \
inline '`' '`' '' \
shell '^\h+' '^[^\h]' ''
add-highlighter shared/justfile regions
add-highlighter shared/justfile/content default-region group
add-highlighter shared/justfile/comment region '#' '$' '' fill comment
add-highlighter shared/justfile/double_string region '"' (?<!\\)(\\\\)*" '' fill string
add-highlighter shared/justfile/single_string region "'" (?<!\\)(\\\\)*' '' fill string
add-highlighter shared/justfile/inline region '`' '`' '' ref sh
add-highlighter shared/justfile/shell region '^\h+' '^[^\h]' '' group
add-highlighter shared/justfile/comment fill comment
add-highlighter shared/justfile/single_string fill string
add-highlighter shared/justfile/double_string fill string
add-highlighter shared/justfile/shell ref sh
add-highlighter shared/justfile/inline ref sh
add-highlighter shared/justfile/shell/ ref sh
add-highlighter shared/justfile/content regex '^(@)?([\w-]+)(?:\s(.+))?\s?(:)(.+)?$' 1:operator 2:function 3:value 4:operator 5:type
add-highlighter shared/justfile/content regex '([=+])' 1:operator
add-highlighter shared/justfile/content regex '^([\w-]+)\s=' 1:value
add-highlighter shared/justfile/content/ regex '^(@)?([\w-]+)(?:\s(.+))?\s?(:)(.+)?$' 1:operator 2:function 3:value 4:operator 5:type
add-highlighter shared/justfile/content/ regex '([=+])' 1:operator
add-highlighter shared/justfile/content/ regex '^([\w-]+)\s=' 1:value
hook global WinSetOption filetype=justfile %{
hook window InsertChar \n -group justfile-indent just-indent-on-new-line
add-highlighter window ref justfile
add-highlighter window/justfile ref justfile
# variable substititution highlighting
add-highlighter shared/justfile/shell regex '(\{{2})([\w-]+)(\}{2})' 1:operator 2:variable 3:operator

View File

@ -2,29 +2,27 @@ hook global BufCreate .*\.ks %{
set-option buffer filetype kickstart
}
add-highlighter shared/ regions -default code kickstart \
comment '(^|\h)\K#' $ '' \
double_string '"' (?<!\\)(\\\\)*" '' \
single_string "'" (?<!\\)(\\\\)*' '' \
packages '^\h*\K%packages\b' '^\h*\K%end\b' '' \
shell '^\h*\K%(pre|pre-install|post)\b' '^\h*\K%end\b' ''
add-highlighter shared/kickstart regions
add-highlighter shared/kickstart/code default-region group
add-highlighter shared/kickstart/comment region '(^|\h)\K#' $ '' fill comment
add-highlighter shared/kickstart/double_string region '"' (?<!\\)(\\\\)*" '' fill string
add-highlighter shared/kickstart/single_string region "'" (?<!\\)(\\\\)*' '' fill string
add-highlighter shared/kickstart/packages region '^\h*\K%packages\b' '^\h*\K%end\b' '' group
add-highlighter shared/kickstart/shell region '^\h*\K%(pre|pre-install|post)\b' '^\h*\K%end\b' '' group
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 shared/kickstart/code regex '(--[\w-]+=? ?)([^-"\n][^\h\n]*)?' 1:attribute 2:string
add-highlighter shared/kickstart/code regex '%(include|ksappend)\b' 0: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 shared/kickstart/code/ regex '(--[\w-]+=? ?)([^-"\n][^\h\n]*)?' 1:attribute 2:string
add-highlighter shared/kickstart/code/ regex '%(include|ksappend)\b' 0:keyword
add-highlighter shared/kickstart/comment fill comment
add-highlighter shared/kickstart/single_string fill string
add-highlighter shared/kickstart/double_string fill string
add-highlighter shared/kickstart/packages regex "^\h*[\w-]*" 0:value
add-highlighter shared/kickstart/packages regex "#[^\n]*" 0:comment
add-highlighter shared/kickstart/packages regex "^\h*@\^?[\h\w-]*" 0:attribute
add-highlighter shared/kickstart/packages regex '\A\h*\K%packages\b' 0:type
add-highlighter shared/kickstart/packages regex '^\h*%end\b' 0:type
add-highlighter shared/kickstart/shell regex '\A\h*\K%(pre-install|pre|post)\b' 0:type
add-highlighter shared/kickstart/shell regex '^\h*%end\b' 0:type
add-highlighter shared/kickstart/shell ref sh
add-highlighter shared/kickstart/packages/ regex "^\h*[\w-]*" 0:value
add-highlighter shared/kickstart/packages/ regex "#[^\n]*" 0:comment
add-highlighter shared/kickstart/packages/ regex "^\h*@\^?[\h\w-]*" 0:attribute
add-highlighter shared/kickstart/packages/ regex '\A\h*\K%packages\b' 0:type
add-highlighter shared/kickstart/packages/ regex '^\h*%end\b' 0:type
add-highlighter shared/kickstart/shell/ regex '\A\h*\K%(pre-install|pre|post)\b' 0:type
add-highlighter shared/kickstart/shell/ regex '^\h*%end\b' 0:type
add-highlighter shared/kickstart/shell/ ref sh
hook -group kickstart-highlight global WinSetOption filetype=kickstart %{ add-highlighter window ref kickstart }
hook -group kickstart-highlight global WinSetOption filetype=kickstart %{ add-highlighter window/kickstart ref kickstart }
hook -group kickstart-highlight global WinSetOption filetype=(?!kickstart).* %{ remove-highlighter window/kickstart }

View File

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

View File

@ -11,21 +11,17 @@ hook global BufCreate .*[.](moon) %{
# Highlighters
# ‾‾‾‾‾‾‾‾‾‾‾‾
add-highlighter shared/ regions -default code moon \
double_string '"' (?<!\\)(\\\\)*" '' \
single_string "'" (?<!\\)(\\\\)*' '' \
comment '--' '$' '' \
add-highlighter shared/moon regions
add-highlighter shared/moon/code default-region group
add-highlighter shared/moon/double_string region '"' (?<!\\)(\\\\)*" '' regions
add-highlighter shared/moon/single_string region "'" (?<!\\)(\\\\)*' '' fill string
add-highlighter shared/moon/comment region '--' '$' '' fill comment
add-highlighter shared/moon/double_string fill string
add-highlighter shared/moon/double_string regions regions interpolation \Q#{ \} \{
add-highlighter shared/moon/double_string/regions/interpolation fill meta
add-highlighter shared/moon/double_string/base default-region fill string
add-highlighter shared/moon/double_string/interpolation region \Q#{ \} \{ fill meta
add-highlighter shared/moon/single_string fill string
add-highlighter shared/moon/comment fill comment
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 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
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 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
# ‾‾‾‾‾‾‾‾
@ -92,7 +88,7 @@ define-command -hidden moon-indent-on-new-line %{
# Initialization
# ‾‾‾‾‾‾‾‾‾‾‾‾‾‾
hook -group moon-highlight global WinSetOption filetype=moon %{ add-highlighter window ref moon }
hook -group moon-highlight global WinSetOption filetype=moon %{ add-highlighter window/moon ref moon }
hook global WinSetOption filetype=moon %{
hook window ModeChange insert:.* -group moon-hooks moon-filter-around-selections

View File

@ -11,17 +11,15 @@ hook global BufCreate .*\.nim(s|ble)? %{
# Highlighters
# ‾‾‾‾‾‾‾‾‾‾‾‾
add-highlighter shared/ regions -default code nim \
double_string '"' (?<!\\)(\\\\)*" '' \
double_string '"""' '"""' '' \
comment '#?#\[' '\]##?' ''
add-highlighter shared/nim regions
add-highlighter shared/nim/code default-region group
add-highlighter shared/nim/double_string region '"' (?<!\\)(\\\\)*" '' fill string
add-highlighter shared/nim/triple_string region '"""' '"""' '' fill string
add-highlighter shared/nim/comment region '#?#\[' '\]##?' '' fill comment
add-highlighter shared/nim/double_string fill string
add-highlighter shared/nim/comment fill comment
add-highlighter shared/nim/code regex \b(0[xXocCbB])?[\d_]+('[iIuUfFdD](8|16|32|64|128))?\b 0:value
add-highlighter shared/nim/code regex \b\d+\.\d+\b 0:value
add-highlighter shared/nim/code regex %{'[^'\n]'} 0:string
add-highlighter shared/nim/code/ regex \b(0[xXocCbB])?[\d_]+('[iIuUfFdD](8|16|32|64|128))?\b 0:value
add-highlighter shared/nim/code/ regex \b\d+\.\d+\b 0:value
add-highlighter shared/nim/code/ regex %{'[^'\n]'} 0:string
evaluate-commands %sh{
# Grammar
@ -45,13 +43,13 @@ evaluate-commands %sh{
# Highlight keywords
printf %s "
add-highlighter shared/nim/code regex \b(${keywords})\b 0:keyword
add-highlighter shared/nim/code regex \b(${types})\b 0:type
add-highlighter shared/nim/code regex \b(${values})\b 0:value
add-highlighter shared/nim/code/ regex \b(${keywords})\b 0:keyword
add-highlighter shared/nim/code/ regex \b(${types})\b 0:type
add-highlighter shared/nim/code/ regex \b(${values})\b 0:value
"
}
add-highlighter shared/nim/code regex '#[^\n]+' 0:comment
add-highlighter shared/nim/code/ regex '#[^\n]+' 0:comment
# Commands
# ‾‾‾‾‾‾‾‾
@ -72,7 +70,7 @@ def -hidden nim-indent-on-new-line %{
# Initialization
# ‾‾‾‾‾‾‾‾‾‾‾‾‾‾
hook -group nim-highlight global WinSetOption filetype=nim %{ add-highlighter window ref nim }
hook -group nim-highlight global WinSetOption filetype=nim %{ add-highlighter window/nim ref nim }
hook global WinSetOption filetype=nim %{
hook window InsertChar \n -group nim-indent nim-indent-on-new-line

View File

@ -8,45 +8,42 @@ hook global BufCreate .*[.](php) %{
# Highlighters
# ‾‾‾‾‾‾‾‾‾‾‾‾
add-highlighter shared/ regions -default code php \
double_string '"' (?<!\\)(\\\\)*" '' \
single_string "'" (?<!\\)(\\\\)*' '' \
doc_comment /// '$' '' \
doc_comment /\*\* \*/ '' \
comment // '$' '' \
comment /\* \*/ '' \
comment '#' '$' ''
add-highlighter shared/php regions
add-highlighter shared/php/code default-region group
add-highlighter shared/php/double_string region '"' (?<!\\)(\\\\)*" '' group
add-highlighter shared/php/single_string region "'" (?<!\\)(\\\\)*' '' fill string
add-highlighter shared/php/doc_comment region /// '$' '' group
add-highlighter shared/php/doc_comment2 region /\*\* \*/ '' ref php/doc_comment
add-highlighter shared/php/comment1 region // '$' '' fill comment
add-highlighter shared/php/comment2 region /\* \*/ '' fill comment
add-highlighter shared/php/comment3 region '#' '$' '' fill comment
add-highlighter shared/php/double_string fill string
add-highlighter shared/php/single_string fill string
add-highlighter shared/php/comment fill comment
add-highlighter shared/php/code regex &?\$\w* 0:variable
add-highlighter shared/php/code regex \b(false|null|parent|self|this|true)\b 0:value
add-highlighter shared/php/code regex "(\b|-)[0-9]*\.?[0-9]+\b" 0:value
add-highlighter shared/php/code regex \b((string|int|bool)|[A-Z][a-z].*?)\b 0:type
add-highlighter shared/php/code regex \B/[^\n/]+/[gimy]* 0:meta
add-highlighter shared/php/code regex '<\?(php)?|\?>' 0:meta
add-highlighter shared/php/code/ regex &?\$\w* 0:variable
add-highlighter shared/php/code/ regex \b(false|null|parent|self|this|true)\b 0:value
add-highlighter shared/php/code/ regex "(\b|-)[0-9]*\.?[0-9]+\b" 0:value
add-highlighter shared/php/code/ regex \b((string|int|bool)|[A-Z][a-z].*?)\b 0:type
add-highlighter shared/php/code/ regex \B/[^\n/]+/[gimy]* 0:meta
add-highlighter shared/php/code/ regex '<\?(php)?|\?>' 0:meta
add-highlighter shared/php/double_string regex (?<!\\)(\\\\)*(\$\w+)(->\w+)* 0:variable
add-highlighter shared/php/double_string regex \{(?<!\\)(\\\\)*(\$\w+)(->\w+)*\} 0:variable
add-highlighter shared/php/double_string/ fill string
add-highlighter shared/php/double_string/ regex (?<!\\)(\\\\)*(\$\w+)(->\w+)* 0:variable
add-highlighter shared/php/double_string/ regex \{(?<!\\)(\\\\)*(\$\w+)(->\w+)*\} 0:variable
# Highlight doc comments
add-highlighter shared/php/doc_comment fill string
add-highlighter shared/php/doc_comment regex '`.*`' 0:module
add-highlighter shared/php/doc_comment regex '@\w+' 0:meta
add-highlighter shared/php/doc_comment/ fill string
add-highlighter shared/php/doc_comment/ regex '`.*`' 0:module
add-highlighter shared/php/doc_comment/ regex '@\w+' 0:meta
# Keywords are collected at
# http://php.net/manual/en/reserved.keywords.php
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
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
# Highlighter for html with php tags in it, i.e. the structure of conventional php files
add-highlighter shared/ regions -default html php-file \
php '<\?(php)?' '\?>' ''
add-highlighter shared/php-file/php ref php
add-highlighter shared/php-file/html ref html
add-highlighter shared/php-file regions
add-highlighter shared/php-file/html default-region ref html
add-highlighter shared/php-file/php region '<\?(php)?' '\?>' '' ref php
# Commands
# ‾‾‾‾‾‾‾‾
@ -79,7 +76,7 @@ define-command -hidden php-indent-on-new-line %<
# Initialization
# ‾‾‾‾‾‾‾‾‾‾‾‾‾‾
hook -group php-highlight global WinSetOption filetype=php %{ add-highlighter window ref php-file }
hook -group php-highlight global WinSetOption filetype=php %{ add-highlighter window/php-file ref php-file }
hook global WinSetOption filetype=php %{
hook window ModeChange insert:.* -group php-hooks php-filter-around-selections

View File

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

View File

@ -15,31 +15,27 @@ hook global BufCreate .*[.](pug|jade) %{
# Highlighters
# ‾‾‾‾‾‾‾‾‾‾‾‾
add-highlighter shared/ regions -default code pug \
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.*' $ '' \
javascript ^\h*[-=!] $ '' \
double_string '"' (?:(?<!\\)(\\\\)*"|$) '' \
single_string "'" (?:(?<!\\)(\\\\)*'|$) '' \
comment // $ '' \
attribute \( \) \( \
puglang ^\h*\b(\block|extends|include|append|prepend|if|unless|else|case|when|default|each|while|mixin)\b $ '' \
add-highlighter shared/pug regions
add-highlighter shared/pug/code default-region group
add-highlighter shared/pug/text region ^\h*\|\s $ '' regex \h*(\|) 1:meta
add-highlighter shared/pug/text2 region '^\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.*' $ '' regex \h*(\|) 1:meta
add-highlighter shared/pug/javascript region ^\h*[-=!] $ '' ref javascript
add-highlighter shared/pug/double_string region '"' (?:(?<!\\)(\\\\)*"|$) '' fill string
add-highlighter shared/pug/single_string region "'" (?:(?<!\\)(\\\\)*'|$) '' fill string
add-highlighter shared/pug/comment region // $ '' fill comment
add-highlighter shared/pug/attribute region \( \) \( group
add-highlighter shared/pug/puglang region ^\h*\b(\block|extends|include|append|prepend|if|unless|else|case|when|default|each|while|mixin)\b $ '' group
# Filters
# ‾‾‾‾‾‾‾
add-highlighter shared/pug/double_string fill string
add-highlighter shared/pug/single_string fill string
add-highlighter shared/pug/comment fill comment
add-highlighter shared/pug/javascript ref javascript
add-highlighter shared/pug/attribute ref javascript
add-highlighter shared/pug/puglang ref javascript
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 shared/pug/attribute regex [()=] 0:operator
add-highlighter shared/pug/text regex \h*(\|) 1:meta
add-highlighter shared/pug/code regex ^\h*([A-Za-z][A-Za-z0-9_-]*) 1:type
add-highlighter shared/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:value
add-highlighter shared/pug/attribute/ ref javascript
add-highlighter shared/pug/attribute/ regex [()=] 0:operator
add-highlighter shared/pug/puglang/ ref javascript
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 shared/pug/code/ regex ^\h*([A-Za-z][A-Za-z0-9_-]*) 1:type
add-highlighter shared/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:value
# Commands
# ‾‾‾‾‾‾‾‾
@ -65,7 +61,7 @@ define-command -hidden pug-indent-on-new-line %{
# Initialization
# ‾‾‾‾‾‾‾‾‾‾‾‾‾‾
hook -group pug-highlight global WinSetOption filetype=pug %{ add-highlighter window ref pug }
hook -group pug-highlight global WinSetOption filetype=pug %{ add-highlighter window/pug ref pug }
hook global WinSetOption filetype=pug %{
hook window ModeChange insert:.* -group pug-hooks pug-filter-around-selections

View File

@ -13,18 +13,16 @@ hook global BufCreate .*[.](ragel|rl) %{
# Highlighters
# ‾‾‾‾‾‾‾‾‾‾‾‾
add-highlighter shared/ regions -default code ragel \
string '"' (?<!\\)(\\\\)*" '' \
string "'" "'" '' \
comment '#' '$' ''
add-highlighter shared/ragel regions
add-highlighter shared/ragel/code default-region group
add-highlighter shared/ragel/double_string region '"' (?<!\\)(\\\\)*" '' fill string
add-highlighter shared/ragel/single_string region "'" "'" '' fill string
add-highlighter shared/ragel/comment region '#' '$' '' fill comment
add-highlighter shared/ragel/string fill string
add-highlighter shared/ragel/comment fill comment
add-highlighter shared/ragel/code regex \b(true|false)\b 0:value
add-highlighter shared/ragel/code regex '%%\{|\}%%|<\w+>' 0:variable
add-highlighter shared/ragel/code regex :=|=>|->|:>|:>>|<: 0:operator
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
add-highlighter shared/ragel/code/ regex \b(true|false)\b 0:value
add-highlighter shared/ragel/code/ regex '%%\{|\}%%|<\w+>' 0:variable
add-highlighter shared/ragel/code/ regex :=|=>|->|:>|:>>|<: 0:operator
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
# ‾‾‾‾‾‾‾‾
@ -58,7 +56,7 @@ define-command -hidden ragel-indent-on-new-line %<
# Initialization
# ‾‾‾‾‾‾‾‾‾‾‾‾‾‾
hook -group ragel-highlight global WinSetOption filetype=ragel %{ add-highlighter window ref ragel }
hook -group ragel-highlight global WinSetOption filetype=ragel %{ add-highlighter window/ragel ref ragel }
hook global WinSetOption filetype=ragel %{
hook window ModeChange insert:.* -group ragel-hooks ragel-filter-around-selections

View File

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

View File

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

View File

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