summaryrefslogtreecommitdiff
path: root/src/main.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2017-06-27 14:43:55 +0200
committerBram Moolenaar <Bram@vim.org>2017-06-27 14:43:55 +0200
commit07ecfa64a18609a986f21d6132d04ee8934f3200 (patch)
tree310133eeb745e650be5406b1eeb5999aa6741421 /src/main.c
parent41cc038ff83498c589c7d25b3d2984145528eb92 (diff)
downloadvim-07ecfa64a18609a986f21d6132d04ee8934f3200.zip
patch 8.0.0680: plugins in start packages are sourced twice
Problem: Plugins in start packages are sourced twice. (mseplowitz) Solution: Use the unmodified runtime path when loading plugins (test by Ingo Karkat, closes #1801)
Diffstat (limited to 'src/main.c')
-rw-r--r--src/main.c16
1 files changed, 13 insertions, 3 deletions
diff --git a/src/main.c b/src/main.c
index e30701c67..67c0a30d4 100644
--- a/src/main.c
+++ b/src/main.c
@@ -449,18 +449,28 @@ vim_main2(void)
*/
if (p_lpl)
{
+ char_u *rtp_copy = NULL;
+
/* First add all package directories to 'runtimepath', so that their
* autoload directories can be found. Only if not done already with a
- * :packloadall command. */
+ * :packloadall command.
+ * Make a copy of 'runtimepath', so that source_runtime does not use
+ * the pack directories. */
if (!did_source_packages)
+ {
+ rtp_copy = vim_strsave(p_rtp);
add_pack_start_dirs();
+ }
+ source_in_path(rtp_copy == NULL ? p_rtp : rtp_copy,
# ifdef VMS /* Somehow VMS doesn't handle the "**". */
- source_runtime((char_u *)"plugin/*.vim", DIP_ALL | DIP_NOAFTER);
+ (char_u *)"plugin/*.vim",
# else
- source_runtime((char_u *)"plugin/**/*.vim", DIP_ALL | DIP_NOAFTER);
+ (char_u *)"plugin/**/*.vim",
# endif
+ DIP_ALL | DIP_NOAFTER);
TIME_MSG("loading plugins");
+ vim_free(rtp_copy);
/* Only source "start" packages if not done already with a :packloadall
* command. */