env-vars.mdx 3.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. ---
  2. title: Environment variables
  3. description: Runtime configuration flags for OpenTUI
  4. order: 1
  5. skill:
  6. entry: true
  7. intents: [env, environment, configuration, flags]
  8. ---
  9. # Environment variables
  10. OpenTUI reads environment variables at runtime. Bun loads `.env` automatically, so you can set these in your shell or in a `.env` file.
  11. ## Variables
  12. | Variable | Type | Default | Description |
  13. | ------------------------------ | --------- | ------- | ------------------------------------------------------------- |
  14. | `OTUI_TS_STYLE_WARN` | `string` | `false` | Enable warnings for missing syntax styles |
  15. | `OTUI_TREE_SITTER_WORKER_PATH` | `string` | `""` | Path to the Tree-sitter worker |
  16. | `XDG_CONFIG_HOME` | `string` | `""` | Base directory for user-specific configuration files |
  17. | `XDG_DATA_HOME` | `string` | `""` | Base directory for user-specific data files |
  18. | `OTUI_PALETTE_IDLE_TIMEOUT_MS` | `number` | `300` | Milliseconds of silence after palette queries before fallback |
  19. | `OTUI_DEBUG_FFI` | `boolean` | `false` | Enable debug logging for the FFI bindings |
  20. | `OTUI_SHOW_STATS` | `boolean` | `false` | Show the debug overlay at startup |
  21. | `OTUI_TRACE_FFI` | `boolean` | `false` | Enable tracing for the FFI bindings |
  22. | `OPENTUI_FORCE_WCWIDTH` | `boolean` | `false` | Use wcwidth for character width calculations |
  23. | `OPENTUI_FORCE_UNICODE` | `boolean` | `false` | Force Mode 2026 Unicode support in terminal capabilities |
  24. | `OPENTUI_GRAPHICS` | `boolean` | `true` | Enable Kitty graphics protocol detection |
  25. | `OPENTUI_FORCE_NOZWJ` | `boolean` | `false` | Use no_zwj width method (Unicode without ZWJ joining) |
  26. | `OPENTUI_FORCE_EXPLICIT_WIDTH` | `string` | - | Force explicit width detection (`true`/`1` or `false`/`0`) |
  27. | `OTUI_USE_CONSOLE` | `boolean` | `true` | Enable global `console.*` capture for the built-in overlay |
  28. | `SHOW_CONSOLE` | `boolean` | `false` | Open the built-in console overlay at startup |
  29. | `OTUI_DUMP_CAPTURES` | `boolean` | `false` | Dump captured stdout and console caches from the exit handler |
  30. | `OTUI_NO_NATIVE_RENDER` | `boolean` | `false` | Skip the Zig/native frame renderer |
  31. | `OTUI_DEBUG` | `boolean` | `false` | Capture all raw stdin input for debugging |
  32. ## Notes
  33. - `OPENTUI_FORCE_EXPLICIT_WIDTH=false` skips OSC 66 queries on older terminals.
  34. - `OTUI_PALETTE_IDLE_TIMEOUT_MS` bounds palette detection when a terminal reports OSC support but does not answer follow-up color queries.
  35. - Disable global `console.*` capture with `OTUI_USE_CONSOLE=false`. `consoleMode` only changes the overlay surface.
  36. - `OTUI_NO_NATIVE_RENDER` still runs the render loop. In `"split-footer"` mode, the current stdout flush path can still emit ANSI cursor movement and clear sequences.
  37. - `OTUI_DUMP_CAPTURES` runs from the renderer exit handler. A direct `renderer.destroy()` call does not trigger it by itself.