Gnu screen – Copying text between windows


Is it possible to paste text copied in a paste buffer to a different window with some keybinding, without having to leave the current window? I.e., instead of going to the window and doing a Ctr-a + ], giving a gnu screen command and the name of the receiving window?

Best Answer

You could make a bind to create such a keybinding in your screenrc, because there is none.

Depending on how you wanted to implement it (is it for a named screen whose name is known?), the following screen functions could be useful to you:

  • copy ( C-a esc / C-a [ ) to make your copy of the current window
  • writebuf (C-a > ) to write /tmp/screen-exchange
  • readbuf ( C-a < ) to read in the other /tmp/screen-exchange
  • paste . ( C-a ] / C-a C-] ) to write the paste on the other window
  • at [identifier][#|*|%] command [args ...] to make other windows process the two former commands from the specified original window, without leaving it (through a keybind or directly at the screen commandline C-a : ).
Related Question