vimviputty

Copy from PuTTY/Vim visual mode to Windows clipboard


I currently have a Vim session open in PuTTY, and I've selected everything in the file via visual mode. Normally to copy this onto clipboard, I would use either "+y or "*y, but neither of those commands are working.

Here's my vimrc:

call pathogen#infect()

set noswapfile

set mouse="

set ts=4
set wildmenu
set wildmode=list:longest,full

colorscheme evening

set expandtab
set smarttab

" Stuff from GitHub:
set ts=4
set wildmenu
set wildmode=list:longest,full
set number

" This shows what you are typing as a command. I love this!
set showcmd

" Who doesn't like autoindent?
set autoindent

" Spaces are better than a tab character
set expandtab
set smarttab

" Who wants an 8 character tab? Not me!
set shiftwidth=3
set softtabstop=3

" Ignoring case is a fun trick
set ignorecase

" When I close a tab, remove the buffer
set hidden

" Set word wrapping
set linebreak

" Use filetype specific indentation
filetype on
filetype plugin on
filetype indent on

" Disable auto commenting
autocmd FileType * setlocal formatoptions-=c formatoptions-=r formatoptions-=o

Solution

  • 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.