WindowsmacOSLinux

Where Does Neovim Store Shada and Swap Files?

Neovim persists session state in shada files, crash swaps, and optional undo files under its data and state directories. Config is elsewhere.

Last updated

Neovim separates config from state cleanly. Your init files live in the config directory, while everything the editor remembers goes to data and state: shada files for registers, marks, and command history, swap files for crash recovery, and optional undo files for cross session undo.

Most users meet these files through the swap prompt after a crash. That prompt is doing its job. Recover first, verify the buffer, and only then remove the swap. Shada corruption shows up as lost marks and registers; deleting the shada file resets that state safely.

Where Neovim stores this, by platform

Windows
%LOCALAPPDATA%\nvim-data\shada\main.shada

Shada main file plus swap and undo siblings under data and state dirs. Answer the recovery prompt before deleting anything. Wipe main.shada to reset registers and marks.

macOS
~/.local/share/nvim/shada/main.shada

Same split as Linux. Config stays in .config while state lives here, so dotfiles repos should exclude these paths.

Linux
~/.local/share/nvim/shada/main.shada

Data dir holds shada, state dir holds swap and undo. Check the swap directory neighbors of the shada path when hunting crash leftovers.

Frequently asked questions

Neovim says a swap file exists. How do I recover?

Reopen the file and accept the recovery prompt, or run the recover command explicitly. The swap file holds unsaved changes. Delete it only after confirming the recovered buffer is complete.

Can undo survive a restart?

Enable persistent undo with an undo directory, then undo survives restarts. Without it, closing the buffer discards the undo tree along with the swap.

Notice an outdated path? Let us know.