Add force parameter to automatic packer download
parent
df0a5af6ad
commit
e3301f6240
|
@ -1,7 +1,9 @@
|
||||||
-- Adopted from https://github.com/tjdevries/config_manager/blob/master/xdg_config/nvim/lua/tj/first_load.lua
|
-- Adopted from https://github.com/tjdevries/config_manager/blob/master/xdg_config/nvim/lua/tj/first_load.lua
|
||||||
local download_packer = function()
|
local download_packer = function(force)
|
||||||
if vim.fn.input("Download Packer? (y for yes)") ~= "y" then
|
if not force then
|
||||||
return
|
if vim.fn.input("Download Packer? (y for yes)") ~= "y" then
|
||||||
|
return
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
local directory = string.format("%s/site/pack/packer/start/", vim.fn.stdpath("data"))
|
local directory = string.format("%s/site/pack/packer/start/", vim.fn.stdpath("data"))
|
||||||
|
@ -17,11 +19,14 @@ local download_packer = function()
|
||||||
vim.api.nvim_command("PackerCompile")
|
vim.api.nvim_command("PackerCompile")
|
||||||
vim.api.nvim_command("PackerInstall")
|
vim.api.nvim_command("PackerInstall")
|
||||||
print("( You'll need to restart now )")
|
print("( You'll need to restart now )")
|
||||||
|
if force then
|
||||||
|
vim.api.nvim_command("quitall")
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
return function()
|
return function(force)
|
||||||
if not pcall(require, "packer") then
|
if not pcall(require, "packer") then
|
||||||
download_packer()
|
download_packer(force)
|
||||||
|
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue