From Vim’s documentation (:h quotequote):
Vim fills this register with text deleted with the “d”, “c”, “s”, “x” commands or copied with the yank “y” command, regardless of whether or not a specific register was used.
Vim calls this the unnamed register, which is a sweet oxymoron. I prefer to call it the default register.
Here are descriptions of a few simple commands that interact with the default register:
| command | description |
|---|---|
| x | cut one character and write it to default register |
| dd | cut one line and write it to default register |
| yy | copy one line into default register |
| p | put text from default register after cursor |
There’s more to the p command than meets the eye: its behavior differs subtly depending on whether the register contains a characterwise or linewise region of text (see :h linewise-register). When the default register contains a characterwise region of text, the p command puts the text after the current character. Whereas when the default register contains a linewise region, the p command puts the text after the current line.
Even though xp, ddp, and yyp each consist of two separate commands, we can think of each pair as forming an aggregate command:
| commands | description |
|---|---|
| xp | toggle characters |
| ddp | toggle lines |
| yyp | duplicate line |
You can explicitly tell Vim that you want to paste the contents of the default register by prefixing the p command with "" (that is, doublequote twice). Of course, ""p and p are equivalent, since the default register is used by default.
Further reading
- :h
linewise-register - :h
quotequote - :h
x - :h
dd - :h
yy - :h
p