Skip to content

Instantly share code, notes, and snippets.

@StevenBonePgh
Created May 21, 2022 02:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save StevenBonePgh/b40c87d9e6937cec4b966807184d016c to your computer and use it in GitHub Desktop.
Save StevenBonePgh/b40c87d9e6937cec4b966807184d016c to your computer and use it in GitHub Desktop.
oh-my-posh configuration 7.87 compatible. Left: folder, git, root, elapsed, exit code. Right: shell, battery, time
{
"$schema": "https://raw.githubusercontent.com/JanDeDobbeleer/oh-my-posh/main/themes/schema.json",
"blocks": [
{
"alignment": "left",
"segments": [
{
"background": "#ff479c",
"foreground": "#ffffff",
"leading_diamond": "",
"trailing_diamond": "",
"properties": {
"folder_separator_icon": "  ",
"home_icon": "~",
"style": "folder"
},
"style": "diamond",
"template": "  {{ .Path }} ",
"type": "path"
},
{
"background": "#fffb38",
"background_templates": [
"{{ if or (.Working.Changed) (.Staging.Changed) }}#FF9248{{ end }}",
"{{ if and (gt .Ahead 0) (gt .Behind 0) }}#ff4500{{ end }}",
"{{ if gt .Ahead 0 }}#B388FF{{ end }}",
"{{ if gt .Behind 0 }}#B388FF{{ end }}"
],
"foreground": "#193549",
"leading_diamond": "",
"powerline_symbol": "",
"properties": {
"branch_max_length": 25,
"fetch_stash_count": true,
"fetch_status": true,
"fetch_upstream_icon": true
},
"style": "powerline",
"template": " {{ .UpstreamIcon }}{{ .HEAD }}{{ .BranchStatus }}{{ if .Working.Changed }}  {{ .Working.String }}{{ end }}{{ if and (.Working.Changed) (.Staging.Changed) }} |{{ end }}{{ if .Staging.Changed }}  {{ .Staging.String }}{{ end }}{{ if gt .StashCount 0 }}  {{ .StashCount }}{{ end }} ",
"trailing_diamond": "",
"type": "git"
},
{
"background": "#ffff66",
"foreground": "#111111",
"powerline_symbol": "",
"style": "powerline",
"template": "  ",
"type": "root"
},
{
"background": "#83769c",
"foreground": "#ffffff",
"properties": {
"always_enabled": true
},
"style": "plain",
"template": "<transparent></> ﮫ{{ .FormattedMs }}⠀",
"type": "executiontime"
},
{
"background": "#00897b",
"background_templates": [
"{{ if gt .Code 0 }}#e91e63{{ end }}"
],
"foreground": "#ffffff",
"properties": {
"always_enabled": true
},
"style": "diamond",
"template": "<parentBackground></> ",
"trailing_diamond": "",
"type": "exit"
}
],
"type": "prompt"
},
{
"segments": [
{
"background": "#0077c2",
"foreground": "#ffffff",
"style": "plain",
"template": "<#0077c2,transparent></>  {{ .Name }} <transparent,#0077c2></>",
"type": "shell"
},
{
"background": "#f36943",
"background_templates": [
"{{if eq \"Charging\" .State.String}}#40c4ff{{end}}",
"{{if eq \"Discharging\" .State.String}}#ff5722{{end}}",
"{{if eq \"Full\" .State.String}}#4caf50{{end}}"
],
"foreground": "#ffffff",
"invert_powerline": true,
"powerline_symbol": "",
"properties": {
"charged_icon": " ",
"charging_icon": " ",
"discharging_icon": " "
},
"style": "powerline",
"template": " {{ if not .Error }}{{ .Icon }}{{ .Percentage }}{{ end }}{{ .Error }} ",
"type": "battery"
},
{
"background": "#2e9599",
"foreground": "#111111",
"invert_powerline": true,
"leading_diamond": "",
"style": "diamond",
"template": " {{ .CurrentDate | date .Format }} ",
"trailing_diamond": "",
"type": "time"
}
],
"type": "rprompt"
}
],
"console_title_template": "{{ .Shell }} in {{ .Folder }}",
"final_space": true,
"version": 2
}
@StevenBonePgh
Copy link
Author

Notes to future me:

Copy file to %USERPROFILE%

Need to use a nerd font to see the symbols in the file above. Cascadia Code patched with additional symbols is my current favorite.

  • "Caskaydia Cove" via www.nerdfonts.com
    -- VSCode Editor Font Family (or Windows Terminal profiles/defaults/font/face): CaskaydiaCove Nerd Font

  • Delugia Code is more recently updated than Caskaydia Cove
    -- Can be installed via Chocolatey "choco install nerd-fonts-delugiacomplete"
    -- VSCode Editor Font Family (or Windows Terminal profiles/defaults/font/face): Delugia

  • Powershell
    -- "choco install powershell-core"
    -- Find location of profile file and edit it (echo $PROFILE, notepad++$PROFILE)
    -- add line: oh-my-posh init pwsh --config=$env:USERPROFILE/sbone.omp.json | Invoke-Expression

  • Command Prompt
    -- "choco install clink-maintained"
    -- Open new command prompt and type "clink info". In the scripts directory add lua file: notepad++ %LOCALAPPDATA%\clink\oh-my-posh.lua
    --- load(io.popen('oh-my-posh init cmd --config=%USERPROFILE%/sbone.omp.json'):read("*a"))()

  • WSL
    -- Install oh-my-posh
    --- /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
    ---- Follow the Next steps instructions to add Homebrew to your PATH and to your bash shell profile script ~/.profile
    --- brew install jandedobbeleer/oh-my-posh/oh-my-posh
    ---- update via: brew update && brew upgrade oh-my-posh && exec bash
    -- Configure via nano ~/.bashrc brew should have added a line, need to add the config file to use.
    --- eval "$(oh-my-posh init bash --config /mnt/c/Users/MyUserFolder/sbone.omp.json)"

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