I use Django a lot and I just want to open all .html files with the htmldjango syntax rather than html syntax. Is there a way for me to tell vim to open all html files with a htmldjango syntax?

Because at the moment, everytime I open an html file, I have to always click on


and set it to

HTML -> Django HTML Template

1 Answer 1


To tell VIM to use this style evertytime it loads and HTML file put this into your VIMRC:

au BufNewFile,BufRead *.html set filetype=htmldjango

You can quickly edit your VIMRC file by executing :edit $MYVIMRC.

  • That menu is the default list of all installed Vim syntax files, and syntax/htmldjango.vim also ships with Vim (version 7.3+) Commented Jan 11, 2014 at 22:31
  • @IngoKarkat AH! I didn't find it because i was looking for a file starting with django! Whoops. Glad my answer was still helpful.
    – verdammelt
    Commented Jan 11, 2014 at 22:32

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .