comparison src/option.c @ 164:8b0ee9d57d7f

updated for version 7.0050
author vimboss
date Sat, 12 Feb 2005 14:29:27 +0000
parents 6df0106fc595
children 4d9eabb1396e
comparison
equal deleted inserted replaced
163:06bc859d1a32 164:8b0ee9d57d7f
663 {"copyindent", "ci", P_BOOL|P_VI_DEF|P_VIM, 663 {"copyindent", "ci", P_BOOL|P_VI_DEF|P_VIM,
664 (char_u *)&p_ci, PV_CI, 664 (char_u *)&p_ci, PV_CI,
665 {(char_u *)FALSE, (char_u *)0L}}, 665 {(char_u *)FALSE, (char_u *)0L}},
666 {"cpoptions", "cpo", P_STRING|P_VIM|P_RALL|P_FLAGLIST, 666 {"cpoptions", "cpo", P_STRING|P_VIM|P_RALL|P_FLAGLIST,
667 (char_u *)&p_cpo, PV_NONE, 667 (char_u *)&p_cpo, PV_NONE,
668 {(char_u *)CPO_ALL, (char_u *)CPO_DEFAULT}}, 668 {(char_u *)CPO_VI, (char_u *)CPO_VIM}},
669 {"cscopepathcomp", "cspc", P_NUM|P_VI_DEF|P_VIM, 669 {"cscopepathcomp", "cspc", P_NUM|P_VI_DEF|P_VIM,
670 #ifdef FEAT_CSCOPE 670 #ifdef FEAT_CSCOPE
671 (char_u *)&p_cspc, PV_NONE, 671 (char_u *)&p_cspc, PV_NONE,
672 #else 672 #else
673 (char_u *)NULL, PV_NONE, 673 (char_u *)NULL, PV_NONE,
2338 (char_u *)NULL, PV_NONE, 2338 (char_u *)NULL, PV_NONE,
2339 {(char_u *)NULL, (char_u *)0L} 2339 {(char_u *)NULL, (char_u *)0L}
2340 #endif 2340 #endif
2341 }, 2341 },
2342 {"window", "wi", P_NUM|P_VI_DEF, 2342 {"window", "wi", P_NUM|P_VI_DEF,
2343 (char_u *)NULL, PV_NONE, 2343 (char_u *)&p_window, PV_NONE,
2344 {(char_u *)0L, (char_u *)0L}}, 2344 {(char_u *)0L, (char_u *)0L}},
2345 {"winheight", "wh", P_NUM|P_VI_DEF, 2345 {"winheight", "wh", P_NUM|P_VI_DEF,
2346 #ifdef FEAT_WINDOWS 2346 #ifdef FEAT_WINDOWS
2347 (char_u *)&p_wh, PV_NONE, 2347 (char_u *)&p_wh, PV_NONE,
2348 #else 2348 #else
2589 #endif 2589 #endif
2590 2590
2591 /* Be Vi compatible by default */ 2591 /* Be Vi compatible by default */
2592 p_cp = TRUE; 2592 p_cp = TRUE;
2593 2593
2594 /* Use POSIX compatibility when $VIM_POSIX is set. */
2595 if (mch_getenv((char_u *)"VIM_POSIX") != NULL)
2596 set_string_default("cpo", (char_u *)CPO_ALL);
2597
2594 /* 2598 /*
2595 * Find default value for 'shell' option. 2599 * Find default value for 'shell' option.
2596 * Don't use it if it is empty. 2600 * Don't use it if it is empty.
2597 */ 2601 */
2598 if (((p = mch_getenv((char_u *)"SHELL")) != NULL && *p != NUL) 2602 if (((p = mch_getenv((char_u *)"SHELL")) != NULL && *p != NUL)
3080 * setting 'term'. 3084 * setting 'term'.
3081 */ 3085 */
3082 void 3086 void
3083 set_init_2() 3087 set_init_2()
3084 { 3088 {
3089 int idx;
3090
3085 /* 3091 /*
3086 * 'scroll' defaults to half the window height. Note that this default is 3092 * 'scroll' defaults to half the window height. Note that this default is
3087 * wrong when the window height changes. 3093 * wrong when the window height changes.
3088 */ 3094 */
3089 options[findoption((char_u *)"scroll")].def_val[VI_DEFAULT] 3095 set_number_default("scroll", (long_u)Rows >> 1);
3090 = (char_u *)((long_u)Rows >> 1);
3091 comp_col(); 3096 comp_col();
3092 3097
3098 /*
3099 * 'window' is only for backwards compatibility with Vi.
3100 * Default is Rows - 1.
3101 */
3102 idx = findoption((char_u *)"wi");
3103 if (!(options[idx].flags & P_WAS_SET))
3104 p_window = Rows - 1;
3105 set_number_default("window", Rows - 1);
3106
3093 #if !((defined(MSDOS) || defined(OS2) || defined(WIN3264)) && !defined(FEAT_GUI)) 3107 #if !((defined(MSDOS) || defined(OS2) || defined(WIN3264)) && !defined(FEAT_GUI))
3094 { 3108 {
3095 int idx4;
3096
3097 /* 3109 /*
3098 * If 'background' wasn't set by the user, try guessing the value, 3110 * If 'background' wasn't set by the user, try guessing the value,
3099 * depending on the terminal name. Only need to check for terminals 3111 * depending on the terminal name. Only need to check for terminals
3100 * with a dark background, that can handle color. Only "linux" 3112 * with a dark background, that can handle color. Only "linux"
3101 * console at the moment. 3113 * console at the moment.
3102 */ 3114 */
3103 idx4 = findoption((char_u *)"bg"); 3115 idx = findoption((char_u *)"bg");
3104 if (!(options[idx4].flags & P_WAS_SET) && STRCMP(T_NAME, "linux") == 0) 3116 if (!(options[idx].flags & P_WAS_SET) && STRCMP(T_NAME, "linux") == 0)
3105 { 3117 {
3106 set_string_option_direct(NULL, idx4, (char_u *)"dark", OPT_FREE); 3118 set_string_option_direct(NULL, idx, (char_u *)"dark", OPT_FREE);
3107 /* don't mark it as set, when starting the GUI it may be changed 3119 /* don't mark it as set, when starting the GUI it may be changed
3108 * again */ 3120 * again */
3109 options[idx4].flags &= ~P_WAS_SET; 3121 options[idx].flags &= ~P_WAS_SET;
3110 } 3122 }
3111 } 3123 }
3112 #endif 3124 #endif
3113 } 3125 }
3114 3126
6870 /* Show/unshow value of 'keymap' in status lines. */ 6882 /* Show/unshow value of 'keymap' in status lines. */
6871 status_redraw_curbuf(); 6883 status_redraw_curbuf();
6872 #endif 6884 #endif
6873 } 6885 }
6874 6886
6887 else if (pp == &p_window)
6888 {
6889 if (p_window < 1)
6890 p_window = 1;
6891 else if (p_window >= Rows)
6892 p_window = Rows - 1;
6893 }
6894
6875 else if (pp == &curbuf->b_p_imsearch) 6895 else if (pp == &curbuf->b_p_imsearch)
6876 { 6896 {
6877 if (curbuf->b_p_imsearch < -1 || curbuf->b_p_imsearch > B_IMODE_LAST) 6897 if (curbuf->b_p_imsearch < -1 || curbuf->b_p_imsearch > B_IMODE_LAST)
6878 { 6898 {
6879 errmsg = e_invarg; 6899 errmsg = e_invarg;
7009 * messages. */ 7029 * messages. */
7010 check_shellsize(); 7030 check_shellsize();
7011 if (cmdline_row > Rows - p_ch && Rows > p_ch) 7031 if (cmdline_row > Rows - p_ch && Rows > p_ch)
7012 cmdline_row = Rows - p_ch; 7032 cmdline_row = Rows - p_ch;
7013 } 7033 }
7034 if (p_window >= Rows)
7035 p_window = Rows - 1;
7014 } 7036 }
7015 7037
7016 if (curbuf->b_p_sts < 0) 7038 if (curbuf->b_p_sts < 0)
7017 { 7039 {
7018 errmsg = e_positive; 7040 errmsg = e_positive;