Yank and Put

Yank is copy. Put is paste. The register knows whether it's a line or a span.

Keys: y, yy, Y, yw, y$, p, P

y is the yank (copy) operator. p puts after the cursor; P puts before. The register remembers whether it holds characters or whole lines, and that decides where the put lands.

y is yank โ€” Vim's word for copy. It's an operator, like d and c, so it takes a motion: yw yanks a word, y$ yanks to end of line, yy yanks the whole line.

Whatever you yanked sits in the unnamed register, ready to be put with p (after the cursor) or P (before).

Yank current line (linewise)
KeyNote
y
y
Yank current line (= yy by tradition; some configs map to y$)
KeyNote
Y
Yank a word
KeyNote
y
w
Yank to end of line
KeyNote
y
$
Put after cursor / below line
KeyNote
p
Put before cursor / above line
KeyNote
P
yy โ€” yank a line
Y โ€” yank line
p โ€” put after
P โ€” put before
yw / y$ โ€” yank a span

Reference

Key Action Type
y{motion} Yank range Inherits from motion
yy Yank current line Linewise
Y Yank line (vi) or to end-of-line (nvim default) Linewise / charwise
p Put after cursor / below line โ€”
P Put before cursor / above line โ€”
gp Like p but leave cursor after pasted text โ€”
]p Put + adjust indent to context โ€”
"{r}p Put from register {r} โ€”

Worked example โ€” yy then p

Copy a line, paste below.

Step 1 ยท
editing.yank-put
Step 2 ยท yy ยท yy โ€” line into unnamed register.
yy โ€” line into unnamed register.

Buffer unchanged. The unnamed register now holds 'bravo\n'.

Step 3 ยท p ยท p โ€” pasted below.
p โ€” pasted below.

Linewise paste opens a new line beneath. Capital P pastes above.

โ–ถ Try this in the simulator

See also: Delete, The Unnamed Register, Named Registers, The Universal Grammar