In ideal situation it would be great if you could open two files under one instance:
vim file1.txt file2.txt
If not possible, then you can still do it if the files are accessible on the same host, by opening 1st file and:
Copy text in file1.txt
(e.g. enter visual mode V, select the text, and yank/copy them by y).
Open 2nd file by :Sex
.
You may also use: :e file2.txt
, then if you need to use full path, go to 2nd instance and check by 1,Ctrl+g.
Paste your text (e.g. p).
Above steps can be done opposite, by opening file2.txt
, then file1.txt
to copy the text, back to the original file and paste it there.
Or simply use screen
buffer to copy and paste between screen windows (Ctrl+a,[ and Ctrl+a,]).
file1.txt
andfile2.txt
using one instance? E.g.vim file1.txt file2.txt
?tmux
, you can start "copy mode" withprefix+[
, thenspace
to select stuff,
Enter` to copy, then go to the other pane, and useprefix+]
to paste ... It's very similar to Vim's visual mode. IIRCscreen
can do this as well (but I don't remember how, as I haven't used it in years and years).