31 Mar 2024

Speed up Oh-My-Posh Cold Start

收藏到CSDN网摘

Oh-My-Posh is a beautiful cross-platform command line customisation tool that runs on windows, linux, and mac. I have set up it for my win11 laptop's Terminal (PowerShell) and WSL2 prompt. One day, I've noticed that it started incredibly slow (>20s). After browsing the internet for a while, a simple fix is to replace the existing one line code in my $PROFILE setting file. Here it is!
notepad $PROFILE
The above line assumes that you have the profile defined properly. (If not, check oh-my-posh website for how to do it) Then, clear the content in the profile file and type the line below as the only content and the magic will happen.
oh-my-posh --init --shell pwsh --config $env:POSH_THEMES_PATH/jandedobbeleer.omp.json | Invoke-Expression
Tips: Inside the WSL, you can find your Windows user's home folder here: /mnt/c/<THEME_PATH>. To check the THEME_PATH, try to echo it in powershell:
echo "$env:POSH_THEMES_PATH"

No comments :

Post a Comment