summaryrefslogtreecommitdiff
path: root/src/quickfix.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2013-03-07 16:32:54 +0100
committerBram Moolenaar <Bram@vim.org>2013-03-07 16:32:54 +0100
commit60abe75379f8b7c2076856c5f12ce2e7650110f6 (patch)
tree687ecaf2a2000b31cd2aa332861c581b9c4fda4a /src/quickfix.c
parentc389fd3a49c01674960fe2153af2f6e42b316c61 (diff)
downloadvim-git-7.3.850.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)
Diffstat (limited to 'src/quickfix.c')
-rw-r--r--src/quickfix.c15
1 files changed, 14 insertions, 1 deletions
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;