diff options
| author | zeertzjq <zeertzjq@outlook.com> | 2023-01-26 12:17:51 +0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-01-26 12:17:51 +0800 |
| commit | a0a112515923206b640f0056a8282386b5514978 (patch) | |
| tree | f25bc50ff763a3d31cbd43a528b1e391720ac136 /src/nvim/cmdexpand.c | |
| parent | 5ac34cf55db2b00c044fa95f75766dd89dd36ba9 (diff) | |
| parent | 62f09017e09b7dc7bc837b0b13d9f1598685be46 (diff) | |
| download | rneovim-a0a112515923206b640f0056a8282386b5514978.tar.gz rneovim-a0a112515923206b640f0056a8282386b5514978.tar.bz2 rneovim-a0a112515923206b640f0056a8282386b5514978.zip | |
Merge pull request #22002 from zeertzjq/vim-9.0.1227
vim-patch:9.0.{1227,1231,1238,1242}: cmdline completion for :runtime
Diffstat (limited to 'src/nvim/cmdexpand.c')
| -rw-r--r-- | src/nvim/cmdexpand.c | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/src/nvim/cmdexpand.c b/src/nvim/cmdexpand.c index be815151ef..5e4b49db24 100644 --- a/src/nvim/cmdexpand.c +++ b/src/nvim/cmdexpand.c @@ -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 @@ -1215,6 +1216,7 @@ char *addstar(char *fname, size_t len, int context) || context == EXPAND_OWNSYNTAX || context == EXPAND_FILETYPE || context == EXPAND_PACKADD + || context == EXPAND_RUNTIME || ((context == EXPAND_TAGS_LISTFILES || context == EXPAND_TAGS) && fname[0] == '/')) { retval = xstrnsave(fname, len); @@ -2092,6 +2094,10 @@ static const char *set_context_by_cmdname(const char *cmd, cmdidx_T cmdidx, expa xp->xp_pattern = (char *)arg; break; + case CMD_runtime: + set_context_in_runtime_cmd(xp, arg); + break; + #ifdef HAVE_WORKING_LIBINTL case CMD_language: return set_context_in_lang_cmd(xp, arg); @@ -2733,6 +2739,9 @@ static int ExpandFromContext(expand_T *xp, char *pat, char ***matches, int *numM if (xp->xp_context == EXPAND_PACKADD) { return ExpandPackAddDir(pat, numMatches, matches); } + if (xp->xp_context == EXPAND_RUNTIME) { + return expand_runtime_cmd(pat, numMatches, matches); + } // When expanding a function name starting with s:, match the <SNR>nr_ // prefix. @@ -3201,11 +3210,12 @@ static int ExpandUserLua(expand_T *xp, int *num_file, char ***file) /// Expand `file` for all comma-separated directories in `path`. /// Adds matches to `ga`. -void globpath(char *path, char *file, garray_T *ga, int expand_options) +/// If "dirs" is true only expand directory names. +void globpath(char *path, char *file, garray_T *ga, int expand_options, bool dirs) { expand_T xpc; ExpandInit(&xpc); - xpc.xp_context = EXPAND_FILES; + xpc.xp_context = dirs ? EXPAND_DIRECTORIES : EXPAND_FILES; char *buf = xmalloc(MAXPATHL); @@ -3524,11 +3534,14 @@ void f_getcompletion(typval_T *argvars, typval_T *rettv, EvalFuncData fptr) set_context_in_menu_cmd(&xpc, "menu", xpc.xp_pattern, false); xpc.xp_pattern_len = strlen(xpc.xp_pattern); } - if (xpc.xp_context == EXPAND_SIGN) { set_context_in_sign_cmd(&xpc, xpc.xp_pattern); xpc.xp_pattern_len = strlen(xpc.xp_pattern); } + if (xpc.xp_context == EXPAND_RUNTIME) { + set_context_in_runtime_cmd(&xpc, xpc.xp_pattern); + xpc.xp_pattern_len = strlen(xpc.xp_pattern); + } theend: if (cmdline_fuzzy_completion_supported(&xpc)) { |