384 points · by jandeboevrie · 2mo ago · 346 comments
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.
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.
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
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.
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.
I would consider deleting my persistent undo state, which would be something that I would have specifically enabled, to be "severely impacting".
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).
Needing to know in advance that neovim requires a specifying a different undodir to vim, because neovim's persistent undo format is unstable even though vim's is stable, but the feature is called the same thing and neovim bills itself as a plug and play replacement for vim...
This is very predictably going to lead to loss of user data.
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.
Two programs that save their cache in the same folder causes issues.
Unlike Dr. Chisnall, I started my editor journey on Neovim, so it wasn't a transition that bit me. However, if the format of the persistent undo file is unstable, and Neovim just deletes it when it doesn't recognize the previous format, then it seems conceivable (to me) that an upgrade after changing the format would delete the file too.
Ouch. This is making me think about getting off of Neovim. Yes, FOSS comes as-is, but if there's an alternative...
I could see ignoring the old undo data or warning before discarding it but just silently wiping it is so user hostile it’s hard to comprehend.
To me it's a bit like storing your important files in a ramfs and then complaining that your OS doesn't respect user data when it crashes. Sure, it's not exactly a documented behaviour of the system, but you're also not storing your data in a place the developers of the OS expected you to put important data.
So exactly the opposite of persistent undo?
The short-termism changes little here, losing weeks' worth of work just because you deleted it recently by mistake and then upgraded with the app deleting the undo, is also bad
If not, I wonder how Google justifies it.
Google is abysmal. In every sense of the word and in every product they touch.
Edit: some great examples in the replies here, thanks! Perhaps I should start using it in editors that support it, never gave it a thought before.
It doesn't matter whether or not you can think of a reason you would want to enable it, but it should be pretty trivial to do so. Once you've enabled it, it should work.
I can give some as well. IDE crashes. Computer reboots at an undesired time. Even if my work is saved, I am not “finished”. I would like my undo history to extend before file / open time.
Second (for servers), etckeeper
#!/bin/sh
errecho() {
>&2 printf '%s\n' "$@"
}
if [ "$#" != 1 ] || [ -z "$1" ]
then
errecho 'Requires a single filename as the argument'
exit 1
fi
ORIGINAL=$1
if [ "${ORIGINAL#./}" == "$ORIGINAL" ] && [ "${ORIGINAL#/}" == "$ORIGINAL" ]
then
ORIGINAL=./"$ORIGINAL"
fi
# because of course the output of dirname can't be blindly joined with slash and the basename
DIRNAME=$(dirname -- "$ORIGINAL")
if [ "$DIRNAME" = / ]
then
DIRNAME=
fi
FILENAME=$(basename -- "$ORIGINAL")
# because of course extracting the filename's extension is not supported out of the box
case "$FILENAME" in
.*.* )
EXTENSION=.${FILENAME#.*.}
BASENAME=$(printf '%s' "$FILENAME" | cut -c-$((${#FILENAME} - ${#EXTENSION})) )
;;
.* )
EXTENSION=
BASENAME=$FILENAME
;;
*.[^.]* )
BASENAME=${FILENAME%%.*}
EXTENSION=${FILENAME#*.}
;;
* )
BASENAME=${FILENAME%%.*}
EXTENSION=$(printf '%s' "$FILENAME" | cut -c$((${#BASENAME} + 1))- )
;;
esac
if [ "$FILENAME" != "$BASENAME$EXTENSION" ] || [ -z "$BASENAME" ]
then
errecho 'Failed to properly split the extension from the filename:' "$FILENAME"
exit 1
fi
TIMESTAMP=$(date --utc --date=@"$(stat --format %Y "$ORIGINAL")" +'_%Y-%m-%d_%H%M%S')
if [ -z "$TIMESTAMP" ]
then
errecho 'Failed to get the timestamp of the file:' "$ORIGINAL"
exit 1
fi
NEW_FILENAME=$(printf '%s/%s_%s%s' "$DIRNAME" "$BASENAME" "$TIMESTAMP" "$EXTENSION")
if [ "$NEW_FILENAME" = "$ORIGINAL" ]
then
errecho 'Somehow the name for the backup is the same as the original file'
exit 1
fi
# this preserves the timestamps somewhat better
if ! mv --no-clobber --no-copy -- "$ORIGINAL" "$NEW_FILENAME"
then
errecho 'Failed to backup the file: ' "$ORIGINAL" "$NEW_FILENAME"
exit 1
fi
if ! cp -- "$NEW_FILENAME" "$ORIGINAL"
then
errecho 'Failed to backup the file: ' "$ORIGINAL" "$NEW_FILENAME"
mv --no-clobber --no-copy -- "$NEW_FILENAME" "$ORIGINAL"
fi
Actually, nevermind that bullshit, you know what? I think I'd prefer to have an editor with locally persisted edit history instead.I didn't know about persistent undo until seeing this posted here on HN, but now I've enabled it! Of course, turns out it's an unreliable feature on nvim... maybe I'll consider switching back to the original (for that and other reasons).
Moreover, the vim history tracking is amazingly advanced. It's almost like a mini version control system. I highly recommend getting to know it.
`:earlier 1d`.
persistant undo is like a second brain to consolidate.
Bare vi does not have windows, visual selection mode, multiple level undo, color schemes, etc.
NVim wants to improve some defaults, which cannot be done if it is beholden to all legacy code. That being said, I still think this specific undo example is insane.
Vanilla Vim added it in 2016 I think, but by that time I had already fully switched to NeoVim and it didn't seem worth it to me to switch.
That fell apart when people wanted vim to do some more modern IDE kind of things like all the “… on save” stuff (build on save, test, lint, etc). I think LSP support is native in neovim as well.
I believe vim merged asynchronous plugin support a while back though, so I’m not sure how different they really are anymore.
As far as really cool uses for tree-sitter go, ast-grep is a fantastic tool. Of course it's a standalone program, so it doesn't need nvim to make use of it.
This seems however more like of a documentation and UX problem. Neovim should warn and ask before deleting old undo files, or at least back them up, but it's not neovim's fault if people don't use reliable backup and versioning systems. Relying on persistent undo for this is kind of a self inflicted wound.
Use the proper tools for the job. Saying that neovim developers "had no concept of a duty of care to their users" is really disrespectful. Neovim's Lua API is overflowing with care, you just need to go look.
The feature's name has "persistent" in it.
For example applying the recover file (well it's a huge pitfall in vim on its own) resets not only the current undo history but also the "persistent" one.
They don't get a pass because you disagree with an imagined use case.
[0]: In spite of the author at Unsung saying that Neovim is "in news" for other reasons. Chisnall's account is being given in the immediate context of that news.
Seems so. As smart as keeping tabs open in browser instead of using bookmarks, but "workflow".
But it is a nice feature.
I do that by using version control. I have it hooked to my editor so that "save" is "check in". Now I have persistent, versioned, copies of all my states independent of whatever tools I happen to be using.
You do not have all your states available.
I just tried it in Nextcloud Notes on Android (FlorisBoard has undo/redo buttons), and it seems to work this way. If I type a bunch of words quickly and hit undo, it removes all of them. If I stop for a couple seconds between each word, it undos them one-by-one.
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`.For example, a common scenario is rolling back a file via git, which triggers this reset. However, considering they treated it as a reliable version control system without actually reading the documentation, they probably aren't using git anyway.
The good news for them, however, is that they actually can bypass this limitation and treat their undo history like version control—by using nvim-fundo [1]. The catch is that they'll have to switch to nvim, as there isn't a direct equivalent for vim.
1. [nvim-fundo](https://github.com/kevinhwang91/nvim-fundo)
The way I personally remember it being positioned was “Vim, but with breaking changes.”
The original author of this post (on Mastodon) appears to have a bone to pick with Neovim since it's "platforming white supremacists"? I couldn't figure out what this meant. Some sort of internet drama I guess.
That's the wrong way to look at it. NeoVIM has a different concept of care for their users. They're optimizing for another kind of care, more in line with modern expectations, which VIM did not care about (hence the fork).
It's not better or worse, just different.
This same article could've been written about how VIM has no native LSP integration or autocomplete and they don't have duty or care for their users.
Persistent undo exists to recover from an accidental write-and-quit mid-session nuking some stuff you really didn't intend to delete. If you care about its contents beyond a handful of hours, you either need to adopt proper version management, or start making backups.
Reading the PR the change was needed because the old undofile format was fundamentally broken. They considered making an undofile-upgrade mechanism, but it would've caused more issues that it would've solved. In other words: stuck between a rock and a hard place.
A duty of care also means occasionally having to break things to make it better, or else you end up being stuck with spacebar heating[0] forever. As a user it does suck, but that's the price you have to pay for using actively-developed software.
That's one use case, sure, but not the only possible one.
> Reading the PR the change was needed because the old undofile format was fundamentally broken.
That's a good reason to have a new undo file that's completely separate from the old one, and use the new one instead, and tell users "Hey, whatever undo information you had in your old undo file isn't accessible any more through neovim, you'll have to use vim if you need to get to it."
It's not a good reason for just deleting the old undo file with no warning. All the new version needs to do is ignore it, not nuke it.
"All software should be shit because most software is shit"
Relax for a second. Get some perspective.
On that board, silently deleting a user's files is obviously justified. What would be out of line is complaining about software silently deleting user files.
[1] Long ago. Galaxy far away.
```markdown
abhorrent
/əbˈhɒr(ə)nt/
Abhorrent is an adjective that means morally very bad, hateful, or causing strong disgust and loathing.
```
I realise that this causes strong disgust and loathing in you, but can you please expand upon how it's morally very bad to prioritise speed and ease of use over undelete capability in Neovim? Are you unable to make backups or use Git?
> Are you unable to make backups or use Git?
Ah yes, the old perty theft justification as applied to intentionally-inflicted data loss; "They won't mind if I take/delete this, they (should) have insurance".
People are making it sound like this is a huge company with a product and not a grouping of curious people with a couple hours of free time on a Sunday.
Most likely they never thought about it, then it broke, then it was not impactful enough to fix on their free time compared to other stuff.
https://github.com/neovim/neovim/pull/13973#issuecomment-789...
If it's really just a toy with no expectation of not unexpectedly destroying user data then they ought to make that more clear.
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.
The undodir option in vim defaults to the directory of the file, and in neovim it defaults to ~/.local/state/nvim/undo/.
Or in the OPs case, installed a totally different application and was surprised by an incompatibility.
https://neovim.io/news/2021/07/
Differences from Vim are also documented, but this issue isn't mentioned there either.
https://neovim.io/doc/user/vim_diff/
Also, what's up with people claiming that the undo files are stored under ~/.cache? That's completely made up. Or that persistent undo doesn't persist edit history, against what the docs say. Utter nonsense.
https://neovim.io/doc/user/undo/#_5.-undo-persistence
Users don't expect their editor to cause data loss after a routine `brew update`. Blaming users for that is unreasonable.
> 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] https://en.wikipedia.org/wiki/Filesystem_Hierarchy_Standard#...
[1] https://specifications.freedesktop.org/basedir/latest/#varia...
You just can't point the finger at file system standards, or shoulda-read-release notes or whatever.
There is no such thing as "by mistake, we historically stored persistent files in a directory with 'cache' in its name, contrary to a popular standard, so that makes it okay to trash them now".
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.
(Or rather, you can, but you will likely be disappointed.)
We can speak, respectfully, of how important backwards compatibility is to us, and ask nicely for them to give more of their time to support it when their free sodftware isn't backwards compatible. Perhaps we can even offer to help implement it.
But they have no duty to do so or to "care" for their users. (They have already demonstrated they care for their users, btw, by giving them free software.)
EDIT: I missed an important part of the story, which is that they mutated existing files in a non-backwards compatible manner. That should have been avoided, I understand where the (secondary) author is coming from now.
I don’t care if you’re volunteering your time; if you build something whose implied purpose and success depends on other people using it, you emphatically have a duty to those people not to silently destroy stuff that was there before your software was.
If I fork chromium, I do not get to claim that I am a chromium maintainer.
Vim and Neovim are two seperate programs.
Even a gift comes with an implicit promise that it will do no harm. Deleting important data of yours without warning is harm.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.That's such an obvious category mistake that I'm not sure how to respond. It almost feels like a bad-faith interpretation of Wichary's original point.
This is a great example of why. Most humans have a sense, deep down, that contracts often exist to bridge the gulf between the ethically defensible and the legally defensible.
It's hard to imagine that any sane person who is just looking to use a popular editor would read some broad limitation of liability language like the above, and interpret it to mean, "By the way, we intend to quietly delete certain files created by a competing fork of this project whenever we find them."
It's true that contracts with liability limitation clauses like this are an absolute necessity in this day and age. But there's also a non-legal principle of mutual respect that is absolutely necessary to a healthy open source community.
“Ow, the gas pedal is actually a bear trap.”
“Why are you complaining? It’s free!”
But actually there is! They didn't start from scratch. They took another very successfull and beloved project with the promise "to make it better". There is some promise here and the duty not to make it worse.
How many neovim users were made aware that the software would proactively delete their decade-long file history?
This is the extreme version of "I enjoy coding but I hate users."
It may be legally valid in absolute technical terms, but I'm going to take a lot of persuading that it's a healthy attitude.
And for what it's worth, I have flagged your comment for the inevitable pointless bickering it has precipitated. While applying reductionist frameworks and seeing where they lead is a necessary part of an individual's path to understanding, please avoid pushing ignorant assertions ("there is no duty here") as if they might constitute well reasoned truths.
By that logic, if Facebook gives away their services for free then they don't have the duty to protect their user's privacy and mental health?
And even mentioning that results in "fork it if you're not happy" which immediately turns everyone off who's had to maintain a fork to fix a minor issue in something before. And anyone who can't fork it is being told to go to hell.
Everyone needs to quite frankly get off their high horse, crank the ego down and listen to users. Because you're damaging open source with the attitude.
30 years ago, things were better. They got a lot worse, particularly since github appeared.
Yes, OSS can start with just a passion without a duty, but as the scale grows you have a duty to make sure it does not have adverse effect.
If you don't like the duty, just make it die by building it crappy like VIM does.
How does this translate to the vim situation?
The only way to "fix" this from a source code perspective would be to fork Neovim.
It is counterintuitive in the same manner as when excel persists undo history chronologically across the running application process, and not separately per document.
Similarly AutoCAD intersperses application parameters and tool configurations alongside actual data operations in it's undo history.
And why my .vimrc starts with this:
set nobackup
set nowritebackup
set noundofile
set noswapfileDon't forget time travel: `:earlier 7d`
People of Raskin's vintage had a very humanist approach to computing. The mentality was very much an outgrowth of the cultural revolution of the 60s. Computer usage should be joyful rather than toiling. The computer should help you. It should make you feel good about what you create.
That stands in stark contrast today, where things are more hostile. Not just in terms of "Dark patterns", or writing off user needs for the sake of expediency... but even the way we talk about technology today. You need to use X, do Y or you're "not going to make it" / "escape the permanent underclass". It's bleak.
I recently restored a vintage Macintosh SE I picked up at VCF Midwest and despite its limitations that machine was an absolute JOY to use despite its limitations and nearly 40 years of age. This was a machine and software designed by Raskin's contemporaries and it shows.
That's just how people market things these days, preying on desperation and fear of missing out. It's not how normal humans talk, I hope.
And look at this article’s HN discussion. Many people indignantly defending it. “It’s open source. If you don’t like it deleting your data, don’t use it!”
Maybe we aren’t so rare. I can think of another group that values enduring hardship over progress making things easier for everyone.
This story is about software being a slow, deliberate process where a lack of gatekeeping can lead to data loss. This is the type of problem which is getting worse.
Of the over a hundred students I taught when I helped out in uni, basically no one wanted to learn it, despite my enthusiasm.
And I sympathise. As I get older, I slowly grow more and more distaste for software that does not respect my time enough to give me properly-crafted defaults. Vim, in the age of modern editors, cannot compete. Not without 20 plugins with conflicting shortcuts and its self-imposed cliff of a learning curve.
And I’m saying this from a place of love; I’ve been using Vim (at least as a VSCode extension) every day for the last 10 years. But it never really grew up to the promise that the “Vim Creep” essay [1] gave me.
[1]: https://web.archive.org/web/20190227031109/https://www.norfo...
:wq
As for default plugins, it'd be neat if they curated a set of optional ones, but nothing should be preinstalled.
I dream of a Vim that wóuld guide and teach me how to use it, so that it does not scare away people because they can’t close it.
I dream of a Vim that embraces the needs of editing contemporary programming languages and fills in its UX gaps correspondingly (changes single to double quotes, anyone? Function argument order?).
I dream of a Vim with native Git gutters.
I dream of a Vim with sane default leader commands.
I dream of a Vim where I see line numbers by default.
I dream of a Vim where “Y” is consistent with other commands.
I dream of a Vim that detects correct indentation by default. And that can visualise whitespace.
I dream of a Vim where Ctrl+V does not have an assigned action that looks like it blocks input.
I dream of a Vim that experiments with keyboard ergonomics, not just mnemonics.
I dream of a Vim where quintuple-tapping Escape is not a habit I subconsciously form why learning it.
I dream of a Vim I stumble on people discovering and exploring, and not have to persuade people for months just to try it.
Not on by default, you have to enable it in your .nanorc (not least because you need to provide a backup folder where you want to store these backups).
Very handy. Occasionally I've deleted files accidentally or made destructive changes, and could restore a working version from the past as if I had a timemachine.
Such amazing design...
" Enable persistent undo set undofile
Making privacy-sensitive features opt-in is a form of duty of care as well, to avert harm from the user.
They have very vocal and entrenched users so that practically no defaults can be changed lest the single Amiga user will start a huge uproar.
And since they don't really have a BDFL or commercial pressure, they can be super detached even from standards or expectations that appeared 40 years ago.
Neovim was basically a reaction to that, for Vim, where they updated defaults to stuff basically every Unix editor since 2005 has.
Driven by <3, passion and bravery.
Anyhow; I switched back to vim after one year of neovim shrugs. Still a Junior, here.
This was the end of the original Mastodon. Which is why I just can't with Mastodon or Bluesky. Casually tossing around ridiculous claims to back up an opinion on persistent undo.
I don't know if this story is true, but you can't defend it when taken at face value.
Just by trying Neovim you can lose your vim undo file.
The point was they did it in a completely stupid way and responded to a bug report about it in a way that suggested this might not be just the occasional stupid that we've all had slip into our code.
Some people just want to keep looking at the gift horse in the mouth.