feat: add command to save session
parent
a323e3f50a
commit
00fe043e8d
|
|
@ -62,6 +62,8 @@ The plugin comes with the following defaults:
|
|||
}
|
||||
```
|
||||
|
||||
These can be overwritten by calling the `setup` method and passing in the appropriate value.
|
||||
|
||||
## 🚀 Usage
|
||||
|
||||
The plugin works well with others like [vim-startify](https://github.com/mhinz/vim-startify) or [dashboard](https://github.com/glepnir/dashboard-nvim). It will never restore a session automatically but the commands below, or a custom autocmd, may be used.
|
||||
|
|
@ -70,6 +72,7 @@ The plugin works well with others like [vim-startify](https://github.com/mhinz/v
|
|||
|
||||
- `SessionStart` - Start a session. Useful if `autosave = false`
|
||||
- `SessionStop` - Stop recording a session
|
||||
- `SessionSave` - Save the current session
|
||||
- `SessionLoad` - Load the session for the current directory and current branch if `git_use_branch = true`
|
||||
- `SessionLoadLast` - Load the last session
|
||||
- `SessionDelete` - Delete the current session
|
||||
|
|
@ -89,4 +92,4 @@ To lazy load the plugin, consider adding the `module = "persisted"` option if yo
|
|||
|
||||
The plugin sets a global variable, `vim.g.persisting`, which is set to `true` when a session is started. The author uses this to display an icon in their [statusline](https://github.com/olimorris/dotfiles/blob/0cdaee183c64f872778952f90f62b9366851101c/.config/nvim/lua/Oli/plugins/statusline.lua#L257).
|
||||
|
||||
A list of saved sessions can be returned by executing `<cmd>lua require("persisted").list()<cr>`.
|
||||
A table of saved sessions can be returned by the `lua require("persisted").list()` command. The author uses this to display a list of sessions in their [config](https://github.com/olimorris/dotfiles/blob/9e06f00a878710aefc8c28904d2322ea46e3eaea/.config/nvim/lua/Oli/core/functions.lua#L3).
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@ local function setup_commands()
|
|||
vim.cmd([[
|
||||
command! SessionStart :lua require("persisted").start()
|
||||
command! SessionStop :lua require("persisted").stop()
|
||||
command! SessionSave :lua require("persisted").save()
|
||||
command! SessionLoad :lua require("persisted").load()
|
||||
command! SessionLoadLast :lua require("persisted").load({ last = true })
|
||||
command! SessionDelete :lua require("persisted").delete()
|
||||
|
|
|
|||
Loading…
Reference in New Issue