Linux – UNIX – How to copy and paste between different bash windows with files opend with VI

bashcopy/pastelinuxterminalvi

Lets say I log in to bash, open a file in vi, then using alt-f2 I open a new terminal. After logging in I navigate to a second file and open that in vi. How can I CnP between these two files?

I found this from wikia.com. I'm not familiar with this command shift-8-y-y. I follow the vimtutor and use virtual mode. I tried this sequence and was unsuccessful.

And, I read this about registers. I found a mention of using double_quote-p to 'put' or paste the register, but this does not work in a different file. The second file reported the register empty.

Alternatively, I read in the VIM docs, it is possible to open multiple files under split screens. This may be a course to a solution. The need I often encounter has me navigating in a different bash window to find a file, then wishing to copy between the two. Whereas, I imagine, a split VIM window useful for files in the same directory.

Best Answer

You cannot do it unaided in a standard generic way with the vim you have.

Firstly make sure you have a good version compiled and installed on your distro.

Then I would suggest either using gvim with separate windows, or using vim -o to open multiple files and just between the frames using ^W^W to switch and then copy and paste.