Vim tip 10: Undo and Redo
In Normal mode, you can undo and redo changes using the following commands:
- u undo last change
- press u again for further undos
- U undo latest changes on last edited line
- Ctrl+r redo a change undone by u
- U redo changes undone by U
See :h 32.3 for details on g- and g+ commands that you can use to undo branches.
Video demo:
See also my Vim Reference Guide and curated list of resources for Vim.