[IPython-user] Custom command completers implemented in SVN

John Hunter jdhunter at ace.bsd.uchicago.edu
Tue Oct 31 13:42:11 CST 2006


>>>>> "John" == John Hunter <jdhunter at ace.bsd.uchicago.edu> writes:

    John> In [19]: completer.register('run', listpy)

    John> and so on....

    John> This would be really useful, IMO.

Oh, now I get it.  I just dropped this in my ipy_user_conf.py

import os, glob
def listdirs(self, event):
    cd, relpath = event['line'].split(' ', 1)
    return [f for f in  glob.glob(relpath+'*') if os.path.isdir(f)]

ip.set_hook('complete_command', listdirs, re_key = 'cd .*')


and Voila!

...very nice...  

JDH


More information about the IPython-user mailing list