diff options
author | hut <hut@lepus.uberspace.de> | 2015-01-01 22:26:49 +0100 |
---|---|---|
committer | hut <hut@lepus.uberspace.de> | 2015-01-01 22:26:49 +0100 |
commit | 7248023cbe8e0778468b0713ca188657bdf492ff (patch) | |
tree | 6f2160dd6cdc7c073f715d5a5d77279618fd04b1 | |
parent | 2ec8ec54cfc968dc03cb0078f24c5a668a0864cd (diff) | |
parent | 30212099f0055f3cb9906457415c34e83ea4fa28 (diff) | |
download | ranger-7248023cbe8e0778468b0713ca188657bdf492ff.tar.gz |
Merge branch 'rename_append' of https://github.com/NoSuck/ranger
-rw-r--r-- | ranger/config/commands.py | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/ranger/config/commands.py b/ranger/config/commands.py index c496f71e..a8813de2 100644 --- a/ranger/config/commands.py +++ b/ranger/config/commands.py @@ -722,18 +722,18 @@ class rename(Command): def tab(self): return self._tab_directory_content() -class renameConsole(Command): - """:renameConsole +class rename_append(Command): + """:rename_append Creates an open_console for the rename command, automatically placing the cursor before the file extension. """ def execute(self): - if "." in self.fm.thisfile.basename: - offset = 6 + len(self.fm.thisfile.basename) - self.fm.thisfile.basename[::-1].index('.') - self.fm.open_console('rename ' + self.fm.thisfile.basename, position=offset) + cf = self.fm.thisfile + if cf.basename.find('.') != 0 and cf.basename.rfind('.') != -1 and not cf.is_directory: + self.fm.open_console('rename ' + cf.basename, position=(7 + cf.basename.rfind('.'))) else: - self.fm.open_console('rename ' + self.fm.thisfile.basename) + self.fm.open_console('rename ' + cf.basename) class chmod(Command): """:chmod <octal number> |