# Terminal

Source: https://athas.dev/docs/terminal

Integrated terminal with shell integration, split panes, and multiple shells

Athas includes a built-in terminal so you can run commands without leaving the editor.

## Features

- **Multiple Terminals**: Create as many terminal tabs as you need and pin the important ones
- **Split Panes**: Split any terminal right or down, nest splits, and drag the dividers
- **Shell Selection**: Choose bash, zsh, fish, nushell, PowerShell, or a custom profile
- **Shell Integration**: Prompt marks, exit codes, and working-directory tracking for zsh, bash, fish, PowerShell, and Git Bash
- **Clickable Links**: URLs, file paths with line numbers, and OSC 8 hyperlinks open with `Cmd/Ctrl+Click`
- **Command Notifications**: Get told when a long command finishes in a terminal you are not looking at
- **Terminal Persistence**: Terminals and their split layouts restore across app restarts
- **Search**: Use `Cmd/Ctrl+F` to search terminal output

On Windows, WSL distributions appear as terminal shells. Terminals created from WSL workspaces
start in the matching Linux distribution and working directory. See [WSL](https://athas.dev/docs/wsl).

## Shell Integration

When shell integration is enabled (the default), Athas injects a small script into supported
shells at launch. Nothing is written to your dotfiles.

- Each prompt gets a mark in the gutter that turns green or red once the command finishes
- `Cmd/Ctrl+Up` and `Cmd/Ctrl+Down` jump between previous and next commands
- **Copy Last Command Output** (`Cmd/Ctrl+Shift+C`) copies exactly what the previous command printed
- The tab title follows the shell's working directory
- Programs that report progress (for example `winget` or a build script using OSC 9;4) show a
  progress indicator in the tab

Shell integration can be turned off under **Settings → Terminal → Launch**.

## Split Panes

- Split the focused terminal with `Cmd/Ctrl+D` (right) or `Cmd/Ctrl+Shift+D` (down)
- Split any tab from its context menu, or drag a tab onto the edge of a terminal pane
- Drag the divider to resize; double-click it to make the panes equal again
- `Cmd/Ctrl+Alt+Left` and `Cmd/Ctrl+Alt+Right` move focus between panes
- **Unsplit** from the context menu or command palette moves a pane back into its own tab
- Closing a pane collapses the split and focuses its neighbour

## Links

Hover a link to see where it goes, then `Cmd+Click` (macOS) or `Ctrl+Click` (Windows, Linux) to
open it. Web and mail links open in your browser. File paths, including `path:line:column` forms
printed by compilers and test runners, open in the editor at that position. Tools that emit OSC 8
hyperlinks, such as `ls --hyperlink` and ripgrep, work the same way.

## Command Notifications

If a command runs for at least ten seconds and finishes while its terminal is hidden, not the
active tab, or the window is in the background, Athas shows a toast with a **Show** action, adds
an entry to the notification center, and sends a native notification when the app is not focused.
Inactive tabs also show a green or red dot until you look at them. Turn this off under
**Settings → Terminal → Launch → Command Notifications**.

## Colors

Every builtin theme ships a full 16-color ANSI palette, so `ls`, `git`, and test runners look as
their authors intended. Custom themes can define `terminal-black` through `terminal-bright-white`.
The **Minimum Contrast** setting lifts colors that would be hard to read against the background
without changing the theme itself.

## Context Menu

Right-click a terminal tab for:

- Pin/Unpin Terminal
- Split Right, Split Down, and Unsplit
- Duplicate Terminal
- Clear Terminal
- Rename Terminal
- Export Output
- Close Terminal, Close Others, Close All, Close to the Right

## Keyboard Shortcuts

**Terminal Management**

- `Cmd/Ctrl+N` - New terminal while the terminal is focused
- `Cmd/Ctrl+W` - Close current terminal or pane
- `Cmd/Ctrl+D` - Split right
- `Cmd/Ctrl+Shift+D` - Split down
- `Cmd/Ctrl+Alt+Left` / `Cmd/Ctrl+Alt+Right` - Focus previous / next pane
- `Ctrl+PageUp` / `Ctrl+PageDown` - Previous / next terminal
- `Cmd/Ctrl+1-9` - Switch to terminal by number

**Terminal Operations**

- `Cmd/Ctrl+F` - Search in terminal
- `Cmd/Ctrl+K` - Clear terminal
- `Cmd/Ctrl+Shift+A` - Select all
- `Cmd/Ctrl+Shift+C` - Copy last command output
- `Cmd/Ctrl+Up` / `Cmd/Ctrl+Down` - Previous / next command
- `Cmd/Ctrl++` - Increase font size
- `Cmd/Ctrl+-` - Decrease font size

Every shortcut can be changed under **Settings → Keyboard**.
