Search code examples
tmux

How to change the position of pane in Tmux


I want to change the postion of a pane such as that I want to change pane 4 to pane 3 after pane 3 exits.


Solution

  • You may want to consider using layouts and rotate-window. For example if you are using main-vertical layout and close the "main" window, then:

    1. Reset the layout with C-b M-4.
    2. Rotate up or down (C-b C-o or C-b M-o) until the desired window is main.

    You might also want to change the prefix to a shorter version. I like back-tick, so I have this in my tmux.conf file:

    unbind-key C-b
    set-option -g prefix `
    bind-key ` send-prefix
    

    And to make C-o and M-o repeatable add:

    bind-key -r C-o rotate-window -U
    bind-key -r M-o rotate-window -D