2022-08-08 01:41:01 +02:00
|
|
|
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
|
|
|
|
|
2022-08-08 13:57:38 +02:00
|
|
|
packer = require('packer')
|
|
|
|
packer.init()
|
2022-08-08 01:41:01 +02:00
|
|
|
|
2022-08-08 20:27:58 +02:00
|
|
|
packer.use 'https://github.com/wbthomason/packer.nvim'
|
2022-08-08 13:57:38 +02:00
|
|
|
|
2022-08-12 00:06:42 +02:00
|
|
|
-- source file, install and compile plugins when config file is written
|
2022-08-10 17:34:00 +02:00
|
|
|
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
|
2022-08-10 17:52:25 +02:00
|
|
|
vim.cmd([[
|
|
|
|
source <afile>
|
2022-08-12 00:06:42 +02:00
|
|
|
PackerInstall
|
2022-08-10 17:52:25 +02:00
|
|
|
]])
|
2022-08-10 17:34:00 +02:00
|
|
|
end
|
|
|
|
end
|
|
|
|
}
|
|
|
|
)
|
2022-08-12 00:06:42 +02:00
|
|
|
vim.api.nvim_create_autocmd(
|
|
|
|
{ 'User' },
|
|
|
|
{
|
|
|
|
group = 'packer_user_config',
|
|
|
|
pattern = 'PackerComplete',
|
2022-08-12 05:09:26 +02:00
|
|
|
command = [[PackerCompile]]
|
2022-08-12 00:06:42 +02:00
|
|
|
}
|
|
|
|
)
|
|
|
|
vim.api.nvim_create_autocmd(
|
|
|
|
{ 'User' },
|
|
|
|
{
|
|
|
|
group = 'packer_user_config',
|
|
|
|
pattern = 'PackerCompileDone',
|
2022-08-12 05:09:26 +02:00
|
|
|
command = [[echo 'plugins compiled']]
|
2022-08-12 00:06:42 +02:00
|
|
|
}
|
|
|
|
)
|