Skip to content

The terminal

Each working folder has its own terminals: shells that start in a session’s folder, beside the agent’s work, or in a project’s, with no session (see Projects). A session’s working folder is its worktree, where it has one, else its own folder. Every session working in one folder shares its terminals: two sessions in one folder, or a worktree session and another session started in that worktree, see the same tabs, as they were left. A session in another folder, or in another worktree of the same repository, has its own.

They belong to Moontors’ background service, as sessions do, so they keep running when you close the window, open another session or quit Moontors: the background service stays up while any terminal runs.

  • The Terminal button at the window’s right edge, under Git, opens the terminal over the board and the transcript for the session or project in focus, and closes it again. The view’s header names it, and its X button closes it. Escape closes it too, except in the terminal itself or in a tab’s name you’re editing.
  • The first time you open it in a folder, it starts a shell. After that it shows the folder’s terminals as you left them, whichever session of that folder you open it from.
  • With no session or project in focus, the button is dimmed. Right after an update, it waits until the new version’s background service has taken over, and its tooltip says so.
  • Each terminal is a tab, named by the title its shell sets, or else by the shell’s name. The Left and Right arrow keys move between tabs, and Home and End go to the first and the last.
  • Double-click a tab’s name, or press F2 on it, to rename it in place. Enter or clicking away keeps the name, up to 64 characters, and Escape drops it; an empty name gives back the shell’s title. The name lasts as long as the terminal does, over any title its shell sets.
  • New terminal, the + at the right end of the tabs, starts another shell. A folder can have 10 terminals at once; at 10, the button says so.
  • A tab’s X closes it, ending its shell and whatever runs in it. A tab whose terminal has already gone closes the same way.
  • When a shell exits, its tab is struck through, and showing it says the code it exited with. Its last screen stays until you close the tab.
  • Showing a tab again shows its screen as it is now, with up to 10,000 lines of what came before, scrolled back to where you left it. Each folder keeps its tabs, the one it showed and their scroll while the window is open, and its tabs’ names and order across a restart.
  • In a folder you added as a project, the shells go on running when its last session is archived, deleted or moved, until you remove the project; focus the project to reach them.
  • In any other folder, when its last session is archived or deleted, or /cd moves it to another folder, its shells end, and the folder remembers its tabs: their names and order, and the one it showed. The first time a session started there later shows Terminal, each comes back as a fresh shell, with no old output, under the name you gave it. Moontors keeps this for the 20 folders left most recently, across a restart too. An archive asks every question first, such as about a worktree’s changes, before any shell ends, so Cancel leaves them running. If it’s refused only after they ended, as when files changed while the agent stopped, or git couldn’t remove the worktree, the tabs come back the same way for the session still there.
  • On macOS, your login shell; on Linux, an interactive shell; on Windows, PowerShell.
  • It starts in the session’s folder, or its worktree, or the project’s folder, with the environment the agents get, never Moontors’ own variables: on macOS and Linux, your login shell’s; on Windows, the one Windows gives a new terminal, the machine’s variables and yours, as System Properties sets them, with your session’s.
  • That environment is read again for each new terminal, so a variable you’ve changed shows in the next one.
  • It keeps one size, the one it was last resized to.
  • The terminal keeps Escape and the shell’s own control keys, such as Ctrl+C. Escape in the terminal never closes the view.
  • Shift+Escape leaves the terminal for its tab, so the keyboard is never held there.
  • Copy and paste as each system’s terminals do:
    • macOS: Cmd+C and Cmd+V, from the Edit menu;
    • Windows: Ctrl+C copies what’s selected, once, so pressed again it interrupts the shell; Ctrl+V pastes;
    • Linux: Ctrl+Shift+C and Ctrl+Shift+V.
  • On Windows and Linux, the menus’ shortcuts give way while the terminal has the focus, but for Ctrl+P, which opens Go to File… rather than going to the shell, as VS Code’s terminal does for Quick Open (see Going to a file).

Right-click the terminal, or press the menu key or Shift+F10 in it, for its menu. Copy and Paste show their keys beside them.

  • Copy puts what’s selected on the clipboard. With nothing selected, it’s dimmed.
  • Paste pastes the clipboard into the shell, as the paste keys do.
  • Clear empties the screen and the scrollback but the line the cursor is on, the prompt’s, all of it where a long one wraps onto more rows, and they stay cleared when the terminal shows again. While a program fills the whole screen, as an editor does, Clear leaves that screen to it. On Windows, resizing the terminal can bring back what Clear cleared, because the console the shell runs in keeps its own copy of the screen.
  • Select All selects every line, the scrollback’s too.
  • A web link the shell prints, or that a program names as a link, opens in your browser on a click. Only https links open.
  • A program may put text on your clipboard, as some editors do, but never read what’s there.
  • Nothing a terminal carries is logged, or kept in the session’s transcript: what you type can be a password.
  • A folder’s terminals end when the last open session working there leaves it: archived, deleted, or moved to another folder with /cd, unless you added the folder as a project, when they end as you remove the project, unless an open session still works there. Before running ones end, archiving or deleting the session, or removing the project, names them, with what runs in each, and /cd asks first with Change folder, saying how many. Archiving or deleting a session while another works in its folder, or in a folder you added as a project, ends none, and its dialog says they keep running, naming the project that reaches them; moving it ends none either, and asks nothing.
  • When Moontors restarts to update, or a newer version takes over its background service, what runs in each terminal stops, and each comes back in its tab, in its order, with its name and its history, on a new shell. A line under its history says so. One whose shell had exited doesn’t come back, nor one in a folder that’s gone, or that no open session works in and you no longer have as a project.
  • When the background service stops any other way, as when it’s killed or crashes, no terminal or history comes back. The first time Terminal shows there after Moontors starts again, each tab it remembers comes back as a fresh shell with its name, in its order.
  • A large paste goes to the shell in pieces of up to about a million characters each, in order.
  • Terminals are on your computer only: the phone doesn’t show them. Archiving or deleting a session from the phone names the running ones it ends, and moving it says how many, before it does.