Search in Vim’s undo history

undovim

I have a "weird" usage pattern in vim that I often use – or have to use, depending on how you view it.

What normally happens is this: I enter some text, do some editing, then remove a bit of text again. Some time in the future, I figure that this deleted bit of text would again be useful, so the following happens:

  1. Undo until the deleted text appears again
  2. Yank the text into some register
  3. Redo the undo history until I'm at the "current" version again
  4. Paste the yanked text

What I'm wondering is this: Is there a way to search for something in the undo history of a file, so I won't have to undo dozens (or hundreds) of undoes to get to the right version?

Note that I'm explicitly not looking for an "external" VCS like Git or Subversion – I'm trying to search for changes before even having to save a file to disk.

Best Answer

It looks like what you want to do is the exact use case for Gundo.

Related Question