Skip to content

Instantly share code, notes, and snippets.

@bombadillo
Last active April 18, 2023 10:13
Show Gist options
  • Save bombadillo/b8d97fc9b9a55e6675101c0e2d5ced8d to your computer and use it in GitHub Desktop.
Save bombadillo/b8d97fc9b9a55e6675101c0e2d5ced8d to your computer and use it in GitHub Desktop.
oh my posh

Reference Guide

https://gist.github.com/jchandra74/5b0c94385175c7a8d1cb39bc5157365e

Pre-install commands

Install-PackageProvider NuGet -MinimumVersion '2.8.5.201' -Force

Set-PSRepository -Name PSGallery -InstallationPolicy Trusted

Install-Module -Name 'posh-git'

Install the plugins

install-module posh-git

install-module oh-my-posh

Open powershell profile

if (!(Test-Path -Path $PROFILE )) { New-Item -Type File -Path $PROFILE -Force }
notepad $PROFILE

Paste in profile

Import-Module 'posh-git'
Import-Module 'oh-my-posh'
Set-Theme agnoster

Location of theme file

%localappdata%\Programs\oh-my-posh\themes

{
"$schema": "https://raw.githubusercontent.com/JanDeDobbeleer/oh-my-posh/main/themes/schema.json",
"blocks": [
{
"alignment": "left",
"segments": [
{
"type": "text",
"style": "diamond",
"leading_diamond": "\ue0b6",
"foreground": "#ffffff",
"background": "#cc3802",
"template": "{{ if .Env.PNPPSHOST }} \uf8c5 {{ .Env.PNPPSHOST }} {{ end }}"
},
{
"type": "text",
"style": "powerline",
"foreground": "#ffffff",
"background": "#047e84",
"powerline_symbol": "\ue0b0",
"template": "{{ if .Env.PNPPSSITE }} \uf672 {{ .Env.PNPPSSITE }}{{ end }}"
},
{
"type": "text",
"style": "diamond",
"trailing_diamond": "\ue0b4",
"foreground": "#ffffff",
"background": "#047e84",
"template": "{{ if .Env.PNPPSSITE }}\u00A0{{ end }}"
}
],
"type": "rprompt"
},
{
"alignment": "left",
"segments": [
{
"background": "#9A348E",
"foreground": "#ffffff",
"leading_diamond": "\ue0b6",
"style": "diamond",
"template": "\uD83D\uDC7A ",
"type": "session"
},
{
"background": "#DA627D",
"foreground": "#ffffff",
"powerline_symbol": "\ue0b0",
"properties": {
"style": "folder"
},
"style": "powerline",
"template": " {{ .Path }} ",
"type": "path"
},
{
"background": "#252323",
"foreground": "#deefb7",
"foreground_templates": [
"{{ if and (gt .Ahead 0) (gt .Behind 0) }} #DA627D {{ end }}",
"{{ if gt .Ahead 0 }}#98ce00{{ end }}",
"{{ if gt .Behind 0 }}#ff9505{{ end }}"
],
"powerline_symbol": "\ue0b0",
"properties": {
"branch_max_length": 30,
"fetch_stash_count": true,
"fetch_status": true,
"fetch_upstream_icon": true
},
"style": "powerline",
"template": " {{ .UpstreamIcon }}{{ .HEAD }}{{ .BranchStatus }}{{ if .Working.Changed }}<#E84855> {{ .Working.String }}</>{{ end }}{{ if gt .StashCount 0 }}<#566246> \uf692 {{ .StashCount }}</>{{ end }}{{ if and (.Working.Changed) (.Staging.Changed) }} |{{ end }}{{ if .Staging.Changed }}<#98ce00> \uf046 {{ .Staging.String }}</>{{ end }}",
"trailing_diamond": "\ue0b4",
"type": "git"
},
{
"background": "#86BBD8",
"foreground": "#ffffff",
"powerline_symbol": "\ue0b0",
"style": "powerline",
"template": " \ue718 {{ if .PackageManagerIcon }}{{ .PackageManagerIcon }} {{ end }}{{ .Full }} ",
"type": "node"
},
{
"background": "#33658A",
"foreground": "#ffffff",
"properties": {
"time_format": "15:04"
},
"style": "diamond",
"template": " \uD83D\uDE80 {{ .CurrentDate | date .Format }} ",
"trailing_diamond": "\ue0b0",
"type": "time"
}
],
"type": "prompt"
}
],
"final_space": true,
"version": 2
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment