Add automatic bootstrap for packer install

This commit is contained in:
Evie Litherland-Smith 2023-02-01 07:57:54 +00:00
parent 44462072f6
commit 3a74b60ef3
2 changed files with 17 additions and 4 deletions

View file

@ -33,6 +33,7 @@ zsh: $(ZSH_DIR) $(ZSH_CUSTOM_DIR) $(POWERLEVEL_DIR) $(ZSH_TARGETS)
ssh: $(HOME)/.ssh/config $(HOME)/.ssh/sockets $(HOME)/.ssh/config.d
nvim: $(PACKER_DIR)
nvim --headless -c 'autocmd User PackerComplete quitall' -c 'PackerSync'
$(CONFIG_TARGETS): $(CONFIG_DIR)/%: config/%
$(FONT_TARGETS): $(FONT_DIR)/%: nerdfont_symbols/%
@ -41,10 +42,6 @@ $(HOME)/.ssh/config: $(HOME)/.ssh/%: ssh-%
$(CONFIG_TARGETS) $(FONT_TARGETS) $(ZSH_TARGETS) $(HOME)/.ssh/config:
ln -s $(PWD)/$? $@
$(PACKER_DIR):
git clone --depth 1 $(PACKER_REPO) $@
nvim --headless -c 'autocmd User PackerComplete quitall' -c 'PackerSync'
$(ZSH_DIR):
sh -c "$$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"

View file

@ -1,3 +1,16 @@
local ensure_packer = function()
local fn = vim.fn
local install_path = fn.stdpath('data')..'/site/pack/packer/start/packer.nvim'
if fn.empty(fn.glob(install_path)) > 0 then
fn.system({'git', 'clone', '--depth', '1', 'https://github.com/wbthomason/packer.nvim', install_path})
vim.cmd [[packadd packer.nvim]]
return true
end
return false
end
local packer_bootstrap = ensure_packer()
vim.cmd([[
augroup packer_user_config
autocmd!
@ -149,6 +162,9 @@ require('packer').startup {
}
end
}
if packer_bootstrap then
require('packer').sync()
end
end,
config = {
display = {