[IPython-user] Tab-complete filenames first
Fernando.Perez at colorado.edu
Thu Jun 10 11:22:08 CDT 2004
Ville Vainio wrote:
> (This is my first message here - hope it gets through properly)
> I'm planning on starting to use ipython as a shell for Windows (why not
> - it can't possibly suck more that cmd.exe). So far I've got the tab
> completion working using python readline from uncpythontools (which
> screws up the colors, BTW - even the standard interactive python starts
> to display in bright white). Now, I need to make filenames the first
> priority in choosing tab completions. What should I do?
Well, roll up your sleeves :)
I'd suggest reading the new_design.pdf doc included with the distro, it has a
section discussing shell-related issues.
If you really want to reorder the completion search priority, I think the
place to look is the FlexCompleter class, and you may also need to study the
original readline sources in the python distro (or perhaps in Gary's readline,
I'm not sure).
As I've said in the past, I won't go all the way down the road of writing a
full-fledged system shell. But the recent 'shell' profile actually goes a
decent way in that direction. If I have some time in the next few weeks, at
least I'll try to rewrite the '@alias' implementation to become a lightweight
dict. This turns out to be the cornerstone of a possible shell: if @alias is
light and fast, it becomes realistic to scan the ENTIRE $PATH at runtime with
a @rehash command to load aliases for ALL executables in your $PATH.
While I won't get into a readline rewrite, I may do this bit of work on the
@alias setup. The current method (dynamic code generation) looked like a neat
trick when I was learning python, but in reality it's just a gross,
> Also getting the same nice colors I get on my home Linux box would be a
> boon, but that's probably too much to ask right now...
That should be working right now. Just type
at the ipython prompt. If the colors work, set that option permanently in
your ipythonrc file.
More information about the IPython-user