about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authortoonn <toonn@toonn.io>2018-09-06 15:33:00 +0200
committertoonn <toonn@toonn.io>2018-09-06 15:33:00 +0200
commitf12b7fc43fa1420b016e06be76f306d6a2834a8b (patch)
tree870d1e9e0b4ee8090945fb7c6fa4e6a8f8b73dc0
parentcc6d9a0b19d250215b822342436e8e81e71c4b4d (diff)
parent07cc58396035d1c25871632d8ee14cad08dbe69a (diff)
downloadranger-f12b7fc43fa1420b016e06be76f306d6a2834a8b.tar.gz
Merge branch 'anypathmacro'
-rw-r--r--ranger/core/actions.py19
1 files changed, 17 insertions, 2 deletions
diff --git a/ranger/core/actions.py b/ranger/core/actions.py
index 83cfcc08..73c9fa51 100644
--- a/ranger/core/actions.py
+++ b/ranger/core/actions.py
@@ -240,10 +240,25 @@ class Actions(  # pylint: disable=too-many-instance-attributes,too-many-public-m
         cmd = cmd_class(string, quantifier=quantifier)
 
         if cmd.resolve_macros and _MacroTemplate.delimiter in cmd.line:
-            macros = dict(('any%d' % i, key_to_string(char))
-                          for i, char in enumerate(wildcards if wildcards is not None else []))
+            def any_macro(i, char):
+                return ('any{:d}'.format(i), key_to_string(char))
+
+            def anypath_macro(i, char):
+                try:
+                    val = self.fm.bookmarks[key_to_string(char)]
+                except KeyError:
+                    self.notify('No bookmark defined for `{}`'.format(
+                        key_to_string(char)), bad=True)
+                    val = MACRO_FAIL
+                return ('any_path{:d}'.format(i), val)
+
+            macros = dict(f(i, char) for f in (any_macro, anypath_macro)
+                          for i, char in enumerate(wildcards if wildcards
+                                                   is not None else []))
             if 'any0' in macros:
                 macros['any'] = macros['any0']
+                if 'any_path0' in macros:
+                    macros['any_path'] = macros['any_path0']
             try:
                 line = self.substitute_macros(cmd.line, additional=macros,
                                               escape=cmd.escape_macros_for_shell)
rtik/mu/commit/test_layers?h=hlt&id=1baa04dbd4c77d18b906fd185c762f613b36baa0'>1baa04db ^
6e1eeeeb ^
d9ee2076 ^
f902aa09 ^
4ba60f35 ^
51858e5d ^

6e1eeeeb ^
6e1eeeeb ^
9e5e87ca ^

6e1eeeeb ^


fd91f7f6 ^
6e1eeeeb ^


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32