gvim:轻松复制到系统剪贴板 [英] gvim: Easy copying into system clipboard

查看:292
本文介绍了gvim:轻松复制到系统剪贴板的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Ubuntu 10.10上使用gVim.我想将文本复制(粘贴)到系统剪贴板,以便复制的文本可在其他应用程序中使用.

I am using gVim on Ubuntu 10.10. I want to copy (yank) text to the system clipboard, so that the copied text is available in other applications.

这与"+y一起使用.但我想让它与y一起使用.

This works with "+y. But I want to have it working with y.

我尝试将y映射到"+y,但是yy不再起作用(因为它会生成"+y"+y).

I have tried to map y to "+y but then yy doesn't work anymore (since it produces "+y"+y).

我也尝试过 :set clipboard=unnamed 但这仅在另一个方向起作用:我可以使用p粘贴系统剪贴板中的文本.

I have also tried :set clipboard=unnamed but this works only the other direction: Text in the system clipboard I can paste with p.

推荐答案

您尝试使用以下命令进行映射:

Did you try to map with this command:

noremap y "+y

?此映射包含一个严重的错误:它在普通,可视和操作员待定模式下映射y,而您仅需要普通和可视模式.使用以下内容:

? This mapping contains a serious mistake: it maps y in normal, visual and operator-pending modes, while you need only normal and visual modes. Use the following:

nnoremap y "+y
vnoremap y "+y

也可以尝试set clipboard=unnamedplus(至少需要vim-7.3.74). set clipboard=unnamed可以在两个方向上工作,但是它设置的鼠标"(*)寄存器与剪贴板寄存器(+)不同.

Also try set clipboard=unnamedplus (it requires at least vim-7.3.74). set clipboard=unnamed works in both directions, but it sets «mouse» (*) register which is different from clipboard register (+).

这篇关于gvim:轻松复制到系统剪贴板的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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