Pamper your windows terminal - Customize Prompt
Debashish Pal
Posted on April 22, 2021
Windows Terminal (WT) came as a revolution. It was a refreshing delight for all those windows users, who used to stare at the Linux Terminal and wished, can we have it on windows, until now.
Love for Windows Terminal !!
Those who have not tried, what are you waiting for. Give it a try. Trust me it's a game changer.
https://www.microsoft.com/en-in/p/windows-terminal/9n0dx20hk701?activetab=pivot:overviewtab
WT supports Windows PowerShell (Old one that comes installed with windows by default), PowerShell, WSL, CMD, Azure CLI etc. So, whatever terminals are installed on you machine are all integrated under one roof, which you can choose from the drop-down, as you can see in the image below.
Can we make the terminal look even better like this, with a fancy prompt? YEAH !!
Please follow the steps below:
Note: A separate article will be posted soon for WSL users
For Windows Powershell & Powershell Only
Install Git for Windows from
https://git-scm.com/downloadsRun below command on the command prompt
This would install post-git & oh-my-posh
Install-Module posh-git -Scope CurrentUser
Install-Module oh-my-posh -Scope CurrentUser
Script execution policy must be set to either RemoteSigned or Unrestricted in order for the profile script to run.
Run this command to check your current execution policy.
Get-ExecutionPolicy
Run the below command for setting it.
Set-ExecutionPolicy Unrestricted -Scope CurrentUser
If it does not work you can try the Force flag.
Set-ExecutionPolicy Unrestricted -Scope CurrentUser -Force
Posh-Git adds Git status information to your prompt and tab completion for Git commands, parameters, remotes, and branch names.
Oh-My-Posh provides theme capabilities for your PowerShell prompt.
3.Now, we need to add some lines to your profile, which would be executed every time you open a new tab.
Type the below command on the command prompt
notepad $PROFILE
It will open up the profile file in notepad. If a profile file does not exist, it will create a new one. If it exists then same will open.
Add below lines to the end of the file, and Save. The file might be empty initially.
Import-Module posh-git
Import-Module oh-my-posh
Set-PoshPrompt -Theme paradox
4.Now we need to add the required fonts
Download Meslo, and save it at a convenient location.
Navigate to the path were the file was downloaded. Unzip Meslo.zip and install the highlighted fonts as shown below.
Double click each of the font file and install.
Click the Install button on the window which pops up for the same, as shown below.
5.Let's perform the last step.
Open up settings in WT.
It will open up settings.json file in the default editor.
Add below lines to the defaults section.
"fontSize": 9,
"fontFace": "MesloLGM NF"
If you are using latest version of WT, you might get the below screen.
Don't fret, click on the gear icon as shown above. It will open up settings.json file.
That's It !!
You have patiently followed all the steps.
Enjoy your terminal.
Tip !!
If you want to list down all the themes supported by Oh My Posh, run the below command.
Get-PoshThemes
You will get output like below
If you wish to change a theme, open up the profile file, and change the theme name.
Ex. If I want to change the theme to bubbles
Type below command on the command prompt to open up profile
notepad $PROFILE
Change the theme name to bubbles as shown below, and save the file.
Open up another tab now, the theme would be applied.
Repeat the steps for each of the terminals
For WSL, WSL2 I will be adding another post soon.
Enjoy the customization !!
Posted on April 22, 2021
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.
Related
July 10, 2020