Skip to content

Instantly share code, notes, and snippets.

@paulczy
Forked from NickCraver/Microsoft.PowerShell_profile.ps1
Created September 8, 2021 19:25
Show Gist options
  • Save paulczy/39dc4a605d051c10bcc3bf009add009f to your computer and use it in GitHub Desktop.
Save paulczy/39dc4a605d051c10bcc3bf009add009f to your computer and use it in GitHub Desktop.
Craver's oh-my-posh profile
{
"$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}}(Admin) {{end}}{{.Folder}}",
"blocks": [
{
"type": "prompt",
"alignment": "left",
"segments": [
{
"type": "os",
"style": "plain",
"foreground": "#3A86FF",
"properties": {
"prefix": ""
}
},
{
"type": "root",
"style": "powerline",
"powerline_symbol": "\uE0B0",
"foreground": "#f1184c",
"background": "#242424",
"properties": {
"prefix": "root ",
"postfix": ""
}
},
{
"type": "time",
"style": "powerline",
"powerline_symbol": "\uE0B0",
"foreground": "#FFBB00",
"background": "#242424",
"properties": {
"time_format": "2006-01-02 15:04:05",
"prefix": ""
}
},
{
"type": "path",
"style": "powerline",
"powerline_symbol": "\uE0B0",
"foreground": "#33DD2D",
"background": "#242424",
"properties": {
"prefix": "\uE5FF ",
"style": "full",
"folder_separator_icon": "/"
}
},
{
"type": "git",
"style": "powerline",
"powerline_symbol": "\uE0B0",
"foreground": "#3A86FF",
"background": "#242424",
"properties": {
"display_stash_count": true,
"display_upstream_icon": true,
"prefix": ""
}
},
{
"type": "dotnet",
"style": "powerline",
"powerline_symbol": "",
"foreground": "#000000",
"background": "#00ffff",
"properties": {
"prefix": " v"
}
},
{
"type": "exit",
"style": "powerline",
"powerline_symbol": "\uE0B0",
"foreground": "#242424",
"background": "#33DD2D",
"properties": {
"display_exit_code": false,
"always_enabled": true,
"color_background": true,
"error_color": "#f1184c",
"prefix": " \ufc8d"
}
}
]
},
{
"type": "prompt",
"alignment": "left",
"newline": true,
"segments": [
{
"type": "text",
"style": "plain",
"foreground": "#f1184c",
"properties": {
"prefix": "",
"text": "\u279C"
}
}
]
}
]
}

Included here are the PowerShell profile I use as well as the oh-my-posh 3 config, but in addition to these you'll need:

  1. The PowerShell modules:
    • For git in PowerShell, I use posh-git
    • For prompt customization, I use oh-my-posh
    • For file/folder icons I use the excellent Terminal-Icons package by @devblackops: https://github.com/devblackops/Terminal-Icons
    • To install each:
Install-Module -Name posh-git -Repository PSGallery
Install-Module -Name oh-my-posh -Repository PSGallery
Install-Module -Name Terminal-Icons -Repository PSGallery
  1. You'll also need a font capable of rendering the symbols, I use Delugia Nerd Font (download: https://en.likefont.com/font/252443/)
    • To select this after install, go to Terminal's Settings -> PowerShell settings -> Appearance tab, choose font

I hope you enjoy!

Import-Module -Name posh-git
Import-Module -Name oh-my-posh
Import-Module -Name Terminal-Icons
Set-PoshPrompt -Theme ~/Documents/WindowsPowerShell/craver.omp.json
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment