Post

Setting up Powershell profile in Windows Terminal

The below steps will walk you through setting up your windows terminal with the latest powershell, oh-my-posh, and psreadline.

  1. Install the latest version of powershell from Microsoft
  2. Set your windows terminal default powershell to the latest that was just installed.
  3. Use winget to install oh-my-posh.
    1
    
     winget install JanDeDobbeleer.OhMyPosh -s winget
    
  4. Install fonts using oh-my-posh.
    1
    
     oh-my-posh font install
    
  5. After fonts are installed change your windows terminal font defaults to MesloLGM NF. This will allow the themes to render correctly in your terminal.
  6. Install PSReadLine powershell module using an elevated powershell session.
    1
    
     Install-Module -Name PSReadLine -AllowPrerelease -Scope CurrentUser -Force -SkipPublisherCheck
    
  7. Modify your powershell profile.
    1
    
     nodepad $PROFILE
    

    If your prfoile does not exist create it with the below.

    1
    
     New-Item -Path $PROFILE -Type File -Force
    
    1
    2
    3
    4
    5
    6
    
     $ohmyposhTheme = "spaceship"
     oh-my-posh init pwsh --config "$env:POSH_THEMES_PATH\$ohmyposhTheme.omp.json" | Invoke-Expression
     Import-Module PSReadLine
     Set-PSReadLineOption -PredictionSource HistoryAndPlugin
     Set-PSReadLineOption -PredictionViewStyle ListView
     Set-PSReadLineOption -EditMode Windows
    

You can view oh-my-posh themes by running Get-PoshThemes. After you find a theme you like change $ohmyposhTheme = "spaceship" in your profile and save.

This post is licensed under CC BY 4.0 by the author.