diff --git a/src/cmdexpand.c b/src/cmdexpand.c index dd8bc06d0..003f6daf1 100644 --- a/src/cmdexpand.c +++ b/src/cmdexpand.c @@ -2496,6 +2496,8 @@ ExpandFromContext( int ret; int flags; char_u *tofree = NULL; + int fuzzy = cmdline_fuzzy_complete(pat) + && cmdline_fuzzy_completion_supported(xp); flags = map_wildopts_to_ewflags(options); @@ -2580,12 +2582,15 @@ ExpandFromContext( pat = tofree; } - regmatch.regprog = vim_regcomp(pat, magic_isset() ? RE_MAGIC : 0); - if (regmatch.regprog == NULL) - return FAIL; + if (!fuzzy) + { + regmatch.regprog = vim_regcomp(pat, magic_isset() ? RE_MAGIC : 0); + if (regmatch.regprog == NULL) + return FAIL; - // set ignore-case according to p_ic, p_scs and pat - regmatch.rm_ic = ignorecase(pat); + // set ignore-case according to p_ic, p_scs and pat + regmatch.rm_ic = ignorecase(pat); + } if (xp->xp_context == EXPAND_SETTINGS || xp->xp_context == EXPAND_BOOL_SETTINGS) @@ -2599,7 +2604,8 @@ ExpandFromContext( else ret = ExpandOther(pat, xp, ®match, matches, numMatches); - vim_regfree(regmatch.regprog); + if (!fuzzy) + vim_regfree(regmatch.regprog); vim_free(tofree); return ret; diff --git a/src/testdir/test_cmdline.vim b/src/testdir/test_cmdline.vim index c83a8f147..2fc19c6fb 100644 --- a/src/testdir/test_cmdline.vim +++ b/src/testdir/test_cmdline.vim @@ -2659,6 +2659,10 @@ func Test_wildoptions_fuzzy() call assert_equal('"mapclear ', @:) " map name fuzzy completion - NOT supported + " test regex completion works + set wildoptions=fuzzy + call feedkeys(":cnoremap \\\"\", 'tx') + call assert_equal("\"cnoremap \", @:) " menu name fuzzy completion if has('gui_running') diff --git a/src/version.c b/src/version.c index c8511d2b4..c77f76134 100644 --- a/src/version.c +++ b/src/version.c @@ -754,6 +754,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 4478, /**/ 4477, /**/