87

Is it possible to use the mouse to navigate between different window panes which are split vertically or horizontally?

tshepang
  • 65,642
daisy
  • 54,555

3 Answers3

111

As of tmux 2.1, you can enable this by adding it to your .tmux.conf: set -g mouse on

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


See the mouse-select-pane option in man tmux:

mouse-select-pane [on | off]
If on, tmux captures the mouse and when a window is split into multiple panes the mouse may be used to select the current pane. The mouse click is also passed through to the application as normal.

You can enable this by adding it to your .tmux.conf: set -g mouse-select-pane on

jasonwryan
  • 73,126
  • 17
    This works great but as I have noticed you loose the ability to select text with mouse or copy mode (prefix Ctrl + [) when you have more than 1 pane. – Patryk Jan 07 '13 at 12:08
  • 16
    Just saw, that, indeed, I lost the ability to select text with the mouse, but found that I still can select it with SHIFT key being pressed. OpenSuse 12.3, GNOME terminal 3.6.1, tmux 1.7. – user72025 Sep 07 '15 at 00:53
  • 4
    This option doesn't seem to be available in v2.1. – DBedrenko Nov 10 '15 at 09:09
  • 2
    was happy with this but it seems to have broken less pagination so.. nope... I'm on tmux 2.0, may try again with the new setup after upgrading to 2.1 – Louis Maddox Dec 04 '15 at 23:51
  • Can I do this when running tmux over ssh? – fiatjaf Nov 02 '16 at 23:26
  • 2
    Yes, if your ssh client emulates xterm terminal. So in most cases the answer is yes: it's possible with Windows/Putty, with macos and linux – nponeccop Nov 25 '17 at 12:15
  • I am getting following error message: .tmux.conf:76: invalid option: mouse-select-pane – alper May 12 '20 at 11:04
  • Using tmux-3.1 here and set mouse on works – codepearlex Apr 14 '21 at 16:54
  • 2
    In tmux 2.6, this interferes with vim visual selection too. That's a deal breaker! – sidcha May 08 '21 at 21:10
  • If you are using iTerm enable clipboard from preferences: Preferences > General > Selection > Applications in terminal may access clipboard Now no need to press shift, cmnd+c works as usual. – vaibhavatul47 Jan 30 '22 at 09:28
  • There's a moose on the loose @Patryk – NeilG Mar 10 '23 at 05:15
6

For those who are newbie with tmux, here all the steps to do:

Step 1: Start tmux in your terminal.

tmux

Step 2: Enter tmux's command mode by pressing Ctrl+b followed by :.

Step 3: Type the following command and press Enter to enable mouse support:

setw -g mouse on

Step 4: You can now use the mouse to click on a window pane to switch to it or click and drag on pane borders to resize them.

1

Please try:

set-option -g mouse on
bind-key -T root MouseDown1Pane select-pane -t =
Ahmad Ismail
  • 2,678