If your Vim supports the system clipboard (i.e. if vim --version
output shows +clipboard
), you can copy into the system clipboard from the first Vim and paste from it into the second one. This releaves us of the need to ensure the receiving Vim is in insert mode and has paste
set appropriately.
The trick is to use the "+
register. So when you do the copy, prefix whatever yanking command you want to use with "+
; and do likewise prefix the put command you use in the receiving Vim with it.
If you're on an X11 system, you can also use the "*
register, which is X's "PRIMARY" selection buffer -- the one where text goes if you just highlight it, and which you can paste by pressing the middle button.
See :help gui-selections
. GUI selection support generally requires a Vim other than "vim-tiny"; on Debian and Ubuntu the vim-gtk and vim-gnome packages are good choices.