From a2ffa8b3bc317eb329617304dee97cf0811c9df6 Mon Sep 17 00:00:00 2001 From: Dustin Swan Date: Mon, 7 Nov 2022 11:18:37 -0500 Subject: [PATCH] Having packer install auto --- init.lua | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/init.lua b/init.lua index 34d6fe6..a00054d 100644 --- a/init.lua +++ b/init.lua @@ -17,6 +17,18 @@ vim.opt.cursorline = true vim.api.nvim_create_autocmd("FileType", { pattern = { "org" }, command = "setlocal nowrap" }) +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() + require('packer').startup(function(use) use 'wbthomason/packer.nvim' use 'tpope/vim-surround' @@ -248,6 +260,10 @@ require('packer').startup(function(use) require("trouble").setup() end } + + if packer_bootstrap then + require('packer').sync() + end end) local wk = require("which-key")