当前位置:网站首页 > 更多 > 玩电脑 > 正文

[玩转系统] 获取 PSReadLineKeyHandler (PSReadLine)

作者:精品下载站 日期:2024-12-14 02:00:25 浏览:15 分类:玩电脑

获取 PSReadLineKeyHandler (PSReadLine)


获取 PSReadLineKeyHandler

模块 :PS阅读线

获取 PSReadLine 模块的按键绑定。

句法

Get-PSReadLineKeyHandler
   [-Bound]
   [-Unbound]
   [<CommonParameters>]
Get-PSReadLineKeyHandler
   [-Chord] <String[]>
   [<CommonParameters>]

描述

如果未指定参数,则返回 PSReadLine 模块当前绑定的按键函数。

如果指定了 Chord 参数,则 cmdlet 返回特定的绑定键。

示例

示例1:获取所有按键映射

此命令返回所有键映射(已绑定和未绑定)。

Get-PSReadLineKeyHandler -Bound -Unbound

Key                   Function                Description
---                   --------                -----------
Enter                 AcceptLine              Accept the input or move to the next line if input is missing a closing token.
Shift+Enter           AddLine                 Move the cursor to the next line without attempting to execute the input
Escape                RevertLine              Equivalent to undo all edits (clears the line except lines imported from history)
LeftArrow             BackwardChar            Move the cursor back one character
RightArrow            ForwardChar             Move the cursor forward one character
Ctrl+LeftArrow        BackwardWord            Move the cursor to the beginning of the current or previous word
Ctrl+RightArrow       NextWord                Move the cursor forward to the start of the next word
Shift+LeftArrow       SelectBackwardChar      Adjust the current selection to include the previous character
Shift+RightArrow      SelectForwardChar       Adjust the current selection to include the next character
Ctrl+Shift+LeftArrow  SelectBackwardWord      Adjust the current selection to include the previous word
Ctrl+Shift+RightArrow SelectNextWord          Adjust the current selection to include the next word
UpArrow               PreviousHistory         Replace the input with the previous item in the history
DownArrow             NextHistory             Replace the input with the next item in the history
Home                  BeginningOfLine         Move the cursor to the beginning of the line
End                   EndOfLine               Move the cursor to the end of the line
Shift+Home            SelectBackwardsLine     Adjust the current selection to include from the cursor to the end of the line
Shift+End             SelectLine              Adjust the current selection to include from the cursor to the start of the line
Delete                DeleteChar              Delete the character under the cursor
Backspace             BackwardDeleteChar      Delete the character before the cursor
Ctrl+Spacebar         MenuComplete            Complete the input if there is a single completion, otherwise complete the input by selecting from a menu o...
Tab                   TabCompleteNext         Complete the input using the next completion
Shift+Tab             TabCompletePrevious     Complete the input using the previous completion
Ctrl+a                SelectAll               Select the entire line. Moves the cursor to the end of the line
Ctrl+c                CopyOrCancelLine        Either copy selected text to the clipboard, or if no text is selected, cancel editing the line with Cancel...
Ctrl+C                Copy                    Copy selected region to the system clipboard.  If no region is selected, copy the whole line
Ctrl+l                ClearScreen             Clear the screen and redraw the current line at the top of the screen
Ctrl+r                ReverseSearchHistory    Search history backwards interactively
...

示例2:获取绑定键

此命令仅返回绑定键和组合键。

Get-PSReadLineKeyHandler

Key                   Function                Description
---                   --------                -----------
Enter                 AcceptLine              Accept the input or move to the next line if input is missing a closing token.
Shift+Enter           AddLine                 Move the cursor to the next line without attempting to execute the input
Escape                RevertLine              Equivalent to undo all edits (clears the line except lines imported from history)
LeftArrow             BackwardChar            Move the cursor back one character
RightArrow            ForwardChar             Move the cursor forward one character
Ctrl+LeftArrow        BackwardWord            Move the cursor to the beginning of the current or previous word
Ctrl+RightArrow       NextWord                Move the cursor forward to the start of the next word
Shift+LeftArrow       SelectBackwardChar      Adjust the current selection to include the previous character
Shift+RightArrow      SelectForwardChar       Adjust the current selection to include the next character
Ctrl+Shift+LeftArrow  SelectBackwardWord      Adjust the current selection to include the previous word
Ctrl+Shift+RightArrow SelectNextWord          Adjust the current selection to include the next word
UpArrow               PreviousHistory         Replace the input with the previous item in the history
DownArrow             NextHistory             Replace the input with the next item in the history
Home                  BeginningOfLine         Move the cursor to the beginning of the line
End                   EndOfLine               Move the cursor to the end of the line
Shift+Home            SelectBackwardsLine     Adjust the current selection to include from the cursor to the end of the line
Shift+End             SelectLine              Adjust the current selection to include from the cursor to the start of the line
Delete                DeleteChar              Delete the character under the cursor
Backspace             BackwardDeleteChar      Delete the character before the cursor
Ctrl+Spacebar         MenuComplete            Complete the input if there is a single completion, otherwise complete the input by selecting from a menu o...
Tab                   TabCompleteNext         Complete the input using the next completion
...

示例 3:获取特定的按键绑定

此命令仅返回指定键的绑定。

Get-PSReadLineKeyHandler -Chord Enter, Shift+Enter

Key         Function   Description
---         --------   -----------
Enter       AcceptLine Accept the input or move to the next line if input is missing a closing token.
Shift+Enter AddLine    Move the cursor to the next line without attempting to execute the input
...

参数

-Bound

指示此 cmdlet 返回绑定的函数。

类型 :

SwitchParameter

位置:

命名

默认值:

True

必需的:

False

接受管道输入:

False

接受通配符:

False

-Chord

仅返回绑定到特定键或序列的函数。

类型 :

String[]

别名:

Key

位置:

0

默认值:

None

必需的:

True

接受管道输入:

False

接受通配符:

False

-Unbound

指示此 cmdlet 返回未绑定的函数。

类型 :

SwitchParameter

位置:

命名

默认值:

False

必需的:

False

接受管道输入:

False

接受通配符:

False

输入

您无法将对象通过管道传输到此 cmdlet。

输出

密钥处理程序

此 cmdlet 返回一个 KeyHandler 对象。

您需要 登录账户 后才能发表评论

取消回复欢迎 发表评论:

关灯