Skip to content

Instantly share code, notes, and snippets.

@7696122
Created December 8, 2016 05:08
Show Gist options
  • Save 7696122/d4c76ddbe19a6e9c134ea0f10e93e71c to your computer and use it in GitHub Desktop.
Save 7696122/d4c76ddbe19a6e9c134ea0f10e93e71c to your computer and use it in GitHub Desktop.
# workaround clipboard for tmux {
# https://robots.thoughtbot.com/how-to-copy-and-paste-with-tmux-on-mac-os-x
# pbcopy, pbpaste for TMUX
# brew install reattach-to-user-namespace
set-option -g default-command "reattach-to-user-namespace -l $SHELL"
# For emacs mode
################################################################
# setw -g mode-keys emacs
# To copy:
# bind-key -t emacs-copy C-w copy-selection
bind-key -n -t emacs-copy M-w copy-pipe "reattach-to-user-namespace pbcopy" # or "xclip -i -sel p -f | xclip -i -sel c "
bind-key -n -t emacs-copy C-w copy-pipe "reattach-to-user-namespace pbcopy" # or "xclip -i -sel p -f | xclip -i -sel c "
# For vi mode
################################################################
# To paste:
# bind-key -n C-y run "xclip -o | tmux load-buffer - ; tmux paste-buffer"
# Use vim keybindings in copy mode
# setw -g mode-keys vi
# Setup 'v' to begin selection as in Vim
# bind-key -n -t vi-copy v begin-selection
# bind-key -n -t vi-copy y copy-pipe "reattach-to-user-namespace pbcopy"
# Update default binding of `Enter` to also use copy-pipe
# bind-key -n -t vi-copy Enter copy-pipe "reattach-to-user-namespace pbcopy"
# }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment