summary refs log tree commit diff stats
path: root/ranger
diff options
context:
space:
mode:
authorhut <hut@lepus.uberspace.de>2014-04-11 15:56:50 +0200
committerhut <hut@lepus.uberspace.de>2014-04-11 15:56:50 +0200
commit4217d4e6cfa5ea877b8e29e5dbb9b3f933409721 (patch)
tree3eae44f8a0f8088ce915f996c17ee1b997cc76ba /ranger
parentd807aa384dddd49aada76c124acbfd2bca93fb59 (diff)
downloadranger-4217d4e6cfa5ea877b8e29e5dbb9b3f933409721.tar.gz
Add setting "automatically_count_files"
Diffstat (limited to 'ranger')
-rw-r--r--ranger/config/rc.conf3
-rw-r--r--ranger/container/directory.py10
-rw-r--r--ranger/container/settings.py1
3 files changed, 12 insertions, 2 deletions
diff --git a/ranger/config/rc.conf b/ranger/config/rc.conf
index e5d68926..7487e8be 100644
--- a/ranger/config/rc.conf
+++ b/ranger/config/rc.conf
@@ -41,6 +41,9 @@ set preview_script ~/.config/ranger/scope.sh
 # Use the external preview script or display simple plain text or image previews?
 set use_preview_script true
 
+# Automatically count files in the directory, even before entering them?
+set automatically_count_files false
+
 # Open all images in this directory when running certain image viewers
 # like feh or sxiv?  You can still open selected files by marking them.
 set open_all_images true
diff --git a/ranger/container/directory.py b/ranger/container/directory.py
index b63907db..136cc8ac 100644
--- a/ranger/container/directory.py
+++ b/ranger/container/directory.py
@@ -395,14 +395,20 @@ class Directory(FileSystemObject, Accumulator, Loadable):
     @lazy_property
     def size(self):
         try:
-            size = len(os.listdir(self.path))  # bite me
+            if self.fm.settings.automatically_count_files:
+                size = len(os.listdir(self.path))
+            else:
+                size = None
         except OSError:
             self.infostring = BAD_INFO
             self.accessible = False
             self.runnable = False
             return 0
         else:
-            self.infostring = ' %d' % size
+            if size is None:
+                self.infostring = ''
+            else:
+                self.infostring = ' %d' % size
             self.accessible = True
             self.runnable = True
             return size
diff --git a/ranger/container/settings.py b/ranger/container/settings.py
index 44bd60e0..90b6f7ce 100644
--- a/ranger/container/settings.py
+++ b/ranger/container/settings.py
@@ -9,6 +9,7 @@ import re
 import os.path
 
 ALLOWED_SETTINGS = {
+    'automatically_count_files': bool,
     'autosave_bookmarks': bool,
     'autoupdate_cumulative_size': bool,
     'cd_bookmarks': bool,