Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Using the vim text editor, I am looking for a method to copy content highlighted in visual mode to the system clipboard (i.e. I would then be able to Ctr-v that content say in a browser window).

Is there a standard way to copy content directly to the system clipboard? If not is there a suited hack to enable it for Mac OS 10.7.3?

share|improve this question
up vote 8 down vote accepted

If your VIM was built with the clipboard feature enabled, then you select your text in visual mode, and then type "*y.

To paste from the clipboard, do "*p.

share|improve this answer
@Kurt The text register "* is special, it places the selected text into the X CLIPBOARD. – Keith Apr 10 '12 at 12:12
This does not work for me. Each time I press "* I get a bell and then y/p perform their independently mapped actions. – rudolph9 Apr 10 '12 at 17:40
This seems to be an issue with OS X, from what I have gather it does not properly map the X CLIPBOARD as mentioned by Keith. (it seems rather unsuited to even call OS X Unix anymore!) – rudolph9 Apr 10 '12 at 17:49
For OSX this article was rather helpful. Basically there is a command pbcopy and pbpast which you able to call for say the current line . !pbcopy or if you don't want the current line cut .w !pbcopy. – rudolph9 Apr 10 '12 at 17:59
Right, the "* register is only available where VIM was built with the right settings. It might be that OS X can't do that, but I can't check as I don't have it. – ams Apr 10 '12 at 19:02

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.