fix(loader): fixed event check in reload. Fixes #1124

This commit is contained in:
Folke Lemaitre 2023-10-17 08:36:09 +02:00
parent f73986546c
commit cdfa788881
No known key found for this signature in database
GPG Key ID: 41F8B1FBACAE2040
2 changed files with 5 additions and 3 deletions

View File

@ -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

View File

@ -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<string,LazyEvent>
---@field ft? table<string,LazyEvent>
---@field keys? table<string,LazyKeys>