editing

yy

'Yank' (copy) the current line into the unnamed register — Vim's word for copy. Combine with p/P to duplicate lines without touching your system clipboard.

yy  (normal mode)

Variations

Keystroke Effect
3yy Yank 3 lines starting from current
y$ or Y Yank from cursor to end of line (Y differs from D/C, which act line-wise)
yw Yank to start of next word
"+yy Yank line into the system clipboard (needs +clipboard build)

Examples

yy

Copy current line

5yyp

Copy 5 lines and paste them below

"+yy

Copy current line to system clipboard

Gotcha

Historical wart: Y in stock Vim behaves like yy (yank whole line), not y$. Many people remap Y to y$ to match D and C — check your config.

Related

← All Vim commands · Vim cheat sheet