Whenever I use tmux split-window -h/v
, it creates the new split to the right/bottom, respectively. I want a command that creates the new split on the other side (i.e., to the left/top), but I can't find any simple answer for this anywhere... How can I bind this behavior into a shortcut?
What happens by default:
_______ _______
| | | | |
| * | == split-window -h => | | * |
| | | | |
------- -------
What I want a shortcut for:
_______ _______
| | | | |
| * | == ? => | * | |
| | | | |
------- -------
For example, to create a new window the hard way, you can press Ctrl+B followed by : to enter the tmux command line. Type new-window and press Enter to create a new window. This does exactly the same thing as pressing Ctrl+B then C.
Tmux uses the keybinding 'Prefix' followed by 'Ctrl+o' to cycle around the panes. When you use this key-binding for the first time, it moves the pane in one position clockwise.
by default. Execute this in the tmux command-line: :join-pane -t <int> , where <int> is the index of the window you want to move it into. You can optionally specify -h or -v to explicitly tell tmux to attach the current pane as a horizontal-split or a vertical-split on the target window, respectively.
As from version 2.0, tmux's split-window
and join-window
understand -b
to create the pane to the left or above the target pane.
Split horizontally and place at the left:
tmux split-window -hb
Split vertically and place at the top:
tmux split-window -vb
Update:
From inside tmux
you can use }
for swapping the panels once you have split the window:
Example for vertical splitting:
Ctrl + B + %
Ctrl + B + }
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With