How to copy a selection to the OS X clipboard

后端 未结 27 2295
野趣味
野趣味 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:20

    If your Vim is not compiled with clipboards, you wish to copy selected text instead of entire lines, you do not want to install MacVim or other GUI, the simplest solution is to add this line to your .vimrc:

    map  y:e ~/clipsongzboardP:w !pbcopy:bdelete!
    

    To use it, simply visually select the text you want to copy, and then Control-C. If you want a full explanation of this line read "How to Copy to clipboard on vim".

提交回复
热议问题