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

6,166

Solution 1

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

Solution 2

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

Solution 3

Not directly relevant to OP's case, but for anyone else arriving here from Google:

If you're using iTerm2 on macOS, this can be accomplished by unticking "Report mouse clicks & drags" while keeping "Report mouse wheel events" ticked, under Profiles -> Terminal. (Note, however, that this will also disable pane selection through clicking.)

Solution 4

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

Share:
6,166

Related videos on Youtube

gatoatigrado
Author by

gatoatigrado

see website (zoratung.com)

Updated on September 18, 2022

Comments

  • gatoatigrado
    gatoatigrado over 1 year

    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
    gatoatigrado about 11 years
    Actually, I am not sure about your assertion. I can select things normally in applications like 'vim' or 'less', but scrolling also works.
  • xuhdev
    xuhdev almost 10 years
    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?
  • Jean-Bernard Jansen
    Jean-Bernard Jansen almost 6 years
    Works with xterm too
  • Valloric
    Valloric over 2 years
    I made an account just to be able to upvote this. YEARS OF PAIN finally gone. Thank you!