What is the best way to split every pane of the current window into two? I'm asking because it provides a way to quickly exponentiate the amount of panes, e.g. 5 splits equal 32 panes.

After activating pane synchronization with :setw synchronize-panes on I expected the<prefix> + % (or ") to split all panes, but it only splits the currently active pane.

I've cobbled together this command that iterates over all current panes in reverse and splits each one, but it seems a bit cumbersome: tmux lsp -F "#{pane_index}" | tac | xargs -I{} tmux split-pane -t {} (attach -h to split sideways).

Is there any easier way to split all panes of the current window? Thanks!

1 Answer 1


Since no one answered, I'll put my ugly hack below - it's not polished but it works and is fast to use.

I set up an alias in my ~/.bash_profile that creates and calls a function that takes the number of splits as an argument.

alias splitpanes='_splitpanes() { for i in $(seq "$1"); do tmux lsp -F "#{pane_index}" | tac | xargs -I{} tmux split-pane -t {} $(if [ $(($i%2)) -eq 0 ]; then echo "-h"; fi;); done; }; _splitpanes'

With the modulo 2 check half of the times it splits it horizontally, so that in the end you end up with 2 ^ splits evenly-sized panes.

Now I can e.g. call splitpanes 6 and end up with 64 panes (after a few seconds of rendering).

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .