Learn Vim at your own pace with my self-study Core Vim Course.

Learn more

Learn Vim at your own pace with my self-study Core Vim Course.

Getting Vim with `+clipboard` support

Many systems ship with a version of Vim that was compiled with the -clipboard feature disabled, which is a damned nuisance! Being able to access the system clipboard from Vim is an essential feature. Let’s look at a few ways of getting the +clipboard feature on OS X and Ubuntu.


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.

On Linux

On desktop Linux systems the clipboard is handled by the X window system. Most systems that use X11 will ship a version of Vim with the +clipboard feature. If your desktop Linux distribution ships with Vim without the +clipboard feature, you should be able to install a Vim package that provides this feature, e.g. each of these packages for Ubuntu provides Vim with +clipboard: vim-gnome, vim-athena, and vim-gtx.

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.

When Linux runs on a server it doesn’t usually include X11. In this environment, it makes sense for Vim to be built with the -clipboard feature disabled. Some Vim packages are intended for systems without X11, such as the vim-nox package. It’s possible to install packages on a Linux server that would add the +clipboard feature for Vim, but doing so would also install X11 and all its dependencies. That’s probably not a good idea.

Can we fix this?

Being able to access the system clipboard from Vim is essential. It’s a nuisance that some desktop 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.

Update: I’ve revised this article, because my understanding of Linux was terribly flawed. You can find the original draft here. Thanks to Will Gray for his patient explanations.


Level-up your Vim


Boost your productivity with a Vim training class. Join a public class, or book a private session for your team.

Drew hosted a private Vim session for the shopify team that was one of the best workshops I have ever attended.

John Duff, Director of Engineering at Shopify


Make yourself a faster and more efficient developer with the help of these publications, including Practical Vim (Pragmatic Bookshelf 2012), which has over 50 five-star reviews on Amazon.

After reading it, I've switched to vim as my default editor on a daily basis with no regrets. ★★★★★

Javier Collado

Learn to use Vim efficiently in your Ruby projects

In association with thoughtbot, one of the most well respected Rails consultancies in the world, I've produced a series of screencasts on how to make navigating your Ruby projects with Vim ultra-efficient. Along the way, you’ll also learn how to make Ruby blocks a first-class text object in Vim. This lets you edit Ruby code at a higher level of abstraction. Available to buy from thoughtbot..