fix bootstrap for packer

This commit is contained in:
2023-01-22 18:32:20 +08:00
parent 8871fc7477
commit 3dcef0efee
+15 -25
View File
@@ -1,30 +1,19 @@
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
PACKER_BOOTSTRAP = fn.system({ 'git', 'clone', '--depth', '1', 'https://github.com/wbthomason/packer.nvim',
install_path })
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
-- Only required if you have packer configured as `opt`
vim.cmd [[packadd packer.nvim]]
local packer_bootstrap = ensure_packer()
local status_ok, packer = pcall(require, 'packer')
if not status_ok then
return
end
packer.init {
display = {
open_fn = function()
return require('packer.util').float {
border = 'rounded'
}
end
}
}
return packer.startup(function(use)
return require('packer').startup(function(use)
use 'wbthomason/packer.nvim'
-- My plugins here
use { 'wbthomason/packer.nvim' }
use { 'lewis6991/impatient.nvim' }
use {
'nvim-treesitter/nvim-treesitter',
@@ -177,9 +166,10 @@ return packer.startup(function(use)
-- vim.cmd('colorscheme rose-pine')
end
})
-- Automatically set up your configuration after cloning packer.nvim,
-- Automatically set up your configuration after cloning packer.nvim
-- Put this at the end after all plugins
if PACKER_BOOTSTRAP then
if packer_bootstrap then
require('packer').sync()
end
end)