NAME
Set-PSReadlineOption
SYNOPSIS
Customizes the behavior of command line editing in PSReadline.SYNTAX
Set-PSReadlineOption [-AddToHistoryHandler
] [-BellStyle {None | Visual | Audible}] [-CommandValidationHandler
] [-CompletionQueryItems
DarkBlue | DarkGreen | DarkCyan | DarkRed | DarkMagenta | DarkYellow | Gray | DarkGray | Blue | Green | Cyan | Red] [-ContinuationPrompt ] [-ContinuationPromptBackgroundColor {Black | | Magenta | Yellow | White}] [-ContinuationPromptForegroundColor {Black | DarkBlue | DarkGreen | DarkCyan |
DarkRed | DarkMagenta | DarkYellow | Gray | DarkGray | Blue | Green | Cyan | Red | Magenta | Yellow | White}][-DingDuration
DarkBlue | DarkGreen | DarkCyan | DarkRed | DarkMagenta | DarkYellow | Gray | DarkGray | Blue | Green | Cyan | Red] [-DingTone ] [-EditMode {Windows | Emacs | Vi}] [-EmphasisBackgroundColor {Black | | Magenta | Yellow | White}] [-EmphasisForegroundColor {Black | DarkBlue | DarkGreen | DarkCyan | DarkRed |
DarkMagenta | DarkYellow | Gray | DarkGray | Blue | Green | Cyan | Red | Magenta | Yellow | White}][-ErrorBackgroundColor {Black | DarkBlue | DarkGreen | DarkCyan | DarkRed | DarkMagenta | DarkYellow | Gray |
DarkGray | Blue | Green | Cyan | Red | Magenta | Yellow | White}] [-ErrorForegroundColor {Black | DarkBlue |
DarkGreen | DarkCyan | DarkRed | DarkMagenta | DarkYellow | Gray | DarkGray | Blue | Green | Cyan | Red | Magenta| Yellow | White}] [-ExtraPromptLineCount
] [-HistoryNoDuplicates] [-HistorySavePath ] [-HistorySaveStyle {SaveIncrementally | SaveAtExit | SaveNothing}] [-HistorySearchCaseSensitive]
[-HistorySearchCursorMovesToEnd] [-MaximumHistoryCount
] [-MaximumKillRingCount ] [-ResetTokenColors] [-ShowToolTips] [-ViModeIndicator {None | Prompt | Cursor}] [-WordDelimiters
[] ] Set-PSReadlineOption [-TokenKind] {None | Comment | Keyword | String | Operator | Variable | Command | Parameter |
Type | Number | Member} [[-ForegroundColor] {Black | DarkBlue | DarkGreen | DarkCyan | DarkRed | DarkMagenta |
DarkYellow | Gray | DarkGray | Blue | Green | Cyan | Red | Magenta | Yellow | White}] [[-BackgroundColor] {Black |
DarkBlue | DarkGreen | DarkCyan | DarkRed | DarkMagenta | DarkYellow | Gray | DarkGray | Blue | Green | Cyan | Red | Magenta | Yellow | White}] [] DESCRIPTION
The Set-PSReadlineOption cmdlet customizes the behavior of the PSReadline module when you are editing the command
line.PARAMETERS
-AddToHistoryHandler
Specifies a ScriptBlock that controls which commands get added to PSReadline history. Required? false Position? named Default value None Accept pipeline input? False Accept wildcard characters? false-BackgroundColor
Specifies the background color for the token kind that is specified by the TokenKind parameter. The acceptable values for this parameter are:- Black
- DarkBlue
- DarkGreen
- DarkCyan
- DarkRed
- DarkMagenta
- DarkYellow
- Gray
- DarkGray
- Blue
- Green
- Cyan
- Red
- Magenta
- Yellow
- White
Required? false Position? 2 Default value None Accept pipeline input? False Accept wildcard characters? false-BellStyle
Specifies how PSReadLine responds to various error conditions or user prompts. If you do not specify this parameter, the default response is Audible. The acceptable values for this parameter are:- None. No feedback. - Visual. Text flashes briefly. - Audible. A short beep.
Required? false Position? named Default value None Accept pipeline input? False Accept wildcard characters? false-CommandValidationHandler
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 can place the cursor at the point of the error to make it easier to fix. A validation handler can also change the command line, such as to correct common typographical errors. Required? false Position? named Default value None Accept pipeline input? False Accept wildcard characters? false-CompletionQueryItems
Specifies the maximum number of completion items that are shown without prompting. If the number of items to show is greater than this value, PSReadline prompts you to specify yes or no (y/n) before it displays the completion items. The default maximum number is 100. Required? false Position? named Default value None Accept pipeline input? False Accept wildcard characters? false-ContinuationPrompt
Specifies the string displayed at the start of the second and subsequent lines when multi-line input is being
entered. The default value is '>>>'. The empty string is valid. Required? false Position? named Default value None Accept pipeline input? False Accept wildcard characters? false-ContinuationPromptBackgroundColor
Specifies the background color of the continuation prompt. The acceptable values for this parameter are: the same values as for the BackgroundColor parameter. Required? false Position? named Default value None Accept pipeline input? False Accept wildcard characters? false-ContinuationPromptForegroundColor
Specifies the foreground color of the continuation prompt. The acceptable values for this parameter are: the same values as for BackgroundColor . Required? false Position? named Default value None Accept pipeline input? False Accept wildcard characters? false-DingDuration
Specifies the duration of the beep, in milliseconds (ms), if the BellStyle parameter has a value of Audible. If you do not specify this parameter, and BellStyle is set to Audible, the default duration is 50 ms. Required? false Position? named Default value None Accept pipeline input? False Accept wildcard characters? false-DingTone
Specifies the tone of the beep, in hertz (Hz), if the BellStyle parameter is set to Audible. The acceptable values for this parameter are: integers in the range 37 to 32767 Hz. If you do not specify this parameter, and Bellstyle is Audible, the default tone is 1221 Hz. Required? false Position? named Default value None Accept pipeline input? False Accept wildcard characters? false-EditMode
Specifies the command line editing mode. The EditMode parameter resets any key bindings that you have set byrunning Set-PSReadlineKeyHandler.
Required? false Position? named Default value None Accept pipeline input? False Accept wildcard characters? false-EmphasisBackgroundColor
Specifies the background color that is used for emphasis, such as to highlight search text. The acceptable values for this parameter are: the same values as for BackgroundColor . Required? false Position? named Default value None Accept pipeline input? False Accept wildcard characters? false-EmphasisForegroundColor
Specifies the foreground color that is used for emphasis, such as to highlight search text. The acceptable values for this parameter are: the same values as for BackgroundColor . Required? false Position? named Default value None Accept pipeline input? False Accept wildcard characters? false-ErrorBackgroundColor
Specifies the background color that is used for errors. The acceptable values for this parameter are: the same values as for BackgroundColor . Required? false Position? named Default value None Accept pipeline input? False Accept wildcard characters? false-ErrorForegroundColor
Specifies the foreground color that is used for errors. The acceptable values for this parameter are: the same values as for BackgroundColor . Required? false Position? named Default value None Accept pipeline input? False Accept wildcard characters? false-ExtraPromptLineCount
Specifies the number of extra lines. Specify a value for this parameter if your prompt spans more than one line, and you want extra lines to be available when PSReadline displays the prompt after showing some output, such as when PSReadline returns a list of completions. Required? false Position? named Default value None Accept pipeline input? False Accept wildcard characters? false-ForegroundColor
Specifies the foreground color for the token kind that is specified by the TokenKind parameter. The acceptable values for this parameter are: the same values as for BackgroundColor . Required? false Position? 1 Default value None Accept pipeline input? False Accept wildcard characters? false-HistoryNoDuplicates [
Specifies that duplicate commands not added to PSReadline history. Required? false Position? named Default value False Accept pipeline input? False Accept wildcard characters? false] -HistorySavePath
Specifies a path of the history file. If you do not add this parameter, the default path is~\AppData\Roaming\PSReadline\$($host.Name)_history.txt.
Required? false Position? named Default value None Accept pipeline input? False Accept wildcard characters? false-HistorySaveStyle
Specifies how PSReadLine saves history. To avoid unexpected behavior with command history, if you do not want to use the default value, SaveIncrementally, then set this option before you run the first command line in a session. Required? false Position? named Default value None Accept pipeline input? False Accept wildcard characters? false-HistorySearchCaseSensitive [
Indicates that the searching history is case sensitive in functions such as ReverseSearchHistory or HistorySearchBackward. Required? false Position? named Default value False Accept pipeline input? False Accept wildcard characters? false] -HistorySearchCursorMovesToEnd [
Indicates that the cursor moves to the end of commands that you load from history by using a search. You can search the command history by typing one or more of the characters at the start of the command, and then pressing the up or down arrows, or any other keys that you have mapped to cycling through the command history. If you do not specify this parameter, the cursor remains at the position it was when you pressed the up or down arrows. To turn off this option, you can run either of the following commands:] `Set-PSReadlineOption -HistorySearchCursorMovesToEnd:$False`
`(Get-PSReadlineOption).HistorySearchCursorMovesToEnd = $False`
Required? false Position? named Default value False Accept pipeline input? False Accept wildcard characters? false-MaximumHistoryCount
Specifies the maximum number of commands to save in PSReadline history. PSReadline history not the same thing as Windows PowerShell history. Required? false Position? named Default value None Accept pipeline input? False Accept wildcard characters? false-MaximumKillRingCount
Specifies the maximum number of items stored in the kill ring. Required? false Position? named Default value None Accept pipeline input? False Accept wildcard characters? false-ResetTokenColors [
Indicates that this cmdlet restores token colors to default settings. Required? false Position? named Default value False Accept pipeline input? False Accept wildcard characters? false] -ShowToolTips [
Indicates that when you are displaying possible completions tooltips are shown in the list of completions. Required? false Position? named Default value False Accept pipeline input? False Accept wildcard characters? false] -TokenKind
Specifies the kind of token when you are setting token coloring options with the ForegroundColor and BackgroundColor parameters. The acceptable values for this parameter are:- None
- Comment
- Keyword
- String
- Operator
- Variable
- Command
- Parameter
- Type
- Number
- Member
Required? true Position? 0 Default value None Accept pipeline input? False Accept wildcard characters? false-ViModeIndicator
{{Fill ViModeIndicator Description}} Required? false Position? named Default value None Accept pipeline input? False Accept wildcard characters? false-WordDelimiters
Specifies the characters that delimit words for functions like ForwardWord or KillWord. The default value isthe following list of characters: >;:,.[]{}()/\|^&*-=+
Required? false Position? named Default value None Accept pipeline input? False Accept wildcard characters? falseThis cmdlet supports the common parameters: Verbose, Debug, ErrorAction, ErrorVariable, WarningAction, WarningVariable, OutBuffer, PipelineVariable, and OutVariable. For more information, see about_CommonParameters (https:/go.microsoft.com/fwlink/?LinkID=113216). INPUTS
You cannot pipe objects to this cmdlet.OUTPUTS
This cmdlet does not generate output.NOTES
Example 1: Set values for Comment type
PS C:\>Set-PSReadlineOption -TokenKind Comment -ForegroundColor Green -BackgroundColor Gray
This command sets tokens of the type Comment to be displayed in PSReadline in green text on a gray background.Example 2: Set bell style
PS C:\>Set-PSReadlineOption -BellStyle Audible -DingTone 1221 -DingDuration 60
This cmdlet instructs PSReadline to respond to errors and other conditions that require user input by emitting an audible beep or sound at 1221 Hz for 60 ms.RELATED LINKS
Online Version: http://go.microsoft.com/fwlink/?LinkId=821453Get-PSReadlineKeyHandler
Remove-PSReadlineKeyHandler
Get-PSReadlineOption
Set-PSReadlineKeyHandler