yy (yank line)
What is yy (yank line)?
yy (yank line): Vim: copy ("yank") the current line into the register. In Vim, yy yanks, or copies, the current line into a register. Paste it with p below the cursor or P above it. A number in front copies several lines: 5yy copies five. Like other Vim commands, y combines with motions. yw copies a word, y$ copies to the end of the line, and yi" copies everything inside quotes.
Frequently asked questions about yy (yank line)
What should you keep in mind with yy (yank line)?
Yanked text goes into Vim's own registers, not the system clipboard, unless you use the + register, as in "+yy, or set clipboard=unnamedplus. That is the usual reason copying in Vim seems not to work in other applications. Knowing yy, dd and p already covers most of the copying and moving you need when editing a config file on a server.
At a glance
| Category | Keyboard shortcuts |
|---|---|
| Explained by | Reinier de la Parra |
| Updated |