Customize Your Windows Terminal - Like A Pro
No more default windows terminal! Let's customize our windows terminal like a pro using oh-my-posh a prompt theme engine for any shell.
Table of contents
Prerequisites
Install Windows Terminal
First of all, need to install Microsoft Windows Terminal from the Microsoft Store or you can check their GitHub repo. as well.
Setup Powerline Fonts
To do some fancy styling in our terminal, now we need to install some Powerline like fancy fonts. Here, I'm gonna use use FiraMono Nerd Font, download from their official website: Nerd Fonts. Download and install any powerline font into your machine.
Git Installation
It's time to download and install git from the official source. Here you will find it: Git SCM. I'm not gonna show you how to install git (
Execution Policy
Sometimes we face some difficulties to install any module in PowerShell. To solve the matter simply run the command.
Set-ExecutionPolicy Unrestricted -Scope CurrentUser
Or,
Set-ExecutionPolicy Unrestricted
Required Modules
Now run Windows Terminal as adminstator. Before installing any module, we need to set windows execution policy to unrestricted so that we can do the rest without any exception. Let's write the follwing commands and hit enter one by one to install them into our machine.
Install-Module posh-git -Scope CurrentUser
Install-Module oh-my-posh -Scope CurrentUser
PowerShell Core (optional)
If you are using PowerShell Core, install PSReadLine module using the following command.
Install-Module -Name PSReadLine -Scope CurrentUser -Force -SkipPublisherCheck
My process
Modify Terminal Settings
Open terminal settings.json
by pressing [Ctrl + ,
] in any code editor. Then, select all by pressing [Ctrl + a
] and hit delete button. Now we need to copy and paste everyting from the given link to our settings.json
. Then save by pressing [Ctrl + s
] and close settings.json
file.
settings.json
file will be found here: Terminal settings.josn
Note: This settings will only work if you do not change your git installation directory. If do so, then change the commandline
and icon
file path in the settings.json
.
Import Modules & Install Terminal Theme
To import Oh My Posh run the following commands one by one.
Import-Module posh-git
Import-Module oh-my-posh
All are set. Now It's time to see all the installed theme those we can use as our default terminal theme. To see them copy and paste the command to windows terminal.
Get-PoshThemes
From here I am using Hotstick Minimal as my default one. To do so run the given command.
Set-PoshPrompt -Theme hotstick.minimal
Set Terminal Profile
To ensure all the modules imported and theme installed correctly edit the default terminal profile. First of all let's see where our terminal profile is located by running the command.
echo $profile
It will produce result as follows.
C:\Users\{your_username}\Documents\WindowsPowerShell\Microsoft.PowerShell_profile.ps1
Simply run the command.
notepad $profile
It will create, or open default shell profile in default notepad editor. In this stage, we will copy the strings from below and paste them into the $profile
file, save it and close it. Finally, close the terminal and reopen it.
Import-Module posh-git
Import-Module oh-my-posh
Set-PoshPrompt -Theme hotstick.minimal
Customize Terminal Theme (Optional)
If anyone wish to customize his/her terminal theme as mine then he/she can do through updating {themename}.json
file. I'm providing my one here.
settings.json
file will be found here: Theme settings.josn
Steps to do so
- Find out
oh-my-posh
theme directory. i.e:
C:\Users\{your_username}\Documents\WindowsPowerShell\Modules\oh-my-posh\themes
- Select the right json theme file. i.e:
hotstick.minimal.omp.json
and open it with any editor. - Erase everything from the json theme file. Open my json theme settings file. Copy all the settings and paste them to your theme settings file. Save it and simply close it.
Now you are able to see a eye catchy terminal like this one.
Author
- Website - AminBabu
- Twitter - @AminBabu_