aboutsummaryrefslogtreecommitdiff
path: root/plugins/language_tex.lua
diff options
context:
space:
mode:
authorFrancesco Abbate <francesco.bbt@gmail.com>2021-09-14 09:20:58 +0200
committerFrancesco Abbate <francesco.bbt@gmail.com>2021-09-14 09:20:58 +0200
commite93bfb1afafda1e84aa014f3f3f2aac90a1224cf (patch)
tree7503e159e683558b20a00a6ae46b6330a136a1fb /plugins/language_tex.lua
parent9edf5d4818473bf860813f804efb4342f0aad0bd (diff)
downloadlite-xl-plugins-e93bfb1afafda1e84aa014f3f3f2aac90a1224cf.tar.gz
lite-xl-plugins-e93bfb1afafda1e84aa014f3f3f2aac90a1224cf.zip
Attempt to improve tex syntax highlighting
In theory we could have a sub-syntax for the math mode but this is difficult to achieve.
Diffstat (limited to 'plugins/language_tex.lua')
-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 = {}
}