Files
dotfiles/.config/nvim/lua/plugins-setup.lua
T
2023-06-03 10:21:21 -04:00

38 lines
955 B
Lua

-- auto install packer if not installed
local ensure_packer = function()
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
fn.system({ "git", "clone", "--depth", "1", "https://github.com/wbthomason/packer.nvim", install_path })
vim.cmd([[packadd packer.nvim]])
return true
end
return false
end
local packer_bootstrap = ensure_packer()
-- autoreload
vim.cmd([[
augroup packer_user_config
autocmd!
autocmd BufWritePost plugins-setup.lua source <afile> | PackerSync
augroup end
]])
-- import packer safely
local status, packer = pcall(require, "packer")
if not status then
return
end
-- enable plugins
return packer.startup(function(use)
use("wbthomason/packer.nvim")
use("nvim-lua/plenary.nvim")
use("rmehri01/onenord.nvim") -- preferred colorscheme
if packer_bootstrap then
require("packer").sync()
end
end)