chore: format files
This commit is contained in:
parent
317eedd9b2
commit
d810cc35a7
@ -4,7 +4,7 @@ local function isModuleAvailable(name)
|
||||
else
|
||||
for _, searcher in ipairs(package.searchers or package.loaders) do
|
||||
local loader = searcher(name)
|
||||
if type(loader) == 'function' then
|
||||
if type(loader) == "function" then
|
||||
package.preload[name] = loader
|
||||
return true
|
||||
end
|
||||
@ -13,10 +13,10 @@ local function isModuleAvailable(name)
|
||||
end
|
||||
end
|
||||
|
||||
local loadIfExists = function (module)
|
||||
local loadIfExists = function(module)
|
||||
if isModuleAvailable(module) then
|
||||
require(module)
|
||||
end
|
||||
end
|
||||
|
||||
loadIfExists('custom')
|
||||
loadIfExists "custom"
|
||||
|
@ -1,11 +1,11 @@
|
||||
local hooks, overrides, M = {}, {}, {};
|
||||
local hooks, overrides, M = {}, {}, {}
|
||||
local allowed_hooks = {
|
||||
"install_plugins",
|
||||
"setup_mappings",
|
||||
"ready",
|
||||
}
|
||||
|
||||
local function has_value (tab, val)
|
||||
local function has_value(tab, val)
|
||||
for _, value in ipairs(tab) do
|
||||
if value == val then
|
||||
return true
|
||||
@ -16,18 +16,18 @@ local function has_value (tab, val)
|
||||
end
|
||||
|
||||
M.add = function(name, fn)
|
||||
if not(has_value(allowed_hooks, name)) then
|
||||
if not (has_value(allowed_hooks, name)) then
|
||||
error("Custom lua uses unallowed hook " .. name)
|
||||
end
|
||||
if hooks[name] == nil then
|
||||
hooks[name] = {}
|
||||
end
|
||||
table.insert(hooks[name], fn);
|
||||
table.insert(hooks[name], fn)
|
||||
end
|
||||
|
||||
M.run = function(name, args)
|
||||
if hooks[name] == nil then
|
||||
return;
|
||||
return
|
||||
end
|
||||
|
||||
for _, hook in pairs(hooks[name]) do
|
||||
@ -36,10 +36,10 @@ M.run = function(name, args)
|
||||
end
|
||||
|
||||
M.createOverrides = function(module)
|
||||
local O = {};
|
||||
local O = {}
|
||||
|
||||
O.get = function(name, default)
|
||||
local current = default;
|
||||
local current = default
|
||||
if overrides[module] and overrides[module][name] then
|
||||
if type(overrides[module][name]) == "function" then
|
||||
current = overrides[module][name]
|
||||
@ -49,21 +49,20 @@ M.createOverrides = function(module)
|
||||
end
|
||||
end
|
||||
end
|
||||
return current;
|
||||
return current
|
||||
end
|
||||
|
||||
return O;
|
||||
return O
|
||||
end
|
||||
|
||||
M.override = function(module, name, overwrite)
|
||||
if overrides[module] == nil then
|
||||
overrides[module] = {};
|
||||
overrides[module] = {}
|
||||
end
|
||||
if overrides[module][name] == nil then
|
||||
overrides[module][name] = {};
|
||||
overrides[module][name] = {}
|
||||
end
|
||||
table.insert(overrides[module][name], overwrite)
|
||||
end
|
||||
|
||||
|
||||
return M;
|
||||
return M
|
||||
|
@ -5,7 +5,7 @@ local core_modules = {
|
||||
"core.mappings",
|
||||
}
|
||||
|
||||
local hooks = require('core.hooks');
|
||||
local hooks = require "core.hooks"
|
||||
|
||||
for _, module in ipairs(core_modules) do
|
||||
local ok, err = pcall(require, module)
|
||||
@ -17,4 +17,4 @@ end
|
||||
-- set all the non plugin mappings
|
||||
require("core.mappings").misc()
|
||||
|
||||
hooks.run("ready")
|
||||
hooks.run "ready"
|
||||
|
Loading…
Reference in New Issue
Block a user