最终效果如下:
安装PSReadLine
在PowerShell中输入
Install-Module PSReadLine -RequiredVersion 2.1.0 -Scope CurrentUser
配置PowerShell
在PowerShell的配置文件中添加如下内容:
Import-Module PSReadLine
Set-PSReadLineOption -PredictionSource History
PowerShell的默认配置文件为:
~\Documents\PowerShell\Microsoft.PowerShell_profile.ps1
也可以直接vim $PROFILE.CurrentUserCurrentHost进行编辑