Vim undo: undo changes after file write

There’s persistent undo option in vim, :h persistent-undo
Note: It was introduced in VIM 7.3 version, so for earlier versions, it will not work.

It can be turned on by placing the following text in your .vimrc:

if has('persistent_undo')      "check if your vim version supports it
  set undofile                 "turn on the feature  
  set undodir=$HOME/.vim/undo  "directory where the undo files will be stored
endif     

Note: Before enabling this option, whatever was lost, remains lost.
After enabling the option, you will be able to do subsequent undo/redo on whatever was added/deleted after enabling the option.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)