Last Updated: February 25, 2016
· davidann

Vim copy to system clipboard on a Mac


Having trouble copying selected text from Vim (not MacVim)? Since using "+y or '"*y' in Vim on a Mac doesn't actually copy the selected text to the system clipboard, you might find it beneficial to do the following:

  1. Open your ~/.vimrc file
  2. add vmap '' :w !pbcopy<CR><CR>
  3. Save it/source the file

Voila! You can now copy to the system clipboard, in visual mode, via ''!

2 Responses
Add your response


over 1 year ago ·

Insanely helpful. Thanks, David!

over 1 year ago ·