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
cmd('packadd packer.nvim')
local present, packer = pcall(require, 'packer')
local first_install = false
if not present then
local packer_path = vim.fn.stdpath('data') .. '/site/pack/packer/opt/packer.nvim'
@ -24,8 +24,7 @@ if not present then
if present then
print('Packer cloned successfully.')
packer.sync()
packer.compile()
first_install = true
else
error("Couldn't clone packer !\nPacker path: " .. packer_path .. '\n' .. packer)
end
@ -41,9 +40,12 @@ packer.init({
git = {
clone_timeout = 800, -- Timeout, in seconds, for git clones
},
compile_path = vim.fn.stdpath('config')..'/lua/cosmic/compiled.lua',
compile_path = vim.fn.stdpath('config') .. '/lua/cosmic/compiled.lua',
auto_clean = 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
return false
end
local packer = cosmic_packer.packer
local use = packer.use
local ok, user_plugins = pcall(require, 'cosmic.config.plugins')