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?

share|improve this question
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 8 '13 at 12:57
    
I do, but the statement holds for all numbers other than 0. – duckworthd Sep 8 '13 at 17:28

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.
share|improve this answer
1  
This is exactly what I am looking for. But the time of pane number showing is too short, Can I set the time value?? – CodyChan May 23 '14 at 8:15
11  
I got it: put "set display-panes-time 2000 #2s" in .tmux.conf – CodyChan May 23 '14 at 8:40
    
Do you know how to start this pane numbering from 1 instead of 0? – Phani Sep 10 '14 at 19:50
4  
@phani set -g pane-base-index 1 – Silas Paul Jan 28 '15 at 16:04
    
I would love this feature even more if instead of numbers it would output letters for each panel, since they are much easier to type and much closer to the keyboard's home row. – Luis Vasconcellos Sep 22 '16 at 19:02

I was able to do this with tmux version 1.8:

bind-key / display-panes \; select-pane -t :.

This would display the pane id's and then allow me to type in a number to then jump to a pane.

For your specific problem, I was unable to get it to work, because I couldn't get tmux to recognize that C-0 was any different than 0.

share|improve this answer

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.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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