This Gist is deprecated, please refer to: https://ohmyposh.dev/docs/installation/windows
Original post: How to make a pretty prompt in Windows Terminal with Powerline, Nerd Fonts, Cascadia Code, WSL, and oh-my-posh (Thanks Scott Hanselman) I copied most of that post content with some modifications, I just want to keep everything uin one place for reference later in the future
I recommend installing Installing PowerShell 7 or above
Get Windows Terminal free from the Store. You can also get it from GitHub's releases but I recommend the store because it'll stay up to date automatically.
Per these directions, install Posh-Git and Oh-My-Posh. This also assumes you've installed Git for Windows.
Install-Module posh-git -Scope CurrentUser
Install-Module oh-my-posh -Scope CurrentUser
Run these commands from PowerShell or PowerShell 7. I recommend PowerShell 7.1.3 or above. You can also use PowerShell on Linux too, so be aware. When you run Install-Module for the first time you'll get a warning that you're downloading and installing stuff from the internet so follow the prompts appropriately.
Also get PSReadline if you're on PowerShell 7:
Install-Module -Name PSReadLine -RequiredVersion 2.1.0 -Scope CurrentUser
Then run notepad $PROFILE
and add these lines to the end:
Windows may prompt asking to create
Microsoft.PowerShell_profile.ps1
if it doesn't exist, you can confirm and copy paste the lines below
Import-Module posh-git
Import-Module oh-my-posh
Set-PoshPrompt -Theme Paradox
After I closed and reopened the terminal I got execution of scripts is disabled on this system.
error (Or something like that, I dont remember exactly), to solve it I ran the following command (Source):
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser
If you do all this and you see squares and goofy symbols, it's likely that the font you're using doesn't have the advanced Powerline glyphs. Those glyphs are the ones that make this prompt look so cool!
Cascadia Code has been updated with a PL (Powerline) Glyph version! Go get it at https://github.com/microsoft/cascadia-code/releases and in your settings.json
under profiles > defaults
set the fontFace to "Cascadia Code PL":
"profiles":
{
"defaults": { "fontFace": "Cascadia Code PL" },
...
You can do the same with VSCode. Go to
settings
, search forterminal font
and add'Cascadia Code PL'
to the Font Family (e.g'Cascadia Code PL', Consolas, 'Courier New', monospace
)
Remember also you can get lots of Nerd Fonts at https://www.nerdfonts.com, just make sure you get one (or generate one!) that includes PowerLine Glyphs.
PowerShell include PSReadline, you simply need to run notepad $PROFILE
and add these line to the end:
Set-PSReadlineKeyHandler -Key Tab -Function MenuComplete
As you can see the autocompletion is working as expected:
- Tutorial: Set up Powerline in Windows Terminal
- How to use autocomplete at the command line for dotnet, git, winget, and more!
- Installing PowerShell on Windows 7.1
Enjoy!