persist.nvim
July 27, 2026 ยท View on GitHub
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.
โจ Features
- ๐ Restore tabs, windows, and split layouts
- ๐ Persist unnamed (
[No Name]) scratch buffers - ๐ Preview scratch buffers before restoring
- โ Restore only the tabs you want
- ๐๏ธ Permanently discard unwanted scratch notes
- ๐ซ Automatically ignore empty tabs
- ๐พ JSON-based session storage
- โก Lightweight with no external dependencies
๐ธ Preview
Review, restore, or permanently discard unsaved scratch buffers.
๐ฆ Installation
lazy.nvim
{
"dmshvedchenko/persist.nvim",
config = function()
require("persist").setup()
end,
}
packer.nvim
use {
"dmshvedchenko/persist.nvim",
config = function()
require("persist").setup()
end,
}
๐ Quick Start
Once installed, persist.nvim works automatically.
When Neovim exits, it saves:
- tabs
- windows
- split layouts
- unnamed scratch buffers
The next time Neovim starts, the plugin restores your previous session.
If scratch buffers are found, you'll be prompted to:
- restore all notes;
- review notes one by one;
- permanently discard unwanted notes;
- postpone restoration until later.
No additional configuration is required.
๐ค Why not :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:
- preview every scratch buffer;
- restore only the important ones;
- permanently delete unwanted notes;
- automatically forget empty tabs.
๐ Commands
| Command | Description |
|---|---|
:PersistSave | Save the current session |
:PersistRestore | Restore the last saved session |
๐ Storage
Session metadata is stored in:
stdpath("state")/persist/session.json
Scratch buffers are stored in:
stdpath("state")/persist/scratch/
๐ Requirements
- Neovim 0.10 or newer
๐บ Roadmap
Planned improvements include:
- native
:help persistdocumentation - configurable behaviour
- restore hooks
- optional automatic restore
- CI and automated tests
Suggestions and feature requests are always welcome.
๐ค Contributing
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.
๐ License
MIT