> ## Documentation Index
> Fetch the complete documentation index at: https://tty7.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Links

> Opening URLs, files, and localhost ports straight out of the terminal.

Hold <kbd>⌘</kbd> (<kbd>Ctrl</kbd> on Windows and Linux) and links under the
pointer underline; click to open one.

## URLs

Anything that looks like a URL is detected, including one the shell wrapped
across two lines — tty7 stitches it back together before opening it.

Turn detection off with **Settings → Terminal → Links → Detect URLs**
(`link_url: false`).

## Files

A file path in the output — a compiler error, a test failure, a `grep -n` hit —
opens in tty7's own editor, on the line the link named, and the Files panel
selects it if it is open. A path to a directory opens the Files panel on it
instead.

Both absolute and relative paths are detected. A relative one is measured
against the directory the pane is working in, and then against the repository
around it — which is what makes a path a build tool printed from the workspace
root resolve while the shell sits in a member directory. A path that matches
nothing under either says so rather than doing nothing.

Paths in a pane connected to another machine are resolved *on that machine*,
so the underline appears a moment after the pointer settles rather than
instantly. A pane running `ssh` typed into a local shell has no host that can
answer for its paths, so file links are off there.

**Settings → Terminal → Links → Open files with** picks what a click opens:

| Mode            | Opens in                                       |
| --------------- | ---------------------------------------------- |
| Built-in editor | tty7's editor, at `:line:column`. The default. |
| Default app     | Whatever the OS associates with the file type. |
| Command         | A command of your own — see below.             |

A file on another machine always opens in the built-in editor, whichever mode
is set: a path that was just resolved on the far side means nothing to a local
`open` or `code`, which would show this machine's copy of that path or nothing
at all.

Under **Command**, the command runs with placeholders substituted:

```
code --goto {path}:{line}:{column}
zed {path}:{line}
herdr edit {path} --line={line}
```

`{path}`, `{line}`, and `{column}` are filled in from the link. A flag whose
value is not available is dropped rather than passed empty — so
`--line={line}` simply disappears when the link had no line number.

The settings are `link_file_open` (`internal`, `system`, or `command`) and
`link_file_command` in `config.json`. A config written before `link_file_open`
existed keeps working: one that set a command stays on **Command**, and one
that did not moves to the built-in editor.

## localhost ports

<kbd>⌘</kbd>-clicking `localhost:3000` opens it in your browser, which is only
useful if the server is on this machine.

When the pane is inside an SSH session it usually is not. Turn on **Settings →
Terminal → Links → Forward SSH loopback links** (`ssh_loopback_forward: true`)
and tty7 opens a temporary port forward through that connection first, so the
link reaches the server on the remote machine.

<Tip>
  For a forward you want to keep, set one up properly instead —
  [port forwarding](/remote/port-forwarding).
</Tip>
