[Techtalk] bash and inputrc

Akkana Peck akkana at shallowsky.com
Thu Jan 13 05:17:04 EST 2005


I asked:
> > Anybody used .inputrc successfully to change bash's key bindings?

John Clarke writes:
> and loaded it:
> 
>     [jrc at zeus ~]$ bind -f .inputrc

Thanks -- I didn't know about the options to the bind command,
and knowing -P and -f are making it easier to test this.

I have it working now on the woody machine -- it turned out woody's
readline needs the backslash before the key modifiers, which sarge's
readline doesn't, so \C-w and not C-w -- but it still doesn't work
on sid, and running bind -f .inputrc doesn't change anything.

I wondered whether maybe this was because some recent change is
making it pickier about overwriting keys that are already bound,
so I thought I'd try removing the existing key bindings:

bind -r '\C-w'
bind -r '\C-h'

Those commands don't return any errors, but typing C-w and C-h
still do the same thing they always do.  So it looks like the "bind"
command isn't doing anything at all, either for setting new bindings
or removing old ones.  Indeed, typing commands like

bind '\C-h':backward-kill-word
bind "\\C-w":backward-kill-word

directly don't change anything either.

I also tried the beginning/end of line bindings you used as
examples; the system default bindings already have "\M-[H"
bound to beginning-of-line, and running your .inputrc lines
doesn't add "\e[H" as a binding, if it's actually different.
None of the existing \M- bindings work when I type them,
anyway, whether with alt, the "windows" key, or esc, so I've
been using mostly \C- bindings for testing.

I wondered if it might be modifying the wrong keymap, but
bind -V says the keymap is emacs, and adding -m emacs to the
bind commands doesn't help.

This machine has both libreadline4 version 4.3-15 and
libreadline5 5.0-7.  But ldd /bin/bash doesn't mention readline,
so maybe bash has its own compiled-in version (it's bash 3.00.16(1),
but that doesn't tell me what libraries were used to compile it).

Any thoughts?  Is there any way to get bind to be more verbose about
errors or problems?  I don't see anything in the discussion of bind
under bash(1).

	...Akkana


More information about the Techtalk mailing list