From 95c2ec702f1571c9923bfdd056a91fa70df0710c Mon Sep 17 00:00:00 2001 From: Elias Almqvist Date: Tue, 2 May 2023 12:33:07 +0200 Subject: [PATCH] NeoVim packer bootstrap --- nvim/.config/nvim/lua/evim/init.lua | 1 - nvim/.config/nvim/lua/evim/packer.lua | 22 ++++++++++++++++++++-- 2 files changed, 20 insertions(+), 3 deletions(-) diff --git a/nvim/.config/nvim/lua/evim/init.lua b/nvim/.config/nvim/lua/evim/init.lua index 2609dca..3447f82 100644 --- a/nvim/.config/nvim/lua/evim/init.lua +++ b/nvim/.config/nvim/lua/evim/init.lua @@ -1,3 +1,2 @@ require("evim.remap") -- Default binds require("evim.packer") -- Package manager - diff --git a/nvim/.config/nvim/lua/evim/packer.lua b/nvim/.config/nvim/lua/evim/packer.lua index 904eae2..d66e89e 100644 --- a/nvim/.config/nvim/lua/evim/packer.lua +++ b/nvim/.config/nvim/lua/evim/packer.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 [[packadd packer.nvim]] return require("packer").startup(function(use) @@ -46,8 +59,8 @@ return require("packer").startup(function(use) -- use "vimsence/vimsence" use "andweeb/presence.nvim" use { - 'nvim-lualine/lualine.nvim', - requires = { 'nvim-tree/nvim-web-devicons', opt = true } + "nvim-lualine/lualine.nvim", + requires = { "nvim-tree/nvim-web-devicons", opt = true } } use { @@ -61,4 +74,9 @@ return require("packer").startup(function(use) "windwp/nvim-autopairs", config = function() require("nvim-autopairs").setup {} end } + + + if packer_bootstrap then + require("packer").sync() + end end)