Skip to content

Instantly share code, notes, and snippets.

@quentin
Created December 3, 2019 10:17
Show Gist options
  • Save quentin/ad4eea0d151e132f180e543a14bd3df0 to your computer and use it in GitHub Desktop.
Save quentin/ad4eea0d151e132f180e543a14bd3df0 to your computer and use it in GitHub Desktop.
tmux copy/paste configuration
## tested with tmux 3
# mouse mode
set -g mouse on
setw -g mode-keys vi
# selection with mouse copies to clipboard in addition to the default action
unbind-key -n -T copy-mode-vi MouseDragEnd1Pane
bind-key -T copy-mode-vi MouseDragEnd1Pane send-keys -X copy-pipe-and-cancel "xclip -in -sel primary"
# middle click to paste from the clipboard
unbind-key MouseDown2Pane
bind-key -T root MouseDown2Pane run "tmux set-buffer \"$(xclip -o -sel primary)\"; tmux paste-buffer"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment