mustache / vim-mustache-handlebars

mustache and handlebars mode for vim
mustache.github.io
455 stars 49 forks source link

Non-HTML mustache #96

Open Mange opened 5 years ago

Mange commented 5 years ago

I have some nginx config files using mustache for pre-processing, but this applies to any sort of file.

If I open, for example, a foo.json.mustache, then the filetype is set to html.mustache instead of json.mustache.

I'm trying to fix some of this via my own config, but since the au uses set filetype instead of setfiletype this plugin overrides my own ftdetect declarations.[1]

Can I solve this somehow?

Here's a snippet from my ftdetect/nginx.vim:

au BufRead,BufNewFile */nginx/conf.d/*.conf set ft=nginx
au BufRead,BufNewFile */nginx/conf.d/*.conf.mustache set ft=nginx.mustache syntax=mustache

[1]: At least I think this is the issue; I don't know how to really confirm it. If I source the ftdetect/nginx.vim file and reload the example file, then the detection works. But during normal startup it has no effect, despite showing up in the :au output. This is why I suspect it's an ordering problem.

jsit commented 4 years ago

Try putting your set filetype lines into ~/.vim/after/ftplugin/nginx.vim instead; that should cause them to fire after this plugin.

Mange commented 4 years ago

Thank you. I will try this!