Last active
March 22, 2021 07:03
-
-
Save bgelens/440c21ced26a42a7cbd7a147a006b13c to your computer and use it in GitHub Desktop.
My oh-my-posh v3 theme!
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"$schema": "https://raw.githubusercontent.com/JanDeDobbeleer/oh-my-posh/main/themes/schema.json", | |
"final_space": false, | |
"console_title": false, | |
"blocks": [ | |
{ | |
"type": "prompt", | |
"alignment": "left", | |
"horizontal_offset": 0, | |
"vertical_offset": 0, | |
"segments": [ | |
{ | |
"type": "envvar", | |
"style": "powerline", | |
"foreground": "#007ACC", | |
"background": "#000000", | |
"properties": { | |
"var_name": "oh_my_psversion", | |
"postfix": " \uFCB5 ", | |
"prefix": "" | |
} | |
}, | |
{ | |
"type": "root", | |
"style": "powerline", | |
"powerline_symbol": "", | |
"invert_powerline": false, | |
"foreground": "#100e23", | |
"background": "#ffe9aa", | |
"leading_diamond": "", | |
"trailing_diamond": "", | |
"properties": null | |
}, | |
{ | |
"type": "envvar", | |
"style": "powerline", | |
"powerline_symbol": "\uE0B0", | |
"foreground": "#ffffff", | |
"background": "#0077c2", | |
"properties": { | |
"var_name": "oh_my_azure_context", | |
"prefix": "\uFD03 " | |
} | |
}, | |
{ | |
"type": "kubectl", | |
"style": "powerline", | |
"powerline_symbol": "\uE0B0", | |
"foreground": "#000000", | |
"background": "#ebcc34", | |
"properties": { | |
"prefix": "\uFD31 ", | |
"template": "{{.Context}}{{if .Namespace}} - {{.Namespace}}{{end}}" | |
} | |
}, | |
{ | |
"type": "path", | |
"style": "powerline", | |
"powerline_symbol": "", | |
"invert_powerline": false, | |
"foreground": "#100e23", | |
"background": "#91ddff", | |
"leading_diamond": "", | |
"trailing_diamond": "", | |
"properties": { | |
"style": "folder", | |
"prefix": "\uF115 ", | |
"postfix": " " | |
} | |
}, | |
{ | |
"type": "git", | |
"style": "powerline", | |
"powerline_symbol": "", | |
"invert_powerline": false, | |
"foreground": "#193549", | |
"background": "#95ffa4", | |
"leading_diamond": "", | |
"trailing_diamond": "", | |
"properties": { | |
"display_stash_count": true, | |
"stash_count_icon": "\uF692 ", | |
"prefix": "" | |
} | |
}, | |
{ | |
"type": "exit", | |
"style": "powerline", | |
"powerline_symbol": "", | |
"invert_powerline": false, | |
"foreground": "#ffffff", | |
"background": "#ff8080", | |
"leading_diamond": "", | |
"trailing_diamond": "", | |
"properties": null | |
} | |
] | |
}, | |
{ | |
"type": "newline" | |
}, | |
{ | |
"type": "prompt", | |
"alignment": "left", | |
"segments": [ | |
{ | |
"type": "text", | |
"style": "plain", | |
"foreground": "#007ACC", | |
"properties": { | |
"prefix": "", | |
"text": "\u276F" | |
} | |
} | |
] | |
} | |
] | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#requires -Module Microsoft.PowerShell.UnixCompleters | |
$env:PATH = "/usr/local/opt/python/libexec/bin:/usr/local/opt/openjdk/bin:/Library/Application Support/Microsoft/MAU2.0/Microsoft AutoUpdate.app/Contents/MacOS:$env:PATH" | |
Set-PSReadLineOption -EditMode Emacs -BellStyle None -ExtraPromptLineCount 1 -PredictionSource History -Colors @{ | |
Selection = "`e[93m" | |
} | |
Set-PSReadLineKeyHandler -Chord Tab -Function MenuComplete | |
Set-PSReadLineKeyHandler -Key UpArrow -Function HistorySearchBackward | |
Set-PSReadLineKeyHandler -Key DownArrow -Function HistorySearchForward | |
Set-PSReadLineKeyHandler -Key 'Ctrl+f' -Function ForwardWord | |
Set-PSReadLineKeyHandler -Key 'Ctrl+z' -Function Undo | |
Set-PSReadLineOption -HistorySearchCursorMovesToEnd | |
function Set-EnvVar { | |
if (Test-Path -Path ~/.Azure/AzureRmContext.json) { | |
$azureContext = Get-Content ~/.Azure/AzureRmContext.json | ConvertFrom-Json | |
$subscriptionName = $azureContext.Contexts.($azureContext.DefaultContextKey).Subscription.Name | |
$env:oh_my_azure_context = $subscriptionName | |
} else { | |
$env:oh_my_azure_context = $null | |
} | |
$env:oh_my_psversion = ($PSVersionTable.PSVersion.ToString() -split '-')[0] | |
} | |
Set-PoshPrompt -Theme ~/.config/powershell/PoshThemes/ben.json | |
New-Alias -Name 'Set-PoshContext' -Value 'Set-EnvVar' -Scope Global |
And you need to install PSReadline prerelease as well!
Install-Module PSReadLine -AllowPrerelease -Force
Yes, for those settings indeed (copied a little bit too much profile :)) I'll leave it in there for reference
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Font: Caskaydia Cove Nerd Font
Make sure you change the line in the profile where the theme is loaded to point to your path (note I got a report on Windows that the ~ did not work correctly so you might want to use a literal path):