Skip to content

Instantly share code, notes, and snippets.

@saman-taghavi
Created January 13, 2022 17:57
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 saman-taghavi/b4a0fc25b21c68e19c95bacc41bf0bf7 to your computer and use it in GitHub Desktop.
Save saman-taghavi/b4a0fc25b21c68e19c95bacc41bf0bf7 to your computer and use it in GitHub Desktop.
Well this is how i set up my powershell profile for ohmypwsh and auto complete for powershell 7
Set-Item -Path Function:prompt -Value $Prompt -Force
# get all themes
$themes = Get-ChildItem -Path "~\AppData\Local\Programs\oh-my-posh\themes\*" -Include '*.omp.json' | Sort-Object Name
# get a rendom theme
$theme = Get-Random -InputObject $themes.Name
# initiate ohmyposh
oh-my-posh --init --shell pwsh --config ~/AppData/Local/Programs/oh-my-posh/themes/$theme | Invoke-Expression
# these are for auto complete of commands previously used
Import-Module PSReadLine
Set-PSReadLineOption -PredictionSource History
Set-PSReadLineOption -PredictionViewStyle ListView
Set-PSReadLineOption -EditMode Windows
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment