diff options
author | hut <hut@lavabit.com> | 2013-02-17 22:28:57 +0100 |
---|---|---|
committer | hut <hut@lavabit.com> | 2013-02-17 22:30:04 +0100 |
commit | a4e8f6e5961e043f059ea1eef9962d970d233591 (patch) | |
tree | a6991c4eead2562e1191260f9c1a39b8c1162307 | |
parent | 0955e44aa3d809c75f6247075d32d0e5e368d622 (diff) | |
download | ranger-a4e8f6e5961e043f059ea1eef9962d970d233591.tar.gz |
config/commands: remove :narrow command
The command :narrow has few use cases, which will be served by a system that'll be implemented at a later point.
-rw-r--r-- | ranger/config/commands.py | 49 |
1 files changed, 0 insertions, 49 deletions
diff --git a/ranger/config/commands.py b/ranger/config/commands.py index 90ca3b65..4c3b3bac 100644 --- a/ranger/config/commands.py +++ b/ranger/config/commands.py @@ -1056,55 +1056,6 @@ class pmap(map_): context = 'pager' -# TODO: Maybe merge this with :find? -class narrow(Command): - """ - :narrow <string> - - Displays only the files which contain <string> in their basename. - Unlike :filter, this command executes the selection and removes the filter - again when run. - """ - - def execute(self): - results = len(self.fm.thisdir.files) - self.cancel() # Clean up - if self.rest(1) == "..": - self.fm.move(left=1) - elif results > 0: - self.fm.move(right=1) - else: - self.fm.cd(self.rest(1)) - - def cancel(self): - self.fm.thisdir.temporary_filter = None - self.fm.thisdir.load_content(schedule=False) - - def quick(self): - self.fm.thisdir.temporary_filter = self.build_regex(self.rest(1)) - self.fm.thisdir.load_content(schedule=False) - - def tab(self): - if self.fm.thisdir.files[-1] is not self.fm.thisfile: - self.fm.move(down=1) - else: - # We're at the bottom, so wrap - self.fm.move(to=0) - - def build_regex(self, arg): - regex = "%s" - if arg.endswith("$"): - arg = arg[:-1] - regex += "$" - if arg.startswith("^"): - arg = arg[1:] - regex = "^" + regex - - case_insensitive = arg.lower() == arg - flags = re.I if case_insensitive else 0 - return re.compile(regex % ".*".join(arg), flags) - - class travel(Command): """ :travel <string> |