diff options
-rw-r--r-- | ranger/api/commands.py | 11 | ||||
-rw-r--r-- | ranger/config/commands.py | 3 |
2 files changed, 14 insertions, 0 deletions
diff --git a/ranger/api/commands.py b/ranger/api/commands.py index 8e7e16ac..4a9688a0 100644 --- a/ranger/api/commands.py +++ b/ranger/api/commands.py @@ -271,6 +271,17 @@ class Command(FileManagerAware): # manually type in the slash to advance into that directory return (self.start(1) + join(rel_dirname, name) for name in names) + def _tab_through_executables(self): + from ranger.ext.get_executables import get_executables + programs = [program for program in get_executables() if \ + program.startswith(self.rest(1))] + if not programs: + return + if len(programs) == 1: + return self.start(1) + programs[0] + programs.sort() + return (self.start(1) + program for program in programs) + class FunctionCommand(Command): _based_function = None diff --git a/ranger/config/commands.py b/ranger/config/commands.py index bc6e674c..74d306e8 100644 --- a/ranger/config/commands.py +++ b/ranger/config/commands.py @@ -243,6 +243,9 @@ class open_with(Command): flags = flags, mode = mode) + def tab(self): + return self._tab_through_executables() + def _get_app_flags_mode(self, string): """ Extracts the application, flags and mode from a string. |