-
Notifications
You must be signed in to change notification settings - Fork 2
/
profile.example.ps1
39 lines (32 loc) · 1.24 KB
/
profile.example.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
Import-Module c:/Utilities/Scripts/posh-git/posh-git
# Set up a simple prompt, adding the git prompt parts inside git repos
function prompt {
$path = ""
$pathbits = ([string]$pwd).split("\", [System.StringSplitOptions]::RemoveEmptyEntries)
if($pathbits.length -eq 1) {
$path = $pathbits[0] + "\"
} else {
$path = $pathbits[$pathbits.length - 1]
}
$userLocation = $env:username + '@' + [System.Environment]::MachineName + ' ' + $path
$host.UI.RawUi.WindowTitle = $userLocation
Write-Host($userLocation) -nonewline -foregroundcolor Green
# Git Prompt
$Global:GitStatus = Get-GitStatus
Write-GitStatus $GitStatus
return "> "
}
if(-not (Test-Path Function:\DefaultTabExpansion)) {
Rename-Item Function:\TabExpansion DefaultTabExpansion
}
# Set up tab expansion and include git expansion
function TabExpansion($line, $lastWord) {
$lastBlock = [regex]::Split($line, '[|;]')[-1]
switch -regex ($lastBlock) {
# Execute git tab completion for all git-related commands
'git (.*)' { GitTabExpansion $lastBlock }
# Fall back on existing tab expansion
default { DefaultTabExpansion $line $lastWord }
}
}
Enable-GitColors