smhk

Setting up PowerShell

These steps improve PowerShell by:

  • Adding tabs.
  • Changing the tab completion to be more bash like.
  • Displaying the current Git branch (if applicable).

Add tabs §

  1. Install Windows Terminal to get tabs (and better WSL integration).

Bash style tab completion §

  1. Create PowerShell profile:

    new-item $profile -itemtype file -force
    
  2. Open the profile:

    notepad $profile
    
  3. Paste this config which enables bash-like tab completion:

    Set-PSReadlineKeyHandler -Key Tab -Function MenuComplete
    
  4. Save.

  5. Restart PowerShell.

Display current Git branch §

  1. Install Scoop.

    Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser
    Invoke-RestMethod -Uri https://get.scoop.sh | Invoke-Expression
  2. Install posh-git via scoop.

    scoop bucket add extras
    scoop install posh-git
    # May need to restart shell
    Add-PoshGitToProfile

Install Python at specific version §

Doing scoop install python will default to the latest, but it has older versions available.

  1. Add the versions bucket:

    scoop bucket add versions
  2. Install the desired Python version:

    scoop install versions/python310

Install pipx §

  1. Install pipx and add to path:

    scoop install pipx
    pipx ensurepath

Install Poetry §

  1. Install Poetry via pipx:

    pipx install poetry