diff options
author | James McCoy <jamessan@jamessan.com> | 2016-07-07 23:12:33 -0400 |
---|---|---|
committer | James McCoy <jamessan@jamessan.com> | 2016-07-08 01:45:21 -0400 |
commit | 23b2ee077130182c60d6639d99b45546902c8f80 (patch) | |
tree | 0dd3eeb4699e73bb9699311565941b747ca34c7f /src | |
parent | 3f689ed327be0a391f8cdd15302583c02b04b4e2 (diff) | |
download | rneovim-23b2ee077130182c60d6639d99b45546902c8f80.tar.gz rneovim-23b2ee077130182c60d6639d99b45546902c8f80.tar.bz2 rneovim-23b2ee077130182c60d6639d99b45546902c8f80.zip |
vim-patch:7.4.1712
Problem: For plugins in packages, plugin authors need to take care of all
dependencies.
Solution: When loading "start" packages and for :packloadall, first add all
directories to 'runtimepath' before sourcing plugins.
https://github.com/vim/vim/commit/49b27326447d0827c59c6cd201d58f65c1163086
Diffstat (limited to 'src')
-rw-r--r-- | src/nvim/ex_cmds2.c | 20 | ||||
-rw-r--r-- | src/nvim/version.c | 1 |
2 files changed, 16 insertions, 5 deletions
diff --git a/src/nvim/ex_cmds2.c b/src/nvim/ex_cmds2.c index bd91968bce..900932fbed 100644 --- a/src/nvim/ex_cmds2.c +++ b/src/nvim/ex_cmds2.c @@ -2452,18 +2452,22 @@ static void source_all_matches(char_u *pat) } } +// used for "cookie" of add_pack_plugin() +static int APP_ADD_DIR; +static int APP_LOAD; +static int APP_BOTH; + static void add_pack_plugin(char_u *fname, void *cookie) { char_u *p4, *p3, *p2, *p1, *p; char_u *new_rtp; char_u *ffname = (char_u *)fix_fname((char *)fname); - bool load_files = cookie != NULL; if (ffname == NULL) { return; } - if (strstr((char *)p_rtp, (char *)ffname) == NULL) { + if (cookie != &APP_LOAD && strstr((char *)p_rtp, (char *)ffname) == NULL) { // directory not in 'runtimepath', add it p4 = p3 = p2 = p1 = get_past_head(ffname); for (p = p1; *p; mb_ptr_adv(p)) { @@ -2510,7 +2514,7 @@ static void add_pack_plugin(char_u *fname, void *cookie) xfree(new_rtp); } - if (load_files) { + if (cookie != &APP_ADD_DIR) { static const char *plugpat = "%s/plugin/*.vim"; static const char *ftpat = "%s/ftdetect/*.vim"; @@ -2548,8 +2552,14 @@ void ex_packloadall(exarg_T *eap) { if (!did_source_packages || (eap != NULL && 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, p_pp); + add_pack_plugin, &APP_LOAD); } } @@ -2562,7 +2572,7 @@ void ex_packadd(exarg_T *eap) char *pat = (char *)xmallocz(len); vim_snprintf(pat, len, plugpat, eap->arg); do_in_path(p_pp, (char_u *)pat, DIP_ALL + DIP_DIR + DIP_ERR, add_pack_plugin, - eap->forceit ? NULL : p_pp); + eap->forceit ? &APP_ADD_DIR : &APP_BOTH); xfree(pat); } diff --git a/src/nvim/version.c b/src/nvim/version.c index 25a5c9d730..b9543cb0b7 100644 --- a/src/nvim/version.c +++ b/src/nvim/version.c @@ -87,6 +87,7 @@ static int included_patches[] = { 1753, 1728, 1716, + 1712, 1695, 1654, 1652, |