From 5e5431e80912a2a5e114fc47ac2e2d166717be83 Mon Sep 17 00:00:00 2001 From: Johannes Zitz Date: Sat, 10 Jan 2026 11:50:18 +0100 Subject: [PATCH 1/4] Enhance admin function to set current working directory for new terminal instances --- Microsoft.PowerShell_profile.ps1 | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Microsoft.PowerShell_profile.ps1 b/Microsoft.PowerShell_profile.ps1 index da4512b..b314de6 100644 --- a/Microsoft.PowerShell_profile.ps1 +++ b/Microsoft.PowerShell_profile.ps1 @@ -337,11 +337,12 @@ function winutildev { # System Utilities function admin { + $cwd = (Get-Location).ProviderPath if ($args.Count -gt 0) { $argList = $args -join ' ' - Start-Process wt -Verb runAs -ArgumentList "pwsh.exe -NoExit -Command $argList" + Start-Process wt -Verb runAs -ArgumentList @('-d', $cwd, 'pwsh.exe', '-NoExit', '-Command', $argList) } else { - Start-Process wt -Verb runAs + Start-Process wt -Verb runAs -ArgumentList @('-d', $cwd, 'pwsh.exe', '-NoExit') } } From 0910ad8c93ed17a95df0bb29abef9c6a521a021a Mon Sep 17 00:00:00 2001 From: Johannes Zitz Date: Sat, 10 Jan 2026 11:57:05 +0100 Subject: [PATCH 2/4] Fix final font family check --- setup.ps1 | 2 ++ 1 file changed, 2 insertions(+) diff --git a/setup.ps1 b/setup.ps1 index 8e4546e..aa88b70 100644 --- a/setup.ps1 +++ b/setup.ps1 @@ -141,6 +141,8 @@ $themeInstalled = Install-OhMyPoshTheme -ThemeName "cobalt2" Install-NerdFonts -FontName "CascadiaCode" -FontDisplayName "CaskaydiaCove NF" # Final check and message to the user +[void] [System.Reflection.Assembly]::LoadWithPartialName("System.Drawing") +$fontFamilies = (New-Object System.Drawing.Text.InstalledFontCollection).Families.Name if ((Test-Path -Path $PROFILE) -and (winget list --name "OhMyPosh" -e) -and ($fontFamilies -contains "CaskaydiaCove NF") -and $themeInstalled) { Write-Host "Setup completed successfully. Please restart your PowerShell session to apply changes." } else { From 3b531f0d949367aa63c44d2cc60963bedd6c02ea Mon Sep 17 00:00:00 2001 From: Johannes Zitz Date: Sat, 10 Jan 2026 12:11:31 +0100 Subject: [PATCH 3/4] Run CTTCustom in current scope (sticky function definitions) --- Microsoft.PowerShell_profile.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Microsoft.PowerShell_profile.ps1 b/Microsoft.PowerShell_profile.ps1 index b314de6..ee4119c 100644 --- a/Microsoft.PowerShell_profile.ps1 +++ b/Microsoft.PowerShell_profile.ps1 @@ -756,7 +756,7 @@ Use '$($PSStyle.Foreground.Magenta)Show-Help$($PSStyle.Reset)' to display this h } if (Test-Path "$PSScriptRoot\CTTcustom.ps1") { - Invoke-Expression -Command "& `"$PSScriptRoot\CTTcustom.ps1`"" + . (Join-Path -Path $PSScriptRoot -ChildPath 'CTTcustom.ps1') } Write-Host "$($PSStyle.Foreground.Yellow)Use 'Show-Help' to display help$($PSStyle.Reset)" From 86c3e8c245a187b19458f74a70b6eb6c124f92e4 Mon Sep 17 00:00:00 2001 From: Johannes Zitz Date: Sat, 10 Jan 2026 13:16:34 +0100 Subject: [PATCH 4/4] Update Edit-Profile function to respect EDITOR_Override --- Microsoft.PowerShell_profile.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Microsoft.PowerShell_profile.ps1 b/Microsoft.PowerShell_profile.ps1 index ee4119c..f09be65 100644 --- a/Microsoft.PowerShell_profile.ps1 +++ b/Microsoft.PowerShell_profile.ps1 @@ -298,7 +298,7 @@ if ($EDITOR_Override){ } # Quick Access to Editing the Profile function Edit-Profile { - vim $PROFILE.CurrentUserAllHosts + & $EDITOR $PROFILE.CurrentUserAllHosts } Set-Alias -Name ep -Value Edit-Profile