undo and redo in vim

2019-09-17

 | 

~1 min read

 | 

125 words

Sometimes Vim is simultaneously impossible opaque and extraordinarily intuitive. That’s the case with the undo and redo.

To undo the last change, type u. To redo the last change, type ctrl+r.

These make plenty of sense as keybindings once you think about it - but until you’re told, it’s unlikely you’d come up with them on your own.1

There’s also a U keybinding which returns the last line modified to its original state (i.e. it reverses all the changes made). U, however, is not a true undo, but actually a change. That means it can be undone itself.

To access the vim manual enter a vim editor and while in the command mode, type :help undo.

Footnotes


Related Posts
  • Vim: Command Cheatsheet


  • Hi there and thanks for reading! My name's Stephen. I live in Chicago with my wife, Kate, and dog, Finn. Want more? See about and get in touch!