Powershell hot key ctrl j and ctrl w #5472

Open
opened 2026-01-31 00:14:13 +00:00 by claunia · 0 comments
Owner

Originally created by @Xdminsy on GitHub (Dec 9, 2019).

#Environment

Windows build number: Microsoft Windows [Version 10.0.18362.356]
Windows Terminal version (if applicable): 0.7.3382.0


Any other software?
Powershell Core: 7.0.0-preview.6

I used to bind ctrl+j to enter and use ctrl+w to backward delete word. I have

Set-PSReadLineOption -BellStyle None -EditMode Emacs

emacs edit mode enabled in my powershell.
The ctrl+w works differently in powershell and in powershell in windows terminal.
If I input Get-Command and type ctrl+w, only the Command wil be deleted in powershell.
But in Windows terminal the Get- will be deleted as well.
I don't understand why, but if I explicitly add this to $PROFILE

Set-PSReadLineKeyHandler -Chord ctrl+w -Function BackwardDeleteWord

It works in terminal as expected.

Though ctrl+w can work as expected if I add one line, the ctrl+j cannot work,

Set-PSReadLineKeyHandler -Chord ctrl+j -Function AcceptLine

In powershell I can use ctrl+j instead of Enter key to run command.
But in powershell in Windows Terminal this doesn't work, ctrl+j do nothing even if I mapped it to something.
Other keys seem to work, I only found the binding for ctrl+j won't work.
I thought terminal deals with ctrl+j itself instead of sending it to powershell, but I tried mapping ctrl+j in vim running in terminal it worked.

So I don't understand why these happen, why?

Originally created by @Xdminsy on GitHub (Dec 9, 2019). #Environment ```none Windows build number: Microsoft Windows [Version 10.0.18362.356] Windows Terminal version (if applicable): 0.7.3382.0 Any other software? Powershell Core: 7.0.0-preview.6 ``` I used to bind ctrl+j to enter and use ctrl+w to backward delete word. I have ```powershell Set-PSReadLineOption -BellStyle None -EditMode Emacs ``` emacs edit mode enabled in my powershell. The ctrl+w works differently in powershell and in powershell in windows terminal. If I input `Get-Command` and type ctrl+w, only the `Command` wil be deleted in powershell. But in Windows terminal the `Get-` will be deleted as well. I don't understand why, but if I explicitly add this to $PROFILE ```powershell Set-PSReadLineKeyHandler -Chord ctrl+w -Function BackwardDeleteWord ``` It works in terminal as expected. Though ctrl+w can work as expected if I add one line, the ctrl+j cannot work, ```powershell Set-PSReadLineKeyHandler -Chord ctrl+j -Function AcceptLine ``` In powershell I can use ctrl+j instead of Enter key to run command. But in powershell in Windows Terminal this doesn't work, ctrl+j do nothing even if I mapped it to something. Other keys seem to work, I only found the binding for ctrl+j won't work. I thought terminal deals with ctrl+j itself instead of sending it to powershell, but I tried mapping ctrl+j in vim running in terminal it worked. So I don't understand why these happen, why?
claunia added the Resolution-Duplicate label 2026-01-31 00:14:13 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#5472