|
From: | Eduardo Suarez-Santana |
Subject: | Re: [Ranger-users] explorer mode |
Date: | Tue, 30 Oct 2012 17:59:47 +0000 |
User-agent: | Mozilla/5.0 (X11; Linux i686; rv:10.0.7) Gecko/20120824 Thunderbird/10.0.7 |
On 26/10/12 19:53, Joshua Landau wrote:
On 25 October 2012 11:08, Eduardo Suarez-Santana <address@hidden> wrote:This is almost the same, but using 'startswith' instead of 'count'. I also changed the dot behavior to '..'. In rc.conf (very important whitespace at the end): map e console explorer In commands.py: class explorer(Command): """ :explorer <string> Enters Explorer Mode. Press Esc or Ctrl-C to exit Explorer Mode """ special = False def execute(self): self.fm.set_filter("") self.fm.reload_cwd() if self.special: self.fm.cd(self.special) if self.special != "..": self.fm.block_input(0.5) self.special = False else: self.fm.move(right=1) self.fm.open_console('explorer ') def cancel(self): self.fm.set_filter("") self.fm.reload_cwd() def quick(self): arg = self.rest(1) self.fm.set_filter(arg) self.fm.reload_cwd() if arg == ".": self.special = ".." return self.execute() filtered_files = [d for d in self.fm.env.cwd.files if d.basename.startswith(arg)] if len(filtered_files)==1: self.special = filtered_files[0].basename return self.execute() def tab(self): if self.fm.env.cwd.files[-1] is not self.fm.env.cf: self.fm.move(down=1) else: self.fm.move(to=0) |
[Prev in Thread] | Current Thread | [Next in Thread] |