Skip to content

Instantly share code, notes, and snippets.

@gregmac
Last active April 28, 2023 15:35
Show Gist options
  • Save gregmac/b17ce3e10b3e2563e5605866bb7dbf63 to your computer and use it in GitHub Desktop.
Save gregmac/b17ce3e10b3e2563e5605866bb7dbf63 to your computer and use it in GitHub Desktop.
Oh-my-posh Config
  • Originally adapteed from Scott Hanselman's excellent guide.
  • Updated in 2021-08 for oh-my-posh v3.
  • Uses a theme based on Paradox theme
    • Short folder names, special icons for Registry, Home, etc
    • Different prompt icon when running as admin
    • Shows last exit code
    • Timing info for long-running commands
    • Git status

  1. Install Windows Terminal (from Store)
  2. Install Scoop
  3. Install Powershell stuff:
   scoop install posh-git
   Install-Module oh-my-posh -Scope CurrentUser
   sudo Install-Module -Name Recycle

  1. Install nerd-font
   scoop bucket add nerd-fonts
   sudo scoop install Delugia-Nerd-Font-Complete
  1. In Windows Terminal, Ctrl+Shift+, to open settings.json
  2. Add
{
    "profiles":
    {
        "defaults":
        {
            "fontFace": "Delugia"
        }
    }
}
  1. Create the other files listed here
Set-PoshPrompt ~\Documents\PowerShell\paradox-greg.omp.json
# Produce UTF-8 by default
# https://news.ycombinator.com/item?id=12991690
$PSDefaultParameterValues["Out-File:Encoding"] = "utf8"
# bash-style completion
Set-PSReadlineKeyHandler -Key Tab -Function Complete
{
"$schema": "https://raw.githubusercontent.com/JanDeDobbeleer/oh-my-posh/main/themes/schema.json",
"console_title": true,
"console_title_style": "template",
"console_title_template": "{{ if .Root }}\u26A1{{end}} {{ .Path }}",
"blocks": [
{
"type": "prompt",
"alignment": "left",
"segments": [
{
"type": "session",
"style": "powerline",
"powerline_symbol": "\uE0B0",
"foreground": "#100e23",
"background": "#ffffff",
"properties": {
"display_host": true,
"default_user_name": "greg",
"display_default": false
}
},
{
"type": "path",
"style": "powerline",
"powerline_symbol": "\uE0B0",
"foreground": "#100e23",
"background": "#91ddff",
"properties": {
"folder_icon": "\u2026",
"windows_registry_icon": "<#cc00cc>\ue5fc</>",
"folder_separator_icon": "\\",
"style": "agnoster_short",
"max_depth": 7,
"enable_hyperlink": true
}
},
{
"type": "git",
"style": "powerline",
"powerline_symbol": "\uE0B0",
"foreground": "#193549",
"background": "#95ffa4",
"properties": {
"display_status": true
}
},
{
"type": "exit",
"style": "powerline",
"powerline_symbol": "\uE0B0",
"foreground": "#ffffff",
"background": "#006100",
"properties": {
"error_icon": "\uF468",
"error_color": "#ff8080",
"always_numeric": true,
"color_background": true,
"always_enabled": false,
"success_icon": "\uF62B"
}
},
{
"type": "executiontime",
"style": "powerline",
"powerline_symbol": "\uE0B0",
"foreground": "#ffffff",
"background": "#30004e",
"properties": {
"threshold": 100,
"style": "austin",
"prefix": " \uFA1A"
}
}
]
},
{
"type": "prompt",
"alignment": "left",
"newline": true,
"segments": [
{
"type": "text",
"style": "plain",
"foreground": "#007ACC",
"properties": {
"prefix": "",
"text": "{{if .Root}}<#ffe9aa>\uF0E7</>{{else}}\u03BB{{end}}"
}
}
]
}
],
"final_space": false
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment