2021-07-19 00:49:27 +00:00
|
|
|
vim.cmd("packadd packer.nvim")
|
|
|
|
|
2021-07-17 11:14:52 +00:00
|
|
|
local present, packer = pcall(require, "packer")
|
|
|
|
|
|
|
|
if not present then
|
2021-07-19 00:49:27 +00:00
|
|
|
local packer_path = vim.fn.stdpath("data") .. "/site/pack/packer/opt/packer.nvim"
|
2021-07-15 15:46:45 +00:00
|
|
|
|
|
|
|
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
|
|
|
|
}
|
|
|
|
)
|
2021-07-17 11:14:52 +00:00
|
|
|
|
2021-07-19 00:49:27 +00:00
|
|
|
vim.cmd("packadd packer.nvim")
|
2021-07-17 11:14:52 +00:00
|
|
|
present, packer = pcall(require, "packer")
|
|
|
|
|
|
|
|
if present then
|
2021-07-15 15:46:45 +00:00
|
|
|
print("Packer cloned successfully.")
|
|
|
|
else
|
|
|
|
error("Couldn't clone packer !\nPacker path: " .. packer_path)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
return packer.init {
|
|
|
|
display = {
|
|
|
|
open_fn = function()
|
|
|
|
return require("packer.util").float {border = "single"}
|
|
|
|
end
|
|
|
|
},
|
|
|
|
git = {
|
|
|
|
clone_timeout = 600 -- Timeout, in seconds, for git clones
|
|
|
|
}
|
|
|
|
}
|