From aabc0f208e49e28daaeb4270a30830f239da0d2f Mon Sep 17 00:00:00 2001 From: tiyn Date: Fri, 13 Jan 2023 04:10:00 +0100 Subject: [PATCH] nvim: bootstrap packer --- .config/nvim/lua/loadplugins.lua | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/.config/nvim/lua/loadplugins.lua b/.config/nvim/lua/loadplugins.lua index b28e5e5..9f25cca 100644 --- a/.config/nvim/lua/loadplugins.lua +++ b/.config/nvim/lua/loadplugins.lua @@ -1,5 +1,19 @@ -- loadplugins +-- bootstrap packer +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() + -- load plugins with packer return require("packer").startup(function(use) -- automatic closing of brackets @@ -39,7 +53,9 @@ return require("packer").startup(function(use) use 'norcalli/nvim-colorizer.lua' -- package manager - use 'wbthomason/packer.nvim' + if packer_bootstrap then + require('packer').sync() + end -- colorful brackets use 'luochen1990/rainbow'