Categories
Vim

Vim: How to Copy Text into a Specific Register in Command Mode

Syntax

:[range]y[ank] [x]

The yank command yanks (copies) selected text into the register x.

:[line]pu[t] [x]

The put command pastes the text from register x after a specified line.

Examples

:1,10y a

Copies text from the line 1 to line 10 into the register a.

:1,10y

Copies text from the line 1 to line 10 into the unnamed register.

:23pu a

Puts the text from register a after line 23.

:23pu

Puts the text in the unnamed register after line 23.

Displaying the contents of registers

Display the register list with :reg.

:reg[isters]

Leave a Reply

Your email address will not be published. Required fields are marked *