Tmux: Switch the split style of two adjacent panes

Steven Lu picture Steven Lu · Mar 15, 2013 · Viewed 19.7k times · Source

I realize that reshaping pane layout in general is not trivial to describe, but I'm interested in at least being able to swap the layout of two adjacent panes.

Suppose I've got these panes laid out like this

 _____________
|    |        |
|    |   2    |
|    |________|
| 0  |        |
|    |        |
|    |        |
|    |   3    |
|____|        |
| 1  |        |
|____|________|

And I now discover that I want even more vertical space with pane 3. It's clearly not trivial to consider how I could rearrange it with pane 0 or 1 but it would be really nice if I could tell 3 and 2 to flip splitting axis:

 _____________
|    |     |  |
|    |     |  |
|    |     |  |
| 0  |     |  |
|    |  3  |2 |
|    |     |  |
|    |     |  |
|____|     |  |
| 1  |     |  |
|____|_____|__|

(note here tmux will most likely reorder it so the old 3 becomes the new pane #2)

Currently when I try to run join-pane -h to reorganize it it tells me "cannot join pane to its own window". Yeah, well, I'm just trying to shuffle it without disrupting the entire layout.

I guess a workaround is to break it out to its own named window and then immediately join it back, though it looks like it won't be able to determine the orientation to switch to (horizontal vs vertical).

Note this is different from the operation of swapping the locations of two panes, for which there exists a command ready to use. I'm looking to swap the splitting axis.

Answer

Brandon picture Brandon · Oct 18, 2013

Prefix + Space is bound to next layout