Copy to system clipboard instead of vim buffer

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.


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

See

:help clipboard
:help 'clipboard'

have a try :

"+y   and    "+p

this works for me, on Ubuntu.