Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

This question already has an answer here:

This question is similar but not identical to tmux -- any way to enable scrolling, but not selection?

I'm using tmux within gnome-terminal. When I use setw -g mode-mouse on in tmux to enable scrolling through the history buffer, tmux doesn't respect the copy/paste functionality in X, i.e. selecting text does not place the text in the primary buffer, and I can't paste using the middle mouse button

When I press the middle mouse button, I see coordinates in the upper right corner of the screen -- it looks like it's trying to register a middle mouse click as use of the scroll wheel.

Are there tmux settings that I can use to fix this? Are the scroll wheel and the middle mouse buttons seen as independent in tmux? Can I map middle mouse button to OS paste? Can tmux copy/paste request from/feed to OS paste?

share|improve this question

marked as duplicate by slhck May 25 '13 at 17:21

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

2 Answers 2


On OS X, (using iTerm2) I have to hold down shift + alt to override tmux's mouse control temporarily. Your terminal emulator may have a similar ability.

Works, but cumbersome

Aside from that, you could flip mouse support off, copy the text with your system clipboard, and flip it back on. From my ~/.tmux.conf:

### Mouse On/Off ### {{{
## Mouse On by default
set -g mode-mouse on
set -g mouse-resize-pane on
set -g mouse-select-pane on
set -g mouse-select-window on

##Toggle mouse on with <prefix>m
bind m \
        set -g mode-mouse on \;\
        set -g mouse-resize-pane on \;\
        set -g mouse-select-pane on \;\
        set -g mouse-select-window on \;\
        display 'Mouse: ON'

## Toggle mouse off with <prefix>M
bind M \
        set -g mode-mouse off \;\
        set -g mouse-resize-pane off \;\
        set -g mouse-select-pane off \;\
        set -g mouse-select-window off \;\
        display 'Mouse: OFF'
### End Mouse On/Off ### }}}

Possibly Better

You could also make a tmux yank go to your system clipboard:

# move x clipboard into tmux paste buffer
bind C-p run "tmux set-buffer \"$(xclip -o)\"; tmux paste-buffer"
# move tmux copy buffer into x clipboard
bind C-y run "tmux save-buffer - | xclip -i"

Where xclip could be replaced with your choice. This last one would need X forwarding, if done on a remote server.

share|improve this answer

Actually, the answer was hidden among the possibilities listed in tmux -- any way to enable scrolling, but not selection?:

You have the following options:

  • set up a keyboard short-cut that copies the tmux selection into yoursystem clipboard
  • use a terminal that supports set-clipboard function, such as xterm
  • disable any use of the mouse in tmux

I googled forset-clipboard and ran across http://grota.github.io/blog/2012/05/08/tmux-clipboard-integration/ which is what I wanted, if not what I asked for.

share|improve this answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.