37

I'd like to switch directly to a pane in Tmux, by pane #.

How can I do this? I know how to cycle between panes, and move to panes that are beside the current pane.

I'd like to be able to run the display-panes command, which shows the "pane #" on each pane, then later on jump directly to a pane using the pane #'s that were displayed by display-panes.

Is this possible?

NOTE: And just to be clear, I don't mean window, I mean pane. Thanks!

  • is there any way to focus the currently highlighted pane using the direction keys to navigate panes? eg I up arrow to be sent to bash and not tmux after the current pane is selected... the timeout drives me crazy – ThorSummoner Oct 12 at 20:53
  • none that I know of – Brad Parks Oct 13 at 13:09
52

You can jump directly to a pane by typing pane's index while it is showed by display-panes command.

From man tmux:

display-panes [-t target-client]
                   (alias: displayp)
             Display a visible indicator of each pane shown by target-client.
             See the display-panes-time, display-panes-colour, and
             display-panes-active-colour session options.  While the indicator
             is on screen, a pane may be selected with the ‘0’ to ‘9’ keys.

Or instead of typing command, you can use:

C-b q
  • C-b send prefix key
  • q display panes indexes
  • 7
    If the pane #'s show too quick for you to select a pane, use the following in your .tmux.conf file to change the amount of time the pane #'s are displayed. set display-panes-time 4000 Note that you can hit the esc key to cancel the operation if you want – Brad Parks Sep 18 '14 at 12:37
  • Can you also so up and down, right and left instead of using a number? – Raffi Khatchadourian Apr 20 '17 at 15:14
  • The set display-panes-time 4000 works nicely, however, there is one edge case I hit that is just a minor thing but would be good to know how to get around it. If I have my default shell set to tmux and use guake to launch into it, the first time I get an /home/elynn/.tmux.conf:92: no current session warning. – Elijah Lynn Jun 27 '18 at 21:37
  • K, looks like -g works, set -g display-panes-time 4000 – Elijah Lynn Jun 27 '18 at 21:42
12

Ctrlbq (the tmux defualt prefix sequence plus q) will briefly display the pane indexes, if you enter the index number while they are dsiplayed, your cursor will move to that pane.

If you have a large number of panes and the display time is too short, you can configure tmux to display the index for a specified interval with the display-panes-time option in your ~/.tmux.conf. The value is in milliseconds.

3

I know this isn't necessarily what you asked for, but enabling mouse support is pretty easy and most terminal emulators support it.

You may simply click on the pane you want to switch to. :)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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