feat: add event for `PersistedToggled`
parent
c1c4bbff8a
commit
2de1fe69e7
|
|
@ -301,6 +301,7 @@ The plugin fires events at various points during its lifecycle which users can h
|
||||||
- `PersistedDeletePre` - For _before_ a session is deleted
|
- `PersistedDeletePre` - For _before_ a session is deleted
|
||||||
- `PersistedDeletePost` - For _after_ a session is deleted
|
- `PersistedDeletePost` - For _after_ a session is deleted
|
||||||
- `PersistedStateChange` - For when a session is _started_ or _stopped_
|
- `PersistedStateChange` - For when a session is _started_ or _stopped_
|
||||||
|
- `PersistedToggled` - For when a session is toggled
|
||||||
|
|
||||||
For example, to ensure that the excellent [minimap](https://github.com/wfxr/minimap.vim) plugin is not saved into a session, an autocmd can be created to hook into the `PersistedSavePre` event:
|
For example, to ensure that the excellent [minimap](https://github.com/wfxr/minimap.vim) plugin is not saved into a session, an autocmd can be created to hook into the `PersistedSavePre` event:
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -194,6 +194,8 @@ end
|
||||||
---Determines whether to load, start or stop a session
|
---Determines whether to load, start or stop a session
|
||||||
---@return nil
|
---@return nil
|
||||||
function M.toggle()
|
function M.toggle()
|
||||||
|
vim.api.nvim_exec_autocmds("User", { pattern = "PersistedToggled" })
|
||||||
|
|
||||||
if vim.g.persisting == nil then
|
if vim.g.persisting == nil then
|
||||||
return M.load()
|
return M.load()
|
||||||
end
|
end
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue