readline and TAB-completion?

Peter Otten __peter__ at web.de
Wed Nov 25 04:44:05 EST 2015


Ulli Horlacher wrote:

> I need an input function with GNU readline support. So far I have:
> 
>     import readline
>     readline.parse_and_bind("tab: complete")
> 
>     file = raw_input('File to send: ')
> 
> 
> Cursor keys are working, but TAB-completion works only in the current
> directory. Example:
> 
> 
> File to send: [TAB][TAB]
> argv.py              error.py             md5b64.py            x.py

[...]

> Is there a way to make TAB-completion work for other directories, too?

Remove "/" from the set of delimiters:

readline.set_completer_delims(
    "".join(c for c in readline.get_completer_delims() if c != "/"))

> murksigkeiten

I wonder what's in there ;)




More information about the Python-list mailing list