First you must install a clipboard-enabled version of vim. To accommodate users with non-graphical environments (eg Ubuntu Server users), vim
and vim-tiny
do not hook into this capability. You'll want to install GVim
, which be launched either graphically or in your terminal. GVim will replace the vim
command.
You can yank the text into the 'cut buffer' from the first vim, and then paste the text into the second vim. To copy to the global cut buffer, use the +
register. The "
key allows you to specify which register to use when doing a yank or paste operation.
In the first vim, yank a line into the +
register:
"+yy
then, to paste from the +
register in the second vim:
"+p
For more information on the registers available, check out :help registers
. You can also use "+p
to paste text copied from any other source on your system.
"*yy
,"*p
also works. if you hit:reg
, you will see that star registry – elquimista Apr 12 '18 at 07:35vim-gtk
package includes a clipboard enabled version of (terminal) vim:sudo apt install vim-gtk
– Niklas Apr 08 '20 at 10:01