Red Hat Bugzilla – Bug 3275
how to set meta-delete key binding
Last modified: 2008-05-01 11:37:50 EDT
I've been trying to set the key binding for meta-delete.
I'm running in an xterm and have used xmodmap to cause both
backspace and delete to issue delete (0xff) in vt100-type
windows. This fixes a lot of things and the only thing that
this breaks is meta-backspace in tcsh. So I need to set
meta-delete in tcsh but tcsh appears not to allow it to be
The tcsh man page states that delete is given as ^? and that
you can say bindkey -b 'M-<keyname>' <command> to set meta
% bindkey -b 'M-^?' backward-delete-word
Bad key spec M-^?
If I use ^V to quote the meta-delete sequence, I get ^H,
which is backspace (0x08), not delete (0xff). Using ^H in
any bindkey command affects backspace but not delete.
Doing just bindkey to list the sequences lists a bunch of
meta sequences like "^^g". Perhaps one of these is what I
want but I have no way of knowing which of those sequences
corresponds to meta-delete, nor do I know how to generate
them. Cutting and pasting them works to some windows, but
not to shell windows.
The man page tells you how to set delete and anything with a
meta in front of it, but combining those rules does not
work. Please fix, or suggest (and document in the man page)
Have you tried entering the command all in ascii? By that I mean
instead of trying to get the code \0xff into the command, try
the key sequence
? question mark
when entering your bindkey command?
------- Email Received From Joe Harrington <email@example.com> 06/07/99 11:57 -------
(Here's the contents of the email I sent. Sorry, I thought it would
appear in the dialog.)
Yes I tried, no it doesn't work. Trying this suggestion will show
that it produces the following error message:
% bindkey -b 'M-^?' backward-delete-character
Bad key spec M-^?
I tried both the quoted key sequences and the ascii equivalents for
^?, ^H, ^h, ^_, M-DL, M-DEL, M-0xff, and all of the "untypable"
foreign characters that show up when you do bindkey without arguments,
by cut-and-paste from the window.
Apparently bindkey -b limits the sequence to three characters, and
they have to be printable. The sequence 'M-C-s' fails, for example.
My belief is that there is an anti-loophole in the key codes for
bindkey: You can only tell bindkey to use "meta" in the -b format, and
you can only tell bindkey about delete using ^?. This latter sequence
is documented but is disallowed by the -b format, so meta-delete isn't
possible. DEL is the only ascii sequence that is not printable and
that is not in the first ascii register (values 0x00 - 0x1f).
A very easy fix to code would be to extend the -b option to include 1)
the standard ASCII two- and three-letter expansions of the control
characters (NUL, SOH, STX, etc.), 2) Multiple "shift"-style prefixes
(M-C-x), and/or 3) hex values in the "0x" format (M-0xff).
This won't be in Red Hat 6.1. I'm preserving the bug by changing the
state to REMIND.