diff --git a/Makefile b/Makefile index bc179824..783a2418 100644 --- a/Makefile +++ b/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)" diff --git a/config/nvim/lua/plugins.lua b/config/nvim/lua/plugins.lua index 8bafa833..7fafa6e4 100644 --- a/config/nvim/lua/plugins.lua +++ b/config/nvim/lua/plugins.lua @@ -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 = {