vim-patch:8.0.0612

Problem:    Package directories are added to 'runtimepath' only after loading
            non-package plugins.
Solution:   Split off the code to add package directories to 'runtimepath'.
            (Ingo Karkat, closes vim/vim#1680)

ce876aaa9a
This commit is contained in:
James McCoy
2017-08-21 12:47:58 -04:00
parent fc7bf1c71d
commit 622c3454df
5 changed files with 65 additions and 11 deletions

View File

@@ -2623,23 +2623,31 @@ theend:
xfree(ffname);
}
static bool did_source_packages = false;
/// Add all packages in the "start" directory to 'runtimepath'.
void add_pack_start_dirs(void)
{
do_in_path(p_pp, (char_u *)"pack/*/start/*", DIP_ALL + DIP_DIR, // NOLINT
add_pack_plugin, &APP_ADD_DIR);
}
/// Load plugins from all packages in the "start" directory.
void load_start_packages(void)
{
did_source_packages = true;
do_in_path(p_pp, (char_u *)"pack/*/start/*", DIP_ALL + DIP_DIR, // NOLINT
add_pack_plugin, &APP_LOAD);
}
// ":packloadall"
// Find plugins in the package directories and source them.
// "eap" is NULL when invoked during startup.
void ex_packloadall(exarg_T *eap)
{
if (!did_source_packages || (eap != NULL && eap->forceit)) {
did_source_packages = true;
if (!did_source_packages || eap->forceit) {
// First do a round to add all directories to 'runtimepath', then load
// the plugins. This allows for plugins to use an autoload directory
// of another plugin.
do_in_path(p_pp, (char_u *)"pack/*/start/*", DIP_ALL + DIP_DIR, // NOLINT
add_pack_plugin, &APP_ADD_DIR);
do_in_path(p_pp, (char_u *)"pack/*/start/*", DIP_ALL + DIP_DIR, // NOLINT
add_pack_plugin, &APP_LOAD);
add_pack_start_dirs();
load_start_packages();
}
}