Copy & paste from tmux to system clipboard

For the first time in many years I am using a Linux machine for my work. In general I am extremely pleased with the system I've set up. But of course, there are things that don't "just work".

Like... copy selected text from a tmux pane to the clipboard.

As usual, StackOverflow knows the answer. In short:

# .tmux.conf
set-option -g mouse on
set-option -s set-clipboard off
bind-key -T copy-mode-vi MouseDragEnd1Pane send-keys -X copy-pipe-and-cancel "xclip -se c -i"

Categories: Tags: #tmux # linux