2022-05-23 03:24:03 -04:00
|
|
|
local M = {}
|
|
|
|
|
|
|
|
M.bootstrap = function()
|
|
|
|
local fn = vim.fn
|
2022-05-29 09:56:12 -04:00
|
|
|
local install_path = fn.stdpath "data" .. "/site/pack/packer/start/packer.nvim"
|
2022-05-23 03:24:03 -04:00
|
|
|
|
|
|
|
vim.api.nvim_set_hl(0, "NormalFloat", { bg = "#1e222a" })
|
|
|
|
|
2022-05-29 09:56:12 -04:00
|
|
|
if fn.empty(fn.glob(install_path)) > 0 then
|
2022-05-23 03:24:03 -04:00
|
|
|
print "Cloning packer .."
|
|
|
|
fn.system { "git", "clone", "--depth", "1", "https://github.com/wbthomason/packer.nvim", install_path }
|
|
|
|
|
|
|
|
-- install plugins + compile their configs
|
|
|
|
vim.cmd "packadd packer.nvim"
|
|
|
|
require "plugins"
|
|
|
|
vim.cmd "PackerSync"
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
M.options = {
|
|
|
|
auto_clean = true,
|
|
|
|
compile_on_sync = true,
|
|
|
|
git = { clone_timeout = 6000 },
|
|
|
|
display = {
|
2022-06-18 00:27:17 -04:00
|
|
|
working_sym = "ﲊ",
|
2022-05-29 00:46:31 -04:00
|
|
|
error_sym = "✗ ",
|
|
|
|
done_sym = " ",
|
|
|
|
removed_sym = " ",
|
2022-05-23 03:24:03 -04:00
|
|
|
moved_sym = "",
|
|
|
|
open_fn = function()
|
|
|
|
return require("packer.util").float { border = "single" }
|
|
|
|
end,
|
|
|
|
},
|
|
|
|
}
|
|
|
|
|
|
|
|
-- merge overrides if there are any
|
2022-05-29 06:37:47 -04:00
|
|
|
M.options = require("core.utils").load_override(M.options, "wbthomason/packer.nvim")
|
2022-05-23 03:24:03 -04:00
|
|
|
|
|
|
|
M.run = function(plugins)
|
|
|
|
local present, packer = pcall(require, "packer")
|
|
|
|
|
|
|
|
if not present then
|
|
|
|
return
|
|
|
|
end
|
|
|
|
|
|
|
|
-- Override with chadrc values
|
2022-05-29 06:37:47 -04:00
|
|
|
plugins = require("core.utils").remove_default_plugins(plugins)
|
|
|
|
plugins = require("core.utils").merge_plugins(plugins)
|
2022-05-23 03:24:03 -04:00
|
|
|
|
|
|
|
packer.init(M.options)
|
|
|
|
|
|
|
|
packer.startup(function(use)
|
|
|
|
for _, v in pairs(plugins) do
|
|
|
|
use(v)
|
|
|
|
end
|
|
|
|
end)
|
|
|
|
end
|
|
|
|
|
|
|
|
return M
|