Copy to system clipboard in VIM

You might have noticed that when you copy something from vim and try to paste somewhere else (maybe your browser), then it doesn’t work.

First of all you need to install the following packages:

sudo apt-get install vim-gnome

Most probably, vim-gui-common package will get automatically installed with it.

Now, you may confirm it using:

vim --version | grep 'clipboard'

If it says +clipboard then you are good to go. At present, my vim version is 7.4.52.

Now open any file with vim, and select text using v or V. Then press “+y to copy it to system clipboard. And “+p to paste in another vim file.

I found this helpful on vim wikia:

vim wikia

Advertisements

One thought on “Copy to system clipboard in VIM

  1. Pingback: Vim tweaks | Mandeep Singh

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s