update: pwsh: PSReadLine version & add CompletionPredictor

This commit is contained in:
qwjyh 2022-10-09 20:42:38 +09:00
parent 62e1bff8aa
commit 700fa0ba79
2 changed files with 6 additions and 4 deletions

View file

@ -2,6 +2,7 @@
some notable features some notable features
## Key-Bindings ## Key-Bindings
- `F2` to toggle InlineView and ListView of predictions
- tab completion like fish - tab completion like fish
- `Ctrl + D` to exit - `Ctrl + D` to exit
- `Ctrl + G` to Invoke-FzfTabCompletion - `Ctrl + G` to Invoke-FzfTabCompletion

View file

@ -1,11 +1,12 @@
# ============================================================== # ==============================================================
# PSReadLine Settings # PSReadLine Settings
# ============================================================== # ==============================================================
Import-Module PSReadLine Import-Module PSReadLine # >= 2.2.2
Set-PSReadLineOption -PredictionSource History Import-Module CompletionPredictor
Set-PSReadLineOption -PredictionSource HistoryAndPlugin # require PowerShell ≧ 7.2 and PSReadLine ≧ 2.2.2
Set-PSReadlineOption -HistoryNoDuplicates Set-PSReadlineOption -HistoryNoDuplicates
Set-PSReadLineOption -DingTone 880 # beep frequency Set-PSReadLineOption -DingTone 880 # beep frequency
Set-PSReadLineKeyHandler -Chord "Ctrl+f" -Function ForwardWord # like fish Set-PSReadLineKeyHandler -Chord "Ctrl+f" -Function AcceptSuggestion # like fish
Set-PSReadLineKeyHandler -Chord "Tab" MenuComplete Set-PSReadLineKeyHandler -Chord "Tab" MenuComplete
Set-PSReadLineKeyHandler -Chord "Ctrl+d" DeleteCharOrExit Set-PSReadLineKeyHandler -Chord "Ctrl+d" DeleteCharOrExit
Set-PSReadLineKeyHandler -Chord "Ctrl+g" -ScriptBlock { Invoke-FzfTabCompletion } Set-PSReadLineKeyHandler -Chord "Ctrl+g" -ScriptBlock { Invoke-FzfTabCompletion }