-
-
Notifications
You must be signed in to change notification settings - Fork 7
Open
Description
Hello,
first of all, thank you for the plugin. It really helps me! :)
I had to make some changes to make it work for me.
I don't have any experience on customizing something like that, so I don't know if this is good code.
The Problem is, as you wrote, that you need syntax=on, but the following didn't worked for me:
if !get(b:, 'jinja_syntax_autocmd_loaded', v:false)
if luaeval("vim.treesitter.language.get_lang('jinja')") == v:null
autocmd FileType <buffer> if !empty(&ft) | setlocal syntax=on | endif
endif
let b:jinja_syntax_autocmd_loaded = v:true
endifI handled it the following way in neovim:
- First of all, I set all "html" to "html.jinja", because I only write jinja code or html but never django:
vim.filetype.add {
extension = {
html = "html.jinja"
}
}
- Secondly I wrote an autocommand to set syntax=on when I open the buffer and it has the filetype "html".
vim.api.nvim_create_autocmd("BufEnter", {
desc = "set syntax=on on attached buffer",
group = vim.api.nvim_create_augroup("JinjaSyntaxOn", {clear=true}),
pattern = "*.html",
callback = function ()
vim.opt.syntax = "on"
end,
})You could enhance that, if you check for ft=html.jinja and only set it if this is true, but this is simple and works for me.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels