How can I undo all changes to a block of text in vim?
Asked Answered
M

1

4

Is it possible to select some text with visual line and undo all changes made to it from the beginning ?

Maria answered 10/2, 2010 at 10:39 Comment(0)
G
5

I actually do that by undoing everything yanking the block then redoing everything to the last modification and then replacing the block with the yanked text.

Galiot answered 10/2, 2010 at 10:41 Comment(5)
+1 May be ok when block fits on the screen and there are not many things to undo/redo. Troublesome otherwise.Maria
why does it need to fit in the screen? but yes, the undolevel matters.Alecto
or you can save the file to a different name and then comparing the two versions with vimdiff - this solves the undolevel problemAlecto
@KARASZI It doesn't "need" to. But is easier for me to manipulate with.Maria
I would like to note that multi-level undo requires 'set nocompatible', which is not default.Maria

© 2022 - 2024 — McMap. All rights reserved.