Vim and system clipboard in Arch

Joaquin L. Pereyra
Sep 16, 2015 · 1 min read

There’s something that has always anoyed me when using vim: I couldn’t seem to access to the system’s clipboard. Copy (or yank) would work great as long as I didn’t try to copy something outside of vim. This, of course, is a problem. After a long time of simply trying to ignore the problem after a few failed attempts to try to solve it, the solution basically came upon me. Someone on the Arch linux subreddit had the same problem I did.

Turns out vim doesn’t pack with +xterm_clipboard on Arch Linux. Why? Your guess is as good as mine. This option is necessary for accessing the system clipboard. So you have two options: either you compile vim by yourself with +xterm_clipboard, or you can install gvim.

# pacman -S gvim

This will tell you vim and gvim are in conflict. This is intended behavior, just go ahead: you’ll still have vim (plus gvim, the graphical interface of vim) installed after pacman finishes.

Now you can edit your ~/.vimrc file and add a line that maps Ctrl+C in visual mode to “copy selection to the system clipboard”.

vmap <C-c> "+y

Restart vim and that should be it.

BTW, if when you copy something to vim the indentation gets all crazy, this plugin will fix it right away.

Avalanche of Sheep

a notepad for my future self

Joaquin L. Pereyra

Written by

No sé cómo hackearte el facebook.

Avalanche of Sheep

a notepad for my future self

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade