Is there a way to load a syntax file depending of the contents of a variable? Something like this:

syntax include @CSYN "syntax/" + b:language + ".vim"
syntax region cSnip start="<" end=">" keepend contains=@CSYN
有帮助吗?

解决方案

Use :execute, and the string concatenation in Vimscript is with . not + (for more complex stuff, prefer printf()):

:execute 'syntax include @CSYN syntax/' . b:language . '.vim'
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top