Scott Hanselman

Adding Predictive IntelliSense to my Windows Terminal PowerShell Prompt with PSReadline

July 01, 2021 Comment on this post [7] Posted in PowerShell
Sponsored By

I've long said You should be customizing your PowerShell Prompt with PSReadLine. Go to your PowerShell prompt, and

Install-Module PSReadLine -AllowPrerelease -Force

Then, after running code $profile or nodepad $profile, add

Import-Module PSReadLine

Sure, but next, add these:

Set-PSReadLineOption -PredictionSource History
Set-PSReadLineOption -PredictionViewStyle ListView
Set-PSReadLineOption -EditMode Windows

This means that PSReadLine (and hence, your prompt in general) will use your prompt history to make predictions on what you want to see next. These predictions can be on one line in light gray (full details on Jason's blog) but I like them to pop down in a ANSI style ListView. Then you can edit them with up and down arrows (or Emacs or VI soon).

I'm loving PSReadLine an will be doing a video on setting up your best prompt soon.


Sponsor: Pluralsight helps teams build better tech skills through expert-led, hands-on practice and clear development paths. For a limited time, get 50% off your first month and start building stronger skills.

About Scott

Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, consultant, father, diabetic, and Microsoft employee. He is a failed stand-up comic, a cornrower, and a book author.

facebook bluesky subscribe
About   Newsletter
Hosting By
Hosted on Linux using .NET in an Azure App Service
July 04, 2021 11:38
Hello Scott,
Very nice tip and easy to use.
Actually, I found your site while searching for another topic related to terminal. But for me this configuration was more useful :)
July 04, 2021 14:38
This is awesome. Thanks for that. I always used CTRL+R to find last command, but this is much better.
July 04, 2021 19:13
thanks for sharing this news with us.
July 06, 2021 15:23
Thanks for this tip, a good improvement that saves time
July 07, 2021 0:50
Hey Scott, really dig this tool. Super small typo (I think) "... code $profile or nodepad $profile ... "
July 07, 2021 13:14
Get the cure to low sperm count, penis enlargement, weak erection and premature ejaculation problem from Dr Okoye, my wife left me because i was not able to perform on bed, and because of that we were childless, he sent his product (herbal medicine) to me which i used and it is a permanent cure to weak erection and premature ejaculation my new wife is two month pregnant now, so i give all thanks to Dr Okoye for making me a man again, i was cured with his herbal product. Dr Okoye contact drokoyesnaturals@gmail.com or whatsapp him +2348109476757
July 10, 2021 21:03
I have a bad understanding of coding but I definitely want to learn it. If there is an institution that teaches then advise me, Because it is not necessary to give us a good education in every institution, sometimes it is just a waste of time.

Comments are closed.

Disclaimer: The opinions expressed herein are my own personal opinions and do not represent my employer's view in any way.