#How to customize keymap for cycling items in pwsh prediction

4 messages · Page 1 of 1 (latest)

cobalt elbow
dire pewter
#

The default InlineView doesn't support cycling. ListView is needed, which you can switch to on-demand with F2 (by default) or set an absolute value using:

Set-PSReadLineOption -PredictionViewStyle ListView

To see bound and unbound key handlers:

Get-PSReadLineKeyHandler -Bound -Unbound

Built-in prediction functions you can bind to: https://learn.microsoft.com/en-us/powershell/module/psreadline/about/about_psreadline_functions#prediction-functions

Arrow keys are used by default to cycle through ListView predictions. Use Set-PSReadLineKeyHandler to bind chords to PreviousSuggestion/NextSuggestion if you want to use something in addition to arrow keys.

https://learn.microsoft.com/en-us/powershell/module/psreadline/set-psreadlinekeyhandler

There's a feature request for implementing InlineView cycling here: https://github.com/PowerShell/PSReadLine/issues/3362

cobalt elbow
#

thanks for these details!

muted minnow
#

If you install this optional module, you get completions based on the context. (the non-history ones)

Import-Module CompletionPredictor