Modifying Windows Terminal
Tags: terminal, windows, commands, prompt
Published: 2021-01-22 12:11:57

Most of us (developers) love using terminal and I personally prefer Terminal over GUI especially when it comes to Git **BUT** if you're a Windows user, the command prompt is so boring.

![Command Prompt](https://i.imgur.com/qqgeU67.png)

Have you ever seen Mac OS terminals? Aren't they cool? Let's try to change our windows boring command prompt to something like this:

![Amazing Terminal](https://i.imgur.com/JmlSIWS.png)

There are several steps to follow.
* Downloading Windows Terminal
* Installing Modules
* Changing Fonts
* Changing Theme

# Downloading Windows Terminal
By default, Windows provides **Command prompt** and **PowerShell**. We will not modify any of these but rather download **[Windows Terminal](https://github.com/khattakdev/terminal)**.
It is recommended to download it from [Microsoft Store](https://www.microsoft.com/en-pk/p/windows-terminal/9n0dx20hk701?rtc=1#activetab=pivot:overviewtab). Make sure your Windows version is the latest.

![Microsoft Store](https://i.imgur.com/VXlv2Em.png)

I've already downloaded and installed it on my computer. Once it's downloaded and installed, open it from Windows Start by simply typing `Windows Terminal`

![Task Menu](https://i.imgur.com/IzG1hWY.png)

By default, it looks something like this

![Default Windows Terminal](https://i.imgur.com/pA3PgzI.png)


# Installing Modules
There are two modules that we need to make our terminal looks awesome.
* [oh-my-posh](https://github.com/JanDeDobbeleer/oh-my-posh)
* [posh-git](https://github.com/dahlbyk/posh-git)

**Oh My Posh** is a module that helps you to decorate your Powershell and make it look more colorful.
**Posh git** is a module that helps you to provide autocomplete for **git** commands, paths, and branches.

To install these two modules, run Windows Terminal as Administrator.

Execute
```powershell
Install-Module oh-my-posh
```

This will also ask you to install `NuGet` if not installed. I've already installed it on my computer.

![Oh my Posh](https://i.imgur.com/rWw9Xe3.png)

Next is to install `posh-git`
```powershell
Install-Module posh-git
```

![Posh Git](https://i.imgur.com/7tjOaVA.png)

Now that we have both modules installed, it's time to import them.
To do that, execute the following commands
```powershell
Set-ExecutionPolicy Unrestricted
```
(The above command will remove the restriction of 3rd party script execution)

```powershell
Import-Module oh-my-posh
```
```powershell
Import-Module posh-git
```
(Optional)
```powershell
Set-Theme Paradox
```

You'll be able to see a difference

![After Modules](https://i.imgur.com/fy9b4rd.png)

The change looks a bit odd, there is a small blue triangle after `~` (Tilda). Let's fix that later.
There is one other problem that every time you start Windows Terminal, you'll need to import the modules again.

To fix this issue, we need to create a file in the Windows Terminal folder and paste all these commands there.

If you do
```powershell
echo $profile
```
You'll get a file path in return, that's the file, which is executed every time we start Windows Terminal
We just need to simply add those import commands to this file.
To do that,
```powershell
notepad $profile
```
This will ask you to create this file if it doesn't exist.

Paste the following commands and save the file.
```powershell
Import-Module oh-my-posh
Import-Module posh-git
Set-Theme Paradox
```
Now try restarting your Terminal and it will still have the change.

# Changing Fonts
That small rectangle you see is because of unsupported fonts. We need to change the fonts. I recommend using [Fira Code](https://github.com/tonsky/FiraCode). Simply download it and install it on your computer.

Once installed, open Windows Terminal's settings

![Terminal Settings](https://i.imgur.com/d1SKUIr.png)

Go to `defaults` located under `profile` and add
```json
"fontFace": "Fira Code"
```

![Change Fonts](https://i.imgur.com/1p1vI6c.png)

Save the file and check your Windows Terminal, it will now look awesome.

![New Fonts](https://i.imgur.com/8CHF3E8.png)

# Changing Theme
Let's try to change the theme and make it look cooler.
[Windows Terminal Themes](https://windowsterminalthemes.dev/) has a number of amazing themes available. Find a good theme for yourself, I'll go with *Dracula* and tap on `Get Theme` to copy JSON data.

![Windows Terminal Themes](https://i.imgur.com/2LL37kJ.png)

Open Windows Terminal's Setting, navigate to `schemes`, and paste the copied JSON data.

![New Theme](https://i.imgur.com/EWgZT6X.png)

Next, navigate to `defaults` where we previously added `fontFace` and add the following
```json
"colorScheme": "Dracula"
```
I've copied **Dracula**, that's why its value is `Dracula`, depending on the theme you copied, the value will be different.

Save the file and revisit your Windows Terminal. Tadaa!! 🎉🎉 

![New look](https://i.imgur.com/Gy0TFVn.png)