2021-02-23 11:27:32 +00:00
|
|
|
-- Adopted from https://github.com/tjdevries/config_manager/blob/master/xdg_config/nvim/lua/tj/first_load.lua
|
2022-04-28 15:21:55 +00:00
|
|
|
local download_packer = function()
|
|
|
|
if vim.fn.input("Download Packer? (y for yes)") ~= "y" then
|
|
|
|
return
|
2022-04-28 13:53:54 +00:00
|
|
|
end
|
2021-02-23 11:27:32 +00:00
|
|
|
|
2022-04-28 13:53:54 +00:00
|
|
|
local directory = string.format("%s/site/pack/packer/start/", vim.fn.stdpath("data"))
|
2021-02-23 11:27:32 +00:00
|
|
|
|
2022-04-28 13:53:54 +00:00
|
|
|
vim.fn.mkdir(directory, "p")
|
2021-02-23 11:27:32 +00:00
|
|
|
|
2022-04-28 13:53:54 +00:00
|
|
|
local out = vim.fn.system(
|
|
|
|
string.format("git clone %s %s", "https://github.com/wbthomason/packer.nvim", directory .. "/packer.nvim")
|
|
|
|
)
|
2021-02-23 11:27:32 +00:00
|
|
|
|
2022-04-28 13:53:54 +00:00
|
|
|
print(out)
|
|
|
|
print("Downloading packer.nvim...")
|
|
|
|
vim.api.nvim_command("PackerCompile")
|
|
|
|
vim.api.nvim_command("PackerInstall")
|
|
|
|
print("( You'll need to restart now )")
|
2021-02-23 11:27:32 +00:00
|
|
|
end
|
|
|
|
|
2022-04-28 15:21:55 +00:00
|
|
|
return function()
|
2022-04-28 13:53:54 +00:00
|
|
|
if not pcall(require, "packer") then
|
2022-04-28 15:21:55 +00:00
|
|
|
download_packer()
|
2021-02-23 11:27:32 +00:00
|
|
|
|
2022-04-28 13:53:54 +00:00
|
|
|
return true
|
|
|
|
end
|
2021-02-23 11:27:32 +00:00
|
|
|
|
2022-04-28 13:53:54 +00:00
|
|
|
return false
|
2021-02-23 11:27:32 +00:00
|
|
|
end
|