A lightweight session persistence plugin for Neovim with interactive scratch buffer recovery.
Unlike the built-in :mksession, persist.nvim preserves the contents of unnamed ([No Name]) buffers and provides an interactive recovery workflow.
This means you can safely close Neovim without losing temporary notes, drafts, or command output stored in scratch buffers.
[No Name]) scratch buffers{
"dmshvedchenko/persist.nvim",
config = function()
require("persist").setup()
end,
}
use {
"dmshvedchenko/persist.nvim",
config = function()
require("persist").setup()
end,
}
Once installed, persist.nvim works automatically.
When Neovim exits, it saves:
The next time Neovim starts, the plugin restores your previous session.
If scratch buffers are found, you'll be prompted to:
No additional configuration is required.
:mksession?The built-in :mksession command restores files and window layouts, but it does not preserve the contents of unnamed ([No Name]) buffers.
persist.nvim solves this problem by storing scratch buffers separately and restoring them through an interactive workflow.
Instead of blindly restoring everything, you can:
| Command | Description |
|---|---|
:PersistSave |
Save the current session |
:PersistRestore |
Restore the last saved session |
Session metadata is stored in:
stdpath("state")/persist/session.json
Scratch buffers are stored in:
stdpath("state")/persist/scratch/
Planned improvements include:
:help persist documentationSuggestions and feature requests are always welcome.
Bug reports, feature requests, and pull requests are welcome.
If you discover a bug or have an idea that could improve the plugin, please open an issue.
MIT