helix-mirror/runtime/queries/latex/highlights.scm

411 lines
6.9 KiB
Scheme
Raw Normal View History

2021-06-15 20:50:42 +04:00
;; Math
[
(displayed_equation)
(inline_formula)
] @text.math
;; This highlights the whole environment like vimtex does
((environment
(begin
name: (word) @_env)) @text.math
(#any-of? @_env
"displaymath" "displaymath*"
"equation" "equation*"
"multline" "multline*"
"eqnarray" "eqnarray*"
"align" "align*"
"array" "array*"
"split" "split*"
"alignat" "alignat*"
"gather" "gather*"
"flalign" "flalign*"))
[
(generic_command_name)
"\\newcommand"
"\\renewcommand"
"\\DeclareRobustCommand"
"\\DeclareMathOperator"
"\\newglossaryentry"
"\\caption"
"\\label"
"\\newlabel"
"\\color"
"\\colorbox"
"\\textcolor"
"\\pagecolor"
"\\definecolor"
"\\definecolorset"
"\\newtheorem"
"\\declaretheorem"
"\\newacronym"
] @function.macro
[
"\\ref"
"\\vref"
"\\Vref"
"\\autoref"
"\\pageref"
"\\cref"
"\\Cref"
"\\cref*"
"\\Cref*"
"\\namecref"
"\\nameCref"
"\\lcnamecref"
"\\namecrefs"
"\\nameCrefs"
"\\lcnamecrefs"
"\\labelcref"
"\\labelcpageref"
"\\crefrange"
"\\crefrange"
"\\Crefrange"
"\\Crefrange"
"\\crefrange*"
"\\crefrange*"
"\\Crefrange*"
"\\Crefrange*"
] @function.macro
[
"\\cite"
"\\cite*"
"\\Cite"
"\\nocite"
"\\citet"
"\\citep"
"\\citet*"
"\\citep*"
"\\citeauthor"
"\\citeauthor*"
"\\Citeauthor"
"\\Citeauthor*"
"\\citetitle"
"\\citetitle*"
"\\citeyear"
"\\citeyear*"
"\\citedate"
"\\citedate*"
"\\citeurl"
"\\fullcite"
"\\citeyearpar"
"\\citealt"
"\\citealp"
"\\citetext"
"\\parencite"
"\\parencite*"
"\\Parencite"
"\\footcite"
"\\footfullcite"
"\\footcitetext"
"\\textcite"
"\\Textcite"
"\\smartcite"
"\\Smartcite"
"\\supercite"
"\\autocite"
"\\Autocite"
"\\autocite*"
"\\Autocite*"
"\\volcite"
"\\Volcite"
"\\pvolcite"
"\\Pvolcite"
"\\fvolcite"
"\\ftvolcite"
"\\svolcite"
"\\Svolcite"
"\\tvolcite"
"\\Tvolcite"
"\\avolcite"
"\\Avolcite"
"\\notecite"
"\\notecite"
"\\pnotecite"
"\\Pnotecite"
"\\fnotecite"
] @function.macro
[
"\\ref"
"\\vref"
"\\Vref"
"\\autoref"
"\\pageref"
"\\cref"
"\\Cref"
"\\cref*"
"\\Cref*"
"\\namecref"
"\\nameCref"
"\\lcnamecref"
"\\namecrefs"
"\\nameCrefs"
"\\lcnamecrefs"
"\\labelcref"
"\\labelcpageref"
] @function.macro
[
"\\crefrange"
"\\crefrange"
"\\Crefrange"
"\\Crefrange"
"\\crefrange*"
"\\crefrange*"
"\\Crefrange*"
"\\Crefrange*"
] @function.macro
[
"\\gls"
"\\Gls"
"\\GLS"
"\\glspl"
"\\Glspl"
"\\GLSpl"
"\\glsdisp"
"\\glslink"
"\\glstext"
"\\Glstext"
"\\GLStext"
"\\glsfirst"
"\\Glsfirst"
"\\GLSfirst"
"\\glsplural"
"\\Glsplural"
"\\GLSplural"
"\\glsfirstplural"
"\\Glsfirstplural"
"\\GLSfirstplural"
"\\glsname"
"\\Glsname"
"\\GLSname"
"\\glssymbol"
"\\Glssymbol"
"\\glsdesc"
"\\Glsdesc"
"\\GLSdesc"
"\\glsuseri"
"\\Glsuseri"
"\\GLSuseri"
"\\glsuserii"
"\\Glsuserii"
"\\GLSuserii"
"\\glsuseriii"
"\\Glsuseriii"
"\\GLSuseriii"
"\\glsuseriv"
"\\Glsuseriv"
"\\GLSuseriv"
"\\glsuserv"
"\\Glsuserv"
"\\GLSuserv"
"\\glsuservi"
"\\Glsuservi"
"\\GLSuservi"
] @function.macro
[
"\\acrshort"
"\\Acrshort"
"\\ACRshort"
"\\acrshortpl"
"\\Acrshortpl"
"\\ACRshortpl"
"\\acrlong"
"\\Acrlong"
"\\ACRlong"
"\\acrlongpl"
"\\Acrlongpl"
"\\ACRlongpl"
"\\acrfull"
"\\Acrfull"
"\\ACRfull"
"\\acrfullpl"
"\\Acrfullpl"
"\\ACRfullpl"
"\\acs"
"\\Acs"
"\\acsp"
"\\Acsp"
"\\acl"
"\\Acl"
"\\aclp"
"\\Aclp"
"\\acf"
"\\Acf"
"\\acfp"
"\\Acfp"
"\\ac"
"\\Ac"
"\\acp"
"\\glsentrylong"
"\\Glsentrylong"
"\\glsentrylongpl"
"\\Glsentrylongpl"
"\\glsentryshort"
"\\Glsentryshort"
"\\glsentryshortpl"
"\\Glsentryshortpl"
"\\glsentryfullpl"
"\\Glsentryfullpl"
] @function.macro
(comment) @comment
2021-09-02 09:58:57 +04:00
(bracket_group) @variable.parameter
2021-06-15 20:50:42 +04:00
[(math_operator) "="] @operator
[
"\\usepackage"
"\\documentclass"
"\\input"
"\\include"
"\\subfile"
"\\subfileinclude"
"\\subfileinclude"
"\\includegraphics"
"\\addbibresource"
"\\bibliography"
"\\includesvg"
"\\includeinkscape"
"\\usepgflibrary"
"\\usetikzlibrary"
] @keyword.control.import
2021-06-15 20:50:42 +04:00
[
"\\part"
"\\chapter"
"\\section"
"\\subsection"
"\\subsubsection"
"\\paragraph"
"\\subparagraph"
] @type
"\\item" @punctuation.special
((word) @punctuation.delimiter
(#eq? @punctuation.delimiter "&"))
["$" "\\[" "\\]" "\\(" "\\)"] @punctuation.delimiter
(label_definition
name: (_) @text.reference)
(label_reference
label: (_) @text.reference)
(equation_label_reference
label: (_) @text.reference)
(label_reference
label: (_) @text.reference)
(label_number
label: (_) @text.reference)
(citation
key: (word) @text.reference)
(key_val_pair
2021-09-02 09:58:57 +04:00
key: (_) @variable.parameter
2021-06-15 20:50:42 +04:00
value: (_))
["[" "]" "{" "}"] @punctuation.bracket ;"(" ")" is has no special meaning in LaTeX
(chapter
text: (brace_group) @markup.heading)
2021-06-15 20:50:42 +04:00
(part
text: (brace_group) @markup.heading)
2021-06-15 20:50:42 +04:00
(section
text: (brace_group) @markup.heading)
2021-06-15 20:50:42 +04:00
(subsection
text: (brace_group) @markup.heading)
2021-06-15 20:50:42 +04:00
(subsubsection
text: (brace_group) @markup.heading)
2021-06-15 20:50:42 +04:00
(paragraph
text: (brace_group) @markup.heading)
2021-06-15 20:50:42 +04:00
(subparagraph
text: (brace_group) @markup.heading)
2021-06-15 20:50:42 +04:00
((environment
(begin
name: (word) @_frame)
(brace_group
child: (text) @markup.heading))
2021-06-15 20:50:42 +04:00
(#eq? @_frame "frame"))
((generic_command
name:(generic_command_name) @_name
arg: (brace_group
(text) @markup.heading))
2021-06-15 20:50:42 +04:00
(#eq? @_name "\\frametitle"))
;; Formatting
((generic_command
name:(generic_command_name) @_name
arg: (_) @markup.italic)
2021-06-15 20:50:42 +04:00
(#eq? @_name "\\emph"))
((generic_command
name:(generic_command_name) @_name
arg: (_) @markup.italic)
2021-06-15 20:50:42 +04:00
(#match? @_name "^(\\\\textit|\\\\mathit)$"))
((generic_command
name:(generic_command_name) @_name
arg: (_) @markup.bold)
2021-06-15 20:50:42 +04:00
(#match? @_name "^(\\\\textbf|\\\\mathbf)$"))
((generic_command
name:(generic_command_name) @_name
.
arg: (_) @markup.link.url)
2021-06-15 20:50:42 +04:00
(#match? @_name "^(\\\\url|\\\\href)$"))
(ERROR) @error
[
"\\begin"
"\\end"
] @text.environment
(begin
name: (_) @text.environment.name
(#not-any-of? @text.environment.name
"displaymath" "displaymath*"
"equation" "equation*"
"multline" "multline*"
"eqnarray" "eqnarray*"
"align" "align*"
"array" "array*"
"split" "split*"
"alignat" "alignat*"
"gather" "gather*"
"flalign" "flalign*"))
(end
name: (_) @text.environment.name
(#not-any-of? @text.environment.name
"displaymath" "displaymath*"
"equation" "equation*"
"multline" "multline*"
"eqnarray" "eqnarray*"
"align" "align*"
"array" "array*"
"split" "split*"
"alignat" "alignat*"
"gather" "gather*"
"flalign" "flalign*"))