Hyperlinks

Click URLs in the terminal to open them in your browser, and render rich OSC 8 hyperlinks where the click target can differ from the visible text.

Wintty recognizes two kinds of hyperlinks in the terminal:

  1. Automatic URL detection. Wintty scans terminal output for things that look like URLs (https://..., mailto:..., file:...) and makes them clickable.
  2. OSC 8 hyperlinks. Terminal programs can emit a specific escape sequence to mark a region of text as a link, where the displayed text and the target URL are independent. This is the same mechanism used by ls --hyperlink=auto, git log with hyperlink support, modern test runners, and many other tools.

Both kinds of links are rendered with an underline on hover and open in your system's default handler when clicked.

To open a link, hover over it and click while holding the platform's "link" modifier:

PlatformModifier
Windowsctrl
Linuxctrl

This avoids accidentally opening links when you click to position the cursor or to start a selection.

You can also bind copy_url_to_clipboard to copy the URL under the cursor without a mouse click.

Automatic URL Detection

URL detection is on by default. Disable it with:

link-url = false

The matched URLs are opened with the system opener: start on Windows, and xdg-open on Linux.

If you want different match rules (for example, recognizing internal bug tracker IDs as links), see the link configuration, which lets you register a regex and an action to run when the match is clicked.

OSC 8 is the standard escape sequence for hyperlinks in the terminal. A program emits a sequence like this:

\x1b]8;;https://example.com\x1b\\Click me\x1b]8;;\x1b\\

Wintty renders the text Click me as a hyperlink to https://example.com. The link text and the target can be completely different, which is what makes OSC 8 useful: a test runner can print a short file name like src/foo.zig:42 that actually opens an editor:// URL with full context, for example.

See the OSC 8 protocol reference for the full sequence syntax.

When you hover an OSC 8 link, the displayed text and the target URL can differ. To make the target visible, Wintty can show a preview on hover.

link-previews controls this:

ValueBehavior
true (default)Show previews for all matched URLs
osc8Show previews only for OSC 8 links (where the text and target may differ)
falseNever show previews

Setting link-previews = osc8 is a nice middle ground: previews are suppressed for plain URLs (where the link text already shows the target) but always shown for OSC 8 (where the target might be surprising).

file:// links have a particularly nasty corner case. The full syntax is file://<hostname>/<path>. Most tools emit file:///path (note the three slashes: the hostname is empty), meaning the local machine. But a malicious program could emit file://otherhost/path, which on Windows expands to a UNC path and on POSIX to a non-local mount.

Wintty enforces a strict rule on file:// links:

  • The hostname must be empty, localhost, or match the local machine's hostname.

file:// links that point to a different host are not opened. This prevents drive-by mounts and credential theft from terminal output you might not control (e.g., a log file you cat'd that happened to contain an attacker-supplied hyperlink).

Warning

Even with this protection, treat hyperlinks in the terminal with the same caution as hyperlinks in email. The click modifier is your primary defense: you have to deliberately hover and ctrl/cmd-click before any URL handler runs.

Configuration

OptionPurpose
link-urlEnable or disable automatic URL detection
link-previewsShow link previews on hover (true, false, osc8)
linkDefine custom regex-based link matchers

Keybindings

ActionPurpose
copy_url_to_clipboardCopy the URL under the cursor