From f2cf8467ef664aac46789f901497cf1cd8c22bec Mon Sep 17 00:00:00 2001 From: Stevan Freeborn <65925598+StevanFreeborn@users.noreply.github.com> Date: Fri, 17 Jul 2026 23:05:43 -0500 Subject: [PATCH] fix: set edit mode before ps readline key registration --- Documents/PowerShell/Microsoft.PowerShell_profile.ps1 | 1 - Documents/PowerShell/Profile/04-PSReadLine.ps1 | 4 ++-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/Documents/PowerShell/Microsoft.PowerShell_profile.ps1 b/Documents/PowerShell/Microsoft.PowerShell_profile.ps1 index 963a8c5..e9a98dd 100644 --- a/Documents/PowerShell/Microsoft.PowerShell_profile.ps1 +++ b/Documents/PowerShell/Microsoft.PowerShell_profile.ps1 @@ -12,7 +12,6 @@ if (Test-Path -Path $ProfileDir) { Write-Warning "Failed to load profile module: $($Script.Name). Error: $($_.Exception.Message)" } } - } else { Write-Warning "Profile directory not found at: $ProfileDir" } diff --git a/Documents/PowerShell/Profile/04-PSReadLine.ps1 b/Documents/PowerShell/Profile/04-PSReadLine.ps1 index 85cc5be..e71a6a5 100644 --- a/Documents/PowerShell/Profile/04-PSReadLine.ps1 +++ b/Documents/PowerShell/Profile/04-PSReadLine.ps1 @@ -1,8 +1,9 @@ using namespace System.Management.Automation using namespace System.Management.Automation.Language -Import-Module PSReadLine -ErrorAction SilentlyContinue if (Get-Command Set-PSReadLineOption -ErrorAction SilentlyContinue) { + # Set EditMode Windows first to ensure all subsequent registrations target the correct keymap + Set-PSReadLineOption -EditMode Windows # Searching for commands with up/down arrow is really handy. Set-PSReadLineKeyHandler -Key UpArrow -Function HistorySearchBackward @@ -539,7 +540,6 @@ if (Get-Command Set-PSReadLineOption -ErrorAction SilentlyContinue) { Set-PSReadLineOption -PredictionSource History Set-PSReadLineOption -PredictionViewStyle ListView - Set-PSReadLineOption -EditMode Windows # dotnet build macro Set-PSReadLineKeyHandler -Key Ctrl+Shift+b `