Skip to content

Commit d3ea7ae

Browse files
committed
feat(profile): 为PSReadLine添加Tab键自动补全功能
在Unix和Windows的profile脚本中添加PSReadLine的Tab键自动补全配置,提升用户交互体验
1 parent 2759ebc commit d3ea7ae

2 files changed

Lines changed: 3 additions & 0 deletions

File tree

‎profile/profile.ps1‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -234,6 +234,7 @@ function Initialize-Environment {
234234
Write-Verbose "设置控制台编码为UTF8"
235235
$Global:OutputEncoding = [console]::InputEncoding = [console]::OutputEncoding = New-Object System.Text.UTF8Encoding
236236
$Global:PSDefaultParameterValues["Out-File:Encoding"] = "UTF8"
237+
Set-PSReadLineKeyHandler -Key Tab -Function MenuComplete
237238

238239
# 导入PSReadLine模块
239240
# pwsh 7.x版本以上是自动启用了,所以也不用导入

‎profile/profile_unix.ps1‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -198,6 +198,8 @@ function Initialize-Environment {
198198
}
199199
}
200200

201+
# powershell相关配置
202+
Set-PSReadLineKeyHandler -Key Tab -Function MenuComplete
201203
Set-AliasProfile
202204
Write-Verbose "PowerShell 环境初始化完成"
203205

0 commit comments

Comments
 (0)