Here is a Chinese entry document, but too long, do not want to read, so there is this article
- The quickest way is to find a syntax similar syntax highlighting file, a little change
- Write your own words first, the key words:
Case " is case sensitive syntax keyword your keyword category name x keyword 1 keyword 2syntax keyword also fill x, will not overwrite, only append keyword 3 keyword 4
Keywords can not be confused, generally with regular match:
Syntax match category name /Regular Expression/
There is a trouble is not part of the match, such as I want to match the curly braces,/[a-za-z_]+\s{/, vim syntax highlighting does not match the concept of the group, can not only highlight the preceding string, resulting in curly braces also dyed.
In this case, nested recognition is required, typically nested keyword and match in region, and match is nested in match. For example:
Syntax keyword Sptodo contained TODO fixme xxxsyntax cluster spcommentgrp contains=sptodosyntax Region spcomment Start="//" skip="\\$" end= " $ " keepend [email protected]
Specify which syntax units are included in this area by using the CONTAINS keyword.
How to quickly write a vim syntax highlighting file