clipboard

来源:2-9 Vim复制粘贴与寄存器的使用

tongguangyu

2019-05-29 19:24

:echo has ('clipboard')

输出0

写回答 关注

2回答

  • 慕斯5307059
    2021-03-19 12:34:32

    好好好


  • wsgws_码码要洗手
    2019-05-31 00:27:06

    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:


玩转Vim 从放弃到爱不释手

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

28518 学习 · 78 问题

查看课程