startup: load files from &packpath . '/start/{pluginname}'

Quoting the existing docs:

    Packages are loaded.  These are plugins, as above [&runtimepath], but
    found in the "start" directory of each entry in 'packpath'.  Every
    plugin directory found is added in 'runtimepath' and then the plugins
    are sourced.

Also tj didn't think I could do it.
This commit is contained in:
Björn Linse
2020-11-18 20:02:44 +01:00
parent 569e5c86bf
commit a119fe15da
5 changed files with 71 additions and 3 deletions

View File

@@ -5533,6 +5533,7 @@ static int ExpandRTDir(char_u *pat, int flags, int *num_file, char_u ***file,
garray_T ga;
ga_init(&ga, (int)sizeof(char *), 10);
// TODO(bfredl): this is bullshit, exandpath should not reinvent path logic.
for (int i = 0; dirnames[i] != NULL; i++) {
size_t size = STRLEN(dirnames[i]) + pat_len + 7;
char_u *s = xmalloc(size);
@@ -5549,6 +5550,14 @@ static int ExpandRTDir(char_u *pat, int flags, int *num_file, char_u ***file,
globpath(p_pp, s, &ga, 0);
xfree(s);
}
for (int i = 0; dirnames[i] != NULL; i++) {
size_t size = STRLEN(dirnames[i]) + pat_len + 22;
char_u *s = xmalloc(size);
snprintf((char *)s, size, "start/*/%s/%s*.vim", dirnames[i], pat); // NOLINT
globpath(p_pp, s, &ga, 0);
xfree(s);
}
}
if (flags & DIP_OPT) {
@@ -5559,6 +5568,14 @@ static int ExpandRTDir(char_u *pat, int flags, int *num_file, char_u ***file,
globpath(p_pp, s, &ga, 0);
xfree(s);
}
for (int i = 0; dirnames[i] != NULL; i++) {
size_t size = STRLEN(dirnames[i]) + pat_len + 20;
char_u *s = xmalloc(size);
snprintf((char *)s, size, "opt/*/%s/%s*.vim", dirnames[i], pat); // NOLINT
globpath(p_pp, s, &ga, 0);
xfree(s);
}
}
for (int i = 0; i < ga.ga_len; i++) {
@@ -5606,6 +5623,8 @@ static int ExpandPackAddDir(char_u *pat, int *num_file, char_u ***file)
char_u *s = xmalloc(buflen);
snprintf((char *)s, buflen, "pack/*/opt/%s*", pat); // NOLINT
globpath(p_pp, s, &ga, 0);
snprintf((char *)s, buflen, "opt/%s*", pat); // NOLINT
globpath(p_pp, s, &ga, 0);
xfree(s);
for (int i = 0; i < ga.ga_len; i++) {