This question already has an answer here:
-
Copying stuff from vim running in putty
3 answers
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
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.
exit from vi editor
$cat
using above command you will see your all content which is in that file
select the content you want to copy (yes you can scroll on this screen while selecting)
don't click any mouse button because text will get selected automatically
open your text editor on windows and paste it there
Done
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
The only reliable way to copy text/data from a remote connection I was able to find is through a third party SCP application like filezilla or winscp. You can download the last one here: http://winscp.net/eng/download.php
The easiest way i have found so far is to enable logging in my putty session. Then just browse through the lines i want. since everything on the putty screen is been logged into my local file i can easily copy stuff from my local file and send it in an email or whatever.
HTH.