github JanDeDobbeleer/oh-my-posh v29.4.0

latest release: v29.4.1
7 hours ago

🚀 Streaming Prompt Rendering (Beta)

Oh My Posh now supports streaming mode - a new rendering approach that displays your prompt progressively as segments complete, instead of waiting for all segments to finish before showing anything.

What's New

  • Instant prompt display: Get an immediate prompt with fast segments, while slow segments load in the background
  • Progressive updates: The prompt updates incrementally as data-fetching segments (APIs, git status, etc.) complete
  • Configurable timeout: Set the segment timeout threshold via the streaming config property (recommended: 100ms)
  • Pending placeholders: Segments still loading show ... by default (customizable via segment placeholder property)
  • Multi-shell support: Available in PowerShell 7.2+, Zsh, and Fish

Configuration

Enable streaming by adding a timeout value (in milliseconds) to your config:

{
  "streaming": 100,
  "blocks": [...]
}

How It Works

sequenceDiagram
    participant Shell
    participant CLI as oh-my-posh stream
    participant Engine
    participant Segments as Segment Workers

    Shell->>CLI: Execute with context
    CLI->>Engine: Initialize streaming

    par Concurrent Execution
        Engine->>Segments: Start all segments
        Segments-->>Engine: Fast segments complete
        Segments-->>Engine: Slow segments timeout
    end

    Engine->>CLI: Render initial prompt<br/>(fast segments + "..." placeholders)
    CLI->>Shell: Output prompt (null-delimited)
    Shell->>Shell: Display initial prompt

    loop Background completion
        Segments-->>Engine: Slow segment completes
        Engine->>Engine: Re-render prompt with new data
        Engine->>CLI: Output updated prompt
        CLI->>Shell: Send update (null-delimited)
        Shell->>Shell: Redraw prompt progressively
    end

    Segments->>Engine: All segments complete
    Engine->>CLI: Final prompt
    CLI->>Shell: Close stream
Loading

Technical Details

  • New oh-my-posh stream command outputs null-byte delimited prompts (\0) for proper multi-line handling
  • Segments that exceed the timeout threshold are marked as Pending and continue executing in goroutines
  • Background segments notify the engine via channels when they complete
  • The entire prompt is re-rendered incrementally (not just the changed segment)
  • Shell integration scripts handle async updates using:
    • PowerShell: Event-based DataAdded with PSConsoleReadLine::InvokePrompt()
    • Zsh: File descriptor with zle -F async handler and zle reset-prompt
    • Fish: Background process with SIGUSR1 signal and commandline --function repaint

Benefits

  • Improved responsiveness: No more waiting for slow API calls or network operations
  • Better UX: See your prompt immediately, with updates appearing as they're ready
  • Flexible configuration: Set timeouts per your needs and customize pending indicators

Notes

⚠️ This is an experimental beta feature. The behavior and configuration may evolve in future releases.

For more information, see the streaming documentation.

Don't miss a new oh-my-posh release

NewReleases is sending notifications on new releases.