Skip to content

Commit 1177d62

Browse files
committed
updates
1 parent c16c510 commit 1177d62

File tree

4 files changed

+3028
-40
lines changed

4 files changed

+3028
-40
lines changed

Microsoft.PowerShell_profile.ps1

Lines changed: 39 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,14 @@
11

2+
if (!(Get-Command Test-Elevated -ea SilentlyContinue))
3+
{
4+
Write-Host "*** Ensure $PSScriptRoot\Modules\Scripts is in your system env PATH" -ForegroundColor Red
5+
Write-Host "*** temporarily setting path" -ForegroundColor DarkGray
6+
$env:PATH += "$PSScriptRoot\Modules\Scripts"
7+
}
8+
29
$env:PSElevated = Test-Elevated
310

4-
# override the prompt function
11+
# override the prompt function; this is the default prompt before using OhMyPosh
512
function prompt {
613
$saveCode = $LASTEXITCODE
714
if ($env:PSElevated -eq $true) {
@@ -16,27 +23,6 @@ function prompt {
1623
return "> "
1724
}
1825

19-
20-
# Aliases
21-
22-
New-Alias ep Edit-PSProfile
23-
New-Alias vs Set-VsDevEnv
24-
New-Alias push Push-Location
25-
New-Alias pop Pop-Location
26-
New-Alias rbh Remove-BrowserHijack
27-
28-
$0 = 'C:\Github\ClipboardViewer\bin\Debug\ClipboardViewer.exe'
29-
if (Test-Path $0)
30-
{
31-
function Start-ClipboardViewer
32-
{
33-
[CmdletBinding()]
34-
[Alias("cv")]
35-
param ($p1, $p2, $p3, $p4)
36-
& $0 $p1 $p2 $p3 $p4
37-
}
38-
}
39-
4026
function Push-PSRoot
4127
{
4228
[CmdletBinding()]
@@ -53,12 +39,6 @@ function Stop-Edge
5339
taskkill /f /im msedge.exe
5440
}
5541

56-
. $PSScriptRoot\Modules\Scripts\Set-OutDefaultOverride.ps1
57-
Set-Alias ls Get-ChildItemColorized -Force -Option AllScope
58-
59-
# curl.exe is installed as a choco package to \system32; ensure no alias
60-
Remove-Item alias:curl -ErrorAction SilentlyContinue
61-
6242
function Start-Wilma
6343
{
6444
[CmdletBinding()]
@@ -67,13 +47,38 @@ function Start-Wilma
6747
& 'C:\Tools\WiLMa\WinLayoutManager.exe'
6848
}
6949

70-
New-Alias hx Get-HistoryEx
71-
New-Alias Clear-History Clear-HistoryEx
50+
$0 = 'C:\Github\ClipboardViewer\bin\Debug\ClipboardViewer.exe'
51+
if (Test-Path $0)
52+
{
53+
function Start-ClipboardViewer
54+
{
55+
[CmdletBinding()]
56+
[Alias("cv")]
57+
param ($p1, $p2, $p3, $p4)
58+
& $0 $p1 $p2 $p3 $p4
59+
}
60+
}
61+
62+
# Command aliases...
63+
64+
. $PSScriptRoot\Modules\Scripts\Set-OutDefaultOverride.ps1
65+
Set-Alias ls Get-ChildItemColorized -Force -Option AllScope
66+
67+
New-Alias Clear-History Clear-HistoryEx -ea SilentlyContinue
68+
New-Alias ep Edit-PSProfile -ea SilentlyContinue
69+
New-Alias hx Get-HistoryEx -ea SilentlyContinue
70+
New-Alias pop Pop-Location -ea SilentlyContinue
71+
New-Alias push Push-Location -ea SilentlyContinue
72+
New-Alias rbh Remove-BrowserHijack -ea SilentlyContinue
73+
New-Alias vs Set-VsDevEnv -ea SilentlyContinue
7274

7375
# Docker helpers
74-
New-Alias doc Remove-DockerTrash
75-
New-Alias dos Show-Docker
76-
New-Alias dow Start-DockerForWindows
76+
New-Alias doc Remove-DockerTrash -ea SilentlyContinue
77+
New-Alias dos Show-Docker -ea SilentlyContinue
78+
New-Alias dow Start-DockerForWindows -ea SilentlyContinue
79+
80+
# curl.exe is installed as a choco package to \system32; ensure no alias
81+
Remove-Item alias:curl -ErrorAction SilentlyContinue
7782

7883
# OK, Go!
7984

@@ -98,9 +103,7 @@ $cmd = (Get-CimInstance win32_process -filter ("ProcessID={0}" -f `
98103

99104
if ($cmd -notmatch 'cmd\.exe')
100105
{
101-
if (Test-Path 'D:\scp') { Set-Location 'D:\scp'; }
102-
elseif (Test-Path 'D:\Github') { Set-Location 'D:\Github'; }
103-
elseif (Test-Path 'C:\Github') { Set-Location 'C:\Github'; }
106+
if (Test-Path 'C:\Github') { Set-Location 'C:\Github'; }
104107
elseif (Test-Path 'C:\Code') { Set-Location 'C:\Code'; }
105108
elseif (Test-Path 'C:\River') { Set-Location 'C:\River'; }
106109
else { Set-Location '\'; }

0 commit comments

Comments
 (0)