Skip to content

Commit

Permalink
fix(event): prevent loading event handler more than once in some cases
Browse files Browse the repository at this point in the history
  • Loading branch information
folke committed Oct 6, 2023
1 parent 25f6009 commit 6b37927
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lua/lazy/core/handler/event.lua
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,16 @@ function M:_add(value)
---@type string?, string?
local event, pattern = event_spec:match("^(%w+)%s+(.*)$")
event = event or event_spec
local done = false
vim.api.nvim_create_autocmd(event, {
group = self.group,
once = true,
pattern = pattern,
callback = function(ev)
if not self.active[value] then
if done or not self.active[value] then
return
end
done = true
Util.track({ [self.type] = value })
local groups = M.get_augroups(ev.event, pattern)
-- load the plugins
Expand Down

0 comments on commit 6b37927

Please sign in to comment.