为了账号安全,请及时绑定邮箱和手机立即绑定

正在回答

2 回答

好好好


0 回复 有任何疑惑可以回复我~

https://vi.stackexchange.com/questions/84/how-can-i-copy-text-to-the-system-clipboard-from-vim


gVim

If you use gVim, you can get copy-on-select behaviour when using :set guioptions+=a.
This is enabled by default on X11 systems (copies to PRIMARY), but not on MS Windows & OSX (as selecting any text would override your clipboard).

No +clipboard?

Vim requires the +clipboard feature flag for any of this to work; you can check if your Vim has this by using :echo has('clipboard') from within Vim (if the output is 0, it not present, if it's 1, it is), or checking the output of vim --version.

Most Linux distributions ship with a "minimal" Vim build by default, which doesn't have +clipboard, but you can usually install it:

  • Debian & Ubuntu: Install vim-gtk or vim-gnome.

  • Fedora: install vim-X11, and run vimx instead of vim (more info).

  • Arch Linux: install gvim (this will enable +clipboard for normal vim as well).

You could also use xclipxcopy, or xsel to copy text to the clipboard; see the following questions for solutions:


0 回复 有任何疑惑可以回复我~

举报

0/150
提交
取消
玩转Vim 从放弃到爱不释手
  • 参与学习       28385    人
  • 解答问题       78    个

作为程序员你还不知道编辑器之神 Vim 吗,带你从零开始学习 vim 编辑器。

进入课程
意见反馈 帮助中心 APP下载
官方微信