Last active
February 27, 2022 04:08
-
-
Save trapezoid/5c824599f58f1b00f41487c51c41fe13 to your computer and use it in GitHub Desktop.
PSReadLine2.2のPredictionViewStyleをCtrl+rで切り替えていい感じに使う
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Set-PSReadLineOption -PredictionSource History -PredictionViewStyle InlineView | |
Set-PSReadLineKeyHandler -Key "Ctrl+f" -Function ForwardWord | |
function Switch-PredictionView() | |
{ | |
if ((Get-PSReadLineOption).PredictionViewStyle -eq "InlineView") | |
{ | |
Set-PSReadLineOption -PredictionViewStyle ListView | |
Set-PSReadLineKeyHandler -Key "Ctrl+f" -Function HistorySearchForward | |
Set-PSReadLineKeyHandler -Key "Ctrl+b" -Function HistorySearchBackward | |
} | |
else | |
{ | |
Set-PSReadLineOption -PredictionViewStyle InlineView | |
Set-PSReadLineKeyHandler -Key "Ctrl+f" -Function ForwardWord | |
} | |
} | |
Set-PSReadLineKeyHandler -Chord "Ctrl+r" -ScriptBlock { Switch-PredictionView } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment