From a4e8f6e5961e043f059ea1eef9962d970d233591 Mon Sep 17 00:00:00 2001 From: hut Date: Sun, 17 Feb 2013 22:28:57 +0100 Subject: 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. --- ranger/config/commands.py | 49 ----------------------------------------------- 1 file changed, 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 - - Displays only the files which contain 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 -- cgit 1.4.1-2-gfad0 e='qt'>
blob: 6666563198e154286a550f6ff82779978f9210ac (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27