Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #99418 > unrolled thread
| Started by | Ulli Horlacher <framstag@rus.uni-stuttgart.de> |
|---|---|
| First post | 2015-11-25 07:02 +0000 |
| Last post | 2015-11-25 12:44 +0000 |
| Articles | 3 — 2 participants |
Back to article view | Back to comp.lang.python
readline and TAB-completion? Ulli Horlacher <framstag@rus.uni-stuttgart.de> - 2015-11-25 07:02 +0000
Re: readline and TAB-completion? Peter Otten <__peter__@web.de> - 2015-11-25 10:44 +0100
Re: readline and TAB-completion? Ulli Horlacher <framstag@rus.uni-stuttgart.de> - 2015-11-25 12:44 +0000
| From | Ulli Horlacher <framstag@rus.uni-stuttgart.de> |
|---|---|
| Date | 2015-11-25 07:02 +0000 |
| Subject | readline and TAB-completion? |
| Message-ID | <n33mde$bgg$1@news2.informatik.uni-stuttgart.de> |
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
Python_Cookbook.pdf bookmarks fexit.py murksigkeiten
_.py compile.py https.py wcp
File to send: /tmp/[TAB][TAB]
argv.py error.py md5b64.py x.py
Python_Cookbook.pdf bookmarks fexit.py murksigkeiten
_.py compile.py https.py wcp
Is there a way to make TAB-completion work for other directories, too?
--
Ullrich Horlacher Server und Virtualisierung
Rechenzentrum IZUS/TIK E-Mail: horlacher@tik.uni-stuttgart.de
Universitaet Stuttgart Tel: ++49-711-68565868
Allmandring 30a Fax: ++49-711-682357
70550 Stuttgart (Germany) WWW: http://www.tik.uni-stuttgart.de/
[toc] | [next] | [standalone]
| From | Peter Otten <__peter__@web.de> |
|---|---|
| Date | 2015-11-25 10:44 +0100 |
| Message-ID | <mailman.63.1448444665.20593.python-list@python.org> |
| In reply to | #99418 |
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 ;)
[toc] | [prev] | [next] | [standalone]
| From | Ulli Horlacher <framstag@rus.uni-stuttgart.de> |
|---|---|
| Date | 2015-11-25 12:44 +0000 |
| Message-ID | <n34aeg$h37$1@news2.informatik.uni-stuttgart.de> |
| In reply to | #99429 |
Peter Otten <__peter__@web.de> wrote: > > 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 != "/")) Great! > > murksigkeiten > > I wonder what's in there ;) Fexed to you :-) -- Ullrich Horlacher Server und Virtualisierung Rechenzentrum IZUS/TIK E-Mail: horlacher@tik.uni-stuttgart.de Universitaet Stuttgart Tel: ++49-711-68565868 Allmandring 30a Fax: ++49-711-682357 70550 Stuttgart (Germany) WWW: http://www.tik.uni-stuttgart.de/
[toc] | [prev] | [standalone]
Back to top | Article view | comp.lang.python
csiph-web