Manjaro-zsh-config: backward-kill-word

Is there a reason that this file:
has this configuration:
bindkey '^H' backward-kill-word # delete previous word with ctrl+backspace

The comment and the actual binding are at odds with each other.
Ctrl+Backspace is ^?, not ^H correct?

Anyway, if I change the ^H to a ^? backspace works as expected and per documentation.

Anyway, my fix is to add these lines to ~/.zshrc:

# Backward Kill Word Fix
bindkey '^?' backward-kill-word                                 # delete previous word with ctrl+backspace
bindkey '^H' backward-delete-char                               # delete previous character with backspace

Seems like a sort of “papercut” bug to me.

1 Like

Could also be just different keyboard models? It has been working for me, but I have a finnish keyboard. Adding ^? does sound like a good idea.

That is possible can you send the output of showkeys?

~ >>> showkey --ascii                                                                                                                  

Press any keys - Ctrl-D will terminate this program

^H        8 0010 0x08
^?      127 0177 0x7f
^[[3~    27 0033 0x1b
         91 0133 0x5b
         51 0063 0x33
        126 0176 0x7e
^D        4 0004 0x04
~ >>>

For me, ^H is plain backspace and
the ^? is Ctrl+Backspace
and the stuff starting with ^[[3~ is delete.
I try this on a Dell laptop and a MacOS laptop (both running Manjaro)

If yours is different, then you may have a non standard keyboard.
^H has been backspace for many many years…
It is so old that it should transcend keyboard models, versions, and country variants.

In every OS I have used (Linux, SunOS, Irix, BSD, AIX, HP-UX) across decades, “^H” has ALWAYS been backspace. “stty erase ^H” is a command that I used often in the olden days. I will put it this way: I have never ran across a *nix OS that “^H” was NOT the backspace key.

Here is wikipedia supporting that backspace is 0x8 or ^H.

So, either the comment needs to remove “ctrl+” from the comment… OR “^?” needs to be used instead to match the intention of the comment. Either way is fine, as it is, the config is just plain wrong. It was my very first annoyance with Manjaro, and I figured it would have been corrected by now, but so far it remains.

1 Like

Press any keys - Ctrl-D will terminate this program

^H 	  8 0010 0x08
^? 	127 0177 0x7f
^[[3~ 	 27 0033 0x1b
 	 91 0133 0x5b
 	 51 0063 0x33
 	126 0176 0x7e

For me, plain backspace is ^? and ctrlbackspace is ^H. So exact reverse of how it is in your systems. Using your suggested config, plain backspace deletes whole words and ctrl+backspace deletes single character. I think we need some smarter system to detect the model of keyboard or something, so we can make defaults work for everyone.

Unfortunately I don’t know right away how to do this. Pull requests and suggestions are welcome!

What kind of keyboard are you using?


asus ROG Zephyrus G14 integrated keyboard, with finnish qwerty layout. But it has been the same with all the keyboards I’ve used. Hmmm… I wonder what happens if I okay with setxkbmap…

Yeah, I meant make and model. Not layout… Two separate things there ace. Chrysostomus understood what I meant, see next comment.

Interesting, so maybe the Finnish layout and others do change the ASCII sequence for backspace away from the default ^H and replace it with ^?. Kind of a weird thing to do, since ^H has been standard for backspace for decades… but possible.

Or perhaps, I wonder if it has anything to do with some BIOS preferences that I always set a certain way, and you set another way… Although, Mac hardware would be excluded from this since there is no traditional BIOS on a Mac.