PowerShell / PSReadLine

A bash inspired readline implementation for PowerShell
BSD 2-Clause "Simplified" License
3.69k stars 293 forks source link

KeyHandler to toggle through predictors sources #3383

Open StevenBucher98 opened 2 years ago

StevenBucher98 commented 2 years ago

Prerequisites

Description of the new feature/enhancement

Instead of typing Set-PSReadlineOption -PredictionSource <source> the user would be able to use a key handler to toggle between all the possible options for -PredictorSource and have a display note of which predictor source a user is on.

Open for discussion on the exact UI implementation.

Proposed technical implementation details (optional)

Shift + F2 to switch between different predictor sources.

PS C:\Users\stevenbucher> <Press Shift+F2>
PSReadLineOption Predictor Source now set to History

PS C:\Users\stevenbucher> <Press Shift+F2>
PSReadLineOption Predictor Source now set to HistoryAndPlugin

PS C:\Users\stevenbucher> <Press Shift+F2>
PSReadLineOption Predictor Source now set to Plugin

PS C:\Users\stevenbucher> <Press Shift+F2>
PSReadLineOption Predictor Source now set to None
StevenBucher98 commented 1 year ago

A way to add a keyhandler for toggling on and off predictors can be found here: https://ianmorozoff.com/2023/01/10/predictive-intellisense-on-by-default-in-powershell-7-3/#keybinding