Advanced features

Rush exposes interactive editor state through shell variables and builtins. Use the shell language to configure prompts, completions, and UI styles.

Adaptive UI theme

Set semantic rush_style_* variables to theme directories, options, autosuggestions, matches, and diagnostics wherever Rush renders them. Rush reads them before each prompt and caches them for rendering.

rush_style() {
  if test "$rush_color_scheme" = light; then
    fallback_bg='#ffffff'
  else
    fallback_bg='#000000'
  fi

  rush_style_selection="fg=${rush_color_cyan-#00ffff},bold"
  rush_style_directory="fg=$(color dim "${rush_color_blue-#0000ff}" 15)"
  rush_style_muted="fg=$(color blend "${rush_color_foreground-#c0c0c0}" "${rush_color_background-$fallback_bg}" 45)"
  rush_style_match='fg=yellow,bold'
}

Define rush_style to recompute styles at startup and when the terminal reports a color-scheme or palette change. Rush sets rush_color_scheme to dark, light, or unknown first.

Rush also asks for foreground, background, and ANSI colors 0 through 7. Reported colors become #rrggbb variables such as rush_color_foreground, rush_color_background, and rush_color_blue. Use shell fallbacks for missing reports, such as ${rush_color_blue-#0000ff}.

When supported, Rush subscribes to color-scheme changes, refreshes color variables, reruns rush_style, and repaints the editor.

Color utilities

Use color to derive truecolor values in command substitutions.

color dim '#204080' 25
#183060

color blend '#000000' '#ffffff' 50
#808080

color dim COLOR PERCENT blends toward black. color blend COLOR COLOR PERCENT blends toward the second color. Invalid input exits 2, writes stderr, and writes no stdout.

Editor feedback

The line editor gives lightweight feedback: failed completions flash the current word, Ctrl-C clears non-empty input, and completion roles use separate styles.

Terminal protocols

Rush probes terminal capabilities instead of assuming them. It uses modern keyboard protocols, bracketed paste, in-band resize, color-scheme reports, and palette reports when available. Unsupported queries time out; the editor keeps working with conservative defaults.