diff src/main.c @ 13361:65c29bd4548b v8.0.1554

patch 8.0.1554: custom plugins loaded with --clean commit https://github.com/vim/vim/commit/072687032683b1994d25a114893d9a6f8bc36612 Author: Bram Moolenaar <Bram@vim.org> Date: Thu Mar 1 21:57:32 2018 +0100 patch 8.0.1554: custom plugins loaded with --clean Problem: Custom plugins loaded with --clean. Solution: Do not include the home directory in 'runtimepath'.
author Christian Brabandt <cb@256bit.org>
date Thu, 01 Mar 2018 22:00:09 +0100
parents ac42c4b11dbc
children 2103b009e32d
line wrap: on
line diff
--- a/src/main.c
+++ b/src/main.c
@@ -158,18 +158,25 @@ main
 
 #ifdef STARTUPTIME
     /* Need to find "--startuptime" before actually parsing arguments. */
-    for (i = 1; i < argc; ++i)
-    {
-	if (STRICMP(argv[i], "--startuptime") == 0 && i + 1 < argc)
+    for (i = 1; i < argc - 1; ++i)
+	if (STRICMP(argv[i], "--startuptime") == 0)
 	{
 	    time_fd = mch_fopen(argv[i + 1], "a");
 	    TIME_MSG("--- VIM STARTING ---");
 	    break;
 	}
-    }
 #endif
     starttime = time(NULL);
 
+#ifdef CLEAN_RUNTIMEPATH
+    /* Need to find "--clean" before actually parsing arguments. */
+    for (i = 1; i < argc; ++i)
+	if (STRICMP(argv[i], "--clean") == 0)
+	{
+	    params.clean = TRUE;
+	    break;
+	}
+#endif
     common_init(&params);
 
 #ifdef FEAT_CLIENTSERVER
@@ -1024,7 +1031,7 @@ common_init(mparm_T *paramp)
      * First find out the home directory, needed to expand "~" in options.
      */
     init_homedir();		/* find real value of $HOME */
-    set_init_1();
+    set_init_1(paramp->clean);
     TIME_MSG("inits 1");
 
 #ifdef FEAT_EVAL
@@ -1903,6 +1910,7 @@ command_line_scan(mparm_T *parmp)
 		else if (STRNICMP(argv[0] + argv_idx, "clean", 5) == 0)
 		{
 		    parmp->use_vimrc = (char_u *)"DEFAULTS";
+		    parmp->clean = TRUE;
 		    set_option_value((char_u *)"vif", 0L, (char_u *)"NONE", 0);
 		}
 		else if (STRNICMP(argv[0] + argv_idx, "literal", 7) == 0)