Use The Dot (Luke)


Edits actions in VIM are recorded.

Say that you just deleted a line (by typing dd). The editor knows you deleted a line. You can repeat the edit (that is, delete another line) by pressing the period key (".").

You can even apply the standard pattern and give a register, repeat, and then a dot (the dot knows the command and movement).

This is particularly handy if the command you last used was cw. It will repeat the replace operation on the text under the cursor.

Because the dot command repeats the last edit you did, it is one of the most powerful keys on the keyboard.

You should learn to rely on it. It is one of the most wonderful things VIM gives you.

No comments:

Post a Comment