chore: update README.md
parent
6140a4703a
commit
4f97606552
14
README.md
14
README.md
|
|
@ -91,6 +91,7 @@ require("persisted").setup({
|
||||||
ignored_dirs = nil, -- table of dirs that are ignored when auto-saving and auto-loading
|
ignored_dirs = nil, -- table of dirs that are ignored when auto-saving and auto-loading
|
||||||
before_save = nil, -- function to run before the session is saved to disk
|
before_save = nil, -- function to run before the session is saved to disk
|
||||||
after_save = nil, -- function to run after the session is saved to disk
|
after_save = nil, -- function to run after the session is saved to disk
|
||||||
|
after_source = nil, -- function to run after the session is sourced
|
||||||
telescope = { -- options for the telescope extension
|
telescope = { -- options for the telescope extension
|
||||||
before_source = nil, -- function to run before the session is sourced via telescope
|
before_source = nil, -- function to run before the session is sourced via telescope
|
||||||
after_source = nil, -- function to run after the session is sourced via telescope
|
after_source = nil, -- function to run after the session is sourced via telescope
|
||||||
|
|
@ -228,17 +229,15 @@ require("persisted").setup({
|
||||||
|
|
||||||
### Telescope extension
|
### Telescope extension
|
||||||
|
|
||||||
> **This feature is still in beta!!**
|
|
||||||
|
|
||||||
<p align="center">
|
<p align="center">
|
||||||
<img src="https://user-images.githubusercontent.com/9512444/164997799-7621d04f-e6fb-4bd3-9bb5-504454380e07.png" alt="Telescope">
|
<img src="https://user-images.githubusercontent.com/9512444/177375482-3bc9bd0d-42c8-4755-a36c-08ea5f954525.png" alt="Telescope">
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
The plugin contains an extension for [telescope.nvim](https://github.com/nvim-telescope/telescope.nvim) which allows the user to list all of the saved session files and source them via `:Telescope persisted`.
|
The plugin contains an extension for [telescope.nvim](https://github.com/nvim-telescope/telescope.nvim) which allows the user to list all of the saved session files and source them via `:Telescope persisted`.
|
||||||
|
|
||||||
#### Telescope callbacks
|
#### Telescope callbacks
|
||||||
|
|
||||||
The plugin allows for *before* and *after* callbacks to be used when sourcing a session via *Telescope*. For example:
|
The plugin allows for *before* and *after* callbacks to be used when sourcing a session via Telescope. For example:
|
||||||
|
|
||||||
```lua
|
```lua
|
||||||
require("persisted").setup({
|
require("persisted").setup({
|
||||||
|
|
@ -249,28 +248,27 @@ require("persisted").setup({
|
||||||
vim.api.nvim_input("<ESC>:%bd<CR>")
|
vim.api.nvim_input("<ESC>:%bd<CR>")
|
||||||
end,
|
end,
|
||||||
after_source = function(session)
|
after_source = function(session)
|
||||||
-- Change the git branch
|
|
||||||
print("Loaded session " .. session.name)
|
print("Loaded session " .. session.name)
|
||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
```
|
```
|
||||||
The callbacks can 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.
|
||||||
|
|
||||||
## :rocket: Usage
|
## :rocket: Usage
|
||||||
|
|
||||||
### Default commands
|
### Default commands
|
||||||
The plugin comes with a number of commands:
|
The plugin comes with a number of commands:
|
||||||
|
|
||||||
|
- `SessionToggle` - Determines whether to load, start or stop a session
|
||||||
- `SessionStart` - Start recording a session. Useful if `autosave = false`
|
- `SessionStart` - Start recording a session. Useful if `autosave = false`
|
||||||
- `SessionStop` - Stop recording a session
|
- `SessionStop` - Stop recording a session
|
||||||
- `SessionSave` - Save the current session
|
- `SessionSave` - Save the current session
|
||||||
- `SessionLoad` - Load the session for the current directory and current branch if `git_use_branch = true`
|
- `SessionLoad` - Load the session for the current directory and current branch if `git_use_branch = true`
|
||||||
- `SessionLoadLast` - Load the last session
|
- `SessionLoadLast` - Load the last session
|
||||||
- `SessionDelete` - Delete the current session
|
- `SessionDelete` - Delete the current session
|
||||||
- `SessionToggle` - Determines whether to load, start or stop a session
|
|
||||||
|
|
||||||
> **Note:** The author only binds `SessionToggle` to a keymap for simplicity.
|
> **Note:** The author only binds `SessionToggle` to a keymap for simplicity.
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue