From 473c90bbb681670741ea67c2b0149ff76a547da8 Mon Sep 17 00:00:00 2001 From: Simon McLean Date: Mon, 6 Jun 2022 17:38:23 +0100 Subject: [PATCH] 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. --- lua/persisted/init.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/persisted/init.lua b/lua/persisted/init.lua index e729535..4e9b9ff 100644 --- a/lua/persisted/init.lua +++ b/lua/persisted/init.lua @@ -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