feat(loader): `LazyLoad` event with plugin name as `data` field. Useful to do stuff when a plugin loads

This commit is contained in:
Folke Lemaitre 2023-07-12 17:21:32 +02:00
parent da8b00581a
commit ea5b2e00bf
No known key found for this signature in database
GPG Key ID: 41F8B1FBACAE2040
2 changed files with 2 additions and 0 deletions

View File

@ -582,6 +582,7 @@ The following user events will be triggered:
- **LazyClean**: after a clean
- **LazyCheck**: after checking for updates
- **LazyLog**: after running log
- **LazyLoad**: after loading a plugin. The `data` attribute will contain the plugin name.
- **LazySyncPre**: before running sync
- **LazyInstallPre**: before an install
- **LazyUpdatePre**: before an update

View File

@ -333,6 +333,7 @@ function M._load(plugin, reason, opts)
plugin._.loaded.time = Util.track().time
table.remove(M.loading)
vim.schedule(function()
vim.api.nvim_exec_autocmds("User", { pattern = "LazyLoad", modeline = false, data = plugin.name })
vim.api.nvim_exec_autocmds("User", { pattern = "LazyRender", modeline = false })
end)
end