about summary refs log tree commit diff stats
path: root/ranger
diff options
context:
space:
mode:
authorchu4ng <shichuang@horsefucker.org>2021-01-22 02:27:13 +0300
committerchu4ng <shichuang@horsefucker.org>2021-01-22 02:27:13 +0300
commit290c1f5f0d755fb667e7c6ca8c613110af6dfb11 (patch)
tree516af88510ab2dce462cf310e13849b739e3ffe7 /ranger
parent73bcd80c1c3e721391c75015cb4ec03532357ad9 (diff)
downloadranger-290c1f5f0d755fb667e7c6ca8c613110af6dfb11.tar.gz
Added -s flag for set position by char seq '^&'.
Diffstat (limited to 'ranger')
-rwxr-xr-xranger/config/commands.py15
1 files changed, 12 insertions, 3 deletions
diff --git a/ranger/config/commands.py b/ranger/config/commands.py
index 9031e7a2..41bf906a 100755
--- a/ranger/config/commands.py
+++ b/ranger/config/commands.py
@@ -828,21 +828,30 @@ class mark_tag(Command):
 
 
 class console(Command):
-    """:console <command>
+    """:console [-p N] [-s] <command>
 
+    Flags:
+     -p N   Set position at N index
+     -s     Set postion at '^&'
     Open the console with the given command.
     """
 
     def execute(self):
         position = None
+        command = self.rest(2)
         if self.arg(1)[0:2] == '-p':
             try:
                 position = int(self.arg(1)[2:])
             except ValueError:
                 pass
+        elif self.arg(1)[0:2] == '-s':
+            position = command.find('^&')
+            if position != -1:
+                command = command.replace('^&', '')
             else:
-                self.shift()
-        self.fm.open_console(self.rest(1), position=position)
+                position = None
+        self.fm.open_console(command, position=position)
+
 
 
 class load_copy_buffer(Command):