set-executionpolicy remotesigned
安装:PSReadLine
Install-Module PSReadLine -RequiredVersion 2.1.0
安装posh-git
PowerShellGet\Install-Module posh-git -Scope CurrentUser -Force
写入配置:
notepad $PROFILE
若提示错误:请继续以下代码
New-Item -Path $PROFILE -Type File -Force
Microsoft.PowerShell_profile.ps1 配置:
clear
# Tab 当按Tab键时,显示所有选项的导航菜单
Set-PSReadlineKeyHandler -Key Tab -Function MenuComplete
# 每次回溯输入历史,光标定位于输入内
Set-PSReadLineOption -HistorySearchCursorMovesToEnd
# 下一条自动补全 History记录 line模式中相反
Set-PSReadlineKeyHandler -Key Ctrl+n -Function HistorySearchForward
# 上一条自动补全 History记录
Set-PSReadlineKeyHandler -Key Ctrl+p -Function HistorySearchBackward
# auto suggestions
Import-Module PSReadLine
Set-PSReadLineOption -PredictionSource History
# git自动补全
#Add-PoshGitToProfile
Import-Module posh-git