If you always want Ca
- Switch between panels when the active window has more than one panel, and
- Switch between windows when the active window has only one panel,
then you can use an if-shell , which counts the number of panels in the active window, to choose between last-pane and last-window :
bind-key Ca if-shell 'test $(tmux list-panes | wc -l) -gt 1' 'last-pane' 'last-window'
When switching between wide and square configurations (for example, through break-pane and join-pane ), it will still be “up to you” to rearrange your panels.
In tmux 1.8, if-shell and run-shell format the extension, so you can simply execute the shell command:
bind-key Ca if-shell 'test #{window_panes} -gt 1' 'last-pane' 'last-window'
Chris johnsen
source share