Last active
August 26, 2020 08:13
-
-
Save neur0manc/e2d96f75c86a013dc29f5ad77c855997 to your computer and use it in GitHub Desktop.
PowerShell config
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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