From 07ecfa64a18609a986f21d6132d04ee8934f3200 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Tue, 27 Jun 2017 14:43:55 +0200 Subject: 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) --- src/main.c | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) (limited to 'src/main.c') 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. */ -- cgit v1.2.3