0
0
mirror of https://github.com/vim/vim.git synced 2025-09-23 03:43:49 -04:00

patch 8.0.0612: pack dirs are added to 'runtimepath' too late

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 #1680)
This commit is contained in:
Bram Moolenaar
2017-06-04 17:47:42 +02:00
parent 976787d1f3
commit ce876aaa9a
6 changed files with 71 additions and 10 deletions

View File

@@ -3633,27 +3633,41 @@ theend:
vim_free(ffname);
}
static int 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,
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,
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))
if (!did_source_packages || eap->forceit)
{
did_source_packages = TRUE;
/* 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,
add_pack_plugin, &APP_ADD_DIR);
do_in_path(p_pp, (char_u *)"pack/*/start/*", DIP_ALL + DIP_DIR,
add_pack_plugin, &APP_LOAD);
add_pack_start_dirs();
load_start_packages();
}
}