Show More
@@ -45,15 +45,20 b' def apt_completers(self, event):' | |||
|
45 | 45 | ip.set_hook('complete_command', apt_completers, re_key = '.*apt-get') |
|
46 | 46 | ip.set_hook('complete_command', apt_completers, re_key = '.*yum') |
|
47 | 47 | |
|
48 | pkg_cache = None | |
|
49 | ||
|
48 | 50 | def module_completer(self,event): |
|
49 | 51 | """ Give completions after user has typed 'import' """ |
|
50 | 52 | |
|
53 | global pkg_cache | |
|
51 | 54 | import pkgutil,imp,time |
|
52 | for ld, name, ispkg in pkgutil.walk_packages(): | |
|
53 | if ispkg: | |
|
54 | yield name + '.' | |
|
55 | else: | |
|
56 | yield name | |
|
55 | #current = | |
|
56 | if pkg_cache is None: | |
|
57 | print "\n\n[Standby while scanning modules, this can take a while]\n\n" | |
|
58 | pkg_cache = list(pkgutil.walk_packages()) | |
|
59 | ||
|
60 | for ld, name, ispkg in pkg_cache: | |
|
61 | yield name | |
|
57 | 62 | return |
|
58 | 63 | |
|
59 | 64 | ip.set_hook('complete_command', module_completer, str_key = 'import') |
@@ -89,7 +94,7 b' def runlistpy(self, event):' | |||
|
89 | 94 | |
|
90 | 95 | ip.set_hook('complete_command', runlistpy, str_key = '%run') |
|
91 | 96 | |
|
92 |
def |
|
|
97 | def cd_completer(self, event): | |
|
93 | 98 | relpath = event.symbol |
|
94 | 99 | |
|
95 | 100 | if '-b' in event.line: |
@@ -112,4 +117,4 b' def listdirs(self, event):' | |||
|
112 | 117 | return [relpath] |
|
113 | 118 | return found |
|
114 | 119 | |
|
115 |
ip.set_hook('complete_command', |
|
|
120 | ip.set_hook('complete_command', cd_completer, str_key = '%cd') No newline at end of file |
General Comments 0
You need to be logged in to leave comments.
Login now