5

I recently needed to copy X amount of lines from a file, that I opened in vim and then paste them to another file opened in a different screen session (and different server).

So on screen #1 I ran in vim:

:15,20y

and on screen #2 I tried to use p to paste the lines, but I couldn't because the register was empty (to be honest, I was expecting that but I just wanted to give it a try).

I eventually worked my way around in order to get those lines to the right place, but I wonder if it is possible to copy-paste data between screen sessions.

2 Answers 2

4

You can use the copy/paste functionnality of the screen command:

First off, you select the text to be copied on screen #1:

C-a esc

With the command above, you're in window edit mode and this allows you to copy text from the current window and its history into the paste buffer. You move arround with the arrows and select your text with space bar.

Go into the screen #2 Paste it by typing:

C-a ]

For more references to screen command, consult the manpage:

$ man screen
1
  • This is the answer that I was looking for! Thank you so much!!!
    – ILikeTacos
    Jul 30, 2013 at 14:10
2

One workaround is to use shiftmouse-drag and then ctrl c and shiftctrlv in combination with zoom out (repeated ctrl--'s) and mouse drag. This works for up to about 130 lines.

3
  • I guess I didn't understand how to do that because I just tried it and it zooms out but it doesn't copy any data
    – ILikeTacos
    Jul 10, 2013 at 22:32
  • zoom out first , then use shift-ctrl-c Jul 10, 2013 at 22:45
  • Updated, you need to use mouse (or trackpad) drag. Jul 10, 2013 at 23:20

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .