CTRL K
pwsh key bindings (with vi mode)
Zach Nedwich,•1 min read
I’m using PowerShell Core 7.0.0-preview.6, I have no idea which versions of pwsh support these commands.
Best to suck it and see :-) .
Create a $PROFILE if you don’t have one:
New-Item $PROFILECheck that it worked:
Test-Path $PROFILEOpen it in your $EDITOR of choice:
notepad $PROFILE (or $EDITOR profile)Add configuration (example, I like using C^P and C^N to navigate prev/next commands):
Set-PSReadlineOption -EditMode vi
Set-PSReadlineKeyHandler -Key Ctrl+p -Function PreviousHistory
Set-PSReadlineKeyHandler -Key Ctrl+n -Function NextHistorySave, close and source your $PROFILE:
& $PROFILETa-da! Next time you open PWSH this will happen auto-magically.