The simplest solution to this, that also works between different Linux machines through ssh
is:
Check whether vim supports X-11 clipboard:
vim --version | grep clipboard
. If it reports back-clipboard
and-xterm_clipboard
you should install eithervim-gtk
orvim-gnome
(gvim on arch linux)Add the following lines to your
.vimrc
:
set clipboard=unnamedplusset paste
- If you login on a different machine via ssh, use the option -Y:
ssh -Y machine
Now copying and pasting should work exactly as expected on a single, and across different machines by only using y
for yank and p
for paste. NB modify .vimrc
on all machines where you want to use this feature.