문제

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