Let's beautify the Windows Terminal

hanancs

Ben Subendran

Posted on July 4, 2022

Let's beautify the Windows Terminal

This is a straightforward & clear-cut guide based on Scott Hanselman's YouTube tutorial.

Let's get you set up!

Install Powershell(.NET Core-powered cross-platform Powershell)

winget install Microsoft.PowerShell
Enter fullscreen mode Exit fullscreen mode

Image description

Install Windows Terminal

winget install Microsoft.WindowsTerminal
Enter fullscreen mode Exit fullscreen mode

Make PowerShell as your default terminal on Windows Terminal

Go to Settings

Image description

Click on Default profile and select PowerShell and save the changes.

Image description

Then go to Profiles > PowerShell > Additional Settings > Appearance.

Here you can customize your fonts by choosing a suitable font with lots of Glyphs.

Image description

Navigate to the following link to explore & download all the trendiest developer nerd fonts: https://www.nerdfonts.com/font-downloads

So, we will go with this, https://github.com/ryanoasis/nerd-fonts/releases/download/v2.1.0/FiraCode.zip

Choose FiraCode NF as Terminal Font.

Install Oh My Posh

winget install JanDeDobbeleer.OhMyPosh -s winget
Enter fullscreen mode Exit fullscreen mode
  • For the PATH to be reloaded, a restart of your terminal is advised

Enter the following code in Terminal to get the exact location of the PowerShell profile.

 echo $profile
Enter fullscreen mode Exit fullscreen mode

Image description

If you don't see any folder titled PowerShell in Documents, Make new folder in that name anyway.

Inside that folder, create a file Microsoft.PowerShell_profile.ps1 where we're gonna add our functionalities.

Following json is being used as theme property to modify Oh My Posh options.

theme.json:

Download theme.json and locate it wherever you want, I'm letting it beside the Microsoft.PowerShell_profile.ps1 file.

Open Microsoft.PowerShell_profile.ps1 and add the following code and save it.

oh-my-posh --init --shell pwsh --config C:\Users\{YOUR PC USER NAME}\Documents\PowerShell\theme.json | Invoke-Expression
Enter fullscreen mode Exit fullscreen mode

Restart your terminal. You will see the difference.

Image description

Install Terminal-Icons

Run the following code in the terminal

Install-Module -Name Terminal-Icons -Repository PSGallery
Enter fullscreen mode Exit fullscreen mode

Image description

And then add this line to Microsoft.PowerShell_profile.ps1 file

Import-Module -Name Terminal-Icons
Enter fullscreen mode Exit fullscreen mode

After your installation; if you run ls, you will notice that all the listed files, got colored with beautiful icons like this:

Image description

Install PSReadLine

PSReadLine will give you the guessings from the previous command history.

Run the following code in the terminal.

Install-Module PSReadLine -AllowPrerelease -Force
Enter fullscreen mode Exit fullscreen mode

And then add these lines to Microsoft.PowerShell_profile.ps1 file

Import-Module PSReadLine
Set-PSReadLineOption -PredictionSource History
Enter fullscreen mode Exit fullscreen mode

PSReadLine will help you this way:

Image description

Enable Predictive Intellisense

Predictive intellisense will gather guesses as much as possible.

Add these lines to Microsoft.PowerShell_profile.ps1 file.

Set-PSReadLineOption -PredictionViewStyle ListView
Set-PSReadLineOption -EditMode Windows

Enter fullscreen mode Exit fullscreen mode

This is the way Predictive Intellisense works:

Image description

Make sure your Microsoft.PowerShell_profile.ps1 file contains code like this:

Image description

Enable the Glassmorphism effect

Go to Windows Terminal > Settings > Open JSON file, then add these fields to defaults. Then save the settings.json file and restart the terminal. You will see wonders.

"defaults": {
   "useAcrylic": true,
   "acrylicOpacity": 0.5
},
Enter fullscreen mode Exit fullscreen mode

Finally!!! you terminal will look like this(if you follow everything precisely):

Image description

💖 💪 🙅 🚩
hanancs
Ben Subendran

Posted on July 4, 2022

Join Our Newsletter. No Spam, Only the good stuff.

Sign up to receive the latest update from our blog.

Related