Copying from VIM in Putty on Windows – Step-by-Step Guide

clipboardputtyremotevimwindows

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.

Best Answer

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.

Related Question