From e3301f6240d6ed56933f9cd63c1f8f73cc9a6c46 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ensar=20Saraj=C4=8Di=C4=87?= Date: Thu, 28 Apr 2022 17:13:58 +0200 Subject: [PATCH] Add force parameter to automatic packer download --- symlinks/config/nvim/lua/init/first_load.lua | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/symlinks/config/nvim/lua/init/first_load.lua b/symlinks/config/nvim/lua/init/first_load.lua index c67add9..d26ffef 100644 --- a/symlinks/config/nvim/lua/init/first_load.lua +++ b/symlinks/config/nvim/lua/init/first_load.lua @@ -1,7 +1,9 @@ -- Adopted from https://github.com/tjdevries/config_manager/blob/master/xdg_config/nvim/lua/tj/first_load.lua -local download_packer = function() - if vim.fn.input("Download Packer? (y for yes)") ~= "y" then - return +local download_packer = function(force) + if not force then + if vim.fn.input("Download Packer? (y for yes)") ~= "y" then + return + end end 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("PackerInstall") print("( You'll need to restart now )") + if force then + vim.api.nvim_command("quitall") + end end -return function() +return function(force) if not pcall(require, "packer") then - download_packer() + download_packer(force) return true end