gvim: Easy copying into system clipboard

后端 未结 5 447
庸人自扰
庸人自扰 2021-02-03 23:37

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.

This works with \"

5条回答
  •  北海茫月
    2021-02-03 23:52

    Did you try to map with this command:

    noremap 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
    

    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 (+).

提交回复
热议问题