I have been using nvim for a couple months now and 90% of the time everything works smoothly.
Sometimes when I open nvim on my laptop (the same config works fine on my PC) I get the following error:
Error detected while processing BufReadPost Autocommands for "*":
Error executing lua callback: /home/fergus/nvim-linux64/share/nvim/runtime/filetype.lua:24: Error executing lua: /home/fergus/nvim-linux64/share/nvim/runtime/filetype
.lua:25: BufReadPost Autocommands for "*"..FileType Autocommands for "*": Vim(append):Error executing lua callback: ...cal/share/nvim/lazy/LuaSnip/lua/luasnip/loaders
/init.lua:139: attempt to index field 'loaded_fts' (a nil value)
stack traceback:
...cal/share/nvim/lazy/LuaSnip/lua/luasnip/loaders/init.lua:139: in function 'load_lazy_loaded'
...fergus/.local/share/nvim/lazy/LuaSnip/plugin/luasnip.lua:87: in function <...fergus/.local/share/nvim/lazy/LuaSnip/plugin/luasnip.lua:86>
[C]: in function 'nvim_cmd'
/home/fergus/nvim-linux64/share/nvim/runtime/filetype.lua:25: in function </home/fergus/nvim-linux64/share/nvim/runtime/filetype.lua:24>
[C]: in function 'nvim_buf_call'
/home/fergus/nvim-linux64/share/nvim/runtime/filetype.lua:24: in function </home/fergus/nvim-linux64/share/nvim/runtime/filetype.lua:10>
stack traceback:
[C]: in function 'nvim_cmd'
/home/fergus/nvim-linux64/share/nvim/runtime/filetype.lua:25: in function </home/fergus/nvim-linux64/share/nvim/runtime/filetype.lua:24>
[C]: in function 'nvim_buf_call'
/home/fergus/nvim-linux64/share/nvim/runtime/filetype.lua:24: in function </home/fergus/nvim-linux64/share/nvim/runtime/filetype.lua:10>
stack traceback:
[C]: in function 'nvim_buf_call'
/home/fergus/nvim-linux64/share/nvim/runtime/filetype.lua:24: in function </home/fergus/nvim-linux64/share/nvim/runtime/filetype.lua:10>
Error detected while processing BufWinEnter Autocommands for "*":
Error executing lua callback: ...cal/share/nvim/lazy/LuaSnip/lua/luasnip/loaders/init.lua:139: attempt to index field 'loaded_fts' (a nil value)
stack traceback:
...cal/share/nvim/lazy/LuaSnip/lua/luasnip/loaders/init.lua:139: in function 'load_lazy_loaded'
...fergus/.local/share/nvim/lazy/LuaSnip/plugin/luasnip.lua:87: in function <...fergus/.local/share/nvim/lazy/LuaSnip/plugin/luasnip.lua:86>
I have tried removing all autocommands in my nvim config but I end up getting a different error instead, I'm not sure what is causing the issue.
Edit:
Sometimes I also get:
Error detected while processing BufWinEnter Autocommands for "*"
When starting nvim
I had similar issue with lazy.nvim
plugin manager.
lazy.nvim
may mess runtime path.
In my case workaround was
require("lazy").setup({
spec = {
<...your plugins...>
},
<...your configs...> ,
performance = { rtp = { reset = false } }, -- turn off runtime path reset
})
And it solves these nasty errors.