Spice up your Windows CLI experience

· wordCount · 3 minute read

The terminal experience in windows is not great, but it can be made better. We’ll learn how to

before_preview
turn this
after_preview
into this

Oh My Posh Theme: custom | Windows Terminal (in focus mode) Theme: Gruvbox Dark

Font: CaskaydiaCove NF

Nerd Fonts

Nerd Fonts provides patched versions of monospace fonts containing a large number of glyphs (icons). The glyphs will be needed to correctly render the prompts from oh-my-posh. Head over to nerd fonts to download a font of your choosing. Unzip the file, and install all the fonts with “Mono Windows Compatible” in their name.

Oh My Posh

Oh my posh is a shell agnostic prompt theme engine. In other words, a single theme configuration can be applied to multiple shells. We’ll be using it for powershell.

Why use an oh-my-posh prompt? Aside from improved aesthetics, it includes various segments for displaying information such as the current git branch, environment versions, and much more.

Installation

We’ll follow the official instructions. Open a powershell instance use the following cmd to install the oh-my-posh module:

Install-Module oh-my-posh -Scope CurrentUser

Head over to the themes section for a web-preview of pre-configured themes. After choosing a theme, oh-my-posh prompt can be activated using:

Set-PoshPrompt -Theme <theme_name>
# Example:
Set-PoshPrompt -Theme sorin

This is not a permanent change, and the prompt will revert to the default prompt when powershell is launched again. To resolve this, the above cmd must be added to the powershell profile. This can be done as follows:

# The following will overwrite the profile
echo "Set-PoshPrompt -Theme sorin" > $PROFILE
# The following will append to the profile
echo "Set-PoshPrompt -Theme sorin" >> $PROFILE

Windows Terminal

Windows Terminal is a new, modern, feature-rich, productive terminal application for command-line users. It includes many of the features most frequently requested by the Windows command-line community including support for tabs, rich text, globalization, configurability, theming & styling, and more.

Installation

We can install windows terminal using chocolatey using:

choco install microsoft-windows-terminal

Configuration

The configuration file for windows terminal can be accessed as:

notepad "$HOME\AppData\Local\Packages\Microsoft.WindowsTerminal_8wekyb3d8bbwe\LocalState\settings.json"

Configure windows terminal theme and font:

// Add under "profiles" key
"defaults": {
    "colorScheme": "Gruvbox Dark", // terminal colorscheme
    "font": {
        "face": "CaskaydiaCove NF" // terminal font
                                   // (replace with name of downloaded nerd font)
    },
},

P.S. remove the comments after copying.

// Add inside "schemes" array
{
    "background": "#14171C",
    "black": "#14171C",
    "blue": "#377375",
    "brightBlack": "#7F7061",
    "brightBlue": "#719586",
    "brightCyan": "#7DB669",
    "brightGreen": "#AAB01E",
    "brightPurple": "#C77089",
    "brightRed": "#F73028",
    "brightWhite": "#E6D4A3",
    "brightYellow": "#F7B125",
    "cursorColor": "#FFFFFF",
    "cyan": "#578E57",
    "foreground": "#E6D4A3",
    "green": "#868715",
    "name": "Gruvbox Dark",
    "purple": "#A04B73",
    "red": "#BE0F17",
    "selectionBackground": "#FFFFFF",
    "white": "#978771",
    "yellow": "#CC881A"
},

Winfetch

Winfetch is a CLI utility that displays information about your operating system, software, and hardware in an aesthetic and visually pleasing way.

Installation

We can install winfetch using chocolatey using:

choco install winfetch

Usage

Run winfetch using:

winfetch.bat

Configuration

Custom configuration settings can be found here. For a custom logo, uncomment the image line and provide the path for said image. Note: Imagemagick is needed to render a custom logo.