From 23778b1f65d9a2f06974d54e3abe3d34f30dd116 Mon Sep 17 00:00:00 2001 From: REmerald <55359236+REmerald@users.noreply.github.com> Date: Tue, 19 Jul 2022 13:18:45 +0000 Subject: [PATCH] port packer autocmd to lua --- lua/user/plugins.lua | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/lua/user/plugins.lua b/lua/user/plugins.lua index 7482d6a..4860f48 100644 --- a/lua/user/plugins.lua +++ b/lua/user/plugins.lua @@ -16,12 +16,12 @@ if fn.empty(fn.glob(install_path)) > 0 then 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 au_packer = vim.api.nvim_create_augroup("packer_autoconf", {clear = true}) +vim.api.nvim_create_autocmd( + "BufWritePost", {group = au_packer, pattern = "plugins.lua", + command = "source PackerSync", + desc = "Reloads nvim when you save plugins.lua"} +) -- Use a protected call so we don't error out on first use local status_ok, packer = pcall(require, "packer")