python27 + readline: can't bind ^U

Oliver Fromme olli at lurza.secnetix.de
Thu Oct 21 13:11:40 UTC 2010


Hi,

I'm using python27 on FreeBSD 8.1.  I would like to change
the behaviour of ^U at the Python prompt.  By default, it
deletes everything to the left of the cursor, but I want
it to delete the _whole_ line, regardless of the current
cursor position.

Nothing of the following works:

 - adding one of these lines to ~/.inputrc:
   "\C-u": kill-whole-line
   Control-u: kill-whole-line

 - adding "import readline" and one of these lines to
   ~/.pythonstartup:
   readline.parse_and_bind (r'"\C-u": kill-whole-line')
   readline.parse_and_bind (r'Control-u: kill-whole-line')

The desired binding is never executed.  When I run the
"dump-functions" command, kill-whole-line is listed as
unbound, and \C-u is still bound to unix-line-discard.

Other key bindings that I added to ~/.pythonstartup and
~/.inputrc work fine.  Only Control-U refuses to be bound
to anything else than unix-line-discard.

What am I doing wrong?

Best regards
   Oliver

-- 
Oliver Fromme, secnetix GmbH & Co. KG, Marktplatz 29, 85567 Grafing b. M.
Handelsregister: Registergericht Muenchen, HRA 74606,  Geschäftsfuehrung:
secnetix Verwaltungsgesellsch. mbH, Handelsregister: Registergericht Mün-
chen, HRB 125758,  Geschäftsführer: Maik Bachmann, Olaf Erb, Ralf Gebhart

FreeBSD-Dienstleistungen, -Produkte und mehr:  http://www.secnetix.de/bsd

One Unix to rule them all, One Resolver to find them,
One IP to bring them all and in the zone to bind them.


More information about the freebsd-python mailing list