1
1
mirror of https://github.com/mawww/kakoune.git synced 2024-12-24 12:02:15 +03:00

Merge remote-tracking branch 'alexherbo2/command-names'

This commit is contained in:
Maxime Coste 2017-01-10 13:44:11 +00:00
commit 343df600cb
67 changed files with 868 additions and 868 deletions

View File

@ -1201,25 +1201,25 @@ Highlighters
Manipulation of the displayed text is done through highlighters, which can be added
or removed with the command
-----------------------------------------------------
:addhl <highlighter_name> <highlighter_parameters...>
-----------------------------------------------------
---------------------------------------------------------------
:add-highlighter <highlighter_name> <highlighter_parameters...>
---------------------------------------------------------------
and
----------------------
:rmhl <highlighter_id>
----------------------
------------------------------------
:remove-highlighter <highlighter_id>
------------------------------------
`highlighter_id` is a name generated by the highlighter specified with `highlighter_name`,
possibly dependent on the parameters. Use command completion on rmhl to see the existing
possibly dependent on the parameters. Use command completion on remove-highlighter to see the existing
highlighters id.
general highlighters are:
* `regex <ex> <capture_id>:<face>...`: highlight a regex, takes the regex as
first parameter, followed by any number of face parameters.
For example: `:addhl regex (\hTODO:)?[^\n] 0:cyan 1:yellow,red`
For example: `:add-highlighter regex (\hTODO:)?[^\n] 0:cyan 1:yellow,red`
will highlight C++ style comments in cyan, with an eventual 'TODO:' in
yellow on red background.
* `dynregex`: Similar to regex, but expand (like a command parameter would) the
@ -1243,23 +1243,23 @@ Highlighting Groups
the `group` highlighter is a container for other highlighters. You can add
a group to the current window using
------------------
addhl group <name>
------------------
----------------------------
add-highlighter group <name>
----------------------------
and then the `-group` switch of `addhl` provides a mean to add highlighters
and then the `-group` switch of `add-highlighter` provides a mean to add highlighters
inside this group.
--------------------------------------
addhl -group <name> <type> <params>...
--------------------------------------
------------------------------------------------
add-highlighter -group <name> <type> <params>...
------------------------------------------------
groups can contain other groups, the `-group` switch can be used to define a path.
------------------------------------------------
addhl -group <name> group <subname>
addhl -group <name>/<subname> <type> <params>...
------------------------------------------------
----------------------------------------------------------
add-highlighter -group <name> group <subname>
add-highlighter -group <name>/<subname> <type> <params>...
----------------------------------------------------------
[[regions-highlighters]]
Regions highlighters
@ -1291,16 +1291,16 @@ shell_expand %sh\{ \} \{
Regions are used in the `regions` highlighter which can take any number
of regions.
-----------------------------------------------------------------------
addhl regions <name> <region_name1> <opening1> <closing1> <recurse1> \
---------------------------------------------------------------------------------
add-highlighter regions <name> <region_name1> <opening1> <closing1> <recurse1> \
<region_name2> <opening2> <closing2> <recurse2>...
-----------------------------------------------------------------------
---------------------------------------------------------------------------------
defines multiple regions in which other highlighters can be added
-------------------------------------
addhl -group <name>/<region_name> ...
-------------------------------------
-----------------------------------------------
add-highlighter -group <name>/<region_name> ...
-----------------------------------------------
Regions are matched using the left-most rule: the left-most region opening starts
a new region. when a region closes, the closest next opening start another region.
@ -1314,13 +1314,13 @@ Most programming languages can then be properly highlighted using a `regions`
highlighter as root:
-----------------------------------------------------------------
addhl regions -default code <lang> \
add-highlighter regions -default code <lang> \
string <str_opening> <str_closing> <str_recurse> \
comment <comment_opening> <comment_closing> <comment_recurse>
addhl -group <lang>/code ...
addhl -group <lang>/string ...
addhl -group <lang>/comment ...
add-highlighter -group <lang>/code ...
add-highlighter -group <lang>/string ...
add-highlighter -group <lang>/comment ...
-----------------------------------------------------------------
Shared Highlighters
@ -1329,11 +1329,11 @@ Shared Highlighters
Highlighters are often defined for a specific filetype, and it makes then sense to
share the highlighters between all the windows on the same filetypes.
A shared highlighter can be defined with the `:addhl` command
A shared highlighter can be defined with the `:add-highlighter` command
------------------------------
addhl -group /<group_name> ...
------------------------------
----------------------------------------
add-highlighter -group /<group_name> ...
----------------------------------------
when the group switch values starts with a '/', it references a group in the
shared highlighters, rather than the window highlighters.
@ -1341,16 +1341,16 @@ shared highlighters, rather than the window highlighters.
The common case would be to create a named shared group, and then fill it
with highlighters:
---------------------------
addhl -group / group <name>
addhl -group /name regex ...
---------------------------
--------------------------------------
add-highlighter -group / group <name>
add-highlighter -group /name regex ...
--------------------------------------
It can then be referenced in a window using the `ref` highlighter.
----------------
addhl ref <name>
----------------
--------------------------
add-highlighter ref <name>
--------------------------
the `ref` can reference any named highlighter in the shared namespace.
@ -1374,16 +1374,16 @@ called.
For example to automatically use line numbering with .cc files,
use the following command:
-----------------------------------------------------
:hook global WinCreate .*\.cc %{ addhl number_lines }
-----------------------------------------------------
---------------------------------------------------------------
:hook global WinCreate .*\.cc %{ add-highlighter number_lines }
---------------------------------------------------------------
if `<group>` is given, make this hook part of the named group. groups
are used for removing hooks with the `rmhooks` command
are used for removing hooks with the `remove-hooks` command
-----------------------
rmhooks <scope> <group>
-----------------------
----------------------------
remove-hooks <scope> <group>
----------------------------
will remove every hooks in `<scope>` that are part of the given group.

View File

@ -11,19 +11,19 @@ Description
Manipulation of the displayed text is done through highlighters, which can
be added or removed with the following commands:
-------------------------------------------------------
addhl <highlighter_name> <highlighter_parameters> ...
-------------------------------------------------------
---------------------------------------------------------------
add-highlighter <highlighter_name> <highlighter_parameters> ...
---------------------------------------------------------------
and
-----------------------
rmhl <highlighter_id>
-----------------------
-----------------------------------
remove-highlighter <highlighter_id>
-----------------------------------
*highlighter_id* is a name generated by the highlighter specified with
*highlighter_name*, possibly dependent on the parameters. Use command
completion in a prompt on the *rmhl* command to see the existing highlighters
completion in a prompt on the *remove-highlighter* command to see the existing highlighters
ids.
General highlighters
@ -32,9 +32,9 @@ General highlighters
highlight a regex, takes the regex as first parameter, followed by
any number of face parameters. For example:
-----------------------------------------------------
addhl regex //(\hTODO:)?[^\n] 0:cyan 1:yellow,red
-----------------------------------------------------
---------------------------------------------------------------
add-highlighter regex //(\hTODO:)?[^\n] 0:cyan 1:yellow,red
---------------------------------------------------------------
will highlight C++ style comments in cyan, with an eventual 'TODO:'
in yellow on red background
@ -81,24 +81,24 @@ Highlighting Groups
The group highlighter is a container for other highlighters. You can add a
group to the current window using
--------------------
addhl group <name>
--------------------
----------------------------
add-highlighter group <name>
----------------------------
The *-group* switch of the *addhl* command provides a mean to add highlighters
The *-group* switch of the *add-highlighter* command provides a mean to add highlighters
inside this group:
----------------------------------------
addhl -group <name> <type> <params>...
----------------------------------------
------------------------------------------------
add-highlighter -group <name> <type> <params>...
------------------------------------------------
Groups can contain other groups, the *-group* switch can be used to define
a path as follows:
--------------------------------------------------
addhl -group <name> group <subname>
addhl -group <name>/<subname> <type> <params>...
--------------------------------------------------
----------------------------------------------------------
add-highlighter -group <name> group <subname>
add-highlighter -group <name>/<subname> <type> <params>...
----------------------------------------------------------
Regions highlighters
--------------------
@ -140,16 +140,16 @@ of regions.
The following command:
-----------------------------------------------------------------------
addhl regions <name> <region_name1> <opening1> <closing1> <recurse1>
------------------------------------------------------------------------------
add-highlighter regions <name> <region_name1> <opening1> <closing1> <recurse1>
<region_name2> <opening2> <closing2> <recurse2>...
-----------------------------------------------------------------------
------------------------------------------------------------------------------
defines multiple regions in which other highlighters can be added as follows:
---------------------------------------
addhl -group <name>/<region_name> ...
---------------------------------------
-----------------------------------------------
add-highlighter -group <name>/<region_name> ...
-----------------------------------------------
Regions are matched using the left-most rule: the left-most region opening
starts a new region. When a region closes, the closest next opening start
@ -164,13 +164,13 @@ Most programming languages can then be properly highlighted using a regions
highlighter as root:
-----------------------------------------------------------------
addhl regions -default code <lang> \
add-highlighter regions -default code <lang> \
string <str_opening> <str_closing> <str_recurse> \
comment <comment_opening> <comment_closing> <comment_recurse>
addhl -group <lang>/code ...
addhl -group <lang>/string ...
addhl -group <lang>/comment ...
add-highlighter -group <lang>/code ...
add-highlighter -group <lang>/string ...
add-highlighter -group <lang>/comment ...
-----------------------------------------------------------------
Shared Highlighters
@ -181,9 +181,9 @@ sense to share the highlighters between all the windows on the same filetypes.
A shared highlighter can be defined with the following command:
--------------------------------
addhl -group /<group_name> ...
--------------------------------
----------------------------------------
add-highlighter -group /<group_name> ...
----------------------------------------
When the group switch values starts with a '/', it references a group in
the shared highlighters, rather than the window highlighters.
@ -191,15 +191,15 @@ the shared highlighters, rather than the window highlighters.
The common case would be to create a named shared group, and then fill it
with highlighters:
------------------------------
addhl -group / group <name>
addhl -group /name regex ...
------------------------------
--------------------------------------
add-highlighter -group / group <name>
add-highlighter -group /name regex ...
--------------------------------------
It can then be referenced in a window using the ref highlighter.
------------------
addhl ref <name>
------------------
--------------------------
add-highlighter ref <name>
--------------------------
The ref can reference any named highlighter in the shared namespace.

View File

@ -25,14 +25,14 @@ For example to automatically use line numbering with .cc files, use the
following command:
----------------------------------------------------
hook global WinCreate .*\.cc %{ addhl number_lines }
hook global WinCreate .*\.cc %{ add-highlighter number_lines }
----------------------------------------------------
if *group* is given, make this hook part of the named group. Groups are used
for removing hooks with the following command:
-----------------------
rmhooks <scope> <group>
remove-hooks <scope> <group>
-----------------------
A call to the command above will remove every hooks in *scope* that are part

View File

@ -43,5 +43,5 @@ def autowrap-enable -docstring "Automatically wrap the lines in which characters
}
def autowrap-disable -docstring "Disable automatic line wrapping" %{
rmhooks window autowrap
remove-hooks window autowrap
}

View File

@ -13,11 +13,11 @@ hook global BufCreate .*[.](cljs?) %{
# Highlighters
# ‾‾‾‾‾‾‾‾‾‾‾‾
addhl -group / group clojure
add-highlighter -group / group clojure
addhl -group /clojure ref lisp
add-highlighter -group /clojure ref lisp
addhl -group /clojure regex \b(clojure.core/['/\w]+)\b 0:keyword
add-highlighter -group /clojure regex \b(clojure.core/['/\w]+)\b 0:keyword
# Commands
# ‾‾‾‾‾‾‾‾
@ -27,16 +27,16 @@ def -hidden _clojure_indent_on_new_line _lisp_indent_on_new_line
# Initialization
# ‾‾‾‾‾‾‾‾‾‾‾‾‾‾
hook -group clojure-highlight global WinSetOption filetype=clojure %{ addhl ref clojure }
hook -group clojure-highlight global WinSetOption filetype=clojure %{ add-highlighter ref clojure }
hook global WinSetOption filetype=clojure %[
hook window InsertEnd .* -group clojure-hooks _clojure_filter_around_selections
hook window InsertChar \n -group clojure-indent _clojure_indent_on_new_line
]
hook -group clojure-highlight global WinSetOption filetype=(?!clojure).* %{ rmhl clojure }
hook -group clojure-highlight global WinSetOption filetype=(?!clojure).* %{ remove-highlighter clojure }
hook global WinSetOption filetype=(?!clojure).* %{
rmhooks window clojure-indent
rmhooks window clojure-hooks
remove-hooks window clojure-indent
remove-hooks window clojure-hooks
}

View File

@ -11,27 +11,27 @@ hook global BufCreate .*[.](css) %{
# Highlighters
# ‾‾‾‾‾‾‾‾‾‾‾‾
addhl -group / regions -default selector css \
add-highlighter -group / regions -default selector css \
declaration [{] [}] '' \
comment /[*] [*]/ ''
addhl -group /css/comment fill comment
add-highlighter -group /css/comment fill comment
addhl -group /css/declaration regions content \
add-highlighter -group /css/declaration regions content \
string '"' (?<!\\)(\\\\)*" '' \
string "'" "'" ''
addhl -group /css/declaration/content/string fill string
add-highlighter -group /css/declaration/content/string fill string
addhl -group /css/declaration regex (#[0-9A-Fa-f]+)|((\d*\.)?\d+(em|px)) 0:value
addhl -group /css/declaration regex ([A-Za-z][A-Za-z0-9_-]*)\h*: 1:keyword
addhl -group /css/declaration regex :(before|after) 0:attribute
addhl -group /css/declaration regex !important 0:keyword
add-highlighter -group /css/declaration regex (#[0-9A-Fa-f]+)|((\d*\.)?\d+(em|px)) 0:value
add-highlighter -group /css/declaration regex ([A-Za-z][A-Za-z0-9_-]*)\h*: 1:keyword
add-highlighter -group /css/declaration regex :(before|after) 0:attribute
add-highlighter -group /css/declaration regex !important 0:keyword
# element#id element.class
# universal selector
addhl -group /css/selector regex [A-Za-z][A-Za-z0-9_-]* 0:keyword
addhl -group /css/selector regex [*]|[#.][A-Za-z][A-Za-z0-9_-]* 0:identifier
add-highlighter -group /css/selector regex [A-Za-z][A-Za-z0-9_-]* 0:keyword
add-highlighter -group /css/selector regex [*]|[#.][A-Za-z][A-Za-z0-9_-]* 0:identifier
# Commands
# ‾‾‾‾‾‾‾‾
@ -62,7 +62,7 @@ def -hidden _css_indent_on_closing_curly_brace %[
# Initialization
# ‾‾‾‾‾‾‾‾‾‾‾‾‾‾
hook -group css-highlight global WinSetOption filetype=css %{ addhl ref css }
hook -group css-highlight global WinSetOption filetype=css %{ add-highlighter ref css }
hook global WinSetOption filetype=css %[
hook window InsertEnd .* -group css-hooks _css_filter_around_selections
@ -70,9 +70,9 @@ hook global WinSetOption filetype=css %[
hook window InsertChar \} -group css-indent _css_indent_on_closing_curly_brace
]
hook -group css-highlight global WinSetOption filetype=(?!css).* %{ rmhl css }
hook -group css-highlight global WinSetOption filetype=(?!css).* %{ remove-highlighter css }
hook global WinSetOption filetype=(?!css).* %{
rmhooks window css-indent
rmhooks window css-hooks
remove-hooks window css-indent
remove-hooks window css-hooks
}

View File

@ -70,7 +70,7 @@ def ctags-enable-autoinfo -docstring "Automatically display ctags information ab
hook window -group ctags-autoinfo InsertIdle .* ctags-funcinfo
}
def ctags-disable-autoinfo -docstring "Disable automatic ctags information displaying" %{ rmhooks window ctags-autoinfo }
def ctags-disable-autoinfo -docstring "Disable automatic ctags information displaying" %{ remove-hooks window ctags-autoinfo }
decl str ctagsopts "-R"
decl str ctagspaths "."

View File

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

View File

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

View File

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

View File

@ -5,34 +5,34 @@ hook global BufCreate .*\.(s|S|asm)$ %{
}
addhl -group / regions -default code gas \
add-highlighter -group / regions -default code gas \
string '"' (?<!\\)(\\\\)*" '' \
commentMulti /\* \*/ '' \
commentSingle1 '#' '$' '' \
commentSingle2 ';' '$' ''
addhl -group /gas/string fill string
addhl -group /gas/commentMulti fill comment
addhl -group /gas/commentSingle1 fill comment
addhl -group /gas/commentSingle2 fill comment
add-highlighter -group /gas/string fill string
add-highlighter -group /gas/commentMulti fill comment
add-highlighter -group /gas/commentSingle1 fill comment
add-highlighter -group /gas/commentSingle2 fill comment
# Constant
addhl -group /gas/code regex (0[xX][0-9]+|\b[0-9]+)\b 0:value
add-highlighter -group /gas/code regex (0[xX][0-9]+|\b[0-9]+)\b 0:value
# Labels
addhl -group /gas/code regex ^\h*([A-Za-z0-9_.-]+): 0:operator
add-highlighter -group /gas/code regex ^\h*([A-Za-z0-9_.-]+): 0:operator
# ARM Directives
addhl -group /gas/code regex ((^|\s+)\.([248]byte|align|arch(_extension)?|arm|bsscantunwind|code|[cf]pu|[dq]n|eabi_attribute|even|extend|ldouble|fnend|fnstart|force_thumb|handlerdata|inst(\.[nw])?|ltorg|movsp|object_arch|packed|pad|personality(index)?|pool|req|save|setfp|screl32|syntax|thumb(_func|_set)?|tlsdescseq|unreq|unwind_raw|vsave)(\h+|$)) 0:type
add-highlighter -group /gas/code regex ((^|\s+)\.([248]byte|align|arch(_extension)?|arm|bsscantunwind|code|[cf]pu|[dq]n|eabi_attribute|even|extend|ldouble|fnend|fnstart|force_thumb|handlerdata|inst(\.[nw])?|ltorg|movsp|object_arch|packed|pad|personality(index)?|pool|req|save|setfp|screl32|syntax|thumb(_func|_set)?|tlsdescseq|unreq|unwind_raw|vsave)(\h+|$)) 0:type
# Assembler Directives
addhl -group /gas/code regex ((^|\s+)\.(abort|ABORT|align|app-file|ascii|asciz|balign[wl]|byte|comm|data|def|desc|dim|double|eject|else|endif|equ|extern|file|fill|float|global|globl|hword|ident|if|include|int|irp|irpc|lcomm|iflags|line|linkonce|ln|mri|list|loc|local|long|macro|nolist|octa|org|print|purgem|p2align[wl]|psize|quad|rept|sbttl|section|set|short|single|size|skip|space|stab[dns]|string|struct|tag|text|title|type|title|uleb128|val|vtable_entry|weak|word|rodata|zero)(\h+|$)) 0:type
add-highlighter -group /gas/code regex ((^|\s+)\.(abort|ABORT|align|app-file|ascii|asciz|balign[wl]|byte|comm|data|def|desc|dim|double|eject|else|endif|equ|extern|file|fill|float|global|globl|hword|ident|if|include|int|irp|irpc|lcomm|iflags|line|linkonce|ln|mri|list|loc|local|long|macro|nolist|octa|org|print|purgem|p2align[wl]|psize|quad|rept|sbttl|section|set|short|single|size|skip|space|stab[dns]|string|struct|tag|text|title|type|title|uleb128|val|vtable_entry|weak|word|rodata|zero)(\h+|$)) 0:type
# Registers
addhl -group /gas/code regex \%(([re](ax|bx|cx|dx|si|di|bp|sp))|(al|bl|cl|dl|sil|dil|bpl|spl)|(r[8-9][dwb])|(r1[0-5][dwb])|(cs|ds|es|fs|gs|ss|ip|eflags)|([xy]mm[0-9]|[xy]mm1[0-5]))\b 0:identifier
add-highlighter -group /gas/code regex \%(([re](ax|bx|cx|dx|si|di|bp|sp))|(al|bl|cl|dl|sil|dil|bpl|spl)|(r[8-9][dwb])|(r1[0-5][dwb])|(cs|ds|es|fs|gs|ss|ip|eflags)|([xy]mm[0-9]|[xy]mm1[0-5]))\b 0:identifier
# General Instructions
addhl -group /gas/code regex \
add-highlighter -group /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 +53,7 @@ addhl -group /gas/code regex \
^\h*(bound([wl])?|enter|int(o)?|lcall|loop(n)?[ez]|pause)\b 0:keyword
#Floating Point Instructions
addhl -group /gas/code regex \
add-highlighter -group /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,14 +85,14 @@ def -hidden _gas_indent_on_new_line %~
>
~
hook -group gas-highlight global WinSetOption filetype=gas %{ addhl ref gas }
hook -group gas-highlight global WinSetOption filetype=gas %{ add-highlighter ref gas }
hook global WinSetOption filetype=gas %{
hook window InsertChar \n -group gas-indent _gas_indent_on_new_line
}
hook -group gas-highlight global WinSetOption filetype=(?!gas).* %{ rmhl gas }
hook -group gas-highlight global WinSetOption filetype=(?!gas).* %{ remove-highlighter gas }
hook global WinSetOption filetype=(?!gas).* %{
rmhooks window gas-indent
remove-hooks window gas-indent
}

View File

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

View File

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

View File

@ -11,20 +11,20 @@ hook global BufCreate .*[.](hs) %{
# Highlighters
# ‾‾‾‾‾‾‾‾‾‾‾‾
addhl -group / regions -default code haskell \
add-highlighter -group / regions -default code haskell \
string '"' (?<!\\)(\\\\)*" '' \
comment (--) $ '' \
comment \{- -\} \{- \
macro ^\h*?\K# (?<!\\)\n ''
addhl -group /haskell/string fill string
addhl -group /haskell/comment fill comment
addhl -group /haskell/macro fill meta
add-highlighter -group /haskell/string fill string
add-highlighter -group /haskell/comment fill comment
add-highlighter -group /haskell/macro fill meta
addhl -group /haskell/code regex \b(import)\b 0:meta
addhl -group /haskell/code regex \b(True|False)\b 0:value
addhl -group /haskell/code regex \b(as|case|class|data|default|deriving|do|else|hiding|if|in|infix|infixl|infixr|instance|let|module|newtype|of|qualified|then|type|where)\b 0:keyword
addhl -group /haskell/code regex \b(Int|Integer|Char|Bool|Float|Double|IO|Void|Addr|Array|String)\b 0:type
add-highlighter -group /haskell/code regex \b(import)\b 0:meta
add-highlighter -group /haskell/code regex \b(True|False)\b 0:value
add-highlighter -group /haskell/code regex \b(as|case|class|data|default|deriving|do|else|hiding|if|in|infix|infixl|infixr|instance|let|module|newtype|of|qualified|then|type|where)\b 0:keyword
add-highlighter -group /haskell/code regex \b(Int|Integer|Char|Bool|Float|Double|IO|Void|Addr|Array|String)\b 0:type
# Commands
# ‾‾‾‾‾‾‾‾
@ -54,16 +54,16 @@ def -hidden _haskell_indent_on_new_line %{
# Initialization
# ‾‾‾‾‾‾‾‾‾‾‾‾‾‾
hook -group haskell-highlight global WinSetOption filetype=haskell %{ addhl ref haskell }
hook -group haskell-highlight global WinSetOption filetype=haskell %{ add-highlighter ref haskell }
hook global WinSetOption filetype=haskell %{
hook window InsertEnd .* -group haskell-hooks _haskell_filter_around_selections
hook window InsertChar \n -group haskell-indent _haskell_indent_on_new_line
}
hook -group haskell-highlight global WinSetOption filetype=(?!haskell).* %{ rmhl haskell }
hook -group haskell-highlight global WinSetOption filetype=(?!haskell).* %{ remove-highlighter haskell }
hook global WinSetOption filetype=(?!haskell).* %{
rmhooks window haskell-indent
rmhooks window haskell-hooks
remove-hooks window haskell-indent
remove-hooks window haskell-hooks
}

View File

@ -15,24 +15,24 @@ hook global BufCreate .*\.xml %{
# Highlighters
# ‾‾‾‾‾‾‾‾‾‾‾‾
addhl -group / regions html \
add-highlighter -group / regions html \
comment <!-- --> '' \
tag < > '' \
style <style\b.*?>\K (?=</style>) '' \
script <script\b.*?>\K (?=</script>) ''
addhl -group /html/comment fill comment
add-highlighter -group /html/comment fill comment
addhl -group /html/style ref css
addhl -group /html/script ref javascript
add-highlighter -group /html/style ref css
add-highlighter -group /html/script ref javascript
addhl -group /html/tag regex </?(\w+) 1:keyword
add-highlighter -group /html/tag regex </?(\w+) 1:keyword
addhl -group /html/tag regions content \
add-highlighter -group /html/tag regions content \
string '"' (?<!\\)(\\\\)*" '' \
string "'" "'" ''
addhl -group /html/tag/content/string fill string
add-highlighter -group /html/tag/content/string fill string
# Commands
# ‾‾‾‾‾‾‾‾
@ -63,7 +63,7 @@ def -hidden _html_indent_on_new_line %{
# Initialization
# ‾‾‾‾‾‾‾‾‾‾‾‾‾‾
hook -group html-highlight global WinSetOption filetype=(?:html|xml) %{ addhl ref html }
hook -group html-highlight global WinSetOption filetype=(?:html|xml) %{ add-highlighter ref html }
hook global WinSetOption filetype=(?:html|xml) %{
hook window InsertEnd .* -group html-hooks _html_filter_around_selections
@ -71,9 +71,9 @@ hook global WinSetOption filetype=(?:html|xml) %{
hook window InsertChar \n -group html-indent _html_indent_on_new_line
}
hook -group html-highlight global WinSetOption filetype=(?!html|xml).* %{ rmhl html }
hook -group html-highlight global WinSetOption filetype=(?!html|xml).* %{ remove-highlighter html }
hook global WinSetOption filetype=(?!html|xml).* %{
rmhooks window html-indent
rmhooks window html-hooks
remove-hooks window html-indent
remove-hooks window html-hooks
}

View File

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

View File

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

View File

@ -8,7 +8,7 @@ hook global BufCreate .*[.](js) %{
# Highlighters
# ‾‾‾‾‾‾‾‾‾‾‾‾
addhl -group / regions -default code javascript \
add-highlighter -group / regions -default code javascript \
double_string '"' (?<!\\)(\\\\)*" '' \
single_string "'" (?<!\\)(\\\\)*' '' \
literal "`" (?<!\\)(\\\\)*` '' \
@ -18,21 +18,21 @@ addhl -group / regions -default code javascript \
# 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
addhl -group /javascript/double_string fill string
addhl -group /javascript/single_string fill string
addhl -group /javascript/comment fill comment
addhl -group /javascript/literal fill string
addhl -group /javascript/literal regex \${.*?} 0:value
add-highlighter -group /javascript/double_string fill string
add-highlighter -group /javascript/single_string fill string
add-highlighter -group /javascript/comment fill comment
add-highlighter -group /javascript/literal fill string
add-highlighter -group /javascript/literal regex \${.*?} 0:value
addhl -group /javascript/code regex \$\w* 0:identifier
addhl -group /javascript/code regex \b(document|false|null|parent|self|this|true|undefined|window)\b 0:value
addhl -group /javascript/code regex "-?[0-9]*\.?[0-9]+" 0:value
addhl -group /javascript/code regex \b(Array|Boolean|Date|Function|Number|Object|RegExp|String)\b 0:type
addhl -group /javascript/code regex (?<=\W)/[^\n/]+/[gimy]* 0:meta
add-highlighter -group /javascript/code regex \$\w* 0:identifier
add-highlighter -group /javascript/code regex \b(document|false|null|parent|self|this|true|undefined|window)\b 0:value
add-highlighter -group /javascript/code regex "-?[0-9]*\.?[0-9]+" 0:value
add-highlighter -group /javascript/code regex \b(Array|Boolean|Date|Function|Number|Object|RegExp|String)\b 0:type
add-highlighter -group /javascript/code regex (?<=\W)/[^\n/]+/[gimy]* 0:meta
# Keywords are collected at
# https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Lexical_grammar#Keywords
addhl -group /javascript/code regex \b(break|case|catch|class|const|continue|debugger|default|delete|do|else|export|extends|finally|for|function|if|import|in|instanceof|let|new|of|return|super|switch|throw|try|typeof|var|void|while|with|yield)\b 0:keyword
add-highlighter -group /javascript/code regex \b(break|case|catch|class|const|continue|debugger|default|delete|do|else|export|extends|finally|for|function|if|import|in|instanceof|let|new|of|return|super|switch|throw|try|typeof|var|void|while|with|yield)\b 0:keyword
# Commands
# ‾‾‾‾‾‾‾‾
@ -65,7 +65,7 @@ def -hidden _javascript_indent_on_new_line %<
# Initialization
# ‾‾‾‾‾‾‾‾‾‾‾‾‾‾
hook -group javascript-highlight global WinSetOption filetype=javascript %{ addhl ref javascript }
hook -group javascript-highlight global WinSetOption filetype=javascript %{ add-highlighter ref javascript }
hook global WinSetOption filetype=javascript %{
hook window InsertEnd .* -group javascript-hooks _javascript_filter_around_selections
@ -73,9 +73,9 @@ hook global WinSetOption filetype=javascript %{
hook window InsertChar \n -group javascript-indent _javascript_indent_on_new_line
}
hook -group javascript-highlight global WinSetOption filetype=(?!javascript).* %{ rmhl javascript }
hook -group javascript-highlight global WinSetOption filetype=(?!javascript).* %{ remove-highlighter javascript }
hook global WinSetOption filetype=(?!javascript).* %{
rmhooks window javascript-indent
rmhooks window javascript-hooks
remove-hooks window javascript-indent
remove-hooks window javascript-hooks
}

View File

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

View File

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

View File

@ -17,7 +17,7 @@ def lint -docstring 'Parse the current buffer with a linter' %{
set buffer make_current_error_line 0
hook -group fifo buffer BufCloseFifo .* %{
nop %sh{ rm -r '$dir' }
rmhooks buffer fifo
remove-hooks buffer fifo
}
}"
@ -68,13 +68,13 @@ def -hidden lint-show %{ %sh{
}}
def lint-enable -docstring "Activate automatic diagnostics of the code" %{
addhl flag_lines default lint_flags
add-highlighter flag_lines default lint_flags
hook window -group lint-diagnostics NormalIdle .* %{ lint-show }
}
def lint-disable -docstring "Disable automatic diagnostics of the code" %{
rmhl hlflags_lint_flags
rmhooks window lint-diagnostics
remove-highlighter hlflags_lint_flags
remove-hooks window lint-diagnostics
}
def lint-next -docstring "Jump to the next line that contains an error" %{ %sh{

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -11,25 +11,25 @@ hook global BufCreate .*[.](rust|rs) %{
# Highlighters
# ‾‾‾‾‾‾‾‾‾‾‾‾
addhl -group / regions -default code rust \
add-highlighter -group / regions -default code rust \
string '"' (?<!\\)(\\\\)*" '' \
comment // $ '' \
comment /\* \*/ /\*
addhl -group /rust/string fill string
addhl -group /rust/comment fill comment
add-highlighter -group /rust/string fill string
add-highlighter -group /rust/comment fill comment
addhl -group /rust/code regex \b[A-z0-9_]+! 0:meta
add-highlighter -group /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
addhl -group /rust/code regex \b(?:self|true|false|[0-9][_0-9]*(?:\.[0-9][_0-9]*|(?:\.[0-9][_0-9]*)?E[\+\-][_0-9]+)(?:f(?:32|64))?|(?:0x[_0-9a-fA-F]+|0o[_0-7]+|0b[_01]+|[0-9][_0-9]*)(?:(?:i|u)(?:8|16|32|64|size))?)\b 0:value
addhl -group /rust/code regex \b(?:&&|\|\|)\b 0:operator
add-highlighter -group /rust/code regex \b(?:self|true|false|[0-9][_0-9]*(?:\.[0-9][_0-9]*|(?:\.[0-9][_0-9]*)?E[\+\-][_0-9]+)(?:f(?:32|64))?|(?:0x[_0-9a-fA-F]+|0o[_0-7]+|0b[_01]+|[0-9][_0-9]*)(?:(?:i|u)(?:8|16|32|64|size))?)\b 0:value
add-highlighter -group /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
addhl -group /rust/code regex \b(?:crate|use|extern)\b 0:meta
addhl -group /rust/code regex \b(?:let|as|fn|return|match|if|else|loop|for|in|while|break|continue|move|box|where|impl|pub|unsafe)\b 0:keyword
addhl -group /rust/code regex \b(?:mod|trait|struct|enum|type|mut|ref|static|const)\b 0:attribute
addhl -group /rust/code regex \b(?:u8|u16|u32|u64|usize|i8|i16|i32|i64|isize|f32|f64|bool|char|str|Self)\b 0:type
add-highlighter -group /rust/code regex \b(?:crate|use|extern)\b 0:meta
add-highlighter -group /rust/code regex \b(?:let|as|fn|return|match|if|else|loop|for|in|while|break|continue|move|box|where|impl|pub|unsafe)\b 0:keyword
add-highlighter -group /rust/code regex \b(?:mod|trait|struct|enum|type|mut|ref|static|const)\b 0:attribute
add-highlighter -group /rust/code regex \b(?:u8|u16|u32|u64|usize|i8|i16|i32|i64|isize|f32|f64|bool|char|str|Self)\b 0:type
# Commands
# ‾‾‾‾‾‾‾‾
@ -71,7 +71,7 @@ def -hidden _rust_indent_on_closing_curly_brace %[
# Initialization
# ‾‾‾‾‾‾‾‾‾‾‾‾‾‾
hook -group rust-highlight global WinSetOption filetype=rust %{ addhl ref rust }
hook -group rust-highlight global WinSetOption filetype=rust %{ add-highlighter ref rust }
hook global WinSetOption filetype=rust %[
hook window InsertEnd .* -group rust-hooks _rust_filter_around_selections
@ -80,9 +80,9 @@ hook global WinSetOption filetype=rust %[
hook window InsertChar \} -group rust-indent _rust_indent_on_closing_curly_brace
]
hook -group rust-highlight global WinSetOption filetype=(?!rust).* %{ rmhl rust }
hook -group rust-highlight global WinSetOption filetype=(?!rust).* %{ remove-highlighter rust }
hook global WinSetOption filetype=(?!rust).* %{
rmhooks window rust-indent
rmhooks window rust-hooks
remove-hooks window rust-indent
remove-hooks window rust-hooks
}

View File

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

View File

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

View File

@ -2,26 +2,26 @@ hook global BufCreate .*\.(swift) %{
set buffer filetype swift
}
addhl -group / regions -default code swift \
add-highlighter -group / regions -default code swift \
string %{(?<!')"} %{(?<!\\)(\\\\)*"} '' \
comment /\* \*/ '' \
comment // $ ''
addhl -group /swift/string fill string
addhl -group /swift/comment fill comment
add-highlighter -group /swift/string fill string
add-highlighter -group /swift/comment fill comment
addhl -group /swift/comment regex "\<(TODO|XXX|MARK)\>" 0:red
add-highlighter -group /swift/comment regex "\<(TODO|XXX|MARK)\>" 0:red
addhl -group /swift/code regex %{\<(true|false|nil)\>|\<-?(?!\$)\d+[fdiu]?|'((\\.)?|[^'\\])'} 0:value
addhl -group /swift/code regex "\<(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)\>" 0:keyword
addhl -group /swift/code regex "\<as\>[!?]?" 0:keyword
addhl -group /swift/code regex "(\$[0-9])\>" 0:keyword
addhl -group /swift/code regex "\<(const|mutable|auto|namespace|inline|static|volatile|class|struct|enum|union|public|protected|private|typedef|virtual|friend|extern|typename|override|final|required|convenience|dynamic)\>" 0:attribute
add-highlighter -group /swift/code regex %{\<(true|false|nil)\>|\<-?(?!\$)\d+[fdiu]?|'((\\.)?|[^'\\])'} 0:value
add-highlighter -group /swift/code regex "\<(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)\>" 0:keyword
add-highlighter -group /swift/code regex "\<as\>[!?]?" 0:keyword
add-highlighter -group /swift/code regex "(\$[0-9])\>" 0:keyword
add-highlighter -group /swift/code regex "\<(const|mutable|auto|namespace|inline|static|volatile|class|struct|enum|union|public|protected|private|typedef|virtual|friend|extern|typename|override|final|required|convenience|dynamic)\>" 0:attribute
addhl -group /swift/code regex "\<(self|nil|id|super)\>" 0:value
addhl -group /swift/code regex "\<(Bool|String|UInt|UInt16|UInt32|UInt64|UInt8)\>" 0:type
addhl -group /swift/code regex "\<(IBAction|IBOutlet)\>" 0:attribute
addhl -group /swift/code regex "@\w+\>" 0:attribute
add-highlighter -group /swift/code regex "\<(self|nil|id|super)\>" 0:value
add-highlighter -group /swift/code regex "\<(Bool|String|UInt|UInt16|UInt32|UInt64|UInt8)\>" 0:type
add-highlighter -group /swift/code regex "\<(IBAction|IBOutlet)\>" 0:attribute
add-highlighter -group /swift/code regex "@\w+\>" 0:attribute
hook -group swift-highlight global WinSetOption filetype=swift %{ addhl ref swift }
hook -group swift-highlight global WinSetOption filetype=(?!swift).* %{ rmhl swift }
hook -group swift-highlight global WinSetOption filetype=swift %{ add-highlighter ref swift }
hook -group swift-highlight global WinSetOption filetype=(?!swift).* %{ remove-highlighter swift }

View File

@ -11,18 +11,18 @@ hook global BufCreate .*[.](yaml) %{
# Highlighters
# ‾‾‾‾‾‾‾‾‾‾‾‾
addhl -group / regions -default code yaml \
add-highlighter -group / regions -default code yaml \
double_string '"' (?<!\\)(\\\\)*" '' \
single_string "'" "'" '' \
comment '#' '$' ''
addhl -group /yaml/double_string fill string
addhl -group /yaml/single_string fill string
addhl -group /yaml/comment fill comment
add-highlighter -group /yaml/double_string fill string
add-highlighter -group /yaml/single_string fill string
add-highlighter -group /yaml/comment fill comment
addhl -group /yaml/code regex ^(---|\.\.\.)$ 0:meta
addhl -group /yaml/code regex ^(\h*:\w*) 0:keyword
addhl -group /yaml/code regex \b(true|false|null)\b 0:value
add-highlighter -group /yaml/code regex ^(---|\.\.\.)$ 0:meta
add-highlighter -group /yaml/code regex ^(\h*:\w*) 0:keyword
add-highlighter -group /yaml/code regex \b(true|false|null)\b 0:value
# Commands
# ‾‾‾‾‾‾‾‾
@ -48,16 +48,16 @@ def -hidden _yaml_indent_on_new_line %{
# Initialization
# ‾‾‾‾‾‾‾‾‾‾‾‾‾‾
hook -group yaml-highlight global WinSetOption filetype=yaml %{ addhl ref yaml }
hook -group yaml-highlight global WinSetOption filetype=yaml %{ add-highlighter ref yaml }
hook global WinSetOption filetype=yaml %{
hook window InsertEnd .* -group yaml-hooks _yaml_filter_around_selections
hook window InsertChar \n -group yaml-indent _yaml_indent_on_new_line
}
hook -group yaml-highlight global WinSetOption filetype=(?!yaml).* %{ rmhl yaml }
hook -group yaml-highlight global WinSetOption filetype=(?!yaml).* %{ remove-highlighter yaml }
hook global WinSetOption filetype=(?!yaml).* %{
rmhooks window yaml-indent
rmhooks window yaml-hooks
remove-hooks window yaml-indent
remove-hooks window yaml-hooks
}

View File

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

View File

@ -123,22 +123,22 @@ def -hidden c-family-insert-on-newline %[ eval -draft %[
fi
printf %s\\n '
addhl -group / regions -default code FT \
add-highlighter -group / regions -default code FT \
string %{MAYBEAT(?<!QUOTE)"} %{(?<!\\)(\\\\)*"} "" \
comment /\* \*/ "" \
comment // $ "" \
disabled ^\h*?#\h*if\h+(0|FALSE)\b "#\h*(else|elif|endif)" "#\h*if(def)?" \
macro %{^\h*?\K#} %{(?<!\\)\n} ""
addhl -group /FT/string fill string
addhl -group /FT/comment fill comment
addhl -group /FT/disabled fill rgb:666666
addhl -group /FT/macro fill meta' | sed -e "s/FT/${ft}/g; s/QUOTE/'/g; s/MAYBEAT/${maybe_at}/;"
add-highlighter -group /FT/string fill string
add-highlighter -group /FT/comment fill comment
add-highlighter -group /FT/disabled fill rgb:666666
add-highlighter -group /FT/macro fill meta' | sed -e "s/FT/${ft}/g; s/QUOTE/'/g; s/MAYBEAT/${maybe_at}/;"
done
}
# c specific
addhl -group /c/code regex %{\b-?(0x[0-9a-fA-F]+|\d+)[fdiu]?|'((\\.)?|[^'\\])'} 0:value
add-highlighter -group /c/code regex %{\b-?(0x[0-9a-fA-F]+|\d+)[fdiu]?|'((\\.)?|[^'\\])'} 0:value
%sh{
# Grammar
keywords="while|for|if|else|do|switch|case|default|goto|asm|break|continue|return|sizeof"
@ -153,15 +153,15 @@ addhl -group /c/code regex %{\b-?(0x[0-9a-fA-F]+|\d+)[fdiu]?|'((\\.)?|[^'\\])'}
# Highlight keywords
printf %s "
addhl -group /c/code regex \b(${keywords})\b 0:keyword
addhl -group /c/code regex \b(${attributes})\b 0:attribute
addhl -group /c/code regex \b(${types})\b 0:type
addhl -group /c/code regex \b(${values})\b 0:value
add-highlighter -group /c/code regex \b(${keywords})\b 0:keyword
add-highlighter -group /c/code regex \b(${attributes})\b 0:attribute
add-highlighter -group /c/code regex \b(${types})\b 0:type
add-highlighter -group /c/code regex \b(${values})\b 0:value
"
}
# c++ specific
addhl -group /cpp/code regex %{\b-?(0x[0-9a-fA-F]+|\d+)[fdiu]?|'((\\.)?|[^'\\])'} 0:value
add-highlighter -group /cpp/code regex %{\b-?(0x[0-9a-fA-F]+|\d+)[fdiu]?|'((\\.)?|[^'\\])'} 0:value
%sh{
# Grammar
@ -184,10 +184,10 @@ addhl -group /cpp/code regex %{\b-?(0x[0-9a-fA-F]+|\d+)[fdiu]?|'((\\.)?|[^'\\])'
# Highlight keywords
printf %s "
addhl -group /cpp/code regex \b(${keywords})\b 0:keyword
addhl -group /cpp/code regex \b(${attributes})\b 0:attribute
addhl -group /cpp/code regex \b(${types})\b 0:type
addhl -group /cpp/code regex \b(${values})\b 0:value
add-highlighter -group /cpp/code regex \b(${keywords})\b 0:keyword
add-highlighter -group /cpp/code regex \b(${attributes})\b 0:attribute
add-highlighter -group /cpp/code regex \b(${types})\b 0:type
add-highlighter -group /cpp/code regex \b(${values})\b 0:value
"
}
@ -196,13 +196,13 @@ addhl -group /cpp/code regex %{\b-?(0x[0-9a-fA-F]+|\d+)[fdiu]?|'((\\.)?|[^'\\])'
builtin_macros="__cplusplus|__STDC_HOSTED__|__FILE__|__LINE__|__DATE__|__TIME__|__STDCPP_DEFAULT_NEW_ALIGNMENT__"
printf %s "
addhl -group /c/code regex \b(${builtin_macros})\b 0:builtin
addhl -group /cpp/code regex \b(${builtin_macros})\b 0:builtin
add-highlighter -group /c/code regex \b(${builtin_macros})\b 0:builtin
add-highlighter -group /cpp/code regex \b(${builtin_macros})\b 0:builtin
"
}
# objective-c specific
addhl -group /objc/code regex %{\b-?\d+[fdiu]?|'((\\.)?|[^'\\])'} 0:value
add-highlighter -group /objc/code regex %{\b-?\d+[fdiu]?|'((\\.)?|[^'\\])'} 0:value
%sh{
# Grammar
@ -223,18 +223,18 @@ addhl -group /objc/code regex %{\b-?\d+[fdiu]?|'((\\.)?|[^'\\])'} 0:value
# Highlight keywords
printf %s "
addhl -group /objc/code regex \b(${keywords})\b 0:keyword
addhl -group /objc/code regex \b(${attributes})\b 0:attribute
addhl -group /objc/code regex \b(${types})\b 0:type
addhl -group /objc/code regex \b(${values})\b 0:value
addhl -group /objc/code regex @(${decorators})\b 0:attribute
add-highlighter -group /objc/code regex \b(${keywords})\b 0:keyword
add-highlighter -group /objc/code regex \b(${attributes})\b 0:attribute
add-highlighter -group /objc/code regex \b(${types})\b 0:type
add-highlighter -group /objc/code regex \b(${values})\b 0:value
add-highlighter -group /objc/code regex @(${decorators})\b 0:attribute
"
}
hook global WinSetOption filetype=(c|cpp|objc) %[
try %{ # we might be switching from one c-family language to another
rmhooks window c-family-hooks
rmhooks window c-family-indent
remove-hooks window c-family-hooks
remove-hooks window c-family-indent
}
hook -group c-family-indent window InsertEnd .* c-family-trim-autoindent
@ -248,21 +248,21 @@ hook global WinSetOption filetype=(c|cpp|objc) %[
]
hook global WinSetOption filetype=(?!(c|cpp|objc)$).* %[
rmhooks window c-family-hooks
rmhooks window c-family-indent
rmhooks window c-family-insert
remove-hooks window c-family-hooks
remove-hooks window c-family-indent
remove-hooks window c-family-insert
unalias window alt c-family-alternative-file
]
hook -group c-highlight global WinSetOption filetype=c %[ addhl ref c ]
hook -group c-highlight global WinSetOption filetype=(?!c$).* %[ rmhl c ]
hook -group c-highlight global WinSetOption filetype=c %[ add-highlighter ref c ]
hook -group c-highlight global WinSetOption filetype=(?!c$).* %[ remove-highlighter c ]
hook -group cpp-highlight global WinSetOption filetype=cpp %[ addhl ref cpp ]
hook -group cpp-highlight global WinSetOption filetype=(?!cpp$).* %[ rmhl cpp ]
hook -group cpp-highlight global WinSetOption filetype=cpp %[ add-highlighter ref cpp ]
hook -group cpp-highlight global WinSetOption filetype=(?!cpp$).* %[ remove-highlighter cpp ]
hook -group objc-highlight global WinSetOption filetype=objc %[ addhl ref objc ]
hook -group objc-highlight global WinSetOption filetype=(?!objc$).* %[ rmhl objc ]
hook -group objc-highlight global WinSetOption filetype=objc %[ add-highlighter ref objc ]
hook -group objc-highlight global WinSetOption filetype=(?!objc$).* %[ remove-highlighter objc ]
decl str c_include_guard_style "ifdef"
def -hidden c-family-insert-include-guards %{

View File

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

View File

@ -20,25 +20,25 @@ All the optional arguments are forwarded to the grep utility} \
set buffer _grep_current_line 0
hook -group fifo buffer BufCloseFifo .* %{
nop %sh{ rm -r $(dirname ${output}) }
rmhooks buffer fifo
remove-hooks buffer fifo
}
}"
}}
hook -group grep-highlight global WinSetOption filetype=grep %{
addhl group grep
addhl -group grep regex "^((?:\w:)?[^:]+):(\d+):(\d+)?" 1:cyan 2:green 3:green
addhl -group grep line %{%opt{_grep_current_line}} default+b
add-highlighter group grep
add-highlighter -group grep regex "^((?:\w:)?[^:]+):(\d+):(\d+)?" 1:cyan 2:green 3:green
add-highlighter -group grep line %{%opt{_grep_current_line}} default+b
}
hook global WinSetOption filetype=grep %{
hook buffer -group grep-hooks NormalKey <ret> grep-jump
}
hook -group grep-highlight global WinSetOption filetype=(?!grep).* %{ rmhl grep }
hook -group grep-highlight global WinSetOption filetype=(?!grep).* %{ remove-highlighter grep }
hook global WinSetOption filetype=(?!grep).* %{
rmhooks buffer grep-hooks
remove-hooks buffer grep-hooks
}
decl str jumpclient

View File

@ -11,7 +11,7 @@ hook global BufCreate (.*/)?(kakrc|.*.kak) %{
# Highlighters & Completion
# ‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾
addhl -group / regions -default code kakrc \
add-highlighter -group / regions -default code kakrc \
comment (^|\h)\K\# $ '' \
double_string %{(^|\h)"} %{(?<!\\)(\\\\)*"} '' \
single_string %{(^|\h)'} %{(?<!\\)(\\\\)*'} '' \
@ -31,20 +31,20 @@ addhl -group / regions -default code kakrc \
# Highlight keywords
printf %s "
addhl -group /kakrc/code regex \b(${keywords})\b 0:keyword
addhl -group /kakrc/code regex \b(${values})\b 0:value
add-highlighter -group /kakrc/code regex \b(${keywords})\b 0:keyword
add-highlighter -group /kakrc/code regex \b(${values})\b 0:value
"
}
addhl -group /kakrc/code regex \brgb:[0-9a-fA-F]{6}\b 0:value
addhl -group /kakrc/code regex (?:\bhook)\h+(?:-group\h+\S+\h+)?(?:(global|buffer|window)|(\S+))\h+(\S+) 1:attribute 2:Error 3:identifier
addhl -group /kakrc/code regex (?:\bset)\h+(?:-add)?\h+(?:(global|buffer|window)|(\S+))\h+(\S+) 1:attribute 2:Error 3:identifier
addhl -group /kakrc/code regex (?:\bmap)\h+(?:(global|buffer|window)|(\S+))\h+(?:(normal|insert|menu|prompt|goto|view|user|object)|(\S+))\h+(\S+) 1:attribute 2:Error 3:attribute 4:Error 5:identifier
add-highlighter -group /kakrc/code regex \brgb:[0-9a-fA-F]{6}\b 0:value
add-highlighter -group /kakrc/code regex (?:\bhook)\h+(?:-group\h+\S+\h+)?(?:(global|buffer|window)|(\S+))\h+(\S+) 1:attribute 2:Error 3:identifier
add-highlighter -group /kakrc/code regex (?:\bset)\h+(?:-add)?\h+(?:(global|buffer|window)|(\S+))\h+(\S+) 1:attribute 2:Error 3:identifier
add-highlighter -group /kakrc/code regex (?:\bmap)\h+(?:(global|buffer|window)|(\S+))\h+(?:(normal|insert|menu|prompt|goto|view|user|object)|(\S+))\h+(\S+) 1:attribute 2:Error 3:attribute 4:Error 5:identifier
addhl -group /kakrc/double_string fill string
addhl -group /kakrc/single_string fill string
addhl -group /kakrc/comment fill comment
addhl -group /kakrc/shell ref sh
add-highlighter -group /kakrc/double_string fill string
add-highlighter -group /kakrc/single_string fill string
add-highlighter -group /kakrc/comment fill comment
add-highlighter -group /kakrc/shell ref sh
# Commands
# ‾‾‾‾‾‾‾‾
@ -65,7 +65,7 @@ def -hidden kak-indent-on-new-line %{
# Initialization
# ‾‾‾‾‾‾‾‾‾‾‾‾‾‾
hook -group kak-highlight global WinSetOption filetype=kak %{ addhl ref kakrc }
hook -group kak-highlight global WinSetOption filetype=kak %{ add-highlighter ref kakrc }
hook global WinSetOption filetype=kak %{
hook window InsertChar \n -group kak-indent kak-indent-on-new-line
@ -73,5 +73,5 @@ hook global WinSetOption filetype=kak %{
hook window InsertEnd .* -group kak-indent %{ try %{ exec -draft \; <a-x> s ^\h+$ <ret> d } }
}
hook -group kak-highlight global WinSetOption filetype=(?!kak).* %{ rmhl kakrc }
hook global WinSetOption filetype=(?!kak).* %{ rmhooks window kak-indent }
hook -group kak-highlight global WinSetOption filetype=(?!kak).* %{ remove-highlighter kakrc }
hook global WinSetOption filetype=(?!kak).* %{ remove-hooks window kak-indent }

View File

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

View File

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

View File

@ -3,15 +3,15 @@ decl str docsclient
decl -hidden str _manpage
hook -group man-highlight global WinSetOption filetype=man %{
addhl group man-highlight
add-highlighter group man-highlight
# Sections
addhl -group man-highlight regex ^\S.*?$ 0:blue
add-highlighter -group man-highlight regex ^\S.*?$ 0:blue
# Subsections
addhl -group man-highlight regex '^ {3}\S.*?$' 0:default+b
add-highlighter -group man-highlight regex '^ {3}\S.*?$' 0:default+b
# Command line options
addhl -group man-highlight regex '^ {7}-[^\s,]+(,\s+-[^\s,]+)*' 0:yellow
add-highlighter -group man-highlight regex '^ {7}-[^\s,]+(,\s+-[^\s,]+)*' 0:yellow
# References to other manpages
addhl -group man-highlight regex [-a-zA-Z0-9_.]+\(\d\) 0:green
add-highlighter -group man-highlight regex [-a-zA-Z0-9_.]+\(\d\) 0:green
}
hook global WinSetOption filetype=man %{
@ -20,10 +20,10 @@ hook global WinSetOption filetype=man %{
}
}
hook -group man-highlight global WinSetOption filetype=(?!man).* %{ rmhl man-highlight }
hook -group man-highlight global WinSetOption filetype=(?!man).* %{ remove-highlighter man-highlight }
hook global WinSetOption filetype=(?!man).* %{
rmhooks window man-hooks
remove-hooks window man-hooks
}
def -hidden -params 1..2 _man %{ %sh{

View File

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

View File

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

View File

@ -54,7 +54,7 @@ def autorestore-purge-backups -docstring "Remove all the backups of the current
## If for some reason, backup files need to be ignored
def autorestore-disable -docstring "Disable automatic backup recovering" %{
rmhooks global autorestore
remove-hooks global autorestore
}
hook -group autorestore global BufOpen .* %{ autorestore-restore-buffer }

View File

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

View File

@ -25,7 +25,7 @@ The syntaxic errors detected during parsing are shown when auto-diagnostics are
set buffer make_current_error_line 0
hook -group fifo buffer BufCloseFifo .* %{
nop %sh{ rm -r ${dir} }
rmhooks buffer fifo
remove-hooks buffer fifo
}
}"
# this runs in a detached shell, asynchronously, so that kakoune does
@ -126,7 +126,7 @@ def clang-enable-autocomplete -docstring "Enable automatic clang completion" %{
def clang-disable-autocomplete -docstring "Disable automatic clang completion" %{
set window completers %sh{ printf %s\\n "'${kak_opt_completers}'" | sed -e 's/option=clang_completions://g' }
rmhooks window clang-autocomplete
remove-hooks window clang-autocomplete
unalias window complete clang-complete
}
@ -140,14 +140,14 @@ def -hidden clang-show-error-info %{ %sh{
def clang-enable-diagnostics -docstring %{Activate automatic error reporting and diagnostics
Information about the analysis are showned after the buffer has been parsed with the clang-parse function} \
%{
addhl flag_lines default clang_flags
add-highlighter flag_lines default clang_flags
hook window -group clang-diagnostics NormalIdle .* %{ clang-show-error-info }
hook window -group clang-diagnostics WinSetOption ^clang_errors=.* %{ info; clang-show-error-info }
}
def clang-disable-diagnostics -docstring "Disable automatic error reporting and diagnostics" %{
rmhl hlflags_clang_flags
rmhooks window clang-diagnostics
remove-highlighter hlflags_clang_flags
remove-hooks window clang-diagnostics
}
def clang-diagnostics-next -docstring "Jump to the next line that contains an error" %{ %sh{

View File

@ -11,7 +11,7 @@ hook global BufCreate .*[.](coffee) %{
# Highlighters
# ‾‾‾‾‾‾‾‾‾‾‾‾
addhl -group / regions -default code coffee \
add-highlighter -group / regions -default code coffee \
double_string '"""' '"""' '' \
single_string "'''" "'''" '' \
comment '###' '###' '' \
@ -24,23 +24,23 @@ addhl -group / regions -default code coffee \
# 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
addhl -group /coffee/double_string fill string
addhl -group /coffee/double_string regions regions interpolation \Q#{ \} \{
addhl -group /coffee/double_string/regions/interpolation fill meta
addhl -group /coffee/single_string fill string
addhl -group /coffee/regex fill meta
addhl -group /coffee/regex regions regions interpolation \Q#{ \} \{
addhl -group /coffee/regex/regions/interpolation fill meta
addhl -group /coffee/comment fill comment
add-highlighter -group /coffee/double_string fill string
add-highlighter -group /coffee/double_string regions regions interpolation \Q#{ \} \{
add-highlighter -group /coffee/double_string/regions/interpolation fill meta
add-highlighter -group /coffee/single_string fill string
add-highlighter -group /coffee/regex fill meta
add-highlighter -group /coffee/regex regions regions interpolation \Q#{ \} \{
add-highlighter -group /coffee/regex/regions/interpolation fill meta
add-highlighter -group /coffee/comment fill comment
# 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
addhl -group /coffee/code regex [$@]\w* 0:identifier
addhl -group /coffee/code regex \b(Array|Boolean|Date|Function|Number|Object|RegExp|String)\b 0:type
addhl -group /coffee/code regex \b(document|false|no|null|off|on|parent|self|this|true|undefined|window|yes)\b 0:value
addhl -group /coffee/code regex \b(and|is|isnt|not|or)\b 0:operator
addhl -group /coffee/code regex \b(break|case|catch|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally|for|function|if|implements|import|in|instanceof|interface|let|native|new|package|private|protected|public|return|static|super|switch|throw|try|typeof|var|void|while|with|yield)\b 0:keyword
add-highlighter -group /coffee/code regex [$@]\w* 0:identifier
add-highlighter -group /coffee/code regex \b(Array|Boolean|Date|Function|Number|Object|RegExp|String)\b 0:type
add-highlighter -group /coffee/code regex \b(document|false|no|null|off|on|parent|self|this|true|undefined|window|yes)\b 0:value
add-highlighter -group /coffee/code regex \b(and|is|isnt|not|or)\b 0:operator
add-highlighter -group /coffee/code regex \b(break|case|catch|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally|for|function|if|implements|import|in|instanceof|interface|let|native|new|package|private|protected|public|return|static|super|switch|throw|try|typeof|var|void|while|with|yield)\b 0:keyword
# Commands
# ‾‾‾‾‾‾‾‾
@ -69,16 +69,16 @@ def -hidden _coffee_indent_on_new_line %{
# Initialization
# ‾‾‾‾‾‾‾‾‾‾‾‾‾‾
hook -group coffee-highlight global WinSetOption filetype=coffee %{ addhl ref coffee }
hook -group coffee-highlight global WinSetOption filetype=coffee %{ add-highlighter ref coffee }
hook global WinSetOption filetype=coffee %{
hook window InsertEnd .* -group coffee-hooks _coffee_filter_around_selections
hook window InsertChar \n -group coffee-indent _coffee_indent_on_new_line
}
hook -group coffee-highlight global WinSetOption filetype=(?!coffee).* %{ rmhl coffee }
hook -group coffee-highlight global WinSetOption filetype=(?!coffee).* %{ remove-highlighter coffee }
hook global WinSetOption filetype=(?!coffee).* %{
rmhooks window coffee-indent
rmhooks window coffee-hooks
remove-hooks window coffee-indent
remove-hooks window coffee-hooks
}

View File

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

View File

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

View File

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

View File

@ -1,20 +1,20 @@
decl str docsclient
hook -group git-log-highlight global WinSetOption filetype=git-log %{
addhl group git-log-highlight
addhl -group git-log-highlight regex '^(commit) ([0-9a-f]+)$' 1:yellow 2:red
addhl -group git-log-highlight regex '^([a-zA-Z_-]+:) (.*?)$' 1:green 2:magenta
addhl -group git-log-highlight ref diff # highlight potential diffs from the -p option
add-highlighter group git-log-highlight
add-highlighter -group git-log-highlight regex '^(commit) ([0-9a-f]+)$' 1:yellow 2:red
add-highlighter -group git-log-highlight regex '^([a-zA-Z_-]+:) (.*?)$' 1:green 2:magenta
add-highlighter -group git-log-highlight ref diff # highlight potential diffs from the -p option
}
hook -group git-log-highlight global WinSetOption filetype=(?!git-log).* %{ rmhl git-log-highlight }
hook -group git-log-highlight global WinSetOption filetype=(?!git-log).* %{ remove-highlighter git-log-highlight }
hook -group git-status-highlight global WinSetOption filetype=git-status %{
addhl group git-status-highlight
addhl -group git-status-highlight regex '^\h+(?:((?:both )?modified:)|(added:|new file:)|(deleted(?: by \w+)?:)|(renamed:)|(copied:))(?:.*?)$' 1:yellow 2:green 3:red 4:cyan 5:blue 6:magenta
add-highlighter group git-status-highlight
add-highlighter -group git-status-highlight regex '^\h+(?:((?:both )?modified:)|(added:|new file:)|(deleted(?: by \w+)?:)|(renamed:)|(copied:))(?:.*?)$' 1:yellow 2:green 3:red 4:cyan 5:blue 6:magenta
}
hook -group git-status-highlight global WinSetOption filetype=(?!git-status).* %{ rmhl git-status-highlight }
hook -group git-status-highlight global WinSetOption filetype=(?!git-status).* %{ remove-highlighter git-status-highlight }
decl line-flags git_blame_flags
decl line-flags git_diff_flags
@ -47,7 +47,7 @@ Available commands:\n-add\n-rm\n-blame\n-commit\n-checkout\n-diff\n-hide-blame\n
set buffer filetype '${filetype}'
hook -group fifo buffer BufCloseFifo .* %{
nop %sh{ rm -r $(dirname ${output}) }
rmhooks buffer fifo
remove-hooks buffer fifo
}
}"
}
@ -55,7 +55,7 @@ Available commands:\n-add\n-rm\n-blame\n-commit\n-checkout\n-diff\n-hide-blame\n
run_git_blame() {
(
printf %s "eval -client '$kak_client' %{
try %{ addhl flag_lines GitBlame git_blame_flags }
try %{ add-highlighter flag_lines GitBlame git_blame_flags }
set buffer=$kak_bufname git_blame_flags '$kak_timestamp'
}" | kak -p ${kak_session}
git blame "$@" --incremental ${kak_buffile} | awk '
@ -142,11 +142,11 @@ Available commands:\n-add\n-rm\n-blame\n-commit\n-checkout\n-diff\n-hide-blame\n
hide-blame)
printf %s "try %{
set buffer=$kak_bufname git_blame_flags ''
rmhl hlflags_git_blame_flags
remove-highlighter hlflags_git_blame_flags
}"
;;
show-diff)
echo 'try %{ addhl flag_lines GitDiffFlags git_diff_flags }'
echo 'try %{ add-highlighter flag_lines GitDiffFlags git_diff_flags }'
update_diff
;;
update-diff) update_diff ;;

View File

@ -44,7 +44,7 @@ def go-enable-autocomplete -docstring "Add gocode completion candidates to the c
def go-disable-autocomplete -docstring "Disable gocode completion" %{
set window completers %sh{ printf %s\\n "'${kak_opt_completers}'" | sed 's/option=gocode_completions://g' }
rmhooks window go-autocomplete
remove-hooks window go-autocomplete
unalias window complete go-complete
}

View File

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

View File

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

View File

@ -42,6 +42,6 @@ def jedi-enable-autocomplete -docstring "Add jedi completion candidates to the c
def jedi-disable-autocomplete -docstring "Disable jedi completion" %{
set window completers %sh{ printf %s\\n "'${kak_opt_completers}'" | sed -e 's/option=jedi_completions://g' }
rmhooks window jedi-autocomplete
remove-hooks window jedi-autocomplete
unalias window complete jedi-complete
}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -13,11 +13,11 @@ hook global BufCreate .*[.](scss) %{
# Highlighters
# ‾‾‾‾‾‾‾‾‾‾‾‾
addhl -group / group scss
add-highlighter -group / group scss
addhl -group /scss ref css
add-highlighter -group /scss ref css
addhl -group /scss regex @[A-Za-z][A-Za-z0-9_-]* 0:meta
add-highlighter -group /scss regex @[A-Za-z][A-Za-z0-9_-]* 0:meta
# Commands
# ‾‾‾‾‾‾‾‾
@ -29,7 +29,7 @@ def -hidden _scss_indent_on_closing_curly_brace _css_indent_on_closing_curly_bra
# Initialization
# ‾‾‾‾‾‾‾‾‾‾‾‾‾‾
hook -group scss-highlight global WinSetOption filetype=scss %{ addhl ref scss }
hook -group scss-highlight global WinSetOption filetype=scss %{ add-highlighter ref scss }
hook global WinSetOption filetype=scss %[
hook window InsertEnd .* -group scss-hooks _scss_filter_around_selections
@ -37,9 +37,9 @@ hook global WinSetOption filetype=scss %[
hook window InsertChar \} -group scss-indent _scss_indent_on_closing_curly_brace
]
hook -group scss-highlight global WinSetOption filetype=(?!scss).* %{ rmhl scss }
hook -group scss-highlight global WinSetOption filetype=(?!scss).* %{ remove-highlighter scss }
hook global WinSetOption filetype=(?!scss).* %{
rmhooks window scss-indent
rmhooks window scss-hooks
remove-hooks window scss-indent
remove-hooks window scss-hooks
}

View File

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

View File

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

View File

@ -784,7 +784,7 @@ const CommandDesc add_hook_cmd = {
" (and any window for that buffer)\n"
" * window: hook is executed only for the current window\n",
ParameterDesc{
{ { "group", { true, "set hook group, see rmhooks" } } },
{ { "group", { true, "set hook group, see remove-hooks" } } },
ParameterDesc::Flags::None, 4, 4
},
CommandFlags::None,

View File

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

View File

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