by justinmk · 2mo ago · 0 comments
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)