aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2023-07-14 06:46:16 +0800
committerGitHub <noreply@github.com>2023-07-14 06:46:16 +0800
commitdbb840da01c72d8a311e0c55d3248d78a64b63a4 (patch)
tree36a381283d42f6e23d552c3ed8e06b03b9fed51b /src
parenta3f4598226c4d01e4fbc41181a1ad21793862fe3 (diff)
downloadrneovim-dbb840da01c72d8a311e0c55d3248d78a64b63a4.tar.gz
rneovim-dbb840da01c72d8a311e0c55d3248d78a64b63a4.tar.bz2
rneovim-dbb840da01c72d8a311e0c55d3248d78a64b63a4.zip
fix(runtime): respect 'rtp' order for all runtime files (#24335)
Diffstat (limited to 'src')
-rw-r--r--src/nvim/runtime.c21
1 files changed, 11 insertions, 10 deletions
diff --git a/src/nvim/runtime.c b/src/nvim/runtime.c
index eac483b8e7..9cd4a17b27 100644
--- a/src/nvim/runtime.c
+++ b/src/nvim/runtime.c
@@ -1067,21 +1067,22 @@ theend:
/// Load scripts in "plugin" directory of the package.
/// For opt packages, also load scripts in "ftdetect" (start packages already
-/// load these from filetype.vim)
+/// load these from filetype.lua)
static int load_pack_plugin(bool opt, char *fname)
{
- static const char *ftpat = "%s/ftdetect/*"; // NOLINT
+ static const char plugpat[] = "%s/plugin/**/*"; // NOLINT
+ static const char ftpat[] = "%s/ftdetect/*"; // NOLINT
char *const ffname = fix_fname(fname);
- size_t len = strlen(ffname) + strlen(ftpat);
+ size_t len = strlen(ffname) + sizeof(plugpat);
char *pat = xmallocz(len);
- vim_snprintf(pat, len, "%s/plugin/**/*", ffname); // NOLINT
+ vim_snprintf(pat, len, plugpat, ffname); // NOLINT
gen_expand_wildcards_and_cb(1, &pat, EW_FILE, true, source_callback_vim_lua, NULL);
char *cmd = xstrdup("g:did_load_filetypes");
- // If runtime/filetype.vim wasn't loaded yet, the scripts will be
+ // If runtime/filetype.lua wasn't loaded yet, the scripts will be
// found when it loads.
if (opt && eval_to_number(cmd) > 0) {
do_cmdline_cmd("augroup filetypedetect");
@@ -1255,7 +1256,7 @@ void load_plugins(void)
/// ":packadd[!] {name}"
void ex_packadd(exarg_T *eap)
{
- static const char *plugpat = "pack/*/%s/%s"; // NOLINT
+ static const char plugpat[] = "pack/*/%s/%s"; // NOLINT
int res = OK;
// Round 1: use "start", round 2: use "opt".
@@ -1265,7 +1266,7 @@ void ex_packadd(exarg_T *eap)
continue;
}
- const size_t len = strlen(plugpat) + strlen(eap->arg) + 5;
+ const size_t len = sizeof(plugpat) + strlen(eap->arg) + 5;
char *pat = xmallocz(len);
vim_snprintf(pat, len, plugpat, round == 1 ? "start" : "opt", eap->arg);
// The first round don't give a "not found" error, in the second round
@@ -1367,11 +1368,11 @@ expand:
/// Expand color scheme, compiler or filetype names.
/// Search from 'runtimepath':
-/// 'runtimepath'/{dirnames}/{pat}.(vim|lua)
+/// 'runtimepath'/{dirnames}/{pat}.{vim,lua}
/// When "flags" has DIP_START: search also from "start" of 'packpath':
-/// 'packpath'/pack/*/start/*/{dirnames}/{pat}.(vim|lua)
+/// '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)
+/// '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[])
{