To rotate panes in tmux, use the rotate-window
command. Press Ctrl+b } to rotate panes clockwise or Ctrl+b { to rotate counterclockwise. These commands swap the positions of panes while maintaining their content, allowing you to quickly rearrange your workspace without changing the layout structure.
# Rotate clockwise Ctrl+b } # Rotate counterclockwise Ctrl+b {
Rotating panes in tmux allows you to quickly rearrange your workspace without affecting the content of each pane or the overall layout structure. This is particularly useful when you want to optimize your view based on the current task or bring a specific pane into a more convenient position.
tmux provides two default keybindings for rotating panes:
When you press these key combinations, the panes will shift positions while maintaining their content and size. The rotation happens in the order the panes were created, not necessarily in visual order.
You can also rotate panes using the tmux command prompt:
# Enter command mode with Ctrl+b :, then type: rotate-window -D # Rotate clockwise (Down) rotate-window -U # Rotate counterclockwise (Up)
The -D
flag rotates clockwise (Down), and -U
rotates counterclockwise (Up). These commands correspond to the } and { keybindings respectively.
To understand how rotation works, consider this example of a window with three panes arranged vertically:
┌──────┬──────┐ │ A │ B │ │ │ │ ├──────┘ │ │ C │ │ │ └─────────────┘
After pressing Ctrl+b } (clockwise rotation), the panes would rearrange to:
┌──────┬──────┐ │ C │ A │ │ │ │ ├──────┘ │ │ B │ │ │ └─────────────┘
The content and relative size of each pane remains the same, but their positions have shifted.
If you find yourself rotating panes frequently, you might want to set up more intuitive keybindings in your ~/.tmux.conf
file:
# More intuitive pane rotation keybindings bind-key r rotate-window -D # Ctrl+b r to rotate clockwise bind-key R rotate-window -U # Ctrl+b R to rotate counterclockwise
There are a few things to keep in mind when rotating panes:
select-layout
command instead.