From 1e070cb96a55392dd0996343055ef3e9c09030c2 Mon Sep 17 00:00:00 2001 From: amarakon Date: Sat, 1 Oct 2022 21:00:03 -0400 Subject: [PATCH] README: improve `autocmd` instructions --- README.md | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 86ac7f5b..27c8254f 100644 --- a/README.md +++ b/README.md @@ -205,7 +205,7 @@ You can configure Neovim to automatically run `:PackerCompile` whenever `plugins ``` augroup packer_user_config autocmd! - autocmd BufWritePost plugins.lua source | PackerCompile + autocmd BufWritePost plugins.lua source | PackerCompile augroup end ``` @@ -213,12 +213,15 @@ This autocommand can be placed in your `init.vim`, or any other startup file as Placing this in `plugins.lua` could look like this: ```lua -vim.cmd([[ - augroup packer_user_config - autocmd! - autocmd BufWritePost plugins.lua source | PackerCompile - augroup end -]]) +vim.api.nvim_create_augroup('packer_user_config', {}) +vim.api.nvim_create_autocmd( + 'BufWritePost', + { + group = 'packer_user_config', + pattern = 'plugins.lua', + command = 'source | PackerCompile' + } +) ``` ## Bootstrapping