Skip to content
Vim
Learn/

Copy and Paste Lines

17 / 51

Basic Operators

Copy and Paste Lines

Yank lines and place them above or below the cursor.

yy writes a complete line to the unnamed register. p places linewise text below the cursor and P places it above.

Use yy, p, and P in the editor beside this lesson. Practice is where you learn it, with the answer a click away; the Test is graded, unaided, and the only thing that marks this lesson complete.

Keys in this lesson

yy
Yank the whole line
p
Paste after the cursor, or below for a whole line
P
Paste before the cursor, or above for a whole line
All 91 keys →

Practice to learn it. Test to prove it.

Practice keeps the answer a click away — endlessly in Free, or as a 15-goal run against par and your own best time in Timed. The Test gives you 8 goals with no hints and a keystroke budget on each; passing it is what marks this lesson complete.

yyp

Yank the line under the cursor and paste a copy below it.