Skip to content

Shell Integration

Ö. Efe D. edited this page Sep 15, 2026 · 1 revision

Shell Integration

Shells can mark where prompts, commands and command output start with OSC 133 escape sequences. With these marks, tron can:

  • Jump between prompts: Ctrl+Shift+Z (previous) and Ctrl+Shift+X (next), Cmd+Up and Cmd+Down on macOS.
  • Select the output of the last command with Ctrl+Shift+G (Cmd+Shift+Up on macOS). After jumping to a prompt, it selects the output of the command at the top of the view instead.
  • Copy that output with the copy_command_output action; see Key Bindings.
  • Let the shell redraw its prompt when the window is resized, instead of leaving broken prompt lines behind.

fish

fish 4 sends the marks by itself. Nothing to set up.

bash

Add to ~/.bashrc, after anything else that sets PS1:

PS0='\e]133;C\e\\'
PS1='\[\e]133;D\e\\\e]133;A\e\\\]'"$PS1"'\[\e]133;B\e\\\]'

zsh

Add to ~/.zshrc:

precmd() { print -n '\e]133;D\e\\\e]133;A\e\\' }
preexec() { print -n '\e]133;C\e\\' }

If a framework such as oh-my-zsh already defines precmd or preexec, add the functions to the hook arrays instead:

_tron_precmd() { print -n '\e]133;D\e\\\e]133;A\e\\' }
_tron_preexec() { print -n '\e]133;C\e\\' }
precmd_functions+=(_tron_precmd)
preexec_functions+=(_tron_preexec)

What the marks mean

Sequence Meaning
OSC 133 ; A ST A prompt starts
OSC 133 ; B ST The prompt ends, the command line starts
OSC 133 ; C ST The command runs, its output starts
OSC 133 ; D ST The command finished

Working directory

Shells that report their directory with OSC 7 let New Window (Ctrl+Shift+N) open in the same directory. fish and many distribution configurations of bash and zsh (through vte.sh) send it already.

Environment

Programs running in tron see:

Variable Value
TERM xterm-tron, or the term setting under [shell]
COLORTERM truecolor
TERM_PROGRAM tron
TERM_PROGRAM_VERSION tron's version
KITTY_WINDOW_ID 1, so tools that check for kitty use the kitty graphics protocol

Variables from a tmux session or another terminal that tron was started from, such as TMUX, KITTY_PID or WEZTERM_PANE, are removed so programs do not think they run inside those.

Clone this wiki locally