Search code examples
macositerm2

How to undo split panels in iTerm2?


I've started using iTerm2. I like the functionality of splitting panels using

Cmd + d

and

Cmd + Shift + d

But how can I undo this splitting?


In the standard terminal Cmd + d can be undone using Cmd + Shift + d, but in iTerm it's used for horizontal split.


Solution

  • I like the functionality of splitting panels using Cmd + d

    Note that whilst this even in iTerm2's official docs is described as Split Panes

    Split Panes

    iTerm2 allows you to divide a tab into many rectangular "panes", each of which is a different terminal session. The shortcuts cmd-d and cmd-shift-d divide an existing session vertically or horizontally, respectively. You can navigate among split panes with cmd-opt-arrow or cmd-[ and cmd-]. You can "maximize" the current pane--hiding all others in that tab--with cmd-shift-enter. Pressing the shortcut again restores the hidden panes.

    if you only start with a single terminal session, the splitting comes with the side effect of starting another session. As per the docs, you can either maximize a single pane using

    Cmd + Shift + Enter
    

    which leaves the hidden panes alive as active terminal sessions. Moreover, you can kill the terminal session of the active pane using

    Cmd + w
    

    Which comes with the iTerm2 side effect that the corresponding pane will also be closed.

    Note that repeated use of Cmd + w will, after closing all terminal sessions, eventually close the final terminal session and the iTerm2 tab itself.

    Example of Cmd + w to close terminal session (with the effect of closing the panes that used to hold them):

    enter image description here