DarkMatter in Cyberspace
  • Home
  • Categories
  • Tags
  • Archives

Communicate System Clipboard with Vim in Linux


Linux Mint Xfce

By default, Ubuntu (so as to Linux Mint) installs the vim-tiny package, which is a ultra-light version of the console "vim" only.

To check the clipboard support of the installed vim, run vim --version|grep clipboard. If you get "-clipboard" and "-xterm_clipboard", your vim can't support system clipboard. You have to remove current vim, and install a "full" version vim like this:

$ sudo apt-get purge vim 
$ sudo apt-get autoremove # remove related packages of vim 
$ sudo apt-get install vim-gtk # gtk suited for Xfce environments

Now let's check:

$ vim --version | grep clipboard

You should get something like "+clipboard" and "+xterm_clipboard".

Now connect vim clipboard with that of system with adding "set clipboard=unnamedplus" into you ~/.vimrc. And check it:

  1. Copy texts in web browser with Ctrl-c, and use "p" to paste them in vim;

  2. copy a line in vim with "yy", then paste them into some GUI program (say, gedit) with Ctrl-v.

Ref:

how to copy from vim and paste it on system clip board

vim-gtk or vim-gnome?

ArchLinux

Install gvim with sudo pacman -S gvim.

Note: On CentOS, use yum search vim to get the exact vim package name. On CentOS 6.4 it's "vim-X11".



Published

Dec 19, 2013

Last Updated

Dec 19, 2013

Category

Tech

Tags

  • clipboard 2
  • linux 158
  • vim 92
  • xfce 16

Contact

  • Powered by Pelican. Theme: Elegant by Talha Mansoor