summary refs log tree commit diff stats
path: root/ranger
diff options
context:
space:
mode:
authorhut <hut@lepus.uberspace.de>2014-08-26 22:43:28 +0200
committerhut <hut@lepus.uberspace.de>2014-08-26 22:58:57 +0200
commit207cafb045e8288b0f91df1528b9edb2a2c31971 (patch)
treeeb43936b88311e98c796a023f2c6aaa5117598aa /ranger
parentdc4216a55e80361177675118944a69514618f6c9 (diff)
downloadranger-207cafb045e8288b0f91df1528b9edb2a2c31971.tar.gz
container.directory: implemented random sorting
Diffstat (limited to 'ranger')
-rw-r--r--ranger/config/rc.conf3
-rw-r--r--ranger/container/directory.py2
2 files changed, 4 insertions, 1 deletions
diff --git a/ranger/config/rc.conf b/ranger/config/rc.conf
index 5b274657..b2cc9307 100644
--- a/ranger/config/rc.conf
+++ b/ranger/config/rc.conf
@@ -147,7 +147,7 @@ set autoupdate_cumulative_size false
 # Turning this on makes sense for screen readers:
 set show_cursor false
 
-# One of: size, basename, mtime, type
+# One of: size, natural, basename, atime, ctime, mtime, type, random
 set sort natural
 
 # Additional sorting options
@@ -373,6 +373,7 @@ map <a-9>     tab_open 9
 
 # Sorting
 map or toggle_option sort_reverse
+map oz set sort=random
 map os chain set sort=size;      set sort_reverse=False
 map ob chain set sort=basename;  set sort_reverse=False
 map on chain set sort=natural;   set sort_reverse=False
diff --git a/ranger/container/directory.py b/ranger/container/directory.py
index 07b2192d..de69c467 100644
--- a/ranger/container/directory.py
+++ b/ranger/container/directory.py
@@ -2,6 +2,7 @@
 # This software is distributed under the terms of the GNU GPL version 3.
 
 import os.path
+import random
 import re
 
 from os import stat as os_stat, lstat as os_lstat
@@ -81,6 +82,7 @@ class Directory(FileSystemObject, Accumulator, Loadable):
         'mtime': lambda path: -(path.stat and path.stat.st_mtime or 1),
         'ctime': lambda path: -(path.stat and path.stat.st_ctime or 1),
         'atime': lambda path: -(path.stat and path.stat.st_atime or 1),
+        'random': lambda path: random.random(),
         'type': lambda path: path.mimetype or '',
     }