Oh My Posh - Cross-Platform Prompt Engine¶
Oh My Posh ist eine benutzerdefinierte Eingabeaufforderung Motor für jede Shell, die die Möglichkeit hat, die Eingabeaufforderung String mit einer Funktion oder Variable anzupassen. Es wurde entwickelt, um schnell, erweiterbar, und Cross-Plattform, mit besonderer Stärke auf Windows PowerShell und Windows Terminal. Oh My Posh bietet schöne Themen, umfangreiche Anpassungsmöglichkeiten und nahtlose Integration über verschiedene Betriebssysteme und Shells.
• Installation
Windows Installation¶
Leistung Shell (empfohlen) ```powershell
Install via PowerShell Gallery¶
Install-Module oh-my-posh -Scope CurrentUser
Install via Winget¶
winget install JanDeDobbeleer.OhMyPosh
Install via Chocolatey¶
choco install oh-my-posh
Install via Scoop¶
scoop install https://github.com/JanDeDobbeleer/oh-my-posh/releases/latest/download/oh-my-posh.json ```_
Manuelle Installation ```powershell
Download and install manually¶
Invoke-WebRequest -Uri "https://github.com/JanDeDobbeleer/oh-my-posh/releases/latest/download/posh-windows-amd64.exe" -OutFile "$env:USERPROFILE\oh-my-posh.exe"
Add to PATH¶
\(env:PATH += ";\)env:USERPROFILE" ```_
macOS Installation¶
```bash
Homebrew¶
brew install jandedobbeleer/oh-my-posh/oh-my-posh
Manual installation¶
curl -s https://ohmyposh.dev/install.sh|bash -s
Add to PATH¶
export PATH=$PATH:/usr/local/bin ```_
Linux Installation¶
```bash
Install script¶
curl -s https://ohmyposh.dev/install.sh|bash -s
Manual download¶
wget https://github.com/JanDeDobbeleer/oh-my-posh/releases/latest/download/posh-linux-amd64 -O /usr/local/bin/oh-my-posh chmod +x /usr/local/bin/oh-my-posh
Package managers¶
Arch Linux¶
yay -S oh-my-posh
Ubuntu/Debian (via .deb package)¶
wget https://github.com/JanDeDobbeleer/oh-my-posh/releases/latest/download/posh-linux-amd64.deb sudo dpkg -i posh-linux-amd64.deb ```_
Font Installation¶
```bash
Install Nerd Fonts (required for icons)¶
oh-my-posh font install
Install specific font¶
oh-my-posh font install meslo
List available fonts¶
oh-my-posh font list
Manual font installation¶
Download from https://www.nerdfonts.com/¶
Install CascadiaCode, FiraCode, or Meslo LG fonts¶
```_
oder Shell Konfiguration
Power Shell Setup¶
```powershell
Add to PowerShell profile¶
Check profile location¶
$PROFILE
Create profile if it doesn't exist¶
if (!(Test-Path -Path $PROFILE)) \\{ New-Item -ItemType File -Path $PROFILE -Force \\}
Add Oh My Posh initialization¶
Add-Content -Path $PROFILE -Value 'oh-my-posh init pwsh|Invoke-Expression'
With custom theme¶
Add-Content -Path \(PROFILE -Value 'oh-my-posh init pwsh --config "\)env:POSH_THEMES_PATH\jandedobbeleer.omp.json"|Invoke-Expression'
Reload profile¶
. $PROFILE ```_
Bash Setup¶
```bash
Add to ~/.bashrc¶
echo 'eval "$(oh-my-posh init bash)"' >> ~/.bashrc
With custom theme¶
echo 'eval "$(oh-my-posh init bash --config ~/.poshthemes/jandedobbeleer.omp.json)"' >> ~/.bashrc
Reload configuration¶
source ~/.bashrc ```_
Zsh Setup¶
```bash
Add to ~/.zshrc¶
echo 'eval "$(oh-my-posh init zsh)"' >> ~/.zshrc
With custom theme¶
echo 'eval "$(oh-my-posh init zsh --config ~/.poshthemes/jandedobbeleer.omp.json)"' >> ~/.zshrc
Reload configuration¶
source ~/.zshrc ```_
Fisch Setup¶
```bash
Add to ~/.config/fish/config.fish¶
echo 'oh-my-posh init fish|source' >> ~/.config/fish/config.fish
With custom theme¶
echo 'oh-my-posh init fish --config ~/.poshthemes/jandedobbeleer.omp.json|source' >> ~/.config/fish/config.fish
Reload configuration¶
source ~/.config/fish/config.fish ```_
Command Prompt (CMD) Setup¶
```cmd
Install Clink first¶
Download from: https://chrisant996.github.io/clink/¶
Create oh-my-posh.lua in Clink scripts directory¶
%LOCALAPPDATA%\clink\oh-my-posh.lua¶
load(io.popen('oh-my-posh init cmd'):read("*a"))() ```_
oder Thema Management
Eingebaute Themen¶
```bash
List all available themes¶
oh-my-posh get themes
Preview themes¶
oh-my-posh get themes --list
Set theme¶
oh-my-posh init pwsh --config "$env:POSH_THEMES_PATH\agnoster.omp.json"|Invoke-Expression
Popular themes¶
oh-my-posh init pwsh --config "\(env:POSH_THEMES_PATH\jandedobbeleer.omp.json"|Invoke-Expression oh-my-posh init pwsh --config "\)env:POSH_THEMES_PATH\paradox.omp.json"|Invoke-Expression oh-my-posh init pwsh --config "\(env:POSH_THEMES_PATH\powerlevel10k_rainbow.omp.json"|Invoke-Expression oh-my-posh init pwsh --config "\)env:POSH_THEMES_PATH\atomic.omp.json"|Invoke-Expression oh-my-posh init pwsh --config "$env:POSH_THEMES_PATH\blue-owl.omp.json"|Invoke-Expression ```_
Themenorte¶
```bash
Windows theme location¶
$env:POSH_THEMES_PATH
macOS/Linux theme location¶
$(oh-my-posh get themes-path)
List theme files¶
Windows¶
Get-ChildItem -Path "$env:POSH_THEMES_PATH" -Filter "*.omp.json"
macOS/Linux¶
ls $(oh-my-posh get themes-path)/*.omp.json ```_
Custom Theme Creation¶
json
\\\\{
"$schema": "https://raw.githubusercontent.com/JanDeDobbeleer/oh-my-posh/main/themes/schema.json",
"version": 2,
"final_space": true,
"console_title_template": "\\\\{\\\\{ .Shell \\\\}\\\\} in \\\\{\\\\{ .Folder \\\\}\\\\}",
"blocks": [
\\\\{
"type": "prompt",
"alignment": "left",
"segments": [
\\\\{
"type": "path",
"style": "powerline",
"powerline_symbol": "\uE0B0",
"foreground": "#ffffff",
"background": "#61AFEF",
"template": " \uF07C \\\\{\\\\{ .Path \\\\}\\\\} ",
"properties": \\\\{
"style": "folder"
\\\\}
\\\\},
\\\\{
"type": "git",
"style": "powerline",
"powerline_symbol": "\uE0B0",
"foreground": "#193549",
"background": "#95ffa4",
"template": " \\\\{\\\\{ .HEAD \\\\}\\\\}\\\\{\\\\{if .BranchStatus \\\\}\\\\} \\\\{\\\\{ .BranchStatus \\\\}\\\\}\\\\{\\\\{ end \\\\}\\\\}\\\\{\\\\{ if .Working.Changed \\\\}\\\\} \uF044 \\\\{\\\\{ .Working.String \\\\}\\\\}\\\\{\\\\{ end \\\\}\\\\}\\\\{\\\\{ if and (.Staging.Changed) (.Working.Changed) \\\\}\\\\}|\\\\{\\\\{ end \\\\}\\\\}\\\\{\\\\{ if .Staging.Changed \\\\}\\\\} \uF046 \\\\{\\\\{ .Staging.String \\\\}\\\\}\\\\{\\\\{ end \\\\}\\\\} "
\\\\}
]
\\\\},
\\\\{
"type": "prompt",
"alignment": "right",
"segments": [
\\\\{
"type": "node",
"style": "plain",
"foreground": "#6CA35E",
"template": "\uF898 \\\\{\\\\{ .Full \\\\}\\\\} "
\\\\},
\\\\{
"type": "time",
"style": "plain",
"foreground": "#007ACC",
"template": "\\\\{\\\\{ .CurrentDate|date .Format \\\\}\\\\} "
\\\\}
]
\\\\},
\\\\{
"type": "prompt",
"alignment": "left",
"newline": true,
"segments": [
\\\\{
"type": "text",
"style": "plain",
"foreground": "#007ACC",
"template": "❯ "
\\\\}
]
\\\\}
]
\\\\}_
Konfigurationsstruktur
Grundkonfiguration¶
json
\\\\{
"$schema": "https://raw.githubusercontent.com/JanDeDobbeleer/oh-my-posh/main/themes/schema.json",
"version": 2,
"final_space": true,
"console_title_template": "\\\\{\\\\{ .Shell \\\\}\\\\} in \\\\{\\\\{ .Folder \\\\}\\\\}",
"blocks": []
\\\\}_
Block Configuration¶
json
\\\\{
"type": "prompt",
"alignment": "left",
"newline": false,
"segments": []
\\\\}_
Segment Configuration¶
json
\\\\{
"type": "path",
"style": "powerline",
"powerline_symbol": "\uE0B0",
"foreground": "#ffffff",
"background": "#61AFEF",
"template": " \uF07C \\\\{\\\\{ .Path \\\\}\\\\} ",
"properties": \\\\{\\\\}
\\\\}_
Kernsegmente
Pfadsegment¶
json
\\\\{
"type": "path",
"style": "powerline",
"powerline_symbol": "\uE0B0",
"foreground": "#ffffff",
"background": "#61AFEF",
"template": " \uF07C \\\\{\\\\{ .Path \\\\}\\\\} ",
"properties": \\\\{
"style": "folder",
"max_depth": 3,
"folder_separator_icon": " \uE0B1 ",
"home_icon": "~",
"folder_icon": "\uF07C",
"windows_registry_icon": "\uE0B1",
"mapped_locations": \\\\{
"C:\\temp": "\uF0E7",
"C:\\Users": "\uF007"
\\\\}
\\\\}
\\\\}_
Git Segment¶
json
\\\\{
"type": "git",
"style": "powerline",
"powerline_symbol": "\uE0B0",
"foreground": "#193549",
"background": "#95ffa4",
"background_templates": [
"\\\\{\\\\{ if or (.Working.Changed) (.Staging.Changed) \\\\}\\\\}#FF9248\\\\{\\\\{ end \\\\}\\\\}",
"\\\\{\\\\{ if and (gt .Ahead 0) (gt .Behind 0) \\\\}\\\\}#ff4500\\\\{\\\\{ end \\\\}\\\\}",
"\\\\{\\\\{ if gt .Ahead 0 \\\\}\\\\}#B388FF\\\\{\\\\{ end \\\\}\\\\}",
"\\\\{\\\\{ if gt .Behind 0 \\\\}\\\\}#B388FF\\\\{\\\\{ end \\\\}\\\\}"
],
"template": " \\\\{\\\\{ .UpstreamIcon \\\\}\\\\}\\\\{\\\\{ .HEAD \\\\}\\\\}\\\\{\\\\{if .BranchStatus \\\\}\\\\} \\\\{\\\\{ .BranchStatus \\\\}\\\\}\\\\{\\\\{ end \\\\}\\\\}\\\\{\\\\{ if .Working.Changed \\\\}\\\\} \uF044 \\\\{\\\\{ .Working.String \\\\}\\\\}\\\\{\\\\{ end \\\\}\\\\}\\\\{\\\\{ if and (.Staging.Changed) (.Working.Changed) \\\\}\\\\}|\\\\{\\\\{ end \\\\}\\\\}\\\\{\\\\{ if .Staging.Changed \\\\}\\\\} \uF046 \\\\{\\\\{ .Staging.String \\\\}\\\\}\\\\{\\\\{ end \\\\}\\\\}\\\\{\\\\{ if gt .StashCount 0 \\\\}\\\\} \uF692 \\\\{\\\\{ .StashCount \\\\}\\\\}\\\\{\\\\{ end \\\\}\\\\} ",
"properties": \\\\{
"branch_max_length": 25,
"fetch_status": true,
"fetch_upstream_icon": true
\\\\}
\\\\}_
Status Segment¶
json
\\\\{
"type": "status",
"style": "diamond",
"foreground": "#ffffff",
"background": "#00897b",
"background_templates": [
"\\\\{\\\\{ if gt .Code 0 \\\\}\\\\}#e91e63\\\\{\\\\{ end \\\\}\\\\}"
],
"leading_diamond": "<transparent,background>\uE0B0",
"trailing_diamond": "\uE0B4",
"template": " \\\\{\\\\{ if gt .Code 0 \\\\}\\\\}\uF00D\\\\{\\\\{ else \\\\}\\\\}\uF00C\\\\{\\\\{ end \\\\}\\\\} ",
"properties": \\\\{
"always_enabled": true
\\\\}
\\\\}_
Zeitsegment¶
json
\\\\{
"type": "time",
"style": "plain",
"foreground": "#007ACC",
"template": "\\\\{\\\\{ .CurrentDate|date .Format \\\\}\\\\}",
"properties": \\\\{
"time_format": "15:04:05"
\\\\}
\\\\}_
Sprach- und Laufzeitsegmente
Node.js Segment¶
json
\\\\{
"type": "node",
"style": "powerline",
"powerline_symbol": "\uE0B0",
"foreground": "#ffffff",
"background": "#6CA35E",
"template": " \uF898 \\\\{\\\\{ .Full \\\\}\\\\} ",
"properties": \\\\{
"fetch_version": true,
"missing_command_text": "",
"display_mode": "files",
"version_url_template": "https://nodejs.org/en/download/releases/",
"extensions": ["js", "ts"],
"folders": ["node_modules", ".nvmrc"],
"files": ["package.json", ".node-version", ".nvmrc"]
\\\\}
\\\\}_
Python Segment¶
json
\\\\{
"type": "python",
"style": "powerline",
"powerline_symbol": "\uE0B0",
"foreground": "#111111",
"background": "#FFDE57",
"template": " \uF81F \\\\{\\\\{ .Full \\\\}\\\\} ",
"properties": \\\\{
"display_mode": "files",
"fetch_virtual_env": false
\\\\}
\\\\}_
Go Segment¶
json
\\\\{
"type": "go",
"style": "powerline",
"powerline_symbol": "\uE0B0",
"foreground": "#111111",
"background": "#8ED1F7",
"template": " \uFCD1 \\\\{\\\\{ .Full \\\\}\\\\} ",
"properties": \\\\{
"fetch_version": true
\\\\}
\\\\}_
Rust Segment¶
json
\\\\{
"type": "rust",
"style": "powerline",
"powerline_symbol": "\uE0B0",
"foreground": "#193549",
"background": "#99908a",
"template": " \uE7a8 \\\\{\\\\{ .Full \\\\}\\\\} ",
"properties": \\\\{
"fetch_version": true
\\\\}
\\\\}_
Java Segment¶
json
\\\\{
"type": "java",
"style": "powerline",
"powerline_symbol": "\uE0B0",
"foreground": "#ffffff",
"background": "#4063D8",
"template": " \uF675 \\\\{\\\\{ .Full \\\\}\\\\} ",
"properties": \\\\{
"fetch_version": true
\\\\}
\\\\}_
Docker Segment¶
json
\\\\{
"type": "docker",
"style": "powerline",
"powerline_symbol": "\uE0B0",
"foreground": "#000000",
"background": "#0B59E7",
"template": " \uF308 \\\\{\\\\{ .Context \\\\}\\\\} ",
"properties": \\\\{
"display_mode": "files"
\\\\}
\\\\}_
 Systeminformationssegmente
OS Segment¶
json
\\\\{
"type": "os",
"style": "diamond",
"foreground": "#26C6DA",
"background": "#546E7A",
"leading_diamond": "\uE0B6",
"trailing_diamond": "<transparent,background>\uE0B0",
"template": " \\\\{\\\\{ if .WSL \\\\}\\\\}WSL at \\\\{\\\\{ end \\\\}\\\\}\\\\{\\\\{.Icon\\\\}\\\\} ",
"properties": \\\\{
"macos": "\uF179",
"ubuntu": "\uF31b",
"windows": "\uF17a"
\\\\}
\\\\}_
Session Segment¶
json
\\\\{
"type": "session",
"style": "diamond",
"foreground": "#ffffff",
"background": "#c386f1",
"leading_diamond": "\uE0B6",
"trailing_diamond": "\uE0B0",
"template": " \\\\{\\\\{ .UserName \\\\}\\\\} ",
"properties": \\\\{
"display_host": false
\\\\}
\\\\}_
Batteriesegment¶
json
\\\\{
"type": "battery",
"style": "powerline",
"powerline_symbol": "\uE0B0",
"foreground": "#193549",
"background": "#f36943",
"background_templates": [
"\\\\{\\\\{if eq \"Charging\" .State.String\\\\}\\\\}#40c4ff\\\\{\\\\{end\\\\}\\\\}",
"\\\\{\\\\{if eq \"Discharging\" .State.String\\\\}\\\\}#ff5722\\\\{\\\\{end\\\\}\\\\}",
"\\\\{\\\\{if eq \"Full\" .State.String\\\\}\\\\}#4caf50\\\\{\\\\{end\\\\}\\\\}"
],
"template": " \\\\{\\\\{ if not .Error \\\\}\\\\}\\\\{\\\\{ .Icon \\\\}\\\\}\\\\{\\\\{ .Percentage \\\\}\\\\}\\\\{\\\\{ end \\\\}\\\\}\\\\{\\\\{ .Error \\\\}\\\\}\uF295 ",
"properties": \\\\{
"discharging_icon": "\uE231 ",
"charging_icon": "\uE234 ",
"charged_icon": "\uE22F "
\\\\}
\\\\}_
Speichersegment¶
json
\\\\{
"type": "sysinfo",
"style": "powerline",
"powerline_symbol": "\uE0B0",
"foreground": "#ffffff",
"background": "#8f43f3",
"template": " \uF85A \\\\{\\\\{ round .PhysicalPercentUsed .Precision \\\\}\\\\}% ",
"properties": \\\\{
"precision": 2
\\\\}
\\\\}_
Cloud und DevOps Segmente
AWS Segment¶
json
\\\\{
"type": "aws",
"style": "powerline",
"powerline_symbol": "\uE0B0",
"foreground": "#ffffff",
"background": "#FFA400",
"template": " \uF270 \\\\{\\\\{.Profile\\\\}\\\\}\\\\{\\\\{if .Region\\\\}\\\\}@\\\\{\\\\{.Region\\\\}\\\\}\\\\{\\\\{end\\\\}\\\\} ",
"properties": \\\\{
"display_default": false
\\\\}
\\\\}_
Azure Segment¶
json
\\\\{
"type": "az",
"style": "powerline",
"powerline_symbol": "\uE0B0",
"foreground": "#000000",
"background": "#9ec3f0",
"template": " \uFD03 \\\\{\\\\{ .Name \\\\}\\\\} ",
"properties": \\\\{
"display_default": true
\\\\}
\\\\}_
Kubernetes Segment¶
json
\\\\{
"type": "kubectl",
"style": "powerline",
"powerline_symbol": "\uE0B0",
"foreground": "#000000",
"background": "#ebcc34",
"template": " \uFD31 \\\\{\\\\{.Context\\\\}\\\\}\\\\{\\\\{if .Namespace\\\\}\\\\} :: \\\\{\\\\{.Namespace\\\\}\\\\}\\\\{\\\\{end\\\\}\\\\} ",
"properties": \\\\{
"display_error": false
\\\\}
\\\\}_
Terraform Segment¶
json
\\\\{
"type": "terraform",
"style": "powerline",
"powerline_symbol": "\uE0B0",
"foreground": "#000000",
"background": "#ebcc34",
"template": " \uF1BB \\\\{\\\\{.WorkspaceName\\\\}\\\\} "
\\\\}_
Erweiterte Eigenschaften
Bedingte Vorlagen¶
json
\\\\{
"type": "git",
"style": "powerline",
"powerline_symbol": "\uE0B0",
"foreground": "#193549",
"background": "#95ffa4",
"background_templates": [
"\\\\{\\\\{ if or (.Working.Changed) (.Staging.Changed) \\\\}\\\\}#FF9248\\\\{\\\\{ end \\\\}\\\\}",
"\\\\{\\\\{ if and (gt .Ahead 0) (gt .Behind 0) \\\\}\\\\}#ff4500\\\\{\\\\{ end \\\\}\\\\}",
"\\\\{\\\\{ if gt .Ahead 0 \\\\}\\\\}#B388FF\\\\{\\\\{ end \\\\}\\\\}",
"\\\\{\\\\{ if gt .Behind 0 \\\\}\\\\}#B388FF\\\\{\\\\{ end \\\\}\\\\}"
],
"foreground_templates": [
"\\\\{\\\\{ if or (.Working.Changed) (.Staging.Changed) \\\\}\\\\}#E3F2FD\\\\{\\\\{ end \\\\}\\\\}"
],
"template": " \\\\{\\\\{ .UpstreamIcon \\\\}\\\\}\\\\{\\\\{ .HEAD \\\\}\\\\}\\\\{\\\\{if .BranchStatus \\\\}\\\\} \\\\{\\\\{ .BranchStatus \\\\}\\\\}\\\\{\\\\{ end \\\\}\\\\}\\\\{\\\\{ if .Working.Changed \\\\}\\\\} \uF044 \\\\{\\\\{ .Working.String \\\\}\\\\}\\\\{\\\\{ end \\\\}\\\\}\\\\{\\\\{ if and (.Staging.Changed) (.Working.Changed) \\\\}\\\\}|\\\\{\\\\{ end \\\\}\\\\}\\\\{\\\\{ if .Staging.Changed \\\\}\\\\} \uF046 \\\\{\\\\{ .Staging.String \\\\}\\\\}\\\\{\\\\{ end \\\\}\\\\}\\\\{\\\\{ if gt .StashCount 0 \\\\}\\\\} \uF692 \\\\{\\\\{ .StashCount \\\\}\\\\}\\\\{\\\\{ end \\\\}\\\\} "
\\\\}_
Custom Variables¶
json
\\\\{
"type": "text",
"style": "plain",
"foreground": "#E06C75",
"template": "\\\\{\\\\{ .Env.CUSTOM_VAR \\\\}\\\\} "
\\\\}_
Cross-Platform Konfiguration¶
json
\\\\{
"type": "path",
"style": "powerline",
"powerline_symbol": "\uE0B0",
"foreground": "#ffffff",
"background": "#61AFEF",
"template": " \\\\{\\\\{ if .WSL \\\\}\\\\}\uF17a \\\\{\\\\{ end \\\\}\\\\}\uF07C \\\\{\\\\{ .Path \\\\}\\\\} ",
"properties": \\\\{
"style": "folder",
"mapped_locations": \\\\{
"C:\\temp": "\uF0E7",
"/tmp": "\uF0E7",
"~": "\uF015"
\\\\}
\\\\}
\\\\}_
Multi-line Prompts¶
json
\\\\{
"blocks": [
\\\\{
"type": "prompt",
"alignment": "left",
"segments": [
\\\\{
"type": "path",
"style": "plain",
"foreground": "#61AFEF",
"template": "\uF07C \\\\{\\\\{ .Path \\\\}\\\\}"
\\\\}
]
\\\\},
\\\\{
"type": "prompt",
"alignment": "right",
"segments": [
\\\\{
"type": "time",
"style": "plain",
"foreground": "#007ACC",
"template": "\\\\{\\\\{ .CurrentDate|date .Format \\\\}\\\\}"
\\\\}
]
\\\\},
\\\\{
"type": "prompt",
"alignment": "left",
"newline": true,
"segments": [
\\\\{
"type": "text",
"style": "plain",
"foreground": "#007ACC",
"template": "❯ "
\\\\}
]
\\\\}
]
\\\\}_
Anpassung und Styling
Farbschemas¶
json
\\\\{
"palette": \\\\{
"os-color": "#ACB0BE",
"closer-color": "#575656",
"pink": "#F25D94",
"lavender": "#LAVENDER",
"blue": "#06BCE4"
\\\\},
"blocks": [
\\\\{
"type": "prompt",
"alignment": "left",
"segments": [
\\\\{
"type": "os",
"style": "diamond",
"foreground": "p:os-color",
"background": "p:closer-color",
"leading_diamond": "\uE0B6",
"trailing_diamond": "\uE0B0",
"template": " \\\\{\\\\{ .Icon \\\\}\\\\} "
\\\\}
]
\\\\}
]
\\\\}_
Icons and Symbols¶
json
\\\\{
"type": "git",
"style": "powerline",
"powerline_symbol": "\uE0B0",
"template": " \\\\{\\\\{ .UpstreamIcon \\\\}\\\\}\\\\{\\\\{ .HEAD \\\\}\\\\}\\\\{\\\\{ if .Working.Changed \\\\}\\\\} \uF044 \\\\{\\\\{ .Working.String \\\\}\\\\}\\\\{\\\\{ end \\\\}\\\\} ",
"properties": \\\\{
"branch_icon": "\uF126 ",
"commit_icon": "\uF417 ",
"fetch_status": true,
"fetch_upstream_icon": true,
"untracked_modes": \\\\{
"no": "\uF059",
"normal": "\uF059",
"all": "\uF059"
\\\\},
"status_formats": \\\\{
"added": "\uF457",
"copied": "\uF4A5",
"deleted": "\uF458",
"modified": "\uF459",
"renamed": "\uF45A",
"unmerged": "\uF426",
"untracked": "\uF059"
\\\\}
\\\\}
\\\\}_
Powerline Symbole¶
json
\\\\{
"type": "path",
"style": "powerline",
"powerline_symbol": "\uE0B0",
"inverse_powerline": false,
"foreground": "#ffffff",
"background": "#61AFEF",
"template": " \uF07C \\\\{\\\\{ .Path \\\\}\\\\} "
\\\\}_
Diamond Style¶
json
\\\\{
"type": "os",
"style": "diamond",
"foreground": "#26C6DA",
"background": "#546E7A",
"leading_diamond": "\uE0B6",
"trailing_diamond": "\uE0B4",
"template": " \\\\{\\\\{ .Icon \\\\}\\\\} "
\\\\}_
Leistung und Optimierung
Caching¶
json
\\\\{
"type": "git",
"style": "powerline",
"powerline_symbol": "\uE0B0",
"template": " \\\\{\\\\{ .HEAD \\\\}\\\\} ",
"properties": \\\\{
"fetch_status": false,
"fetch_upstream_icon": false
\\\\}
\\\\}_
Bedingtes Display¶
json
\\\\{
"type": "node",
"style": "powerline",
"powerline_symbol": "\uE0B0",
"template": " \uF898 \\\\{\\\\{ .Full \\\\}\\\\} ",
"properties": \\\\{
"display_mode": "files",
"fetch_version": true
\\\\}
\\\\}_
Timeout Konfiguration¶
json
\\\\{
"type": "kubectl",
"style": "powerline",
"powerline_symbol": "\uE0B0",
"template": " \uFD31 \\\\{\\\\{.Context\\\\}\\\\} ",
"properties": \\\\{
"parse_kubeconfig": false,
"timeout": 2000
\\\\}
\\\\}_
Einsatz der Kommandozeile
Thema Management¶
```bash
Get current theme¶
oh-my-posh get theme
Set theme¶
oh-my-posh init pwsh --config "~/.mytheme.omp.json"|Invoke-Expression
Export current theme¶
oh-my-posh config export --output ~/.mytheme.omp.json
Validate theme¶
oh-my-posh config validate --config ~/.mytheme.omp.json
Migrate theme from v2 to v3¶
oh-my-posh config migrate --config ~/.mytheme.omp.json ```_
Debugging¶
```bash
Debug mode¶
oh-my-posh init pwsh --config ~/.mytheme.omp.json --debug|Invoke-Expression
Print configuration¶
oh-my-posh config get --config ~/.mytheme.omp.json
Test segment¶
oh-my-posh debug segment --config ~/.mytheme.omp.json --segment git
Performance profiling¶
oh-my-posh init pwsh --config ~/.mytheme.omp.json --profile|Invoke-Expression ```_
Cache Management¶
```bash
Clear cache¶
oh-my-posh cache clear
Cache path¶
oh-my-posh cache path
Cache statistics¶
oh-my-posh cache get --key git ```_
Integrationsbeispiele
Windows Terminal Integration
json
\\\\{
"profiles": \\\\{
"defaults": \\\\{
"font": \\\\{
"face": "CascadiaCode Nerd Font"
\\\\}
\\\\},
"list": [
\\\\{
"name": "PowerShell",
"source": "Windows.Terminal.PowershellCore",
"startingDirectory": "%USERPROFILE%"
\\\\}
]
\\\\}
\\\\}_
VS Code Integration¶
json
\\\\{
"terminal.integrated.fontFamily": "CascadiaCode Nerd Font",
"terminal.integrated.fontSize": 12,
"terminal.integrated.profiles.windows": \\\\{
"PowerShell": \\\\{
"source": "PowerShell",
"icon": "terminal-powershell"
\\\\}
\\\\}
\\\\}_
Azure Cloud Shell¶
```bash
Install in Azure Cloud Shell¶
curl -s https://ohmyposh.dev/install.sh|bash -s -- -d ~/bin echo 'export PATH=\(PATH:~/bin' >> ~/.bashrc echo 'eval "\)(oh-my-posh init bash)"' >> ~/.bashrc ```_
Fehlerbehebung
Häufige Fragen¶
```powershell
Font rendering issues¶
Install Nerd Font and configure terminal¶
PowerShell execution policy¶
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser
Module import issues¶
Import-Module oh-my-posh -Force
Theme not loading¶
oh-my-posh init pwsh --config "$env:POSH_THEMES_PATH\jandedobbeleer.omp.json"|Invoke-Expression
Performance issues¶
oh-my-posh init pwsh --config ~/.mytheme.omp.json --profile|Invoke-Expression ```_
Debug Commands¶
```bash
Check installation¶
oh-my-posh --version
Validate configuration¶
oh-my-posh config validate --config ~/.mytheme.omp.json
Test specific segment¶
oh-my-posh debug segment --config ~/.mytheme.omp.json --segment path
Environment information¶
oh-my-posh debug environment ```_
Konfigurationsvalidierung¶
```bash
Schema validation¶
oh-my-posh config validate --config ~/.mytheme.omp.json
Export for sharing¶
oh-my-posh config export --output ~/.mytheme.omp.json
Migrate old configuration¶
oh-my-posh config migrate --config ~/.old-theme.json ```_
Oh My Posh bietet eine leistungsstarke, plattformübergreifende Lösung für eine schnelle Anpassung, die sich besonders in Windows-Umgebungen auszeichnet und gleichzeitig die volle Kompatibilität mit Unix-ähnlichen Systemen gewährleistet. Das JSON-basierte Konfigurationssystem, die umfangreichen Funktionalitäten und die starke Windows-Terminal-Integration machen es zu einer exzellenten Wahl für Entwickler, die über mehrere Plattformen arbeiten. Ob Sie PowerShell unter Windows, Bash auf Linux oder irgendeine Shell dazwischen verwenden, Oh My Posh liefert konsistente, schöne und informative Aufforderungen, die Ihr Kommandozeilenerlebnis verbessern.