Make Development more delightful ft. Windows Terminal

Hey everyone, Welcome back! In this blog, we will look at installing the brand new Windows Terminal and customizing it in the most attractive way. Here’s the screenshot on how would it look at the end.

Windows Terminal

Step 1: Install Windows Terminal

We can install windows terminal from Microsoft store, once your windows version is 18362.0 or higher. Once you get it, you can install it on your own PC.

Step 2: Install Git for Windows

In order to set up power-line in windows terminal, you need to have Git installed. You can download it from here, and follow the installation instructions.

Step 3: PowerShell pre-requisites

Open PowerShell on your windows machine and run the following commands.

Install-Module posh-git -Scope CurrentUser
Install-Module oh-my-posh -Scope CurrentUser

Powerline uses glyphs in order to style the prompt. If your font does not include Powerline glyphs, you may see several Unicode replacement characters ‘▯’ throughout your prompt. To avoid this, install Cascadia Code PL font to your machine, from the github release page.

Step 4: Customize PowerShell Prompt

Use the following commands in the PowerShell to enable theme.

Import-Module posh-git
Import-Module oh-my-posh
Set-Theme Paradox

Step 5: Adding this to Windows Terminal

Windows Terminal is an integrated terminal, which can be used to run PowerShell, windows command prompt, Git Terminal, WSL Ubuntu, Azure Cloud shell etc. from the same application.

Open Windows Terminal and press Ctrl+, to open settings.json and add these lines to the PowerShell profile in the json file.

{
    // Make changes here to the powershell.exe profile.
    "guid": "{61c54bbd-c2c6-5271-96e7-009a87ff44bf}",
    "name": "Windows PowerShell",
    "commandline": "powershell.exe",
    "fontFace": "Cascadia Code PL",
    "hidden": false
},

Tadaaa! Your PowerShell is now ready with powerline and git integrated. To make this available on other terminals, place the json in default profile of settings.json

How about Ubuntu?

No worries, I have got you covered. There are several ways to add power line to Ubuntu shell. Here we discuss one of them using Go Module.

Run the following commands in your Ubuntu Terminal(Works for WSL as well).

sudo apt install golang-go
go get -u github.com/justjanne/powerline-go

Now open your ~/.bashrc files and copy the following lines of code at the end.

GOPATH=$HOME/go
function _update_ps1() {
    PS1="$($GOPATH/bin/powerline-go -error $?)"
}
if [ "$TERM" != "linux" ] && [ -f "$GOPATH/bin/powerline-go" ]; then
    PROMPT_COMMAND="_update_ps1; $PROMPT_COMMAND"
fi

Now update your terminal by running the following command.

source ~/.bashrc

That’s it. You have got the powerline added to your Ubuntu shell too. Make development more fun. We will see more in our upcoming blogs. Until then, stay safe. Cheers ✌

Leave a comment

Design a site like this with WordPress.com
Get started