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.
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:
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.
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
By default, it looks something like this
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
This will also ask you to install NuGet
if not installed. I've already installed it on my computer.
Next is to install posh-git
Install-Module 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
(The above command will remove the restriction of 3rd party script execution)
Import-Module oh-my-posh
Import-Module posh-git
(Optional)
Set-Theme Paradox
You'll be able to see a difference
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
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
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
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
Go to defaults
located under profile
and add
"fontFace": "Fira Code"
Save the file and check your Windows Terminal, it will now look awesome.
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.
Open Windows Terminal's Setting, navigate to schemes
, and paste the copied JSON data.
Next, navigate to defaults
where we previously added fontFace
and add the following
"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!! 🎉🎉
Top comments (8)
It seems the "Set-Theme" cmdlet was renamed to "Set-PoshPrompt".
Thanks for telling us!
Thank you so much Bro .
Set-PoshPrompt
How to install NuGet for using this theme.
It ask for you permission to install NuGet when you try to install a module for the very first time.
Showing this error.
dev-to-uploads.s3.amazonaws.com/up...
Nice man so clear and easily explained. Appriciate your work keep it up