Moth

Keyboard, tabs and layouts

Move between sessions, find text and save the layouts you use often.

Default shortcuts

Action Shortcut
New window / new tab ⌘N / ⌘T
Select tab 1–9 ⌘1–⌘9
Split right / down ⌘D / ⌘⇧D
Maximise / restore active pane ⌘⇧↩
Close pane ⌘W
Next pane / next tab ⌘] / ⌘⇧]
Move tab left / right ⌃⌘⇧[ / ⌃⌘⇧]
Find / next / previous ⌘F / ⌘G / ⌘⇧G
Settings / reload configuration ⌘, / ⌘⌥R
Saved layouts ⌘⇧R
Reset terminal ⌘R
Toggle keyboard sounds ⌘⌥K
Copy / paste / select all ⌘C / ⌘V / ⌘A
Increase / decrease font size ⌘+ / ⌘−
Save scrollback / print ⌘S / ⌘P
Page setup ⌘⇧P
Full screen ⌃⌘F

Change supported actions in Settings → Shortcuts. In TOML, a binding starts with cmd, can add shift, alt or ctrl, and ends with a single character or return, for example cmd+shift+d. Moth rejects duplicate action bindings. Copy, Paste and Quit use reserved shortcuts.

Tabs and split panes

You can have up to twelve tabs in a window and nine panes in each tab. Splits can be nested, and their native dividers are draggable. Moth won’t add a split if there isn’t enough room. Closing a pane removes the split around it and keeps the other sessions running; closing the last pane closes the window.

Drag tabs along the tab bar to reorder them, or use View → Move Tab Left/Right. Number shortcuts follow the new order. When tabs outgrow the available space, the strip scrolls instead of squeezing their labels. Use the arrows, a trackpad or the mouse wheel to browse, or open the down-chevron menu for the full list. The menu marks the active tab. Selecting through the menu or a keyboard shortcut brings that tab into view.

Drag a tab onto another Moth window to move it, or release it outside Moth windows to open it in a new window. Drop onto the tab strip to choose its position, or into the terminal area to append it. The running shells, splits, scrollback and selection move with it. A window can accept up to twelve tabs. An emptied source window closes.

To rearrange a split, drag its handle beside the close button. Drop in the centre of another pane to swap their positions, or near an edge to place it beside, above or below that pane. The highlighted area shows the destination. Drag a pane’s handle outside the terminal windows to detach it into its own window. Right-click a pane or tab for a Move to New Window action. Panes can move between windows, with up to nine in a tab. A moved pane adopts the destination window’s appearance without reducing its existing history capacity.

Hold Command and click a URL to open it in its registered macOS app. This works for ordinary URLs, including ones that wrap across terminal rows, and OSC 8 hyperlinks supplied by programs. Hold Command over a link to see its destination and underline the clickable text. Right-click for Open Link, Copy Link and the terminal’s Copy, Paste and Select All actions.

Drop a file or folder onto a pane to insert its path, quoted for the shell. You can drop several at once. Moth focuses that pane but doesn’t press Enter for you. If the program supports bracketed paste, the drop uses it.

New tabs and splits start in the active pane’s local shell directory by default, including recovered sessions. Moth reads the directory from macOS, so no shell integration is required. SSH and mosh paths reported by a remote host do not become local starting folders. New windows and named layouts use the profile’s configured starting directory instead. Turn off Settings → Advanced → Open new tabs and splits in the current directory to use that fixed directory for every new session.

Press ⌘⇧↩ to maximise the active pane, then press it again to restore the split layout and divider positions. Cycling panes keeps the maximised view active.

Find in the active pane

Press ⌘F to open Find in the active pane. Searches ignore case unless you enable Match Case. Soft-wrapped text is treated as one line; an actual line break still separates lines. Turn on Regex to use ICU regular expressions. If a pattern is invalid, Find explains why.

Use Return or ⇧Return, or ⌘G and ⌘⇧G, to move between matches. Searches wrap at the beginning and end. Escape closes Find and returns focus to the terminal. To copy a match, close Find first and then press ⌘C. Results update as new output arrives or the pane changes size.

Find stops at 10,000 matches. Regex searches have a 150 ms processing budget, and incomplete results are marked. In an alternate-screen application, Find searches that screen and its available history.

Saved window layouts

Choose Window → Save Window Layout… to save your tabs, splits, divider positions, active pane and window size, along with the profile in use. Press ⌘⇧R to open the layout chooser, where you can open, rename or delete them. Saving under an existing name updates that layout.

Opening a named layout starts fresh shells in a new window and leaves your other windows alone. Named layouts are reusable arrangements; session recovery reconnects to existing processes instead.

Layouts are saved in ~/.config/moth/window-layouts.json, with a .previous backup. Set showLayoutsOnLaunch = false if you don’t want the chooser at launch. Layouts are stored separately from your TOML preferences.

Recover running sessions

Moth starts new sessions in a local helper by default. The helper owns the PTY, so shells and jobs can keep running if the app crashes or disconnects. When you reopen Moth, choose Recover Sessions to reconnect to the original processes, tabs and split arrangement. Moth does not rerun your commands. If a session is unavailable, its pane explains what happened instead of starting a replacement shell.

To leave work running deliberately, choose Moth → Quit and Keep Sessions. Normal Quit, closing a window and closing a pane still end their sessions. The Mac must stay awake for processes to run; recovery cannot survive a Mac restart.

Settings → Advanced → Session recovery controls whether new sessions use the helper:

[advanced]
sessionRecovery = true

Turning this off applies to new sessions. Existing recoverable sessions keep their helper. Quit and Keep Sessions asks you to close any running panes that were started without recovery first.

Window arrangements and session identifiers are saved privately under ~/.config/moth/Sessions/. Terminal output stays in helper memory, with a 64 MB replay buffer per pane. It is not written to a recovery transcript on disk. Recovery replays output and resize events, including ANSI colours and alternate-screen changes, without repeating old bells or clipboard requests. If the buffer fills, the oldest output is discarded; full-screen applications may need Ctrl+L to redraw. A program waiting for a terminal query can wait until the app reconnects.

Recovery reconnects live processes. It cannot recreate a process after its helper has died, recover an exited pane after its helper closed, or resume detached jobs that were never part of the session.

During reconstruction, a Restoring session indicator covers the intermediate output. Moth reveals the terminal when it has caught up and restores input focus without interrupting an open search field.