If you're like me, then I'm sure that you want to ensure that your tools are tweaked and customized to look exactly like you want. Because nice tools make us more productive, right, RIGHT?
In this blog post, we'll see how to take our Windows Terminal with PowerShell Core to the next level :)
What we need to install
- Windows Terminal Icons
- Custom Fonts
- Posh-Git
- Oh My Posh
Most of these are straight downloads and installs with PoSh - using PoSH to make PoSH nice!
Install the Windows Terminal Icons
Open Terminal and run the following command:
Install-Module -Name Terminal-Icons -Repository PSGallery
Then edit your $Profile
using your favorite editor - I'll use VS Code, so it will be code $profile
Add this line at the top: Import-Module -Name Terminal-Icons
Restart your Terminal for this to take effect and you should see something similar to this:
Install Custom Fonts
Most developers prefer clean, easy to read and work with fonts with ligatures. There are many fonts out there but few that meet all these requirements. Luckily, [NerdFonts](Nerd Fonts - Iconic font aggregator, glyphs/icons collection, & fonts patcher) have done a fantastic job in aggregating and listing some awesome, developer-friendly fonts. Find the ones you like and download them. Now, the tricky bit is to install them as you have to go through many many *.ttf or *.otf files. But don't worry, I got you covered! Unzip the font(s) to a folder and navigate into it and run the following script:
Ok! Fonts covered..
Install Posh-Git and Oh My Posh
As a developer you'll most likely have to work with Git so having the ability to quickly understand where things are, is very important. [Posh-Git](dahlbyk/posh-git: A PowerShell environment for Git (github.com)) is a fantastic tool that adds this capability to your PowerShell terminal:
Install-Module posh-git -Scope CurrentUser -Force
Then we want to install Oh My Posh, a PowerShell equivalent to OhMyZsh, that provides customization and theming for our editors.
Install-Module oh-my-posh -Scope CurrentUser
Ensure that you update your $Profile
accordingly. Open it with your favorite editor and add these two lines at the top:
Import-Module posh-git
Import-Module oh-my-posh
With installation done, the next step is customization
Fancy progress bars in Terminal
If you use winget
then you've seen the boring, monotone progress bars that are displayed during downloads or updates. Who likes that? WinGet now winget settings via a file so that you can customize it to an extent. Execute winget settings
in the terminal. This will open the settings.json
file which you can edit. I added the following to get the rainbow effect in the progress bar
{
"$schema": "https://aka.ms/winget-settings.schema.json",
"visual": {
"progressBar": "rainbow"
}
}
Select a theme
Selecting a theme is a big decision. I know people that have spent hours tweaking the look and feel, colors and contrast of their themes. I'm lazy and I rely on the themes that the awesome open source community has built. Oh My Posh comes with way too many themes so if you want to have a quick demo how they would look in your terminal run the following command. This will apply each available theme to help you decide:
Get-PoshThemes
However, I recently fell in love with Nick Craver's (of the StackOverflow fame) theme: Craver. Make sure to update your Oh My Posh (if you're not new to this) and follow the Nick's instructions here: Craver's oh-my-posh profile.
Edit your $profile
file to include your theme as per the example below:
Import-Module posh-git
Import-Module oh-my-posh
Import-Module -Name Terminal-Icons
Set-PoshPrompt -Theme Craver
Configure Windows Terminal
Lastly, you want to configure Windows Terminal with your favorite fonts and tweak. You can now do this in the UI or via the settings.json file - whatever makes you happy :)
After all this, my Terminal looks like this:
Let me know if you want me to publish my Terminal settings json file
if you feel it will help you with your setup :)
NOTE: this is only the tip of the iceberg! Windows Terminal is extremely configurable so I would encourage you to look around and customize it even further
Summary
In any case, I'm really excited to see all the innovation and customization that has gone into Windows Terminal. I have been an avid user since the early preview/beta stages. Windows has always been behind MacOs and Linux in the terminal space and I always wanted to somehow have the equivalent of my iTerm2 with ZSH and OhMyZsh. These days it's the other way around where I want Windows Terminal on my Mac! But for now I'll compromise with what's available.
So, go ahead and tweak your Terminal to your liking - you can. Don't forget to tweet a picture of your terminal and tag me and Kayla Cinnamon @cinnamon_msft (the PM of Windows Terminal). We would love to see what you achieve!