← Sun, Sep 27 digest

On caring for user data: NeoVim caused Vim undo files to be deleted

read article ↗ hn thread ↗

NeoVim changed its persistent undo file format and deleted incompatible existing files, prompting a fierce debate on software compatibility and user data preservation.

summary is enough The short core post captures a common frustration, but the comment thread is essential for uncovering the technical nuances behind shared undo directories.

summary

Computer scientist David Chisnall criticized Neovim for deleting his persistent undo files during an upgrade, citing a violation of the duty of care toward user data. Hacker News commenters quickly added crucial context, noting that the data loss occurred because the user explicitly shared a single undo directory between Vim and Neovim. Additional discussion highlighted that undo files reside in ephemeral cache folders and that Vim itself routinely discards persistent undo histories under external modifications.

key points

  1. Neovim updated its persistent undo format, overwriting incompatible files found in its path rather than migrating them.
  2. Commenters clarified that this data loss scenario requires sharing the exact same undodir path between distinct editor binaries.
  3. Standard filesystem hierarchy guidelines classify application undo histories in cache directories where long-term persistence is not guaranteed.

who should read it

Vim and Neovim users and software developers interested in backward compatibility and state management.

discussion skeptical

consensus

Commenters initially joined in criticizing the data loss, but the consensus shifted toward nuance after discovering the user shared an undo directory between two different editors.

pushback

Some argued that robust software should never silently delete existing files on disk without warning or attempting a migration, regardless of shared configurations.

best comment by justinmk ↗

Vim undofile "data loss" happens because Vim (VIM!) will reset the undofile will reset the undofile if an external tool (git, nano) changed the file while Vim is not running.

Go ahead, try it:

# Make some edits, then exit vim (remember to exit). vim --clean +'set undofile' foo.txt

# Edit the same file with non-vim; save the changes. nano foo.txt

# Open the file again and try "u". Then post on bluesky about Vim's "duty of care". vim --clean +'set undofile' foo.txt

This is documented at `:help undo-persistence`.

It points out that standard Vim also discards persistent undo files when external tools modify a file, challenging the idea that Vim treats this data with absolute safety.

Generated by an LLM from the article and thread. Check the sources before relying on it.