Table of contents
For Powershell, it's called predictive IntelliSense in PSReadLine.
Predictive IntelliSense is implemented in the PowerShell engine and presented through the PSReadLine module and provide History based prediction in the InlineView.
Predictive IntelliSense is an addition to the concept of tab completion that assists the user in successfully completing commands based on matching predictions from the user’s history.
The prediction suggestion appears as colored text following the user’s cursor.
Installing Predictive IntelliSense
The current release is PSReadLine 2.1.0:
Install-Module PSReadLine -RequiredVersion 2.1.0
If you have vscode installed, simply type code $PROFILE
in the terminal. If not simply create Microsoft.PowerShell_profile.ps1 file in this path...
C:\Users\<UserName>\Documents\WindowsPowerShell\Microsoft.PowerShell_profile.ps1
Now in the $PROFILE
of powershell, add the following :
Import-Module PSReadLine
Set-PSReadLineOption -PredictionSource History
Set-PSReadLineOption -HistorySearchCursorMovesToEnd
Set-PSReadLineKeyHandler -Key UpArrow -Function HistorySearchBackward
Set-PSReadLineKeyHandler -Key DownArrow -Function HistorySearchForward
Set-PSReadLineOption -Colors @{ InlinePrediction = '#875f5f'}
Set-PSReadLineKeyHandler -Chord "Ctrl+RightArrow" -Function ForwardWord
Documentation about the code can be found here.
Preview: