diff options
author | Bram Moolenaar <Bram@vim.org> | 2017-06-04 17:47:42 +0200 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2017-06-04 17:47:42 +0200 |
commit | ce876aaa9a250a5a0d0e34b3a2625e51cf9bf5bb (patch) | |
tree | 866d4fce5780c8a1df41501a65596238abc9dcc9 /src/ex_cmds2.c | |
parent | 976787d1f31451ca7a88e774a03e6c24ddc67876 (diff) | |
download | vim-ce876aaa9a250a5a0d0e34b3a2625e51cf9bf5bb.zip |
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)
Diffstat (limited to 'src/ex_cmds2.c')
-rw-r--r-- | src/ex_cmds2.c | 32 |
1 files changed, 23 insertions, 9 deletions
diff --git a/src/ex_cmds2.c b/src/ex_cmds2.c index 36ee57e8e..225225a78 100644 --- a/src/ex_cmds2.c +++ b/src/ex_cmds2.c @@ -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(); } } |