The Vim undofile is purged when the file is edited outside the editor.
How can I get it so I can revert the file to older versions even if it was edited outside of Vim? Is this possible?
You can use vim backup:
set backup " enable backup file
set backupdir=~/.vim/backups " backup directory
then you can go and grab the last backup vim saved in case you want to revert after an external edit but this is not like undofile. From vim wiki:
However, note that if a file is modified externally without Vim, Vim will not be able to read the undo history back when you start editing the file again and the undo tree information will be lost. There is no way to get it back.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With