Lines Matching refs:opt_idx

41 static char_u *option_expand(int opt_idx, char_u *val);
45 static long_u *insecure_flag(int opt_idx, int opt_flags);
47 # define insecure_flag(opt_idx, opt_flags) (&options[opt_idx].flags) argument
49 static char *set_bool_option(int opt_idx, char_u *varp, int value, int opt_flags);
50 static char *set_num_option(int opt_idx, char_u *varp, long value, char *errbuf, size_t errbuflen, …
78 int opt_idx; in set_init_1() local
145 opt_idx = findoption((char_u *)"backupskip"); in set_init_1()
169 if (find_dup_item(ga.ga_data, item, options[opt_idx].flags) in set_init_1()
194 opt_idx = findoption((char_u *)"maxmemtot"); in set_init_1()
195 if (opt_idx >= 0) in set_init_1()
198 if (options[opt_idx].def_val[VI_DEFAULT] == (char_u *)0L) in set_init_1()
212 options[opt_idx].def_val[VI_DEFAULT] = (char_u *)n; in set_init_1()
213 opt_idx = findoption((char_u *)"maxmem"); in set_init_1()
214 if (opt_idx >= 0) in set_init_1()
217 if ((long)(long_i)options[opt_idx].def_val[VI_DEFAULT] > (long)n in set_init_1()
218 || (long)(long_i)options[opt_idx].def_val[VI_DEFAULT] == 0L) in set_init_1()
220 options[opt_idx].def_val[VI_DEFAULT] = (char_u *)n; in set_init_1()
254 opt_idx = findoption((char_u *)"cdpath"); in set_init_1()
255 if (opt_idx >= 0) in set_init_1()
257 options[opt_idx].def_val[VI_DEFAULT] = buf; in set_init_1()
258 options[opt_idx].flags |= P_DEF_ALLOCED; in set_init_1()
317 opt_idx = findoption((char_u *)"runtimepath"); in set_init_1()
318 if (opt_idx >= 0) in set_init_1()
320 options[opt_idx].def_val[VI_DEFAULT] = (char_u *)CLEAN_RUNTIMEPATH; in set_init_1()
323 opt_idx = findoption((char_u *)"packpath"); in set_init_1()
324 if (opt_idx >= 0) in set_init_1()
326 options[opt_idx].def_val[VI_DEFAULT] = (char_u *)CLEAN_RUNTIMEPATH; in set_init_1()
362 for (opt_idx = 0; !istermoption_idx(opt_idx); opt_idx++) in set_init_1()
364 if ((options[opt_idx].flags & P_GETTEXT) in set_init_1()
365 && options[opt_idx].var != NULL) in set_init_1()
366 p = (char_u *)_(*(char **)options[opt_idx].var); in set_init_1()
368 p = option_expand(opt_idx, NULL); in set_init_1()
371 *(char_u **)options[opt_idx].var = p; in set_init_1()
376 if (options[opt_idx].flags & P_DEF_ALLOCED) in set_init_1()
377 vim_free(options[opt_idx].def_val[VI_DEFAULT]); in set_init_1()
378 options[opt_idx].def_val[VI_DEFAULT] = p; in set_init_1()
379 options[opt_idx].flags |= P_DEF_ALLOCED; in set_init_1()
460 opt_idx = findoption((char_u *)"encoding"); in set_init_1()
461 if (opt_idx >= 0) in set_init_1()
463 options[opt_idx].def_val[VI_DEFAULT] = p_enc; in set_init_1()
464 options[opt_idx].flags |= P_DEF_ALLOCED; in set_init_1()
477 opt_idx = findoption((char_u *)"isp"); in set_init_1()
478 if (opt_idx >= 0) in set_init_1()
479 options[opt_idx].def_val[VIM_DEFAULT] = ISP_LATIN1; in set_init_1()
480 opt_idx = findoption((char_u *)"isk"); in set_init_1()
481 if (opt_idx >= 0) in set_init_1()
482 options[opt_idx].def_val[VIM_DEFAULT] = ISK_LATIN1; in set_init_1()
507 opt_idx = findoption((char_u *)"termencoding"); in set_init_1()
508 if (opt_idx >= 0) in set_init_1()
510 options[opt_idx].def_val[VI_DEFAULT] = p_tenc; in set_init_1()
511 options[opt_idx].flags |= P_DEF_ALLOCED; in set_init_1()
557 int opt_idx, in set_option_default() argument
567 varp = get_varp_scope(&(options[opt_idx]), both ? OPT_LOCAL : opt_flags); in set_option_default()
568 flags = options[opt_idx].flags; in set_option_default()
575 if (options[opt_idx].var == (char_u *)&p_fencs && enc_utf8) in set_option_default()
579 else if (options[opt_idx].indir != PV_NONE) in set_option_default()
580 set_string_option_direct(NULL, opt_idx, in set_option_default()
581 options[opt_idx].def_val[dvi], opt_flags, 0); in set_option_default()
586 *(char_u **)varp = options[opt_idx].def_val[dvi]; in set_option_default()
587 options[opt_idx].flags &= ~P_ALLOCED; in set_option_default()
592 if (options[opt_idx].indir == PV_SCROLL) in set_option_default()
596 long def_val = (long)(long_i)options[opt_idx].def_val[dvi]; in set_option_default()
607 *(long *)get_varp_scope(&(options[opt_idx]), OPT_GLOBAL) = in set_option_default()
615 *(int *)varp = (int)(long)(long_i)options[opt_idx].def_val[dvi]; in set_option_default()
618 if (options[opt_idx].indir == PV_ML && getuid() == ROOT_UID) in set_option_default()
623 *(int *)get_varp_scope(&(options[opt_idx]), OPT_GLOBAL) = in set_option_default()
628 flagsp = insecure_flag(opt_idx, opt_flags); in set_option_default()
633 set_option_sctx_idx(opt_idx, opt_flags, current_sctx); in set_option_default()
677 int opt_idx; in set_string_default_esc() local
685 opt_idx = findoption((char_u *)name); in set_string_default_esc()
686 if (opt_idx >= 0) in set_string_default_esc()
688 if (options[opt_idx].flags & P_DEF_ALLOCED) in set_string_default_esc()
689 vim_free(options[opt_idx].def_val[VI_DEFAULT]); in set_string_default_esc()
690 options[opt_idx].def_val[VI_DEFAULT] = p; in set_string_default_esc()
691 options[opt_idx].flags |= P_DEF_ALLOCED; in set_string_default_esc()
749 int opt_idx; in set_number_default() local
751 opt_idx = findoption((char_u *)name); in set_number_default()
752 if (opt_idx >= 0) in set_number_default()
753 options[opt_idx].def_val[VI_DEFAULT] = (char_u *)(long_i)val; in set_number_default()
1238 int opt_idx; in do_set() local
1318 opt_idx = -1; in do_set()
1335 opt_idx = findoption(arg + 1); in do_set()
1337 if (opt_idx == -1) in do_set()
1353 opt_idx = findoption(arg); in do_set()
1355 if (opt_idx == -1) in do_set()
1405 if (opt_idx == -1 && key == 0) // found a mismatch: skip in do_set()
1415 if (opt_idx >= 0) in do_set()
1417 if (options[opt_idx].var == NULL) // hidden option: skip in do_set()
1422 && (!(options[opt_idx].flags & P_BOOL) in do_set()
1428 flags = options[opt_idx].flags; in do_set()
1429 varp = get_varp_scope(&(options[opt_idx]), opt_flags); in do_set()
1449 && (opt_idx < 0 || options[opt_idx].var != VAR_WIN)) in do_set()
1453 if ((opt_flags & OPT_NOWIN) && opt_idx >= 0 in do_set()
1454 && options[opt_idx].var == VAR_WIN) in do_set()
1475 && opt_idx >= 0 // shut up coverity warning in do_set()
1478 options[opt_idx].indir == PV_FDM || in do_set()
1480 options[opt_idx].indir == PV_WRAP)) in do_set()
1538 if (opt_idx >= 0) in do_set()
1540 showoneopt(&options[opt_idx], opt_flags); in do_set()
1545 if (varp == options[opt_idx].var) in do_set()
1546 last_set_msg(options[opt_idx].script_ctx); in do_set()
1547 else if ((int)options[opt_idx].indir & PV_WIN) in do_set()
1549 (int)options[opt_idx].indir & PV_MASK]); in do_set()
1550 else if ((int)options[opt_idx].indir & PV_BUF) in do_set()
1552 (int)options[opt_idx].indir & PV_MASK]); in do_set()
1594 value = (int)(long)(long_i)options[opt_idx].def_val[ in do_set()
1604 value = *(int *)get_varp_scope(&(options[opt_idx]), in do_set()
1624 errmsg = set_bool_option(opt_idx, varp, (int)value, in do_set()
1649 value = (long)(long_i)options[opt_idx].def_val[ in do_set()
1661 &(options[opt_idx]), OPT_GLOBAL); in do_set()
1703 errmsg = set_num_option(opt_idx, varp, value, in do_set()
1706 else if (opt_idx >= 0) // string in do_set()
1730 && ((int)options[opt_idx].indir & PV_BOTH)) in do_set()
1731 varp = options[opt_idx].var; in do_set()
1740 &(options[opt_idx]), OPT_LOCAL); in do_set()
1742 &(options[opt_idx]), OPT_GLOBAL); in do_set()
1747 if (((int)options[opt_idx].indir & PV_BOTH) in do_set()
1754 if (((int)options[opt_idx].indir & PV_BOTH) in do_set()
1757 &options[opt_idx]); in do_set()
1763 newval = options[opt_idx].def_val[ in do_set()
1787 s = option_expand(opt_idx, newval); in do_set()
1797 &(options[opt_idx]), OPT_GLOBAL)); in do_set()
1943 s = option_expand(opt_idx, newval); in do_set()
2078 && options[opt_idx].indir != PV_KEY in do_set()
2096 long_u *p = insecure_flag(opt_idx, opt_flags); in do_set()
2116 opt_idx, (char_u **)varp, in do_set()
2126 opt_idx, opt_flags, saved_origval, in do_set()
2164 if (opt_idx >= 0) in do_set()
2166 opt_idx, opt_flags, value_is_replaced, value_checked); in do_set()
2233 int opt_idx, in did_set_option() argument
2241 options[opt_idx].flags |= P_WAS_SET; in did_set_option()
2246 p = insecure_flag(opt_idx, opt_flags); in did_set_option()
2368 option_expand(int opt_idx, char_u *val) in option_expand() argument
2371 if (!(options[opt_idx].flags & P_EXPAND) || options[opt_idx].var == NULL) in option_expand()
2380 val = *(char_u **)options[opt_idx].var; in option_expand()
2389 (char_u **)options[opt_idx].var == &p_tags, FALSE, in option_expand()
2391 (char_u **)options[opt_idx].var == &p_sps ? (char_u *)"file:" : in option_expand()
2465 int opt_idx; in check_options() local
2467 for (opt_idx = 0; options[opt_idx].fullname != NULL; opt_idx++) in check_options()
2468 if ((options[opt_idx].flags & P_STRING) && options[opt_idx].var != NULL) in check_options()
2469 check_string_option((char_u **)get_varp(&(options[opt_idx]))); in check_options()
2479 int opt_idx; in get_term_opt_idx() local
2481 for (opt_idx = 1; options[opt_idx].fullname != NULL; opt_idx++) in get_term_opt_idx()
2482 if (options[opt_idx].var == (char_u *)p) in get_term_opt_idx()
2483 return opt_idx; in get_term_opt_idx()
2494 int opt_idx = get_term_opt_idx(p); in set_term_option_alloced() local
2496 if (opt_idx >= 0) in set_term_option_alloced()
2497 options[opt_idx].flags |= P_ALLOCED; in set_term_option_alloced()
2498 return opt_idx; in set_term_option_alloced()
2529 insecure_flag(int opt_idx, int opt_flags) in insecure_flag() argument
2532 switch ((int)options[opt_idx].indir) in insecure_flag()
2556 return &options[opt_idx].flags; in insecure_flag()
2592 set_option_sctx_idx(int opt_idx, int opt_flags, sctx_T script_ctx) in set_option_sctx_idx() argument
2595 int indir = (int)options[opt_idx].indir; in set_option_sctx_idx()
2605 options[opt_idx].script_ctx = new_script_ctx; in set_option_sctx_idx()
2621 set_term_option_sctx_idx(char *name, int opt_idx) in set_term_option_sctx_idx() argument
2627 idx = opt_idx; in set_term_option_sctx_idx()
2648 int opt_idx, in apply_optionset_autocmd() argument
2691 apply_autocmds(EVENT_OPTIONSET, (char_u *)options[opt_idx].fullname, in apply_optionset_autocmd()
2703 int opt_idx, // index in options[] table in set_bool_option() argument
2718 ) && (options[opt_idx].flags & P_SECURE)) in set_bool_option()
2726 old_global_value = *(int *)get_varp_scope(&(options[opt_idx]), in set_bool_option()
2733 set_option_sctx_idx(opt_idx, opt_flags, current_sctx); in set_bool_option()
2742 *(int *)get_varp_scope(&(options[opt_idx]), OPT_GLOBAL) = value; in set_bool_option()
3275 options[opt_idx].flags |= P_WAS_SET; in set_bool_option()
3278 apply_optionset_autocmd(opt_idx, opt_flags, in set_bool_option()
3286 && (options[opt_idx].flags & (P_CURSWANT | P_RALL)) != 0) in set_bool_option()
3290 check_redraw(options[opt_idx].flags); in set_bool_option()
3301 int opt_idx, // index in options[] table in set_num_option() argument
3324 ) && (options[opt_idx].flags & P_SECURE)) in set_num_option()
3332 old_global_value = *(long *)get_varp_scope(&(options[opt_idx]), in set_num_option()
3339 set_option_sctx_idx(opt_idx, opt_flags, current_sctx); in set_num_option()
3835 *(long *)get_varp_scope(&(options[opt_idx]), OPT_GLOBAL) = *pp; in set_num_option()
3837 options[opt_idx].flags |= P_WAS_SET; in set_num_option()
3840 apply_optionset_autocmd(opt_idx, opt_flags, old_value, old_global_value, in set_num_option()
3846 && (options[opt_idx].flags & (P_CURSWANT | P_RALL)) != 0) in set_num_option()
3849 check_redraw(options[opt_idx].flags); in set_num_option()
3886 int opt_idx; in findoption() local
3899 for (opt_idx = 1; (s = options[opt_idx].fullname) != NULL; opt_idx++) in findoption()
3904 quick_tab[26] = opt_idx; in findoption()
3906 quick_tab[CharOrdLow(s[0])] = opt_idx; in findoption()
3924 opt_idx = quick_tab[26]; in findoption()
3926 opt_idx = quick_tab[CharOrdLow(arg[0])]; in findoption()
3927 for ( ; (s = options[opt_idx].fullname) != NULL; opt_idx++) in findoption()
3934 opt_idx = quick_tab[CharOrdLow(arg[0])]; in findoption()
3935 for ( ; options[opt_idx].fullname != NULL; opt_idx++) in findoption()
3937 s = options[opt_idx].shortname; in findoption()
3944 opt_idx = -1; in findoption()
3945 return opt_idx; in findoption()
3968 int opt_idx; in get_option_value() local
3971 opt_idx = findoption(name); in get_option_value()
3972 if (opt_idx < 0) // option not in the table in get_option_value()
4004 varp = get_varp_scope(&(options[opt_idx]), opt_flags); in get_option_value()
4006 if (options[opt_idx].flags & P_STRING) in get_option_value()
4025 return (options[opt_idx].flags & P_NUM) in get_option_value()
4027 if (options[opt_idx].flags & P_NUM) in get_option_value()
4038 return (options[opt_idx].flags & P_NUM) ? gov_number : gov_bool; in get_option_value()
4069 int opt_idx; in get_option_value_strict() local
4074 opt_idx = findoption(name); in get_option_value_strict()
4075 if (opt_idx < 0) in get_option_value_strict()
4078 p = &(options[opt_idx]); in get_option_value_strict()
4250 get_option_flags(int opt_idx) in get_option_flags() argument
4252 return options[opt_idx].flags; in get_option_flags()
4259 set_option_flag(int opt_idx, long_u flag) in set_option_flag() argument
4261 options[opt_idx].flags |= flag; in set_option_flag()
4268 clear_option_flag(int opt_idx, long_u flag) in clear_option_flag() argument
4270 options[opt_idx].flags &= ~flag; in clear_option_flag()
4277 is_global_option(int opt_idx) in is_global_option() argument
4279 return options[opt_idx].indir == PV_NONE; in is_global_option()
4287 is_global_local_option(int opt_idx) in is_global_local_option() argument
4289 return options[opt_idx].indir & PV_BOTH; in is_global_local_option()
4296 is_window_local_option(int opt_idx) in is_window_local_option() argument
4298 return options[opt_idx].var == VAR_WIN; in is_window_local_option()
4305 is_hidden_option(int opt_idx) in is_hidden_option() argument
4307 return options[opt_idx].var == NULL; in is_hidden_option()
4315 is_crypt_key_option(int opt_idx) in is_crypt_key_option() argument
4317 return options[opt_idx].indir == PV_KEY; in is_crypt_key_option()
4334 int opt_idx; in set_option_value() local
4338 opt_idx = findoption(name); in set_option_value()
4339 if (opt_idx < 0) in set_option_value()
4369 flags = options[opt_idx].flags; in set_option_value()
4379 return set_string_option(opt_idx, string, opt_flags); in set_option_value()
4382 varp = get_varp_scope(&(options[opt_idx]), opt_flags); in set_option_value()
4405 return set_num_option(opt_idx, varp, number, in set_option_value()
4408 return set_bool_option(opt_idx, varp, (int)number, in set_option_value()
4423 int opt_idx; in get_term_code() local
4429 if ((opt_idx = findoption(tname)) >= 0) in get_term_code()
4431 varp = get_varp(&(options[opt_idx])); in get_term_code()
5072 istermoption_idx(int opt_idx) in istermoption_idx() argument
5074 return istermoption(&options[opt_idx]); in istermoption_idx()
5085 int opt_idx; in unset_global_local_option() local
5088 opt_idx = findoption(name); in unset_global_local_option()
5089 if (opt_idx < 0) in unset_global_local_option()
5091 p = &(options[opt_idx]); in unset_global_local_option()
5273 get_option_varp_scope(int opt_idx, int opt_flags) in get_option_varp_scope() argument
5275 return get_varp_scope(&(options[opt_idx]), opt_flags); in get_option_varp_scope()
5544 get_option_var(int opt_idx) in get_option_var() argument
5546 return options[opt_idx].var; in get_option_var()
5553 get_option_fullname(int opt_idx) in get_option_fullname() argument
5555 return (char_u *)options[opt_idx].fullname; in get_option_fullname()
6176 int opt_idx; in reset_modifiable() local
6180 opt_idx = findoption((char_u *)"ma"); in reset_modifiable()
6181 if (opt_idx >= 0) in reset_modifiable()
6182 options[opt_idx].def_val[VI_DEFAULT] = FALSE; in reset_modifiable()
6215 int opt_idx = 0; // init for GCC in set_context_in_set_cmd() local
6302 opt_idx = findoption(arg); in set_context_in_set_cmd()
6304 if (opt_idx == -1 || options[opt_idx].var == NULL) in set_context_in_set_cmd()
6309 flags = options[opt_idx].flags; in set_context_in_set_cmd()
6335 expand_option_idx = opt_idx; in set_context_in_set_cmd()
6347 p = options[opt_idx].var; in set_context_in_set_cmd()
6406 if (options[opt_idx].var == (char_u *)&p_sps in set_context_in_set_cmd()
6425 int opt_idx; in ExpandSettings() local
6452 for (opt_idx = 0; (str = (char_u *)options[opt_idx].fullname) != NULL; in ExpandSettings()
6453 opt_idx++) in ExpandSettings()
6455 if (options[opt_idx].var == NULL) in ExpandSettings()
6458 && !(options[opt_idx].flags & P_BOOL)) in ExpandSettings()
6460 is_term_opt = istermoption_idx(opt_idx); in ExpandSettings()
6465 || (options[opt_idx].shortname != NULL in ExpandSettings()
6467 (char_u *)options[opt_idx].shortname, (colnr_T)0))) in ExpandSettings()
6502 for (opt_idx = 0; (str = get_termcode(opt_idx)) != NULL; opt_idx++) in ExpandSettings()
6542 for (opt_idx = 0; (str = get_key_name(opt_idx)) != NULL; opt_idx++) in ExpandSettings()
6884 int opt_idx; in vimrc_found() local
6891 for (opt_idx = 0; !istermoption_idx(opt_idx); opt_idx++) in vimrc_found()
6892 if (!(options[opt_idx].flags & (P_WAS_SET|P_VI_DEF))) in vimrc_found()
6893 set_option_default(opt_idx, OPT_FREE, FALSE); in vimrc_found()
6922 int opt_idx; in change_compatible() local
6929 opt_idx = findoption((char_u *)"cp"); in change_compatible()
6930 if (opt_idx >= 0) in change_compatible()
6931 options[opt_idx].flags |= P_WAS_SET; in change_compatible()
6978 int opt_idx; in compatible_set() local
6980 for (opt_idx = 0; !istermoption_idx(opt_idx); opt_idx++) in compatible_set()
6981 if ( ((options[opt_idx].flags & P_VIM) && p_cp) in compatible_set()
6982 || (!(options[opt_idx].flags & P_VI_DEF) && !p_cp)) in compatible_set()
6983 set_option_default(opt_idx, OPT_FREE, p_cp); in compatible_set()
7091 int opt_idx; in get_winbuf_options() local
7097 for (opt_idx = 0; !istermoption_idx(opt_idx); opt_idx++) in get_winbuf_options()
7099 struct vimoption *opt = &options[opt_idx]; in get_winbuf_options()