I'm trying to create a patch for cf.vim to resolve an issue with hashes.  In ColdFusion, # signs are used to enclose an expression inside a cfoutput block.
<cfset x = 1 />
<cfoutput> x is now #x# </cfoutput>
<!--- outputs "x is now 1" --->
The problem comes into play when there is a lone #, not inside a cfoutput block:
<a href="#x">an anchored link</a>
This will cause vim to highlight everything after the # as if it were in a cfHashRegion.
syn region cfHashRegion start=+#+ skip=+"[^"]*"\|'[^']*'+ end=+#+ contained containedin=cfOutputRegion contains=@cfExpressionCluster,cfScriptParenError
syn region cfOutputRegion matchgroup=NONE transparent start=+<cfoutput>+ end=+</cfoutput>+ contains=TOP
Is there something I can add to cfHashRegion to tell vim "Don't enter a cfHashRegion unless the start and end properties are both found?
Super-bonus: cfoutput is only the most common way to be in a "cfOutputRegion".  Any cffunction with output="true" will behave as if everything inside its block were wrapped in cfoutput tags.
Have you tried using syn match instead of syn region? I don't know the ColdFusion syntax, so I won't know if this is possible/correct.
Something like:
syn region cfHashRegion "L\=#[^#]+#" containedin=cfOutputRegion  contains=@cfExpressionCluster,cfScriptParenError
You may also want to look into the use of the contains=ALLBUT,{group-name},.. argument list for some cases.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With