mirror of
https://github.com/CompeyDev/my-nvim-setup.git
synced 2024-12-13 05:20:38 +00:00
3e83ec5314
eg: require "plugins.neoscroll" instead of require "plugins.neoscroll".config() second commit of refactor handle require errors handle cloning of packer
45 lines
1,005 B
Lua
45 lines
1,005 B
Lua
local packer
|
|
if
|
|
not pcall(
|
|
function()
|
|
packer = require "packer"
|
|
end
|
|
)
|
|
then
|
|
local packer_path = vim.fn.stdpath("data") .. "/site/pack/packer/start/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
|
|
}
|
|
)
|
|
if pcall(
|
|
function()
|
|
packer = require "packer"
|
|
end
|
|
)
|
|
then
|
|
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
|
|
}
|
|
}
|