This is my custom theme journey for Oh My Posh, a prompt theming engine for any shell.
Moonlight is my proudly crafted theme, it has a set of customizations and it is a theme that make me feel at home.
All segments and features displayed
Segments, in order:
- Auxiliar 1st row:
- Battery: displays an icon with the current battery, it changes based on 20%'s steps, then almost empty and full.
- Root: Icon displayed if the user is root/superuser/administrator.
- Upgrade: Icon displayed if there are updates to Oh My Posh available.
- Session: Icon displayed if the user is connected via SSH.
- Python: Icon displayed if there's an active Python virtual environment.
- Docker: Icon and image context are displayed if Docker is running.
- Status: Icon and error details are displayed if the last command failed.
- Main Row:
- OS: Icon changes based on OS, also contains a magic URL if clicked.
- Time: Displays the current time.
- Execution Time: Displays the time it took to execute the last command, with a 500ms threshold.
- Git: Displays the current branch, changes based on the status of the repository.
- Icons inside brackets:
- Icon displayed if there are changes in the working directory (untracked or modified files) or if there are changes staged for the next commit.
- Icon displayed if the branch has diverged (both ahead and behind the remote).
- Icon displayed if the local branch is ahead of the remote branch by at least one commit.
- Icon displayed if the local branch is behind the remote branch by at least one commit.
- The current branch name is displayed and has a clickable URL to the repository.
- Icons inside brackets:
- Path: Displays the current path, with a clickable URL to open the current directory in the default file explorer. Also contains some mapped folders with set icons.
Theme timeline
My theme journey, I learned a lot in the way and I feel proud of myself with how it turned out.If any are to your liking, feel free to check the other theme files in this repository, they are named to be in cronological order. Started with Bubbles Extra and kept changing ever since, now I feel that it is done (for now).
A quick guide on how to set up Oh My Posh with this theme.
-
Install Windows Terminal
-
Install Oh My Posh:
winget install JanDeDobbeleer.OhMyPosh -s winget
-
Go to your WindowsPowerShell folder and paste the contents of
Microsoft.PowerShell_profile.ps1
in the beginning of the file:code $PROFILE
-
Paste these lines at the start of the file:
oh-my-posh init pwsh --config 'https://raw.githubusercontent.com/v-amorim/oh-my-posh/main/themes/Moonlight.omp.json' | Invoke-Expression $env:VIRTUAL_ENV_DISABLE_PROMPT = 1
-
Reload your profile:
. $PROFILE
-
To enable auto suggestions, run:
Install-Module PsReadLine -Force Install-Module -Name Terminal-Icons -Repository PSGallery
To get the latest versions whenever there's an update, run:
winget upgrade JanDeDobbeleer.OhMyPosh -s winget
winget upgrade --all # Or this, to update all
-
Install Oh My Posh:
sudo wget https://github.com/JanDeDobbeleer/oh-my-posh/releases/latest/download/posh-linux-amd64 -O /usr/local/bin/oh-my-posh sudo chmod +x /usr/local/bin/oh-my-posh sudo apt install unzip; curl -s https://ohmyposh.dev/install.sh | sudo bash -s
-
Go to your
.bashrc
file:code ~/.bashrc
-
Paste this line at the end:
eval "$(oh-my-posh init bash --config 'https://raw.githubusercontent.com/v-amorim/oh-my-posh/main/themes/Moonlight.omp.json')"
-
Reload your profile:
source ~/.bashrc
-
To get the latest versions whenever there's an update, run:
curl -s https://ohmyposh.dev/install.sh | sudo bash -s
This can fix the auto update requiring sudo:
sudo chown -R $(whoami) /usr/local/bin