From 47f34c1bd5d14a28ffd128b4f22689e626e24c1e Mon Sep 17 00:00:00 2001 From: hut Date: Mon, 16 Nov 2015 23:14:25 +0100 Subject: 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 --- ranger/config/commands.py | 4 ++-- ranger/config/rc.conf | 4 ++-- 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 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 -- cgit 1.4.1-2-gfad0