DEV Community

loading...
Cover image for Modifying Windows Terminal

Modifying Windows Terminal

khattakdev profile image Arsalan Khattak ใƒปUpdated on ใƒป3 min read

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

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

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.
It is recommended to download it from Microsoft Store. Make sure your Windows version is the latest.

Microsoft Store

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

By default, it looks something like this

Default Windows Terminal

Installing Modules

There are two modules that we need to make our terminal looks awesome.

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

Install-Module oh-my-posh
Enter fullscreen mode Exit fullscreen mode

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

Oh my Posh

Next is to install posh-git

Install-Module posh-git
Enter fullscreen mode Exit fullscreen mode

Posh Git

Now that we have both modules installed, it's time to import them.
To do that, execute the following commands

Set-ExecutionPolicy Unrestricted
Enter fullscreen mode Exit fullscreen mode

(The above command will remove the restriction of 3rd party script execution)

Import-Module oh-my-posh
Enter fullscreen mode Exit fullscreen mode
Import-Module posh-git
Enter fullscreen mode Exit fullscreen mode

(Optional)

Set-Theme Paradox
Enter fullscreen mode Exit fullscreen mode

You'll be able to see a difference

After Modules

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

echo $profile
Enter fullscreen mode Exit fullscreen mode

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,

notepad $profile
Enter fullscreen mode Exit fullscreen mode

This will ask you to create this file if it doesn't exist.

Paste the following commands and save the file.

Import-Module oh-my-posh
Import-Module posh-git
Set-Theme Paradox
Enter fullscreen mode Exit fullscreen mode

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. Simply download it and install it on your computer.

Once installed, open Windows Terminal's settings

Terminal Settings

Go to defaults located under profile and add

"fontFace": "Fira Code"
Enter fullscreen mode Exit fullscreen mode

Change Fonts

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

New Fonts

Changing Theme

Let's try to change the theme and make it look cooler.
Windows Terminal Themes 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

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

New Theme

Next, navigate to defaults where we previously added fontFace and add the following

"colorScheme": "Dracula"
Enter fullscreen mode Exit fullscreen mode

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

Discussion (0)

pic
Editor guide