chore: format files

This commit is contained in:
Akianonymus 2021-10-02 10:45:50 +05:30 committed by siduck76
parent 317eedd9b2
commit d810cc35a7
4 changed files with 64 additions and 65 deletions

View File

@ -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
@ -19,4 +19,4 @@ local loadIfExists = function (module)
end
end
loadIfExists('custom')
loadIfExists "custom"

View File

@ -1,4 +1,4 @@
local hooks, overrides, M = {}, {}, {};
local hooks, overrides, M = {}, {}, {}
local allowed_hooks = {
"install_plugins",
"setup_mappings",
@ -22,12 +22,12 @@ M.add = function(name, fn)
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

View File

@ -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"