diff options
| author | Stephan Seitz <stephan.seitz@fau.de> | 2021-03-28 01:42:47 +0100 |
|---|---|---|
| committer | Stephan Seitz <stephan.lauf@yahoo.de> | 2021-03-30 19:26:37 +0200 |
| commit | 0556edf5f385d95c0f8330e6607ade3b9710adc6 (patch) | |
| tree | d716d2c57de5d369c4ec18e0d9138925108b4a82 /queries/latex | |
| parent | feat: Add Latex basic highlights and folds (diff) | |
| download | nvim-treesitter-0556edf5f385d95c0f8330e6607ade3b9710adc6.tar nvim-treesitter-0556edf5f385d95c0f8330e6607ade3b9710adc6.tar.gz nvim-treesitter-0556edf5f385d95c0f8330e6607ade3b9710adc6.tar.bz2 nvim-treesitter-0556edf5f385d95c0f8330e6607ade3b9710adc6.tar.lz nvim-treesitter-0556edf5f385d95c0f8330e6607ade3b9710adc6.tar.xz nvim-treesitter-0556edf5f385d95c0f8330e6607ade3b9710adc6.tar.zst nvim-treesitter-0556edf5f385d95c0f8330e6607ade3b9710adc6.zip | |
latex: add TSMath that behaves like vimtex math highlighting
Diffstat (limited to 'queries/latex')
| -rw-r--r-- | queries/latex/highlights.scm | 39 |
1 files changed, 32 insertions, 7 deletions
diff --git a/queries/latex/highlights.scm b/queries/latex/highlights.scm index cea10cb31..dc1cb0740 100644 --- a/queries/latex/highlights.scm +++ b/queries/latex/highlights.scm @@ -1,3 +1,23 @@ +;; Math +[ + (displayed_equation) + (inline_formula) +] @text.math + +;; This highlights the whole environment like vimtex does +((environment + (begin + name: (word) @_env)) @text.math + (#match? @_env "^(displaymath|eqn|eqnarray|align)[*]?$")) + +;; This at the begining of the file would be the alternative to highlight +;; only the interior of the environment +;((environment + ;(begin + ;name: (word) @_env) @none + ;(end) @none) @text.math + ;(#match? @_env "^(displaymath|eqn|eqnarray)[*]?$")) + [ (generic_command_name) "\\begin" @@ -5,6 +25,7 @@ "\\newcommand" "\\renewcommand" "\\DeclareRobustCommand" + "\\caption" ] @function.macro (comment) @comment @@ -38,6 +59,11 @@ "\\subparagraph" ] @type +"\\item" @punctuation.special + +((word) @punctuation.delimiter +(#eq? @punctuation.delimiter "&")) + [ (label_definition) (label_reference) @@ -99,12 +125,11 @@ arg: (_) @text.strong) (#match? @_name "^(\\textbf|\\mathbf)$")) -(ERROR) @error +((generic_command + name:(generic_command_name) @_name + . + arg: (_) @text.url) + (#match? @_name "^(\\url|\\href)$")) -;; Controversial -; Add @text.bullet? -"\\item" @punctuation.special +(ERROR) @error -;; Math (TODO) -;(displayed_equation) -;(inline_formula) |
