From 0b4c631030e85b5f1d30083394d4d35233f337e7 Mon Sep 17 00:00:00 2001 From: Frede Braendstrup Date: Fri, 29 Apr 2022 13:09:02 +0200 Subject: [PATCH 1/2] Added note about nvim 0.7.0 lua autocmds --- README.md | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/README.md b/README.md index f0fba202..c5bfffd0 100644 --- a/README.md +++ b/README.md @@ -219,6 +219,15 @@ vim.cmd([[ ]]) ``` +Since neovim 0.7.0 you can do this in lua too + +```lua +vim.api.nvim_create_autocmd('BufWritePost', { + pattern = 'plugins.lua' + command = 'source | PackerCompile' +}) +``` + ## Bootstrapping If you want to automatically install and set up `packer.nvim` on any machine you clone your configuration to, From 46093685b27116dd34a73b478b26ec3cfd54cd8e Mon Sep 17 00:00:00 2001 From: Frede Braendstrup Date: Fri, 29 Apr 2022 23:36:42 +0200 Subject: [PATCH 2/2] Added augroup to autocmd --- README.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index c5bfffd0..c5dd9c24 100644 --- a/README.md +++ b/README.md @@ -222,8 +222,10 @@ vim.cmd([[ Since neovim 0.7.0 you can do this in lua too ```lua +vim.api.nvim_create_augroup('packer_user_config', { clear = true }) vim.api.nvim_create_autocmd('BufWritePost', { - pattern = 'plugins.lua' + group = 'packer_user_config', + pattern = 'plugins.lua', command = 'source | PackerCompile' }) ```