2. Tabs, splits, and focus#
In this chapter you arrange several shells in one window without the mouse.
Tabs#
A tab is a separate work area. Each tab has its own panes.
| Action | Keys |
|---|---|
| New tab | Ctrl+Shift+T |
| Next or previous tab | Click the tab, or use the command palette |
Splits#
A split divides the current pane into two panes. Each pane is its own shell.
| Action | Keys |
|---|---|
| Split to the right | Ctrl+Shift+O |
| Split down | Ctrl+Shift+E |
| Move focus left, right, up, down | Ctrl+Alt+Arrow |
Splits nest: split a pane again to make three or more panes. Drag the line between two panes to change their sizes.
Maximize and restore#
To work in one pane for a while, maximize it. The other panes stay where they are and come back when you restore.
| Action | Keys |
|---|---|
| Maximize the active pane, or restore | Ctrl+Shift+Return |
On a tablet, open the pie menu, then choose Panes → Layout.
Find your way back: the scroll map#
The scroll map is still experimental and off by default. Turn it on in
~/.config/mpmux/config.toml:
[host-ui]
scroll-map = true
Then scroll a pane and a map appears on its right edge. It shows the whole scrollback as an outline and where you are in it, and fades out two seconds after you stop.
- Each command you ran sits at its place, as you typed it. Failed commands are red with a ✗; agent answers show their first line after a ◆. A bar shows how much output each one has.
- Drag in the map to move block by block: the command under the pointer is shown from its start. Hold Shift to scroll freely.
- In narrow panes the map is a thin bar with coloured ticks.
| Action | Keys |
|---|---|
| Previous prompt | Ctrl+Shift+PageUp |
| Next prompt | Ctrl+Shift+PageDown |
The marks come from your shell. Shells report prompts with the OSC 133 escape sequence; fish does this on its own. For bash or zsh, add a few lines to your shell configuration:
# ~/.bashrc
PS1='\[\e]133;A\a\]'"$PS1"
PS0='\e]133;C\a'
PROMPT_COMMAND='printf "\e]133;D;%s\a" "$?"'"${PROMPT_COMMAND:+;$PROMPT_COMMAND}"
# ~/.zshrc (at the end; works with oh-my-zsh and other prompt themes)
_mpmux_osc133_precmd() { print -n "\e]133;D;$?\a\e]133;A\a" }
_mpmux_osc133_preexec() { print -n "\e]133;C\a" }
precmd_functions=(_mpmux_osc133_precmd $precmd_functions)
autoload -Uz add-zsh-hook
add-zsh-hook preexec _mpmux_osc133_preexec
_mpmux_osc133_input() { [[ $PS1 == *'133;B'* ]] || PS1+=$'%{\e]133;B\a%}' }
precmd_functions+=(_mpmux_osc133_input)
The last two lines mark where the typed command starts, so the map shows exactly the command (and not parts of a fancy prompt).
Any program can set a mark of its own with printf '\e]1337;SetMark\a';
agents can mark where each answer starts.
Coding agents#
The map works with agents that write into the terminal's scrollback. Full-screen agents draw on the alternate screen and scroll their history themselves, so the terminal has nothing to map. Switch them to their inline mode:
- pi marks your prompts and its answers itself. Set
"tuiMode": "regular"in~/.pi/agent/settings.json; each turn then shows in the map with its first line. - Claude Code: set
"tui": "default"in~/.claude/settings.jsonand install mpmux's prompt marks, which mark each prompt you send:
sh
mpmux-cli agents install claude --with prompt-marks
Marks also work in hosted sessions (mpmux-sessiond).
Close a pane#
Exit the shell in the pane, for example with exit or Ctrl+D. The other panes
fill the space.
Next#
Chapter 3 shows how to keep shells running when you close the window.