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:
- Undo until the deleted text appears again
- Yank the text into some register
- Redo the undo history until I'm at the "current" version again
- 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.
git log -p
andgit log -p -S 'regex_for_change'
. I'm not aware of any vim feature (or Gundo feature) that lets you specifically target a part of the diffs. For example, it is very easy to add power togit log -p
by just using the search inless
, but this can't be done in Gundo.loop until undo is not available { search "the string"; undo one step; }
. Undo status is available through Vim’sundotree()
function.