Vim: Terminal-to-terminal copy&paste

copy/pasteterminalvim

I am trying to copy a large block of code (with indentations preserved) from one vim terminal into another. I was wondering if there was a straightforward way to do this?

Would this be considered a vim functionality, or a property of the terminal?

Best Answer

A lot of things are missing from your question: Which terminal emulator do you use? On which platform? Is Vim compiled with clipboard support?

I'm on Ubuntu, running Vim 7.3 with clipboard support in Gnome Terminal so YMMV.

I'm able to select a block of code with V in one Vim instance in one terminal window and put it in another Vim instance in another terminal window simply with a middle-click. Without the mouse I'm able to yank the selection to the system clipboard with "*y in the first window and put with "*p in the second window.

You might need to do :set paste before pasting your code block and :set nopaste after.

Also, why do you use two different Vim instances in two different terminal windows when Vim has split windows buit-in?

Related Question