docs: update readme for callback data
parent
58aafa5f5f
commit
044e692f52
16
README.md
16
README.md
|
|
@ -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" },
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue