move plugin override function to utils | increase packer clone timeout

navigator
siduck 3 years ago
parent b4c50fa443
commit a256591e90

@ -356,4 +356,27 @@ M.fg_bg = function(group, fgcol, bgcol)
cmd("hi " .. group .. " guifg=" .. fgcol .. " guibg=" .. bgcol)
end
-- Override default config of a plugin based on the path provided in the chadrc
-- FUNCTION: override_req, use `chadrc` plugin config override if present
-- name = name inside `default_config` / `chadrc`
-- default_req = run this if 'name' does not exist in `default_config` / `chadrc`
-- if override or default_req start with `(`, then strip that and assume override calls a function, not a whole file
M.override_req = function(name, default_req)
local override = require("core.utils").load_config().plugins.default_plugin_config_replace[name]
local result = default_req
if override ~= nil then
result = override
end
if string.match(result, "^%(") then
result = result:sub(2)
result = result:gsub("%)%.", "').", 1)
return "require('" .. result
else
return "require('" .. result .. "')"
end
end
return M

@ -8,38 +8,13 @@ local use = packer.use
return packer.startup(function()
local plugin_settings = require("core.utils").load_config().plugins
-- FUNCTION: override_req, use `chadrc` plugin config override if present
-- name = name inside `default_config` / `chadrc`
-- default_req = run this if 'name' does not exist in `default_config` / `chadrc`
-- if override or default_req start with `(`, then strip that and assume override calls a function, not a whole file
local override_req = function(name, default_req)
local override = require("core.utils").load_config().plugins.default_plugin_config_replace[name]
local result = default_req
if override ~= nil then
result = override
end
if string.match(result, "^%(") then
result = result:sub(2)
result = result:gsub("%)%.", "').", 1)
return "require('" .. result
else
return "require('" .. result .. "')"
end
end
local override_req = require("core.utils").override_req
-- this is arranged on the basis of when a plugin starts
-- this is the nvchad core repo containing utilities for some features like theme swticher, no need to lazy load
use {
"Nvchad/extensions",
}
use {
"nvim-lua/plenary.nvim",
}
use "Nvchad/extensions"
use "nvim-lua/plenary.nvim"
use {
"wbthomason/packer.nvim",
@ -259,6 +234,6 @@ return packer.startup(function()
require("core.mappings").telescope()
end,
}
-- load user defined plugins
require("core.hooks").run("install_plugins", use)
end)

@ -1,6 +1,4 @@
local cmd = vim.cmd
cmd "packadd packer.nvim"
vim.cmd "packadd packer.nvim"
local present, packer = pcall(require, "packer")
@ -19,7 +17,7 @@ if not present then
packer_path,
}
cmd "packadd packer.nvim"
vim.cmd "packadd packer.nvim"
present, packer = pcall(require, "packer")
if present then
@ -37,11 +35,10 @@ packer.init {
prompt_border = "single",
},
git = {
clone_timeout = 600, -- Timeout, in seconds, for git clones
clone_timeout = 6000, -- seconds
},
auto_clean = true,
compile_on_sync = true,
-- auto_reload_compiled = true
}
return packer

Loading…
Cancel
Save