On OS X Mavericks, Apple ships Vim version 7.3 with -clipboard
. Here's the gist from running /usr/bin/vim --version
on Mavericks (and the same on Mountain Lion). Shame on you Apple!
If you use Homebrew, you can get Vim with +clipboard
by running:
brew install vim
Here's a gist from running /usr/local/bin/vim --version
.
Alternatively, you could download MacVim. Look inside /Applications/MacVim.app/Contents/MacOS
, and you'll see that the app provides two binaries: MacVim
, which launches the GUI, and Vim
, which runs in the Terminal with the same feature set. Both versions include the +clipboard
feature. Here's a gist from running /Applications/MacVim.app/Contents/MacOS/Vim --version
.
If your Linux distribution ships Vim with the +clipboard
feature, leave a comment saying which distribution you use. If not, read on.
I don't run a desktop Linux environment, so I ran some tests against Ubuntu 12.04 inside Vagrant. The default vi
binary has -clipboard
(gist of vi --version
). If you attempt to run vim
, it prompts you to install a package:
vagrant@precise32:~$ vim --version
The program 'vim' can be found in the following packages:
* vim
* vim-gnome
* vim-tiny
* vim-athena
* vim-gtk
* vim-nox
Try: sudo apt-get install <selected package>
I tried installing each of these and found that vim-gnome
, vim-athena
, and vim-gtk
each included the +clipboard
feature. I've created a gist from running vim --version
for each of these packages: vim-gnome, vim-athena, and vim-gtx. The vim and vim-nox packages both had -clipboard
. Shame!
Robin Skahjem-Eriksen wrote to me with a tip: you can run GVim inside the terminal by launching it with the gvim -v
command. That could be handy if your distribution ship vim
with -clipboard
, but also ships gvim
with +clipboard
.
If you have any more tips on how to obtain Vim with the +clipboard
feature, please share them in a comment.
Being able to access the system clipboard from Vim is essential. It's a nuisance that so many systems ship Vim without the +clipboard
feature! I'd like to see that change. Please make the information in this article obsolete by campaigning to have +clipboard
enabled by default on your system.
See also https://stackoverflow.com/a/57313409/3794873