Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Powershell PSReadLine : Get Key's for a given Function?

In PSReadLine 2.2.2 for PowerShell 7.2.11, On Windows, you can also use the Alt+? key chord to show the function bound to the next key chord you enter.

Conversely, is there a key or PS command that will show keys for a given function?

For example, how can I accomplish:

- Show all keys that are bound for the BackwardDeleteChar function?

Key       Function           Description
---       --------           -----------
Backspace BackwardDeleteChar Delete the character before the cursor
Ctrl+h    BackwardDeleteChar Delete the character before the cursor

or
- Show all keys that are bound for the MenuComplete function>

Key           Function            Description
---           --------            -----------
Ctrl+@        MenuComplete        Complete the input if there ...
Ctrl+Spacebar MenuComplete        Complete the input if there ...
like image 594
Jason Doyle Avatar asked Aug 30 '26 22:08

Jason Doyle


1 Answers

Use the Where-Object cmdlet to filter the output from Get-PSReadLineKeyHandler:

PS ~> Get-PSReadLineKeyHandler |Where-Object Function -eq MenuComplete

Completion functions
====================

Key           Function            Description
---           --------            -----------
Ctrl+@        MenuComplete        Complete the input if there ...
Ctrl+Spacebar MenuComplete        Complete the input if there ...
like image 70
Mathias R. Jessen Avatar answered Sep 03 '26 05:09

Mathias R. Jessen



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!