Ad blocker interference detected!
Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers
Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.
." command repeats the last change made in normal mode. For example, if you press
dw to delete a word, you can then press
. to delete another word (
. is dot, aka period or full stop).
@:" command repeats the last command-line change (a command invoked with "
:", for example
You can move the cursor before using either of the repeat commands.
Suppose you press
dd to delete a line. Next, you might move the cursor, then press
5 then dot). That will delete 5 lines.
In normal mode, press
J to join the next line onto the current line. Press
. to join more lines.
Or, you might use insert mode to type "
hello ". Press Esc for normal mode, then move the cursor, and press
. to insert "hello " again.
Copy a word to multiple locationsEdit
yiw to copy the current word. Move the cursor to a new location, then type
ciw<C-R>0<Esc> to change the word, replacing it with the copied text. After moving the cursor to a new location, press
. to repeat the operation (the current word will be replaced with the word that was originally copied). See replace a word with yanked text.
Copy a line to multiple locationsEdit
Move the cursor to the wanted line and press
Y to copy it. Move the cursor to a new location, then press
p to paste the line after the current line, or
P to paste before the current line. After moving the cursor to a new location, press
. to repeat the paste.
It is also possible to paste the copied line over the destination (replacing the current line). To do that once, copy the wanted line with
Y, then move to the destination, press
V to visually select the destination line, then
p to paste the copied line over the selected line.
A different procedure should be used if the replace operation needs to be repeated. Move the cursor to the wanted line and type
0y$ to copy the line, without the line ending (
0 moves to the beginning of the line;
y$ copies to the end of the line). Move the cursor to a new location, then type
S then Ctrl-R then
0 then Escape). After moving the cursor to a new location, press
. to repeat the operation (the current line will be replaced with the line that was originally copied).
S deletes all text from the current line (but not the line ending) and starts an insert operation. In insert mode, pressing Ctrl-R inserts the contents of a register. Register
0 (zero) contains the text that was copied with
- Using command-line history
- Repeat command on each line in visual block
- Recording keys for repeated jobs
- Repeat last colon command
- Repeating an ex command on multiple blocks
- Repeat last command and put cursor at start of change