Vim Command to Copy a Line


Yank a Line

I suggest you take the blue pill and forget about how yanking text works. If you want to find out how far down the rabit hole goes ... you can read about "registers" below.


One & Done

yy yank line

Registers

The line is yanked into the “unnamed register”. You can think of the “unnamed register” as just the scratch space that stuff is copied to and pasted from. This is the only register I ever use.

But, if you need to be fancy, there are 10 different kinds of registers that can be used for all sorts of madness. Tim Pope’s Fugitive is a great example of what can be accomplished with Vim’s registers.