about summary refs log tree commit diff stats
path: root/ranger
diff options
context:
space:
mode:
authorchu4ng <shichuang@horsefucker.org>2021-01-22 03:25:53 +0300
committerchu4ng <shichuang@horsefucker.org>2021-01-22 03:25:53 +0300
commit29a3b98930eabd72e3b65683e1c7f709465d0e25 (patch)
tree4f326af4401ad925c3abd30cc372989463486c1c /ranger
parent290c1f5f0d755fb667e7c6ca8c613110af6dfb11 (diff)
downloadranger-29a3b98930eabd72e3b65683e1c7f709465d0e25.tar.gz
Set argument from '-s' flag as key character.
Diffstat (limited to 'ranger')
-rwxr-xr-xranger/config/commands.py14
1 files changed, 8 insertions, 6 deletions
diff --git a/ranger/config/commands.py b/ranger/config/commands.py
index 41bf906a..3f7fc57d 100755
--- a/ranger/config/commands.py
+++ b/ranger/config/commands.py
@@ -828,32 +828,34 @@ class mark_tag(Command):
 
 
 class console(Command):
-    """:console [-p N] [-s] <command>
+    """:console [-p N] [-s sep] <command>
 
     Flags:
      -p N   Set position at N index
-     -s     Set postion at '^&'
+     -s sep Set position at separator(any char[s] sequence), example '#'
     Open the console with the given command.
     """
 
     def execute(self):
         position = None
-        command = self.rest(2)
+        command = ""
         if self.arg(1)[0:2] == '-p':
+            command = self.rest(2)
             try:
                 position = int(self.arg(1)[2:])
             except ValueError:
                 pass
         elif self.arg(1)[0:2] == '-s':
-            position = command.find('^&')
+            command = self.rest(3)
+            separate = self.arg(2)
+            position = command.find(separate)
             if position != -1:
-                command = command.replace('^&', '')
+                command = command.replace(separate, '')
             else:
                 position = None
         self.fm.open_console(command, position=position)
 
 
-
 class load_copy_buffer(Command):
     """:load_copy_buffer