[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Cannot bind ctrl-u to a readline function in bash.

From: Bob Proulx
Subject: Re: Cannot bind ctrl-u to a readline function in bash.
Date: Sun, 20 Apr 2008 14:38:23 -0600
User-agent: Mutt/1.5.13 (2006-08-11)

Chet Ramey wrote:
> Woody Thrower wrote:
> >It appears that bash cannot bind ctrl-u either by using the "bind" command,
> >or by reading .inputrc at startup.
> By default, readline binds the tty editing characters (erase, kill,
> literal-next, word-erase) to their readline equivalents when it's called,
> if they're bound to readline functions.  If they're bound to macros,
> readline won't overwrite the bindings.  It doesn't do anything with the
> `reprint' character (default ^R); there's never been demand for it.
> Use the `bind-tty-special-characters' variable to enable or disable this
> behavior.

As a clarification I wanted to say something a little bit more here.
If I am wrong please correct me.

I think what you just said was that if the character is already bound
to an tty function, such as by system default or by stty setting, then
they override bash's readline values because readline reads the tty
values and reloads them with every input line.  This enables any user
changes made with stty to have effect.  But this prevents the readline
values from persisting because they are overridden by the tty values.
The 'set bind-tty-special-chars off' variable controls this behavior
in which case the readline values will be used instead of the tty
driver values.  But then subsequent changes with stty won't have

This means that an alternative way to make bash's readline values
persistent (having them override the tty driver value) is to unset
them in the tty driver first.  If they are not set in the tty driver
then they won't override readline ~/.inputrc values.  It will just be
a normal character in that case.

  stty -a

Normally control-u is bound to tty driver kill.  Because of there is a
tty driver value for ^U that value always overrides any readline
binding.  But if ^U is remove from the tty driver setting then it

There isn't a portable way to unset these values in the tty driver but
with GNU stty setting a value to "undef" will undefine it.

  stty kill undef

Having done this configuration to free up C-u it can then be bound
normally to whatever function is desired.  Here it is bound to the
emacs behavior.

  bind '"\C-u": universal-argument'


reply via email to

[Prev in Thread] Current Thread [Next in Thread]