diff options
author | Bram Moolenaar <Bram@vim.org> | 2013-03-07 16:32:54 +0100 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2013-03-07 16:32:54 +0100 |
commit | 60abe75379f8b7c2076856c5f12ce2e7650110f6 (patch) | |
tree | 687ecaf2a2000b31cd2aa332861c581b9c4fda4a | |
parent | c389fd3a49c01674960fe2153af2f6e42b316c61 (diff) | |
download | vim-git-60abe75379f8b7c2076856c5f12ce2e7650110f6.tar.gz |
updated for version 7.3.850v7.3.850
Problem: ":vimgrep //" matches everywhere.
Solution: Make it use the previous search pattern. (David Bürgin)
-rw-r--r-- | runtime/doc/quickfix.txt | 2 | ||||
-rw-r--r-- | src/quickfix.c | 15 | ||||
-rw-r--r-- | src/version.c | 2 |
3 files changed, 18 insertions, 1 deletions
diff --git a/runtime/doc/quickfix.txt b/runtime/doc/quickfix.txt index 9dd3baae0..4738be0c2 100644 --- a/runtime/doc/quickfix.txt +++ b/runtime/doc/quickfix.txt @@ -574,6 +574,8 @@ commands can be combined to create a NewGrep command: > 'ignorecase' applies. To overrule it put |/\c| in the pattern to ignore case or |/\C| to match case. 'smartcase' is not used. + If {pattern} is empty (e.g. // is specified), the last + used search pattern is used. |last-pattern| When a number is put before the command this is used as the maximum number of matches to find. Use diff --git a/src/quickfix.c b/src/quickfix.c index 2f8155a4c..0de6fe0b1 100644 --- a/src/quickfix.c +++ b/src/quickfix.c @@ -3179,7 +3179,20 @@ ex_vimgrep(eap) EMSG(_(e_invalpat)); goto theend; } - regmatch.regprog = vim_regcomp(s, RE_MAGIC); + + if (s != NULL && *s == NUL) + { + /* Pattern is empty, use last search pattern. */ + if (last_search_pat() == NULL) + { + EMSG(_(e_noprevre)); + goto theend; + } + regmatch.regprog = vim_regcomp(last_search_pat(), RE_MAGIC); + } + else + regmatch.regprog = vim_regcomp(s, RE_MAGIC); + if (regmatch.regprog == NULL) goto theend; regmatch.rmm_ic = p_ic; diff --git a/src/version.c b/src/version.c index 9b90b51e6..b4234e0a3 100644 --- a/src/version.c +++ b/src/version.c @@ -729,6 +729,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ /**/ + 850, +/**/ 849, /**/ 848, |