[IPython-dev] cd a little hyper
John Hunter
jdh2358 at gmail.com
Fri Jun 6 01:38:39 EDT 2008
On Thu, Jun 5, 2008 at 11:41 PM, Ville M. Vainio <vivainio at gmail.com> wrote:
> Yes, I fixed that by introducing the pseudo-annoying behaviour you
> mention (I noticed the same thing on linux + scratchbox). It's the
> single_dir_expand call in ipy_completers.py (cd completer)
If you are working on completions, here are some features I think
would be great:
* for 'run' or 'ls' or 'cat' completions, complete only on files, not
local python namespaces. Eg, in pylab mode, the localname "hist" is
defined in mpl and "histogram", "histogram2d" and "histogramdd" are
defined in numpy. But when I do an an "ls" completion on the
mpl/examples/hist<TAB> directory, I want to see the mpl histogram
examples. If I expilcitly ask for them, all is well::
In [3]: ls /home/jdhunter/mpl/examples/pylab_examples/hist*
/home/jdhunter/mpl/examples/pylab_examples/hist_colormapped.py
/home/jdhunter/mpl/examples/pylab_examples/histogram_demo_extended.py
/home/jdhunter/mpl/examples/pylab_examples/histogram_demo.py
But if I cd into that dir, and do an 'ls hist<TAB>'
In [6]: cd /home/jdhunter/mpl/examples/pylab_examples
/home/jdhunter/mpl/examples/pylab_examples
In [7]: ls hist<TAB>
hist histogramdd
hist_colormapped.py histogram_demo_extended.py
histogram histogram_demo.py
histogram2d
I get files in that dir *and* names in the local namespace.
Interestingly, if I cd back to home and give the full path on to "ls"
followed by TAB, I get the desired behavior:
In [8]: cd
/home/jdhunter
In [9]: ls mpl/examples/pylab_examples/hist<TAB>
mpl/examples/pylab_examples/hist_colormapped.py
mpl/examples/pylab_examples/histogram_demo_extended.py
mpl/examples/pylab_examples/histogram_demo.py
However, 'run' is working as expected, usggesting this may be an easy fix::
In [14]: cd mpl/examples/pylab_examples/
In [15]: run hist<TAB>
hist_colormapped.py histogram_demo.py
histogram_demo_extended.py
though 'ls' is not (as before)::
In [15]: ls hist<TAB>
hist histogramdd
hist_colormapped.py histogram_demo_extended.py
histogram histogram_demo.py
histogram2d
nor is 'cat', which seems to suffer the same problem as 'ls'
Thats all for now!
JDH
More information about the IPython-dev
mailing list