Skip to content

Instantly share code, notes, and snippets.

@jeroenheijmans
Created April 3, 2017 08:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jeroenheijmans/0a45fbf283286629f582b382aa7da492 to your computer and use it in GitHub Desktop.
Save jeroenheijmans/0a45fbf283286629f582b382aa7da492 to your computer and use it in GitHub Desktop.
Powershell prompts
# Normal, colored prompt:
#function Prompt
#{
# $promptString = "PS " + $(Get-Location) + ">"
# Write-Host $promptString -NoNewline -ForegroundColor Yellow
# return " "
#}
# Posh-Git prompt
function prompt {
$origLastExitCode = $LASTEXITCODE
Write-VcsStatus
$curPath = $ExecutionContext.SessionState.Path.CurrentLocation.Path
Write-Host "$curPath>" -NoNewline -ForegroundColor White
$LASTEXITCODE = $origLastExitCode
"$(' ' * ($nestedPromptLevel + 1)) "
}
Import-Module posh-git
$global:GitPromptSettings.BeforeText = '['
$global:GitPromptSettings.AfterText = '] '
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment