import readline
+import rlcompleter
class RainbowCompleter(object):
-
+
def __init__(self, options):
"""
Init
response = None
if state == 0:
if text:
- self.matches = [s
+ self.matches = [s
for s in self.options
if s and s.startswith(text)]
else:
self.matches = self.options[:]
-
+
try:
response = self.matches[state]
except IndexError:
Init the rainbow shell
"""
readline.set_completer(RainbowCompleter(set).complete)
- readline.parse_and_bind('tab: complete')
readline.parse_and_bind('set editing-mode vi')
+ if 'libedit' in readline.__doc__:
+ readline.parse_and_bind("bind ^I rl_complete")
+ else:
+ readline.parse_and_bind("tab: complete")
\ No newline at end of file