VIM & pbcopy on OS X

December 27, 2010

There's nothing more frustrating than yacking a block of code in VIM and not having access to paste it in another terminal session.  So, I finally did some churning on the internets to find a practical solution in visual mode with pbcopy.

Below are the key mappings I've included in my .vimrc file that cut/copy text in visual mode to the operating system's clipboard.


vmap <C-x> :!pbcopy<CR>
vmap <C-c> :w !pbcopy<CR><CR>

vim

@drydevelopment