Copy from Putty/Vim visual mode to windows clipboard

I assume you expected to have the text copied to the clipboard of the host system. I doubt that's possible from within vim running in a putty session but the following works for me

  • select the text using the mouse.
  • selected text is be put in my system's clipboard.

Note that this has nothing to do with vim but is entirely putty's doing.

Edit

From Using PuTTY

3.1.3.5 Copy All to Clipboard

This system menu option provides a convenient way to copy the whole contents of the terminal screen (up to the last nonempty line) and scrollback to the clipboard in one go


When you connect to a remote system with PuTTY (using SSH I assume) and you need to transfer a complete file from that system to your local Windows one, just open a separate SCP connection; PuTTY comes with pscp.exe to transfer files. Depending on your SSH configuration, with multiplexing this may even re-use the same connection, so the overhead should be fairly small.

If you install an X Server (like Cygwin-X) and use ssh -X hostname to connect, you can launch a remote terminal / GVIM session and have clipboard synchronization with your Windows host, courtesy of the X Server. With PuTTY alone, this is not possible, since it's a sole terminal client without any connection to X.


with mouse enabled via set mouse=a you simply need to "Hold down shift, and then highlight the text you want to copy using the left mouse button. When you release, the highlighted text should be in the Windows clipboard." See https://stackoverflow.com/a/4313348


I was facing the same issue I searched everywhere but I didn't find any easy solution without installing some extra software tool. So here is the simplest solution.

  1. exit from vi editor

  2. $cat using above command you will see your all content which is in that file

  3. select the content you want to copy (yes you can scroll on this screen while selecting)

  4. don't click any mouse button because text will get selected automatically

  5. open your text editor on windows and paste it there

  6. Done

Tags:

Vi

Vim

Putty