Improving the usability of Powershell on the command line with PSReadLine

To support me, you can subscribe to the channel, share and like the videos, disable your ad blocker or make a donation. Thank you!

Hello,

The PSReadLine PowerShell module replaces the command line experience for Powershell 3 and above. It provides the following: - Syntax highlighting - Syntax error notification - Multiline editing - Customisation of keyboard shortcuts - Windows, Emacs or Vi mode - Completion - Predictive completion - History

https://github.com/PowerShell/PSReadLine

Prediction is enabled by default in PSReadLine 2.2.6.

Syntaxes used in the video

# Windows PowerShell installation.
powershell -noprofile -command "Install-Module PSReadLine -Force -SkipPublisherCheck"
# Installation under PowerShell Core/7
pwsh.exe -noprofile -command "Install-Module PSReadLine -Force -SkipPublisherCheck -AllowPrerelease"
# You can create a profile file to customise and configure the module
notepad $profile
## You can add the following information:
# Load the module
Import PSReadLine module
# Navigable menu when using TAB
Set-PSReadlineKeyHandler -Key Tab -Function MenuComplete
# Enable prediction based on history
Set-PSReadLineOption -PredictionSource History
# Configure the prediction view as a list
Set-PSReadLineOption -PredictionViewStyle ListView
# Use Windows editing mode
Set-PSReadLineOption -EditMode Windows
## Save and run Powershell to test
# Show all keyboard shortcuts
Get-PSReadlineKeyHandler

Video : Improving the usability of Powershell on the command line with PSReadLine

Related links