enforcing a filetype in vim
Sometimes vim can't guess the filetype of Django templates but we can force it by appending this comment to the end of the file:
- {% comment %}
- vim:filetype=htmldjango
- {% endcomment %}
It applies of course to any type of file and any comment syntax. Just make sure that vim finds it on the last lines.



Discussion
don't forget to enable 'modeline' in your vim settings or else this won't work ;)
Thanks! It works for me on Gentoo with the default config, so I forgot to mention it.
Leave a Comment :