In this section:
Basics
The Undo command discards the last changes to the file in the editor. The Redo command discards the results of the last Undo command.
You can undo or redo your changes as many times as required. However, when you exit IntelliJ IDEA, the undo history is lost.
IntelliJ IDEA smartly defines the logical steps that can be undone and redone. The following events signal about the end of a logical step:
- Pressing ⏎ or ⏎⏎ or ⏎⏎ or ⏎Enter, ⏎ or ⏎Enter, ^ M, ⏎, ⌃M, ⏎ or ⌃M.
- Repositioning the mouse cursor.
- Using navigation keyboard shortcuts.
- Cutting or pasting.
- Pressing Tab.
IntelliJ IDEA expands the undo and redo mechanism to complex operations, such as reformatting or refactoring source code, creating or deleting files. When you undo or redo a complex operation, IntelliJ IDEA requests on your confirmation.
Undoing and redoing changes
- On the main menu, choose .
- Press ⌘Z or ⌘Z⌘Z or ⌘Z⌘Z or ⌘Z^ Z, ⌃Z or ⌃Z^ ⇧ Minus, ^ Slash, ⌃⇧-, ⌃/, ⌃⇧- or ⌃/.
- On the main menu, choose .
- Press ⇧⌘Z, ⌥⇧⌫, ⇧⌘Z or ⌥⇧⌫⇧⌘Z, ⌥⇧⌫, ⇧⌘Z or ⌥⇧⌫⇧⌘Z or ⇧⌘Z^ Y, ^ ⇧ Z, ⌃Y, ⌃⇧Z, ⌃Y or ⌃⇧Z^ ⇧ Z, ⇧ ⌥ Minus, ⌃⇧Z, ⌥⇧-, ⌃⇧Z or ⌥⇧-.