# Split panes & workspaces

A tab can hold several terminals side by side or stacked — **panes**. Saved with their layout, a set of panes is a **workspace** you can reopen with one click.

## Splitting

- **Split right** (<kbd>Ctrl</kbd>+<kbd>Shift</kbd>+<kbd>D</kbd>, <kbd>⌘</kbd>+<kbd>D</kbd> on macOS) or **split down** (<kbd>Ctrl</kbd>+<kbd>Alt</kbd>+<kbd>Shift</kbd>+<kbd>D</kbd>, <kbd>⌘</kbd>+<kbd>⇧</kbd>+<kbd>D</kbd>) splits the focused pane in two. The buttons are also in the title bar (the split icon), in a pane's header, in the tab's right-click menu and in the command palette.
- The new pane opens the same kind of session as the pane you split: another connection to the same host, or a local shell with the same profile in the same directory.
- Splitting in the same direction again divides that pane's space, so you can build any layout: three columns, a large pane with two stacked ones beside it, and so on. A tab holds up to 16 panes; a pane that is too small to split says so.
- In the **new-tab dialog** (<kbd>Ctrl</kbd>+<kbd>Shift</kbd>+<kbd>N</kbd>, <kbd>⌘</kbd>+<kbd>O</kbd>), tick several hosts and choose **Create workspace** to open them as panes of one tab, in a grid.

## Focus

The focused pane — the one your typing goes to — has a coloured outline and a highlighted header. Click a pane to focus it, or move with <kbd>Alt</kbd>+arrow keys (<kbd>⌘</kbd>+<kbd>⌥</kbd>+arrows on macOS) to the pane in that direction. <kbd>Ctrl</kbd>+<kbd>Alt</kbd>+<kbd>→</kbd> / <kbd>←</kbd> (<kbd>⌘</kbd>+<kbd>]</kbd> / <kbd>[</kbd>) goes through the panes in order.

## Resizing

- Drag a **divider** between panes; it lights up when you can grab it. **Double-click** it to make the panes on both sides equal, or use **Equal sizes** in the tab's toolbar for the whole tab.
- From the keyboard, <kbd>Alt</kbd>+<kbd>Shift</kbd>+arrows (<kbd>⌘</kbd>+<kbd>⌃</kbd>+arrows) move the nearest divider of the focused pane in that direction. Dividers can also be focused with <kbd>Tab</kbd> and moved with the arrow keys.
- Sizes are proportions, so the layout keeps its shape when the window changes size. Panes keep a minimum size while you drag.

## Maximizing

**Maximize** (<kbd>Ctrl</kbd>+<kbd>Shift</kbd>+<kbd>Enter</kbd>, <kbd>⌘</kbd>+<kbd>⇧</kbd>+<kbd>Enter</kbd>, the ⤢ button or double-clicking a pane's header) shows one pane on its own, filling the tab. The toolbar then says **Maximized**; click it, press the shortcut again or move focus to another pane to bring the others back.

## Moving panes

Drag a pane by its **header**, or a **tab** from the tab bar, while the target tab is showing. A highlight shows where it will land:

- an **edge** of a pane puts it on that side of the pane,
- the **centre** of a pane swaps the two (a tab you drop there takes the pane's place, and the pane becomes a tab where the dragged tab was),
- the **tab bar** turns a pane into a tab of its own. **Move to new tab** in a pane's menu does the same.

Hover over another tab while dragging to switch to it, then drop into one of its panes. Press <kbd>Esc</kbd> to cancel a drag. Sessions keep running while they move: nothing reconnects.

## Closing

<kbd>Mod</kbd>+<kbd>W</kbd> or a pane's **×** closes the focused pane; when one pane is left, it becomes a normal tab again. As with tabs, closing a pane in which a command is still running asks first.

## Broadcast

Turn on **Broadcast** (<kbd>Mod</kbd>+<kbd>Shift</kbd>+<kbd>B</kbd>) to send every keystroke to all panes of the tab — handy for running the same update on a fleet, or comparing output side by side. All panes are outlined in red while broadcast is on; turn it off before typing anything host-specific.

> **Warning**
>
> Broadcast sends exactly what you type, including mistakes, to every host at once. Snippets can also [run on many hosts](http://vaultport.niessen.dev/guide/snippets.md#running-on-several-hosts) with a confirmation step instead.

## Saving workspaces

**Save** in a split tab's toolbar stores its panes and their layout in the vault: the hosts, local shells (with their directory) and the sizes of every split. Saved workspaces appear under **Workspaces** in the new-tab dialog, open as new connections in the same layout, and sync with the rest of your vault. Quick connections and serial ports are not saved; panes of hosts you deleted are left out when you open a workspace.

**Reopen tabs on start** (Settings → Terminal) also brings back your split tabs, layouts included.

## Phones

Phones show one pane at a time: the chips above the terminal switch between the panes of a tab. Splitting and dragging are not available there; saved workspaces open there too, one pane at a time.

## Tips

- Give the hosts of a workspace distinct terminal themes per environment to see at a glance which pane is production.
- Every pane shortcut can be changed in **Settings → Shortcuts**; see [Keyboard shortcuts](http://vaultport.niessen.dev/guide/keyboard-shortcuts.md#split-panes-workspaces).
