Home
Head's Up: I'm in the middle of upgrading my site. Most things are in place, but there are something missing and/or broken including image alt text. Please bear with me while I'm getting things fixed.

Add Jinja Syntax Highlighting To Neovim

I'm using the Minijinja mj Rust crate to make the templates for Neopolitan neo . It's a solid format but it's a bit hard to look at. Especially without syntax highlighting which doesn't appear to be available by default in Neovim g:nvim .

I tried a plugin plug to add the highlights but caused a bunch of errors every time I started up.

This is the process I ended up going with :

- Create the directory :

[TODO: Code shorthand span ]

- Download the [TODO: Code shorthand span ] and [TODO: Code shorthand span ] files from this page and put them in the [TODO: Code shorthand span ] directory

- Make a new file at :

[TODO: Code shorthand span ]

and put this in it :

vimscript
au Syntax jinja   runtime! syntax/htmljinja.vim
au BufNewFile,BufRead *.jinja,*.j2  setf jinja

That got syntax highlighting working for me. It doesn't do automatic indention. That would be nice but if I had to choose one or the other I'd choose syntax highlighting over the indention.

I've forked the other repo so can take a look at it as well.

- The plugin with the errors is two years old so I'm not surprised it has problems

- The syntax files are closer to 20yrs old, but thankfully they still work just fine

Footnotes And References