[nvim] feat: packer boostrapping on first install
This commit is contained in:
parent
4e95af5b7a
commit
98b6a428a7
@ -4,14 +4,19 @@
|
||||
-- Description : neovim plugins file
|
||||
|
||||
|
||||
local execute = vim.api.nvim_command
|
||||
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", "https://github.com/wbthomason/packer.nvim", install_path})
|
||||
execute "packadd packer.nvim"
|
||||
local install_path = vim.fn.stdpath("data") .. "/site/pack/packer/start/packer.nvim"
|
||||
if vim.fn.empty(vim.fn.glob(install_path)) > 0 then
|
||||
print("Cloning packer...")
|
||||
PACKER_BOOTSTRAP = vim.fn.system({
|
||||
"git",
|
||||
"clone",
|
||||
"--depth",
|
||||
"1",
|
||||
"https://github.com/wbthomason/packer.nvim",
|
||||
install_path,
|
||||
})
|
||||
vim.cmd([[packadd packer.nvim]])
|
||||
print("Done.")
|
||||
end
|
||||
|
||||
return require("packer").startup(function()
|
||||
@ -102,4 +107,10 @@ return require("packer").startup(function()
|
||||
"norcalli/nvim-colorizer.lua",
|
||||
cmd = "ColorizerToggle"
|
||||
}
|
||||
|
||||
|
||||
-- automatically setup the config after cloning
|
||||
if PACKER_BOOTSTRAP then
|
||||
require("packer").sync()
|
||||
end
|
||||
end)
|
||||
|
Reference in New Issue
Block a user