Cette page est affichée en anglais. Une traduction française est en cours.
ScriptsJul 6, 2026·3 min de lecture

Oh My Posh — Cross-Platform Shell Prompt Theme Engine

A prompt theme engine for any shell that renders rich, informative prompts with Git status, language versions, cloud context, and custom segments using a single JSON or YAML config.

Prêt pour agents

Installation agent prête

Cet actif peut être installé après choix du runtime, vérification du plan et exécution de la commande adaptée.

Native · 96/100Policy : autoriser
Surface agent
Tout agent MCP/CLI
Type
Prompt
Installation
Single
Confiance
Confiance : Established
Point d'entrée
Oh My Posh
Commande d'installation directe
npx -y tokrepo@latest install 1988a01e-7937-11f1-9bc6-00163e2b0d79 --target codex

À exécuter après confirmation du plan en dry-run.

Introduction

Oh My Posh is a custom prompt engine that works across Bash, Zsh, Fish, PowerShell, cmd, and Nushell on any operating system. It replaces your default prompt with a configurable, segment-based display that surfaces contextual information like Git branch status, active language versions, and cloud provider context.

What Oh My Posh Does

  • Renders prompt segments showing Git status, language runtimes, and execution time
  • Works identically across Bash, Zsh, Fish, PowerShell, cmd, and Nushell
  • Loads themes from JSON, YAML, or TOML configuration files
  • Supports Nerd Font icons, Unicode glyphs, and plain-text fallbacks
  • Provides a built-in theme gallery with 100+ community themes

Architecture Overview

Oh My Posh is a single Go binary that your shell calls before rendering each prompt. The shell's init script hooks into the prompt lifecycle and invokes the binary with the current environment. The engine evaluates each configured segment, checks activation conditions, formats the output with ANSI escape codes, and returns the rendered string to the shell.

Self-Hosting & Configuration

  • Install via Homebrew, winget, Scoop, or download the binary directly
  • Initialize for your shell by adding the eval/init line to your profile file
  • Point to a theme file or use the built-in default theme
  • Install a Nerd Font (e.g., FiraCode Nerd Font) for icon rendering
  • Customize segments by editing the JSON/YAML config or use oh-my-posh config export

Key Features

  • Shell-agnostic: one config file works across all supported shells
  • Transient prompt mode collapses previous prompts to save terminal space
  • Tooltips show contextual segments only when relevant commands are typed
  • Secondary prompt customization for multiline input
  • Built-in upgrade command keeps the binary current without package manager steps

Comparison with Similar Tools

  • Starship — Rust-based prompt with TOML config; faster cold start, fewer built-in segments
  • Powerlevel10k — Zsh-only prompt with instant prompt feature; deeper Zsh integration
  • Pure — minimalist Zsh prompt focused on async Git status; no segments or theming
  • Tide — Fish-only prompt inspired by Powerlevel10k; Fish-native configuration
  • Liquidprompt — Bash/Zsh adaptive prompt; text-based, no icon support

FAQ

Q: Does Oh My Posh slow down my prompt? A: The binary is compiled Go and typically renders in under 50ms. Segments that query external tools (kubectl, az) may add latency; disable segments you do not use.

Q: Do I need a Nerd Font? A: Nerd Fonts are recommended for icon glyphs, but you can use a minimal theme with Unicode or ASCII-only output.

Q: Can I use Oh My Posh alongside Oh My Zsh? A: Yes. Oh My Posh replaces only the prompt theme. Oh My Zsh plugins for completions and aliases continue to work.

Q: How do I preview themes without applying them? A: Run oh-my-posh config export --format json to see the current config, or browse the theme gallery on the documentation site.

Sources

Fil de discussion

Connectez-vous pour rejoindre la discussion.
Aucun commentaire pour l'instant. Soyez le premier à partager votre avis.

Actifs similaires