Show More
@@ -45,14 +45,19 b' def apt_completers(self, event):' | |||||
45 | ip.set_hook('complete_command', apt_completers, re_key = '.*apt-get') |
|
45 | ip.set_hook('complete_command', apt_completers, re_key = '.*apt-get') | |
46 | ip.set_hook('complete_command', apt_completers, re_key = '.*yum') |
|
46 | ip.set_hook('complete_command', apt_completers, re_key = '.*yum') | |
47 |
|
47 | |||
|
48 | pkg_cache = None | |||
|
49 | ||||
48 | def module_completer(self,event): |
|
50 | def module_completer(self,event): | |
49 | """ Give completions after user has typed 'import' """ |
|
51 | """ Give completions after user has typed 'import' """ | |
50 |
|
52 | |||
|
53 | global pkg_cache | |||
51 | import pkgutil,imp,time |
|
54 | import pkgutil,imp,time | |
52 | for ld, name, ispkg in pkgutil.walk_packages(): |
|
55 | #current = | |
53 | if ispkg: |
|
56 | if pkg_cache is None: | |
54 | yield name + '.' |
|
57 | print "\n\n[Standby while scanning modules, this can take a while]\n\n" | |
55 | else: |
|
58 | pkg_cache = list(pkgutil.walk_packages()) | |
|
59 | ||||
|
60 | for ld, name, ispkg in pkg_cache: | |||
56 |
|
|
61 | yield name | |
57 | return |
|
62 | return | |
58 |
|
63 | |||
@@ -89,7 +94,7 b' def runlistpy(self, event):' | |||||
89 |
|
94 | |||
90 | ip.set_hook('complete_command', runlistpy, str_key = '%run') |
|
95 | ip.set_hook('complete_command', runlistpy, str_key = '%run') | |
91 |
|
96 | |||
92 |
def |
|
97 | def cd_completer(self, event): | |
93 | relpath = event.symbol |
|
98 | relpath = event.symbol | |
94 |
|
99 | |||
95 | if '-b' in event.line: |
|
100 | if '-b' in event.line: | |
@@ -112,4 +117,4 b' def listdirs(self, event):' | |||||
112 | return [relpath] |
|
117 | return [relpath] | |
113 | return found |
|
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