about summary refs log tree commit diff stats
path: root/ranger
diff options
context:
space:
mode:
Diffstat (limited to 'ranger')
-rwxr-xr-xranger/config/commands.py17
1 files changed, 17 insertions, 0 deletions
diff --git a/ranger/config/commands.py b/ranger/config/commands.py
index 5af41723..deda44bd 100755
--- a/ranger/config/commands.py
+++ b/ranger/config/commands.py
@@ -571,6 +571,23 @@ class setlocal(setinpath):
     pass
 
 
+class setinregex(_setlocal):
+    """:setinregex re=<regex> <option name>=<python expression>
+
+    Sets an option when in a specific directory. If the <regex> contains
+    whitespace it needs to be quoted and nested quotes need to be
+    backslash-escaped. Special characters need to be escaped if they are
+    intended to match literally as documented in the ``re`` library
+    documentation. The "re" argument can also be named "regex" or "pattern,"
+    which allows for easier switching with ``setinpath``.
+    """
+    def _arg(self):
+        return "(?:re(?:gex)?|pattern)"
+
+    def _format_arg(self, arg):
+        return arg
+
+
 class setintag(set_):
     """:setintag <tag or tags> <option name>=<option value>