Skip to content

Instantly share code, notes, and snippets.

@maxjustus
Last active December 18, 2015 04:09
Show Gist options
  • Save maxjustus/5723090 to your computer and use it in GitHub Desktop.
Save maxjustus/5723090 to your computer and use it in GitHub Desktop.
Copy and paste in Vim and TMux on OSX

Run the following in your shell:

brew install macvim --override-system-vim
brew upgrade tmux
brew install reattach-to-user-namespace
echo 'set-option -g default-command "reattach-to-user-namespace -l bash"' >> ~/.tmux.conf

pbcopy should work within tmux once you've done that. You can test it by trying echo "hi" | pbcopy and then trying to paste.

In vim, you should now be able to copy to the system clipboard by using the + buffer. For example: do a visual selection of some text and type "+y to yank the selection into the osx paste buffer.

If you want any ole yank in Vim to copy to the system clipboard, add set clipboard=unnamed to your .vimrc

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment