91

Need to enable scrolling into tmux panels with mouse wheel. How can I get that tips? Can I use it (if its exist of course) with mouse-select-pane on option?

4
  • 1
  • 1
    It is most amusing when i use and mark up questions / answers that are closed as 'off topic'. It would have been better in this case if the 'off topic question' was made on-topic by either originator or moderator.
    – HankCa
    Nov 4, 2019 at 22:29
  • This question is NOT ABOUT HARDWARE 🤦🏼‍♂️. It is about scrolling in tmux. The fact that the OP mentioned the hardware used for scrolling does not make it about hardware anymore than questions about text strings are ABOUT KEYBOARDS.
    – iconoclast
    Aug 12, 2020 at 0:39
  • Doesn't say it's necessarily about hardware. Says "...hardware AND SOFTWARE...". This seems like a question about how to configure a piece of software and not via programming, so sure seems off-topic to me.
    – CryptoFool
    Sep 24, 2020 at 3:07

4 Answers 4

128

Origin Answer (deprecated)

Try this:

setw -g mode-mouse on

It can be used with the mouse-select-pane on and mouse-select-window on options.

Update

After tmux 2.1, mode-mouse option is no longer available. You should now use:

set -g mouse on

to capture mouse event.

7
  • 2
    thx, and maybe u know how to enable mouse copy-past opportunity in this mode?
    – mart7ini
    Nov 15, 2011 at 9:38
  • 1
    @mart7ini Do you mean this problem?
    – dm4
    Nov 26, 2011 at 4:09
  • 1
    This does not work via ssh. :( May 22, 2017 at 11:10
  • 1
    CONFIRM working on OpenBSD 6.6
    – Richard
    Feb 4, 2020 at 17:54
  • 4
    Worth to add that you can create a file ~/.tmux.conf with the set -g mouse on content on it to avoid the need to execute the command on each session. Jul 6, 2020 at 14:08
68

There are some changes for Tmux 2.1

  • Mouse-mode has been rewritten. There's now no longer options for:

    • mouse-resize-pane
    • mouse-select-pane
    • mouse-select-window
    • mode-mouse

    Instead there is just one option: 'mouse' which turns on mouse support entirely.

So set -g mouse on

Update:

I have to use this script to make scrolling work again: https://github.com/NHDaly/tmux-scroll-copy-mode

1
  • Wow that is fantastic! I'm new to tmux and I really liked it as it solved problems with sessions, but the windows / panes metaphors were somewhat painful (eg. Ctrl-b o to switch panes was a pain all the time). Along with the newly discovered github.com/tmux-plugins/tmux-continuum things are really starting to look rosey.
    – HankCa
    Nov 3, 2019 at 23:12
15

From https://blogs.oracle.com/samf/entry/smcup_rmcup_hate

In .tmux.conf:

set -g terminal-overrides 'xterm*:smcup@:rmcup@'

where, for instance, mouse scrolling in vim in tmux scrolls vim, NOT tmux history. Very beneficial, and VERY different from history scrolling.

5
  • 1
    I thought smcup/rmcup had nothing to do with handling mouse scrolling. it has to do with the "alternate screen" functionality, where these folks want to turn it off to leave the contents of vim or less on the term so that they can still see it as they type the next command. (my two cents here is I usually have space to open more terminals so I do this sort of thing in parallel terminals -- more often than not I'd rather see my previous commands after exiting from those programs anyway)
    – Steven Lu
    Apr 24, 2013 at 17:23
  • This doesn't work for me. When I add this to .tmux.conf and source that file, it just causes gibberish characters to appear that the terminal prompt (for whatever program I am in).
    – ely
    Aug 1, 2013 at 15:41
  • Yes, scrolling works. But on my Ubuntu computer in vim or less scrolling works through tmux history not vim or less as I expect. Jul 21, 2014 at 6:32
  • That must be the default behavior. This emulate keyboard UP and DOWN arrows. Now tmux implement his own way of scrolling (as before with pgUP pgDOWN). This is a regression, it breaks things.
    – NVRM
    Oct 14, 2019 at 4:29
  • this works for tmux 2.7 as well
    – Dudi Boy
    May 25, 2023 at 10:49
10

For Mac OSX 10.9

First Install SimpleSIMBL

Then Install MouseTerm

Add this to your ~/.tmux.conf

set-option -g mouse-select-pane on
set-option -g mouse-select-window on
set-window-option -g mode-mouse on

For VIM Scrolling add this to your ~/.vimrc

set mouse=a
set ttymouse=xterm

Notes: see also: Scrolling inside Vim in Mac's Terminal

1
  • In Linux I got .tmux.conf:1: invalid option: mouse-select-pane .tmux.conf:1: invalid option: mouse-select-pane and .tmux.conf:3: invalid option: mode-mouse when Tmux starts and then the session works without any change Jul 6, 2020 at 14:02

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