mirror of
https://github.com/nvim-treesitter/nvim-treesitter.git
synced 2026-07-01 19:17:02 -04:00
Add text.reference and text.environment
This commit is contained in:
parent
0556edf5f3
commit
712cc78a1e
6 changed files with 66 additions and 13 deletions
|
|
@ -167,7 +167,10 @@ Mainly for markup languages.
|
||||||
@text.title
|
@text.title
|
||||||
@text.literal
|
@text.literal
|
||||||
@text.uri
|
@text.uri
|
||||||
@text.math (e.g. for LaTeX math enviroments)
|
@text.math (e.g. for LaTeX math environments)
|
||||||
|
@text.environment (e.g. for text environments of markup languages)
|
||||||
|
@text.environment.name (e.g. for the name/the string indicating the type of text environment)
|
||||||
|
@text.reference (for footnotes, text references, citations)
|
||||||
|
|
||||||
@text.note
|
@text.note
|
||||||
@text.warning
|
@text.warning
|
||||||
|
|
|
||||||
|
|
@ -85,6 +85,9 @@ hlmap["text.title"] = "TSTitle"
|
||||||
hlmap["text.literal"] = "TSLiteral"
|
hlmap["text.literal"] = "TSLiteral"
|
||||||
hlmap["text.uri"] = "TSURI"
|
hlmap["text.uri"] = "TSURI"
|
||||||
hlmap["text.math"] = "TSMath"
|
hlmap["text.math"] = "TSMath"
|
||||||
|
hlmap["text.reference"] = "TSTextReference"
|
||||||
|
hlmap["text.environment"] = "TSEnviroment"
|
||||||
|
hlmap["text.environment.name"] = "TSEnviromentName"
|
||||||
|
|
||||||
hlmap["text.note"] = "TSNote"
|
hlmap["text.note"] = "TSNote"
|
||||||
hlmap["text.warning"] = "TSWarning"
|
hlmap["text.warning"] = "TSWarning"
|
||||||
|
|
|
||||||
|
|
@ -77,6 +77,9 @@ highlight default TSEmphasis term=italic cterm=italic gui=italic
|
||||||
highlight default TSUnderline term=underline cterm=underline gui=underline
|
highlight default TSUnderline term=underline cterm=underline gui=underline
|
||||||
highlight default TSStrike term=strikethrough cterm=strikethrough gui=strikethrough
|
highlight default TSStrike term=strikethrough cterm=strikethrough gui=strikethrough
|
||||||
highlight default link TSMath Special
|
highlight default link TSMath Special
|
||||||
|
highlight default link TSTextReference Constant
|
||||||
|
highlight default link TSEnviroment Macro
|
||||||
|
highlight default link TSEnviromentName Normal
|
||||||
highlight default link TSTitle Title
|
highlight default link TSTitle Title
|
||||||
highlight default link TSLiteral String
|
highlight default link TSLiteral String
|
||||||
highlight default link TSURI Underlined
|
highlight default link TSURI Underlined
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
[
|
[
|
||||||
(chapter)
|
(chapter)
|
||||||
|
(part)
|
||||||
(section)
|
(section)
|
||||||
(subsection)
|
(subsection)
|
||||||
(subsubsection)
|
(subsubsection)
|
||||||
|
|
@ -7,4 +8,5 @@
|
||||||
(subparagraph)
|
(subparagraph)
|
||||||
|
|
||||||
(environment)
|
(environment)
|
||||||
|
(displayed_equation)
|
||||||
] @fold
|
] @fold
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,7 @@
|
||||||
((environment
|
((environment
|
||||||
(begin
|
(begin
|
||||||
name: (word) @_env)) @text.math
|
name: (word) @_env)) @text.math
|
||||||
(#match? @_env "^(displaymath|eqn|eqnarray|align)[*]?$"))
|
(#match? @_env "^(displaymath|equation|multline|eqnarray|align|array|split)[*]?$"))
|
||||||
|
|
||||||
;; This at the begining of the file would be the alternative to highlight
|
;; This at the begining of the file would be the alternative to highlight
|
||||||
;; only the interior of the environment
|
;; only the interior of the environment
|
||||||
|
|
@ -20,12 +20,29 @@
|
||||||
|
|
||||||
[
|
[
|
||||||
(generic_command_name)
|
(generic_command_name)
|
||||||
"\\begin"
|
|
||||||
"\\end"
|
|
||||||
"\\newcommand"
|
"\\newcommand"
|
||||||
"\\renewcommand"
|
"\\renewcommand"
|
||||||
"\\DeclareRobustCommand"
|
"\\DeclareRobustCommand"
|
||||||
|
"\\DeclareMathOperator"
|
||||||
|
"\\newglossaryentry"
|
||||||
"\\caption"
|
"\\caption"
|
||||||
|
"\\cite"
|
||||||
|
"\\label"
|
||||||
|
"\\newlabel"
|
||||||
|
"\\label"
|
||||||
|
"\\ref"
|
||||||
|
"\\cref"
|
||||||
|
"\\eqref"
|
||||||
|
"\\color"
|
||||||
|
"\\colorbox"
|
||||||
|
"\\textcolor"
|
||||||
|
"\\pagecolor"
|
||||||
|
"\\definecolor"
|
||||||
|
"\\definecolorset"
|
||||||
|
"\\newtheorem"
|
||||||
|
"\\declaretheorem"
|
||||||
|
"\\newacronym"
|
||||||
|
"\\newglossaryentry"
|
||||||
] @function.macro
|
] @function.macro
|
||||||
|
|
||||||
(comment) @comment
|
(comment) @comment
|
||||||
|
|
@ -38,6 +55,7 @@
|
||||||
"\\usepackage"
|
"\\usepackage"
|
||||||
"\\documentclass"
|
"\\documentclass"
|
||||||
"\\input"
|
"\\input"
|
||||||
|
"\\include"
|
||||||
"\\subfile"
|
"\\subfile"
|
||||||
"\\subfileinclude"
|
"\\subfileinclude"
|
||||||
"\\subfileinclude"
|
"\\subfileinclude"
|
||||||
|
|
@ -51,6 +69,7 @@
|
||||||
] @include
|
] @include
|
||||||
|
|
||||||
[
|
[
|
||||||
|
"\\part"
|
||||||
"\\chapter"
|
"\\chapter"
|
||||||
"\\section"
|
"\\section"
|
||||||
"\\subsection"
|
"\\subsection"
|
||||||
|
|
@ -64,22 +83,34 @@
|
||||||
((word) @punctuation.delimiter
|
((word) @punctuation.delimiter
|
||||||
(#eq? @punctuation.delimiter "&"))
|
(#eq? @punctuation.delimiter "&"))
|
||||||
|
|
||||||
[
|
["$" "\\[" "\\]" "\\(" "\\)"] @punctuation.delimiter
|
||||||
(label_definition)
|
|
||||||
(label_reference)
|
(label_definition
|
||||||
(equation_label_reference)
|
name: (_) @text.reference)
|
||||||
(label_number)
|
(label_reference
|
||||||
] @label
|
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
|
(key_val_pair
|
||||||
key: (_) @parameter
|
key: (_) @parameter
|
||||||
value: (_))
|
value: (_))
|
||||||
|
|
||||||
["(" ")" "[" "]" "{" "}"] @punctuation.bracket
|
["[" "]" "{" "}"] @punctuation.bracket ;"(" ")" is has no special meaning in LaTeX
|
||||||
|
|
||||||
(chapter
|
(chapter
|
||||||
text: (brace_group) @text.title)
|
text: (brace_group) @text.title)
|
||||||
|
|
||||||
|
(part
|
||||||
|
text: (brace_group) @text.title)
|
||||||
|
|
||||||
(section
|
(section
|
||||||
text: (brace_group) @text.title)
|
text: (brace_group) @text.title)
|
||||||
|
|
||||||
|
|
@ -128,8 +159,19 @@
|
||||||
((generic_command
|
((generic_command
|
||||||
name:(generic_command_name) @_name
|
name:(generic_command_name) @_name
|
||||||
.
|
.
|
||||||
arg: (_) @text.url)
|
arg: (_) @text.uri)
|
||||||
(#match? @_name "^(\\url|\\href)$"))
|
(#match? @_name "^(\\url|\\href)$"))
|
||||||
|
|
||||||
(ERROR) @error
|
(ERROR) @error
|
||||||
|
|
||||||
|
[
|
||||||
|
"\\begin"
|
||||||
|
"\\end"
|
||||||
|
] @text.environment
|
||||||
|
|
||||||
|
(begin
|
||||||
|
name: (_) @text.environment.name
|
||||||
|
(#not-match? @text.environment.name "^(displaymath|equation|multline|eqnarray|align|array|split)[*]?$"))
|
||||||
|
(end
|
||||||
|
name: (_) @text.environment.name
|
||||||
|
(#not-match? @text.environment.name "^(displaymath|equation|multline|eqnarray|align|array|split)[*]?$"))
|
||||||
|
|
|
||||||
|
|
@ -127,7 +127,7 @@
|
||||||
(footnote_reference)
|
(footnote_reference)
|
||||||
(citation_reference)
|
(citation_reference)
|
||||||
(reference)
|
(reference)
|
||||||
] @constant
|
] @text.reference
|
||||||
|
|
||||||
;; Others
|
;; Others
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue