Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save nicholasjackson827/d049de3b4218f90c0b29bbb8fa124cf5 to your computer and use it in GitHub Desktop.
Save nicholasjackson827/d049de3b4218f90c0b29bbb8fa124cf5 to your computer and use it in GitHub Desktop.
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