From 0c25d5c867554b39d7fef32fe136007edf7ed74d Mon Sep 17 00:00:00 2001 From: Patrick Michl Date: Fri, 21 Oct 2022 22:28:53 +0200 Subject: [PATCH] allow bootstraping packer --- lua/plugins.lua | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/lua/plugins.lua b/lua/plugins.lua index a806341..cbe58c2 100644 --- a/lua/plugins.lua +++ b/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([[autocmd BufWritePost plugins.lua source | PackerCompile]]) return require('packer').startup({function() @@ -83,6 +96,10 @@ return require('packer').startup({function() config = function() require'plugins/nvim-tree' end } use 'justinmk/vim-sneak' + + if packer_bootstrap then + require('packer').sync() + end end, config = { display = {