How to copy a selection to the OS X clipboard

后端 未结 27 2317
野趣味
野趣味 2020-11-29 14:17

I have an area selected in Vim. How can I copy it into the OS X clipboard?

(The OS X clipboard can be written to via a pipe to /usr/bin/pbcopy)

27条回答
  •  感情败类
    2020-11-29 15:15

    if you have the +clipboard option on your Vim installation (you can check with :version) and you are in visual mode you can do "+y This will yank the selection to the buffer + that is the clipboard.

    I have added the following maps to my vimrc and it works fine.

    vmap y "+y : With this I can do leader key follow by y to copy to the clipboard in visual mode.

    nmap p "+p : With this I can do leader key follow by p to paste from the clipboard on normal mode.

    PD : On Ubuntu I had to install vim-gtk to get the +clipboard option.

提交回复
热议问题