Skip to content

Commit 31d4246

Browse files
author
Ali Shahid
committed
[packer_nvim.lua] upgrade installation bootstrap
1 parent a7bf802 commit 31d4246

File tree

1 file changed

+12
-14
lines changed

1 file changed

+12
-14
lines changed

lua/packer_nvim.lua

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -17,31 +17,21 @@
1717
-- NOTE:1
1818
-- If you want to automatically ensure that packer.nvim is installed on any machine you clone your configuration to,
1919
-- add the following snippet (which is due to @Iron-E) somewhere in your config before your first usage of packer:
20-
local execute = vim.api.nvim_command
2120
local fn = vim.fn
22-
local install_path = fn.stdpath('data') .. '/site/pack/packer/start/packer.nvim'
21+
local install_path = fn.stdpath('data')..'/site/pack/packer/start/packer.nvim'
2322
if fn.empty(fn.glob(install_path)) > 0 then
24-
fn.system({
25-
'git', 'clone', 'https://github.com/wbthomason/packer.nvim', install_path
23+
Packer_bootstrap = fn.system({
24+
'git', 'clone', '--depth', '1', 'https://github.com/wbthomason/packer.nvim',
25+
install_path
2626
})
27-
execute 'packadd packer.nvim'
2827
end
2928

3029
-- safely import packer
3130
local ok, packer = pcall(require, "packer")
3231
if not ok then return end
3332

34-
3533
local commits = require("plugins.commits")
3634

37-
-- automatically run :PackerCompile whenever plugins.lua is updated
38-
vim.cmd([[
39-
augroup packer_user_config
40-
autocmd!
41-
autocmd BufWritePost plugins.lua source <afile> | PackerCompile
42-
augroup end
43-
]])
44-
4535

4636
return packer.startup {
4737

@@ -56,6 +46,7 @@ return packer.startup {
5646
}
5747
},
5848

49+
5950
function()
6051

6152
use { -- Packer can manage itself
@@ -305,6 +296,13 @@ return packer.startup {
305296
config = [[ require('plugins/nvim-ts-autotag') ]]
306297
}
307298
-- ━━━━━━━━━━━━━━❰ end of DEVELOPMENT ❱━━━━━━━━━━━━━ --
299+
300+
301+
-- Automatically set up your configuration after cloning packer.nvim
302+
-- Put this at the end after all plugins
303+
if Packer_bootstrap then
304+
packer.sync()
305+
end
308306
end
309307
}
310308

0 commit comments

Comments
 (0)