Wrap auto load in vim.schedule

I'm experiencing a bug whereby if I enable autoloading, I don't get any syntax highlighting on startup (until I trigger it with `:e` for example). I had the same issue with `persistence.nvim` (I made an auto command to get the same functionality). For both plugins, wrapping the call to `load` in `vim.schedule` solved the problem.

I don't really know enough about the inner workings of Neovim to explain this though.
main
Simon McLean 2022-06-06 17:38:23 +01:00 committed by GitHub
parent 040cf43524
commit 473c90bbb6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 1 deletions

View File

@ -87,7 +87,7 @@ function M.setup(opts)
config.setup(opts)
setup_commands()
if config.options.autoload and (allow_dir() and not ignore_dir()) and vim.fn.argc() == 0 then
M.load()
vim.schedule(M.load)
end
if
config.options.autosave