How to undo specific line in vim

vim

I have lots of modifications in a file, but I want to undo specific line to initial state which keep other lines at current state.

Is there a way to do it in vim?

Best Answer

  • There is no built in way to undo a line.

    What I usually do is to undo u until I am at the changes I want to keep, copy the line or block of text and then do a :e! to reset the file and paste the changes.

    A great plugin that I use for more complex changes is Undo Tree