Is there a *nix tool (or vim plug-in) that would allow me to automatically format django html template files?
Hitting the space bar hundreds of time does not sound like a good use of my time but then neither does leaving some weird formatting that is hard to read.
Advertisement
Answer
- Install vim-jinja2-syntax plugin by putting
Glench/Vim-Jinja2-Syntax
when installing it with plugin manager (vim-plug, Vundle etc.) - Put
autocmd FileType html setlocal expandtab shiftwidth=2 tabstop=2
in the vim config file, which is usually at~/.vimrc
. - run
gg=G
in django html file(aka jinja template)