VIM Tips & Tricks #1 Persistent undo

Some friends of mine praise a lot big IDEs for having change history of file between sessions. They used to laugh at VIM until the moment, I told them that, VIM had this feature since ~2010.
Interested in using it? You can setup it easily in seconds!

Setting up persistent undo

First, you have to set `undofile` and `undodir` in your .vimrc.


" Setup persistent undo
set undofile
set undodir=~/.vim/undodir

Next, you have to create directory to store your undo data. Run `mkdir ~/.vim/undodir`.

You can set any directory, but I’d recommend to create separate directory, because it’ll create new file for every opened file in VIM. If you use some custom directory for it, please remember about changing it in your config.

If you’d like to get more tips & tricks for VIM, you can follow me on twitter/facebook or subscribe to push notifications(red mark in the left down corner of the page).

One thought on “VIM Tips & Tricks #1 Persistent undo

Leave a Reply

Social media & sharing icons powered by UltimatelySocial