summary refs log tree commit diff stats
path: root/ranger
diff options
context:
space:
mode:
authorhut <hut@lepus.uberspace.de>2015-11-16 23:14:25 +0100
committerhut <hut@lepus.uberspace.de>2015-11-16 23:16:56 +0100
commit47f34c1bd5d14a28ffd128b4f22689e626e24c1e (patch)
tree4033485ec48bf928080ac0eeed4d907b0b5d108b /ranger
parent55567184364d22d7c43d7413c62ef73130d940e9 (diff)
downloadranger-47f34c1bd5d14a28ffd128b4f22689e626e24c1e.tar.gz
config/rc.conf: do s/%/%%/ in filenames for a/A/I keys
This is so you can use those keys on filenames like "Foo%sBar" without
ranger trying to expand the macro %s when you press enter, resulting in
the name "FooFoo%sBarBar".

Fixes #417
Diffstat (limited to 'ranger')
-rw-r--r--ranger/config/commands.py4
-rw-r--r--ranger/config/rc.conf4
2 files changed, 4 insertions, 4 deletions
diff --git a/ranger/config/commands.py b/ranger/config/commands.py
index 13b6a50c..a834278d 100644
--- a/ranger/config/commands.py
+++ b/ranger/config/commands.py
@@ -778,9 +778,9 @@ class rename_append(Command):
     def execute(self):
         cf = self.fm.thisfile
         if cf.relative_path.find('.') != 0 and cf.relative_path.rfind('.') != -1 and not cf.is_directory:
-            self.fm.open_console('rename ' + cf.relative_path, position=(7 + cf.relative_path.rfind('.')))
+            self.fm.open_console('rename ' + cf.relative_path.replace("%", "%%"), position=(7 + cf.relative_path.rfind('.')))
         else:
-            self.fm.open_console('rename ' + cf.relative_path)
+            self.fm.open_console('rename ' + cf.relative_path.replace("%", "%%"))
 
 class chmod(Command):
     """:chmod <octal number>
diff --git a/ranger/config/rc.conf b/ranger/config/rc.conf
index b2965cdc..d1bad101 100644
--- a/ranger/config/rc.conf
+++ b/ranger/config/rc.conf
@@ -339,8 +339,8 @@ map =  chmod
 
 map cw console rename%space
 map a  rename_append
-map A  eval fm.open_console('rename ' + fm.thisfile.relative_path)
-map I  eval fm.open_console('rename ' + fm.thisfile.relative_path, position=7)
+map A  eval fm.open_console('rename ' + fm.thisfile.relative_path.replace("%", "%%"))
+map I  eval fm.open_console('rename ' + fm.thisfile.relative_path.replace("%", "%%"), position=7)
 
 map pp paste
 map po paste overwrite=True