mirror of https://github.com/folke/lazy.nvim.git
fix(event): prevent loading event handler more than once in some cases
This commit is contained in:
parent
25f6009087
commit
6b37927be9
|
@ -15,14 +15,16 @@ function M:_add(value)
|
||||||
---@type string?, string?
|
---@type string?, string?
|
||||||
local event, pattern = event_spec:match("^(%w+)%s+(.*)$")
|
local event, pattern = event_spec:match("^(%w+)%s+(.*)$")
|
||||||
event = event or event_spec
|
event = event or event_spec
|
||||||
|
local done = false
|
||||||
vim.api.nvim_create_autocmd(event, {
|
vim.api.nvim_create_autocmd(event, {
|
||||||
group = self.group,
|
group = self.group,
|
||||||
once = true,
|
once = true,
|
||||||
pattern = pattern,
|
pattern = pattern,
|
||||||
callback = function(ev)
|
callback = function(ev)
|
||||||
if not self.active[value] then
|
if done or not self.active[value] then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
done = true
|
||||||
Util.track({ [self.type] = value })
|
Util.track({ [self.type] = value })
|
||||||
local groups = M.get_augroups(ev.event, pattern)
|
local groups = M.get_augroups(ev.event, pattern)
|
||||||
-- load the plugins
|
-- load the plugins
|
||||||
|
|
Loading…
Reference in New Issue