4

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?

1 Answer 1

8

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.

6
  • @Kurt The text register "* is special, it places the selected text into the X CLIPBOARD. Commented Apr 10, 2012 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. Commented Apr 10, 2012 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!) Commented Apr 10, 2012 at 17:49
  • 1
    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. Commented Apr 10, 2012 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. Commented Apr 10, 2012 at 19:02

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.