Vim Scoops / Lessons / Repeat the last change
How to repeat the last change in Vim
Press . to repeat your last change at the cursor. Delete a word with dw, move somewhere else and . deletes a word there too.
The keys
| Keys | What they do |
|---|---|
| . | Repeat the last change |
3. | Repeat it with a new count |
| u | Undo, if it went somewhere you didn't mean |
A change is anything that edits text: dd, x, p, or everything you typed between i and Esc. Moving the cursor isn't a change, so it doesn't get in the way.
The pattern is: make the change once, move, press ., move, press .. Pair it with n after a search and you can work through a file match by match.
Related
Want all of Vim, in order? Vim Scoops is a free game that starts at h j k l and builds up to macros.
Play the full game