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).

Install Windows Terminal §

This step is no longer necessary since Windows Terminal is now included with Windows 11 by default.

  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
  3. Add posh-git to profile:

    notepad $profile
    # Then add:
    Import-Module posh-git

You can run the command Add-PoshGitToProfile to perform the above step, but you need to restart the shell for it to be available, and in my experience it seems to overwrite the profile which is not ideal. So I prefer to add the import manually.

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