avoid un-needed lazy loading of packer | improve packer bootstrapping

This commit is contained in:
siduck 2022-05-23 12:54:03 +05:30
parent bdf45a447a
commit a2ff5c285e
10 changed files with 116 additions and 214 deletions

View file

@ -1,21 +1,12 @@
local present, packer = pcall(require, "plugins.packerInit")
if not present then
return false
end
local plugins = {
["nvim-lua/plenary.nvim"] = {},
["lewis6991/impatient.nvim"] = {},
["wbthomason/packer.nvim"] = {
event = "VimEnter",
},
["wbthomason/packer.nvim"] = {},
["NvChad/extensions"] = {},
["NvChad/base46"] = {
after = "packer.nvim",
after = "plenary.nvim",
config = function()
local ok, base46 = pcall(require, "base46")
@ -219,13 +210,4 @@ local plugins = {
},
}
plugins = nvchad.remove_default_plugins(plugins)
-- merge user plugin table & default plugin table
plugins = nvchad.plugin_list(plugins)
return packer.startup(function(use)
for _, v in pairs(plugins) do
use(v)
end
end)
require("core.packer").run(plugins)

View file

@ -1,48 +0,0 @@
vim.cmd "packadd packer.nvim"
local present, packer = pcall(require, "packer")
if not present then
local packer_path = vim.fn.stdpath "data" .. "/site/pack/packer/opt/packer.nvim"
print "Cloning packer.."
-- remove the dir before cloning
vim.fn.delete(packer_path, "rf")
vim.fn.system {
"git",
"clone",
"https://github.com/wbthomason/packer.nvim",
"--depth",
"20",
packer_path,
}
vim.cmd "packadd packer.nvim"
present, packer = pcall(require, "packer")
if present then
print "Packer cloned successfully."
else
error("Couldn't clone packer !\nPacker path: " .. packer_path .. "\n" .. packer)
end
end
local options = {
display = {
open_fn = function()
return require("packer.util").float { border = "single" }
end,
},
git = {
clone_timeout = 6000, -- seconds
},
auto_clean = true,
compile_on_sync = true,
snapshot = nil,
}
options = nvchad.load_override(options, "wbthomason/packer.nvim")
packer.init(options)
return packer