mirror of https://github.com/folke/lazy.nvim.git
fix(plugin): pass plugin as arg to config/init/build
This commit is contained in:
parent
de383740a2
commit
b6ebed5888
|
@ -63,7 +63,9 @@ function M.startup()
|
|||
for _, plugin in pairs(Config.plugins) do
|
||||
if plugin.init then
|
||||
Util.track({ plugin = plugin.name, init = "init" })
|
||||
Util.try(plugin.init, "Failed to run `init` for **" .. plugin.name .. "**")
|
||||
Util.try(function()
|
||||
plugin.init(plugin)
|
||||
end, "Failed to run `init` for **" .. plugin.name .. "**")
|
||||
Util.track()
|
||||
end
|
||||
end
|
||||
|
@ -176,7 +178,9 @@ end
|
|||
function M.config(plugin)
|
||||
local fn
|
||||
if type(plugin.config) == "function" then
|
||||
fn = plugin.config
|
||||
fn = function()
|
||||
plugin.config(plugin)
|
||||
end
|
||||
else
|
||||
local normname = Util.normname(plugin.name)
|
||||
---@type table<string, string>
|
||||
|
|
|
@ -20,7 +20,7 @@ M.build = {
|
|||
local cmd = vim.api.nvim_parse_cmd(build:sub(2), {})
|
||||
self.output = vim.api.nvim_cmd(cmd, { output = true })
|
||||
elseif type(build) == "function" then
|
||||
build()
|
||||
build(self.plugin)
|
||||
else
|
||||
local shell = vim.env.SHELL or vim.o.shell
|
||||
local shell_args = shell:find("cmd.exe", 1, true) and "/c" or "-c"
|
||||
|
|
Loading…
Reference in New Issue