Last active
August 29, 2015 14:25
-
-
Save joonro/e6c54c033069a0ecb67a to your computer and use it in GitHub Desktop.
This file contains 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
Import-Module posh-git | |
# customize git prompt display settings | |
$global:GitPromptSettings.BeforeText = '[' | |
$global:GitPromptSettings.AfterText = '] ' | |
$global:GitPromptSettings.BranchAheadForegroundColor = [ConsoleColor]::Green | |
$global:GitPromptSettings.WorkingForegroundColor = [ConsoleColor]::Magenta | |
$global:GitPromptSettings.UntrackedForegroundColor = [ConsoleColor]::DarkGray | |
Enable-GitColors |
This file contains 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
function prompt { | |
$realLASTEXITCODE = $LASTEXITCODE | |
Write-Host | |
# Reset color, which can be messed up by Enable-GitColors | |
$Host.UI.RawUI.ForegroundColor = $GitPromptSettings.DefaultForegroundColor | |
if (Test-Administrator) { # Use different username if elevated | |
Write-Host "(Elevated) " -NoNewline -ForegroundColor White | |
} | |
Write-Host "$ENV:USERNAME@" -NoNewline -ForegroundColor DarkYellow | |
Write-Host "$ENV:COMPUTERNAME" -NoNewline -ForegroundColor Magenta | |
if ($s -ne $null) { # color for PSSessions | |
Write-Host " (`$s: " -NoNewline -ForegroundColor DarkGray | |
Write-Host "$($s.Name)" -NoNewline -ForegroundColor Yellow | |
Write-Host ") " -NoNewline -ForegroundColor DarkGray | |
} | |
Write-Host " : " -NoNewline -ForegroundColor DarkGray | |
Write-Host $($(Get-Location) -replace "C:\\Users\\Joon", "~") -NoNewline -ForegroundColor Blue | |
Write-Host " : " -NoNewline -ForegroundColor DarkGray | |
Write-Host (Get-Date -Format G) -NoNewline -ForegroundColor DarkMagenta | |
Write-Host " : " -NoNewline -ForegroundColor DarkGray | |
$global:LASTEXITCODE = $realLASTEXITCODE | |
Write-VcsStatus | |
Write-Host "" | |
return "> " | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment