"+y does not work


情况 2:

Re: "+y does not work

ConcreteVitamin
9 posts
In reply to this post by Gary Johnson-4
Following your advice I installed vim-gnome. And problem fixed!

Thanks! :)

On Wed, Jan 11, 2012 at 3:26 PM, Gary Johnson <[hidden email]> wrote:
On 2012-01-11, ConcreteVitamin wrote:
> Hi All,
>
> I'm using Vim under Ubuntu's Gnome Terminal (the command "vim"). I selected
> some text in visual mode, then "+y, but when I right clicked on Firefox's
> address bar, the "paste" option is not available. What's the problem? And how
> to fix it?

The version of vim that you are using was probably not compiled with
support for X11 or the clipboard.  You can check this by executing

   :version

Ubuntu has several packages that include vim:

   package    binary              X11
   ---------  ------------------  ---
   vim        /usr/bin/vim.basic  No
   vim-tiny   /usr/bin/vim.tiny   No
   vim-gnome  /usr/bin/vim.gnome  Yes

One of these is linked to /usr/bin/vim via /etc/alternatives/vim.
You can find out which by executing

   ls -l /etc/alternatives/vim

I think that all you have to do is install the vim-gnome package and
you'll get what you want.

Regards,
Gary

截自: http://vim.1045645.n5.nabble.com/quot-y-does-not-work-td5136141.html



只有vim.gtk或vim.gnome才能使用系统全局粘贴板,默认的vim.basic看不到+号寄存器

情况 2:


vim:从资料拷贝内容至clipboard

提问者: pierce245     发布时间:2014-03-08     浏览:11     回复:0     悬赏:0.0希赛币
vim:从文件拷贝内容至clipboard
vim:从文件拷贝内容至Clipboard

1.进入visual模式
2.选中目标内容
3.然后:y+将会显示:'<,'>y+
4.拷贝之后,即可粘贴在其他app,例如新开一个vim, 进入insert模式,使用Shift+Insert,即完成复制

  :%y+ 拷贝整个文件至粘贴板:y+ 当前行(或选中的)内容至粘贴板:N,My+ 指定的行数内容至粘贴板



遇到的问题:
按如上方法进行复制操作的时候,遇到"E488: Trailing characters",是由于当前vim没有enable "clipboard"

  vim --version | grep clipboard



发现:
"-clipboard"

解决办法:
由于之前选择vim-7.3 src编译安装,不支持X11,选择安装vim-X11(gvim默认enable clipboard),步骤如下:

  yum list | grep vim-X11sudo yum -y install vim-X11



这时安装的是gvim,对.bashrc如下修改:

alias vim='gvim -v'

  source .bashrc



检查clipboard feature

[xinz@fedora Downloads]$ vim --version | grep clipboard
+clientserver +clipboard +cmdline_compl +cmdline_hist +cmdline_info +comments
+xsmp_interact +xterm_clipboard -xterm_save

按照如上方法即可解决该问题

vim在各个linux发行版本预装支持不同,我使用的是fedora16,希望对遇到类似问题的同学有帮助

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值