Pages

Monday, August 27, 2012

Vim Persistent Undo (Undo persistence)

Enable persistent undo
vi  ~/.vimrc
#Location of undo data
set undodir=~/.vim/undodir
#By setting the 'undofile' option, Vim will automatically save your undo history
#when you write a file and restore undo history when you edit the file again. (udf)
set undofile
#Maximum number of changes that can be undone.(ul)
set undolevels=1000
#Save the whole buffer for undo when reloading it.(ur)
set undoreload=10000

Create undodir
mkdir ~/.vim/undodir


Now, you can undo even you quit vim.

No comments:

Post a Comment