Right now I have the package Jinja2 installed and it gives proper syntax highlighting, but I have to change the syntax every time I open a new html file.
I would like Jinja2 highlighting to be the default for html in Python projects. The only solution I came up with so far was to change all Jinja files to .jinja
instead of .html
and then I could create a separate Jinja.sublime-settings
, but I'm not quite sure this won't give me problems later and I would prefer not to tweak very much.
Any idea?
Thanks.
From the comment by @Martijn Pieters it seems indeed that I need a dedicated extension. I looked more into this and found out something that may be a good alternative.
The Jinja2 package highlight Jinja2 HTML files with a syntax called HTML (Jinja Templates)
. I can create a configuration file (must be called HTML (Jinja Templates).sublime-settings
) for this extension in the Packages/User
folder and include the following lines there:
{
"extensions":
[
"jinja.html"
]
}
In this case, I just need to rename my html
files to jinja.html
and they will be highlighted as soon as loaded. And I keep the html extension, just in case.
I am borrowing the idea from the Rails world. When using HAML they name their files filename.haml.html
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With