My Perfect Oh My Posh Replacement For Oh My Zsh

Table of Contents

Overview

Recently I moved from a Macbook Air to a windows machine and the thing I missed most was the git info in the terminal. Everything was so simple an sufficient with Oh My Zsh.

After spent some time, I found the perfect theme (https://github.com/AntonRyadovoy/Powershell-nord-theme/blob/main/nordcustom_v.3.yaml with a little tweak).

Setup

I believe that you already setup oh my posh.

Let’s go to the theme folder and create the theme file:

 cd $env:POSH_THEMES_PATH

Use any editor you want to put the following content

# yaml-language-server: $schema=https://raw.githubusercontent.com/JanDeDobbeleer/oh-my-posh/main/themes/schema.json

palette:
    nord-0: '#2E3440'
    nord-1: '#3B4252'
    nord-2: '#434C5E'
    nord-3: '#4C566A'
    nord-4: '#D8DEE9'
    nord-5: '#E5E9F0'
    nord-6: '#ECEFF4'
    nord-7: '#8FBCBB'
    nord-8: '#88C0D0'
    nord-9: '#81A1C1'
    nord-10: '#5E81AC'
    nord-11: '#BF616A'
    nord-12: '#D08770'
    nord-13: '#EBCB8B'
    nord-14: '#A3BE8C'
    nord-15: '#B48EAD'
blocks:
    - type: prompt
      alignment: left
      segments:
        - properties:
            cache_duration: none
          template: " ╭─<#BF616A>[<#88C0D0>\U000F0536</> </>{{ if .SSHSession }} {{ end }}{{ .UserName }}@{{ .HostName }}<#BF616A>]</> "
          foreground: p:nord-13
          type: session
          style: plain
        - properties:
            cache_duration: none
            playing_icon: "\U000F04C7 "
          template: '{{ .Icon }}{{ if ne .Status "stopped" }}{{ .Artist }} - {{ .Track }}{{ end }}'
          foreground: p:nord-14
          type: spotify
          style: plain
        - properties:
            cache_duration: none
            folder_icon: 
            folder_separator_icon: ' / '
            home_icon: "\U000F02DC"
            max_depth: 2
            style: agnoster_short
          foreground: p:nord-15
          type: path
          style: plain
        - properties:
            always_enabled: true
            cache_duration: none
          template: " {{ if gt .Code 0 }}✘ {{ else }}\U000F0E1E {{ end }}{{ if eq ( gt .Code 0 ) .Segments.Path.Writable}} {{ end }}"
          foreground: p:nord-14
          type: status
          style: plain
          foreground_templates:
            - '{{ if gt .Code 0 }}red{{ end }}'
    - type: prompt
      alignment: left
      segments:
        - properties:
            branch_icon: ' '
            cache_duration: none
            fetch_stash_count: true
            fetch_status: true
            fetch_upstream_icon: true
            fetch_worktree_count: true
          template: "{{ .UpstreamIcon }}{{ .HEAD }}{{if .BranchStatus }} {{ .BranchStatus }}{{ end }}{{ if .Working.Changed }}  {{ .Working.String }}{{ end }}{{ if and (.Working.Changed) (.Staging.Changed) }} |{{ end }}{{ if .Staging.Changed }}  {{ .Staging.String }}{{ end }}{{ if gt .StashCount 0 }} \U000F0193 {{ .StashCount }}{{ end }}"
          foreground: p:nord-13
          type: git
          style: plain
    - type: prompt
      alignment: left
      segments:
        - properties:
            cache_duration: none
          template: " <#EBCB8B>╰─ "
          foreground: p:nord-8
          type: text
          style: plain
      newline: true
version: 3

edit your profile to load the theme

 notepad $PROFILE

And put this line at the top to load the correct profile:

oh-my-posh init pwsh --config "$env:POSH_THEMES_PATH/nordcustom_v.3.yaml" | Invoke-Expression notepad $PROFILE

That’s it!

Result

oh my posh theme

This is exactly what I need.

Leave a Comment