# Terminal tabs: a real terminal inside Skink

> Open a shell or any program in a Skink terminal tab with Shift+F12, flip back with F12, search the scrollback, open file:line links and jump between prompts.

Source: https://skink.cc/tools/terminal-tabs/

Press Shift+F12 to open a terminal tab with your shell. F12 flips between it and your file, and F11 closes it.

`:term CMD` opens a new tab running `CMD` instead of a shell, for example `:term claude` or `:term htop`.

Terminal tabs are real terminal emulators in a pty: colours, mouse, the alternate screen. Shells, TUIs and AI CLIs run unchanged.

They sit in the same tab bar as your files, and their tab title follows what the program inside sets, like Ghostty.

## Terminal keys

| Key | Typed command | Does |
|---|---|---|
| Shift+F12 | `:newterm` | Open another terminal tab |
| F12 | `:toggleterm` | Jump between the current file and your terminal tab |
| F11 | `:closeterminal` | Close the active terminal tab |
| Alt+T | `:termdock` | Show or hide a shell docked along the bottom |
| Shift+F11 | `:scrollback` | The terminal's history in a tab |
| Shift+F2 / Shift+F3 | `:prevprompt` / `:nextprompt` | Previous / next shell prompt |
| Shift+F4 | `:lastoutput` (`:scrollback last`) | Select the last command's output |
| Alt+1 … Alt+9 | | Jump to tab N |
| Ctrl+PageUp / Ctrl+PageDown | `:prevtab` / `:nexttab` | Previous / next tab |

Type the commands from a file tab, after Ctrl+E. Inside a terminal tab, Ctrl+E goes to the shell. For the short names (`:newterm`, `:toggleterm`, `:nextprompt` and so on), see [Typed commands](https://skink.cc/editing/typed-commands/).

**While debugging:**
During a debug session, F11 steps into and Shift+F11 steps out. The rest of the time they close the terminal and open its history, as above.

## Which keys reach the program

In a terminal tab every key goes to the program inside, so your shell keeps Ctrl+T, Alt+., Ctrl+R, Ctrl+E and the rest. The exceptions are:

- Alt+1 … Alt+9
- Ctrl+PageUp / Ctrl+PageDown
- F-keys bound to Skink's own actions: F1 command palette, F8 file tree, F11, F12, the Problems list, the debugger keys, and the Shift+F-keys above.

F-keys bound to editor actions, like F10 (quit) and F2 (save), go to the program. That keeps `htop` and `mc` usable.

Because these are ordinary bindings, you can move them in `bindings.json`. The actions are `ToggleTerminal`, `NewTerminal`, `CloseTerminal`, `ToggleTree`, `ToggleSidebar`, `PreviousTab` and `NextTab`.

When the program exits, the tab closes on the next key you press.

## Run commands in a terminal

| Command | Does |
|---|---|
| `:term` | New terminal tab with your shell |
| `:term COMMAND...` | New terminal tab running `COMMAND` |
| `:run COMMAND...` | Run in the background in the project root; the output fills a read-only tab when done |
| `:task` | Run a project task in a terminal tab (see [Tasks](https://skink.cc/code/tasks/)) |

New terminals start in the project root with your `$SHELL`. On Windows that is `pwsh`, else Windows PowerShell, else `cmd`.

## Scrollback and copying

The mouse wheel scrolls the scrollback, unless the program tracks the mouse itself (then it gets the wheel). Skink keeps 3000 lines per terminal.

Shift+F11 opens the terminal's history in a tab where editor keys work:

- Ctrl+F searches it.
- Shift+arrows select (a keyboard copy mode), Ctrl+C copies.
- Enter on a line with `file:line[:col]` opens that file there.

### Open file:line links

Ctrl+click a `file:line[:col]` right in the terminal to open it. Compiler errors, test failures and `grep -n` output become links.

## Prompt marks (OSC 133)

Jumping between prompts and selecting the last output need a shell that marks its prompts with OSC 133.

fish 4 and later does this out of the box, and so do the shell-integration scripts of Ghostty, WezTerm and VS Code. For bash, add to `~/.bashrc`:

```bash
PS0='\e]133;C\a'
PROMPT_COMMAND='printf "\e]133;D;$?\a\e]133;A\a"'
PS1="$PS1"'\[\e]133;B\a\]'
```

With marks, Alt+Shift+E sends exactly the last command's output to the AI agent. See [AI agents](https://skink.cc/tools/ai-agents/).

## Terminals and splits

A terminal can be shown in a split pane next to a file, but only in one pane at a time.

The bottom dock (Alt+T) is the quickest way to keep a shell in view. Press it again to hide the dock; the shell keeps running in its tab. See [Splits and docks](https://skink.cc/editing/splits-and-docks/).

Sessions bring shells back: `skink` with no arguments in a project reopens its shells in their last folder. The programs that were running in them are not restarted.
