I want to yank text with a command to vim and have it end up in screen's clipboard where it can be pasted to a different application via ^A] later. vim needs to do the copying (not screen's copy mode) because I have more text than will fit on screen at one time.
Answers to other questions have approached this issue, but they mostly rely on using vim's interfaces + and * to the X clipboard, which is not available to applications started remotely or not in the presence of an X session to begin with. I'm working through puTTY, but that's incidental as I just want to transfer between screens and not [necessarily] out to local.
The best thing would be the existence of a magic buffer in vim that connects to screen, but I'll listen to workarounds : )
Best Answer
If some extra keystrokes do not bother you, I can‘t see a problem.
GNU Screen’s copy-paste register (
.
) can be read from / written to file out of a box:<C-a><
and<C-a>>
are default hotkeys,/tmp/screen-exchange
is a default file, but I’d prefer a user-specific rather than system-wide so I would set something like this in the.screenrc
:Vim has no such commands out of a box, but there is no difficulty to create and map them to whatever you want, e. g.
<leader><
and<leader>>
respectively:If they do bother you however, it becomes a little more complicated – as far as understood, you have to:
remap two shortcuts in GNU Screen: while pasting one is quite obvious:
yanking one –
<Return>
or<Space>
in a special copying mode presents a difficulty to me.