How do I get vim to keep its undo history?

The newest version of vim (7.3) has persistent undo, so that you can make a change, close vim completely (even shutdown and restart), restart vim, and undo. In your .vimrc:

" tell it to use an undo file
set undofile
" set a directory to store the undo history
set undodir=/home/yourname/.vimundo/

Looks like this will do it:

:set hidden

(in .vimrc)


You can use Viewports.
"vim -o testfile1 testfile2" - open files in splitted window.
":sp filename" - split and open "filename".
":vsp filename" - vertical split and open "filename".
"Ctrl+w+arrow" - Change viewport.