介绍
PSReadLine 的预测建议内容,默认是内联视图InlineView
。有需要的话,可以改成列表视图ListView
,最多显示 10 条建议。从使用体验来说,个人认为ListView
感觉更好一些。
https://learn.microsoft.com/zh-cn/powershell/scripting/learn/shell/using-predictors
相关工作
官方文档已经有具体介绍,网上的资料也很多。本文主要还是用于备忘。
方法
可以先使用Get-PSReadLineOption
命令,查看当前的配置选项,其中的PredictionViewStyle
选项即是。
1 | Get-PSReadLineOption |
https://learn.microsoft.com/zh-cn/powershell/module/psreadline/get-psreadlineoption
使用Set-PSReadLineOption
命令,进行修改。
1 | Set-PSReadLineOption -PredictionViewStyle ListView |
https://learn.microsoft.com/zh-cn/powershell/module/psreadline/set-psreadlineoption
如果只是在当前终端会话中,输入该命令,只会在当前会话中生效。如果想让以后每次用 PowerShell 的时候,都显示为列表视图,那么需要把该命令写到$PROFILE
配置文件中。
说些什么吧!