Undo in Vim (Linux)
Press u to undo the last change.
What it does
Each press takes back one more change. A change is everything done by one Normal mode command, or everything typed during one stay in Insert mode, so leaving Insert mode now and then gives smaller undo steps. Redo brings an undone change back. Vim keeps the history of changes for as long as the file is open.
The same shortcut on other platforms
| Platform | Shortcut |
|---|---|
| Linuxthis page | u |
| macOS |
More Vim shortcuts: Editing
- Redo
- Repeat Last Command
- Delete Character
- Delete Line
- Yank (Copy) Line
All 30 Vim shortcuts for LinuxThe full list has a search and a printable PDF.
Questions
What is the Vim shortcut for Undo on Linux?
u. Press it to undo the last change.
What is the shortcut for Undo in Vim on macOS?
On macOS it is U.