Terminal with colors and autosuggestions
  • Terminal
  • Fun

Creating the ultimate terminal setup for development

Why should you upgrade your terminal?

The basic terminal/shell for most operating systems is pretty dull. Why not update it like we do with our IDE, specialy since we use both quite a lot in the development process.

This article mainly focuses on windows but could be applied to all operating systems, be aware that the configuration might differ per OS.

Get PowerShell

Let's start off by getting the latest version of PowerShell. Windows by default comes with Windows PowerShell (which is almost the same as PS) but this version is likely to be outdated. To make sure we get the latest features you can download the most recent version from the PowerShell website.

Download & install NerdFont

To create a more unique feeling we need a custom font. Nerd Fonts has a great collection of commonly used fonts enhanced with glyphs/ligatures (this is required if you also want to install Oh My Posh). For this example I've chosen FiraCode Nerd Font.

To install a font on Windows press windows + R -> fonts. Then just drag and drop each font file in the folder.

Applying default settings

Now that we've downloaded our font and terminal we can start changing the default settings. The settings can be found under the down arrow in the navigation bar.

Default profile

Once the settings are open you can change your default profile to Powershell, should be the first option you'll see.

Windows Terminal startup settings

Font

The font can be changed under Profiles -> Defaults -> Appearance. If you want another color scheme you can change this as well.

Windows Terminal appearance settings

Adding Oh My Posh to the shell

Oh My Posh is a theme engine for any shell, in our case we will install it in PowerShell. Start by opening the terminal and enter the following command.

winget install JanDeDobbeleer.OhMyPosh

After the installation restart your terminal and try to run oh-my-posh.exe. It should show you a preview with the default settings.

Enable by default

Of course we want it to start automatically when we open PowerShell but to get that working we first need to create a PowerShell Profile. The default location of your profile file can be found at the path below. Make sure you replace [username] with your own username.

*If the file doesn't exist you can just create it.

C:/Users/[username]/Documents/PowerShell/Microsoft.PowerShell_profile.ps1

Once you've opened the profile you can enter the following line at the top. This will make Oh My Posh start everytime you create a new Powershell instance.

oh-my-posh --init --shell pwsh --config F:/oh_my_posh.json | Invoke-Expression

You might have noticed it also references to a config file. This file is a custom theme that you can setup. I will not go in detail on how it all works but if you're curious you can check the documentation.

The config i'm using in this post can be found in my Github Gists.