readline, rlcompleter

David M. Cooke cookedm+news at physics.mcmaster.ca
Tue Jan 11 22:11:07 CET 2005


michele.simionato at gmail.com writes:

> This a case where the documentation is lacking. The standard library
> documentation
> (http://www.python.org/dev/doc/devel/lib/module-rlcompleter.html) gives
> this example
> try:
> import readline
> except ImportError:
> print "Module readline not available."
> else:
> import rlcompleter
> readline.parse_and_bind("tab: complete")
>
> but I don't find a list of recognized key bindings. For instance, can I
> would
> like to bind shift-tab to rlcompleter, is that possible? Can I use
> function
> keys? I did various attempt, but I did not succed :-(
> Is there any readline-guru here with some good pointers?
> Michele Simionato

Basically, you could use any key sequence that is sent to the terminal. So
shift-tab is out (that's not sent as a key to any terminal program).

Function keys would have to be specified as the key sequence sent by a
function key ("\e[11~" for F1, for instance).

Have a look at the readline info page, or the man page. The syntax of
readline.parse_and_bind is the same as that of an inputrc file.

-- 
|>|\/|<
/--------------------------------------------------------------------------\
|David M. Cooke
|cookedm(at)physics(dot)mcmaster(dot)ca



More information about the Python-list mailing list