I like that when mode-mouse is on in tmux, I can scroll through the buffer, but I don't like that I can't copy stuff to my OS clipboard by selecting it (as when tmux is disabled). Question: Is there any way to enable mouse scrolling, but not selection? I'm using KDE's konsole, if it matters. I've tried setting,

set -g mouse-select-pane off
set -g mouse-select-window off

but no luck -- the only difference seems to be whether mode-mouse is on (tmux captures scrolling and selection) or off (tmux captures neither scrolling nor selection).

up vote 5 down vote accepted

due to a limitation in the protocol, it is not possible for terminal applications to only request the scrolling but not the selection. It's an all or nothing. So even if tmux wanted, it has no way of doing what you desire.

You have the following options:

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

unfortunately, answer to your question is No

  • 3
    Actually, I am not sure about your assertion. I can select things normally in applications like 'vim' or 'less', but scrolling also works. – gatoatigrado Jan 31 '13 at 19:14
  • 3
    I'm not sure about the protocol, but iterm on OS X has a good integration with tmux: once you hold the "Option" key, you can select any text in the terminal to copy them into the system clipboard. Maybe it is doable but it's just not implemented yet on other terminal emulators? – xuhdev Jul 2 '14 at 22:08

Holding Shift in Konsole seems to disable sending mouse input to tmux. On OS X, (using iTerm2) @demure suggests to hold down shift + alt. https://superuser.com/a/599501/573760

If you're trying to get at the X selection clipboard on linux (middle click to paste)

This will restore that functionality for you while maintaining the buffer functionality, tmux is still managing the selection

bind -n MouseDown2Pane run "tmux set-buffer \"$(xclip -o)\"; tmux paste-buffer"
bind -n MouseUp2Pane run "tmux display \"Pasted from selection clipboard\""
bind-key -n MouseDragEnd1Pane run-shell -b "tmux send-keys M-w ;tmux show-buffer|xclip -i; tmux display \"Coppied to selection Clipboard\""

Add to your ~/.tmux.conf

Your Answer

 

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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