diff options
author | Yegappan Lakshmanan <yegappan@yahoo.com> | 2022-02-27 12:07:30 +0000 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2022-02-27 12:07:30 +0000 |
commit | 6caeda2fce4bccac2dd43ca9fee1d32ee96b708d (patch) | |
tree | 2a3de1990e27aa46b59806f74228347f59ceff65 /src/cmdexpand.c | |
parent | 00333cb3b341499df8729b9345f0bbad968cda0b (diff) | |
download | vim-git-6caeda2fce4bccac2dd43ca9fee1d32ee96b708d.tar.gz |
patch 8.2.4479: no fuzzy completieon for maps and abbreviationsv8.2.4479
Problem: No fuzzy completieon for maps and abbreviations.
Solution: Fuzzy complete maps and abbreviations. (Yegappan Lakshmanan,
closes #9856)
Diffstat (limited to 'src/cmdexpand.c')
-rw-r--r-- | src/cmdexpand.c | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/src/cmdexpand.c b/src/cmdexpand.c index 003f6daf1..84dc64342 100644 --- a/src/cmdexpand.c +++ b/src/cmdexpand.c @@ -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, ®match, pat, numMatches, matches); else if (xp->xp_context == EXPAND_MAPPINGS) - ret = ExpandMappings(®match, numMatches, matches); + ret = ExpandMappings(pat, ®match, numMatches, matches); # if defined(FEAT_EVAL) else if (xp->xp_context == EXPAND_USER_DEFINED) ret = ExpandUserDefined(xp, ®match, 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; |