I am new to vim and esp. in lua scripting. I want to create an autocmd such that all the jinja files will get yaml syntax highlighting.
local a = vim.api
a.nvim_create_autocmd( { "BufNewFile", "BufRead" }, {
pattern = { "*.j2" },
command = [[ lua(syntax = "html")]],
})
but this is not working. Could someone point the obvious.
DD.
I give you an Example on how i do Lua Syntaxhighlightning for my own
*.luadofiles.Before i have copied ( as super Q User: root.root )
/usr/share/nvim/runtime/syntax/lua.vimto/usr/share/nvim/runtime/syntax/luado.vim.So i can change it independently from original
lua.vim.It is not necessary to change
luado.vimfor the Example below.~/.config/nvim/lua/init.luarequired by~/.config/nvim/init.vim( At First and off course before:
syntax on)Triggers at "BufEnter" and shows that "BufNewFile", "BufRead" not really needed.
( Every time before it is shown from Buffer ;-) )
Impression

Now lets change to next Buffer with

:bnto test3.luadoAnd back with

:bpto test2.luado (Output ofset)(test2.luado will be shown after ENTER/RETURN)