Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

README: add Lua example code for auto-running PackerCompile #1221

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
README: add Lua example code for auto-running PackerCompile
Many users come to Packer because they can migrate to a complete
Lua-based config for NeoVim. Thus it makes sense to have a code example
not only in Vimscript for auto-running PackerCompile on changes to
`plugins.lua` but also an example in Lua.
  • Loading branch information
erikw committed Mar 11, 2023
commit 2f34bfac9fb49c7bbd08070587f31ea28da24d34
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,16 @@ vim.cmd([[
]])
```

or using the equivalent Lua code:
```lua
local augroup_packer = vim.api.nvim_create_augroup("packer_user_config", { clear = true })
vim.api.nvim_create_autocmd({ "BufWritePost" }, {
pattern = "plugins.lua",
group = augroup_packer,
command = "source <afile> | PackerCompile",
})
```

## Bootstrapping

If you want to automatically install and set up `packer.nvim` on any machine you clone your configuration to,
Expand Down