O'Reilly logo

Mastering Vim by Ruslan Osipov

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Copying from outside of Vim

There are two built-in registers that interact with the outside world:

  • The * register is the primary system clipboard (the default clipboard in Mac and Windows, and mouse selection inside a Terminal in Linux)
  • The + register (only in Linux) is used for Windows-style Ctrl + c and Ctrl + v operations (referred to as Clipboard selection)

You can interact with these registers as you would with any other. For instance, you can use "*p to paste from the primary clipboard or use "+yy to yank a line into Linux's Clipboard selection.

If you want Vim to work with these registers by default, you can set the clipboard variable in your .vimrc file. Set it to unnamed to copy and paste from the * register:

set clipboard=unnamed ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required