mirror of
https://github.com/nvim-treesitter/nvim-treesitter.git
synced 2026-07-17 02:40:09 -04:00
refactor(latex): deduplicate captures, reorder
This commit is contained in:
parent
debf5816ee
commit
4ee9f12ff5
1 changed files with 26 additions and 52 deletions
|
|
@ -1,18 +1,20 @@
|
||||||
; General syntax
|
; General syntax
|
||||||
(command_name) @function
|
(command_name) @function @nospell
|
||||||
|
|
||||||
(placeholder) @variable
|
|
||||||
|
|
||||||
(text_mode
|
|
||||||
[
|
|
||||||
"\\text"
|
|
||||||
"\\intertext"
|
|
||||||
"\\shortintertext"
|
|
||||||
] @function)
|
|
||||||
|
|
||||||
(caption
|
(caption
|
||||||
command: _ @function)
|
command: _ @function)
|
||||||
|
|
||||||
|
(placeholder) @variable
|
||||||
|
|
||||||
|
; Turn spelling on for text
|
||||||
|
(text) @spell
|
||||||
|
|
||||||
|
; \text, \intertext, \shortintertext, ...
|
||||||
|
(text_mode
|
||||||
|
command: _ @function @nospell
|
||||||
|
content: (curly_group
|
||||||
|
(_) @none @spell))
|
||||||
|
|
||||||
(key_value_pair
|
(key_value_pair
|
||||||
key: (_) @variable.parameter
|
key: (_) @variable.parameter
|
||||||
value: (_))
|
value: (_))
|
||||||
|
|
@ -53,17 +55,13 @@
|
||||||
|
|
||||||
; Definitions and references
|
; Definitions and references
|
||||||
(new_command_definition
|
(new_command_definition
|
||||||
command: _ @function.macro
|
command: _ @function.macro)
|
||||||
declaration: (curly_group_command_name
|
|
||||||
(_) @function))
|
|
||||||
|
|
||||||
(old_command_definition
|
(old_command_definition
|
||||||
command: _ @function.macro
|
command: _ @function.macro)
|
||||||
declaration: (_) @function)
|
|
||||||
|
|
||||||
(let_command_definition
|
(let_command_definition
|
||||||
command: _ @function.macro
|
command: _ @function.macro)
|
||||||
declaration: (_) @function)
|
|
||||||
|
|
||||||
(environment_definition
|
(environment_definition
|
||||||
command: _ @function.macro
|
command: _ @function.macro
|
||||||
|
|
@ -107,6 +105,11 @@
|
||||||
command: _ @function.macro
|
command: _ @function.macro
|
||||||
keys: (curly_group_text_list) @markup.link)
|
keys: (curly_group_text_list) @markup.link)
|
||||||
|
|
||||||
|
(hyperlink
|
||||||
|
command: _ @function @nospell
|
||||||
|
uri: (curly_group_uri
|
||||||
|
(_) @markup.link.url @nospell))
|
||||||
|
|
||||||
(glossary_entry_definition
|
(glossary_entry_definition
|
||||||
command: _ @function.macro
|
command: _ @function.macro
|
||||||
name: (curly_group_text
|
name: (curly_group_text
|
||||||
|
|
@ -137,26 +140,6 @@
|
||||||
name: (curly_group_text
|
name: (curly_group_text
|
||||||
(_) @markup.link))
|
(_) @markup.link))
|
||||||
|
|
||||||
; Formatting
|
|
||||||
(text_mode
|
|
||||||
content: (curly_group
|
|
||||||
(_) @none @spell))
|
|
||||||
|
|
||||||
(math_environment
|
|
||||||
(begin
|
|
||||||
command: _ @markup.math
|
|
||||||
name: (curly_group_text
|
|
||||||
(_) @markup.math)))
|
|
||||||
|
|
||||||
(math_environment
|
|
||||||
(_) @markup.math)
|
|
||||||
|
|
||||||
(math_environment
|
|
||||||
(end
|
|
||||||
command: _ @markup.math
|
|
||||||
name: (curly_group_text
|
|
||||||
(_) @markup.math)))
|
|
||||||
|
|
||||||
; Sectioning
|
; Sectioning
|
||||||
(title_declaration
|
(title_declaration
|
||||||
command: _ @module
|
command: _ @module
|
||||||
|
|
@ -232,7 +215,7 @@
|
||||||
((generic_command
|
((generic_command
|
||||||
command: (command_name) @_name
|
command: (command_name) @_name
|
||||||
arg: (curly_group
|
arg: (curly_group
|
||||||
(text) @markup.heading))
|
(_) @markup.heading))
|
||||||
(#eq? @_name "\\frametitle"))
|
(#eq? @_name "\\frametitle"))
|
||||||
|
|
||||||
((generic_command
|
((generic_command
|
||||||
|
|
@ -247,11 +230,6 @@
|
||||||
(_) @markup.strong))
|
(_) @markup.strong))
|
||||||
(#any-of? @_name "\\textbf" "\\mathbf"))
|
(#any-of? @_name "\\textbf" "\\mathbf"))
|
||||||
|
|
||||||
(hyperlink
|
|
||||||
command: _ @function @nospell
|
|
||||||
uri: (curly_group_uri
|
|
||||||
(_) @markup.link.url @nospell))
|
|
||||||
|
|
||||||
; File inclusion commands
|
; File inclusion commands
|
||||||
(class_include
|
(class_include
|
||||||
command: _ @keyword.import
|
command: _ @keyword.import
|
||||||
|
|
@ -302,12 +280,6 @@
|
||||||
command: _ @keyword.import
|
command: _ @keyword.import
|
||||||
paths: (curly_group_path_list) @string)
|
paths: (curly_group_path_list) @string)
|
||||||
|
|
||||||
(text) @spell
|
|
||||||
|
|
||||||
(inline_formula) @nospell
|
|
||||||
|
|
||||||
(displayed_equation) @nospell
|
|
||||||
|
|
||||||
(key_value_pair) @nospell
|
(key_value_pair) @nospell
|
||||||
|
|
||||||
(generic_environment
|
(generic_environment
|
||||||
|
|
@ -317,8 +289,6 @@
|
||||||
(citation
|
(citation
|
||||||
keys: _ @nospell)
|
keys: _ @nospell)
|
||||||
|
|
||||||
(command_name) @nospell
|
|
||||||
|
|
||||||
(label_definition) @nospell
|
(label_definition) @nospell
|
||||||
|
|
||||||
(label_reference) @nospell
|
(label_reference) @nospell
|
||||||
|
|
@ -329,8 +299,12 @@
|
||||||
[
|
[
|
||||||
(displayed_equation)
|
(displayed_equation)
|
||||||
(inline_formula)
|
(inline_formula)
|
||||||
] @markup.math
|
] @markup.math @nospell
|
||||||
|
|
||||||
|
(math_environment
|
||||||
|
(_) @markup.math)
|
||||||
|
|
||||||
|
; Comments
|
||||||
[
|
[
|
||||||
(line_comment)
|
(line_comment)
|
||||||
(block_comment)
|
(block_comment)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue