Nvim: improve packer setup

main
Marko Korhonen 2 years ago
parent 3841481c79
commit 9e8435ba99
No known key found for this signature in database
GPG Key ID: 911B85FBC6003FE5

@ -1,25 +1,23 @@
local fn = vim.fn local fn = vim.fn
-- Install packer if it's not yet installed -- Install packer if it's not yet installed
local install_path = fn.stdpath('data') .. '/site/pack/packer/opt/packer.nvim' local install_path = fn.stdpath('data') .. '/site/pack/packer/start/packer.nvim'
if fn.empty(fn.glob(install_path)) > 0 then if fn.empty(fn.glob(install_path)) > 0 then
print('Installing Packer') print('Installing Packer')
Packer_installed = fn.system({ Packer_bootstrap = fn.system({
'git', 'clone', '--depth', '1', 'git', 'clone', '--depth', '1',
'https://github.com/wbthomason/packer.nvim', install_path 'https://github.com/wbthomason/packer.nvim', install_path
}) })
vim.o.runtimepath = vim.fn.stdpath('data') .. '/site/pack/*/start/*,' .. vim.cmd [[packadd packer.nvim]]
vim.o.runtimepath
print('Installed Packer') print('Installed Packer')
end end
-- Configure packer -- Configure packer
vim.cmd [[packadd packer.nvim]]
require('packer').startup(function() require('packer').startup(function()
local use = require('packer').use local use = require('packer').use
-- The plugin manager itself -- The plugin manager itself
use {'wbthomason/packer.nvim', opt = true} use {'wbthomason/packer.nvim'}
-- Colorscheme -- Colorscheme
use { use {
@ -174,6 +172,12 @@ require('packer').startup(function()
-- Vim <3 Asciidoctor -- Vim <3 Asciidoctor
use 'habamax/vim-asciidoctor' use 'habamax/vim-asciidoctor'
-- If Packer was just installed,
-- sync plugins
if Packer_bootstrap then
require('packer').sync()
end
end) end)
-- Sync plugins if Packer was just -- Sync plugins if Packer was just

Loading…
Cancel
Save