Mercurial > vim
comparison src/main.c @ 19181:94eda51ba9ba v8.2.0149
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Commit: https://github.com/vim/vim/commit/8a7d6542b33e5d2b352262305c3bfdb2d14e1cf8
Author: Bram Moolenaar <Bram@vim.org>
Date: Sun Jan 26 15:56:19 2020 +0100
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Problem: Maintaining a Vim9 branch separately is more work.
Solution: Merge the Vim9 script changes.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sun, 26 Jan 2020 16:00:05 +0100 |
parents | af1eca322b9e |
children | 5f2cb68f7cb8 |
comparison
equal
deleted
inserted
replaced
19180:8edf0aeb71b9 | 19181:94eda51ba9ba |
---|---|
480 # ifdef VMS // Somehow VMS doesn't handle the "**". | 480 # ifdef VMS // Somehow VMS doesn't handle the "**". |
481 (char_u *)"plugin/*.vim", | 481 (char_u *)"plugin/*.vim", |
482 # else | 482 # else |
483 (char_u *)"plugin/**/*.vim", | 483 (char_u *)"plugin/**/*.vim", |
484 # endif | 484 # endif |
485 DIP_ALL | DIP_NOAFTER); | 485 DIP_ALL | DIP_NOAFTER, NULL); |
486 TIME_MSG("loading plugins"); | 486 TIME_MSG("loading plugins"); |
487 vim_free(rtp_copy); | 487 vim_free(rtp_copy); |
488 | 488 |
489 // Only source "start" packages if not done already with a :packloadall | 489 // Only source "start" packages if not done already with a :packloadall |
490 // command. | 490 // command. |
3167 * For "evim" source evim.vim first of all, so that the user can overrule | 3167 * For "evim" source evim.vim first of all, so that the user can overrule |
3168 * any things he doesn't like. | 3168 * any things he doesn't like. |
3169 */ | 3169 */ |
3170 if (parmp->evim_mode) | 3170 if (parmp->evim_mode) |
3171 { | 3171 { |
3172 (void)do_source((char_u *)EVIM_FILE, FALSE, DOSO_NONE); | 3172 (void)do_source((char_u *)EVIM_FILE, FALSE, DOSO_NONE, NULL); |
3173 TIME_MSG("source evim file"); | 3173 TIME_MSG("source evim file"); |
3174 } | 3174 } |
3175 | 3175 |
3176 /* | 3176 /* |
3177 * If -u argument given, use only the initializations from that file and | 3177 * If -u argument given, use only the initializations from that file and |
3178 * nothing else. | 3178 * nothing else. |
3179 */ | 3179 */ |
3180 if (parmp->use_vimrc != NULL) | 3180 if (parmp->use_vimrc != NULL) |
3181 { | 3181 { |
3182 if (STRCMP(parmp->use_vimrc, "DEFAULTS") == 0) | 3182 if (STRCMP(parmp->use_vimrc, "DEFAULTS") == 0) |
3183 do_source((char_u *)VIM_DEFAULTS_FILE, FALSE, DOSO_NONE); | 3183 do_source((char_u *)VIM_DEFAULTS_FILE, FALSE, DOSO_NONE, NULL); |
3184 else if (STRCMP(parmp->use_vimrc, "NONE") == 0 | 3184 else if (STRCMP(parmp->use_vimrc, "NONE") == 0 |
3185 || STRCMP(parmp->use_vimrc, "NORC") == 0) | 3185 || STRCMP(parmp->use_vimrc, "NORC") == 0) |
3186 { | 3186 { |
3187 #ifdef FEAT_GUI | 3187 #ifdef FEAT_GUI |
3188 if (use_gvimrc == NULL) // don't load gvimrc either | 3188 if (use_gvimrc == NULL) // don't load gvimrc either |
3189 use_gvimrc = parmp->use_vimrc; | 3189 use_gvimrc = parmp->use_vimrc; |
3190 #endif | 3190 #endif |
3191 } | 3191 } |
3192 else | 3192 else |
3193 { | 3193 { |
3194 if (do_source(parmp->use_vimrc, FALSE, DOSO_NONE) != OK) | 3194 if (do_source(parmp->use_vimrc, FALSE, DOSO_NONE, NULL) != OK) |
3195 semsg(_("E282: Cannot read from \"%s\""), parmp->use_vimrc); | 3195 semsg(_("E282: Cannot read from \"%s\""), parmp->use_vimrc); |
3196 } | 3196 } |
3197 } | 3197 } |
3198 else if (!silent_mode) | 3198 else if (!silent_mode) |
3199 { | 3199 { |
3207 | 3207 |
3208 /* | 3208 /* |
3209 * Get system wide defaults, if the file name is defined. | 3209 * Get system wide defaults, if the file name is defined. |
3210 */ | 3210 */ |
3211 #ifdef SYS_VIMRC_FILE | 3211 #ifdef SYS_VIMRC_FILE |
3212 (void)do_source((char_u *)SYS_VIMRC_FILE, FALSE, DOSO_NONE); | 3212 (void)do_source((char_u *)SYS_VIMRC_FILE, FALSE, DOSO_NONE, NULL); |
3213 #endif | 3213 #endif |
3214 #ifdef MACOS_X | 3214 #ifdef MACOS_X |
3215 (void)do_source((char_u *)"$VIMRUNTIME/macmap.vim", FALSE, DOSO_NONE); | 3215 (void)do_source((char_u *)"$VIMRUNTIME/macmap.vim", FALSE, |
3216 DOSO_NONE, NULL); | |
3216 #endif | 3217 #endif |
3217 | 3218 |
3218 /* | 3219 /* |
3219 * Try to read initialization commands from the following places: | 3220 * Try to read initialization commands from the following places: |
3220 * - environment variable VIMINIT | 3221 * - environment variable VIMINIT |
3225 * - second user exrc file ($VIM/.exrc for Dos) | 3226 * - second user exrc file ($VIM/.exrc for Dos) |
3226 * The first that exists is used, the rest is ignored. | 3227 * The first that exists is used, the rest is ignored. |
3227 */ | 3228 */ |
3228 if (process_env((char_u *)"VIMINIT", TRUE) != OK) | 3229 if (process_env((char_u *)"VIMINIT", TRUE) != OK) |
3229 { | 3230 { |
3230 if (do_source((char_u *)USR_VIMRC_FILE, TRUE, DOSO_VIMRC) == FAIL | 3231 if (do_source((char_u *)USR_VIMRC_FILE, TRUE, |
3232 DOSO_VIMRC, NULL) == FAIL | |
3231 #ifdef USR_VIMRC_FILE2 | 3233 #ifdef USR_VIMRC_FILE2 |
3232 && do_source((char_u *)USR_VIMRC_FILE2, TRUE, | 3234 && do_source((char_u *)USR_VIMRC_FILE2, TRUE, |
3233 DOSO_VIMRC) == FAIL | 3235 DOSO_VIMRC, NULL) == FAIL |
3234 #endif | 3236 #endif |
3235 #ifdef USR_VIMRC_FILE3 | 3237 #ifdef USR_VIMRC_FILE3 |
3236 && do_source((char_u *)USR_VIMRC_FILE3, TRUE, | 3238 && do_source((char_u *)USR_VIMRC_FILE3, TRUE, |
3237 DOSO_VIMRC) == FAIL | 3239 DOSO_VIMRC, NULL) == FAIL |
3238 #endif | 3240 #endif |
3239 #ifdef USR_VIMRC_FILE4 | 3241 #ifdef USR_VIMRC_FILE4 |
3240 && do_source((char_u *)USR_VIMRC_FILE4, TRUE, | 3242 && do_source((char_u *)USR_VIMRC_FILE4, TRUE, |
3241 DOSO_VIMRC) == FAIL | 3243 DOSO_VIMRC, NULL) == FAIL |
3242 #endif | 3244 #endif |
3243 && process_env((char_u *)"EXINIT", FALSE) == FAIL | 3245 && process_env((char_u *)"EXINIT", FALSE) == FAIL |
3244 && do_source((char_u *)USR_EXRC_FILE, FALSE, DOSO_NONE) == FAIL | 3246 && do_source((char_u *)USR_EXRC_FILE, FALSE, |
3247 DOSO_NONE, NULL) == FAIL | |
3245 #ifdef USR_EXRC_FILE2 | 3248 #ifdef USR_EXRC_FILE2 |
3246 && do_source((char_u *)USR_EXRC_FILE2, FALSE, DOSO_NONE) == FAIL | 3249 && do_source((char_u *)USR_EXRC_FILE2, FALSE, |
3250 DOSO_NONE, NULL) == FAIL | |
3247 #endif | 3251 #endif |
3248 && !has_dash_c_arg) | 3252 && !has_dash_c_arg) |
3249 { | 3253 { |
3250 // When no .vimrc file was found: source defaults.vim. | 3254 // When no .vimrc file was found: source defaults.vim. |
3251 do_source((char_u *)VIM_DEFAULTS_FILE, FALSE, DOSO_NONE); | 3255 do_source((char_u *)VIM_DEFAULTS_FILE, FALSE, DOSO_NONE, NULL); |
3252 } | 3256 } |
3253 } | 3257 } |
3254 | 3258 |
3255 /* | 3259 /* |
3256 * Read initialization commands from ".vimrc" or ".exrc" in current | 3260 * Read initialization commands from ".vimrc" or ".exrc" in current |
3283 #ifdef SYS_VIMRC_FILE | 3287 #ifdef SYS_VIMRC_FILE |
3284 && fullpathcmp((char_u *)SYS_VIMRC_FILE, | 3288 && fullpathcmp((char_u *)SYS_VIMRC_FILE, |
3285 (char_u *)VIMRC_FILE, FALSE, TRUE) != FPC_SAME | 3289 (char_u *)VIMRC_FILE, FALSE, TRUE) != FPC_SAME |
3286 #endif | 3290 #endif |
3287 ) | 3291 ) |
3288 i = do_source((char_u *)VIMRC_FILE, TRUE, DOSO_VIMRC); | 3292 i = do_source((char_u *)VIMRC_FILE, TRUE, DOSO_VIMRC, NULL); |
3289 | 3293 |
3290 if (i == FAIL) | 3294 if (i == FAIL) |
3291 { | 3295 { |
3292 #if defined(UNIX) || defined(VMS) | 3296 #if defined(UNIX) || defined(VMS) |
3293 // if ".exrc" is not owned by user set 'secure' mode | 3297 // if ".exrc" is not owned by user set 'secure' mode |
3301 #ifdef USR_EXRC_FILE2 | 3305 #ifdef USR_EXRC_FILE2 |
3302 && fullpathcmp((char_u *)USR_EXRC_FILE2, | 3306 && fullpathcmp((char_u *)USR_EXRC_FILE2, |
3303 (char_u *)EXRC_FILE, FALSE, TRUE) != FPC_SAME | 3307 (char_u *)EXRC_FILE, FALSE, TRUE) != FPC_SAME |
3304 #endif | 3308 #endif |
3305 ) | 3309 ) |
3306 (void)do_source((char_u *)EXRC_FILE, FALSE, DOSO_NONE); | 3310 (void)do_source((char_u *)EXRC_FILE, FALSE, |
3311 DOSO_NONE, NULL); | |
3307 } | 3312 } |
3308 } | 3313 } |
3309 if (secure == 2) | 3314 if (secure == 2) |
3310 need_wait_return = TRUE; | 3315 need_wait_return = TRUE; |
3311 secure = 0; | 3316 secure = 0; |
3332 } | 3337 } |
3333 | 3338 |
3334 #endif // NO_VIM_MAIN | 3339 #endif // NO_VIM_MAIN |
3335 | 3340 |
3336 /* | 3341 /* |
3337 * Get an environment variable, and execute it as Ex commands. | 3342 * Get an environment variable and execute it as Ex commands. |
3338 * Returns FAIL if the environment variable was not executed, OK otherwise. | 3343 * Returns FAIL if the environment variable was not executed, OK otherwise. |
3339 */ | 3344 */ |
3340 int | 3345 int |
3341 process_env( | 3346 process_env( |
3342 char_u *env, | 3347 char_u *env, |