Skip to content

Commit

Permalink
feat(loader): LazyLoad event with plugin name as data field. Usef…
Browse files Browse the repository at this point in the history
…ul to do stuff when a plugin loads
  • Loading branch information
folke committed Jul 12, 2023
1 parent da8b005 commit ea5b2e0
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 0 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions lua/lazy/core/loader.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit ea5b2e0

Please sign in to comment.