mikemaccana mikemaccana - 3 months ago 8
PowerShell Question

Can I make powershell tab complete show me all options, rather than picking a specific one?

In Powershell, if I type:

install-<tab>


Powershell tab completion will complete with a single command that starts with
install-


Install-Package


And I can hit Tab again to see different completions.

Is it possible to have Powershell show all options that start with what I typed, like Linux or Unix shell? Eg, if I type:

install-<tab>


I get:

Install-Package
Install-PackageProvider
Install-Script

Answer

PSReadLine has a feature like this called MenuComplete. Instead of Tab, press Ctrl+space:

EmacsModeTabCompletionWithPSReadLine

You can bind the MenuComplete function to tab with Set-PSReadLineKeyHandler:

Set-PSReadlineKeyHandler -Chord Tab -Function MenuComplete
Comments