Changing to packer bootstrap from a function that was called immediately

after being defined into fewer and easier to read procedural lines.
This commit is contained in:
Finch 2024-01-30 11:25:38 -06:00
parent f741b82166
commit 5e9a7530b5

View File

@ -74,24 +74,16 @@ local function execute(type)
end end
end end
-- PLUGIN MANAGEMENT
-- Force install Packer if it is not found locally -- Force install Packer if it is not found locally
local function ensure_packer() local packer_need_bootstrap = false
local fn = vim.fn local install_path = vim.fn.stdpath('data') .. '/site/pack/packer/start/packer.nvim'
local install_path = fn.stdpath('data') .. '/site/pack/packer/start/packer.nvim' if vim.fn.empty(vim.fn.glob(install_path)) > 0 then
if fn.empty(fn.glob(install_path)) > 0 then vim.fn.system({ 'git', 'clone', '--depth', '1', 'https://github.com/wbthomason/packer.nvim', install_path })
fn.system({ 'git', 'clone', '--depth', '1', 'https://github.com/wbthomason/packer.nvim', install_path }) vim.cmd [[packadd packer.nvim]]
vim.cmd [[packadd packer.nvim]] packer_need_bootstrap = true
return true
end
return false
end end
-- Actually load Packer -- Manage plugins
local packer_bootstrap = ensure_packer()
-- Manage plugins, and provide simple configurations if necessary, while storing a reference for more complicated setups or modules that are required elsewhere
-- in the configuration file
require('packer').startup(function(use) require('packer').startup(function(use)
use 'wbthomason/packer.nvim' -- Packer self management use 'wbthomason/packer.nvim' -- Packer self management
@ -163,7 +155,7 @@ require('packer').startup(function(use)
use 'rcarriga/nvim-dap-ui' use 'rcarriga/nvim-dap-ui'
-- Automatically set up your configuration after cloning packer.nvim -- Automatically set up your configuration after cloning packer.nvim
if packer_bootstrap then if packer_need_bootstrap then
require('packer').sync() require('packer').sync()
end end
end) end)