diff options
Diffstat (limited to 'src/nvim/regexp.c')
| -rw-r--r-- | src/nvim/regexp.c | 18 | 
1 files changed, 15 insertions, 3 deletions
| diff --git a/src/nvim/regexp.c b/src/nvim/regexp.c index 193c68860d..90da02bb1b 100644 --- a/src/nvim/regexp.c +++ b/src/nvim/regexp.c @@ -2790,17 +2790,29 @@ static int peekchr(void)         * either "\|", "\)", "\&", or "\n" */        if (reg_magic >= MAGIC_OFF) {          char_u *p = regparse + 1; +        bool is_magic_all = (reg_magic == MAGIC_ALL); -        /* ignore \c \C \m and \M after '$' */ +        // 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; +          } else if (p[1] == 'm' || p[1] == 'M' || p[1] == 'V') { +            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 +                && (p[0] == '|' || p[0] == '&' || p[0] == ')')) +            || reg_magic == MAGIC_ALL) {            curchr = Magic('$'); +        }        }        break;      case '\\': | 
