nvim: re-add automatic plugin install

This commit is contained in:
tastytea 2022-08-12 00:06:42 +02:00
parent 3bb3075151
commit 769af64a86
Signed by: tastytea
SSH Key Fingerprint: SHA256:FBkvrOlhq5use1XEttyUGT4bUTDVA1ar9SgIc9P03cM

View File

@ -10,7 +10,7 @@ packer.init()
packer.use 'https://github.com/wbthomason/packer.nvim' packer.use 'https://github.com/wbthomason/packer.nvim'
-- source file and compile plugins when config file is written -- source file, install and compile plugins when config file is written
vim.api.nvim_create_augroup('packer_user_config', { clear = true }) vim.api.nvim_create_augroup('packer_user_config', { clear = true })
vim.api.nvim_create_autocmd( vim.api.nvim_create_autocmd(
{ 'BufWritePost' }, { 'BufWritePost' },
@ -21,13 +21,27 @@ vim.api.nvim_create_autocmd(
-- exclude plugins.lua, because that would re-init packer -- exclude plugins.lua, because that would re-init packer
if (not vim.api.nvim_buf_get_name(0):match('plugins.lua$')) then if (not vim.api.nvim_buf_get_name(0):match('plugins.lua$')) then
vim.cmd([[ vim.cmd([[
echom 'reloading config file' echom 'reloading config file and installing new plugins'
source <afile> source <afile>
PackerCompile PackerInstall
redraw
]]) ]])
end end
end end
} }
) )
vim.api.nvim_create_autocmd(
{ 'User' },
{
group = 'packer_user_config',
pattern = 'PackerComplete',
command = [[echom 'compiling plugins…' | PackerCompile]]
}
)
vim.api.nvim_create_autocmd(
{ 'User' },
{
group = 'packer_user_config',
pattern = 'PackerCompileDone',
command = [[echom 'plugins compiled.']]
}
)