-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMicrosoft.PowerShell_profile.ps1
More file actions
82 lines (75 loc) · 2.77 KB
/
Microsoft.PowerShell_profile.ps1
File metadata and controls
82 lines (75 loc) · 2.77 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
71
72
73
74
75
76
77
78
79
80
81
82
# ============================================================
# Neon PowerShell Profile — for WezTerm
# With auto-detection for starship (prompt) and zoxide (navigation)
# Repo: https://github.com/Muminur/tmux-alternative-windows
# ============================================================
# PSStyle configuration for PS7+
if ($PSVersionTable.PSVersion.Major -ge 7) {
$PSStyle.Formatting.TableHeader = "`e[96m"
$PSStyle.Formatting.ErrorAccent = "`e[91m"
$PSStyle.Formatting.Warning = "`e[93m"
$PSStyle.Formatting.Verbose = "`e[95m"
$PSStyle.Formatting.Debug = "`e[94m"
$PSStyle.Progress.Style = "`e[96m"
$PSStyle.FileInfo.Directory = "`e[94;1m"
$PSStyle.FileInfo.SymbolicLink = "`e[96m"
$PSStyle.FileInfo.Executable = "`e[92m"
}
# PSReadLine configuration
if (Get-Module -ListAvailable PSReadLine) {
Set-PSReadLineOption -Colors @{
Command = "`e[96m"
Parameter = "`e[95m"
String = "`e[92m"
Operator = "`e[93m"
Variable = "`e[97m"
Number = "`e[93m"
Member = "`e[96m"
Keyword = "`e[94m"
Comment = "`e[90m"
Type = "`e[95m"
Error = "`e[91m"
InlinePrediction = "`e[90m"
}
# Smarter predictions: history + plugin (PS7+), fallback to History only
if ($PSVersionTable.PSVersion.Major -ge 7) {
Set-PSReadLineOption -PredictionSource HistoryAndPlugin
} else {
Set-PSReadLineOption -PredictionSource History
}
Set-PSReadLineOption -EditMode Windows
# Dropdown menu completion (Tab shows selectable list instead of cycling)
Set-PSReadLineKeyHandler -Key Tab -Function MenuComplete
}
# Prompt configuration: starship if available, otherwise custom neon
if (Get-Command starship -ErrorAction SilentlyContinue) {
Invoke-Expression (&starship init powershell)
} else {
function prompt {
$loc = $ExecutionContext.SessionState.Path.CurrentLocation
$cyan = "`e[96m"; $green = "`e[92m"; $reset = "`e[0m"; $bold = "`e[1m"
$yellow = "`e[93m"
$branch = ''
try {
$b = git rev-parse --abbrev-ref HEAD 2>$null
if ($b -and $b -ne 'HEAD') { $branch = " ${yellow}($b)${reset}" }
} catch {}
"${bold}${cyan}PS${reset} ${green}${loc}${reset}${branch}${cyan}>${reset} "
}
}
# Aliases
Set-Alias ll Get-ChildItem
Set-Alias g git
# Navigation shortcuts
function _cd_up1 { Set-Location .. }
function _cd_up2 { Set-Location ../.. }
function _la { Get-ChildItem -Force @args }
function _gs { git status @args }
Set-Alias .. _cd_up1
Set-Alias ... _cd_up2
Set-Alias la _la
Set-Alias gs _gs
# Zoxide initialization (if available)
if (Get-Command zoxide -ErrorAction SilentlyContinue) {
Invoke-Expression (& { (zoxide init powershell | Out-String) })
}