首先核实当前的PowerShell版本。
PS C:Usersgaowei> $PSVersionTable
Name Value
---- -----
PSVersion 5.1.19041.1
PSEdition Desktop
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
BuildVersion 10.0.19041.1
CLRVersion 4.0.30319.42000
WSManStackVersion 3.0
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
倘若版本低于6+,则必须先安装 PSReadLine,安装步骤如下:
Import-Module PSReadLine
两分钟安装完成后,再更改键位绑定的方式:
Set-PSReadLineOption -EditMode Emacs
查看键位绑定的详情:
PS C:Usersgaowei> Get-PSReadLineKeyHandler |head -n 20
Basic editing functions
=======================
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
Backspace BackwardDeleteChar Delete the character before the cursor
Ctrl+h BackwardDeleteChar Delete the character before the cursor
Ctrl+Home BackwardDeleteLine Delete text from the cursor to the start of the line
Ctrl+Backspace BackwardKillWord Move the text from the start of the current or previous word to the cursor to
the kill ring
Ctrl+w BackwardKillWord Move the text from the start of the current or previous word to the cursor to
the kill ring
Ctrl+C Copy Copy selected region to the system clipboard. If no region is selected, copy
the whole line
Ctrl+c CopyOrCancelLine Either copy selected text to the clipboard, or if no text is selected, cancel
editing the line with CancelLine.
以上就是在windows中修改PowerShell键位绑定的方法。
页面更新:2024-05-17
本站资料均由网友自行发布提供,仅用于学习交流。如有版权问题,请与我联系,QQ:4156828
© CopyRight 2020-2024 All Rights Reserved. Powered By 71396.com 闽ICP备11008920号-4
闽公网安备35020302034903号