rm hooks
parent
799432e99e
commit
4e54ee0081
@ -0,0 +1,15 @@
|
||||
local M = {}
|
||||
local plugins = {}
|
||||
|
||||
M.add = function(fn)
|
||||
table.insert(plugins, fn)
|
||||
end
|
||||
|
||||
-- load custom plugins in packer startup function
|
||||
M.run = function(args)
|
||||
for _, hook in pairs(plugins) do
|
||||
hook(args)
|
||||
end
|
||||
end
|
||||
|
||||
return M
|
@ -1,26 +0,0 @@
|
||||
local hooks, M = {}, {}
|
||||
|
||||
local allowed_hooks = {
|
||||
["install_plugins"] = true,
|
||||
["setup_mappings"] = true,
|
||||
}
|
||||
|
||||
M.add = function(name, fn)
|
||||
if not allowed_hooks[name] then
|
||||
print("Custom lua uses unallowed hook " .. name)
|
||||
end
|
||||
if not hooks[name] then
|
||||
hooks[name] = {}
|
||||
end
|
||||
table.insert(hooks[name], fn)
|
||||
end
|
||||
|
||||
M.run = function(name, args)
|
||||
if hooks[name] then
|
||||
for _, hook in pairs(hooks[name]) do
|
||||
hook(args)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
return M
|
Loading…
Reference in New Issue