导入语句顺序
TIP
- 当在
$Profile中添加Import-Module PSCompletions时,它的位置很重要 - 在部分场景中,错误的导入顺序可能会导致
PSCompletions无法正常工作
如果你需要使用
PSReadLine相关的配置命令- 请将它们放在
Import-Module PSCompletions之前
powershell# Get-PSReadLineOption $params = @{ # 列表视图: InlineView/ListView PredictionViewStyle = 'ListView' # 关闭响铃: Audible/Visual/None BellStyle = 'None' # 编辑模式: Windows/Emacs/Vi EditMode = 'Vi' } Set-PSReadLineOption @params Set-PSReadLineKeyHandler -Key 'Ctrl+z' -Function Undo Import-Module PSCompletionspowershell# Get-PSReadLineOption Set-PSReadLineOption -PredictionViewStyle ListView -BellStyle None -EditMode vi Set-PSReadLineKeyHandler -Key 'Ctrl+z' -Function Undo Import-Module PSCompletions- 请将它们放在