-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPowerShell.ps1
More file actions
70 lines (55 loc) · 1.91 KB
/
PowerShell.ps1
File metadata and controls
70 lines (55 loc) · 1.91 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
70
Push-Location $ProfileDir
Import-Module posh-git
Import-Module Terminal-Icons
function Write-VcsPrompt {
$git = Get-GitStatus -WarningAction SilentlyContinue
if ($null -ne $git) {
$text = " $($git.Branch)"
if ($git.HasWorking) {
$text = $text + " +"
}
if ($git.HasUntracked) {
$text = $text + " !"
}
New-PromptText "$text " -BackgroundColor Yellow -ForegroundColor Black
}
}
$global:prompt = @(
{ "`n" }
{ " $(Get-ShortenedPath -SingleCharacterSegment) " }
{ "`t" } # right align
{ Write-VcsPrompt }
{ " $(Get-Date -f "T") " }
{ "`n" }
{ New-PromptText $([char]0x00BB) -BackgroundColor Black -ForegroundColor Cyan }
)
Set-PowerLinePrompt -Colors "#00DDFF", "#0066FF" -RestoreVirtualTerminal:$false -SetCurrentDirectory -PowerLineFont -Title {
-join @(if (Test-Elevation) { "Administrator: " }
Get-ShortenedPath -SingleCharacterSegment)
}
. ./lib/utils.ps1
. ./lib/aliases.ps1
if ($IsWindows) {
. ./lib/windows.ps1
}
elseif ($IsMacOS) {
. ./lib/mac.ps1
}
Invoke-Expression (& {
$hook = if ($PSVersionTable.PSVersion.Major -lt 6) { 'prompt' } else { 'pwd' }
(zoxide init --hook $hook powershell --cmd j) -join "`n"
})
# Bring in env-specific functionality (i.e. work-specific dev stuff, etc.)
If (Test-Path ./EnvSpecificProfile.ps1) { . ./EnvSpecificProfile.ps1 }
Update-TypeData ./TypeData/System.Type.ps1xml
# Update-FormatData -PrependPath ./Formats.ps1xml
Pop-Location
if ($null -ne (Get-Module PSReadLine -ListAvailable)) {
Import-Module PSReadLine
Set-PSReadlineOption -EditMode Emacs
Set-PSReadlineOption -BellStyle None
Set-PSReadLineOption -HistorySearchCursorMovesToEnd
Set-PSReadLineOption -PredictionSource History
Set-PSReadlineKeyHandler -Key UpArrow -Function HistorySearchBackward
Set-PSReadlineKeyHandler -Key DownArrow -Function HistorySearchForward
}