0
0
mirror of https://github.com/vim/vim.git synced 2025-09-23 03:43:49 -04:00

updated for version 7.3.850

Problem:    ":vimgrep //" matches everywhere.
Solution:   Make it use the previous search pattern. (David Bürgin)
This commit is contained in:
Bram Moolenaar
2013-03-07 16:32:54 +01:00
parent c389fd3a49
commit 60abe75379
3 changed files with 18 additions and 1 deletions

View File

@@ -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

View File

@@ -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;

View File

@@ -728,6 +728,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
850,
/**/
849,
/**/