nvim-lua-guide
nvim-lua-guide copied to clipboard
WIP: autocommands
Done now, and API bike-shedding is over as well. Here the documentation should be good, too, and require very little expanding on.
But apparently there's some confusion about user autocommands -- people seem not to be aware that these are just standard autocommands with User
as the event and Whatever
as the pattern (instead often believe that User
is some special keyword and Whatever
is the event).
Maybe having such an autocommand as one of the examples would be helpful.
Is this PR being worked on? If not I can share a PR with a way of creating Autocommands using the latest Neovim v0.7 API.
For a heads up, here's an example of what it could look like:
local augroup_name = vim.api.nvim_create_augroup(
"AutogroupName",
{ clear = true }
)
vim.api.nvim_create_autocommand(
"BufWritePost",
{
command = echo "Recent changes saved!",
group = augroup_name,
pattern = "*"
}
)
For more information on the Autocommand API, refer to :h api-autocmd