I'm having a lot of trouble with syntax offsets, and I'm not understanding the explanation given in the Vim help docs.
I have the following in my PHP ftplugin:
syntax region mySQLRegion
\ contains=@SQLSyntax
\ containedin=phpRegion
\ contained
\ matchgroup=sqlDelim
\ start=+\vSQL\("$+
\ end=+^\s*"[,)]+
\ keepend
I want to match code constructs like the following:
... SQL("
...my sql here...
", ...
Currently this works. But I want the highlighting to take place strictly between the two delimiting lines -- in other words, I want the leading SQL(" and the closing ", to be highlighted with standard PHP highlighting.
I've tried several different permutations of the offsets, but either the rest of the file gets colored with SQL highlighting or the SQL block gets colored as a PHP string. I'm looking for both an answer to this question in particular and for a more general explanation of how to think about when to use ms/me vs. rs/re vs. hs/he, when it would make sense to use either =s+/-{nr} or =e+/-{nr} in those contexts. I get that it's supposed to be match, region, and highlighting and that it's start and end of match offset by a number of characters in either direction, but I'm clearly not understanding it properly because none of my attempts were successful.