/
profile.ps1
40 lines (30 loc) · 1.22 KB
/
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
29
30
31
32
33
34
35
36
37
38
39
40
set-alias vi "C:\Program Files (x86)\Vim\vim74\vim.exe"
set-alias vim "C:\Program Files (x86)\Vim\vim74\vim.exe"
Set-Location -Path $env:SystemDrive\
Clear-Host
$Error.Clear()
Import-Module -Name posh-git -ErrorAction SilentlyContinue
if (-not($Error[0])) {
$DefaultTitle = $Host.UI.RawUI.WindowTitle
$GitPromptSettings.BeforeText = '('
$GitPromptSettings.BeforeForegroundColor = [ConsoleColor]::Cyan
$GitPromptSettings.AfterText = ')'
$GitPromptSettings.AfterForegroundColor = [ConsoleColor]::Cyan
function prompt {
if (-not(Get-GitDirectory)) {
$Host.UI.RawUI.WindowTitle = $DefaultTitle
"PS $($executionContext.SessionState.Path.CurrentLocation)$('>' * ($nestedPromptLevel + 1)) "
}
else {
$realLASTEXITCODE = $LASTEXITCODE
Write-Host 'PS ' -ForegroundColor Green -NoNewline
Write-Host "$($executionContext.SessionState.Path.CurrentLocation) " -ForegroundColor Yellow -NoNewline
Write-VcsStatus
$LASTEXITCODE = $realLASTEXITCODE
return "`n$('$' * ($nestedPromptLevel + 1)) "
}
}
}
else {
Write-Warning -Message 'Unable to load the Posh-Git PowerShell Module'
}