jeremyjh
5 hours ago
This story has no references that support the author's version of events, but it does appear to be substantially true that:
1. The change would break undo history, for both Neovim and Vim [see edit: this is not the really the case]
2. This means Neovim would delete data created by a different program, on another user's computer.
3. This was known before the feature was released.
4. They did it anyway.
I don't think there can really be any post-hoc justification of this.
https://github.com/neovim/neovim/pull/13973#issuecomment-789...
edit: I missed an important detail. The user specified the same path for undodir in both nvim and vim. Vim requires a path to enable the feature - there is no shared default path. The user sharing a path changes the story considerably in my view, because now this is a case of nvim deleting data created by nvim as an alternative to writing a data migration for it.
I could still disagree with that, but it makes alternatives like "just use a different path" more complicated at a minimum and really changes my read of this situation completely. I think Neovim's decisions are justfiable in this context. Maybe they could have saved the contents of the old undo folder somewhere and notified the user - arguably that would be more empathic I don't really agree they had a moral duty to do this.
soraminazuki
2 hours ago
The feature that was broken is called persistent undo. The docs unambiguously state that edit history will be preserved unless Vim/Neovim detects that the "undo file is no longer synchronized with the file it was written for."
https://neovim.io/doc/user/undo/#_5.-undo-persistence
So even putting aside the Vim/Neovim interoperability angle, that contract was broken. Undo files created by old versions of Neovim will be deleted by more recent versions.
The interoperability issue can't be ignored either. Neovim was touted as a drop-in Vim replacement, and that needs to be taken into account when considering how changes affect users.
So many Neovim users have started by reusing their existing vimrc. I'm sure many still have ~/.config/nvim/init.vim symlinked to ~/.vimrc to this very day. With Vim, persistent undo is opt-in. Vim users who cared enough to opt in are highly likely to have explicitly set the path for undo files too. That's because Vim defaults it to the same directory as the file being edited, which clutters the filesystem. As a result, there are many users who shares undo files between Vim and Neovim simply because they reused their vimrc, not because they made the conscious choice to do so.
dtech
5 hours ago
The data is stored in ~/.cache which has the contract that it user-wide cached data, which also means it can be deleted without severely impacting programs.
It seems the author has too high expectations of this feature, or vim is using an incorrect path to store this is they want to make it available more reliably
soraminazuki
3 hours ago
That's some weird technicality that has nothing to do with the issue while also being completely false.
https://github.com/neovim/neovim/blob/fc3f0041fbe01c96f38224...
The feature that was broken is called persistent undo. The feature was inherited from Vim. In case it's not obvious from the name, nowhere does it state in the docs for persistent undo that data may be deleted at any time.
https://neovim.io/doc/user/undo/#persistent-undo
That Neovim changed the default storage path for undo files is completely irrelevant to whether the contract for persistence should be broken.
MatthiasPortzel
3 hours ago
NeoVim docs say it defaults to "$XDG_STATE_HOME/nvim/undo//". Do you have a source for ~/.cache?
buu700
4 hours ago
This reads to me like a case of blame on both sides. Putting data you don't want to lose in ~/.cache is PEBKAC, but if that fact is incidental and NeoVim would have removed the undo history regardless of its filesystem path, then the point remains valid that NeoVim is deleting user data that isn't its place to delete.
A lot of the comments here are getting caught up in legal arguments which may or may not be valid. Those are irrelevant. No one is taking the NeoVim developers to court; the post is merely warning that they knowingly accepted behavior which can cause harm. The question is whether or not that choice was responsible, not whether it's legally actionable.
user
4 hours ago
user
4 hours ago
wonnage
4 hours ago
So if a program decided it owned .cache and deleted it every startup you’d be fine with it?
yjftsjthsd-h
2 hours ago
Honestly, kinda? It'd be rude and cause a performance regression, but it shouldn't break anything.
dtech
4 hours ago
What a weird straw-man. The comparison here is a program breaking compatibility with a file in ~/.cache/... and deleting it instead of providing compatibility. I'd do that without thinking about it twice.
freehorse
2 hours ago
I don't see it as a strawman. The comparison here is a program breaking compatibility with a file _used by another program_. If vim and neovim undo files are incompatible, why does neovim delete vim's file instead of using its own file name/extension and not caring about vim's undo? And why do they use the same subdirectory even? To me it is a case of a program deleting cached files of another program, which, as a user, I see as deleting user data that said program should have touched.
Insanity
5 hours ago
I switched from Vim to NeoVim this year, after about 15 years on Vim.
Not withstanding this incident, I would say that on the whole it has been a good experience with Neovim. (I didn’t actually ever use the persistent undo functionality in vim. Guess because of VCS it’s less needed for my use-case).
schmichael
5 hours ago
Same timeline for me, but this was my 3rd or 4th attempt at switching. Not sure if something materially improved or maybe LLMs finally just got good enough at helping me convert.
Insanity
2 hours ago
Hadn’t tried previously, but will say that LLMs definitely helped me.
johnnypangs
4 hours ago
But you still have to share the undodir for both vim and neovim right? If your undo data was that precious why would you gamble the interoperability? You could just have them in different folders and it would be fine.
So the case is, you really need you undo history and want to try out neovim so you just copy paste you vimrc to the new place and accidentally delete your data? I don’t think it’s that bad personally. It’s bound to happen but it’s not automatic.
johnnypangs
4 hours ago
I have a far less sensationalist headline for this which is:
Two programs that save their cache in the same folder causes issues.
user
4 hours ago
user
4 hours ago
loeg
5 hours ago
It was ostensibly necessary for other, arguably more important features. Persistent undo maybe just isn't that important? I certainly don't use it nearly as much as the author seems to.
jeremyjh
4 hours ago
Why not give it a different name, so that it would not break vim?
loeg
4 hours ago
Just editing the primary file without corresponding update to persistent undo record already breaks persistent undo. Do you prevent users from editing their own files in your text editor?
user
4 hours ago
ludicrousdispla
5 hours ago
maybe they tried to undo the change, but were not able to