99 lines
3.3 KiB
Plaintext
99 lines
3.3 KiB
Plaintext
*persistence.nvim.txt* For Neovim Last change: 2024 July 15
|
|
|
|
==============================================================================
|
|
Table of Contents *persistence.nvim-table-of-contents*
|
|
|
|
1. Persistence |persistence.nvim-persistence|
|
|
- Features |persistence.nvim-persistence-features|
|
|
- Requirements |persistence.nvim-persistence-requirements|
|
|
- Installation |persistence.nvim-persistence-installation|
|
|
- Configuration |persistence.nvim-persistence-configuration|
|
|
- Usage |persistence.nvim-persistence-usage|
|
|
- Events |persistence.nvim-persistence-events|
|
|
|
|
==============================================================================
|
|
1. Persistence *persistence.nvim-persistence*
|
|
|
|
**Persistence** is a simple lua plugin for automated session management.
|
|
|
|
|
|
FEATURES *persistence.nvim-persistence-features*
|
|
|
|
- automatically saves the active session under `~/.local/state/nvim/sessions` on exit
|
|
- simple API to restore the current or last session
|
|
|
|
|
|
REQUIREMENTS *persistence.nvim-persistence-requirements*
|
|
|
|
- Neovim >= 0.7.2
|
|
|
|
|
|
INSTALLATION *persistence.nvim-persistence-installation*
|
|
|
|
Install the plugin with your preferred package manager:
|
|
|
|
|
|
LAZY.NVIM ~
|
|
|
|
>lua
|
|
-- Lua
|
|
{
|
|
"folke/persistence.nvim",
|
|
event = "BufReadPre", -- this will only start session saving when an actual file was opened
|
|
opts = {
|
|
-- add any custom options here
|
|
}
|
|
}
|
|
<
|
|
|
|
|
|
CONFIGURATION *persistence.nvim-persistence-configuration*
|
|
|
|
Persistence comes with the following defaults:
|
|
|
|
>lua
|
|
{
|
|
dir = vim.fn.stdpath("state") .. "/sessions/", -- directory where session files are saved
|
|
-- minimum number of file buffers that need to be open to save
|
|
-- Set to 0 to always save
|
|
need = 1,
|
|
branch = true, -- use git branch to save session
|
|
}
|
|
<
|
|
|
|
|
|
[!TIP] To configure what should be saved in your session, check |:h
|
|
'sessionoptions'|
|
|
|
|
USAGE *persistence.nvim-persistence-usage*
|
|
|
|
**Persistence** works well with plugins like `startify` or `dashboard`. It will
|
|
never restore a session automatically, but you can of course write an autocmd
|
|
that does exactly that if you want.
|
|
|
|
>lua
|
|
-- load the session for the current directory
|
|
vim.keymap.set("n", "<leader>qs", function() require("persistence").load() end)
|
|
|
|
-- select a session to load
|
|
vim.keymap.set("n", "<leader>qS", function() require("persistence").select() end)
|
|
|
|
-- load the last session
|
|
vim.keymap.set("n", "<leader>ql", function() require("persistence").load({ last = true }) end)
|
|
|
|
-- stop Persistence => session won't be saved on exit
|
|
vim.keymap.set("n", "<leader>qd", function() require("persistence").stop() end)
|
|
<
|
|
|
|
|
|
EVENTS *persistence.nvim-persistence-events*
|
|
|
|
- **PersistenceLoadPre**before loading a session
|
|
- **PersistenceLoadPost**after loading a session
|
|
- **PersistenceSavePre**before saving a session
|
|
- **PersistenceSavePost**after saving a session
|
|
|
|
Generated by panvimdoc <https://github.com/kdheepak/panvimdoc>
|
|
|
|
vim:tw=78:ts=8:noet:ft=help:norl:
|