# Terminal

Nana's terminals run in the [server](https://nana.areshk.dev/docs/features/server.md), powered by
[Ghostty](https://github.com/ghostty-org/ghostty). They keep running after you
quit the app, and every app shows the same screen and history.

## Tabs and splits

| Action | Default shortcut |
| --- | --- |
| New tab | `Ctrl+Shift+T` |
| New tab in Home | `Ctrl+Shift+N` |
| Split right / down | `Ctrl+Shift+D` / `Ctrl+Shift+Alt+D` |
| Move focus between panes | `Alt+Arrows` |
| Zoom the pane | `Ctrl+Shift+Return` |
| Close pane / tab | `Ctrl+Shift+W` / `Ctrl+Alt+W` |
| Next / previous tab | `Ctrl+Tab` / `Ctrl+Shift+Tab` |
| Go to tab 1–9 | `Alt+1`–`Alt+9` |

- New panes open in the project folder. Set **Settings → Terminal → New pane
  directory** to open them in the current pane's folder instead.
- Drag dividers to resize, or even them out with **Equalize Splits**
  (`Ctrl+Alt+=`, or a pane's right-click menu). `Win`-drag a pane onto another
  pane to swap them, or onto an edge to dock it there.
- Right-click a tab to rename, color, or pin it. Pinned tabs stay first and
  can't be closed until unpinned.

See [Keyboard shortcuts](https://nana.areshk.dev/docs/user-guide/keyboard-shortcuts.md) for the full
list.

## Closing and detaching

- Closing a pane ends its terminal, unless another pane in any app still shows
  it.
- Nana asks first when a program other than the shell is running.
- **Detach Terminal** in the pane's right-click menu removes the pane but keeps
  the terminal running.
- **Existing Terminals** (`Ctrl+Shift+Alt+T`, or the project menu) lists the project's
  terminals that this app isn't showing, with the app that owns each, and opens
  one in a new tab.
- Set **Settings → General → When closing tabs or panes** to **Detach** to make
  every tab and pane close a detach.
- Quitting the app or closing its window never ends a terminal. **End All
  Sessions and Quit** in the app menu ends every terminal on this computer,
  without asking first.

## Find

`Ctrl+Shift+F` searches the focused terminal, including all of its history.
`Return` or `Ctrl+Shift+G` goes to the next match, `Ctrl+Alt+G` to the previous. Search is
plain text and case-insensitive; **Aa** makes it case-sensitive.

## Copy and paste

- `Ctrl+Shift+C` copies the selection. `Ctrl+C` goes to the program.
- Turn on **Settings → Terminal → Copy on select** to copy when you select.
- When a program uses the mouse, hold `Shift` to select text or open the
  right-click menu.
- Pasting an image into a local terminal sends `Ctrl+V`, so AI tools can read
  it from the clipboard.

## Links and files

- `Cmd`-click a URL or file path to open it. Paths with `:line:column` jump to
  that line in supported editors.
- **Settings → General → Open files with** picks the app for files.
- Web links open in your system browser, or in the
  [built-in browser](https://nana.areshk.dev/docs/features/browser.md) when **Settings → Browser** says so.
- Dropping files on a terminal pastes their paths.
- On a [remote server](https://nana.areshk.dev/docs/features/remote-servers.md), dropped and pasted files are
  uploaded first and the remote path is pasted. `Cmd`-clicking a remote file
  offers a read-only copy.

## Shell integration

With [shell integration](https://nana.areshk.dev/docs/features/server.md#shell-integration), Nana tracks each
terminal's folder, and you can:

- Jump between prompts with `Ctrl+Shift+Up` and `Ctrl+Shift+Down`.
- Select a command's output with **Select Command Output** in the Edit menu or
  the right-click menu.

## Windows default terminal

Windows 11 can hand a new console session to a terminal instead of drawing its
own console window. Turn it on in **Settings → Terminal → Use Nana for new
consoles**, and `cmd.exe`, PowerShell, and double-clicked `.bat` files open as
tabs in Nana. The same page offers Nana in Explorer's context menu for a
folder, its background, and a drive root.

- Windows Terminal has to be installed: its console host is the half of a
  handed-over session that Windows asks, and Nana is the half that shows it.
- A console opened while Nana is closed starts Nana. If Nana cannot show the
  session at all, Windows opens its own console instead, rather than leaving you
  with a console nothing draws.
- Turning it off puts the terminal choice back to what it was before and
  removes the classes and Explorer item Nana added.
- A console that starts **elevated** opens in an elevated Nana instance of its
  own. The *Run as administrator* flag on a console shortcut produces this.
  The elevated instance keeps a separate profile under
  `%ProgramData%\nana-elevated\<user-SID>`, which only a high-integrity
  process can read or write. It neither reads nor copies the normal profile's
  settings, shell commands, kibbles, or history, so it starts with a fresh
  configuration, and its server does not listen for remote or mobile access.
  The default-terminal setting itself stays per user. An elevated server can
  only be reached from an elevated console: a medium-integrity console is never
  shown in an elevated instance, and the other way around.
- An item that launches another terminal's executable, such as `wt.exe`, is a
  windowed application, so it never asks for a console and never passes through
  the setting. Windows Terminal's **Open in Terminal** Explorer item is one.
- **Open in Nana** opens a terminal in the folder that was clicked: as a tab in
  the project that already is that folder, or as a tab in Home when no project
  is. It never adds a project, so opening a folder from Explorer cannot change
  your sidebar. A handed-over console lands the same way.
- Windows 11 shows the Explorer item under **Show more options**; the compact
  menu only carries items that ship inside a package.

## Appearance and configuration

Fonts, colors, transparency, cursor, padding, selection, scrolling,
and key bindings are in **Settings → Terminal**, saved to `terminal.toml`.
Themes are in **Settings → Appearance**. See
[Settings](https://nana.areshk.dev/docs/user-guide/settings.md#terminal-configuration).

- `Ctrl+=` and `Ctrl+-` change the focused pane's font size.
- Images use the Kitty graphics protocol. Sixel and iTerm2 images are not
  supported.