parent
0ad729ee38
commit
6140a4703a
|
|
@ -243,18 +243,19 @@ The plugin allows for *before* and *after* callbacks to be used when sourcing a
|
||||||
```lua
|
```lua
|
||||||
require("persisted").setup({
|
require("persisted").setup({
|
||||||
telescope = {
|
telescope = {
|
||||||
before_source = function(session)
|
before_source = function()
|
||||||
-- Close all open buffers
|
-- Close all open buffers
|
||||||
pcall(vim.cmd, "bufdo bwipeout")
|
-- Thanks to https://github.com/avently
|
||||||
|
vim.api.nvim_input("<ESC>:%bd<CR>")
|
||||||
end,
|
end,
|
||||||
after_source = function(session)
|
after_source = function(session)
|
||||||
-- Change the git branch
|
-- Change the git branch
|
||||||
pcall(vim.cmd, "git checkout " .. session.branch)
|
print("Loaded session " .. session.name)
|
||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
```
|
```
|
||||||
The callbacks must accept a *session* parameter which is a table that has the following properties:
|
The callbacks can accept a *session* parameter which is a table that has the following properties:
|
||||||
* name - The filename of the session.
|
* name - The filename of the session.
|
||||||
* file_path - The file path to the session.
|
* file_path - The file path to the session.
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue