From 044e692f52a73ccf1e693c8e793b828a115b034d Mon Sep 17 00:00:00 2001 From: olimorris Date: Thu, 23 Feb 2023 10:20:05 +0000 Subject: [PATCH] docs: update readme for callback data --- README.md | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 1ae3a21..a933890 100644 --- a/README.md +++ b/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 { name = "PersistedHooks", { "User", - function(args) + function() print("Loading session!") end, opts = { pattern = "PersistedLoadPre" },