nvim: Fix automatic packer installation
Updated to new recommended bootstrapping for packer itself, straight from the project respository.
This commit is contained in:
parent
b33ae09a33
commit
1c983b2dce
1 changed files with 16 additions and 5 deletions
|
@ -1,10 +1,16 @@
|
|||
local install_path = vim.fn.stdpath("data") .. "/pack/packer/start/packer.nvim"
|
||||
|
||||
if vim.fn.empty(vim.fn.glob(install_path)) > 0 then
|
||||
vim.cmd("!git clone 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
|
||||
|
||||
local packer_bootstrap = ensure_packer()
|
||||
|
||||
-- Compile on plugin edits
|
||||
vim.api.nvim_create_autocmd({ "BufWritePost" }, {
|
||||
pattern = "plugins.lua",
|
||||
|
@ -233,4 +239,9 @@ require("packer").startup(function()
|
|||
}
|
||||
require('plug._cmp')
|
||||
|
||||
-- Automatically set up your configuration after cloning packer.nvim
|
||||
-- Put this at the end after all plugins
|
||||
if packer_bootstrap then
|
||||
require('packer').sync()
|
||||
end
|
||||
end)
|
||||
|
|
Loading…
Reference in a new issue