1

We can use the u, <C-R> to undo/redo in Vim and it provides a lot of features to manage the undo tree.

But sometimes, I make a change (let say on line 1) and I go do some other changes on another line.

When I come back to line 1, I may think that the previous value of this line was better.

My current workflow is:

  • undo until I get the value back
  • yank the line
  • redo until the top of the undo tree
  • replace the line.

I think this clearly can be improved, but do you know if there is a vim feature that provide an history of changes for each line?

  • For the 1st step, you can use :changes - the most recent value on the 2nd column that matches the line number you want to redo has a change number (1st column) associated with it, that can be used as a count to g; (add one to that count number). – VanLaser May 10 '16 at 22:10
1

This sounds like you are in dire need of https://github.com/sjl/gundo.vim. Watch a screencast about it at http://screenr.com/M9l

  • I use undotree, but I've used Gundo in the past, and I don't remember it having this feature (that is, the linewise history). – nobe4 May 10 '16 at 16:34
1

You might want to take a look at undotree. Its pure vimscript and uses vim's undo-tree feature added in 7.0

  • I use it, and I've used Gundo in the past, and I don't remember any of them having this feature (that is, the linewise history). – nobe4 May 10 '16 at 16:35
  • 2
    No, neither undotree nor gundo has linewise history. I've looked in the past for a plugin to do this without results. The benifit is you can much more easily perform your current workflow...same workflow I use. – jecxjo May 10 '16 at 16:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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