Copy from and Paste to Native OS X Clipboard in Vim

I just discovered how to copy from and paste to the native clipboard in Vim on OS X–since I have been using Vim quite a bit lately instead of Textmate, and this is one of the final missing pieces that I lacked and that made Vim a little annoying to use.

Here is the simplest way to install the latest version. Open a terminal:

cd ~
mkdir -p .vim/autoload
mkdir -p .vim/doc
mkdir -p .vim/plugin
curl http://github.com/kana/config/raw/vim-fakeclip/vim/dot.vim/autoload/fakeclip.vim -o .vim/autoload/fakeclip.vim
curl http://github.com/kana/config/raw/vim-fakeclip/vim/dot.vim/doc/fakeclip.txt -o .vim/doc/fakeclip.txt
curl http://github.com/kana/config/raw/vim-fakeclip/vim/dot.vim/plugin/fakeclip.vim -o .vim/plugin/fakeclip.vim

Here are a few of the essential commands:

modes    {lhs}        {rhs}                    ~
-----    -----------    --------------------------------    ~
Yank selection in visual mode to native OS X clipboard
nv    "+y        (fakeclip-y)
Yank current line to native OS X clipboard
n    "+yy        (fakeclip-Y)
Paste from the native OS X clipboard
nv    "+p        (fakeclip-p)
Paste from OS X native clipboard while in insert mode
ic    *        (fakeclip-insert)

Related posts:

  1. vim tips ( via cheat gem )
You should follow me on Twitter here.
Subscribe to labs via email here.

About this entry