persist.nvim

July 27, 2026 ยท View on GitHub

CI Neovim

License

Latest Release

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

persist.nvim demo

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

CommandDescription
:PersistSaveSave the current session
:PersistRestoreRestore 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 persist documentation
  • 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