How to make vim’s undo buffer persistent across sessions

undovim

When I make an edit to a file and then leave vim, I would like to be able to undo that change when I reopen it later.

Best Answer

You can turn on persistent undo, check the help with

:help undo-persistence

At least vim 7.3 is required.

undo-persistence needs some setup before use, like defining a directory to keep the persistent undo information. A good explanation is given here: http://amix.dk/blog/post/19548 (thanks to @Dalker)

Related Question