Scott Hanselman inspired me...

... to finally use the "Oh My Posh" shell prompt enhancer.

After watching some of the videos on Scott Hanselman's YouTube channel where he prominently used the new Windows Terminal extensively and in the various shells he had pimped up shell prompts.

Yes, there are some other methods to enhance - especially the git information I find personally very useful - your shell prompt, mainly on linux shells, not so much for Windows shells. So I was impressed with "Ho My Posh" and finally invested the time to pimp my unix shell prompts with it, too.

Installation was easy with brew on macos.

brew tap jandedobbeleer/oh-my-posh  
brew install oh-my-posh

You can find the install instructions for your flavour of Os on the "Ho My Posh" website.

So here is my "Oh My Posh" configuration file (named it: ~/.omp.half-life.json):

  "$schema": "https://raw.githubusercontent.com/JanDeDobbeleer/oh-my-posh/main/themes/schema.json",
  "blocks": [
    {
      "type": "prompt",
      "alignment": "left",
      "segments": [
        {
          "type": "session",
          "style": "plain",
          "foreground": "#7E46B6",
          "properties": {
            "display_host": false,
            "prefix": ""
          }
        },
        {
          "type": "text",
          "style": "plain",
          "foreground": "#ffffff",
          "properties": {
            "prefix": "",
            "text": "›"
          }
        },
        {
          "type": "path",
          "style": "plain",
          "foreground": "#87FF00",
          "properties": {
            "style": "full",
            "prefix": ""
          }
        },
        {
          "type": "git",
          "style": "plain",
          "foreground": "#5FD7FF",
          "properties": {
            "prefix": "<#ffffff>:</> ",
            "branch_icon": "",
            "branch_ahead_icon": "",
            "branch_behind_icon": "",
            "branch_gone_icon": "",
            "branch_identical_icon": "",
            "commit_icon": "",
            "tag_icon": "",
            "merge_icon": "",
            "rebase_icon": "",
            "cherry_pick_icon": "",
            "working_color": "#D75F00",
            "staging_color": "#87FF00",
            "local_working_icon": " ∆",
            "local_staged_icon": " ∆",
            "status_separator_icon": "",
            "display_status": true,
            "display_status_detail": false,
            "display_branch_status": false,
            "display_stash_count": false
          }
        },
    {
      "type": "envvar",
      "style": "powerline",
      "powerline_symbol": "",
      "foreground": "#ffffff",
      "background": "#007700",
      "properties": {
        "var_name": "_venv"
      }
    },
        {
          "type": "text",
          "style": "plain",
          "foreground": "#D75F00",
          "properties": {
            "text": "›",
            "prefix": ""
          }
        }
      ]
    }
  ],
  "final_space": false
}

I use this configuration in my MacBook Pro and Mac Mini in the ".zshrc" like this:

eval "$(oh-my-posh --init --shell zsh --config ~/.omp.half-life.json)"

And so I have a nice looking - at least for me - and pimped up shell prompt, too.

Bildschirmfoto 2021-07-10 um 20.22.29.png

So, if you have not pimped your shell prompt, I highly recommend "Oh My Posh".

As always apply this rule: "Questions, feel free to ask. If you have ideas or find errors, mistakes, problems or other things which bother or enjoy you, use your common sense and be a self-reliant human being."

Have a good one. Alex

 
Share this