In Vim, I did too much undo. How do I undo this (that is, redo)?
To undo a change in Vim/Vi type u , and to redo a change which was undone use the Ctrl-R key sequence. Vim also supports undo branches . Feel free to leave a comment if you have any questions.
Hit ctrl-z, and fire up vim with the new stuff you want. When you're done, quit the current vim session and come back to your old context with `fg`. The key observation is this stacks inductively, so you cant tumble down the dependency rabbit hole and always come back to the context you were at originally.
To undo an action, press Ctrl + Z. To redo an undone action, press Ctrl + Y. The Undo and Redo features let you remove or repeat single or multiple typing actions, but all actions must be undone or redone in the order you did or undid them – you can't skip actions.
Undo changes in vim / ViType u to undo the last change. To undo the two last changes, you would type 2u . Press Ctrl-r to redo changes which were undone. In other words, undo the undos.
Ctrl+r
Also check out :undolist
, which offers multiple paths through the undo history. This is useful if you accidentally type something after undoing too much.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With