Skip to content

Instantly share code, notes, and snippets.

@dongfg
Last active September 4, 2024 05:45
Show Gist options
  • Save dongfg/2808f8388660ef70d96a0618b25ab594 to your computer and use it in GitHub Desktop.
Save dongfg/2808f8388660ef70d96a0618b25ab594 to your computer and use it in GitHub Desktop.
[PowerShell Profile] Save file to $PROFILE
function Find-Command($cmdname) {
return [bool](Get-Command -Name $cmdname -ErrorAction SilentlyContinue)
}
# Alias
Set-Alias ll Get-ChildItem
# Git Alias
if (Find-Command git) {
function Get-GitStatus { git status }
Set-Alias gst Get-GitStatus
}
# Oh My Posh
# https://ohmyposh.dev/
if (Find-Command oh-my-posh) {
oh-my-posh init pwsh --config ~/Documents/PowerShell/themes/velvet.omp.json | Invoke-Expression
}
# Fast Node Manager
# https://github.com/Schniz/fnm
if (Find-Command fnm) {
$Env:NODE_DIST_MIRROR = "https://npmmirror.com/mirrors/node/"
fnm env --node-dist-mirror $Env:NODE_DIST_MIRROR --use-on-cd --shell power-shell | Out-String | Invoke-Expression
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment