Skip to content

Instantly share code, notes, and snippets.

@amigus
Last active November 21, 2023 06:32
Show Gist options
  • Select an option

  • Save amigus/26cfb6cc8578ef783668c0b9346bd26c to your computer and use it in GitHub Desktop.

Select an option

Save amigus/26cfb6cc8578ef783668c0b9346bd26c to your computer and use it in GitHub Desktop.
My PowerShell Profile
<# My $PROFILE; https://gist.github.com/amigus/26cfb6cc8578ef783668c0b9346bd26c #>
$ConfigDirectory = Get-Item $PROFILE | Select-Object -ExpandProperty DirectoryName
#region $env:Path
<#
The PSPaths.ps1 file is a list of expressions that evaluate to folder names e.g.
$env:USERPROFILE + '\.local\bin'
#>
foreach ($DirectoryExpression in Get-Content "${ConfigDirectory}\PSPaths.ps1") {
$Directory = try {
Get-Item (Invoke-Expression $DirectoryExpression) -ErrorAction SilentlyContinue
} catch {
Get-Item $DirectoryExpression -ErrorAction SilentlyContinue
}
if ($Directory -notin $env:Path.Split([IO.Path]::PathSeparator)) {
$env:Path += [IO.Path]::PathSeparator + $Directory
}
}
#endregion
Set-PSReadLineOption -EditMode Windows -PredictionSource History -HistoryNoDuplicates
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment