summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--doc/ranger.17
-rw-r--r--doc/ranger.pod6
-rw-r--r--ranger/config/commands.py7
-rw-r--r--ranger/config/rc.conf5
-rw-r--r--ranger/container/settingobject.py1
5 files changed, 23 insertions, 3 deletions
diff --git a/doc/ranger.1 b/doc/ranger.1
index 7bf542fd..194b81b6 100644
--- a/doc/ranger.1
+++ b/doc/ranger.1
@@ -124,7 +124,7 @@
 .\" ========================================================================
 .\"
 .IX Title "RANGER 1"
-.TH RANGER 1 "ranger-1.5.5" "12/03/2012" "ranger manual"
+.TH RANGER 1 "ranger-1.5.5" "12/06/2012" "ranger manual"
 .\" For nroff, turn off justification.  Always turn off hyphenation; it makes
 .\" way too many mistakes in technical documents.
 .if n .ad l
@@ -570,6 +570,11 @@ blue directories with green ones for better visibility on certain terminals.
 How many columns are there, and what are their relative widths?  For example, a
 value of 1,1,1 would mean 3 evenly sized columns. 1,1,1,1,4 means 5 columns
 with the preview column being as large as the other columns combined.
+.IP "confirm_on_delete [string]" 4
+.IX Item "confirm_on_delete [string]"
+Ask for a confirmation when running the \*(L"delete\*(R" command?  Valid values are
+\&\*(L"always\*(R" (default), \*(L"never\*(R", \*(L"multiple\*(R". With \*(L"multiple\*(R", ranger will ask only
+if you delete multiple files at once.
 .IP "dirname_in_tabs [bool]" 4
 .IX Item "dirname_in_tabs [bool]"
 Display the directory name in tabs?
diff --git a/doc/ranger.pod b/doc/ranger.pod
index f8ba66b1..e240771e 100644
--- a/doc/ranger.pod
+++ b/doc/ranger.pod
@@ -547,6 +547,12 @@ How many columns are there, and what are their relative widths?  For example, a
 value of 1,1,1 would mean 3 evenly sized columns. 1,1,1,1,4 means 5 columns
 with the preview column being as large as the other columns combined.
 
+=item confirm_on_delete [string]
+
+Ask for a confirmation when running the "delete" command?  Valid values are
+"always" (default), "never", "multiple". With "multiple", ranger will ask only
+if you delete multiple files at once.
+
 =item dirname_in_tabs [bool]
 
 Display the directory name in tabs?
diff --git a/ranger/config/commands.py b/ranger/config/commands.py
index 4a2bb912..489f2426 100644
--- a/ranger/config/commands.py
+++ b/ranger/config/commands.py
@@ -487,8 +487,11 @@ class delete(Command):
 		cwd = self.fm.thisdir
 		cf = self.fm.thisfile
 
-		if cwd.marked_items or (cf.is_directory and not cf.is_link \
-				and len(os.listdir(cf.path)) > 0):
+		confirm = self.fm.settings.confirm_on_delete
+		many_files = (cwd.marked_items or (cf.is_directory and not cf.is_link \
+				and len(os.listdir(cf.path)) > 0))
+
+		if confirm != 'never' and (confirm != 'multiple' or many_files):
 			# better ask for a confirmation, when attempting to
 			# delete multiple files or a non-empty directory.
 			return self.fm.open_console(DELETE_WARNING)
diff --git a/ranger/config/rc.conf b/ranger/config/rc.conf
index 2a6be5d8..88e242fd 100644
--- a/ranger/config/rc.conf
+++ b/ranger/config/rc.conf
@@ -30,6 +30,11 @@ set hidden_filter ^\.|\.(?:pyc|pyo|bak|swp)$|^lost\+found$|^__(py)?cache__$
 # Show hidden files? You can toggle this by typing 'zh'
 set show_hidden false
 
+# Ask for a confirmation when running the "delete" command?
+# Valid values are "always" (default), "never", "multiple"
+# With "multiple", ranger will ask only if you delete multiple files at once.
+set confirm_on_delete multiple
+
 # Which script is used to generate file previews?
 # ranger ships with scope.sh, a script that calls external programs (see
 # README for dependencies) to preview images, archives, etc.
diff --git a/ranger/container/settingobject.py b/ranger/container/settingobject.py
index 70eac7b5..780b6365 100644
--- a/ranger/container/settingobject.py
+++ b/ranger/container/settingobject.py
@@ -12,6 +12,7 @@ ALLOWED_SETTINGS = {
 	'collapse_preview': bool,
 	'colorscheme': str,
 	'column_ratios': (tuple, list),
+	'confirm_on_delete': str,
 	'dirname_in_tabs': bool,
 	'display_size_in_main_column': bool,
 	'display_size_in_status_bar': bool,