Is there an easier way to find a particular change in Vim's undo tree than just looking at random old versions of the file one at a time (either using vanilla VIM commands, Gundo, or another plugin)?

Ideally, I'd like to enter a search pattern to be matched against all of the diffs shown in the preview pane by Gundo, and then have Gundo show me which versions have diffs that match that search.

This question asks something almost identical, but the asker has accepted an answer that simply recommends Gundo, which, wonderful though it is, doesn't appear to do what I'm asking for.

I have pitched this as a new feature for Gundo, but received no response.

EDIT: There is an open request for this feature for undotree.

NOTE: This question has been "manually migrated" from superuser.

  • Note: plugin-gundo would be a good tag for this question, but unfortunately that tag doesn't exist yet, and I have no rep. Commented Feb 25, 2015 at 19:22
  • 1
    There's also undotree. I don't know how exactly it's different from gundo, or if it supports the feature you want, but you could check it out. Commented Feb 25, 2015 at 20:00
  • 2
    Bump! If you check the Gundo issue, someone has posted a fork that provides a searching feature. Commented Mar 16, 2015 at 22:25
  • @joeytwiddle I saw that! Haven't checked it out yet, though. Commented Mar 17, 2015 at 2:27

2 Answers 2


In some cases, this might be enough:


Unfortunately it doesn't show a complete summary of your editing history. It appears to show only the line of text which you landed on after each change.

That is good enough to display all single-line inserts or edits, but only the last line of a multi-line insert, and no deleted text.

It can only be searched visually, not automatically, although you could grab this command and then do:

:PipeCmd changes | less

which would allow searching with /. Or just pipe to grep instead of less.

An alternative way to search that list would be to install the Unite plugin and then do:

:Unite change
  • 1
    Hm. Since doing a search-and-replace can make the word(s) being replaced completely invisible to changes, that's not terribly useful. What I'd really like is to be able to do :%s/foo/bar/g, then do a search for foo that would (reconstruct and) show me the last version of the file in which foo was present. Commented Feb 26, 2015 at 18:42

There is now a gundo fork called "mundo" with this feature.

While in the undo-tree window, / will search the history rather than the text displayed in the window itself.

(Note: this feature appears to have been adopted from a different gundo fork. I'm not sure where credit for the implementation belongs, and I have not tried both forks to see which one works better.)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.