Vim and system clipboard in Arch

Joaquin L. Pereyra
Avalanche of Sheep
Published in
1 min readSep 16, 2015

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.

--

--