cmd, readline, and /path/filename completion

holger krekel pyth at devel.trillke.net
Wed Jul 24 08:00:22 EDT 2002


Michael Hudson wrote:
> Dave Cinege <dcinege at psychosis.com> writes:
> > I'm trying to tweak the readline functionality, and am a bit lost.
> > 
> > In Bash
> > 	cd /etc/<tab>
> > Will display a list of files in /etc/ to complete against.
> > 
> > In my shell, I will always see the files in the current directory.
> > 
> > What must be done to mimic the bash functionaly? Is it an option that
> > must be turned on in readline? Do I have to snag the line, and if it is a 
> > valid path, cd to that path? (then back to PWD)
> 
> I'm guessing that you need to fiddle what characters readline thinks
> are word boundaries.  readline.set_completer_delims looks hopeful.

More exactly, the OP needs to erase the '/' character from the delims list.
e.g.

readline.set_completer_delims(' \t\n`~!@#$%^&*()-=+[{]}\\|;:\'",<>?')

should work the way you want it.

Are you implementing your own completion handler? 

    holger




More information about the Python-list mailing list