d2-vim
d2-vim copied to clipboard
Error on startup after install (`BufReadPost Autocommands` `d2#syntax_post` `Undefined variable: b:included_syntaxes`)
I just added the plugin in my Nvchad nvim config, and I'm getting this error when I open a .d2 file:
Error detected while processing BufReadPost Autocommands for "*.d2"..FileType Autocommands for "*"..Syntax Autocommands for "d2"..function d2#syntax_post:
line 1:
E121: Undefined variable: b:included_syntaxes
E116: Invalid arguments for function index
Press ENTER or type command to continue
After pressing enter, the syntax highlighting is actually working.
If I close nvim again, then first open a file with a different file type, for example a .md file, I don't get an error. And when I then open the .d2 file in a second buffer, I still don't get an error, but the syntax is not working. When I enter :e! I do get the error again, and then afterwards the syntax highlighting is also working again.
After reading #11 I fixed the issue by adding ft = { "d2" } to my plugin config:
{
"terrastruct/d2-vim",
ft = { "d2" },
}
I think this should be able to configure into the plugin itself?