I have a custom syntax plugin for a file format that can contain embedded HLSL or GLSL code. At the moment, I've manually included a bunch of syntax keyword
and syntax match
commands in my syntax file to cover the basics of HLSL or GLSL source. I'd prefer to simply reference an existing HLSL syntax plugin via syntax include
, but there is no built-in HLSL or GLSL syntax support in vim, so I cannot expect that a syntax include
will succeed.
I'd like to attempt to execute syntax include
, and if it fails (or would fail), fall back to my half-hearted custom version. How can I accomplish this?
I've looked at try
/endtry
, but they didn't seem to allow me to avoid an error if the desired syntax file wasn't present, and in any case only work on vim 7.0 or greater, and if possible I'd like to use a version-agnostic solution.