I am trying to write a VIM highlight file for Gaussian 09 inputs. One example of control line is shown below:# P TPSSTPSS 6-31G* DENSITYFIT  OPT(VERYTIGHT) INT(ULTRAFINE)  FREQ(NORAMAN)TITLE LINE, NOT CONTROL LINE, SO OPT HERE SHOULD NOT HIGHLIGHTThe point is, if a # mark is found at the beginning of the line, then the following lines are concatenated until an empty line is found, and the words are considered as keywords, e.g. OPT is a keyword in the second row, however it is no longer a keyword in the fifth row.How do I let the syntax command in VIM know it needs to join them, and restrict the keywords inside it?
How to do restrict keyword inside special lines?
syntax highlighting;multiple lines
You can do this with a syntax region. Basically you have to define that your keywords will be contained in a region and then define the region that they will be contained in. Like so:syn keyword ConcatKeywords OPT INT FREQ containedsyn region Concat start='^#' end='^$' contains=ConcatKeywordsThe important part here is the contained option after the first line and the contains= option after the second line. This will make vim look for these keywords only in the regions that have it contained.You will, of course, then need to highlight your keywords. You can define your own or link it to an already exsisting highlight:hi link ConcatKeywords PreProcFor more info I would recommend this great tutorial on the vim wiki, as well as these help documents: :h syn-keyword, :h syn-match, and :h syn-region