I was customizing my Windows Terminal for my new PC from scratch. I ran into a couple of issues installing oh-my-posh, first from this 3rd party tutorial and later when following the official docs.
The final steps/corrections I used are in the answer below.
I was customizing my Windows Terminal for my new PC from scratch. I ran into a couple of issues installing oh-my-posh, first from this 3rd party tutorial and later when following the official docs.
The final steps/corrections I used are in the answer below.
Share Improve this question asked Mar 25 at 20:30 MrCuriousMrCurious 414 bronze badges1 Answer
Reset to default 1(We're assuming you're using Windows Terminal and Powershell)
You'll have to replace <user> in the paths below with your username
(running $Env:UserName
in Powershell will print this)
Install a compatible nerd font like FiraCode so you can see the cool icons
- Unzip the file and double-click the Windows-compatible font to install
Update this font to be your PowerShell default by
Opening Windows Terminal in Administrator mode (for later commands)
Opening Settings (Ctrl-Comma)
On the far left select Profiles -> Windows Powershell -> Additional Settings -> Appearance -> Font Face -> Fira Code (or whatever nerd font you selected)
Hit the save button at the bottom right
Navigate back to the terminal and
Restart your admin terminal either via:
Closing and reopening or
Ctrl-Shift-P (open command palette) -> Restart Connection
Install OhMyPosh, which, for me, meant running the following in my admin Powershell
1. `winget install JanDeDobbeleer.OhMyPosh -s winget`
2. Winget should already be installed in newer Windows versions, but [installation instructions are here](https://www.powershellgallery/packages/winget-install/2.1.0)
3. This also added the oh-my-posh bin to my PATH
4. Restart your admin terminal
Allow Powershell to run local scripts via
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope LocalMachine
Theoretically you can also sign the profile if you don't want to run the former
Create a powershell profile (I didn't have one by default)
New-Item -Path $PROFILE -Type File -Force
My file was created in this directory:
C:\Users\<user>\Documents\WindowsPowerShell
Open your powershell profile file in notepad via
notepad $PROFILE
Enter the following in notepad
& "C:\Users\<user>\AppData\Local\Programs\oh-my-posh\bin\oh-my-posh.exe" init pwsh | Invoke-Expression
The original command from the docs looks like it was made from cmd rather than powershell, and failed when I tried to run it
oh-my-posh init pwsh | Invoke-Expression
Save the file and close it
Reload the profile via
& $PROFILE
The original command from the docs looks like it was made from cmd rather than powershell, and failed when I tried to run it
. $PROFILE
Done! If all went well you should see oh-my-posh run on terminal startup!
发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744170094a4561494.html
评论列表(0条)