Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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.

share|improve this question
Thought, PuTTY does not know anything about remote clipboard. So, it can copy only visible parts of texts. – Maximus Oct 1 '12 at 21:38
up vote 2 down vote accepted

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.

share|improve this answer
was expecting some way to hook up the 'system' clipboard via "+ or "* with putty's clipboard... – gcb Oct 1 '12 at 22:29
It'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 Oct 2 '12 at 1:21

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')

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.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.