powershell 自定义tab键下拉菜单智能提示
基于PSReadLine 得智能提示, tab健下拉菜单
下载依赖
Install-Module -Name GuiCompletion
注册tab按键
Install-GuiCompletion -Key Tab
或者自定义按键
Set-PSReadlineKeyHandler -Key Alt+Spacebar -ScriptBlock { Invoke-GuiCompletion }
更改$profile
里的$GuiCompletionConfig
调整弹窗样式
$GuiCompletionConfig
Colors : @{TextColor=DarkMagenta;
BackColor=White;
SelectedTextColor=White;
SelectedBackColor=DarkMagenta;
BorderTextColor=DarkMagenta;
BorderBackColor=White;
BorderColor=DarkMagenta;
FilterColor=DarkMagenta}
DoubleBorder : True
MinimumTextWidth : 25
FastScrollItemCount : 10
AutoReturnSingle : True
ScrollDisplayDown : False
DotComplete : True
AutoExpandOnDot : True
BackSlashComplete : True
AutoExpandOnBackSlash : True
CustomComplete : True
CustomCompletionChars : ()[]:
自带psreadline的搜索
Set-PSReadLineOption -EditMode Emacs
Set-PSReadLineKeyHandler -Key UpArrow -Function HistorySearchBackward # 设置向上键为后向搜索历史记录
Set-PSReadLineKeyHandler -Key DownArrow -Function HistorySearchForward # 设置向下键为前向搜索历史纪录