从 Putty/Vim 可视模式复制到 Windows 剪贴板 [英] Copy from Putty/Vim visual mode to windows clipboard

查看:68
本文介绍了从 Putty/Vim 可视模式复制到 Windows 剪贴板的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前在 Putty 中打开了一个 vim 会话,并且我已经通过可视模式选择了文件中的所有内容.通常要将其复制到剪贴板,我会使用 "+y"*y,但这些命令都不起作用.

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.

这是我的 vimrc:

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

推荐答案

当您使用 PuTTY 连接到远程系统(我假设使用 SSH)并且您需要将一个完整的文件从该系统传输到本地 Windows 系统时,只需打开一个单独的 SCP 连接;PuTTY 自带 pscp.exe 来传输文件.根据您的 SSH 配置,多路复用甚至可能重复使用相同的连接,因此开销应该相当小.

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.

如果您安装了 X 服务器(例如 Cygwin-X)并使用 ssh -X 主机名 进行连接,您可以启动远程终端/GVIM 会话并拥有剪贴板与您的 Windows 主机同步,由 X Server 提供.单独使用 PuTTY,这是不可能的,因为它是与 X 没有任何连接的唯一终端客户端.

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.

这篇关于从 Putty/Vim 可视模式复制到 Windows 剪贴板的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆