Vim Copy and Paste

Command mode commands

The most important commands are y to yank (copy) and p to paste. And not to forget d to delete. The yank and delete commands put text into registers. Without further information, the default register is used.

Command Meaning
yy copy the current line to the default register
dd delete the current line placing it in the default register
p paste the content of the default register right of or below the cursor
P paste the content of the default register at the position or above the cursor
"ayy yank (the line) into named register a
"ap paste content of register a

see also: :help copy-move

Special registers

The following registers can be used like the named registers a to Z, but they contain special information or have more functions.

Register Function
"* X11 middle-mouse selection (copy by selecting with the right mouse button and paste with the middle mouse button)
"+ X11 clipboard (Edit -> Copy/Paste or Ctrl-X/C/V)
"/ last search term
": last vi command (entered after : in the bottom line of the editor)

social