summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--doc/ranger.15
-rw-r--r--doc/ranger.pod5
-rw-r--r--ranger/defaults/commands.py3
3 files changed, 7 insertions, 6 deletions
diff --git a/doc/ranger.1 b/doc/ranger.1
index 406297bd..6cc2b5e4 100644
--- a/doc/ranger.1
+++ b/doc/ranger.1
@@ -565,9 +565,8 @@ Quit ranger.  The current directory will be bookmarked as ' so you can re-enter
 it by typing `` or '' the next time you start ranger.
 .IP "rename \fInewname\fR" 2
 .IX Item "rename newname"
-Rename the current file.  If a file with that name already exists, it will be
-overwritten without notice.  Also try the key binding A for appending something
-to a file name.
+Rename the current file.  If a file with that name already exists, the renaming
+will fail.  Also try the key binding A for appending something to a file name.
 .IP "save_copy_buffer" 2
 .IX Item "save_copy_buffer"
 Save the copy buffer from \fI~/.config/ranger/copy_buffer\fR.  This can be used to
diff --git a/doc/ranger.pod b/doc/ranger.pod
index 8f6cc62a..f6dbdb60 100644
--- a/doc/ranger.pod
+++ b/doc/ranger.pod
@@ -592,9 +592,8 @@ it by typing `` or '' the next time you start ranger.
 
 =item rename I<newname>
 
-Rename the current file.  If a file with that name already exists, it will be
-overwritten without notice.  Also try the key binding A for appending something
-to a file name.
+Rename the current file.  If a file with that name already exists, the renaming
+will fail.  Also try the key binding A for appending something to a file name.
 
 =item save_copy_buffer
 
diff --git a/ranger/defaults/commands.py b/ranger/defaults/commands.py
index a96c842c..3327c221 100644
--- a/ranger/defaults/commands.py
+++ b/ranger/defaults/commands.py
@@ -647,6 +647,9 @@ class rename(Command):
 		if not new_name:
 			return self.fm.notify('Syntax: rename <newname>', bad=True)
 
+		if new_name == self.fm.env.cf.basename:
+			return
+
 		if access(new_name, os.F_OK):
 			return self.fm.notify("Can't rename: file already exists!", bad=True)