-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMicrosoft.PowerShell_profile.ps1
More file actions
69 lines (52 loc) · 1.86 KB
/
Microsoft.PowerShell_profile.ps1
File metadata and controls
69 lines (52 loc) · 1.86 KB
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
set-location C:\Dev
$Host.UI.RawUI.WindowTitle = 'Shawns Powershell'
. (Resolve-Path ~/Documents/WindowsPowershell/gitutils.ps1)
# Aliases
# Up directory alias. Usage, uX = go up X directories, uuu = go up 3 directories
for($i = 1; $i -le 5; $i++){
$u = "".PadLeft($i,"u")
$unum = "u$i"
$d = $u.Replace("u","../")
Invoke-Expression "function $u { push-location $d }"
Invoke-Expression "function $unum { push-location $d }"
}
new-item alias:ll -value dir
function prompt {
$path = ""
$pathbits = ([string]$pwd).split("\", [System.StringSplitOptions]::RemoveEmptyEntries)
if($pathbits.length -eq 1) {
$path = $pathbits[0] + "\"
} else {
$path = $pathbits[$pathbits.length - 1]
}
$host.UI.RawUi.WindowTitle = $path
Write-Host($PWD.path) -nonewline -foregroundcolor Green
if (isCurrentDirectoryGitRepository) {
$status = gitStatus
$currentBranch = $status["branch"]
Write-Host(' [') -nonewline -foregroundcolor Yellow
if ($status["ahead"] -eq $FALSE) {
# We are not ahead of origin
Write-Host($currentBranch) -nonewline -foregroundcolor Cyan
} else {
# We are ahead of origin
Write-Host($currentBranch) -nonewline -foregroundcolor Red
}
if ($status["added"] -gt 0) {
Write-Host('+') -nonewline -foregroundcolor Yellow
}
if ($status["modified"] -gt 0) {
Write-Host('~') -nonewline -foregroundcolor Yellow
}
if ($status["deleted"] -gt 0) {
Write-Host('-') -nonewline -foregroundcolor Yellow
}
if ($status["untracked"] -ne $FALSE) {
Write-Host('!') -nonewline -foregroundcolor Yellow
}
Write-Host(']') -nonewline -foregroundcolor Yellow
}
Write-Host('>') -nonewline -foregroundcolor Green
return " "
}
Clear-Host