Skip to content

Instantly share code, notes, and snippets.

@NickCraver
Last active August 9, 2024 02:26
Show Gist options
  • Save NickCraver/2d661e24e315e7e94a1aad88dadfadf3 to your computer and use it in GitHub Desktop.
Save NickCraver/2d661e24e315e7e94a1aad88dadfadf3 to your computer and use it in GitHub Desktop.
Craver's oh-my-posh profile

This is the PowerShell profile I use - my theme is now built into oh-my-posh as "craver". Overall, to get this:

preview

You'll need only these instructions - all other files in this gist are for reference only:

  1. Optional (not needed in Windows 11):
    • Install Windows Terminal from the Microsoft Store...but this works in any Powershell terminal.
  2. The PowerShell modules:
    Install-Module -Name posh-git,oh-my-posh,Terminal-Icons -Repository PSGallery
  3. Edit your Microsoft.PowerShell_profile.ps1 file to these 3 modules and set the prompt (this executes when you start a PowerShell terminal). The path for this is $profile in PowerShell, e.g. to edit with VS Code: code $profile:
    Import-Module -Name posh-git,oh-my-posh,Terminal-Icons
    Set-PoshPrompt -Theme craver
  4. You'll also need a font capable of rendering the symbols, I use Delugia Nerd Font (download: https://github.com/adam7/delugia-code) - other options like Hack NF and others work well too.
    • To select this after install, go to Terminal's Settings -> Profiles: PowerShell (bottom left) -> Appearance tab, choose font
    • looks like this
  5. For the grey background, in the same area as step 2 choose "One Half Dark".

I hope you enjoy!

{
"$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": "root",
"style": "powerline",
"powerline_symbol": "\uE0C4",
"foreground": "#242424",
"background": "#f1184c",
"properties": {
"prefix": "",
"postfix": ""
}
},
{
"type": "os",
"style": "diamond",
"leading_diamond": " ",
"powerline_symbol": "",
"foreground": "#3A86FF",
"background": "#282c34",
"properties": {
"prefix": ""
}
},
{
"type": "time",
"style": "powerline",
"powerline_symbol": "\uE0C4",
"foreground": "#FFBB00",
"background": "#242424",
"properties": {
"time_format": "15:04:05",
"prefix": ""
}
},
{
"type": "path",
"style": "powerline",
"powerline_symbol": "\uE0B0",
"foreground": "#33DD2D",
"background": "#242424",
"properties": {
"prefix": "\uE5FF ",
"style": "folder",
"folder_separator_icon": "/"
}
},
{
"type": "git",
"style": "powerline",
"powerline_symbol": "\uE0B0",
"foreground": "#3A86FF",
"background": "#242424",
"properties": {
"display_status": true,
"display_stash_count": true,
"display_upstream_icon": true,
"prefix": ""
}
},
{
"type": "dotnet",
"style": "powerline",
"powerline_symbol": "\uE0C4",
"foreground": "#ffffff",
"background": "#0184bc",
"properties": {
"prefix": "  "
}
},
{
"type": "executiontime",
"style": "powerline",
"powerline_symbol": "\uE0C4",
"foreground": "#ffffff",
"background": "#8800dd",
"properties": {
"threshold": 10,
"style": "austin",
"prefix": " <#fefefe>\ufbab</> "
}
},
{
"type": "exit",
"style": "powerline",
"powerline_symbol": "\uE0B4",
"foreground": "#242424",
"background": "#33DD2D",
"properties": {
"display_exit_code": false,
"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"
}
}
]
}
]
}
# This goes in your Microsoft.PowerShell_profile.ps1 (can find the path via $PROFILE in your prompt)
Import-Module -Name posh-git,oh-my-posh,Terminal-Icons
Set-PoshPrompt -Theme craver
{
"$schema": "https://aka.ms/terminal-profiles-schema",
"profiles":
{
"defaults": {},
"list":
[
{
"acrylicOpacity": 0.94999999999999996,
"closeOnExit": "graceful",
"colorScheme": "Craver",
"commandline": "powershell.exe",
"cursorColor": "#FFFFFF",
"cursorShape": "bar",
"font":
{
"face": "Delugia Nerd Font",
"size": 10
},
"guid": "{61c54bbd-c2c6-5271-96e7-009a87ff44bf}",
"historySize": 9001,
"icon": "ms-appx:///ProfileIcons/{61c54bbd-c2c6-5271-96e7-009a87ff44bf}.png",
"name": "PowerShell",
"padding": "8",
"snapOnInput": true,
"startingDirectory": "C:\\git",
"useAcrylic": true
}
]
},
"schemes":
[
{
"background": "#1F2329",
"black": "#1F2329",
"blue": "#5498D1",
"brightBlack": "#5A6374",
"brightBlue": "#61AFEF",
"brightCyan": "#56B6C2",
"brightGreen": "#98C379",
"brightPurple": "#C678DD",
"brightRed": "#E06C75",
"brightWhite": "#DCDFE4",
"brightYellow": "#E5C07B",
"cursorColor": "#FFFFFF",
"cyan": "#56B6C2",
"foreground": "#DCDFE4",
"green": "#98C379",
"name": "Craver",
"purple": "#C678DD",
"red": "#E06C75",
"selectionBackground": "#FFFFFF",
"white": "#DCDFE4",
"yellow": "#E5C07B"
}
]
}
@NickCraver
Copy link
Author

@joergbattermann Not sure what you're hitting there, try another font like Hack NF? From Hack.zip here: https://github.com/ryanoasis/nerd-fonts/releases

@NickCraver
Copy link
Author

@Bogatinov thanks for the feedback! I tried too improve the instructions here and simplified since it's a built-in theme now :)

@mgasparel
Copy link

We must get the dotnet bot icon patched into nerdfonts!

@edgarronda
Copy link

edgarronda commented Sep 21, 2021

In windows Delugia font doesn't work properly for me,
So I used Agave Nerd Font from @Bogatinov link https://www.nerdfonts.com/font-downloads

Now It's working so well.

image

@DiomedesDominguez
Copy link

Any equivalent to Terminal-Icons but instead of Powershell, to Bash?

@juchom
Copy link

juchom commented Mar 20, 2023

@DiomedesDominguez you can try this : https://www.youtube.com/watch?v=YnGl9SDVn98

@NickCraver Installing oh-my-posh with Install-Module is no longer supported
To install you have to use : winget install JanDeDobbeleer.OhMyPosh -s winget

And Microsoft.PowerShell_profile.ps1 shoud be like this now :

Import-Module -Name posh-git,Terminal-Icons
oh-my-posh init pwsh --config "$env:POSH_THEMES_PATH\craver.omp.json" | Invoke-Expression

I think that's all I've done, thanks for this nice theme 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment