Tmux has normal keybindings to split terminals horizontally and vertically. But it splits right and below the currently active pane. Is there a way to split the currently active pane so that the new pane spawns on the left and above the currently active pane?
1 Answer
From man tmux
:
split-window [-bdfhvP] [-c start-directory] [-l size | -p percentage] [-t target-pane]
[shell-command] [-F format]
(alias: splitw)
Create a new pane by splitting target-pane: -h does a horizontal split and -v a
vertical split; if neither is specified, -v is assumed. The -l and -p options
specify the size of the new pane in lines (for vertical split) or in cells (for
horizontal split), or as a percentage, respectively. The -b option causes the
new pane to be created to the left of or above target-pane. The -f option cre‐
ates a new pane spanning the full window height (with -h) or full window width
(with -v), instead of splitting the active pane. All other options have the
same meaning as for the new-window command.
So, putting the following lines in ~/.tmux.conf
and sourcing it would result in the desired behavior. Notice the -b
option.
# pane splitting
bind -r v split-window -bh
bind -r b split-window -bv