The Repeat command, executed with the dot or period key (.), is more useful than it first appears. Once learned, you will find yourself using it often.
Command | : | Description |
---|---|---|
. | Repeat the last change | |
10. | Repeat the last change 10 times |
So then, for a very simple example, if you make a change to line 1 by typing iI
Esc, with the following result:
1 I made a mistake
2 made a mistake
3 made a mistake
Your cursor will be at position 1 of line 1, and all you need to do to fix the next two lines is press j. twice - that is, j to move down a line and . to repeat the last change, which was the addition of the I
. No need to jump back into Insert Mode twice to fix those lines.
It becomes much more powerful when used to repeat macros.