diff --git a/lua/lz/n/loader.lua b/lua/lz/n/loader.lua index 712864b..2593f71 100644 --- a/lua/lz/n/loader.lua +++ b/lua/lz/n/loader.lua @@ -69,15 +69,16 @@ end ---@param plugin lz.n.Plugin local function config(plugin) - if type(plugin.config) == "function" then + if type(plugin.after) == "function" then xpcall( - plugin.config, + plugin.after, vim.schedule_wrap(function(err) vim.notify( "Failed to run 'config' for " .. plugin.name .. ": " .. tostring(err or ""), vim.log.levels.ERROR ) - end) + end), + plugin ) end end diff --git a/lua/lz/n/meta.lua b/lua/lz/n/meta.lua index b1b5aae..22ced50 100644 --- a/lua/lz/n/meta.lua +++ b/lua/lz/n/meta.lua @@ -20,11 +20,8 @@ error("Cannot import a meta module") --- @class lz.n.PluginHooks --- @field beforeAll? fun(self:lz.n.Plugin) Will be run before loading any plugins ---- @field after? fun(self:lz.n.Plugin, opts:table)|true Will be executed when loading the plugin ---- @field opts? table ---- @field config? fun() Will be executed when loading the plugin +--- @field after? fun(self:lz.n.Plugin) Will be executed after loading this plugin ---- @package --- @class lz.n.PluginHandlers --- @field event? lz.n.Event[] --- @field keys? lz.n.Keys[] @@ -64,7 +61,6 @@ error("Cannot import a meta module") --- @field id string --- @field name string ---- @package --- @class lz.n.Plugin: lz.n.PluginBase,lz.n.PluginHandlers,lz.n.PluginHooks --- @class lz.n.PluginSpec: lz.n.PluginBase,lz.n.PluginSpecHandlers,lz.n.PluginHooks