Persistent undo functionality in vim
Tags: software, howtos
Sometimes, it is the small things that make my day. I recently discovered that recent versions of vim offer a persistent undo functionality. This means I can edit my files, close them, and still be able to undo changes when I open them the next time. How cool is that?
The activation could not be simpler. Just place the following in your
set undofile set undodir=$HOME/.vim/undo
The file path in
undodir should refer to an actual directory in your
directory, so it might need to be created first. Furthermore, you can use the
undoreload to specify how many changes can be
undone at most and how many modified lines should be saved, respectively.
I love vim more and more every day.