fix(plugins): fix packer reinstallation issues

This commit is contained in:
Matt Leong 2021-10-25 16:29:59 -07:00
parent 15986b44ef
commit ae6363c0d6
3 changed files with 12 additions and 8 deletions

View file

@ -17,4 +17,5 @@
}, },
} }
return plugins ]] return plugins
]]

View file

@ -1,9 +1,9 @@
local cmd = vim.cmd local cmd = vim.cmd
cmd('packadd packer.nvim')
local present, packer = pcall(require, 'packer') local present, packer = pcall(require, 'packer')
local first_install = false
if not present then if not present then
local packer_path = vim.fn.stdpath('data') .. '/site/pack/packer/opt/packer.nvim' local packer_path = vim.fn.stdpath('data') .. '/site/pack/packer/opt/packer.nvim'
@ -24,8 +24,7 @@ if not present then
if present then if present then
print('Packer cloned successfully.') print('Packer cloned successfully.')
packer.sync() first_install = true
packer.compile()
else else
error("Couldn't clone packer !\nPacker path: " .. packer_path .. '\n' .. packer) error("Couldn't clone packer !\nPacker path: " .. packer_path .. '\n' .. packer)
end end
@ -46,4 +45,7 @@ packer.init({
compile_on_sync = true, compile_on_sync = true,
}) })
return packer return {
packer = packer,
first_install = first_install,
}

View file

@ -1,9 +1,10 @@
local present, packer = pcall(require, 'cosmic.packer') local present, cosmic_packer = pcall(require, 'cosmic.packer')
if not present then if not present then
return false return false
end end
local packer = cosmic_packer.packer
local use = packer.use local use = packer.use
local ok, user_plugins = pcall(require, 'cosmic.config.plugins') local ok, user_plugins = pcall(require, 'cosmic.config.plugins')