mirror of
https://github.com/CompeyDev/my-nvim-setup.git
synced 2024-12-13 21:40:37 +00:00
bfc10e6034
This commit introduces a hook system that allows the user to add custom modules which can use these hooks to invoke function af specific NvChad events to allow for extending og functionality
22 lines
475 B
Lua
22 lines
475 B
Lua
local function isModuleAvailable(name)
|
|
if package.loaded[name] then
|
|
return true
|
|
else
|
|
for _, searcher in ipairs(package.searchers or package.loaders) do
|
|
local loader = searcher(name)
|
|
if type(loader) == 'function' then
|
|
package.preload[name] = loader
|
|
return true
|
|
end
|
|
end
|
|
return false
|
|
end
|
|
end
|
|
|
|
local loadIfExists = function (module)
|
|
if isModuleAvailable(module) then
|
|
require(module)
|
|
end
|
|
end
|
|
|
|
loadIfExists('custom')
|