Instantly share code, notes, and snippets.

Embed
What would you like to do?
My Sample PowerShell Profile
Import-Module posh-git
[Console]::OutputEncoding = [System.Text.Encoding]::GetEncoding(850)
function prompt {
# Get the current path, but format it a bit differently
$CurrentPath = (pwd).Path
$ShortPath = $CurrentPath.Replace($HOME, '~').Replace("\", "/")
$ShortPath = $ShortPath -Replace '^[^:]+::', ''
# Write out a blank space a neat character first
# and an open curly brace (in blue)
Write-Host ''
Write-Host "$([char]0x0A7) {" -n -f Blue
# Write out the ShortPath we made
Write-Host $ShortPath -n -f Blue
# Close the curly brace and add new line
Write-Host '}' -n -f Blue
# Write the Git status
Write-Host $(Write-VcsStatus)
# Write out a double arrow as the prompt
return "$([char]0xbb) "
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment