From 38928f1e21658d85604cbc0db395f184a1d8e677 Mon Sep 17 00:00:00 2001 From: qwjyh Date: Mon, 10 Oct 2022 22:18:04 +0900 Subject: [PATCH] add: pwsh: emacs keybindings explicit cmd/pwsh PSReadLine mode --- dotfiles/pwsh/powershell_profile.ps1 | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/dotfiles/pwsh/powershell_profile.ps1 b/dotfiles/pwsh/powershell_profile.ps1 index 4a2982f..ea5f655 100644 --- a/dotfiles/pwsh/powershell_profile.ps1 +++ b/dotfiles/pwsh/powershell_profile.ps1 @@ -3,13 +3,17 @@ # ============================================================== Import-Module PSReadLine # >= 2.2.2 Import-Module CompletionPredictor +Set-PSReadLineOption -EditMode Windows Set-PSReadLineOption -PredictionSource HistoryAndPlugin # require PowerShell ≧ 7.2 and PSReadLine ≧ 2.2.2 Set-PSReadlineOption -HistoryNoDuplicates Set-PSReadLineOption -DingTone 880 # beep frequency +Set-PSReadLineKeyHandler -Chord "Ctrl+u" -Function BackwardKillInput # like emacs +Set-PSReadLineKeyHandler -Chord "Ctrl+p" -Function PreviousHistory # like emacs +Set-PSReadLineKeyHandler -Chord "Ctrl+n" -Function NextHistory # like emacs Set-PSReadLineKeyHandler -Chord "Ctrl+f" -Function AcceptSuggestion # like fish Set-PSReadLineKeyHandler -Chord "Tab" MenuComplete Set-PSReadLineKeyHandler -Chord "Ctrl+d" DeleteCharOrExit -Set-PSReadLineKeyHandler -Chord "Ctrl+g" -ScriptBlock { Invoke-FzfTabCompletion } +Set-PSReadLineKeyHandler -Chord "Ctrl+g" -ScriptBlock { Invoke-FzfTabCompletion } -BriefDescription "Fzf tab completion" -Description "Invoke fzf tab completion. Need some input first." # PsFzf Options # 'Ctrl+t' for provider path, 'Ctrl+r' for reverse history