Skip to content

Instantly share code, notes, and snippets.

@bangonkali
Created March 30, 2022 04:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bangonkali/06d4ccab65601f1a9d822012d4e98498 to your computer and use it in GitHub Desktop.
Save bangonkali/06d4ccab65601f1a9d822012d4e98498 to your computer and use it in GitHub Desktop.
Bangon Kali's Favorite PowerShell Configuration

Bangon Kali's PowerShell Configuration

Install desired PowerShell Version

Configure PowerShell

Apply configuration on each Powershell version. Use command mklink /h target/Profile.ps1 source/Profile.ps1 to create a symlink so that you only need to edit 1 Profile.ps1 file.

  1. Install oh-my-posh using winget.

  2. Install psreadline.

  3. Intall fnm.

  4. Each PowerShell Version has its own Profile path given by $PSHOME\Profile.ps1. Preferred Configuration:

    oh-my-posh --init --shell pwsh --config ~\AppData\Local\Programs\oh-my-posh\themes\zash.omp.json | Invoke-Expression
    Set-PSReadLineOption -HistorySearchCursorMovesToEnd
    Set-PSReadLineOption -PredictionSource History
    Set-PSReadlineKeyHandler -Key UpArrow -Function HistorySearchBackward
    Set-PSReadlineKeyHandler -Key DownArrow -Function HistorySearchForward
    fnm env --use-on-cd | Out-String | Invoke-Expression
    fnm use 16.14.2

More:

https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_profiles#the-profile-files

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment