Skip to content

OSC 133 — Shell Integration (FTCS)

SequenceOSC 133 ; <kind> [ ; <params> ] ST
Otty support

Description

Marks the boundaries of prompts and commands in the byte stream. The terminal uses these marks for command outlines, jump-to-prev / next-command, exit-status indicators, and intelligent paste.

This is the "Final Term shell integration" protocol (FTCS) as adopted by iTerm2, WezTerm, Kitty, VS Code, and now Otty.

Kinds

<kind>EmittedMeaning
AJust before the prompt is drawnPrompt start
BAfter the prompt, before inputPrompt end / command start (input zone)
CWhen the command begins executingCommand output start
D ; <exit>When the command finishesCommand end with exit code
L(optional)Marks the start of a "user input prompt" within a tool

Example

bash
# Minimal zsh precmd / preexec:
precmd()  { print -Pn '\e]133;A\e\\'; }
preexec() { print -Pn '\e]133;C\e\\'; }
# B is emitted by zsh's prompt builder if PROMPT_SUBST is on.
# D is emitted by zsh's chpwd or via a hook — Otty's installer handles it.

In practice, Otty's otty shell install writes the snippets — you should never need to hand-roll these.

Try it

  • otty features try semantic-prompt — fires the full A → B → C → D;0 sequence so you can verify prompt-detection wiring (Open Quickly history, etc.).
  • otty features try error-state — same flow with D;1 plus an OSC 9;4 error badge, to confirm Otty marks errored prompts.

Otty