@@ -28,11 +28,11 @@ function M:_add(value)
28
28
return
29
29
end
30
30
Util .track ({ [self .type ] = value })
31
- local groups = M .get_augroups (event , pattern )
31
+ local groups = M .get_augroups (event )
32
32
-- load the plugins
33
33
Loader .load (self .active [value ], { [self .type ] = value })
34
34
-- check if any plugin created an event handler for this event and fire the group
35
- self :trigger (event , pattern , groups )
35
+ self :trigger (event , groups )
36
36
Util .track ()
37
37
end ,
38
38
})
45
45
46
46
-- Get all augroups for the events
47
47
--- @param event string
48
- --- @param pattern ? string
49
- function M .get_augroups (event , pattern )
48
+ function M .get_augroups (event )
50
49
local events = M .trigger_events [event ] or { event }
51
50
--- @type table<string,true>
52
51
local groups = {}
53
- for _ , autocmd in ipairs (vim .api .nvim_get_autocmds ({ event = events , pattern = pattern })) do
52
+ for _ , autocmd in ipairs (vim .api .nvim_get_autocmds ({ event = events })) do
54
53
if autocmd .group then
55
54
groups [autocmd .group ] = true
56
55
end
61
60
--- @param event string | string[]
62
61
--- @param pattern ? string
63
62
--- @param groups table<string,true>
64
- function M :trigger (event , pattern , groups )
63
+ function M :trigger (event , groups )
65
64
local events = M .trigger_events [event ] or { event }
66
65
--- @cast events string[]
67
66
for _ , e in ipairs (events ) do
68
- for _ , autocmd in ipairs (vim .api .nvim_get_autocmds ({ event = e , pattern = pattern })) do
67
+ for _ , autocmd in ipairs (vim .api .nvim_get_autocmds ({ event = e })) do
69
68
if autocmd .event == e and autocmd .group and not groups [autocmd .group ] then
70
69
if Config .options .debug then
71
70
Util .info ({
72
71
" # Firing Events" ,
73
72
" - **group:** `" .. autocmd .group_name .. " `" ,
74
73
" - **event:** " .. autocmd .event ,
75
- pattern and (" - **pattern:** " .. pattern ),
76
74
})
77
75
end
78
76
Util .track ({ event = autocmd .group_name })
0 commit comments