I did this yesterday. However IntelliJ had my back. It's History feature has saved my bacon on more than one occasion.
One time I was able to go back weeks to fetch some code I'd long since deleted and was nowhere to be found in git.
One time I was able to go back weeks to fetch some code I'd long since deleted and was nowhere to be found in git.
" persist undo history to file / across sessions
set undofile
set undodir=$HOME/.vimundo
" max out history length
set history=9999
set undoleves=9999999999
set undoreload=10000
(Don't forget to mkdir "$HOME/.vimundo".)Combine that with https://github.com/mbbill/undotree and you can easily walk the entire history of every file you edit.
(Well, the other big gripe is that when I'm forced to use a program with crippled undo, e.g. any Microsoft product ever, I'm frustrated up the wall. The worst-in-class award goes to Word with Endnote, where many Endnote commands wipe your entire undo history. How people can use that on a permanent basis is beyond me.)