diff options
-rw-r--r-- | ranger/actions.py | 19 | ||||
-rw-r--r-- | ranger/defaults/keys.py | 3 |
2 files changed, 22 insertions, 0 deletions
diff --git a/ranger/actions.py b/ranger/actions.py index 604be298..c4b75aca 100644 --- a/ranger/actions.py +++ b/ranger/actions.py @@ -334,6 +334,25 @@ class Actions(EnvironmentAware, SettingsAware): cwd.unload() cwd.load_content() + def traverse(self): + cf = self.env.cf + cwd = self.env.pwd + if cf is not None and cf.is_directory: + self.enter_dir(cf.path) + elif cwd.pointer >= len(cwd) - 1: + while True: + self.enter_dir('..') + cwd = self.env.pwd + if cwd.pointer < len(cwd) - 1: + break + if cwd.path == '/': + break + self.move_pointer(1) + self.traverse() + else: + self.move_pointer(1) + self.traverse() + def set_filter(self, fltr): try: self.env.pwd.filter = fltr diff --git a/ranger/defaults/keys.py b/ranger/defaults/keys.py index 89dd3d98..f5b2275f 100644 --- a/ranger/defaults/keys.py +++ b/ranger/defaults/keys.py @@ -60,6 +60,9 @@ def initialize_commands(command_list): bind(ctrl('d'), fm.move_pointer_by_pages(0.5)) bind(ctrl('u'), fm.move_pointer_by_pages(-0.5)) + bind(']', fm.traverse()) + bind('[', fm.history_go(-1)) + # --------------------------------------------------------- history bind('H', fm.history_go(-1)) bind('L', fm.history_go(1)) |