Control+Backspace (readline)

181 views
Skip to first unread message

phil.g...@gmail.com

unread,
Jan 16, 2010, 3:16:25 AM1/16/10
to
I want to bind Control+Backspace in readline. Is this possible? When I
add

"\c-\b": kill-word

inside ~/.inputrc, there is no effect; Control+Backspace behaves the
same as Backspace. On the console, I used `showkey' to show the
keycodes. They are:

^? for Backspace
^H for Control+Backspace
^[^? for Meta+Backspace

But on the console, even Control+Arrow or Meta+Arrow do not work,
while in xterm they do.

Thanks in advance for your help! I am not subscribed to the list, so
please add me explicitly in your replies.

Stephane CHAZELAS

unread,
Jan 16, 2010, 6:05:46 AM1/16/10
to
2010-01-16, 00:16(-08), p...@gmail.com:

> I want to bind Control+Backspace in readline. Is this possible? When I
> add

It is only possible if pressing <Ctrl-Backspace> sends a
different character (or character sequence to the application).
>
> "\c-\b": kill-word

That doesn't make sense. \b is already a ctrl character. (\c-h
or \c-?). Control characters are character 0 to 31 and 127,
that's all.

What you need is configure your terminal so that it sends a
specific character sequence upon pressing <Ctrl-Backspace>, and
map that to kill-word. Or simply make it send the ^W character
so that it works everywhere.

With xterm, to do that, you'd install the X resource:

XTerm.VT100.translations: #override\
Ctrl <KeyPress> BackSpace: string(0x17)

(either install that in the X server with xrdb or put it in one
of the resource files read by xterm (for instance your
~/.Xdefaults).

[...]


> But on the console, even Control+Arrow or Meta+Arrow do not work,
> while in xterm they do.

In bash, type <Ctrl-V> followed by a key to see what
character(s) is (are) sent.

> Thanks in advance for your help! I am not subscribed to the list, so
> please add me explicitly in your replies.

This is usenet, not a mailing list.

--
Stï¿œphane

mop2

unread,
Jan 16, 2010, 5:30:14 PM1/16/10
to
On Sat, 16 Jan 2010 06:16:25 -0200, p...@gmail.com <phil.g...@gmail.com> wrote:

> I want to bind Control+Backspace in readline. Is this possible? When I
> add
>
> "\c-\b": kill-word
>
> inside ~/.inputrc, there is no effect; Control+Backspace behaves the
> same as Backspace. On the console, I used `showkey' to show the
> keycodes. They are:
>
> ^? for Backspace
> ^H for Control+Backspace
> ^[^? for Meta+Backspace
>
> But on the console, even Control+Arrow or Meta+Arrow do not work,
> while in xterm they do.

For console try:

file inputrc:
"\C-H": kill-word

command line:
bind '"\C-H": kill-word'

Reply all
Reply to author
Forward
0 new messages