Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I would like to set Y and P to copy and paste directly to the system clipboard instead of vim buffer.

I don't want any additional commands. Just the normal ones, but they should copy to and paste from the system clipboard and bypass the vim buffer.

How can I achieve this?

I'm running vim on Ubuntu 10.10.

share|improve this question
up vote 7 down vote accepted

You can have Vim use the clipboard instead of the default register for yanking, putting, etc., by adding this command to your ~/.vimrc:

set clipboard+=unnamed


:help clipboard
:help 'clipboard'
share|improve this answer
I had to use set clipboard+=unnamedplus as per The * register doesn't copy to my clipboard when I'm running vim from a terminal (which is always). – cledoux Mar 3 '15 at 20:36
For Arch (around 2016-04), I did: set clipboard=unnamedplus – hodgkin-huxley Apr 22 at 14:46

You first need to see if vim is compiled with clipboard support, run vim --version | grep clip and see if there is a + or - in front of clipboard and xterm-clipboard.

If it has clipboard support, copying from and pasting into the * or + registers should use the system/X11 clipboards, so "*yy would copy a line and "*p would paste it.

In Ubuntu 10.10 you can install vim-gnome to have clipboard support compiled in.

share|improve this answer
I tried both this and the method above but I can't get it to copy to system clipboard. It works fine inside Vim though. – Owais Lone Nov 12 '10 at 9:56

have a try :

"+y   and    "+p

this works for me, on Ubuntu.

share|improve this answer
This one works for me, not the * version. Why are people reporting different things? – trusktr Apr 6 '13 at 7:37

The default VIM in Ubuntu is vim-tiny, which is not compiled for system clipboard support. You need to install the full VIM and the Gnome GUI to get clipboard support:

sudo at-get install vim-full vim-gnome

After you install those two packages you can then use the commands that Akira and wliao mentioned.

share|improve this answer

yank to the clipboard register:


paste from the clipboard register:


for more information:

 :help clipboard
share|improve this answer
It doesn't work. Works fine in Vim itself but does not seem to affect the system clipboard. – Owais Lone Nov 10 '10 at 8:11
Oh, it's not working because my version is 7.2 and this seems to be supported in 7.3 only. – Owais Lone Nov 10 '10 at 8:22
Then why not upgrade? – harrymc Nov 29 '10 at 20:33
It works for me exactly as described, except using +. "+yy.... Why? – trusktr Apr 6 '13 at 7:38
@trusktr: look at the answer of steabert. – akira Apr 6 '13 at 15:49

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.