On caring for user data: NeoVim caused Vim undo files to be deleted
Thread
Unofficial Hacker News client; not affiliated with Y Combinator.
On caring for user data: NeoVim caused Vim undo files to be deleted
Unofficial Hacker News client; not affiliated with Y Combinator.
RVuRnvbM2e · · focus · HN ↗
They live in ~/.cache which is defined as "user-specific non-essential (cached) data".
Despite this user's impressive résumé, they simply misunderstood the feature.
kazinator · · focus · HN ↗
tremon · · focus · HN ↗
> Application cache data. Such data are locally generated as a result of time-consuming I/O or calculation. The application must be able to regenerate or restore the data. The cached files can be deleted without loss of data.
Meaning: the persistence of such files is not guaranteed across application restarts. If vim (and also neovim) had intended for the undo files to outlive the program, the files should have been put in ~/.local/state instead -- as also explicitly documented by the XDG [1]:
> [XDG_STATE_HOME] may contain: [..] current state of the application that can be reused on a restart (view, layout, open files, undo history, …)
[0] <a href="https://en.wikipedia.org/wiki/Filesystem_Hierarchy_Standard#mwATw" rel="nofollow">https://en.wikipedia.org/wiki/Filesystem_Hierarchy_Standard#...
[1] <a href="https://specifications.freedesktop.org/basedir/latest/#variables" rel="nofollow">https://specifications.freedesktop.org/basedir/latest/#varia...
maxnoe · · focus · HN ↗
That's a break of the contract then, right? The application was not able to regenerate or restore.
Cache is the wrong place for a persistent undo file.
[deleted] · · focus · HN ↗
[deleted]