improve vi syntax highlighting (#4222)

* simplify string highlighting to reduce likelihood of false positive matches
* highlight registers
* support more keywords
This commit is contained in:
Mikko
2026-09-14 22:38:54 +02:00
committed by GitHub
parent 6b19798535
commit ee457f606b
+12 -16
View File
@@ -7,25 +7,21 @@ rules:
- identifier: "[A-Za-z_][A-Za-z0-9_]*[(]+[A-Za-z0-9_:.,\\s]*[)]+"
- special: "[()]+"
- statement: "\\b([nvxsoilc]?(nore|un)?map|[nvlx]n|[ico]?no|[cilovx][um]|s?unm)\\b"
- statement: "\\b(snor|nun|nm|set|if|endif|let|unlet|source)\\b"
- statement: "[!&=?]"
- statement: "\\b(is|isnot|fu(nc?|nction)?|if|while|for|try|return|throw|end(if|for|while|try|fu(nc?|nction)?|f)?|au(g|group)|else(if)?|do|in|catch|finally)\\b"
- statement: "\\b(snor|nun|nm|set(l|local|global)?|let|command|filetype|colorscheme|syn(tax)?|exe(c|cute)?|ec(ho)?|au(tocmd)?|source|call)\\b"
- statement: "[!&=?]|[+<>]="
- constant.number: "\\b[0-9]+\\b"
- identifier:
start: "@"
end: ".|$"
rules: []
- comment:
start: "(^\"|[ \t]+\" |[ \t]+\"$)"
start: "^[ \t]*\""
end: "$"
rules: []
- constant.string:
start: "\""
end: "\""
skip: "\\\\."
rules:
- constant.specialChar: "\\\\."
- constant.string:
start: "'"
end: "'"
skip: "\\\\."
rules:
- constant.specialChar: "\\\\."
- constant.string: '"[^"]*"'
- constant.string: "'[^']*'"
- constant.specialChar: "\\\\."