summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--ranger/defaults/keys.py1
-rw-r--r--ranger/defaults/options.py1
-rw-r--r--ranger/gui/widgets/browsercolumn.py7
-rw-r--r--ranger/shared/settings.py1
4 files changed, 10 insertions, 0 deletions
diff --git a/ranger/defaults/keys.py b/ranger/defaults/keys.py
index 3a8f4d95..ceff36a7 100644
--- a/ranger/defaults/keys.py
+++ b/ranger/defaults/keys.py
@@ -111,6 +111,7 @@ def initialize_commands(map):
 		"//c//ollapse_preview flush//i//nput")
 	map('bh', fm.toggle_boolean_option('show_hidden'))
 	map('bp', fm.toggle_boolean_option('preview_files'))
+	map('bP', fm.toggle_boolean_option('preview_directories'))
 	map('bi', fm.toggle_boolean_option('flushinput'))
 	map('bd', fm.toggle_boolean_option('directories_first'))
 	map('bc', fm.toggle_boolean_option('collapse_preview'))
diff --git a/ranger/defaults/options.py b/ranger/defaults/options.py
index 5b35a551..74450ba5 100644
--- a/ranger/defaults/options.py
+++ b/ranger/defaults/options.py
@@ -46,6 +46,7 @@ colorscheme = 'default'
 # Preview files on the rightmost column?
 # And collapse the last column if there is nothing to preview?
 preview_files = True
+preview_directories = True
 max_filesize_for_preview = 300 * 1024  # 300kb
 collapse_preview = True
 
diff --git a/ranger/gui/widgets/browsercolumn.py b/ranger/gui/widgets/browsercolumn.py
index bcc48cd1..ed6b26d1 100644
--- a/ranger/gui/widgets/browsercolumn.py
+++ b/ranger/gui/widgets/browsercolumn.py
@@ -108,6 +108,10 @@ class BrowserColumn(Pager):
 			if not self._preview_this_file(self.target):
 				return False
 
+		if self.target.is_directory:
+			if not self.settings.preview_directories:
+				return False
+
 		return True
 
 	def poke(self):
@@ -173,6 +177,9 @@ class BrowserColumn(Pager):
 		"""Draw the contents of a directory"""
 		import stat
 
+		if self.level > 0 and not self.settings.preview_directories:
+			return
+
 		base_color = ['in_browser']
 
 		self.target.use()
diff --git a/ranger/shared/settings.py b/ranger/shared/settings.py
index 7d67d83d..63d6d59a 100644
--- a/ranger/shared/settings.py
+++ b/ranger/shared/settings.py
@@ -34,6 +34,7 @@ ALLOWED_SETTINGS = {
 	'max_history_size': (int, type(None)),
 	'scroll_offset': int,
 	'preview_files': bool,
+	'preview_directories': bool,
 	'flushinput': bool,
 	'colorscheme': str,
 	'hidden_filter': lambda x: isinstance(x, str) or hasattr(x, 'match'),