38

In tmux, the default behavior for processing C-b 0 is to jump to window 0. I would like C-b C-0 to jump to pane 0 in the current window. My attempts at adding,

bind-key C-0 select-pane -t 0

to my .tmux.conf have failed. Is there something else I'm missing?

duckworthd
  • 14,679
  • 16
  • 53
  • 68
  • 1
    do you have one line in your `tmux.conf`: `set -g base-index 1` or `set -g pane-base-index 1`? if yes, your window/pane is 1 based. – Kent Sep 08 '13 at 12:57
  • I do, but the statement holds for all numbers other than 0. – duckworthd Sep 08 '13 at 17:28

2 Answers2

77

Not exactly the way you are looking for, but I doubt you have a reason not to love the following:

  1. display-panes or the likes (<prefix> + q by default),
  2. enter the number of the pane you are switching to.
Covi
  • 1,331
  • 1
  • 14
  • 17
5

You need to modify your terminal so that tmux can recognise control+digit keystrokes correctly. (source: https://unix.stackexchange.com/questions/96884/using-ctrl0-9-to-cycle-between-windows-using-tmux)

If you are using iTerm2, for example, then:

  1. go to Preferences > Profiles > Keys and click +
  2. input ctrl+0 as the keyboard shortcut
  3. select Send Escape Sequence from the action drop-down menu
  4. input Esc+[27;5;48~ in the characters to send textbox
  5. click OK, then restart iTerm

Then, finally add to your .tmux.conf the following:

bind-key C-0 select-pane -t 0

restart tmux (make sure to close all sessions withtmux kill-session). You should now be able to select pane number 0. To get the other 9 keys to work, repeat the above 5 steps with the appropriate escape sequences. They can be found in the link provided.

Community
  • 1
  • 1
James Lawson
  • 8,150
  • 48
  • 47