aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFrancesco <francesco.bbt@gmail.com>2021-09-17 23:07:23 +0200
committerGitHub <noreply@github.com>2021-09-17 23:07:23 +0200
commitfaa205148a67d3ac9ece82fb0237283ce57ed282 (patch)
tree0e46669290f6bd860cafbd1028a073f45414476f
parent2472c4807d40d7d91b5110bb5a4e2d101fabb82a (diff)
parente93bfb1afafda1e84aa014f3f3f2aac90a1224cf (diff)
downloadlite-xl-plugins-faa205148a67d3ac9ece82fb0237283ce57ed282.tar.gz
lite-xl-plugins-faa205148a67d3ac9ece82fb0237283ce57ed282.zip
Merge pull request #70 from lite-xl/improve-tex-syntax
Attempt to improve tex syntax highlighting
-rw-r--r--plugins/language_tex.lua23
1 files changed, 16 insertions, 7 deletions
diff --git a/plugins/language_tex.lua b/plugins/language_tex.lua
index 1bc08f5..9878505 100644
--- a/plugins/language_tex.lua
+++ b/plugins/language_tex.lua
@@ -5,13 +5,22 @@ syntax.add {
files = { "%.tex$" },
comment = "%%",
patterns = {
- { pattern = {"%%", "\n"}, type = "comment" },
- { pattern = "&", type = "operator" },
- { pattern = "\\\\", type = "operator" },
- { pattern = {"%$", "%$"}, type = "operator" },
- { pattern = {"\\%[", "\\]"}, type = "operator" },
- { pattern = {"{", "}"}, type = "keyword" },
- { pattern = "\\%w*", type = "keyword2" },
+ { pattern = "%%.-\n", type = "comment" },
+ { pattern = "\\documentclass().-{()%a%w+()}", type = {"keyword", "symbol", "function", "symbol"} },
+ { pattern = "\\usepackage", type = "keyword" },
+ { pattern = "\\chapter", type = "keyword" },
+ { pattern = "\\section", type = "keyword" },
+ { pattern = "\\subsection", type = "keyword" },
+ { pattern = "\\paragraph", type = "keyword" },
+ { pattern = "\\subparagraph", type = "keyword" },
+ { pattern = "\\begin(){()%a%w+()}", type = {"keyword2", "symbol", "function", "symbol"} },
+ { pattern = "\\end(){()%a%w+()}", type = {"keyword2", "symbol", "function", "symbol"} },
+ { pattern = "\\%a%w+()%*", type = {"keyword2", "operator"} },
+ { pattern = "\\%a%w+", type = "keyword2" },
+ { pattern = "&", type = "operator" },
+ { pattern = "\\\\", type = "operator" },
+ { pattern = "%$", type = "operator" },
+ { pattern = "\\[%[%]()]", type = "operator" },
},
symbols = {}
}