Copy/paste to and from the system clipboard in Vim

May 17, 2010 by Merlin

Users accustomed to CTRL+C/V keyboard shortcuts may find themselves reaching for the mouse when using gVim or Vim in a terminal because aforementioned commands do not work by default. So, how to do it?

Short answer would be to select a text in a Visual or Select mode, type "+y and you have the selected text in a system clipboard. If you need to paste, position your cursor where you want it and type "+p. "+ is just a register, so you can use different yank/put commands with it like "+6yy or "+gP.

Long answer would be … well, long. Vim uses registers "+ and "* to communicate with other applications. How it does that depends on the operating system Vim runs on.

Read the rest of this entry »