simnalamburt / vim-mundo

:christmas_tree: Vim undo tree visualizer

Home Page:https://simnalamburt.github.io/vim-mundo

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Feature: Undo or Redo a Specific Change in the Undo Tree?

CharlesARoy opened this issue · comments

Apologies if I missed something in the docs that explains whether this is possible.

I'm wondering whether Mundo (or any other Undo Tree manager you're aware of) has the ability to undo (or redo) a specific change in the undo tree without reverting the entire file to that state? Sort of like doing a git merge of those lines back into the current version of the file.

For example, say I add a few lines to a file and then decide to undo them and continue coding elsewhere. Then, at a later point, I change my mind and decide that it would have been better to keep the lines I removed. Is there a way to add them back to the file without reverting the entire file back to the state it was in when those lines were removed?

If this isn't possible, is there a way to move the cursor to the preview window so that I can yank those lines to the clipboard to add back manually?

Sort of possible - you can pull up the undo tree in this plugin, go back to the specific undo your interested in and hit the 'd' key. This will 'vim diff' that specific change against your current file. You can then pull in whatever changes your interested in using the standard diff mappings (do, dp, :diffget and the like)

@dsummersl that works very well, thanks for the help!