Вопрос

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