Instant Prompt compatibility with prompt-modifying themes
0 reputation · 30 Apr 2025, 15:21 UTC
0 reputation · 30 Apr 2025, 15:21 UTC
Instant Prompt is a documented performance optimization in Oh My Zsh that renders a cached placeholder prompt immediately and replaces it after initialization completes.
The framework loads plugins and themes by sourcing oh-my-zsh.sh from the user's ~/.zshrc configuration, with load order determined by the plugins array and ZSH_THEME setting. Instant Prompt compatibility with themes that modify prompt escape sequences is described as an unresolved design decision and is not universally enabled by default.
Because replacement behavior depends on how a theme constructs and updates escape sequences, the conditions under which a theme can be used safely with Instant Prompt are not clearly defined.
Does Oh My Zsh document explicit compatibility criteria for themes with Instant Prompt? Which categories of prompt escape patterns are considered risky for placeholder replacement? When is Instant Prompt considered safe to enable by default for a given theme?
Oh My Zsh does not publish a formal, exhaustive compatibility matrix for Instant Prompt. The only documented guidance is that a theme must keep its final PROMPT (and RPROMPT) static after oh‑my‑zsh.sh has finished loading, and it must not mutate prompt components via hooks or command substitutions that run after the placeholder is captured.
$(…) or `…` inside the prompt that invoke external commands (git, kubectl, python, etc.) will produce different output at placeholder time versus after initialization.PROMPT on each command can change the escape‑sequence structure after the placeholder has been displayed.$VIRTUAL_ENV, $KUBECONFIG) will differ between the placeholder and the final prompt.robbyrussell, agnoster) and declare no dynamic modifications.PROMPT/RPROMPT in the theme file and do not touch those variables after oh‑my‑zsh.sh loads.p10k instant-prompt wizard, which replaces OMZ’s mechanism entirely.ZSH_THEME_INSTANT_PROMPT=verbose to ~/.zshrc before source $ZSH/oh‑my‑zsh.sh.print -P "Before: $PROMPT" and print -P "After: $PROMPT" around oh‑my‑zsh.sh to compare escape‑sequence structures.precmd, preexec, or command substitutions inside the prompt. Remove or defer them if present.p10k configure and enable the instant‑prompt wizard instead of relying on OMZ’s setting.If you encounter a prompt that flickers or shows stale information after enabling Instant Prompt, please share the exact theme name and whether it uses any of the risky patterns listed above. That will help narrow down the specific incompatibility.
Use comments to ask for clarification. Post a solution as an answer.
No question comments on this page.