Skip to content

Instantly share code, notes, and snippets.

@neur0manc
Last active August 26, 2020 08:13
Show Gist options
  • Save neur0manc/e2d96f75c86a013dc29f5ad77c855997 to your computer and use it in GitHub Desktop.
Save neur0manc/e2d96f75c86a013dc29f5ad77c855997 to your computer and use it in GitHub Desktop.
PowerShell config
# My profile file (a github gist)
$profileUri = "https://git.io/fh9CA"
# Where to put the profile file
if ($IsWindows) {
$profilePath = "~\Documents\PowerShell\Profile.ps1"
}
else {
$profilePath = "~/.config/powershell/profile.ps1"
}
# Determine this systems hostname
if ($IsWindows) {
$hostname = $env:COMPUTERNAME.ToLower()
}
else {
$hostname = $env:HOSTNAME
}
# The command prompt for PowerShell
function prompt {
$p = Get-Location
Write-Host "$hostname (" -NoNewline -ForegroundColor DarkCyan
Write-Host "$p" -NoNewline -ForegroundColor DarkGray
Write-Host ") " -ForegroundColor DarkCyan
Write-Host ">" -NoNewLine -ForegroundColor Cyan
return " "
}
Set-Alias -Name g -Value git
# Update PowerShell config and reload on the fly
function Update-Config {
Invoke-WebRequest -Uri $profileUri -OutFile $profilePath
. $profilePath
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment