Search code examples
vimjinja2

Jinja Vim plugin not working


I want to have my .html.twig files highlighted as Jinja files. (There doesn't seem to be a good Twig plugin for Vim out there, so I'm using Jinja instead.) I downloaded jinja.vim from here and put the at ~/.vim/ftplugin/jinja.vim. I also added these lines to my ~/.vimrc:

filetype plugin on
au BufRead,BufNewFile *.twig set filetype=jinja
au BufRead,BufNewFile *.html.twig set filetype=jinja

However, when I open a .html.twig file, there's no syntax highlighting whatsoever. I haven't installed a Vim plugin before, so I'm guessing I missed some step. What am I doing wrong?


Solution

  • Put the jinja.vim file in ~/.vim/syntax instead of ~/.vim/ftplugin. If there's still no syntax highlighting try typing :syntax on. If that works you need to add a line that says syntax on to your ~/.vimrc.