From 75c078c8fc7dcb8d58acdb6c8a082818c4828e58 Mon Sep 17 00:00:00 2001 From: Michael Mandl Date: Sun, 20 Feb 2022 12:10:47 +0100 Subject: [PATCH] feat: add packer package manager --- init.lua | 1 + lua/plugins.lua | 28 ++++++++++++++++++++++++++++ 2 files changed, 29 insertions(+) create mode 100644 init.lua create mode 100644 lua/plugins.lua diff --git a/init.lua b/init.lua new file mode 100644 index 0000000..92cf997 --- /dev/null +++ b/init.lua @@ -0,0 +1 @@ +require('plugins') diff --git a/lua/plugins.lua b/lua/plugins.lua new file mode 100644 index 0000000..b443d70 --- /dev/null +++ b/lua/plugins.lua @@ -0,0 +1,28 @@ +local fn = vim.fn +local cmd = vim.cmd + +-- Boostrap Packer +local install_path = fn.stdpath('data')..'/site/pack/packer/start/packer.nvim' +local packer_bootstrap +if fn.empty(fn.glob(install_path)) > 0 then + packer_bootstrap = fn.system({'git', 'clone','https://github.com/wbthomason/packer.nvim', install_path}) +end + +-- Rerun PackerSync everytime plugins.lua is updated +cmd([[ + augroup packer_user_config + autocmd! + autocmd BufWritePost plugins.lua source | PackerSync + augroup end +]]) + +-- Initialize pluggins +return require('packer').startup(function(use) + -- Let Packer manage itself + use('wbthomason/packer.nvim') + + if packer_bootstrap then + require('packer').sync() + end +end) +