How do I shove a pane to the left in tmux?

Solution 1:

I've run into this problem a few times and google is utterly useless. Luckily the man page isn't too difficult to read. And documenting this will provide a quick reminder the next time I forget.

The command you're looking for is move-pane.

You'll have to run it a couple times. I've reindexed the pane numbers to match tmux's convention. Since Pane 0 ultimately borders the other two panes, you should imagine that you're moving Pane 1 (right of 0), and then moving Pane 2 (below Pane 1).

┌──────┐                            ┌──────┬──────┐
│Pane 0│    PREFIX + :              │Pane 0│Pane 1│
├──────┤    move-pane -h -s 1 -t 0  │      │      │
│Pane 1│                            ├──────┴──────┤
├──────┤                            │Pane 2       │
│Pane 2│                            │             │
└──────┘                            └─────────────┘
                                    ┌──────┬──────┐
            PREFIX + :              │Pane 0│Pane 1│
            move-pane -v -s 2 -t 1  │      │      │
                                    │      ├──────┤
                                    │      │Pane 2│
                                    │      │      │
                                    └──────┴──────┘

Here are rough keybindings to achieve the same. Just make sure to focus the pane that will move first.

bind-key g command-prompt -p "place below. select target window" "move-pane -h -t %%"
bind-key G command-prompt -p "place right of. select target window" "move-pane -h -t %%"

If you have trouble figuring out the pane numbers, remember that the number is assigned by order, the number doesn't stick with any particular pane. Use a keybinding to display the pane numbers before each movement. The default is PREFIX + q. If yours is different, you can use PREFIX + ? to find it.

Solution 2:

If I understand what you mean try with:

PREFIX + %   # Create a vertical split
PREFIX + "   # In right pane create a horizontal split

Starting with only one pane. By default PREFIX = Ctrl + b, move between panes with PREFIX + q then type pane number.

EDIT: Wait wait(I didn't take into account that the panes already exist), try with this:

PREFIX + SPACE

Try this various times until the arrangement is the desired.