diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/nvim/cmdexpand.c | 6 | ||||
-rw-r--r-- | src/nvim/runtime.c | 44 | ||||
-rw-r--r-- | src/nvim/runtime.h | 1 |
3 files changed, 19 insertions, 32 deletions
diff --git a/src/nvim/cmdexpand.c b/src/nvim/cmdexpand.c index c1059c40f0..be815151ef 100644 --- a/src/nvim/cmdexpand.c +++ b/src/nvim/cmdexpand.c @@ -2710,11 +2710,11 @@ static int ExpandFromContext(expand_T *xp, char *pat, char ***matches, int *numM } if (xp->xp_context == EXPAND_COLORS) { char *directories[] = { "colors", NULL }; - return ExpandRTDir(pat, DIP_START + DIP_OPT + DIP_LUA, numMatches, matches, directories); + return ExpandRTDir(pat, DIP_START + DIP_OPT, numMatches, matches, directories); } if (xp->xp_context == EXPAND_COMPILER) { char *directories[] = { "compiler", NULL }; - return ExpandRTDir(pat, DIP_LUA, numMatches, matches, directories); + return ExpandRTDir(pat, 0, numMatches, matches, directories); } if (xp->xp_context == EXPAND_OWNSYNTAX) { char *directories[] = { "syntax", NULL }; @@ -2722,7 +2722,7 @@ static int ExpandFromContext(expand_T *xp, char *pat, char ***matches, int *numM } if (xp->xp_context == EXPAND_FILETYPE) { char *directories[] = { "syntax", "indent", "ftplugin", NULL }; - return ExpandRTDir(pat, DIP_LUA, numMatches, matches, directories); + return ExpandRTDir(pat, 0, numMatches, matches, directories); } if (xp->xp_context == EXPAND_USER_LIST) { return ExpandUserList(xp, matches, numMatches); diff --git a/src/nvim/runtime.c b/src/nvim/runtime.c index fd32209310..0d7afa98a7 100644 --- a/src/nvim/runtime.c +++ b/src/nvim/runtime.c @@ -1175,12 +1175,11 @@ void ex_packadd(exarg_T *eap) /// Expand color scheme, compiler or filetype names. /// Search from 'runtimepath': -/// 'runtimepath'/{dirnames}/{pat}.vim -/// When "flags" has DIP_START: search also from 'start' of 'packpath': -/// 'packpath'/pack/ * /start/ * /{dirnames}/{pat}.vim -/// When "flags" has DIP_OPT: search also from 'opt' of 'packpath': -/// 'packpath'/pack/ * /opt/ * /{dirnames}/{pat}.vim -/// When "flags" has DIP_LUA: search also performed for .lua files +/// 'runtimepath'/{dirnames}/{pat}.(vim|lua) +/// When "flags" has DIP_START: search also from "start" of 'packpath': +/// 'packpath'/pack/*/start/*/{dirnames}/{pat}.(vim|lua) +/// When "flags" has DIP_OPT: search also from "opt" of 'packpath': +/// 'packpath'/pack/*/opt/*/{dirnames}/{pat}.(vim|lua) /// "dirnames" is an array with one or more directory names. int ExpandRTDir(char *pat, int flags, int *num_file, char ***file, char *dirnames[]) { @@ -1197,10 +1196,8 @@ int ExpandRTDir(char *pat, int flags, int *num_file, char ***file, char *dirname char *s = xmalloc(size); snprintf(s, size, "%s/%s*.vim", dirnames[i], pat); globpath(p_rtp, s, &ga, 0); - if (flags & DIP_LUA) { - snprintf(s, size, "%s/%s*.lua", dirnames[i], pat); - globpath(p_rtp, s, &ga, 0); - } + snprintf(s, size, "%s/%s*.lua", dirnames[i], pat); + globpath(p_rtp, s, &ga, 0); xfree(s); } @@ -1210,10 +1207,8 @@ int ExpandRTDir(char *pat, int flags, int *num_file, char ***file, char *dirname char *s = xmalloc(size); snprintf(s, size, "pack/*/start/*/%s/%s*.vim", dirnames[i], pat); // NOLINT globpath(p_pp, s, &ga, 0); - if (flags & DIP_LUA) { - snprintf(s, size, "pack/*/start/*/%s/%s*.lua", dirnames[i], pat); // NOLINT - globpath(p_pp, s, &ga, 0); - } + snprintf(s, size, "pack/*/start/*/%s/%s*.lua", dirnames[i], pat); // NOLINT + globpath(p_pp, s, &ga, 0); xfree(s); } @@ -1222,10 +1217,8 @@ int ExpandRTDir(char *pat, int flags, int *num_file, char ***file, char *dirname char *s = xmalloc(size); snprintf(s, size, "start/*/%s/%s*.vim", dirnames[i], pat); // NOLINT globpath(p_pp, s, &ga, 0); - if (flags & DIP_LUA) { - snprintf(s, size, "start/*/%s/%s*.lua", dirnames[i], pat); // NOLINT - globpath(p_pp, s, &ga, 0); - } + snprintf(s, size, "start/*/%s/%s*.lua", dirnames[i], pat); // NOLINT + globpath(p_pp, s, &ga, 0); xfree(s); } } @@ -1236,10 +1229,8 @@ int ExpandRTDir(char *pat, int flags, int *num_file, char ***file, char *dirname char *s = xmalloc(size); snprintf(s, size, "pack/*/opt/*/%s/%s*.vim", dirnames[i], pat); // NOLINT globpath(p_pp, s, &ga, 0); - if (flags & DIP_LUA) { - snprintf(s, size, "pack/*/opt/*/%s/%s*.lua", dirnames[i], pat); // NOLINT - globpath(p_pp, s, &ga, 0); - } + snprintf(s, size, "pack/*/opt/*/%s/%s*.lua", dirnames[i], pat); // NOLINT + globpath(p_pp, s, &ga, 0); xfree(s); } @@ -1248,10 +1239,8 @@ int ExpandRTDir(char *pat, int flags, int *num_file, char ***file, char *dirname char *s = xmalloc(size); snprintf(s, size, "opt/*/%s/%s*.vim", dirnames[i], pat); // NOLINT globpath(p_pp, s, &ga, 0); - if (flags & DIP_LUA) { - snprintf(s, size, "opt/*/%s/%s*.lua", dirnames[i], pat); // NOLINT - globpath(p_pp, s, &ga, 0); - } + snprintf(s, size, "opt/*/%s/%s*.lua", dirnames[i], pat); // NOLINT + globpath(p_pp, s, &ga, 0); xfree(s); } } @@ -1261,8 +1250,7 @@ int ExpandRTDir(char *pat, int flags, int *num_file, char ***file, char *dirname char *s = match; char *e = s + strlen(s); if (e - s > 4 && (STRNICMP(e - 4, ".vim", 4) == 0 - || ((flags & DIP_LUA) - && STRNICMP(e - 4, ".lua", 4) == 0))) { + || STRNICMP(e - 4, ".lua", 4) == 0)) { e -= 4; for (s = e; s > match; MB_PTR_BACK(match, s)) { if (vim_ispathsep(*s)) { diff --git a/src/nvim/runtime.h b/src/nvim/runtime.h index de363020f8..97063b900c 100644 --- a/src/nvim/runtime.h +++ b/src/nvim/runtime.h @@ -105,7 +105,6 @@ typedef kvec_t(char *) CharVec; #define DIP_NORTP 0x20 // do not use 'runtimepath' #define DIP_NOAFTER 0x40 // skip "after" directories #define DIP_AFTER 0x80 // only use "after" directories -#define DIP_LUA 0x100 // also use ".lua" files #define DIP_DIRFILE 0x200 // find both files and directories #ifdef INCLUDE_GENERATED_DECLARATIONS |