Vim copy to system clipboard on a Mac
(from: http://vim.wikia.com/wiki/Mac_OS_X_clipboard_sharing)
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:
- Open your ~/.vimrc file
- add
vmap '' :w !pbcopy<CR><CR>
- Save it/
source
the file
Voila! You can now copy to the system clipboard, in visual mode, via ''
!
Written by David Weiser
Related protips
2 Responses

excellent!
over 1 year ago
·

Insanely helpful. Thanks, David!
over 1 year ago
·
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Vim
Authors
Related Tags
#vim
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#