Skip to content

Instantly share code, notes, and snippets.

@cloud8421
Created September 18, 2012 14:52
Show Gist options
  • Select an option

  • Save cloud8421/3743551 to your computer and use it in GitHub Desktop.

Select an option

Save cloud8421/3743551 to your computer and use it in GitHub Desktop.
Vim and Tmux workshop - 06 - Tmux
/usr/local/bin/tmux_copy &

To have OsX share the tmux clipboard, you need to run a script that syncs both buffers.

You can create a login item for you user that runs run_tmux_copy.

Contents of run_tmux_copy and tmux_copy are below.

Make sure to place them something useful, like /usr/local/bin.

The reasons for all of this are documented in the repo for the reattach-to-user-namespace command

#!/usr/bin/env bash
# http://robots.thoughtbot.com/post/19398560514/how-to-copy-and-paste-with-tmux-on-mac-os-x
while true; do
if [[ -n $(tmux showb 2> /dev/null) ]]; then
$(tmux saveb -|pbcopy && tmux deleteb)
fi
sleep 0.5
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment