copying from VIM in a screen in putty under windows

2

1

Anyway i can get text from Vim in the windows clipboard?

my sessions are usually via PuTTY, and almost always in a gnu screen

if using :set mouse=v i can highlight some lines and they appear in windows' clipboard.

but for longer texts, selecting it all, and yanking to "+ does nothing.

gcb

Posted 2012-10-01T21:16:48.853

Reputation: 3 392

Use X11 forwarding and the clipboard synchronizes. For windows there's the vcxsrv server. Set X11Forwarding=yes in your sshd_config and enable in PuTTY/client also.

– dezza – 2017-04-09T02:28:34.203

1Thought, PuTTY does not know anything about remote clipboard. So, it can copy only visible parts of texts. – Maximus – 2012-10-01T21:38:17.003

Answers

2

Yanking is a feature of Vim itself which by default only works for that process. If you want yanking to utilize the clipboard you have to use "*y (current selection) or "+y (real clipboard) as described in sections 04.7 and 09.3 of Vim help. Use the following commands in Vim to look this up:

:help 04.7
:help 09.3

PuTTY however has no access to either clipboard of the machine you're connecting to.

A quick workaround would be to use the cat command on the file, not in a screen session, and then select the text in your PuTTY which automatically copies it. Doing this outside a screen session ensures you can scroll up and get all of the text.

Derecho

Posted 2012-10-01T21:16:48.853

Reputation: 211

1was expecting some way to hook up the 'system' clipboard via "+ or "* with putty's clipboard... – gcb – 2012-10-01T22:29:17.673

1It's not true that yanking does not work between separate Vim processes. It does work if you are in Windows or in Unix and are running in an X client, either vim in a terminal or gvim. See ":help 04.7" in Vim's built-in help. – garyjohn – 2012-10-02T01:21:59.667

1

Found this patch that will redirect print output (any text inside escape \e''[5i and \e''[4i) to the windows clipboard (e.g. to print "test" in bash echo -ne '\e''[5itest\e''[4i')

http://ericmason.net/putty/putty-0.60-clip.patch

if i can find a windows printer driver that sends text to clipboard instead of printing then putty can be used unmodified, just edit Terminal > Remote controlled printing > select your fake print driver

then i just need a macro to echo the escape codes and the buffer contents.

gcb

Posted 2012-10-01T21:16:48.853

Reputation: 3 392