Is there any way to get tmux to do the equivalent of Vim's window rotation (ctrl-w r and ctrl-R), where it rotates only in one direction? Tmux's normal window swap command ( ctrl-o) just rotates all panes around in a kind of circle.
Tmux: rotate panes vertically or horizontally
tmux
Related Solutions
Add this to your ~/.tmux.conf
:
set-option -g default-shell /bin/bash
unbind Up
unbind Down
unbind Right
unbind Left
bind Up run-shell "if [ $(tmux display-message -p '#{pane_at_top}') -ne 1 ]; then tmux select-pane -U; fi"
bind Down run-shell "if [ $(tmux display-message -p '#{pane_at_bottom}') -ne 1 ] ; then tmux select-pane -D; fi"
bind Right run-shell "if [ $(tmux display-message -p '#{pane_at_right}') -ne 1 ]; then tmux select-pane -R; fi"
bind Left run-shell "if [ $(tmux display-message -p '#{pane_at_left}') -ne 1 ]; then tmux select-pane -L; fi"
Basically, this should run with tmux versions 2.6 + (after which they added the pane_at_top, pane_at_bottom, pane_at_left, pane_at_right environment variables. For tmux < v2.6, I'm not entirely sure how you could implement this.
Further more, if you want to launch a custom-shell, do it through set-option -g default-command fish
(or zsh or csh or whatever). As an alternative, if you want to use a non-bash shell as your tmux default shell, set it as such (set-option -g default-shell
) and then you can code out the logic above in the shell script of your choice. However, (as was in my case) using certain shells doesn't give you the convenience of one-liner if commands (or it might just be I don't know enough about certain shells, or maybe multiple lines do work in run-shell.
This is an old post, actually this problems was already solved by commit aad4e4d on github page a long ago, use choose-tree
(just bind it to a key) to show all panes in all sessions/widows/tabs, it even shows a preview box when you scroll line into one pane from the list, very nice.
Just compile and install tmux
from github source code and you can use this feature.
Best Answer
Yes: try Ctrl+F3 and Ctrl+F4 t swap upper or lower panes. You can also iterate to reach other configurations.