From b5daec0ddcc1af2a5435804286cf41607ed0962d Mon Sep 17 00:00:00 2001 From: aflyingpumpkin Date: Mon, 18 Apr 2022 18:59:59 -0400 Subject: [PATCH] Removed unnecessary use of `vim.cmd` in plugins.lua --- lua/user/plugins.lua | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/lua/user/plugins.lua b/lua/user/plugins.lua index 3d4499f41..a39b1db53 100644 --- a/lua/user/plugins.lua +++ b/lua/user/plugins.lua @@ -12,16 +12,16 @@ if fn.empty(fn.glob(install_path)) > 0 then install_path, } print "Installing packer close and reopen Neovim..." - vim.cmd [[packadd packer.nvim]] + require('packer').packadd = 'packer.nvim' end -- Autocommand that reloads neovim whenever you save the plugins.lua file -vim.cmd [[ - augroup packer_user_config - autocmd! - autocmd BufWritePost plugins.lua source | PackerSync - augroup end -]] +local group = vim.api.nvim_create_augroup("packer_user_config", { clear = true }) +vim.api.nvim_create_autocmd("BufWritePost", { + command = "source | PackerSync", + pattern = "plugins.lua", + group = group, +}) -- Use a protected call so we don't error out on first use local status_ok, packer = pcall(require, "packer")