~fhusson

My Windows and Linux Shell setup

Install Hack Nerd Font

On Windows

Download from the official nerd fonts website

  • Hack Nerd Font v2.1.0
  • Unzip the file
  • In an explorer select all the ttf files, right click and select install

(https://richardspowershellblog.wordpress.com/2008/03/20/special-folders/)

$FontUrl = "https://github.com/ryanoasis/nerd-fonts/releases/download/v2.1.0/Hack.zip"
$TempFile = "$env:TEMP\Hack.zip"
$TempFontFolder = "$env:TEMP\Nerd-Fonts-Hack"

curl -o $TempFile $FontUrl
Expand-Archive -Path $TempFile -DestinationPath $TempFontFolder
$FontComObject = (New-Object -ComObject Shell.Application).Namespace(0x14)
Get-ChildItem -Path $TempFontFolder -Include '*.ttf','*.ttc','*.otf' -Recurse | ForEach {
    If (-not(Test-Path "C:\Windows\Fonts\$($_.Name)")) {
        $FontComObject.CopyHere($_.FullName, 0x10)
    }
}

On Ubuntu

Download the Nerd Font zip Unzip and copy to ~/.local/share/fonts

Run the command fc-cache -f -v to manually rebuild the font cache. Check they are installed correctly by running fc-list

sudo apt install unzip wget
wget https://github.com/ryanoasis/nerd-fonts/releases/download/v2.1.0/Hack.zip
mkdir -p ~/.local/share/fonts
unzip Hack.zip -d ~/.local/share/fonts
rm Hack.zip
fc-cache -f -v

On Alpine Linux

sudo apk add nerd-fonts

Setup Visual Studio Code

Go to Settings and change terminal.integrated.fontFamily value to Hack Nerd Font

Windows - PowerShell 7 - Oh My Posh

Install PowerShell 7

Install a pretty prompt.

Install-Module posh-git -Scope CurrentUser
Install-Module oh-my-posh -Scope CurrentUser
Install-Module -Name PSReadLine -Scope CurrentUser -Force -SkipPublisherCheck -AllowPrerelease

Then run “notepad $PROFILE” and add these lines to the end:

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

Source a blog post from Scott Hanselman

Linux (Ubuntu) - ZSH - Oh My Zsh

Install ZSH.

sudo apt install zsh

Install Oh My Zsh.

sudo apt install git-core curl fonts-powerline
sh -c "$(curl -fsSL https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"

Install powerlevel9k theme.

git clone https://github.com/bhilburn/powerlevel9k.git ~/.oh-my-zsh/custom/themes/powerlevel9k

Edit .zshrc and set the theme.

ZSH_THEME="powerlevel9k/powerlevel9k"

Setup default WSL Terminal

Deprecated :-) use the new “Microsoft Windows Terminal” instead.

Click on the top right icon, then click Properties, change the font to Hack Nerd Font Mono and background colors to (12, 12, 12)

Microsoft Windows Terminal

Install the Windows Terminal from the Microsoft Store, the source can be found on the Github microsoft /terminal

  • go to Settings in the profile you want
  • add "fontFace": "Hack Nerd Font"
  • add "fontSize": 10
  • add "colorScheme": "VS Code - Default Dark+"
  • add schemes section (Manual with info from this blog))
  • set "startingDirectory": "//wsl$/Ubuntu/home/fhusson" on the Ubuntu profile.
  // Add custom color schemes to this array
  "schemes": [
    {
      "name": "VS Code - Default Dark+",
      "background": "#1e1e1e", // was editor.background
      "foreground": "#cccccc",
      "black": "#000000",
      "blue": "#2472c8",
      "brightBlack": "#666666",
      "brightBlue": "#3b8eea",
      "brightCyan": "#29b8db",
      "brightGreen": "#23d18b",
      "brightPurple": "#d670d6", // was BrightMagenta
      "brightRed": "#f14c4c",
      "brightWhite": "#e5e5e5",
      "brightYellow": "#f5f543",
      "cyan": "#11a8cd",
      "green": "#0dbc79",
      "purple": "#bc3fbc", // was Magenta
      "red": "#cd3131",
      "white": "#e5e5e5",
      "yellow": "#e5e510",
      "selectionBackground": "#ffffff"
    }
  ],

Full settings.json file :

// To view the default settings, hold "alt" while clicking on the "Settings" button.
// For documentation on these settings, see: https://aka.ms/terminal-documentation
{
    "$schema": "https://aka.ms/terminal-profiles-schema",
    "defaultProfile": "{2c4de342-38b7-51cf-b940-2309a097f518}",
    "profiles":
    [
        {
            // Make changes here to the powershell.exe profile
            "guid": "{61c54bbd-c2c6-5271-96e7-009a87ff44bf}",
            "name": "Windows PowerShell",
            "commandline": "powershell.exe",
            "hidden": false,
            "fontFace":  "Hack Nerd Font"
        },
        {
            // Make changes here to the cmd.exe profile
            "guid": "{0caa0dad-35be-5f56-a8ff-afceeeaa6101}",
            "name": "cmd",
            "commandline": "cmd.exe",
            "hidden": false
        },
        {
            "guid": "{b453ae62-4e3d-5e58-b989-0a998ec441b8}",
            "hidden": false,
            "name": "Azure Cloud Shell",
            "source": "Windows.Terminal.Azure"
        },
        {
            "guid": "{574e775e-4f2a-5b96-ac1e-a2962a402336}",
            "hidden": false,
            "name": "PowerShell Core",
            "source": "Windows.Terminal.PowershellCore",
            "fontFace":  "Hack Nerd Font",
            "fontSize": 10
        },
        {
            "guid": "{2c4de342-38b7-51cf-b940-2309a097f518}",
            "hidden": false,
            "name": "Ubuntu",
            "source": "Windows.Terminal.Wsl",
            "fontFace":  "Hack Nerd Font",
            "colorScheme": "VS Code - Default Dark+",
            "fontSize": 10,
            "startingDirectory": "//wsl$/Ubuntu/home/fhusson"
        }
    ],

    // Add custom color schemes to this array
    "schemes": [
        {
            "name": "VS Code - Default Dark+",
            "background": "#1e1e1e", // was editor.background!
            "foreground": "#cccccc",
            "black": "#000000",
            "blue": "#2472c8",
            "brightBlack": "#666666",
            "brightBlue": "#3b8eea",
            "brightCyan": "#29b8db",
            "brightGreen": "#23d18b",
            "brightPurple": "#d670d6",
            "brightRed": "#f14c4c",
            "brightWhite": "#e5e5e5",
            "brightYellow": "#f5f543",
            "cyan": "#11a8cd",
            "green": "#0dbc79",
            "purple": "#bc3fbc",
            "red": "#cd3131",
            "white": "#e5e5e5",
            "yellow": "#e5e510",
            "selectionBackground": "#ffffff"
        }
    ],

    // Add any keybinding overrides to this array.
    // To unbind a default keybinding, set the command to "unbound"
    "keybindings": []
}
Discuss on Twitter