mirror of
https://github.com/CompeyDev/my-nvim-setup.git
synced 2024-12-13 21:40:37 +00:00
2293b16709
* fix some lint warnings * remove some unneeded code
27 lines
499 B
Lua
27 lines
499 B
Lua
local hooks, M = {}, {}
|
|
|
|
local allowed_hooks = {
|
|
["install_plugins"] = true,
|
|
["setup_mappings"] = true,
|
|
["ready"] = 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
|