From aec952f22d1623e4f3cd822e20b5a281816e920c Mon Sep 17 00:00:00 2001 From: Anthony Perkins Date: Mon, 29 Jan 2024 15:27:01 +0000 Subject: [PATCH] Try upgrading PSReadLine --- roles/home-cli/files/Microsoft.PowerShell_profile.ps1 | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/roles/home-cli/files/Microsoft.PowerShell_profile.ps1 b/roles/home-cli/files/Microsoft.PowerShell_profile.ps1 index f4af96d..c472648 100644 --- a/roles/home-cli/files/Microsoft.PowerShell_profile.ps1 +++ b/roles/home-cli/files/Microsoft.PowerShell_profile.ps1 @@ -75,6 +75,16 @@ if ($IsWindows -or ($env:OS -eq "Windows_NT")) { # Force UTF-8 output. $OutputEncoding = [System.Text.Encoding]::UTF8 +# Try upgrading the default version of PSReadLine to something newer. +if ((Get-Module PSReadline).Version -le [Version]"2.0.0.0") { + try { + Write-Host "PSReadLine <= 2.0.0.0. Trying to upgrade..." + Install-Module -Scope CurrentUser -Name PSReadLine -Force -ErrorAction SilentlyContinue + Write-Host "PSReadLine upgraded. Restart PowerShell to load it." + } catch { + Write-Host "Failed upgrading PSReadline." + } +} Set-PSReadlineOption -BellStyle None Set-PSReadlineOption -EditMode Emacs Set-PSReadlineKeyHandler -Key Tab -Function Complete