Skip to content

Instantly share code, notes, and snippets.

@joshuaclayton
Created February 25, 2012 00:41
Show Gist options
  • Save joshuaclayton/1904935 to your computer and use it in GitHub Desktop.
Save joshuaclayton/1904935 to your computer and use it in GitHub Desktop.
To get Tmux + pbcopy/pbpaste working:
brew install reattach-to-user-namespace
IIRC this only works on OS X 10.7, but check out https://github.com/ChrisJohnsen/tmux-MacOSX-pasteboard to read more.
At the very top of your ~/.tmux.conf (assuming you're using zsh as your shell)
set-option -g default-command "reattach-to-user-namespace -l zsh"
This will now enable pbcopy + pbpaste. There are still a couple other things you'll want to run:
In ~/bin/tmux_copy:
#!/usr/bin/env bash
while true; do
if [[ -n $(tmux showb 2> /dev/null) ]]; then
$(tmux saveb -|pbcopy && tmux deleteb)
fi
sleep 0.5
done
I'll then run and background that:
$ tmux_copy&
This will copy your tmux buffer into the pasteboard.
Finally, you'll want to set up Vim to use OS X's system clipboard so that you can copy/paste out of vim:
# somewhere in your ~/.vimrc or a file that gets sourced by ~/.vimrc
set clipboard=unnamed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment