diff options
author | zeertzjq <zeertzjq@outlook.com> | 2023-01-17 13:23:38 +0800 |
---|---|---|
committer | zeertzjq <zeertzjq@outlook.com> | 2023-01-17 14:01:26 +0800 |
commit | 5ce6685119419c08475a65b6e48b4487be5c6036 (patch) | |
tree | 858d3d740a79af13729543b62146ba09e5f084c6 /src/nvim/cmdexpand.c | |
parent | 245522db1eb294007066878492d19295a5e91f04 (diff) | |
download | rneovim-5ce6685119419c08475a65b6e48b4487be5c6036.tar.gz rneovim-5ce6685119419c08475a65b6e48b4487be5c6036.tar.bz2 rneovim-5ce6685119419c08475a65b6e48b4487be5c6036.zip |
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 vim/vim#9856)
https://github.com/vim/vim/commit/6caeda2fce4bccac2dd43ca9fee1d32ee96b708d
Co-authored-by: Yegappan Lakshmanan <yegappan@yahoo.com>
Diffstat (limited to 'src/nvim/cmdexpand.c')
-rw-r--r-- | src/nvim/cmdexpand.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/src/nvim/cmdexpand.c b/src/nvim/cmdexpand.c index f6b5127268..899a2a1f62 100644 --- a/src/nvim/cmdexpand.c +++ b/src/nvim/cmdexpand.c @@ -105,7 +105,6 @@ static bool cmdline_fuzzy_completion_supported(const expand_T *const 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 @@ -1377,10 +1376,12 @@ static const char *set_cmd_index(const char *cmd, exarg_T *eap, expand_T *xp, in // 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; } else { @@ -2732,7 +2733,7 @@ static int ExpandFromContext(expand_T *xp, char *pat, char ***matches, int *numM || 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); } else if (xp->xp_context == EXPAND_USER_DEFINED) { ret = ExpandUserDefined(xp, ®match, matches, numMatches); } else { |