patch 8.2.2215: Vim9: not recognized in global command
Problem: Vim9: not recognized in global command.
Solution: Skip over pattern. (issue #7541)
diff --git a/src/vim9compile.c b/src/vim9compile.c
index 53a6105..b035333 100644
--- a/src/vim9compile.c
+++ b/src/vim9compile.c
@@ -2947,7 +2947,7 @@
}
/*
- * parse a lambda: {arg, arg -> expr}
+ * parse a lambda: "{arg, arg -> expr}" or "(arg, arg) => expr"
* "*arg" points to the '{'.
*/
static int
@@ -7315,6 +7315,19 @@
eap->arg = skiptowhite(eap->arg);
}
+ if ((eap->cmdidx == CMD_global || eap->cmdidx == CMD_vglobal)
+ && STRLEN(eap->arg) > 4)
+ {
+ int delim = *eap->arg;
+
+ p = skip_regexp_ex(eap->arg + 1, delim, TRUE, NULL, NULL);
+ if (*p == delim)
+ {
+ eap->arg = p + 1;
+ has_expr = TRUE;
+ }
+ }
+
if (has_expr && (p = (char_u *)strstr((char *)eap->arg, "`=")) != NULL)
{
int count = 0;