1
0
forked from aniani/vim

patch 8.2.4479: no fuzzy completieon for maps and abbreviations

Problem:    No fuzzy completieon for maps and abbreviations.
Solution:   Fuzzy complete maps and abbreviations. (Yegappan Lakshmanan,
            closes #9856)
This commit is contained in:
Yegappan Lakshmanan
2022-02-27 12:07:30 +00:00
committed by Bram Moolenaar
parent 00333cb3b3
commit 6caeda2fce
6 changed files with 140 additions and 29 deletions

View File

@@ -56,7 +56,6 @@ cmdline_fuzzy_completion_supported(expand_T *xp)
&& xp->xp_context != EXPAND_FILES_IN_PATH
&& xp->xp_context != EXPAND_FILETYPE
&& xp->xp_context != EXPAND_HELP
&& xp->xp_context != EXPAND_MAPPINGS
&& xp->xp_context != EXPAND_OLD_SETTING
&& xp->xp_context != EXPAND_OWNSYNTAX
&& xp->xp_context != EXPAND_PACKADD
@@ -1216,10 +1215,12 @@ set_cmd_index(char_u *cmd, exarg_T *eap, expand_T *xp, int *complp)
// Isolate the command and search for it in the command table.
// Exceptions:
// - the 'k' command can directly be followed by any character, but
// do accept "keepmarks", "keepalt" and "keepjumps".
// - the 'k' command can directly be followed by any character, but do
// accept "keepmarks", "keepalt" and "keepjumps". As fuzzy matching can
// find matches anywhere in the command name, do this only for command
// expansion based on regular expression and not for fuzzy matching.
// - the 's' command can be followed directly by 'c', 'g', 'i', 'I' or 'r'
if (*cmd == 'k' && cmd[1] != 'e')
if (!fuzzy && (*cmd == 'k' && cmd[1] != 'e'))
{
eap->cmdidx = CMD_k;
p = cmd + 1;
@@ -2596,7 +2597,7 @@ ExpandFromContext(
|| xp->xp_context == EXPAND_BOOL_SETTINGS)
ret = ExpandSettings(xp, &regmatch, pat, numMatches, matches);
else if (xp->xp_context == EXPAND_MAPPINGS)
ret = ExpandMappings(&regmatch, numMatches, matches);
ret = ExpandMappings(pat, &regmatch, numMatches, matches);
# if defined(FEAT_EVAL)
else if (xp->xp_context == EXPAND_USER_DEFINED)
ret = ExpandUserDefined(xp, &regmatch, matches, numMatches);
@@ -2712,7 +2713,8 @@ ExpandGeneric(
fuzmatch = ALLOC_MULT(fuzmatch_str_T, count);
else
*matches = ALLOC_MULT(char_u *, count);
if ((fuzzy && (fuzmatch == NULL)) || (*matches == NULL))
if ((!fuzzy && (*matches == NULL))
|| (fuzzy && (fuzmatch == NULL)))
{
*numMatches = 0;
*matches = NULL;