summaryrefslogtreecommitdiff
path: root/nvim
diff options
context:
space:
mode:
Diffstat (limited to 'nvim')
-rw-r--r--nvim/.config/nvim/lua/plugins.lua21
1 files changed, 18 insertions, 3 deletions
diff --git a/nvim/.config/nvim/lua/plugins.lua b/nvim/.config/nvim/lua/plugins.lua
index 6b93345..a60c9de 100644
--- a/nvim/.config/nvim/lua/plugins.lua
+++ b/nvim/.config/nvim/lua/plugins.lua
@@ -1,7 +1,18 @@
-- This file can be loaded by calling `lua require('plugins')` from your init.vim
--- Only required if you have packer configured as `opt`
-vim.cmd [[packadd packer.nvim]]
+-- ensure packer is installed
+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()
-- Recompile packer config after editing this file
vim.cmd([[
@@ -11,7 +22,7 @@ vim.cmd([[
augroup end
]])
-return require('packer').startup(function()
+require('packer').startup(function()
-- Packer can manage itself
use 'wbthomason/packer.nvim'
@@ -105,3 +116,7 @@ return require('packer').startup(function()
}
end)
+-- the first run will install package and our plugins
+if packer_bootstrap then
+ require("packer").sync()
+end