Skip to content

Instantly share code, notes, and snippets.

@asgaut
Last active July 9, 2025 08:39
Show Gist options
  • Select an option

  • Save asgaut/496462e67d90f7216b15857bada7d5b3 to your computer and use it in GitHub Desktop.

Select an option

Save asgaut/496462e67d90f7216b15857bada7d5b3 to your computer and use it in GitHub Desktop.
My powershell startup script + Oh-my-posh config
# Oh-my-posh fancy command prompt
# ===============================
# Documentation: https://ohmyposh.dev/
# First run:
# winget install JanDeDobbeleer.OhMyPosh -s winget
& ([ScriptBlock]::Create((oh-my-posh init pwsh --config "$HOME\posh-theme.omp.json" --print) -join "`n"))
# Git autocompletion
# ==================
# Documentation: https://www.rodyvansambeek.com/blog/git-autocomplete-powershell-magic
# Run this as admin first:
# Install-Module posh-git -Scope CurrentUser
Import-Module posh-git
# Show history as a list
# Run this first:
# Install-Module -Name PSReadLine -AllowPrerelease -Scope CurrentUser -Force -SkipPublisherCheck
# Taken from: https://gist.github.com/shanselman/25f5550ad186189e0e68916c6d7f44c3
Set-PSReadLineOption -PredictionSource History
Set-PSReadLineOption -PredictionViewStyle ListView
Set-PSReadLineOption -EditMode Windows
# Allow to use Ctrl-d to exit shell
Set-PSReadlineKeyHandler -Chord 'Ctrl+d' -Function ViExit
# Zoxide
# ======
# https://github.com/ajeetdsouza/zoxide
# First run:
# winget install ajeetdsouza.zoxide
Invoke-Expression (& { (zoxide init powershell | Out-String) })
{
"final_space": true,
"console_title": true,
"console_title_style": "folder",
"blocks": [
{
"type": "prompt",
"alignment": "left",
"horizontal_offset": 0,
"vertical_offset": 0,
"segments": [
{
"type": "path",
"style": "diamond",
"powerline_symbol": "",
"invert_powerline": false,
"foreground": "#ffffff",
"background": "#ff479c",
"leading_diamond": "",
"trailing_diamond": "",
"properties": {
"prefix": "  ",
"style": "folder"
}
},
{
"type": "python",
"style": "powerline",
"powerline_symbol": "",
"invert_powerline": false,
"foreground": "#FFD43B",
"background": "#306998",
"leading_diamond": "",
"trailing_diamond": "",
"properties": {
"display_mode": "env",
"prefix": " \uE235 "
}
},
{
"type": "git",
"style": "powerline",
"powerline_symbol": "",
"invert_powerline": false,
"foreground": "#193549",
"background": "#fffb38",
"leading_diamond": "",
"trailing_diamond": "",
"properties": {
"display_status": true,
"display_stash_count": true,
"display_upstream_icon": true
}
},
{
"type": "dotnet",
"style": "powerline",
"powerline_symbol": "",
"invert_powerline": false,
"foreground": "#ffffff",
"background": "#6CA35E",
"leading_diamond": "",
"trailing_diamond": "",
"properties": {
"display_version": true,
"prefix": "  "
}
},
{
"type": "root",
"style": "powerline",
"powerline_symbol": "",
"invert_powerline": false,
"foreground": "#ffffff",
"background": "#ffff66",
"leading_diamond": "",
"trailing_diamond": "",
"properties": null
},
{
"type": "exit",
"style": "powerline",
"powerline_symbol": "",
"invert_powerline": false,
"foreground": "#ffffff",
"background": "#2e9599",
"leading_diamond": "",
"trailing_diamond": "",
"properties": {
"always_enabled": true,
"color_background": true,
"display_exit_code": false,
"error_color": "#f1184c",
"prefix": " "
}
}
]
}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment