Command | Description |
---|---|
. | Repeat the last change |
The dot command repeats the last change, including the last command and its motion or text object.
Command | Description |
---|---|
; | Repeat last f, t, F, or T motion |
, | Repeat last f, t, F, or T motion in opposite direction |
n | Repeat last search in same direction |
N | Repeat last search in opposite direction |
@: | Repeat last Ex command |
@@ | Repeat last executed macro |
Scenario | Commands | Description |
---|---|---|
Change multiple occurrences | cw[new text]<Esc>n.n.n. | Change word, then use n to find next occurrence and . to repeat change |
Delete multiple lines | dd..... | Delete a line and repeat with . for subsequent lines |
Append to multiple lines | A[text]<Esc>j.j.j. | Append text to end of line, move down, and repeat |
Change inside multiple parentheses | ci([new text]<Esc>n.n. | Change inside parentheses, find next pair, repeat |
Technique | Description |
---|---|
Combine with counts | Use 3. to repeat the last change three times |
Use with visual mode | Make a change in visual mode, then use . to repeat on next visual selection |
Combine with macros | Record a macro, execute it, then use . to repeat the macro's effect |
Two-step repeats | Use ; to repeat a motion, then . to repeat a change |