I have a Jinja2 template which I'd like Vim to syntax-highlight as a Jinja2 template, but the file - once rendered - will be an Nginx configuration file.
Is there some way of getting Vim to use modelines "conditionally"?
The problem is that I cannot tinker with one modeline alone, because even though I could use a template variable, that would invalidate the modeline as far as Vim is concerned.
So essentially when I open the file as Jinja2 template I want the modeline to be treated as:
# vim: set autoindent smartindent ts=4 sw=4 sts=4 noet filetype=jinja2:
and once rendered as:
# vim: set autoindent smartindent ts=4 sw=4 sts=4 noet filetype=nginx:
Is Vim capable of doing something like that?