docs: update readme for callback data

main
olimorris 2023-02-23 10:20:05 +00:00
parent 58aafa5f5f
commit 044e692f52
1 changed files with 14 additions and 2 deletions

View File

@ -296,14 +296,26 @@ vim.api.nvim_create_autocmd({ "User" }, {
}) })
``` ```
If you're using the excellent [Legendary.nvim](https://github.com/mrjones2014/legendary.nvim) plugin, consider the following snippet format: Session data is also made available to the callback:
```lua
vim.api.nvim_create_autocmd({ "User" }, {
pattern = "PersistedTelescopeLoadPre",
group = group,
callback = function(session)
print(session.data.branch) -- Print the session's branch
end,
})
```
Finaly, if you're using the excellent [Legendary.nvim](https://github.com/mrjones2014/legendary.nvim) plugin, consider the following snippet format:
```lua ```lua
{ {
name = "PersistedHooks", name = "PersistedHooks",
{ {
"User", "User",
function(args) function()
print("Loading session!") print("Loading session!")
end, end,
opts = { pattern = "PersistedLoadPre" }, opts = { pattern = "PersistedLoadPre" },