As a terminal junky, many years ago I customized my PowerShell $profile to define a custom function:prompt. This included custom parsing for any .git directory (even .hg for Mecurial!), and eventually any .git file to support worktrees and submodules. It was fast and, last I knew, still powered some internal environments we use at work.

The downside is that this doesn’t work in bash. I do have PowerShell installed in Ubuntu on WSL2, but I don’t use it nearly as much as bash given bash is much faster to start up. And since I’m developing more often in Ubuntu for pretty much every language besides C# (and .NET in general) - because Visual Studio is so much better than Visual Studio Code for managed code - I really wanted all the bells and whistles of my custom profile. I was running powerline and know I can customize it too, but keeping Python3 up to date with the right version that vim needs was something I was growing tired of doing.

It was finally time to switch to Oh My Posh. I learned of this many years ago but I don’t think it existed when I first wrote my custom prompt. It did, however, inspite me to rewrite how the prompt was coded to be more declaritive. Still, adding all the same capabilities just didn’t seem worth my time.

I ended up writing my own custom theme that somewhat matches my old function:prompt with a few improvements I wanted. I can clone this to ~/.config/oh-my-posh and set my .bashrc or PowerShell $profile to initialize it with the custom configuration.

To support starting a shell on a machine that does not yet have Oh My Posh, I moved and refactored my old prompt to be a module I can load as a fallback.

Overall, my $profile was better optimized so PowerShell starts faster, though starting a new Go program each time my profile needs to render is a little slower - not enough to really impact useability, though.

All these configuation directories - along with my vim configuration - are stored as Git repositories to make it easier to sync across disparate machines as well as track changes over time. Who knows: maybe one day I want to restore some old functionality.

After so many, many years with my custom prompt, it’s a little hard to say goodbye, but look at this new prompt (which will also continue to change):

Oh My Posh