-
Notifications
You must be signed in to change notification settings - Fork 0
/
Microsoft.PowerShell_profile.ps1
28 lines (21 loc) · 1.13 KB
/
Microsoft.PowerShell_profile.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
function prompt {
$host.ui.RawUI.WindowTitle = "$pwd"
$Date = Get-Date -Format 'hh:mm:ss tt'
# Test for Admin / Elevated
$IsAdmin = (New-Object Security.Principal.WindowsPrincipal ([Security.Principal.WindowsIdentity]::GetCurrent())).IsInRole([Security.Principal.WindowsBuiltinRole]::Administrator)
$GitPromptSettings.WindowTitle = $null
#Decorate the CMD Prompt
Write-Host ""
Write-Host ($(if ($IsAdmin) { 'Elevated ' } else { '' })) -BackgroundColor DarkRed -ForegroundColor White -NoNewline
Write-Host " $env:USERNAME@$env:COMPUTERNAME " -BackgroundColor DarkBlue -ForegroundColor White -NoNewline
Write-Host " $pwd " -ForegroundColor White -BackgroundColor DarkGreen -NoNewline
Write-Host " [$date] " -ForegroundColor White
return "$(Write-VcsStatus) => "
}
Set-PSReadLineKeyHandler -Key Tab -Function MenuComplete
Set-PSReadLineKeyHandler -Key UpArrow -Function HistorySearchBackward
Set-PSReadLineKeyHandler -Key DownArrow -Function HistorySearchForward
Set-PSReadLineOption -PredictionSource History
Write-Host 'importing posh-git' -ForegroundColor Yellow
Import-Module posh-git
Write-Host