‹ BackHN Continuity

Thread

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

384 points · 346 comments · jandeboevrie

  1. jeremyjh · · focus · HN ↗
    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.

    <a href="https:&#x2F;&#x2F;github.com&#x2F;neovim&#x2F;neovim&#x2F;pull&#x2F;13973#issuecomment-789262094" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;neovim&#x2F;neovim&#x2F;pull&#x2F;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 &quot;just use a different path&quot; more complicated at a minimum and really changes my read of this situation completely. I think Neovim&#x27;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&#x27;t really agree they had a moral duty to do this.

    1. soraminazuki · · focus · HN ↗
      The feature that was broken is called persistent undo. The docs unambiguously state that edit history will be preserved unless Vim&#x2F;Neovim detects that the &quot;undo file is no longer synchronized with the file it was written for.&quot;

      <a href="https:&#x2F;&#x2F;neovim.io&#x2F;doc&#x2F;user&#x2F;undo&#x2F;#_5.-undo-persistence" rel="nofollow">https:&#x2F;&#x2F;neovim.io&#x2F;doc&#x2F;user&#x2F;undo&#x2F;#_5.-undo-persistence

      So even putting aside the Vim&#x2F;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&#x27;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&#x27;m sure many still have ~&#x2F;.config&#x2F;nvim&#x2F;init.vim symlinked to ~&#x2F;.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&#x27;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.

Open on Hacker News to reply ↗

Unofficial Hacker News client; not affiliated with Y Combinator.