Home » Odeon Blogs » Stefan Talpalaru, CTO »

enforcing a filetype in vim

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:

  1. {% comment %}
  2. vim:filetype=htmldjango
  3. {% 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

  1. don't forget to enable 'modeline' in your vim settings or else this won't work ;)


  2. Thanks! It works for me on Gentoo with the default config, so I forgot to mention it.




Leave a Comment :

(required)


(required)




(required)




(required)





Page generated in: 0.19s