summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorCaleb Bassi <calebjbassi@gmail.com>2018-03-23 11:55:01 -0700
committerCaleb Bassi <calebjbassi@gmail.com>2018-03-29 16:36:25 -0700
commitd6f477e64a1ef78dc8d752597a05912484ef6dc9 (patch)
treeb26021ed55712871d724d5f02d20c14120b506b3
parentf855979587bd918f0d32c0caba79ab4b4aa531cf (diff)
downloadranger-d6f477e64a1ef78dc8d752597a05912484ef6dc9.tar.gz
Add traverse_backwards command
* bound to { by default
-rw-r--r--ranger/config/rc.conf1
-rw-r--r--ranger/core/actions.py17
2 files changed, 18 insertions, 0 deletions
diff --git a/ranger/config/rc.conf b/ranger/config/rc.conf
index fe00c7c0..772ce20e 100644
--- a/ranger/config/rc.conf
+++ b/ranger/config/rc.conf
@@ -378,6 +378,7 @@ map L     history_go 1
 map ]     move_parent 1
 map [     move_parent -1
 map }     traverse
+map {     traverse_backwards
 map )     jump_non
 
 map gh cd ~
diff --git a/ranger/core/actions.py b/ranger/core/actions.py
index 6bbb35aa..68b362b9 100644
--- a/ranger/core/actions.py
+++ b/ranger/core/actions.py
@@ -605,6 +605,23 @@ class Actions(  # pylint: disable=too-many-instance-attributes,too-many-public-m
             self.move(down=1)
             self.traverse()
 
+    def traverse_backwards(self):
+        self.change_mode('normal')
+        if self.thisdir.pointer == 0:
+            self.move(left=1)
+            if self.thisdir.pointer != 0:
+                self.traverse_backwards()
+        else:
+            self.move(up=1)
+            while True:
+                if self.thisfile is not None and self.thisfile.is_directory:
+                    self.enter_dir(self.thisfile.path)
+                    self.move(to=100, percentage=True)
+                elif self.thisdir.pointer == 0:
+                    break
+                else:
+                    self.move(up=1)
+
     # --------------------------
     # -- Shortcuts / Wrappers
     # --------------------------