diff --git a/lua/lazy/core/loader.lua b/lua/lazy/core/loader.lua index bc41864..edf9ba7 100644 --- a/lua/lazy/core/loader.lua +++ b/lua/lazy/core/loader.lua @@ -259,8 +259,10 @@ function M.reload(plugin) load = true end - for _, event in ipairs(plugin.event or {}) do - if event == "VimEnter" or event == "UIEnter" or event:find("VeryLazy") then + local events = plugin._.handlers and plugin._.handlers.event and plugin._.handlers.event or {} + + for _, event in pairs(events) do + if event.id:find("VimEnter") or event.id:find("UIEnter") or event.id:find("VeryLazy") then load = true break end diff --git a/lua/lazy/types.lua b/lua/lazy/types.lua index 0525ca0..a3dd9b9 100644 --- a/lua/lazy/types.lua +++ b/lua/lazy/types.lua @@ -32,7 +32,7 @@ ---@field build? string|fun(self:LazyPlugin)|(string|fun(self:LazyPlugin))[] ---@field opts? PluginOpts ----@class LazyPluginHandlers: {[string]: any} +---@class LazyPluginHandlers ---@field event? table ---@field ft? table ---@field keys? table