One of the coolest Vim features is the ability to record keystrokes (in both insert/command mode), so that the same actions can be repeated at different points in the file.

Using registers

There are times when you may wish to keep several items in the clipboard, but yanking only with y will overwrite the clipboard every time it is used. Registers are, effectively, separate clipboards to which you can save text. Registers a, b, ..., z are free to store text.

"ayy save the current line to register a
"ap print contents of register a
"by yank selection into register b (Visual mode)
:reg + Enter see the contents of all the registers

The registers 1, 2, ..., 9 store the most recent deletes with d, while register 0 holds the most recent yank only using y.

Recording keystrokes

Similarly to using registers to save text, you can also record keystrokes to registers a, b, ..., z. This will allow you to repeat edits you make on one line (to other lines). Note that you will need to use i and <Esc> to change to Insert/Command mode during the recording.

qa start recording keystrokes to register a
q stop recording
@a execute keystrokes from register a on current line
2@b execute keystrokes from register b on the next two lines

Note: All the commands above are executed in Command mode.