DEV Community

Colin Bartlett
Colin Bartlett

Posted on • Originally published at

VimTrick: The clipboard register

Ever need to copy something into and out of Vim? There's a built-in way to do that and it's called the * (star) register. The star register is a register like any other in Vim but it's contents are that of your system clipboard.

You can get data out of Vim by putting it on your system clipboard:

  • “*yy - Yank the current line into your * register, the system clipboard
  • “*yap - Yank Around Paragraph: copies the whole paragraph, method, or function

And you can get data out of system and into Vim by pasting it from your system clipboard:

  • “*p - Paste from the system clipboard below the current line
  • “*P - Paste from the system clipboard above the current line

I've got a full write up and a short screencast over on VimTricks.

Top comments (0)