tmux -- any way to enable scrolling, but not selection?

18

8

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).

gatoatigrado

Posted 2012-11-14T19:45:59.700

Reputation: 1 075

http://unix.stackexchange.com/questions/15715/getting-tmux-to-copy-a-buffer-to-the-clipboard – Ciro Santilli 新疆改造中心法轮功六四事件 – 2016-03-16T09:18:44.320

Answers

5

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

Nei

Posted 2012-11-14T19:45:59.700

Reputation: 224

3I'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 – 2014-07-02T22:08:15.533

3Actually, I am not sure about your assertion. I can select things normally in applications like 'vim' or 'less', but scrolling also works. – gatoatigrado – 2013-01-31T19:14:30.503

5

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

user7610

Posted 2012-11-14T19:45:59.700

Reputation: 336

Works with xterm too – Jean-Bernard Jansen – 2018-05-14T09:04:54.253

1

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

treym

Posted 2012-11-14T19:45:59.700

Reputation: 11