3

After making a couple of changes in an xml file opened in Vim I pressed :undolist and got the following output. Is there any way I can see the actual changes? Also what is the difference between number and changes columns? I see the numbers are always the same.

 number changes  time
         2       2  10 seconds ago
Geek
  • 26,489
  • 43
  • 149
  • 227
  • The plugin [gundo](http://www.vim.org/scripts/script.php?script_id=3304) gives a visual representation of the undolist. – FDinoff Jul 23 '13 at 15:34
  • Very similar to [How is VIM's undo tree used?](http://stackoverflow.com/q/1088864). – glts Jul 23 '13 at 17:11

1 Answers1

4

if you :h undolist, difference between number and changes is explained. in short, number is a sequence number, changes are how many changes were made on that leaf.

If you want to go back to a earlier state, you could check :h earlier

I recommend a very nice undo plugin: https://github.com/sjl/gundo.vim with this you could view the states in history, without really applying them, until you find the right state.

Kent
  • 189,393
  • 32
  • 233
  • 301
  • 1
    +1. Gundo.vim is a great plugin to transverse history especially with persistent_undo. If you are more of a visual learner there is a nice vimcasts about undo branching: http://vimcasts.org/episodes/undo-branching-and-gundo-vim/ – Peter Rincker Jul 23 '13 at 15:43
  • 1
    Or use the alternative [undotree.vim - Display your undo history in a graph](http://www.vim.org/scripts/script.php?script_id=4177) plugin; it does not require Python like _Gundo_. – Ingo Karkat Jul 23 '13 at 15:47