Linux – Copy to system clipboard instead of vim buffer

clipboardlinuxvim

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.

Best Answer

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'