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,9 +1,15 @@
|
||||||
local install_path = vim.fn.stdpath("data") .. "/pack/packer/start/packer.nvim"
|
local ensure_packer = function()
|
||||||
|
local fn = vim.fn
|
||||||
if vim.fn.empty(vim.fn.glob(install_path)) > 0 then
|
local install_path = fn.stdpath('data') .. '/site/pack/packer/start/packer.nvim'
|
||||||
vim.cmd("!git clone https://github.com/wbthomason/packer.nvim " ..
|
if fn.empty(fn.glob(install_path)) > 0 then
|
||||||
install_path)
|
fn.system({ 'git', 'clone', '--depth', '1', 'https://github.com/wbthomason/packer.nvim', install_path })
|
||||||
|
vim.cmd [[packadd packer.nvim]]
|
||||||
|
return true
|
||||||
end
|
end
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
|
||||||
|
local packer_bootstrap = ensure_packer()
|
||||||
|
|
||||||
-- Compile on plugin edits
|
-- Compile on plugin edits
|
||||||
vim.api.nvim_create_autocmd({ "BufWritePost" }, {
|
vim.api.nvim_create_autocmd({ "BufWritePost" }, {
|
||||||
|
@ -233,4 +239,9 @@ require("packer").startup(function()
|
||||||
}
|
}
|
||||||
require('plug._cmp')
|
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)
|
end)
|
||||||
|
|
Loading…
Reference in a new issue