Add automatic bootstrap for packer install
This commit is contained in:
parent
44462072f6
commit
3a74b60ef3
5
Makefile
5
Makefile
|
@ -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)"
|
||||
|
||||
|
|
|
@ -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 = {
|
||||
|
|
Loading…
Reference in a new issue