Skip to main content

Overview

Oh My Posh is a custom prompt theme engine that provides a beautiful, informative command-line interface. This configuration uses a custom “Zen” theme designed for minimalism and clarity.

Installation

1

Install Oh My Posh

Follow the official installation guide for your platform:
# Linux (using curl)
curl -s https://ohmyposh.dev/install.sh | bash -s
2

Configure in shell

Add the initialization to your shell configuration:
# ~/.zshrc
eval "$(oh-my-posh init zsh --config ~/.config/oh-my-posh/themes/zen.toml)"
3

Install a Nerd Font

Oh My Posh requires a Nerd Font for icons. Install one from nerdfonts.com:
# Example: Install JetBrainsMono Nerd Font
oh-my-posh font install jetbrainsmono
Then configure your terminal to use the installed font.

Zen theme

The Zen theme is a custom minimal theme that displays essential information without clutter.

Theme features

OS indicator

Shows the current operating system with WSL detection

Path display

Full path to current directory in blue

Git status

Branch name, working changes, and sync status

Execution time

Shows command duration for long-running commands (>5s)

Theme configuration

The complete Zen theme configuration:
~/.config/oh-my-posh/themes/zen.toml
console_title_template = '{{ .Shell }} in {{ .Folder }}'
version = 3
final_space = true

[secondary_prompt]
  template = '❯❯ '
  foreground = 'magenta'
  background = 'transparent'

[transient_prompt]
  template = '❯ '
  background = 'transparent'
  foreground_templates = ['{{if gt .Code 0}}red{{end}}', '{{if eq .Code 0}}magenta{{end}}']

Prompt segments

[[blocks.segments]]
  template = '{{ if .WSL }} WSL {{ end }}{{ .Icon }} <cyan>|</> '
  foreground = 'magenta'
  background = 'transparent'
  type = 'os'
Displays the OS icon and indicates if running in WSL.
[[blocks.segments]]
  template = '{{ .Path }}'
  foreground = 'blue'
  background = 'transparent'
  type = 'path'
  style = 'plain'

  [blocks.segments.properties]
    cache_duration = 'none'
    style = 'full'
Shows the full current directory path in blue.
[[blocks.segments]]
  template = ' {{ .HEAD }}{{ if or (.Working.Changed) (.Staging.Changed) }}*{{ end }} <cyan>{{ if gt .Behind 0 }}⇣{{ end }}{{ if gt .Ahead 0 }}⇡{{ end }}</>'
  foreground = 'p:grey'
  background = 'transparent'
  type = 'git'
  style = 'plain'

  [blocks.segments.properties]
    branch_icon = ''
    cache_duration = 'none'
    commit_icon = '@'
    fetch_status = true
Shows:
  • Current branch name
  • * if there are uncommitted changes
  • if behind remote
  • if ahead of remote
[[blocks.segments]]
  template = '{{ .FormattedMs }}'
  foreground = 'yellow'
  background = 'transparent'
  type = 'executiontime'
  style = 'plain'

  [blocks.segments.properties]
    cache_duration = 'none'
    threshold = 5000
Displays command execution time in yellow if it exceeds 5 seconds.

Prompt symbol

The main prompt symbol changes color based on the last command’s exit status:
[[blocks.segments]]
  template = '❯'
  background = 'transparent'
  type = 'text'
  style = 'plain'
  foreground_templates = ['{{if gt .Code 0}}red{{end}}', '{{if eq .Code 0}}magenta{{end}}']
The prompt symbol appears in magenta for successful commands and red for failed commands.

Transient prompt

The transient prompt feature minimizes previous prompts to save screen space:
[transient_prompt]
  template = '❯ '
  background = 'transparent'
  foreground_templates = ['{{if gt .Code 0}}red{{end}}', '{{if eq .Code 0}}magenta{{end}}']
After executing a command, the full prompt collapses to just , keeping your terminal clean and focused.

Console title

The terminal window title is automatically set to show the current shell and directory:
console_title_template = '{{ .Shell }} in {{ .Folder }}'
Example: zsh in ~/workspace/dotfiles

Customization

To customize the theme, edit ~/.config/oh-my-posh/themes/zen.toml:
# Change prompt color from magenta to blue
foreground = 'blue'
Explore more segments and customization options in the Oh My Posh documentation.

Visual example

Here’s what the Zen theme looks like in action:
 Arch /home/user/workspace/dotfiles main* ⇡
❯ git status
# ... git output ...

 Arch /home/user/workspace/dotfiles main* ⇡        2.3s
❯ npm run build
# ... build output ...

❯ _
The prompt provides all essential information at a glance while maintaining a clean, minimal aesthetic.

Build docs developers (and LLMs) love