Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Windows: Pressing Ctrl + W (or ^W) or Ctrl + Backspace does nothing. #2930

Closed
jens1o opened this issue Oct 28, 2019 · 11 comments
Closed

Windows: Pressing Ctrl + W (or ^W) or Ctrl + Backspace does nothing. #2930

jens1o opened this issue Oct 28, 2019 · 11 comments

Comments

@jens1o
Copy link

jens1o commented Oct 28, 2019

System

Operating System Windows
Binary Version 0.3.3

Summary

Pressing Ctrl + W (or ^W) or Ctrl + Backspace does nothing.

Behavior

The last word is not removed from shell. Instead, ^W is written to the output.

Expectation

Remove the last word instead.

@jens1o jens1o changed the title Windows: Windows: Pressing Ctrl + W (or ^W) or Ctrl + Backspace does nothing. Oct 28, 2019
@chrisduerr
Copy link
Member

Which shell? If ^W is written to the stdin of the shell, it seems like everything is working as intended.

@jens1o
Copy link
Author

jens1o commented Oct 29, 2019

Powershell, but I expected it - like in the linux word - to just remove the last word?

@chrisduerr
Copy link
Member

Powershell, but I expected it - like in the linux word - to just remove the last word?

This is something that Bash does for you, it's not something the terminal emulator provides. We just tell it what key has been sent.

So if it doesn't work in cmd/powershell, it won't work in Alacritty either.

@davidhewitt
Copy link
Contributor

crtl+w works perfectly for me with Powershell core preview 7.0.0-preview.5 . Both in Alacritty and the native terminal.

The builtin Windows powershell is... old! 😄

@chrisduerr
Copy link
Member

Oh yeah, that's definitely a factor too. And cmd.exe is even older and supports even less unix-y features. But generally if the shell supports it, Alacritty shouldn't be stopping things from working properly. And if you can see ^W, that's a good sign that things should work.

@Sl-L
Copy link

Sl-L commented Jul 31, 2021

I'm having the same issue, but Ctrl + Backspace works in cmd but not in alacritty

@vimsux
Copy link

vimsux commented Sep 23, 2021

Ctrl-Backspace does not work for me for either the PowerShell v5.1 (Win10 default) or v7.1.4
It does not print anything, just deletes a single character.

@dominicpalmer
Copy link

Issue is still present. Ctrl+W and Ctrl+Backspace are printing "^W" to stdin via Alacritty, but from a Powershell window the same commands delete a word backwards - the intended result.

@maxreuben
Copy link

In alacritty, at least in Linux, the keybinding for delete previous word is Alt+Backspace, not Ctrl+Backspace. It'd be nice if there was a way to switch that though. If anyone knows how to, please let us know.

@arclaxton
Copy link

On my system, powershell would delete words when I pressed ctrl+backspace but not ctrl+w.
Alacritty had no problem relaying the ctrl+w sequence (which my powershell did nothing with) but ctrl+backspace from alacritty only deleted a single character.

I was able to teach powershell about ctrl+w by adding the following to my profile.ps1:
Set-PSReadLineKeyHandler -Chord ctrl+w -Function BackwardDeleteWord
Now I can delete words using powershell with alacritty. I think it is still an issue that ctrl+backspace works in plain PS but not from alacritty, but I am happy using the bash-flavored shortcut.

@tahir-hassan
Copy link

tahir-hassan commented Mar 5, 2022

To bind Control-BackSpace to End-of-Transmission-Block

I got this solution from microsoft/terminal#755:

  - { key: Back, mods: Control, chars: "\u0017" }

This works in both PowerShell, and when you launch Neovim too.

You can use vtshowkeys on Termux to find the keybindings btw.

Other useful PowerShell-related Key-bindings

  - { key: Space, mods: Control, chars: "\u0000" }
  - { key: Back, mods: Control, chars: "\u0017" }
  - { key: Home, mods: Shift, chars: "\x1b[1;2H" }
  - { key: End, mods: Shift, chars: "\x1b[1;2F" }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

9 participants