vim-patch:9.0.1227: no cmdline completion for :runtime

Problem:    No cmdline completion for :runtime.
Solution:   Add completion for :runtime. (closes vim/vim#11853, closes vim/vim#11447)
            Improve the resulting matches.

a6759381a5
This commit is contained in:
zeertzjq
2023-01-26 09:44:15 +08:00
parent 5ac34cf55d
commit 6644786db0
6 changed files with 82 additions and 12 deletions

View File

@@ -109,6 +109,7 @@ static bool cmdline_fuzzy_completion_supported(const expand_T *const xp)
&& xp->xp_context != EXPAND_OLD_SETTING
&& xp->xp_context != EXPAND_OWNSYNTAX
&& xp->xp_context != EXPAND_PACKADD
&& xp->xp_context != EXPAND_RUNTIME
&& xp->xp_context != EXPAND_SHELLCMD
&& xp->xp_context != EXPAND_TAGS
&& xp->xp_context != EXPAND_TAGS_LISTFILES
@@ -1211,6 +1212,7 @@ char *addstar(char *fname, size_t len, int context)
if (context == EXPAND_HELP
|| context == EXPAND_CHECKHEALTH
|| context == EXPAND_COLORS
|| context == EXPAND_RUNTIME
|| context == EXPAND_COMPILER
|| context == EXPAND_OWNSYNTAX
|| context == EXPAND_FILETYPE
@@ -2072,6 +2074,11 @@ static const char *set_context_by_cmdname(const char *cmd, cmdidx_T cmdidx, expa
xp->xp_pattern = (char *)arg;
break;
case CMD_runtime:
xp->xp_context = EXPAND_RUNTIME;
xp->xp_pattern = (char *)arg;
break;
case CMD_compiler:
xp->xp_context = EXPAND_COMPILER;
xp->xp_pattern = (char *)arg;
@@ -2712,6 +2719,11 @@ static int ExpandFromContext(expand_T *xp, char *pat, char ***matches, int *numM
char *directories[] = { "colors", NULL };
return ExpandRTDir(pat, DIP_START + DIP_OPT, numMatches, matches, directories);
}
if (xp->xp_context == EXPAND_RUNTIME) {
char *directories[] = { "", NULL };
return ExpandRTDir(pat, DIP_START + DIP_OPT + DIP_PRNEXT, numMatches,
matches, directories);
}
if (xp->xp_context == EXPAND_COMPILER) {
char *directories[] = { "compiler", NULL };
return ExpandRTDir(pat, 0, numMatches, matches, directories);