添加了 powershell 5 兼容

This commit is contained in:
shenjack 2024-01-26 10:38:19 +08:00
parent 6caedc71dc
commit 76331afa9c
Signed by: shenjack
GPG Key ID: 7B1134A979775551

View File

@ -5,7 +5,6 @@ Import-Module PSReadLine
# 设置 PS readline
Set-PSReadLineOption -EditMode Windows
Set-PSReadLineOption -PredictionSource HistoryAndPlugin
Set-PSReadLineOption -PredictionViewStyle ListView
Set-PSReadLineOption -BellStyle None
# 设置 Tab 键补全
@ -19,6 +18,14 @@ Set-PSReadLineKeyHandler -Key UpArrow -Function HistorySearchBackward
# 设置向下键为前向搜索历史纪录
Set-PSReadLineKeyHandler -Key DownArrow -Function HistorySearchForward
# 判断 PowerShell 版本
if ($PSVersionTable.PSVersion.Major -lt 7) {
Set-PSReadLineOption -PredictionSource History
}
else {
Set-PSReadLineOption -PredictionSource HistoryAndPlugin
}
function pythons {
(8, 9, 10, 11, 12) | ForEach-Object {
&"python3.$_ $args"