Super User is a question and answer site for computer enthusiasts and power users. 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

Is there any way to use the system clipboard on Mac OS X (it is accessible with pbpaste and pbcopy to read and write, respectively) in place of vim's clipboard? So, for instance, when I did a cut or copy in vim, it would go to the system clipboard. And, also, if I copied something to the system clipboard, I could paste it into vim with P or p

Thanks in advance!

share|improve this question
up vote 4 down vote accepted

Vim 7.3 added “clipboard support in the Mac console” (see under :help added-7.3). The standard * register is the system clipboard when running a tty-based instance of vim (+ also works and is an alias for * like most non-X11 systems). I am using Vim 7.3 from MacPorts.

Paste: "*p
Copy 4 lines: "*4yy
Cut 4 lines: "*4dd

For Vim 7 versions before 7.3, you can use fakeclip.

share|improve this answer
    
This works perfectly, thanks! But, is there any way to map it to a different shortcut? – Wuffers Oct 17 '10 at 21:43
    
You could map then to pretty much anything you want with various map commands. F1 as Paste: :map! <F1> "*p F2 as Copy: :map! <F2> "*y (press F2 then a motion command, or press F2 with a visual selection active). With the support built into Vim 7.3 you can also :set clipboard=unnamed so that normal yank, delete, change, and put operations (i.e. those done without a " + register character prefix) go through the system clipboard. – Chris Johnsen Oct 18 '10 at 2:47
    
Awesome, thanks! – Wuffers Oct 19 '10 at 21:34

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .