A usable VIM Undo tree

As some may have heard, vim stores your actions (and undos) as a tree, which is great. With vim 7.3 there is even a option to persist these changes between session. But with vanilla vim this tree is pretty much unusable.

A friend showed me a great plugin which gives vim git-like super powers by showing undos in a tree, together with a patch view with the gundo plugin.

This plugin, together with persistent undo files feels almost like when i have used ctrl-r for the shell the first time!

Configuration

Grab vundle for VIM, install it.

Add these lines to your vimrc:

Bundle 'sjl/gundo.vim'
nnoremap <F5> :GundoToggle<CR>
set undodir=~/.vim/undo
set undofile
"maximum number of changes that can be undone
set undolevels=1000000
"maximum number lines to save for undo on a buffer reload
set undoreload=10000000

In vim run :BundleInstall , you can now toggle the undo bar with <F5>.

Comments