Skip to content

Instantly share code, notes, and snippets.

@ichizok
Created June 5, 2014 17:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ichizok/ff37b16576321b287b0d to your computer and use it in GitHub Desktop.
Save ichizok/ff37b16576321b287b0d to your computer and use it in GitHub Desktop.
diff --git a/src/regexp.c b/src/regexp.c
--- a/src/regexp.c
+++ b/src/regexp.c
@@ -3109,16 +3109,25 @@
if (reg_magic >= MAGIC_OFF)
{
char_u *p = regparse + 1;
-
- /* ignore \c \C \m and \M after '$' */
+ int is_magic_all = (reg_magic == MAGIC_ALL) ? TRUE : FALSE;
+
+ /* ignore \c \C \m \M \v \V and \Z after '$' */
while (p[0] == '\\' && (p[1] == 'c' || p[1] == 'C'
- || p[1] == 'm' || p[1] == 'M' || p[1] == 'Z'))
+ || p[1] == 'm' || p[1] == 'M'
+ || p[1] == 'v' || p[1] == 'V' || p[1] == 'Z'))
+ {
+ if (p[1] == 'v' && is_magic_all != TRUE)
+ is_magic_all = TRUE;
+ else if ((p[1] == 'm' || p[1] == 'M' || p[1] == 'V')
+ && is_magic_all == TRUE)
+ is_magic_all = FALSE;
p += 2;
+ }
if (p[0] == NUL
|| (p[0] == '\\'
&& (p[1] == '|' || p[1] == '&' || p[1] == ')'
|| p[1] == 'n'))
- || reg_magic == MAGIC_ALL)
+ || is_magic_all == TRUE)
curchr = Magic('$');
}
break;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment