34 lines
1.1 KiB
Lua
34 lines
1.1 KiB
Lua
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})
|
|
vim.cmd [[packadd packer.nvim]]
|
|
end
|
|
|
|
packer = require('packer')
|
|
packer.init()
|
|
|
|
packer.use 'https://github.com/wbthomason/packer.nvim'
|
|
|
|
-- source file and compile plugins when config file is written
|
|
vim.api.nvim_create_augroup('packer_user_config', { clear = true })
|
|
vim.api.nvim_create_autocmd(
|
|
{ 'BufWritePost' },
|
|
{
|
|
group = 'packer_user_config',
|
|
pattern = { '*/nvim/lua/*.lua', '*/nvim/init.lua' },
|
|
callback = function()
|
|
-- exclude plugins.lua, because that would re-init packer
|
|
if (not vim.api.nvim_buf_get_name(0):match('plugins.lua$')) then
|
|
vim.cmd([[
|
|
echom 'reloading config file…'
|
|
source <afile>
|
|
PackerCompile
|
|
redraw
|
|
]])
|
|
end
|
|
end
|
|
}
|
|
)
|
|
|