/PS-GuiCompletion

A graphical menu for PowerShell tab completions.

Primary LanguagePowerShellMIT LicenseMIT

GuiCompletion for PowerShell

GUI-style tab-completion menu for PowerShell. It integrates with PSReadLine which comes installed in PowerShell, and the GUI code is lifted from PowerTab.

This repository clones and continues the original PS-GuiCompletion created by @cspotcode. The same module GuiCompletion is developed here starting from v0.9.0.

Screenshots

command parameter path

Installation

Install from the PowerShell Gallery (GuiCompletion Gallery page):

Install-Module -Name GuiCompletion -Scope CurrentUser

Omit -Scope to install for all users if you have administrator permissions.

Usage

Use with the default Ctrl+Spacebar key shortcut:

Install-GuiCompletion

or with another key shortcut:

Install-GuiCompletion -Key Tab

Install-GuiCompletion wraps PSReadLine's Set-PSReadLineKeyHandler. For more advanced scenarios, you can call the relevant PSReadLine commands directly:

Set-PSReadlineKeyHandler -Key Alt+Spacebar -ScriptBlock { Invoke-GuiCompletion }

Add these configuration commands to your PowerShell profile. Otherwise your configuration will not be applied to new PowerShell sessions.

Options

The exported variable $GuiCompletionConfig provides the following default console colors and options. They may be changed in a profile or interactively.

Colors                : @{TextColor=DarkMagenta;
                        BackColor=White;
                        SelectedTextColor=White;
                        SelectedBackColor=DarkMagenta;
                        BorderTextColor=DarkMagenta;
                        BorderBackColor=White;
                        BorderColor=DarkMagenta;
                        FilterColor=DarkMagenta}
DoubleBorder          : True
MinimumTextWidth      : 25
FastScrollItemCount   : 10
AutoReturnSingle      : True
ScrollDisplayDown     : True
DotComplete           : True
AutoExpandOnDot       : True
BackSlashComplete     : True
AutoExpandOnBackSlash : True
CustomComplete        : True
CustomCompletionChars :  ()[]:

ScrollDisplayDown tells to scroll the display if necessary in order to show the list below the caret. This works around redrawing issues after the list shown above the caret in some terminals.

See also