diff --git a/nvim/lua/packer_init.lua b/nvim/lua/packer_init.lua index 2824870..9552f8e 100644 --- a/nvim/lua/packer_init.lua +++ b/nvim/lua/packer_init.lua @@ -1,17 +1,23 @@ -local ensure_packer = function() - local install_path = vim.fn.stdpath('data')..'/site/pack/packer/start/packer.nvim' - if vim.fn.empty(vim.fn.glob(install_path)) > 0 then - vim.fn.system {'git', 'clone', '--depth', '1', 'https://github.com/wbthomason/packer.nvim', install_path} - vim.cmd [[packadd packer.nvim]] +local packer_init = {} + +packer_init.init = function(plugins) + local ensure_packer = function() + local install_path = vim.fn.stdpath('data')..'/site/pack/packer/start/packer.nvim' + if vim.fn.empty(vim.fn.glob(install_path)) > 0 then + vim.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(plugins) + if packer_bootstrap then + require('packer').sync() return true end return false end -local packer_bootstrap = ensure_packer() -require('packer').startup(plugins) -if packer_bootstrap then - require('packer').sync() - return true -end -return false +return packer_init diff --git a/nvim/lua/plugins.lua b/nvim/lua/plugins.lua index b547c5d..17deb2b 100644 --- a/nvim/lua/plugins.lua +++ b/nvim/lua/plugins.lua @@ -1,9 +1,10 @@ -- [[ plugins list ]] -plugins = function(use) +local plugins = function(use) use 'wbthomason/packer.nvim' use 'lifepillar/vim-gruvbox8' use 'hoob3rt/lualine.nvim' + use 'hashivim/vim-terraform' use 'mhinz/vim-signify' use 'tpope/vim-fugitive' use 'tpope/vim-rsi' @@ -18,7 +19,7 @@ plugins = function(use) end --[[ init packer if missing ]] -if require('packer_init') then return end +if require('packer_init').init(plugins) then return end --[[ plugins config ]] require('lualine').setup()