Cmdlets

Choose a cmdlet from the list on the left or search for a specific cmdlet. Choose a cmdlet from the list or search for a specific cmdlet.
About Help  Providers
 

Set-PSReadlineOption

Set-PSReadlineOption

psreadline.dll

Synopsis

Customizes the behavior of command line editing in PSReadline.

Syntax

Set-PSReadlineOption [-EditMode] [-ContinuationPrompt] [-ContinuationPromptForegroundColor] [-ContinuationPromptBackgroundColor] [-EmphasisForegroundColor] [-EmphasisBackgroundColor] [-ErrorForegroundColor] [-ErrorBackgroundColor] [-HistoryNoDuplicates] [-AddToHistoryHandler] [-CommandValidationHandler] [-HistorySearchCursorMovesToEnd] [-MaximumHistoryCount] [-MaximumKillRingCount] [-ResetTokenColors] [-ShowToolTips] [-ExtraPromptLineCount] [-DingTone] [-DingDuration] [-BellStyle] [-CompletionQueryItems] [-WordDelimiters] [-HistorySearchCaseSensitive] [-HistorySaveStyle] [-HistorySavePath] [<CommonParameters>]

Set-PSReadlineOption [-TokenKind] [-ForegroundColor] [-BackgroundColor] [<CommonParameters>]

Detailed Description

The Set-PSReadlineOption cmdlet is used to customize the behavior of the PSReadline module when editing the command line.

Parameters

-EditMode <EditMode>

Specifies the command line editing mode. This will reset any key bindings set by Set-PSReadlineKeyHandler.

Valid values are:

-- Windows: Key bindings emulate PowerShell/cmd with some bindings emulating Visual Studio.

-- Emacs: Key bindings emulate Bash or Emacs.

Aliases

None

Required?

false

Position

named

Default value

Windows

Accept pipeline input?

false

Accept wildcard characters?

false

-ContinuationPrompt <String>

Specifies the string displayed at the beginning of the second and subsequent lines when multi-line input is being entered. Defaults to '>>> '. The empty string is valid.

Aliases

None

Required?

false

Position

named

Default value

>>>

Accept pipeline input?

false

Accept wildcard characters?

false

-ContinuationPromptForegroundColor <ConsoleColor>

Specifies the foreground color of the continuation prompt.

Aliases

None

Required?

false

Position

named

Default value

None

Accept pipeline input?

false

Accept wildcard characters?

false

-ContinuationPromptBackgroundColor <ConsoleColor>

Specifies the background color of the continuation prompt.

Aliases

None

Required?

false

Position

named

Default value

None

Accept pipeline input?

false

Accept wildcard characters?

false

-EmphasisForegroundColor <ConsoleColor>

Specifies the foreground color used for emphasis, e.g. to highlight search text.

Aliases

None

Required?

false

Position

named

Default value

Cyan

Accept pipeline input?

false

Accept wildcard characters?

false

-EmphasisBackgroundColor <ConsoleColor>

Specifies the background color used for emphasis, e.g. to highlight search text.

Aliases

None

Required?

false

Position

named

Default value

None

Accept pipeline input?

false

Accept wildcard characters?

false

-ErrorForegroundColor <ConsoleColor>

Specifies the foreground color used for errors.

Aliases

None

Required?

false

Position

named

Default value

Red

Accept pipeline input?

false

Accept wildcard characters?

false

-ErrorBackgroundColor <ConsoleColor>

Specifies the background color used for errors.

Aliases

None

Required?

false

Position

named

Default value

None

Accept pipeline input?

false

Accept wildcard characters?

false

-HistoryNoDuplicates <SwitchParameter>

Specifies that duplicate commands should not be added to PSReadline history.

Aliases

None

Required?

false

Position

named

Default value

False

Accept pipeline input?

false

Accept wildcard characters?

false

-AddToHistoryHandler <Func[String, Boolean]>

Specifies a ScriptBlock that can be used to control which commands get added to PSReadline history.

Aliases

None

Required?

false

Position

named

Default value

None

Accept pipeline input?

false

Accept wildcard characters?

false

-CommandValidationHandler <Action[CommandAst]>

Specifies a ScriptBlock that is called from ValidateAndAcceptLine. If an exception is thrown, validation fails and the error is reported. Before throwing an exception, the validation handler may choose to place the cursor at the point of the error to make it easier to fix. A validation handler may also modify the command line, e.g. to correct common typos.

Aliases

None

Required?

false

Position

named

Default value

None

Accept pipeline input?

false

Accept wildcard characters?

false

-HistorySearchCursorMovesToEnd <SwitchParameter>

Aliases

None

Required?

false

Position

named

Default value

False

Accept pipeline input?

false

Accept wildcard characters?

false

-MaximumHistoryCount <Int32>

Specifies the maximum number of commands to save in PSReadline history. Note that PSReadline history is separate from PowerShell history.

Aliases

None

Required?

false

Position

named

Default value

1024

Accept pipeline input?

false

Accept wildcard characters?

false

-MaximumKillRingCount <Int32>

Specifies the maximum number of items stored in the kill ring.

Aliases

None

Required?

false

Position

named

Default value

10

Accept pipeline input?

false

Accept wildcard characters?

false

-ResetTokenColors <SwitchParameter>

Restore the token colors to the default settings.

Aliases

None

Required?

false

Position

named

Default value

False

Accept pipeline input?

false

Accept wildcard characters?

false

-ShowToolTips <SwitchParameter>

When displaying possible completions, show tooltips in the list of completions.

Aliases

None

Required?

false

Position

named

Default value

False

Accept pipeline input?

false

Accept wildcard characters?

false

-ExtraPromptLineCount <Int32>

Use this option if your prompt spans more than one line and you want the extra lines to appear when PSReadline displays the prompt after showing some output, e.g. when showing a list of completions.

Aliases

None

Required?

false

Position

named

Default value

0

Accept pipeline input?

false

Accept wildcard characters?

false

-DingTone <Int32>

When BellStyle is set to Audible, specifies the tone of the beep.

Aliases

None

Required?

false

Position

named

Default value

1221

Accept pipeline input?

false

Accept wildcard characters?

false

-DingDuration <Int32>

When BellStyle is set to Audible, specifies the duration of the beep.

Aliases

None

Required?

false

Position

named

Default value

50ms

Accept pipeline input?

false

Accept wildcard characters?

false

-BellStyle <BellStyle>

Specifies how PSReadLine should respond to various error and ambiguous conditions.

Valid values are:

-- Audible: a short beep

-- Visible: a brief flash is performed

-- None: no feedback

Aliases

None

Required?

false

Position

named

Default value

Audible

Accept pipeline input?

false

Accept wildcard characters?

false

-CompletionQueryItems <Int32>

Specifies the maximum number of completion items that will be shown without prompting. If the number of items to show is greater than this value, PSReadline will prompt y/n before displaying the completion items.

Aliases

None

Required?

false

Position

named

Default value

100

Accept pipeline input?

false

Accept wildcard characters?

false

-WordDelimiters <String>

Specifies the characters that delimit words for functions like ForwardWord or KillWord.

Aliases

None

Required?

false

Position

named

Default value

;:,.[]{}()/\|^&*-=+

Accept pipeline input?

false

Accept wildcard characters?

false

-HistorySearchCaseSensitive <SwitchParameter>

Specifies the searching history is case sensitive in functions like ReverseSearchHistory or HistorySearchBackward.

Aliases

None

Required?

false

Position

named

Default value

False

Accept pipeline input?

false

Accept wildcard characters?

false

-HistorySaveStyle <HistorySaveStyle>

Specifies how PSReadLine should save history.

Valid values are:

-- SaveIncrementally: save history after each command is executed - and share across multiple instances of PowerShell

-- SaveAtExit: append history file when PowerShell exits

-- SaveNothing: don't use a history file

Aliases

None

Required?

false

Position

named

Default value

SaveIncrementally

Accept pipeline input?

false

Accept wildcard characters?

false

-HistorySavePath <String>

Specifies the path to the history file.

Aliases

None

Required?

false

Position

named

Default value

~\AppData\Roaming\PSReadline\$($host.Name)_history.txt

Accept pipeline input?

false

Accept wildcard characters?

false

-TokenKind <TokenClassification>

Specifies the kind of token when setting token coloring options with the -ForegroundColor and -BackgroundColor parameters.

Aliases

None

Required?

true

Position

0

Default value

None

Accept pipeline input?

false

Accept wildcard characters?

false

-ForegroundColor <ConsoleColor>

Specifies the foreground color for the token kind specified by the parameter -TokenKind.

Aliases

None

Required?

false

Position

1

Default value

None

Accept pipeline input?

false

Accept wildcard characters?

false

-BackgroundColor <ConsoleColor>

Specifies the background color for the token kind specified by the parameter -TokenKind.

Aliases

None

Required?

false

Position

2

Default value

None

Accept pipeline input?

false

Accept wildcard characters?

false

Input Type

None

Return Type

None

Notes

None

Examples

about_PSReadline