3 ms·
Huh, I thought being "hardcore" about vim meant writing your own syntax highlighting rules. (Which isn't that hard, though vimscript does have some weird quirk
by yongjik 10y ago
Huh, I thought being "hardcore" about vim meant writing your own syntax highlighting rules. (Which isn't that hard, though vimscript does have some weird quirks.)
- kazinator 10y agoVim's syntax coloring is more powerful than what I have been able to find in other systems. It can handle nested constructs quite well. If you have a situation in which two languages can be embedded in each other. I am using Vim dynamically, calling it out of CGIT. For example: http://www.kylheku.com/cgit/txr/tree/genman.txr http://www.kylheku.com/cgit/txr/tree/genman.txr When you access this file, CGIT runs a syntax highlighting shell script where you can hook in multiple approaches (e.g. based on file suffix). I hacked this script to run Vim via Expect, to load the text and save the HTML with :TOHtml. As you can see, the TXR pattern language and TXR Lisp are nicely separated in the output. The identifiers are colored differently---even in cases when they are the same! Look for a purple (do ...), which is a directive in the TXR pattern language to enclose and evaluate a bunch of Lisp, and green (do ...), which is a totally unrelated construct in TXR Lisp: one of the forms that support explicit partial evaluation. When I'm coding in TXR, Vim is quite accurate in identifying mistakes like string literals not being closed and parentheses not being balanced and such, or various tokens being malformed and whatnot. It can figure it out in spite of levels of nesting. It significantly reduces such errors.