1 /* vi:set ts=8 sts=4 sw=4:
3 * VIM - Vi IMproved by Bram Moolenaar
5 * Do ":help uganda" in Vim to read copying and usage conditions.
6 * Do ":help credits" in Vim to see a list of people who contributed.
7 * See README.txt for an overview of the Vim source code.
11 * Code to handle user-settable options. This is all pretty much table-
12 * driven. Checklist for adding a new option:
13 * - Put it in the options array below (copy an existing entry).
14 * - For a global option: Add a variable for it in option.h.
15 * - For a buffer or window local option:
16 * - Add a PV_XX entry to the enum below.
17 * - Add a variable to the window or buffer struct in structs.h.
18 * - For a window option, add some code to copy_winopt().
19 * - For a buffer option, add some code to buf_copy_options().
20 * - For a buffer string option, add code to check_buf_options().
21 * - If it's a numeric option, add any necessary bounds checks to do_set().
22 * - If it's a list of flags, add some code in do_set(), search for WW_ALL.
23 * - When adding an option with expansion (P_EXPAND), but with a different
24 * default for Vi and Vim (no P_VI_DEF), add some code at VIMEXP.
25 * - Add documentation! One line in doc/help.txt, full description in
26 * options.txt, and any other related places.
27 * - Add an entry in runtime/optwin.vim.
28 * When making changes:
29 * - Adjust the help for the option in doc/option.txt.
30 * - When an entry has the P_VIM flag, or is lacking the P_VI_DEF flag, add a
31 * comment at the help for the 'compatible' option.
38 * The options that are local to a window or buffer have "indir" set to one of
39 * these values. Special values:
40 * PV_NONE: global option.
41 * PV_WIN is added: window-local option
42 * PV_BUF is added: buffer-local option
43 * PV_BOTH is added: global option which also has a local value.
45 #define PV_BOTH 0x1000
48 #define PV_MASK 0x0fff
49 #define OPT_WIN(x) (idopt_T)(PV_WIN + (int)(x))
50 #define OPT_BUF(x) (idopt_T)(PV_BUF + (int)(x))
51 #define OPT_BOTH(x) (idopt_T)(PV_BOTH + (int)(x))
54 * Definition of the PV_ values for buffer-local options.
55 * The BV_ values are defined in option.h.
57 #define PV_AI OPT_BUF(BV_AI)
58 #define PV_AR OPT_BOTH(OPT_BUF(BV_AR))
60 # define PV_BH OPT_BUF(BV_BH)
61 # define PV_BT OPT_BUF(BV_BT)
62 # define PV_EFM OPT_BOTH(OPT_BUF(BV_EFM))
63 # define PV_GP OPT_BOTH(OPT_BUF(BV_GP))
64 # define PV_MP OPT_BOTH(OPT_BUF(BV_MP))
66 #define PV_BIN OPT_BUF(BV_BIN)
67 #define PV_BL OPT_BUF(BV_BL)
69 # define PV_BOMB OPT_BUF(BV_BOMB)
71 #define PV_CI OPT_BUF(BV_CI)
73 # define PV_CIN OPT_BUF(BV_CIN)
74 # define PV_CINK OPT_BUF(BV_CINK)
75 # define PV_CINO OPT_BUF(BV_CINO)
77 #if defined(FEAT_SMARTINDENT) || defined(FEAT_CINDENT)
78 # define PV_CINW OPT_BUF(BV_CINW)
81 # define PV_CMS OPT_BUF(BV_CMS)
84 # define PV_COM OPT_BUF(BV_COM)
86 #ifdef FEAT_INS_EXPAND
87 # define PV_CPT OPT_BUF(BV_CPT)
88 # define PV_DICT OPT_BOTH(OPT_BUF(BV_DICT))
89 # define PV_TSR OPT_BOTH(OPT_BUF(BV_TSR))
91 #ifdef FEAT_COMPL_FUNC
92 # define PV_CFU OPT_BUF(BV_CFU)
95 # define PV_DEF OPT_BOTH(OPT_BUF(BV_DEF))
96 # define PV_INC OPT_BOTH(OPT_BUF(BV_INC))
98 #define PV_EOL OPT_BUF(BV_EOL)
99 #define PV_EP OPT_BOTH(OPT_BUF(BV_EP))
100 #define PV_ET OPT_BUF(BV_ET)
102 # define PV_FENC OPT_BUF(BV_FENC)
104 #if defined(FEAT_BEVAL) && defined(FEAT_EVAL)
105 # define PV_BEXPR OPT_BOTH(OPT_BUF(BV_BEXPR))
108 # define PV_FEX OPT_BUF(BV_FEX)
110 #define PV_FF OPT_BUF(BV_FF)
111 #define PV_FLP OPT_BUF(BV_FLP)
112 #define PV_FO OPT_BUF(BV_FO)
114 # define PV_FT OPT_BUF(BV_FT)
116 #define PV_IMI OPT_BUF(BV_IMI)
117 #define PV_IMS OPT_BUF(BV_IMS)
118 #if defined(FEAT_CINDENT) && defined(FEAT_EVAL)
119 # define PV_INDE OPT_BUF(BV_INDE)
120 # define PV_INDK OPT_BUF(BV_INDK)
122 #if defined(FEAT_FIND_ID) && defined(FEAT_EVAL)
123 # define PV_INEX OPT_BUF(BV_INEX)
125 #define PV_INF OPT_BUF(BV_INF)
126 #define PV_ISK OPT_BUF(BV_ISK)
128 # define PV_KEY OPT_BUF(BV_KEY)
131 # define PV_KMAP OPT_BUF(BV_KMAP)
133 #define PV_KP OPT_BOTH(OPT_BUF(BV_KP))
135 # define PV_LISP OPT_BUF(BV_LISP)
137 #define PV_MA OPT_BUF(BV_MA)
139 # define PV_MIG OPT_BUF(BV_MIG)
141 #define PV_ML OPT_BUF(BV_ML)
142 #define PV_MOD OPT_BUF(BV_MOD)
143 #define PV_MPS OPT_BUF(BV_MPS)
144 #define PV_NF OPT_BUF(BV_NF)
145 #ifdef FEAT_OSFILETYPE
146 # define PV_OFT OPT_BUF(BV_OFT)
148 #ifdef FEAT_COMPL_FUNC
149 # define PV_OFU OPT_BUF(BV_OFU)
151 #define PV_PATH OPT_BOTH(OPT_BUF(BV_PATH))
152 #define PV_PI OPT_BUF(BV_PI)
154 # define PV_QE OPT_BUF(BV_QE)
156 #define PV_RO OPT_BUF(BV_RO)
157 #ifdef FEAT_SMARTINDENT
158 # define PV_SI OPT_BUF(BV_SI)
161 # define PV_SN OPT_BUF(BV_SN)
164 # define PV_SMC OPT_BUF(BV_SMC)
165 # define PV_SYN OPT_BUF(BV_SYN)
168 # define PV_SPC OPT_BUF(BV_SPC)
169 # define PV_SPF OPT_BUF(BV_SPF)
170 # define PV_SPL OPT_BUF(BV_SPL)
172 #define PV_STS OPT_BUF(BV_STS)
173 #ifdef FEAT_SEARCHPATH
174 # define PV_SUA OPT_BUF(BV_SUA)
176 #define PV_SW OPT_BUF(BV_SW)
177 #define PV_SWF OPT_BUF(BV_SWF)
178 #define PV_TAGS OPT_BOTH(OPT_BUF(BV_TAGS))
179 #define PV_TS OPT_BUF(BV_TS)
180 #define PV_TW OPT_BUF(BV_TW)
181 #define PV_TX OPT_BUF(BV_TX)
182 #define PV_WM OPT_BUF(BV_WM)
185 * Definition of the PV_ values for window-local options.
186 * The WV_ values are defined in option.h.
188 #define PV_LIST OPT_WIN(WV_LIST)
190 # define PV_ARAB OPT_WIN(WV_ARAB)
193 # define PV_DIFF OPT_WIN(WV_DIFF)
196 # define PV_FDC OPT_WIN(WV_FDC)
197 # define PV_FEN OPT_WIN(WV_FEN)
198 # define PV_FDI OPT_WIN(WV_FDI)
199 # define PV_FDL OPT_WIN(WV_FDL)
200 # define PV_FDM OPT_WIN(WV_FDM)
201 # define PV_FML OPT_WIN(WV_FML)
202 # define PV_FDN OPT_WIN(WV_FDN)
204 # define PV_FDE OPT_WIN(WV_FDE)
205 # define PV_FDT OPT_WIN(WV_FDT)
207 # define PV_FMR OPT_WIN(WV_FMR)
209 #ifdef FEAT_LINEBREAK
210 # define PV_LBR OPT_WIN(WV_LBR)
212 #define PV_NU OPT_WIN(WV_NU)
213 #ifdef FEAT_LINEBREAK
214 # define PV_NUW OPT_WIN(WV_NUW)
216 #if defined(FEAT_WINDOWS) && defined(FEAT_QUICKFIX)
217 # define PV_PVW OPT_WIN(WV_PVW)
219 #ifdef FEAT_RIGHTLEFT
220 # define PV_RL OPT_WIN(WV_RL)
221 # define PV_RLC OPT_WIN(WV_RLC)
223 #ifdef FEAT_SCROLLBIND
224 # define PV_SCBIND OPT_WIN(WV_SCBIND)
226 #define PV_SCROLL OPT_WIN(WV_SCROLL)
228 # define PV_SPELL OPT_WIN(WV_SPELL)
231 # define PV_CUC OPT_WIN(WV_CUC)
232 # define PV_CUL OPT_WIN(WV_CUL)
235 # define PV_STL OPT_BOTH(OPT_WIN(WV_STL))
238 # define PV_WFH OPT_WIN(WV_WFH)
240 #ifdef FEAT_VERTSPLIT
241 # define PV_WFW OPT_WIN(WV_WFW)
243 #define PV_WRAP OPT_WIN(WV_WRAP)
246 /* WV_ and BV_ values get typecasted to this for the "indir" field */
250 PV_MAXVAL
= 0xffff /* to avoid warnings for value out of range */
254 * Options local to a window have a value local to a buffer and global to all
255 * buffers. Indicate this by setting "var" to VAR_WIN.
257 #define VAR_WIN ((char_u *)-1)
260 * These are the global values for options which are also local to a buffer.
261 * Only to be used in option.c!
268 #if defined(FEAT_QUICKFIX)
276 static char_u
*p_cink
;
277 static char_u
*p_cino
;
279 #if defined(FEAT_SMARTINDENT) || defined(FEAT_CINDENT)
280 static char_u
*p_cinw
;
283 static char_u
*p_com
;
286 static char_u
*p_cms
;
288 #ifdef FEAT_INS_EXPAND
289 static char_u
*p_cpt
;
291 #ifdef FEAT_COMPL_FUNC
292 static char_u
*p_cfu
;
293 static char_u
*p_ofu
;
298 static char_u
*p_fenc
;
302 static char_u
*p_flp
;
306 static long p_iminsert
;
307 static long p_imsearch
;
308 #if defined(FEAT_FIND_ID) && defined(FEAT_EVAL)
309 static char_u
*p_inex
;
311 #if defined(FEAT_CINDENT) && defined(FEAT_EVAL)
312 static char_u
*p_inde
;
313 static char_u
*p_indk
;
315 #if defined(FEAT_EVAL)
316 static char_u
*p_fex
;
319 static char_u
*p_isk
;
321 static char_u
*p_key
;
329 static char_u
*p_mps
;
331 #ifdef FEAT_OSFILETYPE
332 static char_u
*p_oft
;
339 #ifdef FEAT_SMARTINDENT
346 #if defined(FEAT_SEARCHPATH)
347 static char_u
*p_sua
;
353 static char_u
*p_syn
;
356 static char_u
*p_spc
;
357 static char_u
*p_spf
;
358 static char_u
*p_spl
;
365 static char_u
*p_keymap
;
368 /* Saved values for when 'bin' is set. */
369 static int p_et_nobin
;
370 static int p_ml_nobin
;
371 static long p_tw_nobin
;
372 static long p_wm_nobin
;
374 /* Saved values for when 'paste' is set */
375 static long p_tw_nopaste
;
376 static long p_wm_nopaste
;
377 static long p_sts_nopaste
;
378 static int p_ai_nopaste
;
382 char *fullname
; /* full option name */
383 char *shortname
; /* permissible abbreviation */
384 long_u flags
; /* see below */
385 char_u
*var
; /* global option: pointer to variable;
386 * window-local option: VAR_WIN;
387 * buffer-local option: global value */
388 idopt_T indir
; /* global option: PV_NONE;
389 * local option: indirect option index */
390 char_u
*def_val
[2]; /* default values for variable (vi and vim) */
392 scid_T scriptID
; /* script in which the option was last set */
393 # define SCRIPTID_INIT , 0
395 # define SCRIPTID_INIT
399 #define VI_DEFAULT 0 /* def_val[VI_DEFAULT] is Vi default value */
400 #define VIM_DEFAULT 1 /* def_val[VIM_DEFAULT] is Vim default value */
405 #define P_BOOL 0x01 /* the option is boolean */
406 #define P_NUM 0x02 /* the option is numeric */
407 #define P_STRING 0x04 /* the option is a string */
408 #define P_ALLOCED 0x08 /* the string option is in allocated memory,
409 must use free_string_option() when
410 assigning new value. Not set if default is
412 #define P_EXPAND 0x10 /* environment expansion. NOTE: P_EXPAND can
413 never be used for local or hidden options! */
414 #define P_NODEFAULT 0x40 /* don't set to default value */
415 #define P_DEF_ALLOCED 0x80 /* default value is in allocated memory, must
416 use vim_free() when assigning new value */
417 #define P_WAS_SET 0x100 /* option has been set/reset */
418 #define P_NO_MKRC 0x200 /* don't include in :mkvimrc output */
419 #define P_VI_DEF 0x400 /* Use Vi default for Vim */
420 #define P_VIM 0x800 /* Vim option, reset when 'cp' set */
422 /* when option changed, what to display: */
423 #define P_RSTAT 0x1000 /* redraw status lines */
424 #define P_RWIN 0x2000 /* redraw current window */
425 #define P_RBUF 0x4000 /* redraw current buffer */
426 #define P_RALL 0x6000 /* redraw all windows */
427 #define P_RCLR 0x7000 /* clear and redraw all */
429 #define P_COMMA 0x8000 /* comma separated list */
430 #define P_NODUP 0x10000L/* don't allow duplicate strings */
431 #define P_FLAGLIST 0x20000L/* list of single-char flags */
433 #define P_SECURE 0x40000L/* cannot change in modeline or secure mode */
434 #define P_GETTEXT 0x80000L/* expand default value with _() */
435 #define P_NOGLOB 0x100000L/* do not use local value for global vimrc */
436 #define P_NFNAME 0x200000L/* only normal file name chars allowed */
437 #define P_INSECURE 0x400000L/* option was set from a modeline */
438 #define P_PRI_MKRC 0x800000L/* priority for :mkvimrc (setting option has
441 #define ISK_LATIN1 (char_u *)"@,48-57,_,192-255"
443 /* 'isprint' for latin1 is also used for MS-Windows cp1252, where 0x80 is used
444 * for the currency sign. */
445 #if defined(MSDOS) || defined(MSWIN) || defined(OS2)
446 # define ISP_LATIN1 (char_u *)"@,~-255"
448 # define ISP_LATIN1 (char_u *)"@,161-255"
451 /* The 16 bit MS-DOS version is low on space, make the string as short as
452 * possible when compiling with few features. */
453 #if defined(FEAT_DIFF) || defined(FEAT_FOLDING) || defined(FEAT_SPELL) \
454 || defined(FEAT_VERTSPLIT) || defined(FEAT_CLIPBOARD) \
455 || defined(FEAT_INS_EXPAND) || defined(FEAT_SYN_HL)
456 # define HIGHLIGHT_INIT "8:SpecialKey,@:NonText,d:Directory,e:ErrorMsg,i:IncSearch,l:Search,m:MoreMsg,M:ModeMsg,n:LineNr,r:Question,s:StatusLine,S:StatusLineNC,c:VertSplit,t:Title,v:Visual,V:VisualNOS,w:WarningMsg,W:WildMenu,f:Folded,F:FoldColumn,A:DiffAdd,C:DiffChange,D:DiffDelete,T:DiffText,>:SignColumn,B:SpellBad,P:SpellCap,R:SpellRare,L:SpellLocal,+:Pmenu,=:PmenuSel,x:PmenuSbar,X:PmenuThumb,*:TabLine,#:TabLineSel,_:TabLineFill,!:CursorColumn,.:CursorLine"
458 # define HIGHLIGHT_INIT "8:SpecialKey,@:NonText,d:Directory,e:ErrorMsg,i:IncSearch,l:Search,m:MoreMsg,M:ModeMsg,n:LineNr,r:Question,s:StatusLine,S:StatusLineNC,t:Title,v:Visual,w:WarningMsg,W:WildMenu,>:SignColumn,*:TabLine,#:TabLineSel,_:TabLineFill"
462 * options[] is initialized here.
463 * The order of the options MUST be alphabetic for ":set all" and findoption().
464 * All option names MUST start with a lowercase letter (for findoption()).
465 * Exception: "t_" options are at the end.
466 * The options with a NULL variable are 'hidden': a set command for them is
467 * ignored and they are not printed.
469 static struct vimoption
475 {"aleph", "al", P_NUM
|P_VI_DEF
,
476 #ifdef FEAT_RIGHTLEFT
477 (char_u
*)&p_aleph
, PV_NONE
,
479 (char_u
*)NULL
, PV_NONE
,
482 #if (defined(MSDOS) || defined(WIN3264) || defined(OS2)) && !defined(FEAT_GUI_W32)
487 (char_u
*)0L} SCRIPTID_INIT
},
488 {"antialias", "anti", P_BOOL
|P_VI_DEF
|P_VIM
|P_RCLR
,
489 #if defined(FEAT_GUI) && defined(MACOS_X)
490 (char_u
*)&p_antialias
, PV_NONE
,
491 {(char_u
*)FALSE
, (char_u
*)FALSE
}
493 (char_u
*)NULL
, PV_NONE
,
494 {(char_u
*)FALSE
, (char_u
*)FALSE
}
497 {"arabic", "arab", P_BOOL
|P_VI_DEF
|P_VIM
,
499 (char_u
*)VAR_WIN
, PV_ARAB
,
501 (char_u
*)NULL
, PV_NONE
,
503 {(char_u
*)FALSE
, (char_u
*)0L} SCRIPTID_INIT
},
504 {"arabicshape", "arshape", P_BOOL
|P_VI_DEF
|P_VIM
|P_RCLR
,
506 (char_u
*)&p_arshape
, PV_NONE
,
508 (char_u
*)NULL
, PV_NONE
,
510 {(char_u
*)TRUE
, (char_u
*)0L} SCRIPTID_INIT
},
511 {"allowrevins", "ari", P_BOOL
|P_VI_DEF
|P_VIM
,
512 #ifdef FEAT_RIGHTLEFT
513 (char_u
*)&p_ari
, PV_NONE
,
515 (char_u
*)NULL
, PV_NONE
,
517 {(char_u
*)FALSE
, (char_u
*)0L} SCRIPTID_INIT
},
518 {"altkeymap", "akm", P_BOOL
|P_VI_DEF
,
520 (char_u
*)&p_altkeymap
, PV_NONE
,
522 (char_u
*)NULL
, PV_NONE
,
524 {(char_u
*)FALSE
, (char_u
*)0L} SCRIPTID_INIT
},
525 {"ambiwidth", "ambw", P_STRING
|P_VI_DEF
|P_RCLR
,
526 #if defined(FEAT_MBYTE)
527 (char_u
*)&p_ambw
, PV_NONE
,
528 {(char_u
*)"single", (char_u
*)0L}
530 (char_u
*)NULL
, PV_NONE
,
531 {(char_u
*)0L, (char_u
*)0L}
534 #ifdef FEAT_AUTOCHDIR
535 {"autochdir", "acd", P_BOOL
|P_VI_DEF
,
536 (char_u
*)&p_acd
, PV_NONE
,
537 {(char_u
*)FALSE
, (char_u
*)0L} SCRIPTID_INIT
},
539 {"autoindent", "ai", P_BOOL
|P_VI_DEF
,
540 (char_u
*)&p_ai
, PV_AI
,
541 {(char_u
*)FALSE
, (char_u
*)0L} SCRIPTID_INIT
},
542 {"autoprint", "ap", P_BOOL
|P_VI_DEF
,
543 (char_u
*)NULL
, PV_NONE
,
544 {(char_u
*)FALSE
, (char_u
*)0L} SCRIPTID_INIT
},
545 {"autoread", "ar", P_BOOL
|P_VI_DEF
,
546 (char_u
*)&p_ar
, PV_AR
,
547 {(char_u
*)FALSE
, (char_u
*)0L} SCRIPTID_INIT
},
548 {"autowrite", "aw", P_BOOL
|P_VI_DEF
,
549 (char_u
*)&p_aw
, PV_NONE
,
550 {(char_u
*)FALSE
, (char_u
*)0L} SCRIPTID_INIT
},
551 {"autowriteall","awa", P_BOOL
|P_VI_DEF
,
552 (char_u
*)&p_awa
, PV_NONE
,
553 {(char_u
*)FALSE
, (char_u
*)0L} SCRIPTID_INIT
},
554 {"background", "bg", P_STRING
|P_VI_DEF
|P_RCLR
,
555 (char_u
*)&p_bg
, PV_NONE
,
557 #if (defined(MSDOS) || defined(OS2) || defined(WIN3264)) && !defined(FEAT_GUI)
562 (char_u
*)0L} SCRIPTID_INIT
},
563 {"backspace", "bs", P_STRING
|P_VI_DEF
|P_VIM
|P_COMMA
|P_NODUP
,
564 (char_u
*)&p_bs
, PV_NONE
,
565 {(char_u
*)"", (char_u
*)0L} SCRIPTID_INIT
},
566 {"backup", "bk", P_BOOL
|P_VI_DEF
|P_VIM
,
567 (char_u
*)&p_bk
, PV_NONE
,
568 {(char_u
*)FALSE
, (char_u
*)0L} SCRIPTID_INIT
},
569 {"backupcopy", "bkc", P_STRING
|P_VIM
|P_COMMA
|P_NODUP
,
570 (char_u
*)&p_bkc
, PV_NONE
,
572 {(char_u
*)"yes", (char_u
*)"auto"}
574 {(char_u
*)"auto", (char_u
*)"auto"}
577 {"backupdir", "bdir", P_STRING
|P_EXPAND
|P_VI_DEF
|P_COMMA
|P_NODUP
|P_SECURE
,
578 (char_u
*)&p_bdir
, PV_NONE
,
579 {(char_u
*)DFLT_BDIR
, (char_u
*)0L} SCRIPTID_INIT
},
580 {"backupext", "bex", P_STRING
|P_VI_DEF
|P_NFNAME
,
581 (char_u
*)&p_bex
, PV_NONE
,
588 (char_u
*)0L} SCRIPTID_INIT
},
589 {"backupskip", "bsk", P_STRING
|P_VI_DEF
|P_COMMA
,
591 (char_u
*)&p_bsk
, PV_NONE
,
592 {(char_u
*)"", (char_u
*)0L}
594 (char_u
*)NULL
, PV_NONE
,
595 {(char_u
*)0L, (char_u
*)0L}
599 {"balloondelay","bdlay",P_NUM
|P_VI_DEF
,
600 (char_u
*)&p_bdlay
, PV_NONE
,
601 {(char_u
*)600L, (char_u
*)0L} SCRIPTID_INIT
},
602 {"ballooneval", "beval",P_BOOL
|P_VI_DEF
|P_NO_MKRC
,
603 (char_u
*)&p_beval
, PV_NONE
,
604 {(char_u
*)FALSE
, (char_u
*)0L} SCRIPTID_INIT
},
606 {"balloonexpr", "bexpr", P_STRING
|P_ALLOCED
|P_VI_DEF
|P_VIM
,
607 (char_u
*)&p_bexpr
, PV_BEXPR
,
608 {(char_u
*)"", (char_u
*)0L} SCRIPTID_INIT
},
611 {"beautify", "bf", P_BOOL
|P_VI_DEF
,
612 (char_u
*)NULL
, PV_NONE
,
613 {(char_u
*)FALSE
, (char_u
*)0L} SCRIPTID_INIT
},
614 {"binary", "bin", P_BOOL
|P_VI_DEF
|P_RSTAT
,
615 (char_u
*)&p_bin
, PV_BIN
,
616 {(char_u
*)FALSE
, (char_u
*)0L} SCRIPTID_INIT
},
617 {"bioskey", "biosk",P_BOOL
|P_VI_DEF
,
619 (char_u
*)&p_biosk
, PV_NONE
,
621 (char_u
*)NULL
, PV_NONE
,
623 {(char_u
*)TRUE
, (char_u
*)0L} SCRIPTID_INIT
},
624 {"bomb", NULL
, P_BOOL
|P_NO_MKRC
|P_VI_DEF
|P_RSTAT
,
626 (char_u
*)&p_bomb
, PV_BOMB
,
628 (char_u
*)NULL
, PV_NONE
,
630 {(char_u
*)FALSE
, (char_u
*)0L} SCRIPTID_INIT
},
631 {"breakat", "brk", P_STRING
|P_VI_DEF
|P_RALL
|P_FLAGLIST
,
632 #ifdef FEAT_LINEBREAK
633 (char_u
*)&p_breakat
, PV_NONE
,
634 {(char_u
*)" \t!@*-+;:,./?", (char_u
*)0L}
636 (char_u
*)NULL
, PV_NONE
,
637 {(char_u
*)0L, (char_u
*)0L}
640 {"browsedir", "bsdir",P_STRING
|P_VI_DEF
,
642 (char_u
*)&p_bsdir
, PV_NONE
,
643 {(char_u
*)"last", (char_u
*)0L}
645 (char_u
*)NULL
, PV_NONE
,
646 {(char_u
*)0L, (char_u
*)0L}
649 {"bufhidden", "bh", P_STRING
|P_ALLOCED
|P_VI_DEF
|P_NOGLOB
,
650 #if defined(FEAT_QUICKFIX)
651 (char_u
*)&p_bh
, PV_BH
,
652 {(char_u
*)"", (char_u
*)0L}
654 (char_u
*)NULL
, PV_NONE
,
655 {(char_u
*)0L, (char_u
*)0L}
658 {"buflisted", "bl", P_BOOL
|P_VI_DEF
|P_NOGLOB
,
659 (char_u
*)&p_bl
, PV_BL
,
660 {(char_u
*)1L, (char_u
*)0L}
662 {"buftype", "bt", P_STRING
|P_ALLOCED
|P_VI_DEF
|P_NOGLOB
,
663 #if defined(FEAT_QUICKFIX)
664 (char_u
*)&p_bt
, PV_BT
,
665 {(char_u
*)"", (char_u
*)0L}
667 (char_u
*)NULL
, PV_NONE
,
668 {(char_u
*)0L, (char_u
*)0L}
671 {"casemap", "cmp", P_STRING
|P_VI_DEF
|P_COMMA
|P_NODUP
,
673 (char_u
*)&p_cmp
, PV_NONE
,
674 {(char_u
*)"internal,keepascii", (char_u
*)0L}
676 (char_u
*)NULL
, PV_NONE
,
677 {(char_u
*)0L, (char_u
*)0L}
680 {"cdpath", "cd", P_STRING
|P_EXPAND
|P_VI_DEF
|P_COMMA
|P_NODUP
,
681 #ifdef FEAT_SEARCHPATH
682 (char_u
*)&p_cdpath
, PV_NONE
,
683 {(char_u
*)",,", (char_u
*)0L}
685 (char_u
*)NULL
, PV_NONE
,
686 {(char_u
*)0L, (char_u
*)0L}
689 {"cedit", NULL
, P_STRING
,
691 (char_u
*)&p_cedit
, PV_NONE
,
692 {(char_u
*)"", (char_u
*)CTRL_F_STR
}
694 (char_u
*)NULL
, PV_NONE
,
695 {(char_u
*)0L, (char_u
*)0L}
698 {"charconvert", "ccv", P_STRING
|P_VI_DEF
|P_SECURE
,
699 #if defined(FEAT_MBYTE) && defined(FEAT_EVAL)
700 (char_u
*)&p_ccv
, PV_NONE
,
701 {(char_u
*)"", (char_u
*)0L}
703 (char_u
*)NULL
, PV_NONE
,
704 {(char_u
*)0L, (char_u
*)0L}
707 {"charspace", "csp", P_NUM
|P_NODEFAULT
|P_VIM
|P_RCLR
,
709 (char_u
*)&p_charspace
, PV_NONE
,
711 (char_u
*)NULL
, PV_NONE
,
713 {(char_u
*)0L, (char_u
*)0L}
715 {"cindent", "cin", P_BOOL
|P_VI_DEF
|P_VIM
,
717 (char_u
*)&p_cin
, PV_CIN
,
719 (char_u
*)NULL
, PV_NONE
,
721 {(char_u
*)FALSE
, (char_u
*)0L} SCRIPTID_INIT
},
722 {"cinkeys", "cink", P_STRING
|P_ALLOCED
|P_VI_DEF
|P_COMMA
|P_NODUP
,
724 (char_u
*)&p_cink
, PV_CINK
,
725 {(char_u
*)"0{,0},0),:,0#,!^F,o,O,e", (char_u
*)0L}
727 (char_u
*)NULL
, PV_NONE
,
728 {(char_u
*)0L, (char_u
*)0L}
731 {"cinoptions", "cino", P_STRING
|P_ALLOCED
|P_VI_DEF
|P_COMMA
|P_NODUP
,
733 (char_u
*)&p_cino
, PV_CINO
,
735 (char_u
*)NULL
, PV_NONE
,
737 {(char_u
*)"", (char_u
*)0L} SCRIPTID_INIT
},
738 {"cinwords", "cinw", P_STRING
|P_ALLOCED
|P_VI_DEF
|P_COMMA
|P_NODUP
,
739 #if defined(FEAT_SMARTINDENT) || defined(FEAT_CINDENT)
740 (char_u
*)&p_cinw
, PV_CINW
,
741 {(char_u
*)"if,else,while,do,for,switch",
744 (char_u
*)NULL
, PV_NONE
,
745 {(char_u
*)0L, (char_u
*)0L}
748 {"clipboard", "cb", P_STRING
|P_VI_DEF
|P_COMMA
|P_NODUP
,
749 #ifdef FEAT_CLIPBOARD
750 (char_u
*)&p_cb
, PV_NONE
,
751 # ifdef FEAT_XCLIPBOARD
752 {(char_u
*)"autoselect,exclude:cons\\|linux",
755 {(char_u
*)"", (char_u
*)0L}
758 (char_u
*)NULL
, PV_NONE
,
759 {(char_u
*)"", (char_u
*)0L}
762 {"cmdheight", "ch", P_NUM
|P_VI_DEF
|P_RALL
,
763 (char_u
*)&p_ch
, PV_NONE
,
764 {(char_u
*)1L, (char_u
*)0L} SCRIPTID_INIT
},
765 {"cmdwinheight", "cwh", P_NUM
|P_VI_DEF
,
767 (char_u
*)&p_cwh
, PV_NONE
,
769 (char_u
*)NULL
, PV_NONE
,
771 {(char_u
*)7L, (char_u
*)0L} SCRIPTID_INIT
},
772 {"columns", "co", P_NUM
|P_NODEFAULT
|P_NO_MKRC
|P_VI_DEF
|P_RCLR
,
773 (char_u
*)&Columns
, PV_NONE
,
774 {(char_u
*)80L, (char_u
*)0L} SCRIPTID_INIT
},
775 {"comments", "com", P_STRING
|P_ALLOCED
|P_VI_DEF
|P_COMMA
|P_NODUP
,
777 (char_u
*)&p_com
, PV_COM
,
778 {(char_u
*)"s1:/*,mb:*,ex:*/,://,b:#,:%,:XCOMM,n:>,fb:-",
781 (char_u
*)NULL
, PV_NONE
,
782 {(char_u
*)0L, (char_u
*)0L}
785 {"commentstring", "cms", P_STRING
|P_ALLOCED
|P_VI_DEF
,
787 (char_u
*)&p_cms
, PV_CMS
,
788 {(char_u
*)"/*%s*/", (char_u
*)0L}
790 (char_u
*)NULL
, PV_NONE
,
791 {(char_u
*)0L, (char_u
*)0L}
794 /* P_PRI_MKRC isn't needed here, optval_default()
795 * always returns TRUE for 'compatible' */
796 {"compatible", "cp", P_BOOL
|P_RALL
,
797 (char_u
*)&p_cp
, PV_NONE
,
798 {(char_u
*)TRUE
, (char_u
*)FALSE
} SCRIPTID_INIT
},
799 {"complete", "cpt", P_STRING
|P_ALLOCED
|P_VI_DEF
|P_COMMA
|P_NODUP
,
800 #ifdef FEAT_INS_EXPAND
801 (char_u
*)&p_cpt
, PV_CPT
,
802 {(char_u
*)".,w,b,u,t,i", (char_u
*)0L}
804 (char_u
*)NULL
, PV_NONE
,
805 {(char_u
*)0L, (char_u
*)0L}
808 {"completefunc", "cfu", P_STRING
|P_ALLOCED
|P_VI_DEF
|P_SECURE
,
809 #ifdef FEAT_COMPL_FUNC
810 (char_u
*)&p_cfu
, PV_CFU
,
811 {(char_u
*)"", (char_u
*)0L}
813 (char_u
*)NULL
, PV_NONE
,
814 {(char_u
*)0L, (char_u
*)0L}
817 {"completeopt", "cot", P_STRING
|P_VI_DEF
|P_COMMA
|P_NODUP
,
818 #ifdef FEAT_INS_EXPAND
819 (char_u
*)&p_cot
, PV_NONE
,
820 {(char_u
*)"menu,preview", (char_u
*)0L}
822 (char_u
*)NULL
, PV_NONE
,
823 {(char_u
*)0L, (char_u
*)0L}
826 {"confirm", "cf", P_BOOL
|P_VI_DEF
,
827 #if defined(FEAT_GUI_DIALOG) || defined(FEAT_CON_DIALOG)
828 (char_u
*)&p_confirm
, PV_NONE
,
830 (char_u
*)NULL
, PV_NONE
,
832 {(char_u
*)FALSE
, (char_u
*)0L} SCRIPTID_INIT
},
833 {"conskey", "consk",P_BOOL
|P_VI_DEF
,
835 (char_u
*)&p_consk
, PV_NONE
,
837 (char_u
*)NULL
, PV_NONE
,
839 {(char_u
*)FALSE
, (char_u
*)0L} SCRIPTID_INIT
},
840 {"copyindent", "ci", P_BOOL
|P_VI_DEF
|P_VIM
,
841 (char_u
*)&p_ci
, PV_CI
,
842 {(char_u
*)FALSE
, (char_u
*)0L} SCRIPTID_INIT
},
843 {"cpoptions", "cpo", P_STRING
|P_VIM
|P_RALL
|P_FLAGLIST
,
844 (char_u
*)&p_cpo
, PV_NONE
,
845 {(char_u
*)CPO_VI
, (char_u
*)CPO_VIM
}
847 {"cscopepathcomp", "cspc", P_NUM
|P_VI_DEF
|P_VIM
,
849 (char_u
*)&p_cspc
, PV_NONE
,
851 (char_u
*)NULL
, PV_NONE
,
853 {(char_u
*)0L, (char_u
*)0L} SCRIPTID_INIT
},
854 {"cscopeprg", "csprg", P_STRING
|P_EXPAND
|P_VI_DEF
|P_SECURE
,
856 (char_u
*)&p_csprg
, PV_NONE
,
857 {(char_u
*)"cscope", (char_u
*)0L}
859 (char_u
*)NULL
, PV_NONE
,
860 {(char_u
*)0L, (char_u
*)0L}
863 {"cscopequickfix", "csqf", P_STRING
|P_VI_DEF
|P_COMMA
|P_NODUP
,
864 #if defined(FEAT_CSCOPE) && defined(FEAT_QUICKFIX)
865 (char_u
*)&p_csqf
, PV_NONE
,
866 {(char_u
*)"", (char_u
*)0L}
868 (char_u
*)NULL
, PV_NONE
,
869 {(char_u
*)0L, (char_u
*)0L}
872 {"cscopetag", "cst", P_BOOL
|P_VI_DEF
|P_VIM
,
874 (char_u
*)&p_cst
, PV_NONE
,
876 (char_u
*)NULL
, PV_NONE
,
878 {(char_u
*)0L, (char_u
*)0L} SCRIPTID_INIT
},
879 {"cscopetagorder", "csto", P_NUM
|P_VI_DEF
|P_VIM
,
881 (char_u
*)&p_csto
, PV_NONE
,
883 (char_u
*)NULL
, PV_NONE
,
885 {(char_u
*)0L, (char_u
*)0L} SCRIPTID_INIT
},
886 {"cscopeverbose", "csverb", P_BOOL
|P_VI_DEF
|P_VIM
,
888 (char_u
*)&p_csverbose
, PV_NONE
,
890 (char_u
*)NULL
, PV_NONE
,
892 {(char_u
*)0L, (char_u
*)0L} SCRIPTID_INIT
},
893 {"cursorcolumn", "cuc", P_BOOL
|P_VI_DEF
|P_RWIN
,
895 (char_u
*)VAR_WIN
, PV_CUC
,
897 (char_u
*)NULL
, PV_NONE
,
899 {(char_u
*)FALSE
, (char_u
*)0L} SCRIPTID_INIT
},
900 {"cursorline", "cul", P_BOOL
|P_VI_DEF
|P_RWIN
,
902 (char_u
*)VAR_WIN
, PV_CUL
,
904 (char_u
*)NULL
, PV_NONE
,
906 {(char_u
*)FALSE
, (char_u
*)0L} SCRIPTID_INIT
},
907 {"debug", NULL
, P_STRING
|P_VI_DEF
,
908 (char_u
*)&p_debug
, PV_NONE
,
909 {(char_u
*)"", (char_u
*)0L} SCRIPTID_INIT
},
910 {"define", "def", P_STRING
|P_ALLOCED
|P_VI_DEF
,
912 (char_u
*)&p_def
, PV_DEF
,
913 {(char_u
*)"^\\s*#\\s*define", (char_u
*)0L}
915 (char_u
*)NULL
, PV_NONE
,
916 {(char_u
*)NULL
, (char_u
*)0L}
919 {"delcombine", "deco", P_BOOL
|P_VI_DEF
|P_VIM
,
921 (char_u
*)&p_deco
, PV_NONE
,
923 (char_u
*)NULL
, PV_NONE
,
925 {(char_u
*)FALSE
, (char_u
*)0L} SCRIPTID_INIT
},
926 {"dictionary", "dict", P_STRING
|P_EXPAND
|P_VI_DEF
|P_COMMA
|P_NODUP
,
927 #ifdef FEAT_INS_EXPAND
928 (char_u
*)&p_dict
, PV_DICT
,
930 (char_u
*)NULL
, PV_NONE
,
932 {(char_u
*)"", (char_u
*)0L} SCRIPTID_INIT
},
933 {"diff", NULL
, P_BOOL
|P_VI_DEF
|P_RWIN
|P_NOGLOB
,
935 (char_u
*)VAR_WIN
, PV_DIFF
,
937 (char_u
*)NULL
, PV_NONE
,
939 {(char_u
*)FALSE
, (char_u
*)0L} SCRIPTID_INIT
},
940 {"diffexpr", "dex", P_STRING
|P_VI_DEF
|P_SECURE
,
941 #if defined(FEAT_DIFF) && defined(FEAT_EVAL)
942 (char_u
*)&p_dex
, PV_NONE
,
943 {(char_u
*)"", (char_u
*)0L}
945 (char_u
*)NULL
, PV_NONE
,
946 {(char_u
*)0L, (char_u
*)0L}
949 {"diffopt", "dip", P_STRING
|P_ALLOCED
|P_VI_DEF
|P_RWIN
|P_COMMA
|P_NODUP
,
951 (char_u
*)&p_dip
, PV_NONE
,
952 {(char_u
*)"filler", (char_u
*)NULL
}
954 (char_u
*)NULL
, PV_NONE
,
955 {(char_u
*)"", (char_u
*)NULL
}
958 {"digraph", "dg", P_BOOL
|P_VI_DEF
|P_VIM
,
960 (char_u
*)&p_dg
, PV_NONE
,
962 (char_u
*)NULL
, PV_NONE
,
964 {(char_u
*)FALSE
, (char_u
*)0L} SCRIPTID_INIT
},
965 {"directory", "dir", P_STRING
|P_EXPAND
|P_VI_DEF
|P_COMMA
|P_NODUP
|P_SECURE
,
966 (char_u
*)&p_dir
, PV_NONE
,
967 {(char_u
*)DFLT_DIR
, (char_u
*)0L} SCRIPTID_INIT
},
968 {"display", "dy", P_STRING
|P_VI_DEF
|P_COMMA
|P_RALL
|P_NODUP
,
969 (char_u
*)&p_dy
, PV_NONE
,
970 {(char_u
*)"", (char_u
*)0L} SCRIPTID_INIT
},
971 {"eadirection", "ead", P_STRING
|P_VI_DEF
,
972 #ifdef FEAT_VERTSPLIT
973 (char_u
*)&p_ead
, PV_NONE
,
974 {(char_u
*)"both", (char_u
*)0L}
976 (char_u
*)NULL
, PV_NONE
,
977 {(char_u
*)NULL
, (char_u
*)0L}
980 {"edcompatible","ed", P_BOOL
|P_VI_DEF
,
981 (char_u
*)&p_ed
, PV_NONE
,
982 {(char_u
*)FALSE
, (char_u
*)0L} SCRIPTID_INIT
},
983 {"encoding", "enc", P_STRING
|P_VI_DEF
|P_RCLR
,
985 (char_u
*)&p_enc
, PV_NONE
,
986 {(char_u
*)ENC_DFLT
, (char_u
*)0L}
988 (char_u
*)NULL
, PV_NONE
,
989 {(char_u
*)0L, (char_u
*)0L}
992 {"endofline", "eol", P_BOOL
|P_NO_MKRC
|P_VI_DEF
|P_RSTAT
,
993 (char_u
*)&p_eol
, PV_EOL
,
994 {(char_u
*)TRUE
, (char_u
*)0L} SCRIPTID_INIT
},
995 {"equalalways", "ea", P_BOOL
|P_VI_DEF
|P_RALL
,
996 (char_u
*)&p_ea
, PV_NONE
,
997 {(char_u
*)TRUE
, (char_u
*)0L} SCRIPTID_INIT
},
998 {"equalprg", "ep", P_STRING
|P_EXPAND
|P_VI_DEF
|P_SECURE
,
999 (char_u
*)&p_ep
, PV_EP
,
1000 {(char_u
*)"", (char_u
*)0L} SCRIPTID_INIT
},
1001 {"errorbells", "eb", P_BOOL
|P_VI_DEF
,
1002 (char_u
*)&p_eb
, PV_NONE
,
1003 {(char_u
*)FALSE
, (char_u
*)0L} SCRIPTID_INIT
},
1004 {"errorfile", "ef", P_STRING
|P_EXPAND
|P_VI_DEF
|P_SECURE
,
1005 #ifdef FEAT_QUICKFIX
1006 (char_u
*)&p_ef
, PV_NONE
,
1007 {(char_u
*)DFLT_ERRORFILE
, (char_u
*)0L}
1009 (char_u
*)NULL
, PV_NONE
,
1010 {(char_u
*)NULL
, (char_u
*)0L}
1013 {"errorformat", "efm", P_STRING
|P_VI_DEF
|P_COMMA
|P_NODUP
,
1014 #ifdef FEAT_QUICKFIX
1015 (char_u
*)&p_efm
, PV_EFM
,
1016 {(char_u
*)DFLT_EFM
, (char_u
*)0L}
1018 (char_u
*)NULL
, PV_NONE
,
1019 {(char_u
*)NULL
, (char_u
*)0L}
1022 {"esckeys", "ek", P_BOOL
|P_VIM
,
1023 (char_u
*)&p_ek
, PV_NONE
,
1024 {(char_u
*)FALSE
, (char_u
*)TRUE
} SCRIPTID_INIT
},
1025 {"eventignore", "ei", P_STRING
|P_VI_DEF
|P_COMMA
|P_NODUP
,
1027 (char_u
*)&p_ei
, PV_NONE
,
1029 (char_u
*)NULL
, PV_NONE
,
1031 {(char_u
*)"", (char_u
*)0L} SCRIPTID_INIT
},
1032 {"expandtab", "et", P_BOOL
|P_VI_DEF
|P_VIM
,
1033 (char_u
*)&p_et
, PV_ET
,
1034 {(char_u
*)FALSE
, (char_u
*)0L} SCRIPTID_INIT
},
1035 {"exrc", "ex", P_BOOL
|P_VI_DEF
|P_SECURE
,
1036 (char_u
*)&p_exrc
, PV_NONE
,
1037 {(char_u
*)FALSE
, (char_u
*)0L} SCRIPTID_INIT
},
1038 {"fileencoding","fenc", P_STRING
|P_ALLOCED
|P_VI_DEF
|P_RSTAT
|P_RBUF
|P_NO_MKRC
,
1040 (char_u
*)&p_fenc
, PV_FENC
,
1041 {(char_u
*)"", (char_u
*)0L}
1043 (char_u
*)NULL
, PV_NONE
,
1044 {(char_u
*)0L, (char_u
*)0L}
1047 {"fileencodings","fencs", P_STRING
|P_VI_DEF
|P_COMMA
,
1049 (char_u
*)&p_fencs
, PV_NONE
,
1050 {(char_u
*)"ucs-bom", (char_u
*)0L}
1052 (char_u
*)NULL
, PV_NONE
,
1053 {(char_u
*)0L, (char_u
*)0L}
1056 {"fileformat", "ff", P_STRING
|P_ALLOCED
|P_VI_DEF
|P_RSTAT
|P_NO_MKRC
,
1057 (char_u
*)&p_ff
, PV_FF
,
1058 {(char_u
*)DFLT_FF
, (char_u
*)0L} SCRIPTID_INIT
},
1059 {"fileformats", "ffs", P_STRING
|P_VIM
|P_COMMA
|P_NODUP
,
1060 (char_u
*)&p_ffs
, PV_NONE
,
1061 {(char_u
*)DFLT_FFS_VI
, (char_u
*)DFLT_FFS_VIM
}
1063 {"filetype", "ft", P_STRING
|P_ALLOCED
|P_VI_DEF
|P_NOGLOB
|P_NFNAME
,
1065 (char_u
*)&p_ft
, PV_FT
,
1066 {(char_u
*)"", (char_u
*)0L}
1068 (char_u
*)NULL
, PV_NONE
,
1069 {(char_u
*)0L, (char_u
*)0L}
1072 {"fillchars", "fcs", P_STRING
|P_VI_DEF
|P_RALL
|P_COMMA
|P_NODUP
,
1073 #if defined(FEAT_WINDOWS) || defined(FEAT_FOLDING)
1074 (char_u
*)&p_fcs
, PV_NONE
,
1075 {(char_u
*)"vert:|,fold:-", (char_u
*)0L}
1077 (char_u
*)NULL
, PV_NONE
,
1078 {(char_u
*)"", (char_u
*)0L}
1081 {"fkmap", "fk", P_BOOL
|P_VI_DEF
,
1083 (char_u
*)&p_fkmap
, PV_NONE
,
1085 (char_u
*)NULL
, PV_NONE
,
1087 {(char_u
*)FALSE
, (char_u
*)0L} SCRIPTID_INIT
},
1088 {"flash", "fl", P_BOOL
|P_VI_DEF
,
1089 (char_u
*)NULL
, PV_NONE
,
1090 {(char_u
*)FALSE
, (char_u
*)0L} SCRIPTID_INIT
},
1092 {"foldclose", "fcl", P_STRING
|P_VI_DEF
|P_COMMA
|P_NODUP
|P_RWIN
,
1093 (char_u
*)&p_fcl
, PV_NONE
,
1094 {(char_u
*)"", (char_u
*)0L} SCRIPTID_INIT
},
1095 {"foldcolumn", "fdc", P_NUM
|P_VI_DEF
|P_RWIN
,
1096 (char_u
*)VAR_WIN
, PV_FDC
,
1097 {(char_u
*)FALSE
, (char_u
*)0L} SCRIPTID_INIT
},
1098 {"foldenable", "fen", P_BOOL
|P_VI_DEF
|P_RWIN
,
1099 (char_u
*)VAR_WIN
, PV_FEN
,
1100 {(char_u
*)TRUE
, (char_u
*)0L} SCRIPTID_INIT
},
1101 {"foldexpr", "fde", P_STRING
|P_ALLOCED
|P_VIM
|P_VI_DEF
|P_RWIN
,
1103 (char_u
*)VAR_WIN
, PV_FDE
,
1104 {(char_u
*)"0", (char_u
*)NULL
}
1106 (char_u
*)NULL
, PV_NONE
,
1107 {(char_u
*)NULL
, (char_u
*)0L}
1110 {"foldignore", "fdi", P_STRING
|P_ALLOCED
|P_VIM
|P_VI_DEF
|P_RWIN
,
1111 (char_u
*)VAR_WIN
, PV_FDI
,
1112 {(char_u
*)"#", (char_u
*)NULL
} SCRIPTID_INIT
},
1113 {"foldlevel", "fdl", P_NUM
|P_VI_DEF
|P_RWIN
,
1114 (char_u
*)VAR_WIN
, PV_FDL
,
1115 {(char_u
*)0L, (char_u
*)0L} SCRIPTID_INIT
},
1116 {"foldlevelstart","fdls", P_NUM
|P_VI_DEF
,
1117 (char_u
*)&p_fdls
, PV_NONE
,
1118 {(char_u
*)-1L, (char_u
*)0L} SCRIPTID_INIT
},
1119 {"foldmarker", "fmr", P_STRING
|P_ALLOCED
|P_VIM
|P_VI_DEF
|
1120 P_RWIN
|P_COMMA
|P_NODUP
,
1121 (char_u
*)VAR_WIN
, PV_FMR
,
1122 {(char_u
*)"{{{,}}}", (char_u
*)NULL
}
1124 {"foldmethod", "fdm", P_STRING
|P_ALLOCED
|P_VIM
|P_VI_DEF
|P_RWIN
,
1125 (char_u
*)VAR_WIN
, PV_FDM
,
1126 {(char_u
*)"manual", (char_u
*)NULL
} SCRIPTID_INIT
},
1127 {"foldminlines","fml", P_NUM
|P_VI_DEF
|P_RWIN
,
1128 (char_u
*)VAR_WIN
, PV_FML
,
1129 {(char_u
*)1L, (char_u
*)0L} SCRIPTID_INIT
},
1130 {"foldnestmax", "fdn", P_NUM
|P_VI_DEF
|P_RWIN
,
1131 (char_u
*)VAR_WIN
, PV_FDN
,
1132 {(char_u
*)20L, (char_u
*)0L} SCRIPTID_INIT
},
1133 {"foldopen", "fdo", P_STRING
|P_VI_DEF
|P_COMMA
|P_NODUP
,
1134 (char_u
*)&p_fdo
, PV_NONE
,
1135 {(char_u
*)"block,hor,mark,percent,quickfix,search,tag,undo",
1136 (char_u
*)0L} SCRIPTID_INIT
},
1137 {"foldtext", "fdt", P_STRING
|P_ALLOCED
|P_VIM
|P_VI_DEF
|P_RWIN
,
1139 (char_u
*)VAR_WIN
, PV_FDT
,
1140 {(char_u
*)"foldtext()", (char_u
*)NULL
}
1142 (char_u
*)NULL
, PV_NONE
,
1143 {(char_u
*)NULL
, (char_u
*)0L}
1147 {"formatexpr", "fex", P_STRING
|P_ALLOCED
|P_VI_DEF
|P_VIM
,
1149 (char_u
*)&p_fex
, PV_FEX
,
1150 {(char_u
*)"", (char_u
*)0L}
1152 (char_u
*)NULL
, PV_NONE
,
1153 {(char_u
*)0L, (char_u
*)0L}
1156 {"formatoptions","fo", P_STRING
|P_ALLOCED
|P_VIM
|P_FLAGLIST
,
1157 (char_u
*)&p_fo
, PV_FO
,
1158 {(char_u
*)DFLT_FO_VI
, (char_u
*)DFLT_FO_VIM
}
1160 {"formatlistpat","flp", P_STRING
|P_ALLOCED
|P_VI_DEF
,
1161 (char_u
*)&p_flp
, PV_FLP
,
1162 {(char_u
*)"^\\s*\\d\\+[\\]:.)}\\t ]\\s*",
1163 (char_u
*)0L} SCRIPTID_INIT
},
1164 {"formatprg", "fp", P_STRING
|P_EXPAND
|P_VI_DEF
|P_SECURE
,
1165 (char_u
*)&p_fp
, PV_NONE
,
1166 {(char_u
*)"", (char_u
*)0L} SCRIPTID_INIT
},
1167 {"fsync", "fs", P_BOOL
|P_SECURE
|P_VI_DEF
,
1169 (char_u
*)&p_fs
, PV_NONE
,
1170 {(char_u
*)TRUE
, (char_u
*)0L}
1172 (char_u
*)NULL
, PV_NONE
,
1173 {(char_u
*)FALSE
, (char_u
*)0L}
1176 {"gdefault", "gd", P_BOOL
|P_VI_DEF
|P_VIM
,
1177 (char_u
*)&p_gd
, PV_NONE
,
1178 {(char_u
*)FALSE
, (char_u
*)0L} SCRIPTID_INIT
},
1179 {"graphic", "gr", P_BOOL
|P_VI_DEF
,
1180 (char_u
*)NULL
, PV_NONE
,
1181 {(char_u
*)FALSE
, (char_u
*)0L} SCRIPTID_INIT
},
1182 {"grepformat", "gfm", P_STRING
|P_VI_DEF
|P_COMMA
|P_NODUP
,
1183 #ifdef FEAT_QUICKFIX
1184 (char_u
*)&p_gefm
, PV_NONE
,
1185 {(char_u
*)DFLT_GREPFORMAT
, (char_u
*)0L}
1187 (char_u
*)NULL
, PV_NONE
,
1188 {(char_u
*)NULL
, (char_u
*)0L}
1191 {"grepprg", "gp", P_STRING
|P_EXPAND
|P_VI_DEF
|P_SECURE
,
1192 #ifdef FEAT_QUICKFIX
1193 (char_u
*)&p_gp
, PV_GP
,
1196 /* may be changed to "grep -n" in os_win32.c */
1197 (char_u
*)"findstr /n",
1200 /* Add an extra file name so that grep will always
1201 * insert a file name in the match line. */
1202 (char_u
*)"grep -n $* /dev/null",
1205 (char_u
*)"SEARCH/NUMBERS ",
1207 (char_u
*)"grep -n ",
1213 (char_u
*)NULL
, PV_NONE
,
1214 {(char_u
*)NULL
, (char_u
*)0L}
1217 {"guicursor", "gcr", P_STRING
|P_VI_DEF
|P_COMMA
|P_NODUP
,
1219 (char_u
*)&p_guicursor
, PV_NONE
,
1222 (char_u
*)"n-v-c:block-Cursor/lCursor,ve:ver35-Cursor,o:hor50-Cursor,i-ci:ver25-Cursor/lCursor,r-cr:hor20-Cursor/lCursor,sm:block-Cursor-blinkwait175-blinkoff150-blinkon175",
1223 # else /* MSDOS or Win32 console */
1224 (char_u
*)"n-v-c:block,o:hor50,i-ci:hor15,r-cr:hor30,sm:block",
1228 (char_u
*)NULL
, PV_NONE
,
1229 {(char_u
*)NULL
, (char_u
*)0L}
1232 {"guifont", "gfn", P_STRING
|P_VI_DEF
|P_RCLR
|P_COMMA
|P_NODUP
,
1234 (char_u
*)&p_guifont
, PV_NONE
,
1235 {(char_u
*)"", (char_u
*)0L}
1237 (char_u
*)NULL
, PV_NONE
,
1238 {(char_u
*)NULL
, (char_u
*)0L}
1241 {"guifontset", "gfs", P_STRING
|P_VI_DEF
|P_RCLR
|P_COMMA
,
1242 #if defined(FEAT_GUI) && defined(FEAT_XFONTSET)
1243 (char_u
*)&p_guifontset
, PV_NONE
,
1244 {(char_u
*)"", (char_u
*)0L}
1246 (char_u
*)NULL
, PV_NONE
,
1247 {(char_u
*)NULL
, (char_u
*)0L}
1250 {"guifontwide", "gfw", P_STRING
|P_VI_DEF
|P_RCLR
|P_COMMA
|P_NODUP
,
1251 #if defined(FEAT_GUI) && defined(FEAT_MBYTE)
1252 (char_u
*)&p_guifontwide
, PV_NONE
,
1253 {(char_u
*)"", (char_u
*)0L}
1255 (char_u
*)NULL
, PV_NONE
,
1256 {(char_u
*)NULL
, (char_u
*)0L}
1259 {"guiheadroom", "ghr", P_NUM
|P_VI_DEF
,
1260 #if defined(FEAT_GUI_GTK) || defined(FEAT_GUI_X11)
1261 (char_u
*)&p_ghr
, PV_NONE
,
1263 (char_u
*)NULL
, PV_NONE
,
1265 {(char_u
*)50L, (char_u
*)0L} SCRIPTID_INIT
},
1266 {"guioptions", "go", P_STRING
|P_VI_DEF
|P_RALL
|P_FLAGLIST
,
1267 #if defined(FEAT_GUI)
1268 (char_u
*)&p_go
, PV_NONE
,
1269 # if defined(UNIX) && !defined(MACOS)
1270 {(char_u
*)"aegimrLtT", (char_u
*)0L}
1272 {(char_u
*)"egmrLtT", (char_u
*)0L}
1275 (char_u
*)NULL
, PV_NONE
,
1276 {(char_u
*)NULL
, (char_u
*)0L}
1279 {"guipty", NULL
, P_BOOL
|P_VI_DEF
,
1280 #if defined(FEAT_GUI)
1281 (char_u
*)&p_guipty
, PV_NONE
,
1283 (char_u
*)NULL
, PV_NONE
,
1285 {(char_u
*)TRUE
, (char_u
*)0L} SCRIPTID_INIT
},
1286 {"guitablabel", "gtl", P_STRING
|P_VI_DEF
|P_RWIN
,
1287 #if defined(FEAT_GUI_TABLINE)
1288 (char_u
*)&p_gtl
, PV_NONE
,
1289 {(char_u
*)"", (char_u
*)0L}
1291 (char_u
*)NULL
, PV_NONE
,
1292 {(char_u
*)NULL
, (char_u
*)0L}
1295 {"guitabtooltip", "gtt", P_STRING
|P_VI_DEF
|P_RWIN
,
1296 #if defined(FEAT_GUI_TABLINE)
1297 (char_u
*)&p_gtt
, PV_NONE
,
1298 {(char_u
*)"", (char_u
*)0L}
1300 (char_u
*)NULL
, PV_NONE
,
1301 {(char_u
*)NULL
, (char_u
*)0L}
1304 {"hardtabs", "ht", P_NUM
|P_VI_DEF
,
1305 (char_u
*)NULL
, PV_NONE
,
1306 {(char_u
*)0L, (char_u
*)0L} SCRIPTID_INIT
},
1307 {"helpfile", "hf", P_STRING
|P_EXPAND
|P_VI_DEF
|P_SECURE
,
1308 (char_u
*)&p_hf
, PV_NONE
,
1309 {(char_u
*)DFLT_HELPFILE
, (char_u
*)0L}
1311 {"helpheight", "hh", P_NUM
|P_VI_DEF
,
1313 (char_u
*)&p_hh
, PV_NONE
,
1315 (char_u
*)NULL
, PV_NONE
,
1317 {(char_u
*)20L, (char_u
*)0L} SCRIPTID_INIT
},
1318 {"helplang", "hlg", P_STRING
|P_VI_DEF
|P_COMMA
,
1319 #ifdef FEAT_MULTI_LANG
1320 (char_u
*)&p_hlg
, PV_NONE
,
1321 {(char_u
*)"", (char_u
*)0L}
1323 (char_u
*)NULL
, PV_NONE
,
1324 {(char_u
*)0L, (char_u
*)0L}
1327 {"hidden", "hid", P_BOOL
|P_VI_DEF
,
1328 (char_u
*)&p_hid
, PV_NONE
,
1329 {(char_u
*)FALSE
, (char_u
*)0L} SCRIPTID_INIT
},
1330 {"highlight", "hl", P_STRING
|P_VI_DEF
|P_RCLR
|P_COMMA
|P_NODUP
,
1331 (char_u
*)&p_hl
, PV_NONE
,
1332 {(char_u
*)HIGHLIGHT_INIT
, (char_u
*)0L}
1334 {"history", "hi", P_NUM
|P_VIM
,
1335 (char_u
*)&p_hi
, PV_NONE
,
1336 {(char_u
*)0L, (char_u
*)20L} SCRIPTID_INIT
},
1337 {"hkmap", "hk", P_BOOL
|P_VI_DEF
|P_VIM
,
1338 #ifdef FEAT_RIGHTLEFT
1339 (char_u
*)&p_hkmap
, PV_NONE
,
1341 (char_u
*)NULL
, PV_NONE
,
1343 {(char_u
*)FALSE
, (char_u
*)0L} SCRIPTID_INIT
},
1344 {"hkmapp", "hkp", P_BOOL
|P_VI_DEF
|P_VIM
,
1345 #ifdef FEAT_RIGHTLEFT
1346 (char_u
*)&p_hkmapp
, PV_NONE
,
1348 (char_u
*)NULL
, PV_NONE
,
1350 {(char_u
*)FALSE
, (char_u
*)0L} SCRIPTID_INIT
},
1351 {"hlsearch", "hls", P_BOOL
|P_VI_DEF
|P_VIM
|P_RALL
,
1352 (char_u
*)&p_hls
, PV_NONE
,
1353 {(char_u
*)FALSE
, (char_u
*)0L} SCRIPTID_INIT
},
1354 {"icon", NULL
, P_BOOL
|P_VI_DEF
,
1356 (char_u
*)&p_icon
, PV_NONE
,
1358 (char_u
*)NULL
, PV_NONE
,
1360 {(char_u
*)FALSE
, (char_u
*)0L} SCRIPTID_INIT
},
1361 {"iconstring", NULL
, P_STRING
|P_VI_DEF
,
1363 (char_u
*)&p_iconstring
, PV_NONE
,
1365 (char_u
*)NULL
, PV_NONE
,
1367 {(char_u
*)"", (char_u
*)0L} SCRIPTID_INIT
},
1368 {"ignorecase", "ic", P_BOOL
|P_VI_DEF
,
1369 (char_u
*)&p_ic
, PV_NONE
,
1370 {(char_u
*)FALSE
, (char_u
*)0L} SCRIPTID_INIT
},
1371 {"imactivatekey","imak",P_STRING
|P_VI_DEF
,
1372 #if defined(FEAT_XIM) && defined(FEAT_GUI_GTK)
1373 (char_u
*)&p_imak
, PV_NONE
,
1375 (char_u
*)NULL
, PV_NONE
,
1377 {(char_u
*)"", (char_u
*)0L} SCRIPTID_INIT
},
1378 {"imcmdline", "imc", P_BOOL
|P_VI_DEF
,
1379 #ifdef USE_IM_CONTROL
1380 (char_u
*)&p_imcmdline
, PV_NONE
,
1382 (char_u
*)NULL
, PV_NONE
,
1384 {(char_u
*)FALSE
, (char_u
*)0L} SCRIPTID_INIT
},
1385 {"imdisable", "imd", P_BOOL
|P_VI_DEF
,
1386 #ifdef USE_IM_CONTROL
1387 (char_u
*)&p_imdisable
, PV_NONE
,
1389 (char_u
*)NULL
, PV_NONE
,
1392 {(char_u
*)TRUE
, (char_u
*)0L}
1394 {(char_u
*)FALSE
, (char_u
*)0L}
1397 {"iminsert", "imi", P_NUM
|P_VI_DEF
,
1398 (char_u
*)&p_iminsert
, PV_IMI
,
1400 {(char_u
*)B_IMODE_IM
, (char_u
*)0L}
1402 {(char_u
*)B_IMODE_NONE
, (char_u
*)0L}
1405 {"imsearch", "ims", P_NUM
|P_VI_DEF
,
1406 (char_u
*)&p_imsearch
, PV_IMS
,
1408 {(char_u
*)B_IMODE_IM
, (char_u
*)0L}
1410 {(char_u
*)B_IMODE_NONE
, (char_u
*)0L}
1413 {"include", "inc", P_STRING
|P_ALLOCED
|P_VI_DEF
,
1415 (char_u
*)&p_inc
, PV_INC
,
1416 {(char_u
*)"^\\s*#\\s*include", (char_u
*)0L}
1418 (char_u
*)NULL
, PV_NONE
,
1419 {(char_u
*)0L, (char_u
*)0L}
1422 {"includeexpr", "inex", P_STRING
|P_ALLOCED
|P_VI_DEF
,
1423 #if defined(FEAT_FIND_ID) && defined(FEAT_EVAL)
1424 (char_u
*)&p_inex
, PV_INEX
,
1425 {(char_u
*)"", (char_u
*)0L}
1427 (char_u
*)NULL
, PV_NONE
,
1428 {(char_u
*)0L, (char_u
*)0L}
1431 {"incsearch", "is", P_BOOL
|P_VI_DEF
|P_VIM
,
1432 (char_u
*)&p_is
, PV_NONE
,
1433 {(char_u
*)FALSE
, (char_u
*)0L} SCRIPTID_INIT
},
1434 {"indentexpr", "inde", P_STRING
|P_ALLOCED
|P_VI_DEF
|P_VIM
,
1435 #if defined(FEAT_CINDENT) && defined(FEAT_EVAL)
1436 (char_u
*)&p_inde
, PV_INDE
,
1437 {(char_u
*)"", (char_u
*)0L}
1439 (char_u
*)NULL
, PV_NONE
,
1440 {(char_u
*)0L, (char_u
*)0L}
1443 {"indentkeys", "indk", P_STRING
|P_ALLOCED
|P_VI_DEF
|P_COMMA
|P_NODUP
,
1444 #if defined(FEAT_CINDENT) && defined(FEAT_EVAL)
1445 (char_u
*)&p_indk
, PV_INDK
,
1446 {(char_u
*)"0{,0},:,0#,!^F,o,O,e", (char_u
*)0L}
1448 (char_u
*)NULL
, PV_NONE
,
1449 {(char_u
*)0L, (char_u
*)0L}
1452 {"infercase", "inf", P_BOOL
|P_VI_DEF
,
1453 (char_u
*)&p_inf
, PV_INF
,
1454 {(char_u
*)FALSE
, (char_u
*)0L} SCRIPTID_INIT
},
1455 {"insertmode", "im", P_BOOL
|P_VI_DEF
|P_VIM
,
1456 (char_u
*)&p_im
, PV_NONE
,
1457 {(char_u
*)FALSE
, (char_u
*)0L} SCRIPTID_INIT
},
1458 {"isfname", "isf", P_STRING
|P_VI_DEF
|P_COMMA
|P_NODUP
,
1459 (char_u
*)&p_isf
, PV_NONE
,
1461 #ifdef BACKSLASH_IN_FILENAME
1462 /* Excluded are: & and ^ are special in cmd.exe
1463 * ( and ) are used in text separating fnames */
1464 (char_u
*)"@,48-57,/,\\,.,-,_,+,,,#,$,%,{,},[,],:,@-@,!,~,=",
1467 (char_u
*)"@,48-57,/,.,-,_,+,,,$,:",
1470 (char_u
*)"@,48-57,/,.,-,_,+,,,#,$,%,<,>,[,],:,;,~",
1471 # else /* UNIX et al. */
1473 (char_u
*)"@,240-249,/,.,-,_,+,,,#,$,%,~,=",
1475 (char_u
*)"@,48-57,/,.,-,_,+,,,#,$,%,~,=",
1480 (char_u
*)0L} SCRIPTID_INIT
},
1481 {"isident", "isi", P_STRING
|P_VI_DEF
|P_COMMA
|P_NODUP
,
1482 (char_u
*)&p_isi
, PV_NONE
,
1484 #if defined(MSDOS) || defined(MSWIN) || defined(OS2)
1485 (char_u
*)"@,48-57,_,128-167,224-235",
1488 /* TODO: EBCDIC Check this! @ == isalpha()*/
1489 (char_u
*)"@,240-249,_,66-73,81-89,98-105,"
1490 "112-120,128,140-142,156,158,172,"
1491 "174,186,191,203-207,219-225,235-239,"
1494 (char_u
*)"@,48-57,_,192-255",
1497 (char_u
*)0L} SCRIPTID_INIT
},
1498 {"iskeyword", "isk", P_STRING
|P_ALLOCED
|P_VIM
|P_COMMA
|P_NODUP
,
1499 (char_u
*)&p_isk
, PV_ISK
,
1502 (char_u
*)"@,240-249,_",
1503 /* TODO: EBCDIC Check this! @ == isalpha()*/
1504 (char_u
*)"@,240-249,_,66-73,81-89,98-105,"
1505 "112-120,128,140-142,156,158,172,"
1506 "174,186,191,203-207,219-225,235-239,"
1509 (char_u
*)"@,48-57,_",
1510 # if defined(MSDOS) || defined(MSWIN) || defined(OS2)
1511 (char_u
*)"@,48-57,_,128-167,224-235"
1517 {"isprint", "isp", P_STRING
|P_VI_DEF
|P_RALL
|P_COMMA
|P_NODUP
,
1518 (char_u
*)&p_isp
, PV_NONE
,
1520 #if defined(MSDOS) || defined(MSWIN) || defined(OS2) \
1521 || (defined(MACOS) && !defined(MACOS_X)) \
1523 (char_u
*)"@,~-255",
1526 /* all chars above 63 are printable */
1532 (char_u
*)0L} SCRIPTID_INIT
},
1533 {"joinspaces", "js", P_BOOL
|P_VI_DEF
|P_VIM
,
1534 (char_u
*)&p_js
, PV_NONE
,
1535 {(char_u
*)TRUE
, (char_u
*)0L} SCRIPTID_INIT
},
1536 {"key", NULL
, P_STRING
|P_ALLOCED
|P_VI_DEF
|P_NO_MKRC
,
1538 (char_u
*)&p_key
, PV_KEY
,
1539 {(char_u
*)"", (char_u
*)0L}
1541 (char_u
*)NULL
, PV_NONE
,
1542 {(char_u
*)0L, (char_u
*)0L}
1545 {"keymap", "kmp", P_STRING
|P_ALLOCED
|P_VI_DEF
|P_RBUF
|P_RSTAT
|P_NFNAME
|P_PRI_MKRC
,
1547 (char_u
*)&p_keymap
, PV_KMAP
,
1548 {(char_u
*)"", (char_u
*)0L}
1550 (char_u
*)NULL
, PV_NONE
,
1551 {(char_u
*)"", (char_u
*)0L}
1554 {"keymodel", "km", P_STRING
|P_VI_DEF
|P_COMMA
|P_NODUP
,
1556 (char_u
*)&p_km
, PV_NONE
,
1558 (char_u
*)NULL
, PV_NONE
,
1560 {(char_u
*)"", (char_u
*)0L} SCRIPTID_INIT
},
1561 {"keywordprg", "kp", P_STRING
|P_EXPAND
|P_VI_DEF
|P_SECURE
,
1562 (char_u
*)&p_kp
, PV_KP
,
1564 #if defined(MSDOS) || defined(MSWIN)
1581 (char_u
*)0L} SCRIPTID_INIT
},
1582 {"langmap", "lmap", P_STRING
|P_VI_DEF
|P_COMMA
|P_NODUP
,
1584 (char_u
*)&p_langmap
, PV_NONE
,
1585 {(char_u
*)"", /* unmatched } */
1587 (char_u
*)NULL
, PV_NONE
,
1590 (char_u
*)0L} SCRIPTID_INIT
},
1591 {"langmenu", "lm", P_STRING
|P_VI_DEF
|P_NFNAME
,
1592 #if defined(FEAT_MENU) && defined(FEAT_MULTI_LANG)
1593 (char_u
*)&p_lm
, PV_NONE
,
1595 (char_u
*)NULL
, PV_NONE
,
1597 {(char_u
*)"", (char_u
*)0L} SCRIPTID_INIT
},
1598 {"laststatus", "ls", P_NUM
|P_VI_DEF
|P_RALL
,
1600 (char_u
*)&p_ls
, PV_NONE
,
1602 (char_u
*)NULL
, PV_NONE
,
1604 {(char_u
*)1L, (char_u
*)0L} SCRIPTID_INIT
},
1605 {"lazyredraw", "lz", P_BOOL
|P_VI_DEF
,
1606 (char_u
*)&p_lz
, PV_NONE
,
1607 {(char_u
*)FALSE
, (char_u
*)0L} SCRIPTID_INIT
},
1608 {"linebreak", "lbr", P_BOOL
|P_VI_DEF
|P_RWIN
,
1609 #ifdef FEAT_LINEBREAK
1610 (char_u
*)VAR_WIN
, PV_LBR
,
1612 (char_u
*)NULL
, PV_NONE
,
1614 {(char_u
*)FALSE
, (char_u
*)0L} SCRIPTID_INIT
},
1615 {"lines", NULL
, P_NUM
|P_NODEFAULT
|P_NO_MKRC
|P_VI_DEF
|P_RCLR
,
1616 (char_u
*)&Rows
, PV_NONE
,
1618 #if defined(MSDOS) || defined(WIN3264) || defined(OS2)
1623 (char_u
*)0L} SCRIPTID_INIT
},
1624 {"linespace", "lsp", P_NUM
|P_VI_DEF
|P_RCLR
,
1626 (char_u
*)&p_linespace
, PV_NONE
,
1628 (char_u
*)NULL
, PV_NONE
,
1631 {(char_u
*)1L, (char_u
*)0L}
1633 {(char_u
*)0L, (char_u
*)0L}
1636 {"lisp", NULL
, P_BOOL
|P_VI_DEF
,
1638 (char_u
*)&p_lisp
, PV_LISP
,
1640 (char_u
*)NULL
, PV_NONE
,
1642 {(char_u
*)FALSE
, (char_u
*)0L} SCRIPTID_INIT
},
1643 {"lispwords", "lw", P_STRING
|P_VI_DEF
|P_COMMA
|P_NODUP
,
1645 (char_u
*)&p_lispwords
, PV_NONE
,
1646 {(char_u
*)LISPWORD_VALUE
, (char_u
*)0L}
1648 (char_u
*)NULL
, PV_NONE
,
1649 {(char_u
*)"", (char_u
*)0L}
1652 {"list", NULL
, P_BOOL
|P_VI_DEF
|P_RWIN
,
1653 (char_u
*)VAR_WIN
, PV_LIST
,
1654 {(char_u
*)FALSE
, (char_u
*)0L} SCRIPTID_INIT
},
1655 {"listchars", "lcs", P_STRING
|P_VI_DEF
|P_RALL
|P_COMMA
|P_NODUP
,
1656 (char_u
*)&p_lcs
, PV_NONE
,
1657 {(char_u
*)"eol:$", (char_u
*)0L} SCRIPTID_INIT
},
1658 {"loadplugins", "lpl", P_BOOL
|P_VI_DEF
,
1659 (char_u
*)&p_lpl
, PV_NONE
,
1660 {(char_u
*)TRUE
, (char_u
*)0L} SCRIPTID_INIT
},
1662 {"macatsui", NULL
, P_BOOL
|P_VI_DEF
|P_RCLR
,
1663 (char_u
*)&p_macatsui
, PV_NONE
,
1664 {(char_u
*)TRUE
, (char_u
*)0L} SCRIPTID_INIT
},
1666 {"magic", NULL
, P_BOOL
|P_VI_DEF
,
1667 (char_u
*)&p_magic
, PV_NONE
,
1668 {(char_u
*)TRUE
, (char_u
*)0L} SCRIPTID_INIT
},
1669 {"makeef", "mef", P_STRING
|P_EXPAND
|P_VI_DEF
|P_SECURE
,
1670 #ifdef FEAT_QUICKFIX
1671 (char_u
*)&p_mef
, PV_NONE
,
1672 {(char_u
*)"", (char_u
*)0L}
1674 (char_u
*)NULL
, PV_NONE
,
1675 {(char_u
*)NULL
, (char_u
*)0L}
1678 {"makeprg", "mp", P_STRING
|P_EXPAND
|P_VI_DEF
|P_SECURE
,
1679 #ifdef FEAT_QUICKFIX
1680 (char_u
*)&p_mp
, PV_MP
,
1682 {(char_u
*)"MMS", (char_u
*)0L}
1684 {(char_u
*)"make", (char_u
*)0L}
1687 (char_u
*)NULL
, PV_NONE
,
1688 {(char_u
*)NULL
, (char_u
*)0L}
1691 {"matchpairs", "mps", P_STRING
|P_ALLOCED
|P_VI_DEF
|P_COMMA
|P_NODUP
,
1692 (char_u
*)&p_mps
, PV_MPS
,
1693 {(char_u
*)"(:),{:},[:]", (char_u
*)0L}
1695 {"matchtime", "mat", P_NUM
|P_VI_DEF
,
1696 (char_u
*)&p_mat
, PV_NONE
,
1697 {(char_u
*)5L, (char_u
*)0L} SCRIPTID_INIT
},
1698 {"maxcombine", "mco", P_NUM
|P_VI_DEF
,
1700 (char_u
*)&p_mco
, PV_NONE
,
1702 (char_u
*)NULL
, PV_NONE
,
1704 {(char_u
*)2, (char_u
*)0L} SCRIPTID_INIT
},
1705 {"maxfuncdepth", "mfd", P_NUM
|P_VI_DEF
,
1707 (char_u
*)&p_mfd
, PV_NONE
,
1709 (char_u
*)NULL
, PV_NONE
,
1711 {(char_u
*)100L, (char_u
*)0L} SCRIPTID_INIT
},
1712 {"maxmapdepth", "mmd", P_NUM
|P_VI_DEF
,
1713 (char_u
*)&p_mmd
, PV_NONE
,
1714 {(char_u
*)1000L, (char_u
*)0L} SCRIPTID_INIT
},
1715 {"maxmem", "mm", P_NUM
|P_VI_DEF
,
1716 (char_u
*)&p_mm
, PV_NONE
,
1717 {(char_u
*)DFLT_MAXMEM
, (char_u
*)0L}
1719 {"maxmempattern","mmp", P_NUM
|P_VI_DEF
,
1720 (char_u
*)&p_mmp
, PV_NONE
,
1721 {(char_u
*)1000L, (char_u
*)0L} SCRIPTID_INIT
},
1722 {"maxmemtot", "mmt", P_NUM
|P_VI_DEF
,
1723 (char_u
*)&p_mmt
, PV_NONE
,
1724 {(char_u
*)DFLT_MAXMEMTOT
, (char_u
*)0L}
1726 {"menuitems", "mis", P_NUM
|P_VI_DEF
,
1728 (char_u
*)&p_mis
, PV_NONE
,
1730 (char_u
*)NULL
, PV_NONE
,
1732 {(char_u
*)25L, (char_u
*)0L} SCRIPTID_INIT
},
1733 {"mesg", NULL
, P_BOOL
|P_VI_DEF
,
1734 (char_u
*)NULL
, PV_NONE
,
1735 {(char_u
*)FALSE
, (char_u
*)0L} SCRIPTID_INIT
},
1737 {"migemo", "mgm", P_BOOL
|P_VI_DEF
|P_VIM
,
1738 (char_u
*)&p_migemo
, PV_MIG
,
1739 {(char_u
*)FALSE
, (char_u
*)0L} SCRIPTID_INIT
},
1740 {"migemodict", "mgd", P_STRING
|P_EXPAND
|P_VI_DEF
|P_VIM
,
1741 (char_u
*)&p_migdict
, PV_NONE
,
1742 {(char_u
*)"", (char_u
*)0L} SCRIPTID_INIT
},
1743 #endif /* USE_MIGEMO */
1744 {"mkspellmem", "msm", P_STRING
|P_VI_DEF
|P_EXPAND
|P_SECURE
,
1746 (char_u
*)&p_msm
, PV_NONE
,
1747 {(char_u
*)"460000,2000,500", (char_u
*)0L}
1749 (char_u
*)NULL
, PV_NONE
,
1750 {(char_u
*)0L, (char_u
*)0L}
1753 {"modeline", "ml", P_BOOL
|P_VIM
,
1754 (char_u
*)&p_ml
, PV_ML
,
1755 {(char_u
*)FALSE
, (char_u
*)TRUE
} SCRIPTID_INIT
},
1756 {"modelines", "mls", P_NUM
|P_VI_DEF
,
1757 (char_u
*)&p_mls
, PV_NONE
,
1758 {(char_u
*)5L, (char_u
*)0L} SCRIPTID_INIT
},
1759 {"modifiable", "ma", P_BOOL
|P_VI_DEF
|P_NOGLOB
,
1760 (char_u
*)&p_ma
, PV_MA
,
1761 {(char_u
*)TRUE
, (char_u
*)0L} SCRIPTID_INIT
},
1762 {"modified", "mod", P_BOOL
|P_NO_MKRC
|P_VI_DEF
|P_RSTAT
,
1763 (char_u
*)&p_mod
, PV_MOD
,
1764 {(char_u
*)FALSE
, (char_u
*)0L} SCRIPTID_INIT
},
1765 {"more", NULL
, P_BOOL
|P_VIM
,
1766 (char_u
*)&p_more
, PV_NONE
,
1767 {(char_u
*)FALSE
, (char_u
*)TRUE
} SCRIPTID_INIT
},
1768 {"mouse", NULL
, P_STRING
|P_VI_DEF
|P_FLAGLIST
,
1769 (char_u
*)&p_mouse
, PV_NONE
,
1771 #if defined(MSDOS) || defined(WIN3264)
1776 (char_u
*)0L} SCRIPTID_INIT
},
1777 {"mousefocus", "mousef", P_BOOL
|P_VI_DEF
,
1779 (char_u
*)&p_mousef
, PV_NONE
,
1781 (char_u
*)NULL
, PV_NONE
,
1783 {(char_u
*)FALSE
, (char_u
*)0L} SCRIPTID_INIT
},
1784 {"mousehide", "mh", P_BOOL
|P_VI_DEF
,
1786 (char_u
*)&p_mh
, PV_NONE
,
1788 (char_u
*)NULL
, PV_NONE
,
1790 {(char_u
*)TRUE
, (char_u
*)0L} SCRIPTID_INIT
},
1791 {"mousemodel", "mousem", P_STRING
|P_VI_DEF
,
1792 (char_u
*)&p_mousem
, PV_NONE
,
1794 #if defined(MSDOS) || defined(MSWIN)
1798 (char_u
*)"popup_setpos",
1803 (char_u
*)0L} SCRIPTID_INIT
},
1804 {"mouseshape", "mouses", P_STRING
|P_VI_DEF
|P_COMMA
|P_NODUP
,
1805 #ifdef FEAT_MOUSESHAPE
1806 (char_u
*)&p_mouseshape
, PV_NONE
,
1807 {(char_u
*)"i-r:beam,s:updown,sd:udsizing,vs:leftright,vd:lrsizing,m:no,ml:up-arrow,v:rightup-arrow", (char_u
*)0L}
1809 (char_u
*)NULL
, PV_NONE
,
1810 {(char_u
*)NULL
, (char_u
*)0L}
1813 {"mousetime", "mouset", P_NUM
|P_VI_DEF
,
1814 (char_u
*)&p_mouset
, PV_NONE
,
1815 {(char_u
*)500L, (char_u
*)0L} SCRIPTID_INIT
},
1816 {"mzquantum", "mzq", P_NUM
,
1817 #ifdef FEAT_MZSCHEME
1818 (char_u
*)&p_mzq
, PV_NONE
,
1820 (char_u
*)NULL
, PV_NONE
,
1822 {(char_u
*)100L, (char_u
*)100L} SCRIPTID_INIT
},
1823 {"novice", NULL
, P_BOOL
|P_VI_DEF
,
1824 (char_u
*)NULL
, PV_NONE
,
1825 {(char_u
*)FALSE
, (char_u
*)0L} SCRIPTID_INIT
},
1826 {"nrformats", "nf", P_STRING
|P_ALLOCED
|P_VI_DEF
|P_COMMA
|P_NODUP
,
1827 (char_u
*)&p_nf
, PV_NF
,
1828 {(char_u
*)"octal,hex", (char_u
*)0L}
1830 {"number", "nu", P_BOOL
|P_VI_DEF
|P_RWIN
,
1831 (char_u
*)VAR_WIN
, PV_NU
,
1832 {(char_u
*)FALSE
, (char_u
*)0L} SCRIPTID_INIT
},
1833 {"numberwidth", "nuw", P_NUM
|P_RWIN
|P_VIM
,
1834 #ifdef FEAT_LINEBREAK
1835 (char_u
*)VAR_WIN
, PV_NUW
,
1837 (char_u
*)NULL
, PV_NONE
,
1839 {(char_u
*)8L, (char_u
*)4L} SCRIPTID_INIT
},
1840 {"omnifunc", "ofu", P_STRING
|P_ALLOCED
|P_VI_DEF
|P_SECURE
,
1841 #ifdef FEAT_COMPL_FUNC
1842 (char_u
*)&p_ofu
, PV_OFU
,
1843 {(char_u
*)"", (char_u
*)0L}
1845 (char_u
*)NULL
, PV_NONE
,
1846 {(char_u
*)0L, (char_u
*)0L}
1849 {"open", NULL
, P_BOOL
|P_VI_DEF
,
1850 (char_u
*)NULL
, PV_NONE
,
1851 {(char_u
*)FALSE
, (char_u
*)0L} SCRIPTID_INIT
},
1852 {"opendevice", "odev", P_BOOL
|P_VI_DEF
,
1853 #if defined(MSDOS) || defined(MSWIN) || defined(OS2)
1854 (char_u
*)&p_odev
, PV_NONE
,
1856 (char_u
*)NULL
, PV_NONE
,
1858 {(char_u
*)FALSE
, (char_u
*)FALSE
}
1860 {"operatorfunc", "opfunc", P_STRING
|P_VI_DEF
|P_SECURE
,
1861 (char_u
*)&p_opfunc
, PV_NONE
,
1862 {(char_u
*)"", (char_u
*)0L} SCRIPTID_INIT
},
1863 {"optimize", "opt", P_BOOL
|P_VI_DEF
,
1864 (char_u
*)NULL
, PV_NONE
,
1865 {(char_u
*)FALSE
, (char_u
*)0L} SCRIPTID_INIT
},
1866 {"osfiletype", "oft", P_STRING
|P_ALLOCED
|P_VI_DEF
,
1867 #ifdef FEAT_OSFILETYPE
1868 (char_u
*)&p_oft
, PV_OFT
,
1869 {(char_u
*)DFLT_OFT
, (char_u
*)0L}
1871 (char_u
*)NULL
, PV_NONE
,
1872 {(char_u
*)0L, (char_u
*)0L}
1875 {"paragraphs", "para", P_STRING
|P_VI_DEF
,
1876 (char_u
*)&p_para
, PV_NONE
,
1877 {(char_u
*)"IPLPPPQPP TPHPLIPpLpItpplpipbp",
1878 (char_u
*)0L} SCRIPTID_INIT
},
1879 {"paste", NULL
, P_BOOL
|P_VI_DEF
|P_PRI_MKRC
,
1880 (char_u
*)&p_paste
, PV_NONE
,
1881 {(char_u
*)FALSE
, (char_u
*)0L} SCRIPTID_INIT
},
1882 {"pastetoggle", "pt", P_STRING
|P_VI_DEF
,
1883 (char_u
*)&p_pt
, PV_NONE
,
1884 {(char_u
*)"", (char_u
*)0L} SCRIPTID_INIT
},
1885 {"patchexpr", "pex", P_STRING
|P_VI_DEF
|P_SECURE
,
1886 #if defined(FEAT_DIFF) && defined(FEAT_EVAL)
1887 (char_u
*)&p_pex
, PV_NONE
,
1888 {(char_u
*)"", (char_u
*)0L}
1890 (char_u
*)NULL
, PV_NONE
,
1891 {(char_u
*)0L, (char_u
*)0L}
1894 {"patchmode", "pm", P_STRING
|P_VI_DEF
|P_NFNAME
,
1895 (char_u
*)&p_pm
, PV_NONE
,
1896 {(char_u
*)"", (char_u
*)0L} SCRIPTID_INIT
},
1897 {"path", "pa", P_STRING
|P_EXPAND
|P_VI_DEF
|P_COMMA
|P_NODUP
,
1898 (char_u
*)&p_path
, PV_PATH
,
1900 #if defined AMIGA || defined MSDOS || defined MSWIN
1903 # if defined(__EMX__)
1904 (char_u
*)".,/emx/include,,",
1905 # else /* Unix, probably */
1906 (char_u
*)".,/usr/include,,",
1909 (char_u
*)0L} SCRIPTID_INIT
},
1910 {"preserveindent", "pi", P_BOOL
|P_VI_DEF
|P_VIM
,
1911 (char_u
*)&p_pi
, PV_PI
,
1912 {(char_u
*)FALSE
, (char_u
*)0L} SCRIPTID_INIT
},
1913 {"previewheight", "pvh", P_NUM
|P_VI_DEF
,
1914 #if defined(FEAT_WINDOWS) && defined(FEAT_QUICKFIX)
1915 (char_u
*)&p_pvh
, PV_NONE
,
1917 (char_u
*)NULL
, PV_NONE
,
1919 {(char_u
*)12L, (char_u
*)0L} SCRIPTID_INIT
},
1920 {"previewwindow", "pvw", P_BOOL
|P_VI_DEF
|P_RSTAT
|P_NOGLOB
,
1921 #if defined(FEAT_WINDOWS) && defined(FEAT_QUICKFIX)
1922 (char_u
*)VAR_WIN
, PV_PVW
,
1924 (char_u
*)NULL
, PV_NONE
,
1926 {(char_u
*)FALSE
, (char_u
*)0L} SCRIPTID_INIT
},
1927 {"printdevice", "pdev", P_STRING
|P_VI_DEF
|P_SECURE
,
1929 (char_u
*)&p_pdev
, PV_NONE
,
1930 {(char_u
*)"", (char_u
*)0L}
1932 (char_u
*)NULL
, PV_NONE
,
1933 {(char_u
*)NULL
, (char_u
*)0L}
1936 {"printencoding", "penc", P_STRING
|P_VI_DEF
,
1937 #ifdef FEAT_POSTSCRIPT
1938 (char_u
*)&p_penc
, PV_NONE
,
1939 {(char_u
*)"", (char_u
*)0L}
1941 (char_u
*)NULL
, PV_NONE
,
1942 {(char_u
*)NULL
, (char_u
*)0L}
1945 {"printexpr", "pexpr", P_STRING
|P_VI_DEF
,
1946 #ifdef FEAT_POSTSCRIPT
1947 (char_u
*)&p_pexpr
, PV_NONE
,
1948 {(char_u
*)"", (char_u
*)0L}
1950 (char_u
*)NULL
, PV_NONE
,
1951 {(char_u
*)NULL
, (char_u
*)0L}
1954 {"printfont", "pfn", P_STRING
|P_VI_DEF
,
1956 (char_u
*)&p_pfn
, PV_NONE
,
1959 (char_u
*)"Courier_New:h10",
1961 (char_u
*)"courier",
1965 (char_u
*)NULL
, PV_NONE
,
1966 {(char_u
*)NULL
, (char_u
*)0L}
1969 {"printheader", "pheader", P_STRING
|P_VI_DEF
|P_GETTEXT
,
1971 (char_u
*)&p_header
, PV_NONE
,
1972 {(char_u
*)N_("%<%f%h%m%=Page %N"), (char_u
*)0L}
1974 (char_u
*)NULL
, PV_NONE
,
1975 {(char_u
*)NULL
, (char_u
*)0L}
1978 {"printmbcharset", "pmbcs", P_STRING
|P_VI_DEF
,
1979 #if defined(FEAT_POSTSCRIPT) && defined(FEAT_MBYTE)
1980 (char_u
*)&p_pmcs
, PV_NONE
,
1981 {(char_u
*)"", (char_u
*)0L}
1983 (char_u
*)NULL
, PV_NONE
,
1984 {(char_u
*)NULL
, (char_u
*)0L}
1987 {"printmbfont", "pmbfn", P_STRING
|P_VI_DEF
,
1988 #if defined(FEAT_POSTSCRIPT) && defined(FEAT_MBYTE)
1989 (char_u
*)&p_pmfn
, PV_NONE
,
1990 {(char_u
*)"", (char_u
*)0L}
1992 (char_u
*)NULL
, PV_NONE
,
1993 {(char_u
*)NULL
, (char_u
*)0L}
1996 {"printoptions", "popt", P_STRING
|P_VI_DEF
|P_COMMA
|P_NODUP
,
1998 (char_u
*)&p_popt
, PV_NONE
,
1999 {(char_u
*)"", (char_u
*)0L}
2001 (char_u
*)NULL
, PV_NONE
,
2002 {(char_u
*)NULL
, (char_u
*)0L}
2005 {"prompt", NULL
, P_BOOL
|P_VI_DEF
,
2006 (char_u
*)&p_prompt
, PV_NONE
,
2007 {(char_u
*)TRUE
, (char_u
*)0L} SCRIPTID_INIT
},
2008 {"pumheight", "ph", P_NUM
|P_VI_DEF
,
2009 #ifdef FEAT_INS_EXPAND
2010 (char_u
*)&p_ph
, PV_NONE
,
2012 (char_u
*)NULL
, PV_NONE
,
2014 {(char_u
*)0L, (char_u
*)0L} SCRIPTID_INIT
},
2015 {"quoteescape", "qe", P_STRING
|P_ALLOCED
|P_VI_DEF
,
2017 (char_u
*)&p_qe
, PV_QE
,
2018 {(char_u
*)"\\", (char_u
*)0L}
2020 (char_u
*)NULL
, PV_NONE
,
2021 {(char_u
*)NULL
, (char_u
*)0L}
2024 {"readonly", "ro", P_BOOL
|P_VI_DEF
|P_RSTAT
|P_NOGLOB
,
2025 (char_u
*)&p_ro
, PV_RO
,
2026 {(char_u
*)FALSE
, (char_u
*)0L} SCRIPTID_INIT
},
2027 {"redraw", NULL
, P_BOOL
|P_VI_DEF
,
2028 (char_u
*)NULL
, PV_NONE
,
2029 {(char_u
*)FALSE
, (char_u
*)0L} SCRIPTID_INIT
},
2030 {"redrawtime", "rdt", P_NUM
|P_VI_DEF
,
2032 (char_u
*)&p_rdt
, PV_NONE
,
2034 (char_u
*)NULL
, PV_NONE
,
2036 {(char_u
*)2000L, (char_u
*)0L} SCRIPTID_INIT
},
2037 {"remap", NULL
, P_BOOL
|P_VI_DEF
,
2038 (char_u
*)&p_remap
, PV_NONE
,
2039 {(char_u
*)TRUE
, (char_u
*)0L} SCRIPTID_INIT
},
2040 {"report", NULL
, P_NUM
|P_VI_DEF
,
2041 (char_u
*)&p_report
, PV_NONE
,
2042 {(char_u
*)2L, (char_u
*)0L} SCRIPTID_INIT
},
2043 {"restorescreen", "rs", P_BOOL
|P_VI_DEF
,
2045 (char_u
*)&p_rs
, PV_NONE
,
2047 (char_u
*)NULL
, PV_NONE
,
2049 {(char_u
*)TRUE
, (char_u
*)0L} SCRIPTID_INIT
},
2050 {"revins", "ri", P_BOOL
|P_VI_DEF
|P_VIM
,
2051 #ifdef FEAT_RIGHTLEFT
2052 (char_u
*)&p_ri
, PV_NONE
,
2054 (char_u
*)NULL
, PV_NONE
,
2056 {(char_u
*)FALSE
, (char_u
*)0L} SCRIPTID_INIT
},
2057 {"rightleft", "rl", P_BOOL
|P_VI_DEF
|P_RWIN
,
2058 #ifdef FEAT_RIGHTLEFT
2059 (char_u
*)VAR_WIN
, PV_RL
,
2061 (char_u
*)NULL
, PV_NONE
,
2063 {(char_u
*)FALSE
, (char_u
*)0L} SCRIPTID_INIT
},
2064 {"rightleftcmd", "rlc", P_STRING
|P_ALLOCED
|P_VI_DEF
|P_RWIN
,
2065 #ifdef FEAT_RIGHTLEFT
2066 (char_u
*)VAR_WIN
, PV_RLC
,
2067 {(char_u
*)"search", (char_u
*)NULL
}
2069 (char_u
*)NULL
, PV_NONE
,
2070 {(char_u
*)NULL
, (char_u
*)0L}
2073 {"ruler", "ru", P_BOOL
|P_VI_DEF
|P_VIM
|P_RSTAT
,
2074 #ifdef FEAT_CMDL_INFO
2075 (char_u
*)&p_ru
, PV_NONE
,
2077 (char_u
*)NULL
, PV_NONE
,
2079 {(char_u
*)FALSE
, (char_u
*)0L} SCRIPTID_INIT
},
2080 {"rulerformat", "ruf", P_STRING
|P_VI_DEF
|P_ALLOCED
|P_RSTAT
,
2082 (char_u
*)&p_ruf
, PV_NONE
,
2084 (char_u
*)NULL
, PV_NONE
,
2086 {(char_u
*)"", (char_u
*)0L} SCRIPTID_INIT
},
2087 {"runtimepath", "rtp", P_STRING
|P_VI_DEF
|P_EXPAND
|P_COMMA
|P_NODUP
|P_SECURE
,
2088 (char_u
*)&p_rtp
, PV_NONE
,
2089 {(char_u
*)DFLT_RUNTIMEPATH
, (char_u
*)0L}
2091 {"scroll", "scr", P_NUM
|P_NO_MKRC
|P_VI_DEF
,
2092 (char_u
*)VAR_WIN
, PV_SCROLL
,
2093 {(char_u
*)12L, (char_u
*)0L} SCRIPTID_INIT
},
2094 {"scrollbind", "scb", P_BOOL
|P_VI_DEF
,
2095 #ifdef FEAT_SCROLLBIND
2096 (char_u
*)VAR_WIN
, PV_SCBIND
,
2098 (char_u
*)NULL
, PV_NONE
,
2100 {(char_u
*)FALSE
, (char_u
*)0L} SCRIPTID_INIT
},
2101 {"scrolljump", "sj", P_NUM
|P_VI_DEF
|P_VIM
,
2102 (char_u
*)&p_sj
, PV_NONE
,
2103 {(char_u
*)1L, (char_u
*)0L} SCRIPTID_INIT
},
2104 {"scrolloff", "so", P_NUM
|P_VI_DEF
|P_VIM
|P_RALL
,
2105 (char_u
*)&p_so
, PV_NONE
,
2106 {(char_u
*)0L, (char_u
*)0L} SCRIPTID_INIT
},
2107 {"scrollopt", "sbo", P_STRING
|P_VI_DEF
|P_COMMA
|P_NODUP
,
2108 #ifdef FEAT_SCROLLBIND
2109 (char_u
*)&p_sbo
, PV_NONE
,
2110 {(char_u
*)"ver,jump", (char_u
*)0L}
2112 (char_u
*)NULL
, PV_NONE
,
2113 {(char_u
*)0L, (char_u
*)0L}
2116 {"sections", "sect", P_STRING
|P_VI_DEF
,
2117 (char_u
*)&p_sections
, PV_NONE
,
2118 {(char_u
*)"SHNHH HUnhsh", (char_u
*)0L}
2120 {"secure", NULL
, P_BOOL
|P_VI_DEF
|P_SECURE
,
2121 (char_u
*)&p_secure
, PV_NONE
,
2122 {(char_u
*)FALSE
, (char_u
*)0L} SCRIPTID_INIT
},
2123 {"selection", "sel", P_STRING
|P_VI_DEF
,
2125 (char_u
*)&p_sel
, PV_NONE
,
2127 (char_u
*)NULL
, PV_NONE
,
2129 {(char_u
*)"inclusive", (char_u
*)0L}
2131 {"selectmode", "slm", P_STRING
|P_VI_DEF
|P_COMMA
|P_NODUP
,
2133 (char_u
*)&p_slm
, PV_NONE
,
2135 (char_u
*)NULL
, PV_NONE
,
2137 {(char_u
*)"", (char_u
*)0L} SCRIPTID_INIT
},
2138 {"sessionoptions", "ssop", P_STRING
|P_VI_DEF
|P_COMMA
|P_NODUP
,
2140 (char_u
*)&p_ssop
, PV_NONE
,
2141 {(char_u
*)"blank,buffers,curdir,folds,help,options,tabpages,winsize",
2144 (char_u
*)NULL
, PV_NONE
,
2145 {(char_u
*)0L, (char_u
*)0L}
2148 {"shell", "sh", P_STRING
|P_EXPAND
|P_VI_DEF
|P_SECURE
,
2149 (char_u
*)&p_sh
, PV_NONE
,
2155 (char_u
*)"command",
2158 (char_u
*)"command.com",
2160 # if defined(WIN3264)
2161 (char_u
*)"", /* set in set_init_1() */
2164 (char_u
*)"cmd.exe",
2166 # if defined(ARCHIE)
2176 (char_u
*)0L} SCRIPTID_INIT
},
2177 {"shellcmdflag","shcf", P_STRING
|P_VI_DEF
|P_SECURE
,
2178 (char_u
*)&p_shcf
, PV_NONE
,
2180 #if defined(MSDOS) || defined(MSWIN)
2189 (char_u
*)0L} SCRIPTID_INIT
},
2190 {"shellpipe", "sp", P_STRING
|P_VI_DEF
|P_SECURE
,
2191 #ifdef FEAT_QUICKFIX
2192 (char_u
*)&p_sp
, PV_NONE
,
2194 #if defined(UNIX) || defined(OS2)
2205 (char_u
*)NULL
, PV_NONE
,
2206 {(char_u
*)0L, (char_u
*)0L}
2209 {"shellquote", "shq", P_STRING
|P_VI_DEF
|P_SECURE
,
2210 (char_u
*)&p_shq
, PV_NONE
,
2211 {(char_u
*)"", (char_u
*)0L} SCRIPTID_INIT
},
2212 {"shellredir", "srr", P_STRING
|P_VI_DEF
|P_SECURE
,
2213 (char_u
*)&p_srr
, PV_NONE
,
2214 {(char_u
*)">", (char_u
*)0L} SCRIPTID_INIT
},
2215 {"shellslash", "ssl", P_BOOL
|P_VI_DEF
,
2216 #ifdef BACKSLASH_IN_FILENAME
2217 (char_u
*)&p_ssl
, PV_NONE
,
2219 (char_u
*)NULL
, PV_NONE
,
2221 {(char_u
*)FALSE
, (char_u
*)0L} SCRIPTID_INIT
},
2222 {"shelltemp", "stmp", P_BOOL
,
2223 (char_u
*)&p_stmp
, PV_NONE
,
2224 {(char_u
*)FALSE
, (char_u
*)TRUE
} SCRIPTID_INIT
},
2225 {"shelltype", "st", P_NUM
|P_VI_DEF
,
2227 (char_u
*)&p_st
, PV_NONE
,
2229 (char_u
*)NULL
, PV_NONE
,
2231 {(char_u
*)0L, (char_u
*)0L} SCRIPTID_INIT
},
2232 {"shellxquote", "sxq", P_STRING
|P_VI_DEF
|P_SECURE
,
2233 (char_u
*)&p_sxq
, PV_NONE
,
2235 #if defined(UNIX) && defined(USE_SYSTEM) && !defined(__EMX__)
2240 (char_u
*)0L} SCRIPTID_INIT
},
2241 {"shiftround", "sr", P_BOOL
|P_VI_DEF
|P_VIM
,
2242 (char_u
*)&p_sr
, PV_NONE
,
2243 {(char_u
*)FALSE
, (char_u
*)0L} SCRIPTID_INIT
},
2244 {"shiftwidth", "sw", P_NUM
|P_VI_DEF
,
2245 (char_u
*)&p_sw
, PV_SW
,
2246 {(char_u
*)8L, (char_u
*)0L} SCRIPTID_INIT
},
2247 {"shortmess", "shm", P_STRING
|P_VIM
|P_FLAGLIST
,
2248 (char_u
*)&p_shm
, PV_NONE
,
2249 {(char_u
*)"", (char_u
*)"filnxtToO"}
2251 {"shortname", "sn", P_BOOL
|P_VI_DEF
,
2253 (char_u
*)NULL
, PV_NONE
,
2255 (char_u
*)&p_sn
, PV_SN
,
2257 {(char_u
*)FALSE
, (char_u
*)0L} SCRIPTID_INIT
},
2258 {"showbreak", "sbr", P_STRING
|P_VI_DEF
|P_RALL
,
2259 #ifdef FEAT_LINEBREAK
2260 (char_u
*)&p_sbr
, PV_NONE
,
2262 (char_u
*)NULL
, PV_NONE
,
2264 {(char_u
*)"", (char_u
*)0L} SCRIPTID_INIT
},
2265 {"showcmd", "sc", P_BOOL
|P_VIM
,
2266 #ifdef FEAT_CMDL_INFO
2267 (char_u
*)&p_sc
, PV_NONE
,
2269 (char_u
*)NULL
, PV_NONE
,
2278 {"showfulltag", "sft", P_BOOL
|P_VI_DEF
,
2279 (char_u
*)&p_sft
, PV_NONE
,
2280 {(char_u
*)FALSE
, (char_u
*)0L} SCRIPTID_INIT
},
2281 {"showmatch", "sm", P_BOOL
|P_VI_DEF
,
2282 (char_u
*)&p_sm
, PV_NONE
,
2283 {(char_u
*)FALSE
, (char_u
*)0L} SCRIPTID_INIT
},
2284 {"showmode", "smd", P_BOOL
|P_VIM
,
2285 (char_u
*)&p_smd
, PV_NONE
,
2286 {(char_u
*)FALSE
, (char_u
*)TRUE
} SCRIPTID_INIT
},
2287 {"showtabline", "stal", P_NUM
|P_VI_DEF
|P_RALL
,
2289 (char_u
*)&p_stal
, PV_NONE
,
2291 (char_u
*)NULL
, PV_NONE
,
2293 {(char_u
*)1L, (char_u
*)0L} SCRIPTID_INIT
},
2294 {"sidescroll", "ss", P_NUM
|P_VI_DEF
,
2295 (char_u
*)&p_ss
, PV_NONE
,
2296 {(char_u
*)0L, (char_u
*)0L} SCRIPTID_INIT
},
2297 {"sidescrolloff", "siso", P_NUM
|P_VI_DEF
|P_VIM
|P_RBUF
,
2298 (char_u
*)&p_siso
, PV_NONE
,
2299 {(char_u
*)0L, (char_u
*)0L} SCRIPTID_INIT
},
2300 {"slowopen", "slow", P_BOOL
|P_VI_DEF
,
2301 (char_u
*)NULL
, PV_NONE
,
2302 {(char_u
*)FALSE
, (char_u
*)0L} SCRIPTID_INIT
},
2303 {"smartcase", "scs", P_BOOL
|P_VI_DEF
|P_VIM
,
2304 (char_u
*)&p_scs
, PV_NONE
,
2305 {(char_u
*)FALSE
, (char_u
*)0L} SCRIPTID_INIT
},
2306 {"smartindent", "si", P_BOOL
|P_VI_DEF
|P_VIM
,
2307 #ifdef FEAT_SMARTINDENT
2308 (char_u
*)&p_si
, PV_SI
,
2310 (char_u
*)NULL
, PV_NONE
,
2312 {(char_u
*)FALSE
, (char_u
*)0L} SCRIPTID_INIT
},
2313 {"smarttab", "sta", P_BOOL
|P_VI_DEF
|P_VIM
,
2314 (char_u
*)&p_sta
, PV_NONE
,
2315 {(char_u
*)FALSE
, (char_u
*)0L} SCRIPTID_INIT
},
2316 {"softtabstop", "sts", P_NUM
|P_VI_DEF
|P_VIM
,
2317 (char_u
*)&p_sts
, PV_STS
,
2318 {(char_u
*)0L, (char_u
*)0L} SCRIPTID_INIT
},
2319 {"sourceany", NULL
, P_BOOL
|P_VI_DEF
,
2320 (char_u
*)NULL
, PV_NONE
,
2321 {(char_u
*)FALSE
, (char_u
*)0L} SCRIPTID_INIT
},
2322 {"spell", NULL
, P_BOOL
|P_VI_DEF
|P_RWIN
,
2324 (char_u
*)VAR_WIN
, PV_SPELL
,
2326 (char_u
*)NULL
, PV_NONE
,
2328 {(char_u
*)FALSE
, (char_u
*)0L} SCRIPTID_INIT
},
2329 {"spellcapcheck", "spc", P_STRING
|P_ALLOCED
|P_VI_DEF
|P_RBUF
,
2331 (char_u
*)&p_spc
, PV_SPC
,
2332 {(char_u
*)"[.?!]\\_[\\])'\" ]\\+", (char_u
*)0L}
2334 (char_u
*)NULL
, PV_NONE
,
2335 {(char_u
*)0L, (char_u
*)0L}
2338 {"spellfile", "spf", P_STRING
|P_EXPAND
|P_ALLOCED
|P_VI_DEF
|P_SECURE
|P_COMMA
,
2340 (char_u
*)&p_spf
, PV_SPF
,
2341 {(char_u
*)"", (char_u
*)0L}
2343 (char_u
*)NULL
, PV_NONE
,
2344 {(char_u
*)0L, (char_u
*)0L}
2347 {"spelllang", "spl", P_STRING
|P_ALLOCED
|P_VI_DEF
|P_COMMA
|P_RBUF
|P_EXPAND
,
2349 (char_u
*)&p_spl
, PV_SPL
,
2350 {(char_u
*)"en", (char_u
*)0L}
2352 (char_u
*)NULL
, PV_NONE
,
2353 {(char_u
*)0L, (char_u
*)0L}
2356 {"spellsuggest", "sps", P_STRING
|P_VI_DEF
|P_EXPAND
|P_SECURE
|P_COMMA
,
2358 (char_u
*)&p_sps
, PV_NONE
,
2359 {(char_u
*)"best", (char_u
*)0L}
2361 (char_u
*)NULL
, PV_NONE
,
2362 {(char_u
*)0L, (char_u
*)0L}
2365 {"splitbelow", "sb", P_BOOL
|P_VI_DEF
,
2367 (char_u
*)&p_sb
, PV_NONE
,
2369 (char_u
*)NULL
, PV_NONE
,
2371 {(char_u
*)FALSE
, (char_u
*)0L} SCRIPTID_INIT
},
2372 {"splitright", "spr", P_BOOL
|P_VI_DEF
,
2373 #ifdef FEAT_VERTSPLIT
2374 (char_u
*)&p_spr
, PV_NONE
,
2376 (char_u
*)NULL
, PV_NONE
,
2378 {(char_u
*)FALSE
, (char_u
*)0L} SCRIPTID_INIT
},
2379 {"startofline", "sol", P_BOOL
|P_VI_DEF
|P_VIM
,
2380 (char_u
*)&p_sol
, PV_NONE
,
2381 {(char_u
*)TRUE
, (char_u
*)0L} SCRIPTID_INIT
},
2382 {"statusline" ,"stl", P_STRING
|P_VI_DEF
|P_ALLOCED
|P_RSTAT
,
2384 (char_u
*)&p_stl
, PV_STL
,
2386 (char_u
*)NULL
, PV_NONE
,
2388 {(char_u
*)"", (char_u
*)0L} SCRIPTID_INIT
},
2389 {"suffixes", "su", P_STRING
|P_VI_DEF
|P_COMMA
|P_NODUP
,
2390 (char_u
*)&p_su
, PV_NONE
,
2391 {(char_u
*)".bak,~,.o,.h,.info,.swp,.obj",
2392 (char_u
*)0L} SCRIPTID_INIT
},
2393 {"suffixesadd", "sua", P_STRING
|P_VI_DEF
|P_ALLOCED
|P_COMMA
|P_NODUP
,
2394 #ifdef FEAT_SEARCHPATH
2395 (char_u
*)&p_sua
, PV_SUA
,
2396 {(char_u
*)"", (char_u
*)0L}
2398 (char_u
*)NULL
, PV_NONE
,
2399 {(char_u
*)0L, (char_u
*)0L}
2402 {"swapfile", "swf", P_BOOL
|P_VI_DEF
|P_RSTAT
,
2403 (char_u
*)&p_swf
, PV_SWF
,
2404 {(char_u
*)TRUE
, (char_u
*)0L} SCRIPTID_INIT
},
2405 {"swapsync", "sws", P_STRING
|P_VI_DEF
,
2406 (char_u
*)&p_sws
, PV_NONE
,
2407 {(char_u
*)"fsync", (char_u
*)0L} SCRIPTID_INIT
},
2408 {"switchbuf", "swb", P_STRING
|P_VI_DEF
|P_COMMA
|P_NODUP
,
2409 (char_u
*)&p_swb
, PV_NONE
,
2410 {(char_u
*)"", (char_u
*)0L} SCRIPTID_INIT
},
2411 {"synmaxcol", "smc", P_NUM
|P_VI_DEF
|P_RBUF
,
2413 (char_u
*)&p_smc
, PV_SMC
,
2414 {(char_u
*)3000L, (char_u
*)0L}
2416 (char_u
*)NULL
, PV_NONE
,
2417 {(char_u
*)0L, (char_u
*)0L}
2420 {"syntax", "syn", P_STRING
|P_ALLOCED
|P_VI_DEF
|P_NOGLOB
|P_NFNAME
,
2422 (char_u
*)&p_syn
, PV_SYN
,
2423 {(char_u
*)"", (char_u
*)0L}
2425 (char_u
*)NULL
, PV_NONE
,
2426 {(char_u
*)0L, (char_u
*)0L}
2429 {"tabline", "tal", P_STRING
|P_VI_DEF
|P_RALL
,
2431 (char_u
*)&p_tal
, PV_NONE
,
2433 (char_u
*)NULL
, PV_NONE
,
2435 {(char_u
*)"", (char_u
*)0L} SCRIPTID_INIT
},
2436 {"tabpagemax", "tpm", P_NUM
|P_VI_DEF
,
2438 (char_u
*)&p_tpm
, PV_NONE
,
2440 (char_u
*)NULL
, PV_NONE
,
2442 {(char_u
*)10L, (char_u
*)0L} SCRIPTID_INIT
},
2443 {"tabstop", "ts", P_NUM
|P_VI_DEF
|P_RBUF
,
2444 (char_u
*)&p_ts
, PV_TS
,
2445 {(char_u
*)8L, (char_u
*)0L} SCRIPTID_INIT
},
2446 {"tagbsearch", "tbs", P_BOOL
|P_VI_DEF
,
2447 (char_u
*)&p_tbs
, PV_NONE
,
2448 #ifdef VMS /* binary searching doesn't appear to work on VMS */
2449 {(char_u
*)0L, (char_u
*)0L}
2451 {(char_u
*)TRUE
, (char_u
*)0L}
2454 {"taglength", "tl", P_NUM
|P_VI_DEF
,
2455 (char_u
*)&p_tl
, PV_NONE
,
2456 {(char_u
*)0L, (char_u
*)0L} SCRIPTID_INIT
},
2457 {"tagrelative", "tr", P_BOOL
|P_VIM
,
2458 (char_u
*)&p_tr
, PV_NONE
,
2459 {(char_u
*)FALSE
, (char_u
*)TRUE
} SCRIPTID_INIT
},
2460 {"tags", "tag", P_STRING
|P_EXPAND
|P_VI_DEF
|P_COMMA
|P_NODUP
,
2461 (char_u
*)&p_tags
, PV_TAGS
,
2463 #if defined(FEAT_EMACS_TAGS) && !defined(CASE_INSENSITIVE_FILENAME)
2464 (char_u
*)"./tags,./TAGS,tags,TAGS",
2466 (char_u
*)"./tags,tags",
2468 (char_u
*)0L} SCRIPTID_INIT
},
2469 {"tagstack", "tgst", P_BOOL
|P_VI_DEF
,
2470 (char_u
*)&p_tgst
, PV_NONE
,
2471 {(char_u
*)TRUE
, (char_u
*)0L} SCRIPTID_INIT
},
2472 {"term", NULL
, P_STRING
|P_EXPAND
|P_NODEFAULT
|P_NO_MKRC
|P_VI_DEF
|P_RALL
,
2473 (char_u
*)&T_NAME
, PV_NONE
,
2474 {(char_u
*)"", (char_u
*)0L} SCRIPTID_INIT
},
2475 {"termbidi", "tbidi", P_BOOL
|P_VI_DEF
,
2477 (char_u
*)&p_tbidi
, PV_NONE
,
2479 (char_u
*)NULL
, PV_NONE
,
2481 {(char_u
*)FALSE
, (char_u
*)0L} SCRIPTID_INIT
},
2482 {"termencoding", "tenc", P_STRING
|P_VI_DEF
|P_RCLR
,
2484 (char_u
*)&p_tenc
, PV_NONE
,
2485 {(char_u
*)"", (char_u
*)0L}
2487 (char_u
*)NULL
, PV_NONE
,
2488 {(char_u
*)0L, (char_u
*)0L}
2491 {"terse", NULL
, P_BOOL
|P_VI_DEF
,
2492 (char_u
*)&p_terse
, PV_NONE
,
2493 {(char_u
*)FALSE
, (char_u
*)0L} SCRIPTID_INIT
},
2494 {"textauto", "ta", P_BOOL
|P_VIM
,
2495 (char_u
*)&p_ta
, PV_NONE
,
2496 {(char_u
*)DFLT_TEXTAUTO
, (char_u
*)TRUE
}
2498 {"textmode", "tx", P_BOOL
|P_VI_DEF
|P_NO_MKRC
,
2499 (char_u
*)&p_tx
, PV_TX
,
2506 (char_u
*)0L} SCRIPTID_INIT
},
2507 {"textwidth", "tw", P_NUM
|P_VI_DEF
|P_VIM
,
2508 (char_u
*)&p_tw
, PV_TW
,
2509 {(char_u
*)0L, (char_u
*)0L} SCRIPTID_INIT
},
2510 {"thesaurus", "tsr", P_STRING
|P_EXPAND
|P_VI_DEF
|P_COMMA
|P_NODUP
,
2511 #ifdef FEAT_INS_EXPAND
2512 (char_u
*)&p_tsr
, PV_TSR
,
2514 (char_u
*)NULL
, PV_NONE
,
2516 {(char_u
*)"", (char_u
*)0L} SCRIPTID_INIT
},
2517 {"tildeop", "top", P_BOOL
|P_VI_DEF
|P_VIM
,
2518 (char_u
*)&p_to
, PV_NONE
,
2519 {(char_u
*)FALSE
, (char_u
*)0L} SCRIPTID_INIT
},
2520 {"timeout", "to", P_BOOL
|P_VI_DEF
,
2521 (char_u
*)&p_timeout
, PV_NONE
,
2522 {(char_u
*)TRUE
, (char_u
*)0L} SCRIPTID_INIT
},
2523 {"timeoutlen", "tm", P_NUM
|P_VI_DEF
,
2524 (char_u
*)&p_tm
, PV_NONE
,
2525 {(char_u
*)1000L, (char_u
*)0L} SCRIPTID_INIT
},
2526 {"title", NULL
, P_BOOL
|P_VI_DEF
,
2528 (char_u
*)&p_title
, PV_NONE
,
2530 (char_u
*)NULL
, PV_NONE
,
2532 {(char_u
*)FALSE
, (char_u
*)0L} SCRIPTID_INIT
},
2533 {"titlelen", NULL
, P_NUM
|P_VI_DEF
,
2535 (char_u
*)&p_titlelen
, PV_NONE
,
2537 (char_u
*)NULL
, PV_NONE
,
2539 {(char_u
*)85L, (char_u
*)0L} SCRIPTID_INIT
},
2540 {"titleold", NULL
, P_STRING
|P_VI_DEF
|P_GETTEXT
|P_SECURE
|P_NO_MKRC
,
2542 (char_u
*)&p_titleold
, PV_NONE
,
2543 {(char_u
*)N_("Thanks for flying Vim"),
2546 (char_u
*)NULL
, PV_NONE
,
2547 {(char_u
*)0L, (char_u
*)0L}
2550 {"titlestring", NULL
, P_STRING
|P_VI_DEF
,
2552 (char_u
*)&p_titlestring
, PV_NONE
,
2554 (char_u
*)NULL
, PV_NONE
,
2556 {(char_u
*)"", (char_u
*)0L} SCRIPTID_INIT
},
2557 #if defined(FEAT_TOOLBAR) && !defined(FEAT_GUI_W32)
2558 {"toolbar", "tb", P_STRING
|P_COMMA
|P_VI_DEF
|P_NODUP
,
2559 (char_u
*)&p_toolbar
, PV_NONE
,
2560 {(char_u
*)"icons,tooltips", (char_u
*)0L}
2563 #if defined(FEAT_TOOLBAR) && defined(FEAT_GUI_GTK) && defined(HAVE_GTK2)
2564 {"toolbariconsize", "tbis", P_STRING
|P_VI_DEF
,
2565 (char_u
*)&p_tbis
, PV_NONE
,
2566 {(char_u
*)"small", (char_u
*)0L} SCRIPTID_INIT
},
2568 #ifdef USE_TRANSPARENCY
2569 {"transparency", "tra", P_NUM
|P_VI_DEF
,
2570 (char_u
*)&p_transparency
, PV_NONE
,
2571 {(char_u
*)255L, (char_u
*)0L}},
2573 {"ttimeout", NULL
, P_BOOL
|P_VI_DEF
|P_VIM
,
2574 (char_u
*)&p_ttimeout
, PV_NONE
,
2575 {(char_u
*)FALSE
, (char_u
*)0L} SCRIPTID_INIT
},
2576 {"ttimeoutlen", "ttm", P_NUM
|P_VI_DEF
,
2577 (char_u
*)&p_ttm
, PV_NONE
,
2578 {(char_u
*)-1L, (char_u
*)0L} SCRIPTID_INIT
},
2579 {"ttybuiltin", "tbi", P_BOOL
|P_VI_DEF
,
2580 (char_u
*)&p_tbi
, PV_NONE
,
2581 {(char_u
*)TRUE
, (char_u
*)0L} SCRIPTID_INIT
},
2582 {"ttyfast", "tf", P_BOOL
|P_NO_MKRC
|P_VI_DEF
,
2583 (char_u
*)&p_tf
, PV_NONE
,
2584 {(char_u
*)FALSE
, (char_u
*)0L} SCRIPTID_INIT
},
2585 {"ttymouse", "ttym", P_STRING
|P_NODEFAULT
|P_NO_MKRC
|P_VI_DEF
,
2586 #if defined(FEAT_MOUSE) && (defined(UNIX) || defined(VMS))
2587 (char_u
*)&p_ttym
, PV_NONE
,
2589 (char_u
*)NULL
, PV_NONE
,
2591 {(char_u
*)"", (char_u
*)0L} SCRIPTID_INIT
},
2592 {"ttyscroll", "tsl", P_NUM
|P_VI_DEF
,
2593 (char_u
*)&p_ttyscroll
, PV_NONE
,
2594 {(char_u
*)999L, (char_u
*)0L} SCRIPTID_INIT
},
2595 {"ttytype", "tty", P_STRING
|P_EXPAND
|P_NODEFAULT
|P_NO_MKRC
|P_VI_DEF
|P_RALL
,
2596 (char_u
*)&T_NAME
, PV_NONE
,
2597 {(char_u
*)"", (char_u
*)0L} SCRIPTID_INIT
},
2598 {"undolevels", "ul", P_NUM
|P_VI_DEF
,
2599 (char_u
*)&p_ul
, PV_NONE
,
2601 #if defined(UNIX) || defined(WIN3264) || defined(OS2) || defined(VMS)
2606 (char_u
*)0L} SCRIPTID_INIT
},
2607 {"updatecount", "uc", P_NUM
|P_VI_DEF
,
2608 (char_u
*)&p_uc
, PV_NONE
,
2609 {(char_u
*)200L, (char_u
*)0L} SCRIPTID_INIT
},
2610 {"updatetime", "ut", P_NUM
|P_VI_DEF
,
2611 (char_u
*)&p_ut
, PV_NONE
,
2612 {(char_u
*)4000L, (char_u
*)0L} SCRIPTID_INIT
},
2613 {"verbose", "vbs", P_NUM
|P_VI_DEF
,
2614 (char_u
*)&p_verbose
, PV_NONE
,
2615 {(char_u
*)0L, (char_u
*)0L} SCRIPTID_INIT
},
2616 {"verbosefile", "vfile", P_STRING
|P_EXPAND
|P_VI_DEF
|P_SECURE
,
2617 (char_u
*)&p_vfile
, PV_NONE
,
2618 {(char_u
*)"", (char_u
*)0L} SCRIPTID_INIT
},
2619 {"viewdir", "vdir", P_STRING
|P_EXPAND
|P_VI_DEF
|P_SECURE
,
2621 (char_u
*)&p_vdir
, PV_NONE
,
2622 {(char_u
*)DFLT_VDIR
, (char_u
*)0L}
2624 (char_u
*)NULL
, PV_NONE
,
2625 {(char_u
*)0L, (char_u
*)0L}
2628 {"viewoptions", "vop", P_STRING
|P_VI_DEF
|P_COMMA
|P_NODUP
,
2630 (char_u
*)&p_vop
, PV_NONE
,
2631 {(char_u
*)"folds,options,cursor", (char_u
*)0L}
2633 (char_u
*)NULL
, PV_NONE
,
2634 {(char_u
*)0L, (char_u
*)0L}
2637 {"viminfo", "vi", P_STRING
|P_COMMA
|P_NODUP
|P_SECURE
,
2639 (char_u
*)&p_viminfo
, PV_NONE
,
2640 #if defined(MSDOS) || defined(MSWIN) || defined(OS2)
2641 {(char_u
*)"", (char_u
*)"'100,<50,s10,h,rA:,rB:"}
2645 (char_u
*)"'100,<50,s10,h,rdf0:,rdf1:,rdf2:"}
2647 {(char_u
*)"", (char_u
*)"'100,<50,s10,h"}
2651 (char_u
*)NULL
, PV_NONE
,
2652 {(char_u
*)0L, (char_u
*)0L}
2655 {"virtualedit", "ve", P_STRING
|P_COMMA
|P_NODUP
|P_VI_DEF
|P_VIM
,
2656 #ifdef FEAT_VIRTUALEDIT
2657 (char_u
*)&p_ve
, PV_NONE
,
2658 {(char_u
*)"", (char_u
*)""}
2660 (char_u
*)NULL
, PV_NONE
,
2661 {(char_u
*)0L, (char_u
*)0L}
2664 {"visualbell", "vb", P_BOOL
|P_VI_DEF
,
2665 (char_u
*)&p_vb
, PV_NONE
,
2666 {(char_u
*)FALSE
, (char_u
*)0L} SCRIPTID_INIT
},
2667 {"w300", NULL
, P_NUM
|P_VI_DEF
,
2668 (char_u
*)NULL
, PV_NONE
,
2669 {(char_u
*)0L, (char_u
*)0L} SCRIPTID_INIT
},
2670 {"w1200", NULL
, P_NUM
|P_VI_DEF
,
2671 (char_u
*)NULL
, PV_NONE
,
2672 {(char_u
*)0L, (char_u
*)0L} SCRIPTID_INIT
},
2673 {"w9600", NULL
, P_NUM
|P_VI_DEF
,
2674 (char_u
*)NULL
, PV_NONE
,
2675 {(char_u
*)0L, (char_u
*)0L} SCRIPTID_INIT
},
2676 {"warn", NULL
, P_BOOL
|P_VI_DEF
,
2677 (char_u
*)&p_warn
, PV_NONE
,
2678 {(char_u
*)TRUE
, (char_u
*)0L} SCRIPTID_INIT
},
2679 {"weirdinvert", "wiv", P_BOOL
|P_VI_DEF
|P_RCLR
,
2680 (char_u
*)&p_wiv
, PV_NONE
,
2681 {(char_u
*)FALSE
, (char_u
*)0L} SCRIPTID_INIT
},
2682 {"whichwrap", "ww", P_STRING
|P_VIM
|P_COMMA
|P_FLAGLIST
,
2683 (char_u
*)&p_ww
, PV_NONE
,
2684 {(char_u
*)"", (char_u
*)"b,s"} SCRIPTID_INIT
},
2685 {"wildchar", "wc", P_NUM
|P_VIM
,
2686 (char_u
*)&p_wc
, PV_NONE
,
2687 {(char_u
*)(long)Ctrl_E
, (char_u
*)(long)TAB
}
2689 {"wildcharm", "wcm", P_NUM
|P_VI_DEF
,
2690 (char_u
*)&p_wcm
, PV_NONE
,
2691 {(char_u
*)0L, (char_u
*)0L} SCRIPTID_INIT
},
2692 {"wildignore", "wig", P_STRING
|P_VI_DEF
|P_COMMA
|P_NODUP
,
2694 (char_u
*)&p_wig
, PV_NONE
,
2696 (char_u
*)NULL
, PV_NONE
,
2698 {(char_u
*)"", (char_u
*)0L} SCRIPTID_INIT
},
2699 {"wildmenu", "wmnu", P_BOOL
|P_VI_DEF
,
2700 #ifdef FEAT_WILDMENU
2701 (char_u
*)&p_wmnu
, PV_NONE
,
2703 (char_u
*)NULL
, PV_NONE
,
2705 {(char_u
*)FALSE
, (char_u
*)0L} SCRIPTID_INIT
},
2706 {"wildmode", "wim", P_STRING
|P_VI_DEF
|P_COMMA
|P_NODUP
,
2707 (char_u
*)&p_wim
, PV_NONE
,
2708 {(char_u
*)"full", (char_u
*)0L} SCRIPTID_INIT
},
2709 {"wildoptions", "wop", P_STRING
|P_VI_DEF
,
2710 #ifdef FEAT_CMDL_COMPL
2711 (char_u
*)&p_wop
, PV_NONE
,
2712 {(char_u
*)"", (char_u
*)0L}
2714 (char_u
*)NULL
, PV_NONE
,
2715 {(char_u
*)NULL
, (char_u
*)0L}
2718 {"winaltkeys", "wak", P_STRING
|P_VI_DEF
,
2720 (char_u
*)&p_wak
, PV_NONE
,
2721 {(char_u
*)"menu", (char_u
*)0L}
2723 (char_u
*)NULL
, PV_NONE
,
2724 {(char_u
*)NULL
, (char_u
*)0L}
2727 {"window", "wi", P_NUM
|P_VI_DEF
,
2728 (char_u
*)&p_window
, PV_NONE
,
2729 {(char_u
*)0L, (char_u
*)0L} SCRIPTID_INIT
},
2730 {"winheight", "wh", P_NUM
|P_VI_DEF
,
2732 (char_u
*)&p_wh
, PV_NONE
,
2734 (char_u
*)NULL
, PV_NONE
,
2736 {(char_u
*)1L, (char_u
*)0L} SCRIPTID_INIT
},
2737 {"winfixheight", "wfh", P_BOOL
|P_VI_DEF
|P_RSTAT
,
2739 (char_u
*)VAR_WIN
, PV_WFH
,
2741 (char_u
*)NULL
, PV_NONE
,
2743 {(char_u
*)FALSE
, (char_u
*)0L} SCRIPTID_INIT
},
2744 {"winfixwidth", "wfw", P_BOOL
|P_VI_DEF
|P_RSTAT
,
2745 #ifdef FEAT_VERTSPLIT
2746 (char_u
*)VAR_WIN
, PV_WFW
,
2748 (char_u
*)NULL
, PV_NONE
,
2750 {(char_u
*)FALSE
, (char_u
*)0L} SCRIPTID_INIT
},
2751 {"winminheight", "wmh", P_NUM
|P_VI_DEF
,
2753 (char_u
*)&p_wmh
, PV_NONE
,
2755 (char_u
*)NULL
, PV_NONE
,
2757 {(char_u
*)1L, (char_u
*)0L} SCRIPTID_INIT
},
2758 {"winminwidth", "wmw", P_NUM
|P_VI_DEF
,
2759 #ifdef FEAT_VERTSPLIT
2760 (char_u
*)&p_wmw
, PV_NONE
,
2762 (char_u
*)NULL
, PV_NONE
,
2764 {(char_u
*)1L, (char_u
*)0L} SCRIPTID_INIT
},
2765 {"winwidth", "wiw", P_NUM
|P_VI_DEF
,
2766 #ifdef FEAT_VERTSPLIT
2767 (char_u
*)&p_wiw
, PV_NONE
,
2769 (char_u
*)NULL
, PV_NONE
,
2771 {(char_u
*)20L, (char_u
*)0L} SCRIPTID_INIT
},
2772 {"wrap", NULL
, P_BOOL
|P_VI_DEF
|P_RWIN
,
2773 (char_u
*)VAR_WIN
, PV_WRAP
,
2774 {(char_u
*)TRUE
, (char_u
*)0L} SCRIPTID_INIT
},
2775 {"wrapmargin", "wm", P_NUM
|P_VI_DEF
,
2776 (char_u
*)&p_wm
, PV_WM
,
2777 {(char_u
*)0L, (char_u
*)0L} SCRIPTID_INIT
},
2778 {"wrapscan", "ws", P_BOOL
|P_VI_DEF
,
2779 (char_u
*)&p_ws
, PV_NONE
,
2780 {(char_u
*)TRUE
, (char_u
*)0L} SCRIPTID_INIT
},
2781 {"write", NULL
, P_BOOL
|P_VI_DEF
,
2782 (char_u
*)&p_write
, PV_NONE
,
2783 {(char_u
*)TRUE
, (char_u
*)0L} SCRIPTID_INIT
},
2784 {"writeany", "wa", P_BOOL
|P_VI_DEF
,
2785 (char_u
*)&p_wa
, PV_NONE
,
2786 {(char_u
*)FALSE
, (char_u
*)0L} SCRIPTID_INIT
},
2787 {"writebackup", "wb", P_BOOL
|P_VI_DEF
|P_VIM
,
2788 (char_u
*)&p_wb
, PV_NONE
,
2790 #ifdef FEAT_WRITEBACKUP
2795 (char_u
*)0L} SCRIPTID_INIT
},
2796 {"writedelay", "wd", P_NUM
|P_VI_DEF
,
2797 (char_u
*)&p_wd
, PV_NONE
,
2798 {(char_u
*)0L, (char_u
*)0L} SCRIPTID_INIT
},
2800 /* terminal output codes */
2801 #define p_term(sss, vvv) {sss, NULL, P_STRING|P_VI_DEF|P_RALL|P_SECURE, \
2802 (char_u *)&vvv, PV_NONE, \
2803 {(char_u *)"", (char_u *)0L} SCRIPTID_INIT},
2805 p_term("t_AB", T_CAB
)
2806 p_term("t_AF", T_CAF
)
2807 p_term("t_AL", T_CAL
)
2808 p_term("t_al", T_AL
)
2809 p_term("t_bc", T_BC
)
2810 p_term("t_cd", T_CD
)
2811 p_term("t_ce", T_CE
)
2812 p_term("t_cl", T_CL
)
2813 p_term("t_cm", T_CM
)
2814 p_term("t_Co", T_CCO
)
2815 p_term("t_CS", T_CCS
)
2816 p_term("t_cs", T_CS
)
2817 #ifdef FEAT_VERTSPLIT
2818 p_term("t_CV", T_CSV
)
2820 p_term("t_ut", T_UT
)
2821 p_term("t_da", T_DA
)
2822 p_term("t_db", T_DB
)
2823 p_term("t_DL", T_CDL
)
2824 p_term("t_dl", T_DL
)
2825 p_term("t_fs", T_FS
)
2826 p_term("t_IE", T_CIE
)
2827 p_term("t_IS", T_CIS
)
2828 p_term("t_ke", T_KE
)
2829 p_term("t_ks", T_KS
)
2830 p_term("t_le", T_LE
)
2831 p_term("t_mb", T_MB
)
2832 p_term("t_md", T_MD
)
2833 p_term("t_me", T_ME
)
2834 p_term("t_mr", T_MR
)
2835 p_term("t_ms", T_MS
)
2836 p_term("t_nd", T_ND
)
2837 p_term("t_op", T_OP
)
2838 p_term("t_RI", T_CRI
)
2839 p_term("t_RV", T_CRV
)
2840 p_term("t_Sb", T_CSB
)
2841 p_term("t_Sf", T_CSF
)
2842 p_term("t_se", T_SE
)
2843 p_term("t_so", T_SO
)
2844 p_term("t_sr", T_SR
)
2845 p_term("t_ts", T_TS
)
2846 p_term("t_te", T_TE
)
2847 p_term("t_ti", T_TI
)
2848 p_term("t_ue", T_UE
)
2849 p_term("t_us", T_US
)
2850 p_term("t_vb", T_VB
)
2851 p_term("t_ve", T_VE
)
2852 p_term("t_vi", T_VI
)
2853 p_term("t_vs", T_VS
)
2854 p_term("t_WP", T_CWP
)
2855 p_term("t_WS", T_CWS
)
2856 p_term("t_SI", T_CSI
)
2857 p_term("t_EI", T_CEI
)
2858 p_term("t_xs", T_XS
)
2859 p_term("t_ZH", T_CZH
)
2860 p_term("t_ZR", T_CZR
)
2862 /* terminal key codes are not in here */
2865 {NULL
, NULL
, 0, NULL
, PV_NONE
, {NULL
, NULL
} SCRIPTID_INIT
}
2868 #define PARAM_COUNT (sizeof(options) / sizeof(struct vimoption))
2871 static char *(p_ambw_values
[]) = {"single", "double",
2872 # ifdef USE_AMBIWIDTH_AUTO
2877 static char *(p_bg_values
[]) = {"light", "dark", NULL
};
2878 static char *(p_nf_values
[]) = {"octal", "hex", "alpha", NULL
};
2879 static char *(p_ff_values
[]) = {FF_UNIX
, FF_DOS
, FF_MAC
, NULL
};
2880 #ifdef FEAT_CMDL_COMPL
2881 static char *(p_wop_values
[]) = {"tagfile", NULL
};
2884 static char *(p_wak_values
[]) = {"yes", "menu", "no", NULL
};
2886 static char *(p_mousem_values
[]) = {"extend", "popup", "popup_setpos", "mac", NULL
};
2888 static char *(p_sel_values
[]) = {"inclusive", "exclusive", "old", NULL
};
2889 static char *(p_slm_values
[]) = {"mouse", "key", "cmd", NULL
};
2892 static char *(p_km_values
[]) = {"startsel", "stopsel", NULL
};
2895 static char *(p_bsdir_values
[]) = {"current", "last", "buffer", NULL
};
2897 #ifdef FEAT_SCROLLBIND
2898 static char *(p_scbopt_values
[]) = {"ver", "hor", "jump", NULL
};
2900 static char *(p_debug_values
[]) = {"msg", "throw", "beep", NULL
};
2901 #ifdef FEAT_VERTSPLIT
2902 static char *(p_ead_values
[]) = {"both", "ver", "hor", NULL
};
2904 #if defined(FEAT_QUICKFIX)
2905 # ifdef FEAT_AUTOCMD
2906 static char *(p_buftype_values
[]) = {"nofile", "nowrite", "quickfix", "help", "acwrite", NULL
};
2908 static char *(p_buftype_values
[]) = {"nofile", "nowrite", "quickfix", "help", NULL
};
2910 static char *(p_bufhidden_values
[]) = {"hide", "unload", "delete", "wipe", NULL
};
2912 static char *(p_bs_values
[]) = {"indent", "eol", "start", NULL
};
2914 static char *(p_fdm_values
[]) = {"manual", "expr", "marker", "indent", "syntax",
2919 static char *(p_fcl_values
[]) = {"all", NULL
};
2921 #ifdef FEAT_INS_EXPAND
2922 static char *(p_cot_values
[]) = {"menu", "menuone", "longest", "preview", NULL
};
2925 static void set_option_default
__ARGS((int, int opt_flags
, int compatible
));
2926 static void set_options_default
__ARGS((int opt_flags
));
2927 static char_u
*term_bg_default
__ARGS((void));
2928 static void did_set_option
__ARGS((int opt_idx
, int opt_flags
, int new_value
));
2929 static char_u
*illegal_char
__ARGS((char_u
*, int));
2930 static int string_to_key
__ARGS((char_u
*arg
));
2932 static char_u
*check_cedit
__ARGS((void));
2935 static void did_set_title
__ARGS((int icon
));
2937 static char_u
*option_expand
__ARGS((int opt_idx
, char_u
*val
));
2938 static void didset_options
__ARGS((void));
2939 static void check_string_option
__ARGS((char_u
**pp
));
2940 #if defined(FEAT_EVAL) || defined(PROTO)
2941 static long_u
*insecure_flag
__ARGS((int opt_idx
, int opt_flags
));
2943 # define insecure_flag(opt_idx, opt_flags) (&options[opt_idx].flags)
2945 static void set_string_option_global
__ARGS((int opt_idx
, char_u
**varp
));
2946 static void set_string_option
__ARGS((int opt_idx
, char_u
*value
, int opt_flags
));
2947 static char_u
*did_set_string_option
__ARGS((int opt_idx
, char_u
**varp
, int new_value_alloced
, char_u
*oldval
, char_u
*errbuf
, int opt_flags
));
2948 static char_u
*set_chars_option
__ARGS((char_u
**varp
));
2949 #ifdef FEAT_CLIPBOARD
2950 static char_u
*check_clipboard_option
__ARGS((void));
2953 static char_u
*compile_cap_prog
__ARGS((buf_T
*buf
));
2956 static void set_option_scriptID_idx
__ARGS((int opt_idx
, int opt_flags
, int id
));
2958 static char_u
*set_bool_option
__ARGS((int opt_idx
, char_u
*varp
, int value
, int opt_flags
));
2959 static char_u
*set_num_option
__ARGS((int opt_idx
, char_u
*varp
, long value
, char_u
*errbuf
, size_t errbuflen
, int opt_flags
));
2960 static void check_redraw
__ARGS((long_u flags
));
2961 static int findoption
__ARGS((char_u
*));
2962 static int find_key_option
__ARGS((char_u
*));
2963 static void showoptions
__ARGS((int all
, int opt_flags
));
2964 static int optval_default
__ARGS((struct vimoption
*, char_u
*varp
));
2965 static void showoneopt
__ARGS((struct vimoption
*, int opt_flags
));
2966 static int put_setstring
__ARGS((FILE *fd
, char *cmd
, char *name
, char_u
**valuep
, int expand
));
2967 static int put_setnum
__ARGS((FILE *fd
, char *cmd
, char *name
, long *valuep
));
2968 static int put_setbool
__ARGS((FILE *fd
, char *cmd
, char *name
, int value
));
2969 static int istermoption
__ARGS((struct vimoption
*));
2970 static char_u
*get_varp_scope
__ARGS((struct vimoption
*p
, int opt_flags
));
2971 static char_u
*get_varp
__ARGS((struct vimoption
*));
2972 static void option_value2string
__ARGS((struct vimoption
*, int opt_flags
));
2973 static int wc_use_keyname
__ARGS((char_u
*varp
, long *wcp
));
2975 static void langmap_init
__ARGS((void));
2976 static void langmap_set
__ARGS((void));
2978 static void paste_option_changed
__ARGS((void));
2979 static void compatible_set
__ARGS((void));
2980 #ifdef FEAT_LINEBREAK
2981 static void fill_breakat_flags
__ARGS((void));
2983 static int opt_strings_flags
__ARGS((char_u
*val
, char **values
, unsigned *flagp
, int list
));
2984 static int check_opt_strings
__ARGS((char_u
*val
, char **values
, int));
2985 static int check_opt_wim
__ARGS((void));
2988 * Initialize the options, first part.
2990 * Called only once from main(), just after creating the first buffer.
3003 /* Be Vi compatible by default */
3006 /* Use POSIX compatibility when $VIM_POSIX is set. */
3007 if (mch_getenv((char_u
*)"VIM_POSIX") != NULL
)
3009 set_string_default("cpo", (char_u
*)CPO_ALL
);
3010 set_string_default("shm", (char_u
*)"A");
3014 * Find default value for 'shell' option.
3015 * Don't use it if it is empty.
3017 if (((p
= mch_getenv((char_u
*)"SHELL")) != NULL
&& *p
!= NUL
)
3018 #if defined(MSDOS) || defined(MSWIN) || defined(OS2)
3020 || ((p
= mch_getenv((char_u
*)"EMXSHELL")) != NULL
&& *p
!= NUL
)
3022 || ((p
= mch_getenv((char_u
*)"COMSPEC")) != NULL
&& *p
!= NUL
)
3024 || ((p
= default_shell()) != NULL
&& *p
!= NUL
)
3028 set_string_default("sh", p
);
3032 * Set the default for 'backupskip' to include environment variables for
3037 static char *(names
[4]) = {"", "TMPDIR", "TEMP", "TMP"};
3039 static char *(names
[3]) = {"TMPDIR", "TEMP", "TMP"};
3045 ga_init2(&ga
, 1, 100);
3046 for (n
= 0; n
< (long)(sizeof(names
) / sizeof(char *)); ++n
)
3050 if (*names
[n
] == NUL
)
3051 p
= (char_u
*)"/tmp";
3054 p
= vim_getenv((char_u
*)names
[n
], &mustfree
);
3055 if (p
!= NULL
&& *p
!= NUL
)
3057 /* First time count the NUL, otherwise count the ','. */
3058 len
= (int)STRLEN(p
) + 3;
3059 if (ga_grow(&ga
, len
) == OK
)
3062 STRCAT(ga
.ga_data
, ",");
3063 STRCAT(ga
.ga_data
, p
);
3064 add_pathsep(ga
.ga_data
);
3065 STRCAT(ga
.ga_data
, "*");
3072 if (ga
.ga_data
!= NULL
)
3074 set_string_default("bsk", ga
.ga_data
);
3075 vim_free(ga
.ga_data
);
3081 * 'maxmemtot' and 'maxmem' may have to be adjusted for available memory
3083 opt_idx
= findoption((char_u
*)"maxmemtot");
3086 #if !defined(HAVE_AVAIL_MEM) && !defined(HAVE_TOTAL_MEM)
3087 if (options
[opt_idx
].def_val
[VI_DEFAULT
] == (char_u
*)0L)
3090 #ifdef HAVE_AVAIL_MEM
3091 /* Use amount of memory available at this moment. */
3092 n
= (mch_avail_mem(FALSE
) >> 11);
3094 # ifdef HAVE_TOTAL_MEM
3095 /* Use amount of memory available to Vim. */
3096 n
= (mch_total_mem(FALSE
) >> 1);
3098 n
= (0x7fffffff >> 11);
3101 options
[opt_idx
].def_val
[VI_DEFAULT
] = (char_u
*)n
;
3102 opt_idx
= findoption((char_u
*)"maxmem");
3105 #if !defined(HAVE_AVAIL_MEM) && !defined(HAVE_TOTAL_MEM)
3106 if ((long)options
[opt_idx
].def_val
[VI_DEFAULT
] > n
3107 || (long)options
[opt_idx
].def_val
[VI_DEFAULT
] == 0L)
3109 options
[opt_idx
].def_val
[VI_DEFAULT
] = (char_u
*)n
;
3115 /* force 'shortname' for Win32s */
3116 if (gui_is_win32s())
3118 opt_idx
= findoption((char_u
*)"shortname");
3120 options
[opt_idx
].def_val
[VI_DEFAULT
] = (char_u
*)TRUE
;
3124 #ifdef FEAT_SEARCHPATH
3130 int mustfree
= FALSE
;
3132 /* Initialize the 'cdpath' option's default value. */
3133 cdpath
= vim_getenv((char_u
*)"CDPATH", &mustfree
);
3136 buf
= alloc((unsigned)((STRLEN(cdpath
) << 1) + 2));
3139 buf
[0] = ','; /* start with ",", current dir first */
3141 for (i
= 0; cdpath
[i
] != NUL
; ++i
)
3143 if (vim_ispathlistsep(cdpath
[i
]))
3147 if (cdpath
[i
] == ' ' || cdpath
[i
] == ',')
3149 buf
[j
++] = cdpath
[i
];
3153 opt_idx
= findoption((char_u
*)"cdpath");
3156 options
[opt_idx
].def_val
[VI_DEFAULT
] = buf
;
3157 options
[opt_idx
].flags
|= P_DEF_ALLOCED
;
3166 #if defined(FEAT_POSTSCRIPT) && (defined(MSWIN) || defined(OS2) || defined(VMS) || defined(EBCDIC) || defined(MAC) || defined(hpux))
3167 /* Set print encoding on platforms that don't default to latin1 */
3168 set_string_default("penc",
3169 # if defined(MSWIN) || defined(OS2)
3176 (char_u
*)"ebcdic-uk"
3179 (char_u
*)"mac-roman"
3181 (char_u
*)"hp-roman8"
3189 #ifdef FEAT_POSTSCRIPT
3190 /* 'printexpr' must be allocated to be able to evaluate it. */
3191 set_string_default("pexpr",
3192 # if defined(MSWIN) || defined(MSDOS) || defined(OS2)
3193 (char_u
*)"system('copy' . ' ' . v:fname_in . (&printdevice == '' ? ' LPT1:' : (' \"' . &printdevice . '\"'))) . delete(v:fname_in)"
3196 (char_u
*)"system('print/delete' . (&printdevice == '' ? '' : ' /queue=' . &printdevice) . ' ' . v:fname_in)"
3199 (char_u
*)"system('lpr' . (&printdevice == '' ? '' : ' -P' . &printdevice) . ' ' . v:fname_in) . delete(v:fname_in) + v:shell_error"
3206 * Set all the options (except the terminal options) to their default
3207 * value. Also set the global value for local options.
3209 set_options_default(0);
3212 if (found_reverse_arg
)
3213 set_option_value((char_u
*)"bg", 0L, (char_u
*)"dark", 0);
3216 curbuf
->b_p_initialized
= TRUE
;
3217 curbuf
->b_p_ar
= -1; /* no local 'autoread' value */
3218 check_buf_options(curbuf
);
3219 check_win_options(curwin
);
3222 /* Must be before option_expand(), because that one needs vim_isIDc() */
3226 /* Use the current chartab for the generic chartab. */
3227 init_spell_chartab();
3230 #ifdef FEAT_LINEBREAK
3232 * initialize the table for 'breakat'.
3234 fill_breakat_flags();
3238 * Expand environment variables and things like "~" for the defaults.
3239 * If option_expand() returns non-NULL the variable is expanded. This can
3240 * only happen for non-indirect options.
3241 * Also set the default to the expanded value, so ":set" does not list
3243 * Don't set the P_ALLOCED flag, because we don't want to free the
3246 for (opt_idx
= 0; !istermoption(&options
[opt_idx
]); opt_idx
++)
3248 if ((options
[opt_idx
].flags
& P_GETTEXT
)
3249 && options
[opt_idx
].var
!= NULL
)
3250 p
= (char_u
*)_(*(char **)options
[opt_idx
].var
);
3252 p
= option_expand(opt_idx
, NULL
);
3253 if (p
!= NULL
&& (p
= vim_strsave(p
)) != NULL
)
3255 *(char_u
**)options
[opt_idx
].var
= p
;
3257 * Defaults for all expanded options are currently the same for Vi
3258 * and Vim. When this changes, add some code here! Also need to
3259 * split P_DEF_ALLOCED in two.
3261 if (options
[opt_idx
].flags
& P_DEF_ALLOCED
)
3262 vim_free(options
[opt_idx
].def_val
[VI_DEFAULT
]);
3263 options
[opt_idx
].def_val
[VI_DEFAULT
] = p
;
3264 options
[opt_idx
].flags
|= P_DEF_ALLOCED
;
3268 /* Initialize the highlight_attr[] table. */
3269 highlight_changed();
3271 save_file_ff(curbuf
); /* Buffer is unchanged */
3273 /* Parse default for 'wildmode' */
3276 #if defined(FEAT_ARABIC)
3277 /* Detect use of mlterm.
3278 * Mlterm is a terminal emulator akin to xterm that has some special
3279 * abilities (bidi namely).
3280 * NOTE: mlterm's author is being asked to 'set' a variable
3281 * instead of an environment variable due to inheritance.
3283 if (mch_getenv((char_u
*)"MLTERM") != NULL
)
3284 set_option_value((char_u
*)"tbidi", 1L, NULL
, 0);
3287 #if defined(FEAT_WINDOWS) || defined(FEAT_FOLDING)
3288 /* Parse default for 'fillchars'. */
3289 (void)set_chars_option(&p_fcs
);
3292 #ifdef FEAT_CLIPBOARD
3293 /* Parse default for 'clipboard' */
3294 (void)check_clipboard_option();
3298 # if defined(WIN3264) && defined(FEAT_GETTEXT)
3300 * If $LANG isn't set, try to get a good value for it. This makes the
3301 * right language be used automatically. Don't do this for English.
3303 if (mch_getenv((char_u
*)"LANG") == NULL
)
3307 /* Could use LOCALE_SISO639LANGNAME, but it's not in Win95.
3308 * LOCALE_SABBREVLANGNAME gives us three letters, like "enu", we use
3309 * only the first two. */
3310 n
= GetLocaleInfo(LOCALE_USER_DEFAULT
, LOCALE_SABBREVLANGNAME
,
3312 if (n
>= 2 && STRNICMP(buf
, "en", 2) != 0)
3314 /* There are a few exceptions (probably more) */
3315 if (STRNICMP(buf
, "cht", 3) == 0 || STRNICMP(buf
, "zht", 3) == 0)
3316 STRCPY(buf
, "zh_TW");
3317 else if (STRNICMP(buf
, "chs", 3) == 0
3318 || STRNICMP(buf
, "zhc", 3) == 0)
3319 STRCPY(buf
, "zh_CN");
3320 else if (STRNICMP(buf
, "jp", 2) == 0)
3323 buf
[2] = NUL
; /* truncate to two-letter code */
3324 vim_setenv("LANG", buf
);
3328 # ifdef MACOS_CONVERT
3329 /* Moved to os_mac_conv.c to avoid dependency problems. */
3334 /* enc_locale() will try to find the encoding of the current locale. */
3340 /* Try setting 'encoding' and check if the value is valid.
3341 * If not, go back to the default "latin1". */
3344 if (STRCMP(p_enc
, "gb18030") == 0)
3346 /* We don't support "gb18030", but "cp936" is a good substitute
3347 * for practical purposes, thus use that. It's not an alias to
3348 * still support conversion between gb18030 and utf-8. */
3349 p_enc
= vim_strsave((char_u
*)"cp936");
3352 if (mb_init() == NULL
)
3354 opt_idx
= findoption((char_u
*)"encoding");
3357 options
[opt_idx
].def_val
[VI_DEFAULT
] = p_enc
;
3358 options
[opt_idx
].flags
|= P_DEF_ALLOCED
;
3361 #if defined(MSDOS) || defined(MSWIN) || defined(OS2) || defined(MACOS) \
3363 if (STRCMP(p_enc
, "latin1") == 0
3369 /* Adjust the default for 'isprint' and 'iskeyword' to match
3370 * latin1. Also set the defaults for when 'nocompatible' is
3372 set_string_option_direct((char_u
*)"isp", -1,
3373 ISP_LATIN1
, OPT_FREE
, SID_NONE
);
3374 set_string_option_direct((char_u
*)"isk", -1,
3375 ISK_LATIN1
, OPT_FREE
, SID_NONE
);
3376 opt_idx
= findoption((char_u
*)"isp");
3378 options
[opt_idx
].def_val
[VIM_DEFAULT
] = ISP_LATIN1
;
3379 opt_idx
= findoption((char_u
*)"isk");
3381 options
[opt_idx
].def_val
[VIM_DEFAULT
] = ISK_LATIN1
;
3382 (void)init_chartab();
3386 # if defined(WIN3264) && !defined(FEAT_GUI)
3387 /* Win32 console: When GetACP() returns a different value from
3388 * GetConsoleCP() set 'termencoding'. */
3389 if (GetACP() != GetConsoleCP())
3393 sprintf(buf
, "cp%ld", (long)GetConsoleCP());
3394 p_tenc
= vim_strsave((char_u
*)buf
);
3397 opt_idx
= findoption((char_u
*)"termencoding");
3400 options
[opt_idx
].def_val
[VI_DEFAULT
] = p_tenc
;
3401 options
[opt_idx
].flags
|= P_DEF_ALLOCED
;
3403 convert_setup(&input_conv
, p_tenc
, p_enc
);
3404 convert_setup(&output_conv
, p_enc
, p_tenc
);
3407 p_tenc
= empty_option
;
3410 # if defined(WIN3264) && defined(FEAT_MBYTE)
3411 /* $HOME may have characters in active code page. */
3423 #ifdef FEAT_MULTI_LANG
3424 /* Set the default for 'helplang'. */
3425 set_helplang_default(get_mess_lang());
3430 * Set an option to its default value.
3431 * This does not take care of side effects!
3434 set_option_default(opt_idx
, opt_flags
, compatible
)
3436 int opt_flags
; /* OPT_FREE, OPT_LOCAL and/or OPT_GLOBAL */
3437 int compatible
; /* use Vi default value */
3439 char_u
*varp
; /* pointer to variable for current option */
3440 int dvi
; /* index in def_val[] */
3443 int both
= (opt_flags
& (OPT_LOCAL
| OPT_GLOBAL
)) == 0;
3445 varp
= get_varp_scope(&(options
[opt_idx
]), both
? OPT_LOCAL
: opt_flags
);
3446 flags
= options
[opt_idx
].flags
;
3447 if (varp
!= NULL
) /* skip hidden option, nothing to do for it */
3449 dvi
= ((flags
& P_VI_DEF
) || compatible
) ? VI_DEFAULT
: VIM_DEFAULT
;
3450 if (flags
& P_STRING
)
3452 /* Use set_string_option_direct() for local options to handle
3453 * freeing and allocating the value. */
3454 if (options
[opt_idx
].indir
!= PV_NONE
)
3455 set_string_option_direct(NULL
, opt_idx
,
3456 options
[opt_idx
].def_val
[dvi
], opt_flags
, 0);
3459 if ((opt_flags
& OPT_FREE
) && (flags
& P_ALLOCED
))
3460 free_string_option(*(char_u
**)(varp
));
3461 *(char_u
**)varp
= options
[opt_idx
].def_val
[dvi
];
3462 options
[opt_idx
].flags
&= ~P_ALLOCED
;
3465 else if (flags
& P_NUM
)
3467 if (options
[opt_idx
].indir
== PV_SCROLL
)
3468 win_comp_scroll(curwin
);
3471 *(long *)varp
= (long)(long_i
)options
[opt_idx
].def_val
[dvi
];
3472 /* May also set global value for local option. */
3474 *(long *)get_varp_scope(&(options
[opt_idx
]), OPT_GLOBAL
) =
3480 /* the cast to long is required for Manx C, long_i is needed for
3482 *(int *)varp
= (int)(long)(long_i
)options
[opt_idx
].def_val
[dvi
];
3484 /* 'modeline' defaults to off for root */
3485 if (options
[opt_idx
].indir
== PV_ML
&& getuid() == ROOT_UID
)
3486 *(int *)varp
= FALSE
;
3488 /* May also set global value for local option. */
3490 *(int *)get_varp_scope(&(options
[opt_idx
]), OPT_GLOBAL
) =
3494 /* The default value is not insecure. */
3495 flagsp
= insecure_flag(opt_idx
, opt_flags
);
3496 *flagsp
= *flagsp
& ~P_INSECURE
;
3500 set_option_scriptID_idx(opt_idx
, opt_flags
, current_SID
);
3505 * Set all options (except terminal options) to their default value.
3508 set_options_default(opt_flags
)
3509 int opt_flags
; /* OPT_FREE, OPT_LOCAL and/or OPT_GLOBAL */
3517 for (i
= 0; !istermoption(&options
[i
]); i
++)
3518 if (!(options
[i
].flags
& P_NODEFAULT
))
3519 set_option_default(i
, opt_flags
, p_cp
);
3522 /* The 'scroll' option must be computed for all windows. */
3523 FOR_ALL_TAB_WINDOWS(tp
, wp
)
3524 win_comp_scroll(wp
);
3526 win_comp_scroll(curwin
);
3531 * Set the Vi-default value of a string option.
3532 * Used for 'sh', 'backupskip' and 'term'.
3535 set_string_default(name
, val
)
3542 p
= vim_strsave(val
);
3543 if (p
!= NULL
) /* we don't want a NULL */
3545 opt_idx
= findoption((char_u
*)name
);
3548 if (options
[opt_idx
].flags
& P_DEF_ALLOCED
)
3549 vim_free(options
[opt_idx
].def_val
[VI_DEFAULT
]);
3550 options
[opt_idx
].def_val
[VI_DEFAULT
] = p
;
3551 options
[opt_idx
].flags
|= P_DEF_ALLOCED
;
3557 * Set the Vi-default value of a number option.
3558 * Used for 'lines' and 'columns'.
3561 set_number_default(name
, val
)
3567 opt_idx
= findoption((char_u
*)name
);
3569 options
[opt_idx
].def_val
[VI_DEFAULT
] = (char_u
*)(long_i
)val
;
3572 #if defined(EXITFREE) || defined(PROTO)
3581 for (i
= 0; !istermoption(&options
[i
]); i
++)
3583 if (options
[i
].indir
== PV_NONE
)
3585 /* global option: free value and default value. */
3586 if (options
[i
].flags
& P_ALLOCED
&& options
[i
].var
!= NULL
)
3587 free_string_option(*(char_u
**)options
[i
].var
);
3588 if (options
[i
].flags
& P_DEF_ALLOCED
)
3589 free_string_option(options
[i
].def_val
[VI_DEFAULT
]);
3591 else if (options
[i
].var
!= VAR_WIN
3592 && (options
[i
].flags
& P_STRING
))
3593 /* buffer-local option: free global value */
3594 free_string_option(*(char_u
**)options
[i
].var
);
3601 * Initialize the options, part two: After getting Rows and Columns and
3610 * 'scroll' defaults to half the window height. Note that this default is
3611 * wrong when the window height changes.
3613 set_number_default("scroll", (long)((long_u
)Rows
>> 1));
3614 idx
= findoption((char_u
*)"scroll");
3615 if (idx
>= 0 && !(options
[idx
].flags
& P_WAS_SET
))
3616 set_option_default(idx
, OPT_LOCAL
, p_cp
);
3620 * 'window' is only for backwards compatibility with Vi.
3621 * Default is Rows - 1.
3623 if (!option_was_set((char_u
*)"window"))
3624 p_window
= Rows
- 1;
3625 set_number_default("window", Rows
- 1);
3627 /* For DOS console the default is always black. */
3628 #if !((defined(MSDOS) || defined(OS2) || defined(WIN3264)) && !defined(FEAT_GUI))
3630 * If 'background' wasn't set by the user, try guessing the value,
3631 * depending on the terminal name. Only need to check for terminals
3632 * with a dark background, that can handle color.
3634 idx
= findoption((char_u
*)"bg");
3635 if (idx
>= 0 && !(options
[idx
].flags
& P_WAS_SET
)
3636 && *term_bg_default() == 'd')
3638 set_string_option_direct(NULL
, idx
, (char_u
*)"dark", OPT_FREE
, 0);
3639 /* don't mark it as set, when starting the GUI it may be
3641 options
[idx
].flags
&= ~P_WAS_SET
;
3646 parse_shape_opt(SHAPE_CURSOR
); /* set cursor shapes from 'guicursor' */
3648 #ifdef FEAT_MOUSESHAPE
3649 parse_shape_opt(SHAPE_MOUSE
); /* set mouse shapes from 'mouseshape' */
3652 (void)parse_printoptions(); /* parse 'printoptions' default value */
3657 * Return "dark" or "light" depending on the kind of terminal.
3658 * This is just guessing! Recognized are:
3659 * "linux" Linux console
3660 * "screen.linux" Linux console with screen
3661 * "cygwin" Cygwin shell
3662 * "putty" Putty program
3663 * We also check the COLORFGBG environment variable, which is set by
3664 * rxvt and derivatives. This variable contains either two or three
3665 * values separated by semicolons; we want the last value in either
3666 * case. If this value is 0-6 or 8, our background is dark.
3671 #if defined(MSDOS) || defined(OS2) || defined(WIN3264)
3672 /* DOS console nearly always black */
3673 return (char_u
*)"dark";
3677 if (STRCMP(T_NAME
, "linux") == 0
3678 || STRCMP(T_NAME
, "screen.linux") == 0
3679 || STRCMP(T_NAME
, "cygwin") == 0
3680 || STRCMP(T_NAME
, "putty") == 0
3681 || ((p
= mch_getenv((char_u
*)"COLORFGBG")) != NULL
3682 && (p
= vim_strrchr(p
, ';')) != NULL
3683 && ((p
[1] >= '0' && p
[1] <= '6') || p
[1] == '8')
3685 return (char_u
*)"dark";
3686 return (char_u
*)"light";
3691 * Initialize the options, part three: After reading the .vimrc
3696 #if defined(UNIX) || defined(OS2) || defined(WIN3264)
3698 * Set 'shellpipe' and 'shellredir', depending on the 'shell' option.
3699 * This is done after other initializations, where 'shell' might have been
3700 * set, but only if they have not been set before.
3705 #ifdef FEAT_QUICKFIX
3710 idx_srr
= findoption((char_u
*)"srr");
3714 do_srr
= !(options
[idx_srr
].flags
& P_WAS_SET
);
3715 #ifdef FEAT_QUICKFIX
3716 idx_sp
= findoption((char_u
*)"sp");
3720 do_sp
= !(options
[idx_sp
].flags
& P_WAS_SET
);
3724 * Isolate the name of the shell:
3725 * - Skip beyond any path. E.g., "/usr/bin/csh -f" -> "csh -f".
3726 * - Remove any argument. E.g., "csh -f" -> "csh".
3729 p
= vim_strnsave(p
, (int)(skiptowhite(p
) - p
));
3733 * Default for p_sp is "| tee", for p_srr is ">".
3734 * For known shells it is changed here to include stderr.
3736 if ( fnamecmp(p
, "csh") == 0
3737 || fnamecmp(p
, "tcsh") == 0
3738 # if defined(OS2) || defined(WIN3264) /* also check with .exe extension */
3739 || fnamecmp(p
, "csh.exe") == 0
3740 || fnamecmp(p
, "tcsh.exe") == 0
3744 #if defined(FEAT_QUICKFIX)
3748 p_sp
= (char_u
*)">&";
3750 p_sp
= (char_u
*)"|& tee";
3752 options
[idx_sp
].def_val
[VI_DEFAULT
] = p_sp
;
3757 p_srr
= (char_u
*)">&";
3758 options
[idx_srr
].def_val
[VI_DEFAULT
] = p_srr
;
3762 # ifndef OS2 /* Always use bourne shell style redirection if we reach this */
3763 if ( fnamecmp(p
, "sh") == 0
3764 || fnamecmp(p
, "ksh") == 0
3765 || fnamecmp(p
, "zsh") == 0
3766 || fnamecmp(p
, "zsh-beta") == 0
3767 || fnamecmp(p
, "bash") == 0
3769 || fnamecmp(p
, "cmd") == 0
3770 || fnamecmp(p
, "sh.exe") == 0
3771 || fnamecmp(p
, "ksh.exe") == 0
3772 || fnamecmp(p
, "zsh.exe") == 0
3773 || fnamecmp(p
, "zsh-beta.exe") == 0
3774 || fnamecmp(p
, "bash.exe") == 0
3775 || fnamecmp(p
, "cmd.exe") == 0
3780 #if defined(FEAT_QUICKFIX)
3784 p_sp
= (char_u
*)">%s 2>&1";
3786 p_sp
= (char_u
*)"2>&1| tee";
3788 options
[idx_sp
].def_val
[VI_DEFAULT
] = p_sp
;
3793 p_srr
= (char_u
*)">%s 2>&1";
3794 options
[idx_srr
].def_val
[VI_DEFAULT
] = p_srr
;
3801 #if defined(MSDOS) || defined(WIN3264) || defined(OS2)
3803 * Set 'shellcmdflag and 'shellquote' depending on the 'shell' option.
3804 * This is done after other initializations, where 'shell' might have been
3805 * set, but only if they have not been set before. Default for p_shcf is
3806 * "/c", for p_shq is "". For "sh" like shells it is changed here to
3807 * "-c" and "\"", but not for DJGPP, because it starts the shell without
3808 * command.com. And for Win32 we need to set p_sxq instead.
3810 if (strstr((char *)gettail(p_sh
), "sh") != NULL
)
3814 idx3
= findoption((char_u
*)"shcf");
3815 if (idx3
>= 0 && !(options
[idx3
].flags
& P_WAS_SET
))
3817 p_shcf
= (char_u
*)"-c";
3818 options
[idx3
].def_val
[VI_DEFAULT
] = p_shcf
;
3823 /* Somehow Win32 requires the quotes around the redirection too */
3824 idx3
= findoption((char_u
*)"sxq");
3825 if (idx3
>= 0 && !(options
[idx3
].flags
& P_WAS_SET
))
3827 p_sxq
= (char_u
*)"\"";
3828 options
[idx3
].def_val
[VI_DEFAULT
] = p_sxq
;
3831 idx3
= findoption((char_u
*)"shq");
3832 if (idx3
>= 0 && !(options
[idx3
].flags
& P_WAS_SET
))
3834 p_shq
= (char_u
*)"\"";
3835 options
[idx3
].def_val
[VI_DEFAULT
] = p_shq
;
3843 set_title_defaults();
3847 #if defined(FEAT_MULTI_LANG) || defined(PROTO)
3849 * When 'helplang' is still at its default value, set it to "lang".
3850 * Only the first two characters of "lang" are used.
3853 set_helplang_default(lang
)
3858 if (lang
== NULL
|| STRLEN(lang
) < 2) /* safety check */
3860 idx
= findoption((char_u
*)"hlg");
3861 if (idx
>= 0 && !(options
[idx
].flags
& P_WAS_SET
))
3863 if (options
[idx
].flags
& P_ALLOCED
)
3864 free_string_option(p_hlg
);
3865 p_hlg
= vim_strsave(lang
);
3867 p_hlg
= empty_option
;
3870 /* zh_CN becomes "cn", zh_TW becomes "tw". */
3871 if (STRNICMP(p_hlg
, "zh_", 3) == 0 && STRLEN(p_hlg
) >= 5)
3873 p_hlg
[0] = TOLOWER_ASC(p_hlg
[3]);
3874 p_hlg
[1] = TOLOWER_ASC(p_hlg
[4]);
3878 options
[idx
].flags
|= P_ALLOCED
;
3884 static char_u
*gui_bg_default
__ARGS((void));
3889 if (gui_get_lightness(gui
.back_pixel
) < 127)
3890 return (char_u
*)"dark";
3891 return (char_u
*)"light";
3895 * Option initializations that can only be done after opening the GUI window.
3900 /* Set the 'background' option according to the lightness of the
3901 * background color, unless the user has set it already. */
3902 if (!option_was_set((char_u
*)"bg") && STRCMP(p_bg
, gui_bg_default()) != 0)
3904 set_option_value((char_u
*)"bg", 0L, gui_bg_default(), 0);
3905 highlight_changed();
3912 * 'title' and 'icon' only default to true if they have not been set or reset
3913 * in .vimrc and we can read the old value.
3914 * When 'title' and 'icon' have been reset in .vimrc, we won't even check if
3915 * they can be reset. This reduces startup time when using X on a remote
3919 set_title_defaults()
3925 * If GUI is (going to be) used, we can always set the window title and
3926 * icon name. Saves a bit of time, because the X11 display server does
3927 * not need to be contacted.
3929 idx1
= findoption((char_u
*)"title");
3930 if (idx1
>= 0 && !(options
[idx1
].flags
& P_WAS_SET
))
3933 if (gui
.starting
|| gui
.in_use
)
3937 val
= mch_can_restore_title();
3938 options
[idx1
].def_val
[VI_DEFAULT
] = (char_u
*)(long_i
)val
;
3941 idx1
= findoption((char_u
*)"icon");
3942 if (idx1
>= 0 && !(options
[idx1
].flags
& P_WAS_SET
))
3945 if (gui
.starting
|| gui
.in_use
)
3949 val
= mch_can_restore_icon();
3950 options
[idx1
].def_val
[VI_DEFAULT
] = (char_u
*)(long_i
)val
;
3957 * Parse 'arg' for option settings.
3959 * 'arg' may be IObuff, but only when no errors can be present and option
3960 * does not need to be expanded with option_expand().
3963 * OPT_GLOBAL for ":setglobal"
3964 * OPT_LOCAL for ":setlocal" and a modeline
3965 * OPT_MODELINE for a modeline
3966 * OPT_WINONLY to only set window-local options
3967 * OPT_NOWIN to skip setting window-local options
3969 * returns FAIL if an error is detected, OK otherwise
3972 do_set(arg
, opt_flags
)
3973 char_u
*arg
; /* option string (may be written to!) */
3980 int prefix
; /* 1: nothing, 0: "no", 2: "inv" in front of name */
3981 int nextchar
; /* next non-white char after option name */
3982 int afterchar
; /* character just after option name */
3987 long_u flags
; /* flags for current option */
3988 char_u
*varp
= NULL
; /* pointer to variable for current option */
3989 int did_show
= FALSE
; /* already showed one value */
3990 int adding
; /* "opt+=arg" */
3991 int prepending
; /* "opt^=arg" */
3992 int removing
; /* "opt-=arg" */
3998 showoptions(0, opt_flags
);
4003 while (*arg
!= NUL
) /* loop to process all options */
4006 startarg
= arg
; /* remember for error message */
4008 if (STRNCMP(arg
, "all", 3) == 0 && !isalpha(arg
[3])
4009 && !(opt_flags
& OPT_MODELINE
))
4012 * ":set all" show all options.
4013 * ":set all&" set all options to their default value.
4019 /* Only for :set command set global value of local options. */
4020 set_options_default(OPT_FREE
| opt_flags
);
4024 showoptions(1, opt_flags
);
4028 else if (STRNCMP(arg
, "termcap", 7) == 0 && !(opt_flags
& OPT_MODELINE
))
4030 showoptions(2, opt_flags
);
4038 if (STRNCMP(arg
, "no", 2) == 0 && STRNCMP(arg
, "novice", 6) != 0)
4043 else if (STRNCMP(arg
, "inv", 3) == 0)
4049 /* find end of name */
4055 /* look out for <t_>;> */
4056 if (arg
[1] == 't' && arg
[2] == '_' && arg
[3] && arg
[4])
4061 while (arg
[len
] != NUL
&& arg
[len
] != '>')
4064 if (arg
[len
] != '>')
4069 arg
[len
] = NUL
; /* put NUL after name */
4070 if (arg
[1] == 't' && arg
[2] == '_') /* could be term code */
4071 opt_idx
= findoption(arg
+ 1);
4072 arg
[len
++] = '>'; /* restore '>' */
4074 key
= find_key_option(arg
+ 1);
4080 * The two characters after "t_" may not be alphanumeric.
4082 if (arg
[0] == 't' && arg
[1] == '_' && arg
[2] && arg
[3])
4085 while (ASCII_ISALNUM(arg
[len
]) || arg
[len
] == '_')
4087 nextchar
= arg
[len
];
4088 arg
[len
] = NUL
; /* put NUL after name */
4089 opt_idx
= findoption(arg
);
4090 arg
[len
] = nextchar
; /* restore nextchar */
4092 key
= find_key_option(arg
);
4095 /* remember character after option name */
4096 afterchar
= arg
[len
];
4098 /* skip white space, allow ":set ai ?" */
4099 while (vim_iswhite(arg
[len
]))
4105 if (arg
[len
] != NUL
&& arg
[len
+ 1] == '=')
4107 if (arg
[len
] == '+')
4109 adding
= TRUE
; /* "+=" */
4112 else if (arg
[len
] == '^')
4114 prepending
= TRUE
; /* "^=" */
4117 else if (arg
[len
] == '-')
4119 removing
= TRUE
; /* "-=" */
4123 nextchar
= arg
[len
];
4125 if (opt_idx
== -1 && key
== 0) /* found a mismatch: skip */
4127 errmsg
= (char_u
*)N_("E518: Unknown option");
4133 if (options
[opt_idx
].var
== NULL
) /* hidden option: skip */
4135 /* Only give an error message when requesting the value of
4136 * a hidden option, ignore setting it. */
4137 if (vim_strchr((char_u
*)"=:!&<", nextchar
) == NULL
4138 && (!(options
[opt_idx
].flags
& P_BOOL
)
4139 || nextchar
== '?'))
4140 errmsg
= (char_u
*)N_("E519: Option not supported");
4144 flags
= options
[opt_idx
].flags
;
4145 varp
= get_varp_scope(&(options
[opt_idx
]), opt_flags
);
4152 key_name
[0] = KEY2TERMCAP0(key
);
4153 key_name
[1] = KEY2TERMCAP1(key
);
4157 key_name
[0] = KS_KEY
;
4158 key_name
[1] = (key
& 0xff);
4162 /* Skip all options that are not window-local (used when showing
4163 * an already loaded buffer in a window). */
4164 if ((opt_flags
& OPT_WINONLY
)
4165 && (opt_idx
< 0 || options
[opt_idx
].var
!= VAR_WIN
))
4168 /* Skip all options that are window-local (used for :vimgrep). */
4169 if ((opt_flags
& OPT_NOWIN
) && opt_idx
>= 0
4170 && options
[opt_idx
].var
== VAR_WIN
)
4173 /* Disallow changing some options from modelines. */
4174 if (opt_flags
& OPT_MODELINE
)
4176 if (flags
& P_SECURE
)
4178 errmsg
= (char_u
*)_("E520: Not allowed in a modeline");
4182 /* In diff mode some options are overruled. This avoids that
4183 * 'foldmethod' becomes "marker" instead of "diff" and that
4184 * "wrap" gets set. */
4185 if (curwin
->w_p_diff
4186 && (options
[opt_idx
].indir
== PV_FDM
4187 || options
[opt_idx
].indir
== PV_WRAP
))
4193 /* Disallow changing some options in the sandbox */
4194 if (sandbox
!= 0 && (flags
& P_SECURE
))
4196 errmsg
= (char_u
*)_(e_sandbox
);
4201 if (vim_strchr((char_u
*)"?=:!&<", nextchar
) != NULL
)
4205 if (nextchar
== '&' && arg
[1] == 'v' && arg
[2] == 'i')
4207 if (arg
[3] == 'm') /* "opt&vim": set to Vim default */
4212 else /* "opt&vi": set to Vi default */
4218 if (vim_strchr((char_u
*)"?!&<", nextchar
) != NULL
4219 && arg
[1] != NUL
&& !vim_iswhite(arg
[1]))
4221 errmsg
= e_trailing
;
4227 * allow '=' and ':' as MSDOS command.com allows only one
4228 * '=' character per "set" command line. grrr. (jw)
4232 && vim_strchr((char_u
*)"=:&<", nextchar
) == NULL
4233 && !(flags
& P_BOOL
)))
4239 msg_putchar('\n'); /* cursor below last one */
4242 gotocmdline(TRUE
); /* cursor at status line */
4243 did_show
= TRUE
; /* remember that we did a line */
4247 showoneopt(&options
[opt_idx
], opt_flags
);
4251 /* Mention where the option was last set. */
4252 if (varp
== options
[opt_idx
].var
)
4253 last_set_msg(options
[opt_idx
].scriptID
);
4254 else if ((int)options
[opt_idx
].indir
& PV_WIN
)
4255 last_set_msg(curwin
->w_p_scriptID
[
4256 (int)options
[opt_idx
].indir
& PV_MASK
]);
4257 else if ((int)options
[opt_idx
].indir
& PV_BUF
)
4258 last_set_msg(curbuf
->b_p_scriptID
[
4259 (int)options
[opt_idx
].indir
& PV_MASK
]);
4267 p
= find_termcode(key_name
);
4270 errmsg
= (char_u
*)N_("E518: Unknown option");
4274 (void)show_one_termcode(key_name
, p
, TRUE
);
4277 && nextchar
!= NUL
&& !vim_iswhite(afterchar
))
4278 errmsg
= e_trailing
;
4282 if (flags
& P_BOOL
) /* boolean */
4284 if (nextchar
== '=' || nextchar
== ':')
4291 * ":set opt!": invert
4292 * ":set opt&": reset to default value
4293 * ":set opt<": reset to global value
4295 if (nextchar
== '!')
4296 value
= *(int *)(varp
) ^ 1;
4297 else if (nextchar
== '&')
4298 value
= (int)(long)(long_i
)options
[opt_idx
].def_val
[
4299 ((flags
& P_VI_DEF
) || cp_val
)
4300 ? VI_DEFAULT
: VIM_DEFAULT
];
4301 else if (nextchar
== '<')
4303 /* For 'autoread' -1 means to use global value. */
4304 if ((int *)varp
== &curbuf
->b_p_ar
4305 && opt_flags
== OPT_LOCAL
)
4308 value
= *(int *)get_varp_scope(&(options
[opt_idx
]),
4314 * ":set invopt": invert
4315 * ":set opt" or ":set noopt": set or reset
4317 if (nextchar
!= NUL
&& !vim_iswhite(afterchar
))
4319 errmsg
= e_trailing
;
4322 if (prefix
== 2) /* inv */
4323 value
= *(int *)(varp
) ^ 1;
4328 errmsg
= set_bool_option(opt_idx
, varp
, (int)value
,
4331 else /* numeric or string */
4333 if (vim_strchr((char_u
*)"=:&<", nextchar
) == NULL
4340 if (flags
& P_NUM
) /* numeric */
4343 * Different ways to set a number option:
4344 * & set to default value
4345 * < set to global value
4346 * <xx> accept special key codes for 'wildchar'
4347 * c accept any non-digit for 'wildchar'
4352 if (nextchar
== '&')
4353 value
= (long)(long_i
)options
[opt_idx
].def_val
[
4354 ((flags
& P_VI_DEF
) || cp_val
)
4355 ? VI_DEFAULT
: VIM_DEFAULT
];
4356 else if (nextchar
== '<')
4357 value
= *(long *)get_varp_scope(&(options
[opt_idx
]),
4359 else if (((long *)varp
== &p_wc
4360 || (long *)varp
== &p_wcm
)
4363 || ((!arg
[1] || vim_iswhite(arg
[1]))
4364 && !VIM_ISDIGIT(*arg
))))
4366 value
= string_to_key(arg
);
4367 if (value
== 0 && (long *)varp
!= &p_wcm
)
4373 /* allow negative numbers (for 'undolevels') */
4374 else if (*arg
== '-' || VIM_ISDIGIT(*arg
))
4380 value
= strtol((char *)arg
, NULL
, 0);
4381 if (arg
[i
] == '0' && TOLOWER_ASC(arg
[i
+ 1]) == 'x')
4384 value
= atol((char *)arg
);
4386 while (VIM_ISDIGIT(arg
[i
]))
4388 if (arg
[i
] != NUL
&& !vim_iswhite(arg
[i
]))
4396 errmsg
= (char_u
*)N_("E521: Number required after =");
4401 value
= *(long *)varp
+ value
;
4403 value
= *(long *)varp
* value
;
4405 value
= *(long *)varp
- value
;
4406 errmsg
= set_num_option(opt_idx
, varp
, value
,
4407 errbuf
, sizeof(errbuf
), opt_flags
);
4409 else if (opt_idx
>= 0) /* string */
4411 char_u
*save_arg
= NULL
;
4413 char_u
*oldval
; /* previous value if *varp */
4419 int new_value_alloced
; /* new string option
4422 /* When using ":set opt=val" for a global option
4423 * with a local value the local value will be
4424 * reset, use the global value here. */
4425 if ((opt_flags
& (OPT_LOCAL
| OPT_GLOBAL
)) == 0
4426 && ((int)options
[opt_idx
].indir
& PV_BOTH
))
4427 varp
= options
[opt_idx
].var
;
4429 /* The old value is kept until we are sure that the
4430 * new value is valid. */
4431 oldval
= *(char_u
**)varp
;
4432 if (nextchar
== '&') /* set to default val */
4434 newval
= options
[opt_idx
].def_val
[
4435 ((flags
& P_VI_DEF
) || cp_val
)
4436 ? VI_DEFAULT
: VIM_DEFAULT
];
4437 if ((char_u
**)varp
== &p_bg
)
4439 /* guess the value of 'background' */
4442 newval
= gui_bg_default();
4445 newval
= term_bg_default();
4448 /* expand environment variables and ~ (since the
4449 * default value was already expanded, only
4450 * required when an environment variable was set
4453 newval
= empty_option
;
4456 s
= option_expand(opt_idx
, newval
);
4459 newval
= vim_strsave(s
);
4461 new_value_alloced
= TRUE
;
4463 else if (nextchar
== '<') /* set to global val */
4465 newval
= vim_strsave(*(char_u
**)get_varp_scope(
4466 &(options
[opt_idx
]), OPT_GLOBAL
));
4467 new_value_alloced
= TRUE
;
4471 ++arg
; /* jump to after the '=' or ':' */
4474 * Set 'keywordprg' to ":help" if an empty
4475 * value was passed to :set by the user.
4476 * Misuse errbuf[] for the resulting string.
4478 if (varp
== (char_u
*)&p_kp
4479 && (*arg
== NUL
|| *arg
== ' '))
4481 STRCPY(errbuf
, ":help");
4486 * Convert 'whichwrap' number to string, for
4487 * backwards compatibility with Vim 3.0.
4488 * Misuse errbuf[] for the resulting string.
4490 else if (varp
== (char_u
*)&p_ww
4491 && VIM_ISDIGIT(*arg
))
4494 i
= getdigits(&arg
);
4496 STRCAT(errbuf
, "b,");
4498 STRCAT(errbuf
, "s,");
4500 STRCAT(errbuf
, "h,l,");
4502 STRCAT(errbuf
, "<,>,");
4504 STRCAT(errbuf
, "[,],");
4505 if (*errbuf
!= NUL
) /* remove trailing , */
4506 errbuf
[STRLEN(errbuf
) - 1] = NUL
;
4511 * Remove '>' before 'dir' and 'bdir', for
4512 * backwards compatibility with version 3.0
4514 else if ( *arg
== '>'
4515 && (varp
== (char_u
*)&p_dir
4516 || varp
== (char_u
*)&p_bdir
))
4521 /* When setting the local value of a global
4522 * option, the old value may be the global value. */
4523 if (((int)options
[opt_idx
].indir
& PV_BOTH
)
4524 && (opt_flags
& OPT_LOCAL
))
4525 origval
= *(char_u
**)get_varp(
4531 * Copy the new string into allocated memory.
4532 * Can't use set_string_option_direct(), because
4533 * we need to remove the backslashes.
4535 /* get a bit too much */
4536 newlen
= (unsigned)STRLEN(arg
) + 1;
4537 if (adding
|| prepending
|| removing
)
4538 newlen
+= (unsigned)STRLEN(origval
) + 1;
4539 newval
= alloc(newlen
);
4540 if (newval
== NULL
) /* out of mem, don't change */
4545 * Copy the string, skip over escaped chars.
4546 * For MS-DOS and WIN32 backslashes before normal
4547 * file name characters are not removed, and keep
4548 * backslash at start, for "\\machine\path", but
4549 * do remove it for "\\\\machine\\path".
4550 * The reverse is found in ExpandOldSetting().
4552 while (*arg
&& !vim_iswhite(*arg
))
4554 if (*arg
== '\\' && arg
[1] != NUL
4555 #ifdef BACKSLASH_IN_FILENAME
4556 && !((flags
& P_EXPAND
)
4557 && vim_isfilec(arg
[1])
4560 && arg
[2] != '\\')))
4563 ++arg
; /* remove backslash */
4566 && (i
= (*mb_ptr2len
)(arg
)) > 1)
4568 /* copy multibyte char */
4569 mch_memmove(s
, arg
, (size_t)i
);
4580 * Expand environment variables and ~.
4581 * Don't do it when adding without inserting a
4584 if (!(adding
|| prepending
|| removing
)
4585 || (flags
& P_COMMA
))
4587 s
= option_expand(opt_idx
, newval
);
4591 newlen
= (unsigned)STRLEN(s
) + 1;
4592 if (adding
|| prepending
|| removing
)
4593 newlen
+= (unsigned)STRLEN(origval
) + 1;
4594 newval
= alloc(newlen
);
4601 /* locate newval[] in origval[] when removing it
4602 * and when adding to avoid duplicates */
4603 i
= 0; /* init for GCC */
4604 if (removing
|| (flags
& P_NODUP
))
4606 i
= (int)STRLEN(newval
);
4608 for (s
= origval
; *s
; ++s
)
4610 if ((!(flags
& P_COMMA
)
4612 || (s
[-1] == ',' && !(bs
& 1)))
4613 && STRNCMP(s
, newval
, i
) == 0
4614 && (!(flags
& P_COMMA
)
4618 /* Count backspaces. Only a comma with an
4619 * even number of backspaces before it is
4620 * recognized as a separator */
4621 if (s
> origval
&& s
[-1] == '\\')
4627 /* do not add if already there */
4628 if ((adding
|| prepending
) && *s
)
4632 STRCPY(newval
, origval
);
4636 /* concatenate the two strings; add a ',' if
4638 if (adding
|| prepending
)
4640 comma
= ((flags
& P_COMMA
) && *origval
!= NUL
4644 i
= (int)STRLEN(origval
);
4645 mch_memmove(newval
+ i
+ comma
, newval
,
4646 STRLEN(newval
) + 1);
4647 mch_memmove(newval
, origval
, (size_t)i
);
4651 i
= (int)STRLEN(newval
);
4652 STRMOVE(newval
+ i
+ comma
, origval
);
4658 /* Remove newval[] from origval[]. (Note: "i" has
4659 * been set above and is used here). */
4662 STRCPY(newval
, origval
);
4665 /* may need to remove a comma */
4666 if (flags
& P_COMMA
)
4670 /* include comma after string */
4676 /* include comma before string */
4681 STRMOVE(newval
+ (s
- origval
), s
+ i
);
4685 if (flags
& P_FLAGLIST
)
4687 /* Remove flags that appear twice. */
4688 for (s
= newval
; *s
; ++s
)
4689 if ((!(flags
& P_COMMA
) || *s
!= ',')
4690 && vim_strchr(s
+ 1, *s
) != NULL
)
4697 if (save_arg
!= NULL
) /* number for 'whichwrap' */
4699 new_value_alloced
= TRUE
;
4702 /* Set the new value. */
4703 *(char_u
**)(varp
) = newval
;
4705 /* Handle side effects, and set the global value for
4706 * ":set" on local options. */
4707 errmsg
= did_set_string_option(opt_idx
, (char_u
**)varp
,
4708 new_value_alloced
, oldval
, errbuf
, opt_flags
);
4710 /* If error detected, print the error message. */
4714 else /* key code option */
4718 if (nextchar
== '&')
4720 if (add_termcap_entry(key_name
, TRUE
) == FAIL
)
4721 errmsg
= (char_u
*)N_("E522: Not found in termcap");
4725 ++arg
; /* jump to after the '=' or ':' */
4726 for (p
= arg
; *p
&& !vim_iswhite(*p
); ++p
)
4727 if (*p
== '\\' && p
[1] != NUL
)
4731 add_termcode(key_name
, arg
, FALSE
);
4736 redraw_all_later(CLEAR
);
4741 did_set_option(opt_idx
, opt_flags
,
4742 !prepending
&& !adding
&& !removing
);
4747 * Advance to next argument.
4748 * - skip until a blank found, taking care of backslashes
4750 * - skip one "=val" argument (for hidden options ":set gfn =xx")
4752 for (i
= 0; i
< 2 ; ++i
)
4754 while (*arg
!= NUL
&& !vim_iswhite(*arg
))
4755 if (*arg
++ == '\\' && *arg
!= NUL
)
4757 arg
= skipwhite(arg
);
4765 vim_strncpy(IObuff
, (char_u
*)_(errmsg
), IOSIZE
- 1);
4766 i
= (int)STRLEN(IObuff
) + 2;
4767 if (i
+ (arg
- startarg
) < IOSIZE
)
4769 /* append the argument with the error */
4770 STRCAT(IObuff
, ": ");
4771 mch_memmove(IObuff
+ i
, startarg
, (arg
- startarg
));
4772 IObuff
[i
+ (arg
- startarg
)] = NUL
;
4774 /* make sure all characters are printable */
4775 trans_characters(IObuff
, IOSIZE
);
4777 ++no_wait_return
; /* wait_return done later */
4778 emsg(IObuff
); /* show error highlighted */
4784 arg
= skipwhite(arg
);
4788 if (silent_mode
&& did_show
)
4790 /* After displaying option values in silent mode. */
4791 silent_mode
= FALSE
;
4792 info_message
= TRUE
; /* use mch_msg(), not mch_errmsg() */
4794 cursor_on(); /* msg_start() switches it off */
4797 info_message
= FALSE
; /* use mch_msg(), not mch_errmsg() */
4804 * Call this when an option has been given a new value through a user command.
4805 * Sets the P_WAS_SET flag and takes care of the P_INSECURE flag.
4808 did_set_option(opt_idx
, opt_flags
, new_value
)
4810 int opt_flags
; /* possibly with OPT_MODELINE */
4811 int new_value
; /* value was replaced completely */
4815 options
[opt_idx
].flags
|= P_WAS_SET
;
4817 /* When an option is set in the sandbox, from a modeline or in secure mode
4818 * set the P_INSECURE flag. Otherwise, if a new value is stored reset the
4820 p
= insecure_flag(opt_idx
, opt_flags
);
4825 || (opt_flags
& OPT_MODELINE
))
4826 *p
= *p
| P_INSECURE
;
4828 *p
= *p
& ~P_INSECURE
;
4832 illegal_char(errbuf
, c
)
4837 return (char_u
*)"";
4838 sprintf((char *)errbuf
, _("E539: Illegal character <%s>"),
4839 (char *)transchar(c
));
4844 * Convert a key name or string into a key value.
4845 * Used for 'wildchar' and 'cedit' options.
4852 return find_key_option(arg
+ 1);
4854 return Ctrl_chr(arg
[1]);
4860 * Check value of 'cedit' and set cedit_key.
4861 * Returns NULL if value is OK, error message otherwise.
4868 if (*p_cedit
== NUL
)
4872 n
= string_to_key(p_cedit
);
4873 if (vim_isprintc(n
))
4883 * When changing 'title', 'titlestring', 'icon' or 'iconstring', call
4884 * maketitle() to create and display it.
4885 * When switching the title or icon off, call mch_restore_title() to get
4886 * the old value back.
4890 int icon
; /* Did set icon instead of title */
4892 if (starting
!= NO_SCREEN
4902 mch_restore_title(2);
4907 mch_restore_title(1);
4914 * set_options_bin - called when 'bin' changes value.
4917 set_options_bin(oldval
, newval
, opt_flags
)
4920 int opt_flags
; /* OPT_LOCAL and/or OPT_GLOBAL */
4923 * The option values that are changed when 'bin' changes are
4924 * copied when 'bin is set and restored when 'bin' is reset.
4928 if (!oldval
) /* switched on */
4930 if (!(opt_flags
& OPT_GLOBAL
))
4932 curbuf
->b_p_tw_nobin
= curbuf
->b_p_tw
;
4933 curbuf
->b_p_wm_nobin
= curbuf
->b_p_wm
;
4934 curbuf
->b_p_ml_nobin
= curbuf
->b_p_ml
;
4935 curbuf
->b_p_et_nobin
= curbuf
->b_p_et
;
4937 if (!(opt_flags
& OPT_LOCAL
))
4946 if (!(opt_flags
& OPT_GLOBAL
))
4948 curbuf
->b_p_tw
= 0; /* no automatic line wrap */
4949 curbuf
->b_p_wm
= 0; /* no automatic line wrap */
4950 curbuf
->b_p_ml
= 0; /* no modelines */
4951 curbuf
->b_p_et
= 0; /* no expandtab */
4953 if (!(opt_flags
& OPT_LOCAL
))
4959 p_bin
= TRUE
; /* needed when called for the "-b" argument */
4962 else if (oldval
) /* switched off */
4964 if (!(opt_flags
& OPT_GLOBAL
))
4966 curbuf
->b_p_tw
= curbuf
->b_p_tw_nobin
;
4967 curbuf
->b_p_wm
= curbuf
->b_p_wm_nobin
;
4968 curbuf
->b_p_ml
= curbuf
->b_p_ml_nobin
;
4969 curbuf
->b_p_et
= curbuf
->b_p_et_nobin
;
4971 if (!(opt_flags
& OPT_LOCAL
))
4983 * Find the parameter represented by the given character (eg ', :, ", or /),
4984 * and return its associated value in the 'viminfo' string.
4985 * Only works for number parameters, not for 'r' or 'n'.
4986 * If the parameter is not specified in the string or there is no following
4987 * number, return -1.
4990 get_viminfo_parameter(type
)
4995 p
= find_viminfo_parameter(type
);
4996 if (p
!= NULL
&& VIM_ISDIGIT(*p
))
4997 return atoi((char *)p
);
5002 * Find the parameter represented by the given character (eg ''', ':', '"', or
5003 * '/') in the 'viminfo' option and return a pointer to the string after it.
5004 * Return NULL if the parameter is not specified in the string.
5007 find_viminfo_parameter(type
)
5012 for (p
= p_viminfo
; *p
; ++p
)
5016 if (*p
== 'n') /* 'n' is always the last one */
5018 p
= vim_strchr(p
, ','); /* skip until next ',' */
5019 if (p
== NULL
) /* hit the end without finding parameter */
5027 * Expand environment variables for some string options.
5028 * These string options cannot be indirect!
5029 * If "val" is NULL expand the current value of the option.
5030 * Return pointer to NameBuff, or NULL when not expanded.
5033 option_expand(opt_idx
, val
)
5037 /* if option doesn't need expansion nothing to do */
5038 if (!(options
[opt_idx
].flags
& P_EXPAND
) || options
[opt_idx
].var
== NULL
)
5041 /* If val is longer than MAXPATHL no meaningful expansion can be done,
5042 * expand_env() would truncate the string. */
5043 if (val
!= NULL
&& STRLEN(val
) > MAXPATHL
)
5047 val
= *(char_u
**)options
[opt_idx
].var
;
5050 * Expanding this with NameBuff, expand_env() must not be passed IObuff.
5051 * Escape spaces when expanding 'tags', they are used to separate file
5053 * For 'spellsuggest' expand after "file:".
5055 expand_env_esc(val
, NameBuff
, MAXPATHL
,
5056 (char_u
**)options
[opt_idx
].var
== &p_tags
, FALSE
,
5058 (char_u
**)options
[opt_idx
].var
== &p_sps
? (char_u
*)"file:" :
5061 if (STRCMP(NameBuff
, val
) == 0) /* they are the same */
5068 * After setting various option values: recompute variables that depend on
5074 /* initialize the table for 'iskeyword' et.al. */
5075 (void)init_chartab();
5078 (void)opt_strings_flags(p_cmp
, p_cmp_values
, &cmp_flags
, TRUE
);
5080 (void)opt_strings_flags(p_bkc
, p_bkc_values
, &bkc_flags
, TRUE
);
5082 (void)opt_strings_flags(p_ssop
, p_ssop_values
, &ssop_flags
, TRUE
);
5083 (void)opt_strings_flags(p_vop
, p_ssop_values
, &vop_flags
, TRUE
);
5086 (void)opt_strings_flags(p_fdo
, p_fdo_values
, &fdo_flags
, TRUE
);
5088 (void)opt_strings_flags(p_dy
, p_dy_values
, &dy_flags
, TRUE
);
5089 #ifdef FEAT_VIRTUALEDIT
5090 (void)opt_strings_flags(p_ve
, p_ve_values
, &ve_flags
, TRUE
);
5092 #if defined(FEAT_MOUSE) && (defined(UNIX) || defined(VMS))
5093 (void)opt_strings_flags(p_ttym
, p_ttym_values
, &ttym_flags
, FALSE
);
5096 (void)spell_check_msm();
5097 (void)spell_check_sps();
5098 (void)compile_cap_prog(curbuf
);
5100 #if defined(FEAT_TOOLBAR) && !defined(FEAT_GUI_W32)
5101 (void)opt_strings_flags(p_toolbar
, p_toolbar_values
, &toolbar_flags
, TRUE
);
5103 #if defined(FEAT_TOOLBAR) && defined(FEAT_GUI_GTK) && defined(HAVE_GTK2)
5104 (void)opt_strings_flags(p_tbis
, p_tbis_values
, &tbis_flags
, FALSE
);
5108 (void)check_cedit();
5113 * Check for string options that are NULL (normally only termcap options).
5120 for (opt_idx
= 0; options
[opt_idx
].fullname
!= NULL
; opt_idx
++)
5121 if ((options
[opt_idx
].flags
& P_STRING
) && options
[opt_idx
].var
!= NULL
)
5122 check_string_option((char_u
**)get_varp(&(options
[opt_idx
])));
5126 * Check string options in a buffer for NULL value.
5129 check_buf_options(buf
)
5132 #if defined(FEAT_QUICKFIX)
5133 check_string_option(&buf
->b_p_bh
);
5134 check_string_option(&buf
->b_p_bt
);
5137 check_string_option(&buf
->b_p_fenc
);
5139 check_string_option(&buf
->b_p_ff
);
5141 check_string_option(&buf
->b_p_def
);
5142 check_string_option(&buf
->b_p_inc
);
5144 check_string_option(&buf
->b_p_inex
);
5147 #if defined(FEAT_CINDENT) && defined(FEAT_EVAL)
5148 check_string_option(&buf
->b_p_inde
);
5149 check_string_option(&buf
->b_p_indk
);
5151 #if defined(FEAT_BEVAL) && defined(FEAT_EVAL)
5152 check_string_option(&buf
->b_p_bexpr
);
5154 #if defined(FEAT_EVAL)
5155 check_string_option(&buf
->b_p_fex
);
5158 check_string_option(&buf
->b_p_key
);
5160 check_string_option(&buf
->b_p_kp
);
5161 check_string_option(&buf
->b_p_mps
);
5162 check_string_option(&buf
->b_p_fo
);
5163 check_string_option(&buf
->b_p_flp
);
5164 check_string_option(&buf
->b_p_isk
);
5165 #ifdef FEAT_COMMENTS
5166 check_string_option(&buf
->b_p_com
);
5169 check_string_option(&buf
->b_p_cms
);
5171 check_string_option(&buf
->b_p_nf
);
5173 check_string_option(&buf
->b_p_qe
);
5176 check_string_option(&buf
->b_p_syn
);
5179 check_string_option(&buf
->b_p_spc
);
5180 check_string_option(&buf
->b_p_spf
);
5181 check_string_option(&buf
->b_p_spl
);
5183 #ifdef FEAT_SEARCHPATH
5184 check_string_option(&buf
->b_p_sua
);
5187 check_string_option(&buf
->b_p_cink
);
5188 check_string_option(&buf
->b_p_cino
);
5191 check_string_option(&buf
->b_p_ft
);
5193 #ifdef FEAT_OSFILETYPE
5194 check_string_option(&buf
->b_p_oft
);
5196 #if defined(FEAT_SMARTINDENT) || defined(FEAT_CINDENT)
5197 check_string_option(&buf
->b_p_cinw
);
5199 #ifdef FEAT_INS_EXPAND
5200 check_string_option(&buf
->b_p_cpt
);
5202 #ifdef FEAT_COMPL_FUNC
5203 check_string_option(&buf
->b_p_cfu
);
5204 check_string_option(&buf
->b_p_ofu
);
5207 check_string_option(&buf
->b_p_keymap
);
5209 #ifdef FEAT_QUICKFIX
5210 check_string_option(&buf
->b_p_gp
);
5211 check_string_option(&buf
->b_p_mp
);
5212 check_string_option(&buf
->b_p_efm
);
5214 check_string_option(&buf
->b_p_ep
);
5215 check_string_option(&buf
->b_p_path
);
5216 check_string_option(&buf
->b_p_tags
);
5217 #ifdef FEAT_INS_EXPAND
5218 check_string_option(&buf
->b_p_dict
);
5219 check_string_option(&buf
->b_p_tsr
);
5224 * Free the string allocated for an option.
5225 * Checks for the string being empty_option. This may happen if we're out of
5226 * memory, vim_strsave() returned NULL, which was replaced by empty_option by
5228 * Does NOT check for P_ALLOCED flag!
5231 free_string_option(p
)
5234 if (p
!= empty_option
)
5239 clear_string_option(pp
)
5242 if (*pp
!= empty_option
)
5248 check_string_option(pp
)
5256 * Mark a terminal option as allocated, found by a pointer into term_strings[].
5259 set_term_option_alloced(p
)
5264 for (opt_idx
= 1; options
[opt_idx
].fullname
!= NULL
; opt_idx
++)
5265 if (options
[opt_idx
].var
== (char_u
*)p
)
5267 options
[opt_idx
].flags
|= P_ALLOCED
;
5270 return; /* cannot happen: didn't find it! */
5273 #if defined(FEAT_EVAL) || defined(PROTO)
5275 * Return TRUE when option "opt" was set from a modeline or in secure mode.
5276 * Return FALSE when it wasn't.
5277 * Return -1 for an unknown option.
5280 was_set_insecurely(opt
, opt_flags
)
5284 int idx
= findoption(opt
);
5289 flagp
= insecure_flag(idx
, opt_flags
);
5290 return (*flagp
& P_INSECURE
) != 0;
5292 EMSG2(_(e_intern2
), "was_set_insecurely()");
5297 * Get a pointer to the flags used for the P_INSECURE flag of option
5298 * "opt_idx". For some local options a local flags field is used.
5301 insecure_flag(opt_idx
, opt_flags
)
5305 if (opt_flags
& OPT_LOCAL
)
5306 switch ((int)options
[opt_idx
].indir
)
5309 case PV_STL
: return &curwin
->w_p_stl_flags
;
5312 # ifdef FEAT_FOLDING
5313 case PV_FDE
: return &curwin
->w_p_fde_flags
;
5314 case PV_FDT
: return &curwin
->w_p_fdt_flags
;
5317 case PV_BEXPR
: return &curbuf
->b_p_bexpr_flags
;
5319 # if defined(FEAT_CINDENT)
5320 case PV_INDE
: return &curbuf
->b_p_inde_flags
;
5322 case PV_FEX
: return &curbuf
->b_p_fex_flags
;
5323 # ifdef FEAT_FIND_ID
5324 case PV_INEX
: return &curbuf
->b_p_inex_flags
;
5329 /* Nothing special, return global flags field. */
5330 return &options
[opt_idx
].flags
;
5335 static void redraw_titles
__ARGS((void));
5338 * Redraw the window title and/or tab page text later.
5340 static void redraw_titles()
5342 need_maketitle
= TRUE
;
5343 # ifdef FEAT_WINDOWS
5344 redraw_tabline
= TRUE
;
5350 * Set a string option to a new value (without checking the effect).
5351 * The string is copied into allocated memory.
5352 * if ("opt_idx" == -1) "name" is used, otherwise "opt_idx" is used.
5353 * When "set_sid" is zero set the scriptID to current_SID. When "set_sid" is
5354 * SID_NONE don't set the scriptID. Otherwise set the scriptID to "set_sid".
5357 set_string_option_direct(name
, opt_idx
, val
, opt_flags
, set_sid
)
5361 int opt_flags
; /* OPT_FREE, OPT_LOCAL and/or OPT_GLOBAL */
5366 int both
= (opt_flags
& (OPT_LOCAL
| OPT_GLOBAL
)) == 0;
5369 if (idx
== -1) /* use name */
5371 idx
= findoption(name
);
5372 if (idx
< 0) /* not found (should not happen) */
5374 EMSG2(_(e_intern2
), "set_string_option_direct()");
5379 if (options
[idx
].var
== NULL
) /* can't set hidden option */
5382 s
= vim_strsave(val
);
5385 varp
= (char_u
**)get_varp_scope(&(options
[idx
]),
5386 both
? OPT_LOCAL
: opt_flags
);
5387 if ((opt_flags
& OPT_FREE
) && (options
[idx
].flags
& P_ALLOCED
))
5388 free_string_option(*varp
);
5391 /* For buffer/window local option may also set the global value. */
5393 set_string_option_global(idx
, varp
);
5395 options
[idx
].flags
|= P_ALLOCED
;
5397 /* When setting both values of a global option with a local value,
5398 * make the local value empty, so that the global value is used. */
5399 if (((int)options
[idx
].indir
& PV_BOTH
) && both
)
5401 free_string_option(*varp
);
5402 *varp
= empty_option
;
5405 if (set_sid
!= SID_NONE
)
5406 set_option_scriptID_idx(idx
, opt_flags
,
5407 set_sid
== 0 ? current_SID
: set_sid
);
5413 * Set global value for string option when it's a local option.
5416 set_string_option_global(opt_idx
, varp
)
5417 int opt_idx
; /* option index */
5418 char_u
**varp
; /* pointer to option variable */
5422 /* the global value is always allocated */
5423 if (options
[opt_idx
].var
== VAR_WIN
)
5424 p
= (char_u
**)GLOBAL_WO(varp
);
5426 p
= (char_u
**)options
[opt_idx
].var
;
5427 if (options
[opt_idx
].indir
!= PV_NONE
5429 && (s
= vim_strsave(*varp
)) != NULL
)
5431 free_string_option(*p
);
5436 if (varp
== &p_migdict
)
5437 reset_migemo(FALSE
);
5442 * Set a string option to a new value, and handle the effects.
5445 set_string_option(opt_idx
, value
, opt_flags
)
5448 int opt_flags
; /* OPT_LOCAL and/or OPT_GLOBAL */
5454 if (options
[opt_idx
].var
== NULL
) /* don't set hidden option */
5457 s
= vim_strsave(value
);
5460 varp
= (char_u
**)get_varp_scope(&(options
[opt_idx
]),
5461 (opt_flags
& (OPT_LOCAL
| OPT_GLOBAL
)) == 0
5462 ? (((int)options
[opt_idx
].indir
& PV_BOTH
)
5463 ? OPT_GLOBAL
: OPT_LOCAL
)
5467 if (did_set_string_option(opt_idx
, varp
, TRUE
, oldval
, NULL
,
5469 did_set_option(opt_idx
, opt_flags
, TRUE
);
5474 * Handle string options that need some action to perform when changed.
5475 * Returns NULL for success, or an error message for an error.
5478 did_set_string_option(opt_idx
, varp
, new_value_alloced
, oldval
, errbuf
,
5480 int opt_idx
; /* index in options[] table */
5481 char_u
**varp
; /* pointer to the option variable */
5482 int new_value_alloced
; /* new value was allocated */
5483 char_u
*oldval
; /* previous value of the option */
5484 char_u
*errbuf
; /* buffer for errors, or NULL */
5485 int opt_flags
; /* OPT_LOCAL and/or OPT_GLOBAL */
5487 char_u
*errmsg
= NULL
;
5489 int did_chartab
= FALSE
;
5491 long_u free_oldval
= (options
[opt_idx
].flags
& P_ALLOCED
);
5493 /* set when changing an option that only requires a redraw in the GUI */
5494 int redraw_gui_only
= FALSE
;
5497 /* Get the global option to compare with, otherwise we would have to check
5498 * two values for all local options. */
5499 gvarp
= (char_u
**)get_varp_scope(&(options
[opt_idx
]), OPT_GLOBAL
);
5501 /* Disallow changing some options from secure mode */
5506 ) && (options
[opt_idx
].flags
& P_SECURE
))
5511 /* Check for a "normal" file name in some options. Disallow a path
5512 * separator (slash and/or backslash), wildcards and characters that are
5513 * often illegal in a file name. */
5514 else if ((options
[opt_idx
].flags
& P_NFNAME
)
5515 && vim_strpbrk(*varp
, (char_u
*)"/\\*?[|<>") != NULL
)
5521 else if (varp
== &T_NAME
)
5523 if (T_NAME
[0] == NUL
)
5524 errmsg
= (char_u
*)N_("E529: Cannot set 'term' to empty string");
5527 errmsg
= (char_u
*)N_("E530: Cannot change term in GUI");
5528 else if (term_is_gui(T_NAME
))
5529 errmsg
= (char_u
*)N_("E531: Use \":gui\" to start the GUI");
5531 else if (set_termname(T_NAME
) == FAIL
)
5532 errmsg
= (char_u
*)N_("E522: Not found in termcap");
5534 /* Screen colors may have changed. */
5535 redraw_later_clear();
5539 else if (varp
== &p_bkc
)
5541 if (opt_strings_flags(p_bkc
, p_bkc_values
, &bkc_flags
, TRUE
) != OK
)
5543 if (((bkc_flags
& BKC_AUTO
) != 0)
5544 + ((bkc_flags
& BKC_YES
) != 0)
5545 + ((bkc_flags
& BKC_NO
) != 0) != 1)
5547 /* Must have exactly one of "auto", "yes" and "no". */
5548 (void)opt_strings_flags(oldval
, p_bkc_values
, &bkc_flags
, TRUE
);
5553 /* 'backupext' and 'patchmode' */
5554 else if (varp
== &p_bex
|| varp
== &p_pm
)
5556 if (STRCMP(*p_bex
== '.' ? p_bex
+ 1 : p_bex
,
5557 *p_pm
== '.' ? p_pm
+ 1 : p_pm
) == 0)
5558 errmsg
= (char_u
*)N_("E589: 'backupext' and 'patchmode' are equal");
5562 * 'isident', 'iskeyword', 'isprint or 'isfname' option: refill chartab[]
5563 * If the new option is invalid, use old value. 'lisp' option: refill
5564 * chartab[] for '-' char
5566 else if ( varp
== &p_isi
5567 || varp
== &(curbuf
->b_p_isk
)
5571 if (init_chartab() == FAIL
)
5573 did_chartab
= TRUE
; /* need to restore it below */
5574 errmsg
= e_invarg
; /* error in value */
5579 else if (varp
== &p_hf
)
5581 /* May compute new values for $VIM and $VIMRUNTIME */
5584 vim_setenv((char_u
*)"VIM", (char_u
*)"");
5587 if (didset_vimruntime
)
5589 vim_setenv((char_u
*)"VIMRUNTIME", (char_u
*)"");
5590 didset_vimruntime
= FALSE
;
5594 #ifdef FEAT_MULTI_LANG
5596 else if (varp
== &p_hlg
)
5598 /* Check for "", "ab", "ab,cd", etc. */
5599 for (s
= p_hlg
; *s
!= NUL
; s
+= 3)
5601 if (s
[1] == NUL
|| ((s
[2] != ',' || s
[3] == NUL
) && s
[2] != NUL
))
5613 else if (varp
== &p_hl
)
5615 if (highlight_changed() == FAIL
)
5616 errmsg
= e_invarg
; /* invalid flags */
5620 else if (gvarp
== &p_nf
)
5622 if (check_opt_strings(*varp
, p_nf_values
, TRUE
) != OK
)
5627 /* 'sessionoptions' */
5628 else if (varp
== &p_ssop
)
5630 if (opt_strings_flags(p_ssop
, p_ssop_values
, &ssop_flags
, TRUE
) != OK
)
5632 if ((ssop_flags
& SSOP_CURDIR
) && (ssop_flags
& SSOP_SESDIR
))
5634 /* Don't allow both "sesdir" and "curdir". */
5635 (void)opt_strings_flags(oldval
, p_ssop_values
, &ssop_flags
, TRUE
);
5640 else if (varp
== &p_vop
)
5642 if (opt_strings_flags(p_vop
, p_ssop_values
, &vop_flags
, TRUE
) != OK
)
5648 #ifdef FEAT_SCROLLBIND
5649 else if (varp
== &p_sbo
)
5651 if (check_opt_strings(p_sbo
, p_scbopt_values
, TRUE
) != OK
)
5658 else if (varp
== &p_ambw
)
5660 if (check_opt_strings(p_ambw
, p_ambw_values
, FALSE
) != OK
)
5666 else if (varp
== &p_bg
)
5668 if (check_opt_strings(p_bg
, p_bg_values
, FALSE
) == OK
)
5671 int dark
= (*p_bg
== 'd');
5674 init_highlight(FALSE
, FALSE
);
5677 if (dark
!= (*p_bg
== 'd')
5678 && get_var_value((char_u
*)"g:colors_name") != NULL
)
5680 /* The color scheme must have set 'background' back to another
5681 * value, that's not what we want here. Disable the color
5682 * scheme and set the colors again. */
5683 do_unlet((char_u
*)"g:colors_name", TRUE
);
5684 free_string_option(p_bg
);
5685 p_bg
= vim_strsave((char_u
*)(dark
? "dark" : "light"));
5686 check_string_option(&p_bg
);
5687 init_highlight(FALSE
, FALSE
);
5696 else if (varp
== &p_wim
)
5698 if (check_opt_wim() == FAIL
)
5702 #ifdef FEAT_CMDL_COMPL
5704 else if (varp
== &p_wop
)
5706 if (check_opt_strings(p_wop
, p_wop_values
, TRUE
) != OK
)
5713 else if (varp
== &p_wak
)
5716 || check_opt_strings(p_wak
, p_wak_values
, FALSE
) != OK
)
5719 # ifdef FEAT_GUI_MOTIF
5720 else if (gui
.in_use
)
5721 gui_motif_set_mnemonics(p_wak
[0] == 'y' || p_wak
[0] == 'm');
5723 # ifdef FEAT_GUI_GTK
5724 else if (gui
.in_use
)
5725 gui_gtk_set_mnemonics(p_wak
[0] == 'y' || p_wak
[0] == 'm');
5734 else if (varp
== &p_ei
)
5736 if (check_ei() == FAIL
)
5742 /* 'encoding' and 'fileencoding' */
5743 else if (varp
== &p_enc
|| gvarp
== &p_fenc
|| varp
== &p_tenc
)
5745 if (gvarp
== &p_fenc
)
5747 if (!curbuf
->b_p_ma
&& opt_flags
!= OPT_GLOBAL
)
5748 errmsg
= e_modifiable
;
5749 else if (vim_strchr(*varp
, ',') != NULL
)
5750 /* No comma allowed in 'fileencoding'; catches confusing it
5751 * with 'fileencodings'. */
5756 /* May show a "+" in the title now. */
5759 /* Add 'fileencoding' to the swap file. */
5760 ml_setflags(curbuf
);
5765 /* canonize the value, so that STRCMP() can be used on it */
5766 p
= enc_canonize(*varp
);
5781 # if defined(FEAT_GUI_GTK) && defined(HAVE_GTK2)
5782 if (errmsg
== NULL
&& varp
== &p_tenc
&& gui
.in_use
)
5784 /* GTK+ 2 uses only a single encoding, and that is UTF-8. */
5785 if (STRCMP(p_tenc
, "utf-8") != 0)
5786 errmsg
= (char_u
*)N_("E617: Cannot be changed in the GTK+ 2 GUI");
5793 /* When 'keymap' is used and 'encoding' changes, reload the keymap
5794 * (with another encoding). */
5795 if (varp
== &p_enc
&& *curbuf
->b_p_keymap
!= NUL
)
5796 (void)keymap_init();
5799 /* When 'termencoding' is not empty and 'encoding' changes or when
5800 * 'termencoding' changes, need to setup for keyboard input and
5801 * display output conversion. */
5802 if (((varp
== &p_enc
&& *p_tenc
!= NUL
) || varp
== &p_tenc
))
5804 convert_setup(&input_conv
, p_tenc
, p_enc
);
5805 convert_setup(&output_conv
, p_enc
, p_tenc
);
5808 # if defined(WIN3264) && defined(FEAT_MBYTE)
5809 /* $HOME may have characters in active code page. */
5817 #if defined(FEAT_POSTSCRIPT)
5818 else if (varp
== &p_penc
)
5820 /* Canonize printencoding if VIM standard one */
5821 p
= enc_canonize(p_penc
);
5829 /* Ensure lower case and '-' for '_' */
5830 for (s
= p_penc
; *s
!= NUL
; s
++)
5835 *s
= TOLOWER_ASC(*s
);
5841 #if defined(FEAT_XIM) && defined(FEAT_GUI_GTK)
5842 else if (varp
== &p_imak
)
5844 if (gui
.in_use
&& !im_xim_isvalid_imactivate())
5850 else if (varp
== &curbuf
->b_p_keymap
)
5852 /* load or unload key mapping tables */
5853 errmsg
= keymap_init();
5857 if (*curbuf
->b_p_keymap
!= NUL
)
5859 /* Installed a new keymap, switch on using it. */
5860 curbuf
->b_p_iminsert
= B_IMODE_LMAP
;
5861 if (curbuf
->b_p_imsearch
!= B_IMODE_USE_INSERT
)
5862 curbuf
->b_p_imsearch
= B_IMODE_LMAP
;
5866 /* Cleared the keymap, may reset 'iminsert' and 'imsearch'. */
5867 if (curbuf
->b_p_iminsert
== B_IMODE_LMAP
)
5868 curbuf
->b_p_iminsert
= B_IMODE_NONE
;
5869 if (curbuf
->b_p_imsearch
== B_IMODE_LMAP
)
5870 curbuf
->b_p_imsearch
= B_IMODE_USE_INSERT
;
5872 if ((opt_flags
& OPT_LOCAL
) == 0)
5874 set_iminsert_global();
5875 set_imsearch_global();
5877 # ifdef FEAT_WINDOWS
5878 status_redraw_curbuf();
5885 else if (gvarp
== &p_ff
)
5887 if (!curbuf
->b_p_ma
&& !(opt_flags
& OPT_GLOBAL
))
5888 errmsg
= e_modifiable
;
5889 else if (check_opt_strings(*varp
, p_ff_values
, FALSE
) != OK
)
5893 /* may also change 'textmode' */
5894 if (get_fileformat(curbuf
) == EOL_DOS
)
5895 curbuf
->b_p_tx
= TRUE
;
5897 curbuf
->b_p_tx
= FALSE
;
5901 /* update flag in swap file */
5902 ml_setflags(curbuf
);
5903 /* Redraw needed when switching to/from "mac": a CR in the text
5904 * will be displayed differently. */
5905 if (get_fileformat(curbuf
) == EOL_MAC
|| *oldval
== 'm')
5906 redraw_curbuf_later(NOT_VALID
);
5911 else if (varp
== &p_ffs
)
5913 if (check_opt_strings(p_ffs
, p_ff_values
, TRUE
) != OK
)
5917 /* also change 'textauto' */
5925 #if defined(FEAT_CRYPT) && defined(FEAT_CMDHIST)
5927 else if (gvarp
== &p_key
)
5929 /* Make sure the ":set" command doesn't show the new value in the
5931 remove_key_from_history();
5936 else if (gvarp
== &p_mps
)
5938 /* Check for "x:y,x:y" */
5939 for (p
= *varp
; *p
!= NUL
; p
+= 4)
5941 if (p
[1] != ':' || p
[2] == NUL
|| (p
[3] != NUL
&& p
[3] != ','))
5951 #ifdef FEAT_COMMENTS
5953 else if (gvarp
== &p_com
)
5955 for (s
= *varp
; *s
; )
5957 while (*s
&& *s
!= ':')
5959 if (vim_strchr((char_u
*)COM_ALL
, *s
) == NULL
5960 && !VIM_ISDIGIT(*s
) && *s
!= '-')
5962 errmsg
= illegal_char(errbuf
, *s
);
5968 errmsg
= (char_u
*)N_("E524: Missing colon");
5969 else if (*s
== ',' || *s
== NUL
)
5970 errmsg
= (char_u
*)N_("E525: Zero length string");
5973 while (*s
&& *s
!= ',')
5975 if (*s
== '\\' && s
[1] != NUL
)
5979 s
= skip_to_option_part(s
);
5985 else if (varp
== &p_lcs
)
5987 errmsg
= set_chars_option(varp
);
5990 #if defined(FEAT_WINDOWS) || defined(FEAT_FOLDING)
5992 else if (varp
== &p_fcs
)
5994 errmsg
= set_chars_option(varp
);
6000 else if (varp
== &p_cedit
)
6002 errmsg
= check_cedit();
6007 else if (varp
== &p_vfile
)
6010 if (*p_vfile
!= NUL
&& verbose_open() == FAIL
)
6016 else if (varp
== &p_viminfo
)
6018 for (s
= p_viminfo
; *s
;)
6020 /* Check it's a valid character */
6021 if (vim_strchr((char_u
*)"!\"%'/:<@cfhnrs", *s
) == NULL
)
6023 errmsg
= illegal_char(errbuf
, *s
);
6026 if (*s
== 'n') /* name is always last one */
6030 else if (*s
== 'r') /* skip until next ',' */
6032 while (*++s
&& *s
!= ',')
6037 /* optional number */
6038 while (vim_isdigit(*++s
))
6041 else if (*s
== '!' || *s
== 'h' || *s
== 'c')
6042 ++s
; /* no extra chars */
6043 else /* must have a number */
6045 while (vim_isdigit(*++s
))
6048 if (!VIM_ISDIGIT(*(s
- 1)))
6052 sprintf((char *)errbuf
,
6053 _("E526: Missing number after <%s>"),
6054 transchar_byte(*(s
- 1)));
6058 errmsg
= (char_u
*)"";
6067 errmsg
= (char_u
*)N_("E527: Missing comma");
6069 errmsg
= (char_u
*)"";
6073 if (*p_viminfo
&& errmsg
== NULL
&& get_viminfo_parameter('\'') < 0)
6074 errmsg
= (char_u
*)N_("E528: Must specify a ' value");
6076 #endif /* FEAT_VIMINFO */
6078 /* terminal options */
6079 else if (istermoption(&options
[opt_idx
]) && full_screen
)
6081 /* ":set t_Co=0" and ":set t_Co=1" do ":set t_Co=" */
6084 int colors
= atoi((char *)T_CCO
);
6086 /* Only reinitialize colors if t_Co value has really changed to
6087 * avoid expensive reload of colorscheme if t_Co is set to the
6088 * same value multiple times. */
6089 if (colors
!= t_colors
)
6094 if (new_value_alloced
)
6096 T_CCO
= empty_option
;
6098 /* We now have a different color setup, initialize it again. */
6099 init_highlight(TRUE
, FALSE
);
6106 redraw_later(CLEAR
);
6107 #if defined(MSDOS) || (defined(WIN3264) && !defined(FEAT_GUI_W32))
6108 /* Since t_me has been set, this probably means that the user
6109 * wants to use this as default colors. Need to reset default
6110 * background/foreground colors. */
6111 mch_set_normal_colors();
6116 #ifdef FEAT_LINEBREAK
6118 else if (varp
== &p_sbr
)
6120 for (s
= p_sbr
; *s
; )
6122 if (ptr2cells(s
) != 1)
6123 errmsg
= (char_u
*)N_("E595: contains unprintable or wide character");
6131 else if (varp
== &p_guifont
)
6136 # if defined(FEAT_GUI_GTK)
6138 * Put up a font dialog and let the user select a new value.
6139 * If this is cancelled go back to the old value but don't
6140 * give an error message.
6142 if (STRCMP(p
, "*") == 0)
6144 p
= gui_mch_font_dialog(oldval
);
6146 if (new_value_alloced
)
6147 free_string_option(p_guifont
);
6149 p_guifont
= (p
!= NULL
) ? p
: vim_strsave(oldval
);
6150 new_value_alloced
= TRUE
;
6153 if (p
!= NULL
&& gui_init_font(p_guifont
, FALSE
) != OK
)
6155 # if defined(FEAT_GUI_MSWIN) || defined(FEAT_GUI_PHOTON)
6156 if (STRCMP(p_guifont
, "*") == 0)
6158 /* Dialog was cancelled: Keep the old value without giving
6159 * an error message. */
6160 if (new_value_alloced
)
6161 free_string_option(p_guifont
);
6162 p_guifont
= vim_strsave(oldval
);
6163 new_value_alloced
= TRUE
;
6167 errmsg
= (char_u
*)N_("E596: Invalid font(s)");
6170 redraw_gui_only
= TRUE
;
6172 # ifdef FEAT_XFONTSET
6173 else if (varp
== &p_guifontset
)
6175 if (STRCMP(p_guifontset
, "*") == 0)
6176 errmsg
= (char_u
*)N_("E597: can't select fontset");
6177 else if (gui
.in_use
&& gui_init_font(p_guifontset
, TRUE
) != OK
)
6178 errmsg
= (char_u
*)N_("E598: Invalid fontset");
6179 redraw_gui_only
= TRUE
;
6183 else if (varp
== &p_guifontwide
)
6185 if (STRCMP(p_guifontwide
, "*") == 0)
6186 errmsg
= (char_u
*)N_("E533: can't select wide font");
6187 else if (gui_get_wide_font() == FAIL
)
6188 errmsg
= (char_u
*)N_("E534: Invalid wide font");
6189 redraw_gui_only
= TRUE
;
6196 else if (varp
== &p_guicursor
)
6197 errmsg
= parse_shape_opt(SHAPE_CURSOR
);
6200 #ifdef FEAT_MOUSESHAPE
6202 else if (varp
== &p_mouseshape
)
6204 errmsg
= parse_shape_opt(SHAPE_MOUSE
);
6205 update_mouseshape(-1);
6210 else if (varp
== &p_popt
)
6211 errmsg
= parse_printoptions();
6212 # if defined(FEAT_MBYTE) && defined(FEAT_POSTSCRIPT)
6213 else if (varp
== &p_pmfn
)
6214 errmsg
= parse_printmbfont();
6220 else if (varp
== &p_langmap
)
6224 #ifdef FEAT_LINEBREAK
6226 else if (varp
== &p_breakat
)
6227 fill_breakat_flags();
6231 /* 'titlestring' and 'iconstring' */
6232 else if (varp
== &p_titlestring
|| varp
== &p_iconstring
)
6234 # ifdef FEAT_STL_OPT
6235 int flagval
= (varp
== &p_titlestring
) ? STL_IN_TITLE
: STL_IN_ICON
;
6237 /* NULL => statusline syntax */
6238 if (vim_strchr(*varp
, '%') && check_stl_option(*varp
) == NULL
)
6239 stl_syntax
|= flagval
;
6241 stl_syntax
&= ~flagval
;
6243 did_set_title(varp
== &p_iconstring
);
6250 else if (varp
== &p_go
)
6252 gui_init_which_components(oldval
);
6253 redraw_gui_only
= TRUE
;
6257 #if defined(FEAT_GUI_TABLINE)
6259 else if (varp
== &p_gtl
)
6261 redraw_tabline
= TRUE
;
6262 redraw_gui_only
= TRUE
;
6264 /* 'guitabtooltip' */
6265 else if (varp
== &p_gtt
)
6267 redraw_gui_only
= TRUE
;
6271 #if defined(FEAT_MOUSE_TTY) && (defined(UNIX) || defined(VMS))
6273 else if (varp
== &p_ttym
)
6275 /* Switch the mouse off before changing the escape sequences used for
6277 mch_setmouse(FALSE
);
6278 if (opt_strings_flags(p_ttym
, p_ttym_values
, &ttym_flags
, FALSE
) != OK
)
6281 check_mouse_termcode();
6283 setmouse(); /* may switch it on again */
6289 else if (varp
== &p_sel
)
6292 || check_opt_strings(p_sel
, p_sel_values
, FALSE
) != OK
)
6297 else if (varp
== &p_slm
)
6299 if (check_opt_strings(p_slm
, p_slm_values
, TRUE
) != OK
)
6306 else if (varp
== &p_bsdir
)
6308 if (check_opt_strings(p_bsdir
, p_bsdir_values
, FALSE
) != OK
6309 && !mch_isdir(p_bsdir
))
6316 else if (varp
== &p_km
)
6318 if (check_opt_strings(p_km
, p_km_values
, TRUE
) != OK
)
6322 km_stopsel
= (vim_strchr(p_km
, 'o') != NULL
);
6323 km_startsel
= (vim_strchr(p_km
, 'a') != NULL
);
6329 else if (varp
== &p_mousem
)
6331 if (check_opt_strings(p_mousem
, p_mousem_values
, FALSE
) != OK
)
6333 #if defined(FEAT_GUI_MOTIF) && defined(FEAT_MENU) && (XmVersion <= 1002)
6334 else if (*p_mousem
!= *oldval
)
6335 /* Changed from "extend" to "popup" or "popup_setpos" or vv: need
6336 * to create or delete the popup menus. */
6337 gui_motif_update_mousemodel(root_menu
);
6342 else if (varp
== &p_swb
)
6344 if (opt_strings_flags(p_swb
, p_swb_values
, &swb_flags
, TRUE
) != OK
)
6349 else if (varp
== &p_debug
)
6351 if (check_opt_strings(p_debug
, p_debug_values
, TRUE
) != OK
)
6356 else if (varp
== &p_dy
)
6358 if (opt_strings_flags(p_dy
, p_dy_values
, &dy_flags
, TRUE
) != OK
)
6361 (void)init_chartab();
6365 #ifdef FEAT_VERTSPLIT
6367 else if (varp
== &p_ead
)
6369 if (check_opt_strings(p_ead
, p_ead_values
, FALSE
) != OK
)
6374 #ifdef FEAT_CLIPBOARD
6376 else if (varp
== &p_cb
)
6377 errmsg
= check_clipboard_option();
6381 /* When 'spelllang' or 'spellfile' is set and there is a window for this
6382 * buffer in which 'spell' is set load the wordlists. */
6383 else if (varp
== &(curbuf
->b_p_spl
) || varp
== &(curbuf
->b_p_spf
))
6388 if (varp
== &(curbuf
->b_p_spf
))
6390 l
= (int)STRLEN(curbuf
->b_p_spf
);
6391 if (l
> 0 && (l
< 4 || STRCMP(curbuf
->b_p_spf
+ l
- 4,
6399 if (wp
->w_buffer
== curbuf
&& wp
->w_p_spell
)
6401 errmsg
= did_set_spelllang(curbuf
);
6402 # ifdef FEAT_WINDOWS
6408 /* When 'spellcapcheck' is set compile the regexp program. */
6409 else if (varp
== &(curbuf
->b_p_spc
))
6411 errmsg
= compile_cap_prog(curbuf
);
6413 /* 'spellsuggest' */
6414 else if (varp
== &p_sps
)
6416 if (spell_check_sps() != OK
)
6420 else if (varp
== &p_msm
)
6422 if (spell_check_msm() != OK
)
6427 #ifdef FEAT_QUICKFIX
6428 /* When 'bufhidden' is set, check for valid value. */
6429 else if (gvarp
== &p_bh
)
6431 if (check_opt_strings(curbuf
->b_p_bh
, p_bufhidden_values
, FALSE
) != OK
)
6435 /* When 'buftype' is set, check for valid value. */
6436 else if (gvarp
== &p_bt
)
6438 if (check_opt_strings(curbuf
->b_p_bt
, p_buftype_values
, FALSE
) != OK
)
6442 # ifdef FEAT_WINDOWS
6443 if (curwin
->w_status_height
)
6445 curwin
->w_redr_status
= TRUE
;
6446 redraw_later(VALID
);
6449 curbuf
->b_help
= (curbuf
->b_p_bt
[0] == 'h');
6458 /* 'statusline' or 'rulerformat' */
6459 else if (gvarp
== &p_stl
|| varp
== &p_ruf
)
6463 if (varp
== &p_ruf
) /* reset ru_wid first */
6466 if (varp
== &p_ruf
&& *s
== '%')
6468 /* set ru_wid if 'ruf' starts with "%99(" */
6469 if (*++s
== '-') /* ignore a '-' */
6471 wid
= getdigits(&s
);
6472 if (wid
&& *s
== '(' && (errmsg
= check_stl_option(p_ruf
)) == NULL
)
6475 errmsg
= check_stl_option(p_ruf
);
6477 /* check 'statusline' only if it doesn't start with "%!" */
6478 else if (varp
== &p_ruf
|| s
[0] != '%' || s
[1] != '!')
6479 errmsg
= check_stl_option(s
);
6480 if (varp
== &p_ruf
&& errmsg
== NULL
)
6485 #ifdef FEAT_INS_EXPAND
6486 /* check if it is a valid value for 'complete' -- Acevedo */
6487 else if (gvarp
== &p_cpt
)
6489 for (s
= *varp
; *s
;)
6491 while(*s
== ',' || *s
== ' ')
6495 if (vim_strchr((char_u
*)".wbuksid]tU", *s
) == NULL
)
6497 errmsg
= illegal_char(errbuf
, *s
);
6500 if (*++s
!= NUL
&& *s
!= ',' && *s
!= ' ')
6502 if (s
[-1] == 'k' || s
[-1] == 's')
6504 /* skip optional filename after 'k' and 's' */
6505 while (*s
&& *s
!= ',' && *s
!= ' ')
6516 sprintf((char *)errbuf
,
6517 _("E535: Illegal character after <%c>"),
6522 errmsg
= (char_u
*)"";
6530 else if (varp
== &p_cot
)
6532 if (check_opt_strings(p_cot
, p_cot_values
, TRUE
) != OK
)
6535 #endif /* FEAT_INS_EXPAND */
6538 #if defined(FEAT_TOOLBAR) && !defined(FEAT_GUI_W32)
6539 else if (varp
== &p_toolbar
)
6541 if (opt_strings_flags(p_toolbar
, p_toolbar_values
,
6542 &toolbar_flags
, TRUE
) != OK
)
6547 gui_mch_show_toolbar((toolbar_flags
&
6548 (TOOLBAR_TEXT
| TOOLBAR_ICONS
)) != 0);
6553 #if defined(FEAT_TOOLBAR) && defined(FEAT_GUI_GTK) && defined(HAVE_GTK2)
6554 /* 'toolbariconsize': GTK+ 2 only */
6555 else if (varp
== &p_tbis
)
6557 if (opt_strings_flags(p_tbis
, p_tbis_values
, &tbis_flags
, FALSE
) != OK
)
6562 gui_mch_show_toolbar((toolbar_flags
&
6563 (TOOLBAR_TEXT
| TOOLBAR_ICONS
)) != 0);
6568 /* 'pastetoggle': translate key codes like in a mapping */
6569 else if (varp
== &p_pt
)
6573 (void)replace_termcodes(p_pt
, &p
, TRUE
, TRUE
, FALSE
);
6576 if (new_value_alloced
)
6577 free_string_option(p_pt
);
6579 new_value_alloced
= TRUE
;
6585 else if (varp
== &p_bs
)
6587 if (VIM_ISDIGIT(*p_bs
))
6589 if (*p_bs
>'2' || p_bs
[1] != NUL
)
6592 else if (check_opt_strings(p_bs
, p_bs_values
, TRUE
) != OK
)
6598 else if (varp
== &p_cmp
)
6600 if (opt_strings_flags(p_cmp
, p_cmp_values
, &cmp_flags
, TRUE
) != OK
)
6607 else if (varp
== &p_dip
)
6609 if (diffopt_changed() == FAIL
)
6616 else if (gvarp
== &curwin
->w_allbuf_opt
.wo_fdm
)
6618 if (check_opt_strings(*varp
, p_fdm_values
, FALSE
) != OK
6619 || *curwin
->w_p_fdm
== NUL
)
6623 foldUpdateAll(curwin
);
6624 if (foldmethodIsDiff(curwin
))
6630 else if (varp
== &curwin
->w_p_fde
)
6632 if (foldmethodIsExpr(curwin
))
6633 foldUpdateAll(curwin
);
6637 else if (gvarp
== &curwin
->w_allbuf_opt
.wo_fmr
)
6639 p
= vim_strchr(*varp
, ',');
6641 errmsg
= (char_u
*)N_("E536: comma required");
6642 else if (p
== *varp
|| p
[1] == NUL
)
6644 else if (foldmethodIsMarker(curwin
))
6645 foldUpdateAll(curwin
);
6647 /* 'commentstring' */
6648 else if (gvarp
== &p_cms
)
6650 if (**varp
!= NUL
&& strstr((char *)*varp
, "%s") == NULL
)
6651 errmsg
= (char_u
*)N_("E537: 'commentstring' must be empty or contain %s");
6654 else if (varp
== &p_fdo
)
6656 if (opt_strings_flags(p_fdo
, p_fdo_values
, &fdo_flags
, TRUE
) != OK
)
6660 else if (varp
== &p_fcl
)
6662 if (check_opt_strings(p_fcl
, p_fcl_values
, TRUE
) != OK
)
6666 else if (gvarp
== &curwin
->w_allbuf_opt
.wo_fdi
)
6668 if (foldmethodIsIndent(curwin
))
6669 foldUpdateAll(curwin
);
6673 #ifdef FEAT_VIRTUALEDIT
6675 else if (varp
== &p_ve
)
6677 if (opt_strings_flags(p_ve
, p_ve_values
, &ve_flags
, TRUE
) != OK
)
6679 else if (STRCMP(p_ve
, oldval
) != 0)
6681 /* Recompute cursor position in case the new 've' setting
6682 * changes something. */
6684 coladvance(curwin
->w_virtcol
);
6689 #if defined(FEAT_CSCOPE) && defined(FEAT_QUICKFIX)
6690 else if (varp
== &p_csqf
)
6697 if (vim_strchr((char_u
*)CSQF_CMDS
, *p
) == NULL
6699 || vim_strchr((char_u
*)CSQF_FLAGS
, p
[1]) == NULL
6700 || (p
[2] != NUL
&& p
[2] != ','))
6705 else if (p
[2] == NUL
)
6714 /* Options that are a list of flags. */
6719 p
= (char_u
*)WW_ALL
;
6721 p
= (char_u
*)SHM_ALL
;
6722 else if (varp
== &(p_cpo
))
6723 p
= (char_u
*)CPO_ALL
;
6724 else if (varp
== &(curbuf
->b_p_fo
))
6725 p
= (char_u
*)FO_ALL
;
6726 else if (varp
== &p_mouse
)
6729 p
= (char_u
*)MOUSE_ALL
;
6731 if (*p_mouse
!= NUL
)
6732 errmsg
= (char_u
*)N_("E538: No mouse support");
6735 #if defined(FEAT_GUI)
6736 else if (varp
== &p_go
)
6737 p
= (char_u
*)GO_ALL
;
6741 for (s
= *varp
; *s
; ++s
)
6742 if (vim_strchr(p
, *s
) == NULL
)
6744 errmsg
= illegal_char(errbuf
, *s
);
6751 * If error detected, restore the previous value.
6755 if (new_value_alloced
)
6756 free_string_option(*varp
);
6759 * When resetting some values, need to act on it.
6762 (void)init_chartab();
6764 (void)highlight_changed();
6769 /* Remember where the option was set. */
6770 set_option_scriptID_idx(opt_idx
, opt_flags
, current_SID
);
6773 * Free string options that are in allocated memory.
6774 * Use "free_oldval", because recursiveness may change the flags under
6775 * our fingers (esp. init_highlight()).
6778 free_string_option(oldval
);
6779 if (new_value_alloced
)
6780 options
[opt_idx
].flags
|= P_ALLOCED
;
6782 options
[opt_idx
].flags
&= ~P_ALLOCED
;
6784 if ((opt_flags
& (OPT_LOCAL
| OPT_GLOBAL
)) == 0
6785 && ((int)options
[opt_idx
].indir
& PV_BOTH
))
6787 /* global option with local value set to use global value; free
6788 * the local value and make it empty */
6789 p
= get_varp_scope(&(options
[opt_idx
]), OPT_LOCAL
);
6790 free_string_option(*(char_u
**)p
);
6791 *(char_u
**)p
= empty_option
;
6794 /* May set global value for local option. */
6795 else if (!(opt_flags
& OPT_LOCAL
) && opt_flags
!= OPT_GLOBAL
)
6796 set_string_option_global(opt_idx
, varp
);
6800 * Trigger the autocommand only after setting the flags.
6803 /* When 'syntax' is set, load the syntax of that name */
6804 if (varp
== &(curbuf
->b_p_syn
))
6806 apply_autocmds(EVENT_SYNTAX
, curbuf
->b_p_syn
,
6807 curbuf
->b_fname
, TRUE
, curbuf
);
6810 else if (varp
== &(curbuf
->b_p_ft
))
6812 /* 'filetype' is set, trigger the FileType autocommand */
6813 did_filetype
= TRUE
;
6814 apply_autocmds(EVENT_FILETYPE
, curbuf
->b_p_ft
,
6815 curbuf
->b_fname
, TRUE
, curbuf
);
6819 if (varp
== &(curbuf
->b_p_spl
))
6824 * Source the spell/LANG.vim in 'runtimepath'.
6825 * They could set 'spellcapcheck' depending on the language.
6826 * Use the first name in 'spelllang' up to '_region' or
6829 for (p
= curbuf
->b_p_spl
; *p
!= NUL
; ++p
)
6830 if (vim_strchr((char_u
*)"_.,", *p
) != NULL
)
6832 vim_snprintf((char *)fname
, 200, "spell/%.*s.vim",
6833 (int)(p
- curbuf
->b_p_spl
), curbuf
->b_p_spl
);
6834 source_runtime(fname
, TRUE
);
6840 if (varp
== &p_mouse
)
6842 # ifdef FEAT_MOUSE_TTY
6843 if (*p_mouse
== NUL
)
6844 mch_setmouse(FALSE
); /* switch mouse off */
6847 setmouse(); /* in case 'mouse' changed */
6851 if (curwin
->w_curswant
!= MAXCOL
)
6852 curwin
->w_set_curswant
= TRUE
; /* in case 'showbreak' changed */
6854 /* check redraw when it's not a GUI option or the GUI is active. */
6855 if (!redraw_gui_only
|| gui
.in_use
)
6857 check_redraw(options
[opt_idx
].flags
);
6863 * Handle setting 'listchars' or 'fillchars'.
6864 * Returns error message, NULL if it's OK.
6867 set_chars_option(varp
)
6870 int round
, i
, len
, entries
;
6878 #if defined(FEAT_WINDOWS) || defined(FEAT_FOLDING)
6879 static struct charstab filltab
[] =
6882 {&fill_stlnc
, "stlnc"},
6883 {&fill_vert
, "vert"},
6884 {&fill_fold
, "fold"},
6885 {&fill_diff
, "diff"},
6888 static struct charstab lcstab
[] =
6891 {&lcs_ext
, "extends"},
6892 {&lcs_nbsp
, "nbsp"},
6893 {&lcs_prec
, "precedes"},
6895 {&lcs_trail
, "trail"},
6897 struct charstab
*tab
;
6899 #if defined(FEAT_WINDOWS) || defined(FEAT_FOLDING)
6904 entries
= sizeof(lcstab
) / sizeof(struct charstab
);
6906 #if defined(FEAT_WINDOWS) || defined(FEAT_FOLDING)
6910 entries
= sizeof(filltab
) / sizeof(struct charstab
);
6914 /* first round: check for valid value, second round: assign values */
6915 for (round
= 0; round
<= 1; ++round
)
6919 /* After checking that the value is valid: set defaults: space for
6920 * 'fillchars', NUL for 'listchars' */
6921 for (i
= 0; i
< entries
; ++i
)
6922 *(tab
[i
].cp
) = (varp
== &p_lcs
? NUL
: ' ');
6925 #if defined(FEAT_WINDOWS) || defined(FEAT_FOLDING)
6933 for (i
= 0; i
< entries
; ++i
)
6935 len
= (int)STRLEN(tab
[i
].name
);
6936 if (STRNCMP(p
, tab
[i
].name
, len
) == 0
6938 && p
[len
+ 1] != NUL
)
6942 c1
= mb_ptr2char_adv(&s
);
6943 if (mb_char2cells(c1
) > 1)
6948 if (tab
[i
].cp
== &lcs_tab2
)
6953 c2
= mb_ptr2char_adv(&s
);
6954 if (mb_char2cells(c2
) > 1)
6960 if (*s
== ',' || *s
== NUL
)
6964 if (tab
[i
].cp
== &lcs_tab2
)
6986 return NULL
; /* no error */
6991 * Check validity of options with the 'statusline' format.
6992 * Return error message or NULL.
7000 static char_u errbuf
[80];
7002 while (*s
&& itemcnt
< STL_MAX_ITEM
)
7004 /* Check for valid keys after % sequences */
7005 while (*s
&& *s
!= '%')
7010 if (*s
!= '%' && *s
!= ')')
7012 if (*s
== '%' || *s
== STL_TRUNCMARK
|| *s
== STL_MIDDLEMARK
)
7020 if (--groupdepth
< 0)
7026 while (VIM_ISDIGIT(*s
))
7028 if (*s
== STL_USER_HL
)
7033 while (*s
&& VIM_ISDIGIT(*s
))
7041 if (vim_strchr(STL_ALL
, *s
) == NULL
)
7043 return illegal_char(errbuf
, *s
);
7048 while (*s
!= '}' && *s
)
7051 return (char_u
*)N_("E540: Unclosed expression sequence");
7054 if (itemcnt
>= STL_MAX_ITEM
)
7055 return (char_u
*)N_("E541: too many items");
7056 if (groupdepth
!= 0)
7057 return (char_u
*)N_("E542: unbalanced groups");
7062 #ifdef FEAT_CLIPBOARD
7064 * Extract the items in the 'clipboard' option and set global values.
7067 check_clipboard_option()
7069 int new_unnamed
= FALSE
;
7070 int new_autoselect
= FALSE
;
7071 int new_autoselectml
= FALSE
;
7072 int new_html
= FALSE
;
7073 regprog_T
*new_exclude_prog
= NULL
;
7074 char_u
*errmsg
= NULL
;
7077 for (p
= p_cb
; *p
!= NUL
; )
7079 if (STRNCMP(p
, "unnamed", 7) == 0 && (p
[7] == ',' || p
[7] == NUL
))
7084 else if (STRNCMP(p
, "autoselect", 10) == 0
7085 && (p
[10] == ',' || p
[10] == NUL
))
7087 new_autoselect
= TRUE
;
7090 else if (STRNCMP(p
, "autoselectml", 12) == 0
7091 && (p
[12] == ',' || p
[12] == NUL
))
7093 new_autoselectml
= TRUE
;
7096 else if (STRNCMP(p
, "html", 4) == 0 && (p
[4] == ',' || p
[4] == NUL
))
7101 else if (STRNCMP(p
, "exclude:", 8) == 0 && new_exclude_prog
== NULL
)
7104 new_exclude_prog
= vim_regcomp(p
, RE_MAGIC
);
7105 if (new_exclude_prog
== NULL
)
7119 clip_unnamed
= new_unnamed
;
7120 clip_autoselect
= new_autoselect
;
7121 clip_autoselectml
= new_autoselectml
;
7122 clip_html
= new_html
;
7123 vim_free(clip_exclude_prog
);
7124 clip_exclude_prog
= new_exclude_prog
;
7127 vim_free(new_exclude_prog
);
7135 * Set curbuf->b_cap_prog to the regexp program for 'spellcapcheck'.
7136 * Return error message when failed, NULL when OK.
7139 compile_cap_prog(buf
)
7142 regprog_T
*rp
= buf
->b_cap_prog
;
7145 if (*buf
->b_p_spc
== NUL
)
7146 buf
->b_cap_prog
= NULL
;
7149 /* Prepend a ^ so that we only match at one column */
7150 re
= concat_str((char_u
*)"^", buf
->b_p_spc
);
7153 buf
->b_cap_prog
= vim_regcomp(re
, RE_MAGIC
);
7154 if (buf
->b_cap_prog
== NULL
)
7156 buf
->b_cap_prog
= rp
; /* restore the previous program */
7168 #if defined(FEAT_EVAL) || defined(PROTO)
7170 * Set the scriptID for an option, taking care of setting the buffer- or
7171 * window-local value.
7174 set_option_scriptID_idx(opt_idx
, opt_flags
, id
)
7179 int both
= (opt_flags
& (OPT_LOCAL
| OPT_GLOBAL
)) == 0;
7180 int indir
= (int)options
[opt_idx
].indir
;
7182 /* Remember where the option was set. For local options need to do that
7183 * in the buffer or window structure. */
7184 if (both
|| (opt_flags
& OPT_GLOBAL
) || (indir
& (PV_BUF
|PV_WIN
)) == 0)
7185 options
[opt_idx
].scriptID
= id
;
7186 if (both
|| (opt_flags
& OPT_LOCAL
))
7189 curbuf
->b_p_scriptID
[indir
& PV_MASK
] = id
;
7190 else if (indir
& PV_WIN
)
7191 curwin
->w_p_scriptID
[indir
& PV_MASK
] = id
;
7197 * Set the value of a boolean option, and take care of side effects.
7198 * Returns NULL for success, or an error message for an error.
7201 set_bool_option(opt_idx
, varp
, value
, opt_flags
)
7202 int opt_idx
; /* index in options[] table */
7203 char_u
*varp
; /* pointer to the option variable */
7204 int value
; /* new value */
7205 int opt_flags
; /* OPT_LOCAL and/or OPT_GLOBAL */
7207 int old_value
= *(int *)varp
;
7209 /* Disallow changing some options from secure mode */
7214 ) && (options
[opt_idx
].flags
& P_SECURE
))
7217 *(int *)varp
= value
; /* set the new value */
7219 /* Remember where the option was set. */
7220 set_option_scriptID_idx(opt_idx
, opt_flags
, current_SID
);
7224 need_mouse_correct
= TRUE
;
7227 /* May set global value for local option. */
7228 if ((opt_flags
& (OPT_LOCAL
| OPT_GLOBAL
)) == 0)
7229 *(int *)get_varp_scope(&(options
[opt_idx
]), OPT_GLOBAL
) = value
;
7232 * Handle side effects of changing a bool option.
7236 if ((int *)varp
== &p_cp
)
7241 /* 'list', 'number' */
7242 else if ((int *)varp
== &curwin
->w_p_list
7243 || (int *)varp
== &curwin
->w_p_nu
)
7245 if (curwin
->w_curswant
!= MAXCOL
)
7246 curwin
->w_set_curswant
= TRUE
;
7249 else if ((int *)varp
== &curbuf
->b_p_ro
)
7251 /* when 'readonly' is reset globally, also reset readonlymode */
7252 if (!curbuf
->b_p_ro
&& (opt_flags
& OPT_LOCAL
) == 0)
7253 readonlymode
= FALSE
;
7255 /* when 'readonly' is set may give W10 again */
7257 curbuf
->b_did_warn
= FALSE
;
7265 /* when 'modifiable' is changed, redraw the window title */
7266 else if ((int *)varp
== &curbuf
->b_p_ma
)
7270 /* when 'endofline' is changed, redraw the window title */
7271 else if ((int *)varp
== &curbuf
->b_p_eol
)
7276 /* when 'bomb' is changed, redraw the window title and tab page text */
7277 else if ((int *)varp
== &curbuf
->b_p_bomb
)
7284 /* when 'bin' is set also set some other options */
7285 else if ((int *)varp
== &curbuf
->b_p_bin
)
7287 set_options_bin(old_value
, curbuf
->b_p_bin
, opt_flags
);
7294 /* when 'buflisted' changes, trigger autocommands */
7295 else if ((int *)varp
== &curbuf
->b_p_bl
&& old_value
!= curbuf
->b_p_bl
)
7297 apply_autocmds(curbuf
->b_p_bl
? EVENT_BUFADD
: EVENT_BUFDELETE
,
7298 NULL
, NULL
, TRUE
, curbuf
);
7302 /* when 'swf' is set, create swapfile, when reset remove swapfile */
7303 else if ((int *)varp
== &curbuf
->b_p_swf
)
7305 if (curbuf
->b_p_swf
&& p_uc
)
7306 ml_open_file(curbuf
); /* create the swap file */
7308 /* no need to reset curbuf->b_may_swap, ml_open_file() will check
7310 mf_close_file(curbuf
, TRUE
); /* remove the swap file */
7313 /* when 'terse' is set change 'shortmess' */
7314 else if ((int *)varp
== &p_terse
)
7318 p
= vim_strchr(p_shm
, SHM_SEARCH
);
7320 /* insert 's' in p_shm */
7321 if (p_terse
&& p
== NULL
)
7323 STRCPY(IObuff
, p_shm
);
7324 STRCAT(IObuff
, "s");
7325 set_string_option_direct((char_u
*)"shm", -1, IObuff
, OPT_FREE
, 0);
7327 /* remove 's' from p_shm */
7328 else if (!p_terse
&& p
!= NULL
)
7332 /* when 'paste' is set or reset also change other options */
7333 else if ((int *)varp
== &p_paste
)
7335 paste_option_changed();
7338 /* when 'insertmode' is set from an autocommand need to do work here */
7339 else if ((int *)varp
== &p_im
)
7343 if ((State
& INSERT
) == 0)
7344 need_start_insertmode
= TRUE
;
7345 stop_insert_mode
= FALSE
;
7349 need_start_insertmode
= FALSE
;
7350 stop_insert_mode
= TRUE
;
7351 if (restart_edit
!= 0 && mode_displayed
)
7352 clear_cmdline
= TRUE
; /* remove "(insert)" */
7357 /* when 'ignorecase' is set or reset and 'hlsearch' is set, redraw */
7358 else if ((int *)varp
== &p_ic
&& p_hls
)
7360 redraw_all_later(SOME_VALID
);
7363 #ifdef FEAT_SEARCH_EXTRA
7364 /* when 'hlsearch' is set or reset: reset no_hlsearch */
7365 else if ((int *)varp
== &p_hls
)
7367 no_hlsearch
= FALSE
;
7371 #ifdef FEAT_SCROLLBIND
7372 /* when 'scrollbind' is set: snapshot the current position to avoid a jump
7373 * at the end of normal_cmd() */
7374 else if ((int *)varp
== &curwin
->w_p_scb
)
7376 if (curwin
->w_p_scb
)
7377 do_check_scrollbind(FALSE
);
7381 #if defined(FEAT_WINDOWS) && defined(FEAT_QUICKFIX)
7382 /* There can be only one window with 'previewwindow' set. */
7383 else if ((int *)varp
== &curwin
->w_p_pvw
)
7385 if (curwin
->w_p_pvw
)
7389 for (win
= firstwin
; win
!= NULL
; win
= win
->w_next
)
7390 if (win
->w_p_pvw
&& win
!= curwin
)
7392 curwin
->w_p_pvw
= FALSE
;
7393 return (char_u
*)N_("E590: A preview window already exists");
7399 /* when 'textmode' is set or reset also change 'fileformat' */
7400 else if ((int *)varp
== &curbuf
->b_p_tx
)
7402 set_fileformat(curbuf
->b_p_tx
? EOL_DOS
: EOL_UNIX
, opt_flags
);
7405 /* when 'textauto' is set or reset also change 'fileformats' */
7406 else if ((int *)varp
== &p_ta
)
7407 set_string_option_direct((char_u
*)"ffs", -1,
7408 p_ta
? (char_u
*)DFLT_FFS_VIM
: (char_u
*)"",
7409 OPT_FREE
| opt_flags
, 0);
7412 * When 'lisp' option changes include/exclude '-' in
7413 * keyword characters.
7416 else if (varp
== (char_u
*)&(curbuf
->b_p_lisp
))
7418 (void)buf_init_chartab(curbuf
, FALSE
); /* ignore errors */
7423 /* when 'title' changed, may need to change the title; same for 'icon' */
7424 else if ((int *)varp
== &p_title
)
7426 did_set_title(FALSE
);
7429 else if ((int *)varp
== &p_icon
)
7431 did_set_title(TRUE
);
7435 else if ((int *)varp
== &curbuf
->b_changed
)
7438 save_file_ff(curbuf
); /* Buffer is unchanged */
7443 modified_was_set
= value
;
7447 #ifdef BACKSLASH_IN_FILENAME
7448 else if ((int *)varp
== &p_ssl
)
7463 /* need to adjust the file name arguments and buffer names. */
7464 buflist_slash_adjust();
7465 alist_slash_adjust();
7467 scriptnames_slash_adjust();
7472 /* If 'wrap' is set, set w_leftcol to zero. */
7473 else if ((int *)varp
== &curwin
->w_p_wrap
)
7475 if (curwin
->w_p_wrap
)
7476 curwin
->w_leftcol
= 0;
7477 if (curwin
->w_curswant
!= MAXCOL
)
7478 curwin
->w_set_curswant
= TRUE
;
7482 else if ((int *)varp
== &p_ea
)
7484 if (p_ea
&& !old_value
)
7485 win_equal(curwin
, FALSE
, 0);
7489 else if ((int *)varp
== &p_wiv
)
7492 * When 'weirdinvert' changed, set/reset 't_xs'.
7493 * Then set 'weirdinvert' according to value of 't_xs'.
7495 if (p_wiv
&& !old_value
)
7496 T_XS
= (char_u
*)"y";
7497 else if (!p_wiv
&& old_value
)
7498 T_XS
= empty_option
;
7499 p_wiv
= (*T_XS
!= NUL
);
7503 else if ((int *)varp
== &p_beval
)
7505 if (p_beval
== TRUE
)
7506 gui_mch_enable_beval_area(balloonEval
);
7508 gui_mch_disable_beval_area(balloonEval
);
7512 #ifdef FEAT_AUTOCHDIR
7513 else if ((int *)varp
== &p_acd
)
7515 /* Change directories when the 'acd' option is set now. */
7522 else if ((int *)varp
== &curwin
->w_p_diff
)
7524 /* May add or remove the buffer from the list of diff buffers. */
7525 diff_buf_adjust(curwin
);
7526 # ifdef FEAT_FOLDING
7527 if (foldmethodIsDiff(curwin
))
7528 foldUpdateAll(curwin
);
7533 #ifdef USE_IM_CONTROL
7535 else if ((int *)varp
== &p_imdisable
)
7537 /* Only de-activate it here, it will be enabled when changing mode. */
7539 im_set_active(FALSE
);
7545 else if ((int *)varp
== &curwin
->w_p_spell
)
7547 if (curwin
->w_p_spell
)
7549 char_u
*errmsg
= did_set_spelllang(curbuf
);
7558 else if ((int *)varp
== &p_altkeymap
)
7560 if (old_value
!= p_altkeymap
)
7572 (void)init_chartab();
7577 * In case some second language keymapping options have changed, check
7578 * and correct the setting in a consistent way.
7582 * If hkmap or fkmap are set, reset Arabic keymapping.
7584 if ((p_hkmap
|| p_fkmap
) && p_altkeymap
)
7586 p_altkeymap
= p_fkmap
;
7588 curwin
->w_p_arab
= FALSE
;
7590 (void)init_chartab();
7594 * If hkmap set, reset Farsi keymapping.
7596 if (p_hkmap
&& p_altkeymap
)
7601 curwin
->w_p_arab
= FALSE
;
7603 (void)init_chartab();
7607 * If fkmap set, reset Hebrew keymapping.
7609 if (p_fkmap
&& !p_altkeymap
)
7614 curwin
->w_p_arab
= FALSE
;
7616 (void)init_chartab();
7621 if ((int *)varp
== &curwin
->w_p_arab
)
7623 if (curwin
->w_p_arab
)
7626 * 'arabic' is set, handle various sub-settings.
7630 /* set rightleft mode */
7631 if (!curwin
->w_p_rl
)
7633 curwin
->w_p_rl
= TRUE
;
7634 changed_window_setting();
7637 /* Enable Arabic shaping (major part of what Arabic requires) */
7641 redraw_later_clear();
7645 /* Arabic requires a utf-8 encoding, inform the user if its not
7647 if (STRCMP(p_enc
, "utf-8") != 0)
7649 static char *w_arabic
= N_("W17: Arabic requires UTF-8, do ':set encoding=utf-8'");
7651 msg_source(hl_attr(HLF_W
));
7652 MSG_ATTR(_(w_arabic
), hl_attr(HLF_W
));
7654 set_vim_var_string(VV_WARNINGMSG
, (char_u
*)_(w_arabic
), -1);
7659 /* set 'delcombine' */
7664 /* Force-set the necessary keymap for arabic */
7665 set_option_value((char_u
*)"keymap", 0L, (char_u
*)"arabic",
7672 (void)init_chartab();
7678 * 'arabic' is reset, handle various sub-settings.
7682 /* reset rightleft mode */
7685 curwin
->w_p_rl
= FALSE
;
7686 changed_window_setting();
7689 /* 'arabicshape' isn't reset, it is a global option and
7690 * another window may still need it "on". */
7693 /* 'delcombine' isn't reset, it is a global option and another
7694 * window may still want it "on". */
7697 /* Revert to the default keymap */
7698 curbuf
->b_p_iminsert
= B_IMODE_NONE
;
7699 curbuf
->b_p_imsearch
= B_IMODE_USE_INSERT
;
7702 if (curwin
->w_curswant
!= MAXCOL
)
7703 curwin
->w_set_curswant
= TRUE
;
7706 else if ((int *)varp
== &p_arshape
)
7708 if (curwin
->w_curswant
!= MAXCOL
)
7709 curwin
->w_set_curswant
= TRUE
;
7713 #ifdef FEAT_LINEBREAK
7714 if ((int *)varp
== &curwin
->w_p_lbr
)
7716 if (curwin
->w_curswant
!= MAXCOL
)
7717 curwin
->w_set_curswant
= TRUE
;
7721 #ifdef FEAT_RIGHTLEFT
7722 if ((int *)varp
== &curwin
->w_p_rl
)
7724 if (curwin
->w_curswant
!= MAXCOL
)
7725 curwin
->w_set_curswant
= TRUE
;
7730 * End of handling side effects for bool options.
7733 options
[opt_idx
].flags
|= P_WAS_SET
;
7735 comp_col(); /* in case 'ruler' or 'showcmd' changed */
7737 check_redraw(options
[opt_idx
].flags
);
7743 * Set the value of a number option, and take care of side effects.
7744 * Returns NULL for success, or an error message for an error.
7747 set_num_option(opt_idx
, varp
, value
, errbuf
, errbuflen
, opt_flags
)
7748 int opt_idx
; /* index in options[] table */
7749 char_u
*varp
; /* pointer to the option variable */
7750 long value
; /* new value */
7751 char_u
*errbuf
; /* buffer for error messages */
7752 size_t errbuflen
; /* length of "errbuf" */
7753 int opt_flags
; /* OPT_LOCAL, OPT_GLOBAL and
7756 char_u
*errmsg
= NULL
;
7757 long old_value
= *(long *)varp
;
7758 long old_Rows
= Rows
; /* remember old Rows */
7759 long old_Columns
= Columns
; /* remember old Columns */
7760 long *pp
= (long *)varp
;
7762 /* Disallow changing some options from secure mode. */
7767 ) && (options
[opt_idx
].flags
& P_SECURE
))
7772 /* Remember where the option was set. */
7773 set_option_scriptID_idx(opt_idx
, opt_flags
, current_SID
);
7776 need_mouse_correct
= TRUE
;
7779 if (curbuf
->b_p_sw
<= 0)
7781 errmsg
= e_positive
;
7782 curbuf
->b_p_sw
= curbuf
->b_p_ts
;
7786 * Number options that need some action when changed
7789 if (pp
== &p_wh
|| pp
== &p_hh
)
7793 errmsg
= e_positive
;
7798 errmsg
= e_winheight
;
7803 errmsg
= e_positive
;
7807 /* Change window height NOW */
7808 if (lastwin
!= firstwin
)
7810 if (pp
== &p_wh
&& curwin
->w_height
< p_wh
)
7811 win_setheight((int)p_wh
);
7812 if (pp
== &p_hh
&& curbuf
->b_help
&& curwin
->w_height
< p_hh
)
7813 win_setheight((int)p_hh
);
7817 /* 'winminheight' */
7818 else if (pp
== &p_wmh
)
7822 errmsg
= e_positive
;
7827 errmsg
= e_winheight
;
7833 # ifdef FEAT_VERTSPLIT
7834 else if (pp
== &p_wiw
)
7838 errmsg
= e_positive
;
7843 errmsg
= e_winwidth
;
7847 /* Change window width NOW */
7848 if (lastwin
!= firstwin
&& curwin
->w_width
< p_wiw
)
7849 win_setwidth((int)p_wiw
);
7853 else if (pp
== &p_wmw
)
7857 errmsg
= e_positive
;
7862 errmsg
= e_winwidth
;
7872 /* (re)set last window status line */
7873 else if (pp
== &p_ls
)
7878 /* (re)set tab page line */
7879 else if (pp
== &p_stal
)
7881 shell_new_rows(); /* recompute window positions and heights */
7886 else if (pp
== &p_linespace
|| pp
== &p_charspace
)
7888 /* Recompute gui.char_height and resize the Vim window to keep the
7889 * same number of lines. */
7890 if (gui
.in_use
&& gui_mch_adjust_charheight() == OK
)
7891 gui_set_shellsize(FALSE
, FALSE
, RESIZE_VERT
);
7897 else if (pp
== &curwin
->w_p_fdl
)
7899 if (curwin
->w_p_fdl
< 0)
7900 curwin
->w_p_fdl
= 0;
7904 /* 'foldminlines' */
7905 else if (pp
== &curwin
->w_p_fml
)
7907 foldUpdateAll(curwin
);
7911 else if (pp
== &curwin
->w_p_fdn
)
7913 if (foldmethodIsSyntax(curwin
) || foldmethodIsIndent(curwin
))
7914 foldUpdateAll(curwin
);
7918 else if (pp
== &curwin
->w_p_fdc
)
7920 if (curwin
->w_p_fdc
< 0)
7922 errmsg
= e_positive
;
7923 curwin
->w_p_fdc
= 0;
7925 else if (curwin
->w_p_fdc
> 12)
7928 curwin
->w_p_fdc
= 12;
7932 /* 'shiftwidth' or 'tabstop' */
7933 else if (pp
== &curbuf
->b_p_sw
|| pp
== &curbuf
->b_p_ts
)
7935 if (foldmethodIsIndent(curwin
))
7936 foldUpdateAll(curwin
);
7938 #endif /* FEAT_FOLDING */
7942 else if (pp
== &p_mco
)
7944 if (p_mco
> MAX_MCO
)
7948 screenclear(); /* will re-allocate the screen */
7952 #ifdef USE_TRANSPARENCY
7953 else if ((long *)varp
== &p_transparency
)
7955 if (p_transparency
< 1 || p_transparency
> 255)
7956 p_transparency
= 255;
7957 gui_mch_set_transparency(p_transparency
);
7961 else if (pp
== &curbuf
->b_p_iminsert
)
7963 if (curbuf
->b_p_iminsert
< 0 || curbuf
->b_p_iminsert
> B_IMODE_LAST
)
7966 curbuf
->b_p_iminsert
= B_IMODE_NONE
;
7968 p_iminsert
= curbuf
->b_p_iminsert
;
7969 if (termcap_active
) /* don't do this in the alternate screen */
7971 #if defined(FEAT_WINDOWS) && defined(FEAT_KEYMAP)
7972 /* Show/unshow value of 'keymap' in status lines. */
7973 status_redraw_curbuf();
7977 else if (pp
== &p_window
)
7981 else if (p_window
>= Rows
)
7982 p_window
= Rows
- 1;
7985 else if (pp
== &curbuf
->b_p_imsearch
)
7987 if (curbuf
->b_p_imsearch
< -1 || curbuf
->b_p_imsearch
> B_IMODE_LAST
)
7990 curbuf
->b_p_imsearch
= B_IMODE_NONE
;
7992 p_imsearch
= curbuf
->b_p_imsearch
;
7996 /* if 'titlelen' has changed, redraw the title */
7997 else if (pp
== &p_titlelen
)
8001 errmsg
= e_positive
;
8004 if (starting
!= NO_SCREEN
&& old_value
!= p_titlelen
)
8005 need_maketitle
= TRUE
;
8009 /* if p_ch changed value, change the command line height */
8010 else if (pp
== &p_ch
)
8014 errmsg
= e_positive
;
8017 if (p_ch
> Rows
- min_rows() + 1)
8018 p_ch
= Rows
- min_rows() + 1;
8020 /* Only compute the new window layout when startup has been
8021 * completed. Otherwise the frame sizes may be wrong. */
8022 if (p_ch
!= old_value
&& full_screen
8030 /* when 'updatecount' changes from zero to non-zero, open swap files */
8031 else if (pp
== &p_uc
)
8035 errmsg
= e_positive
;
8038 if (p_uc
&& !old_value
)
8041 #ifdef MZSCHEME_GUI_THREADS
8042 else if (pp
== &p_mzq
)
8043 mzvim_reset_timer();
8046 /* sync undo before 'undolevels' changes */
8047 else if (pp
== &p_ul
)
8049 /* use the old value, otherwise u_sync() may not work properly */
8055 #ifdef FEAT_LINEBREAK
8056 /* 'numberwidth' must be positive */
8057 else if (pp
== &curwin
->w_p_nuw
)
8059 if (curwin
->w_p_nuw
< 1)
8061 errmsg
= e_positive
;
8062 curwin
->w_p_nuw
= 1;
8064 if (curwin
->w_p_nuw
> 10)
8067 curwin
->w_p_nuw
= 10;
8069 curwin
->w_nrwidth_line_count
= 0;
8074 * Check the bounds for numeric options here
8076 if (Rows
< min_rows() && full_screen
)
8080 vim_snprintf((char *)errbuf
, errbuflen
,
8081 _("E593: Need at least %d lines"), min_rows());
8086 if (Columns
< MIN_COLUMNS
&& full_screen
)
8090 vim_snprintf((char *)errbuf
, errbuflen
,
8091 _("E594: Need at least %d columns"), MIN_COLUMNS
);
8094 Columns
= MIN_COLUMNS
;
8096 /* Limit the values to avoid an overflow in Rows * Columns. */
8097 if (Columns
> 10000)
8103 /* avoid a crash by checking for a too large value of 'columns' */
8104 if (old_Columns
!= Columns
&& full_screen
&& term_console
)
8105 mch_check_columns();
8109 * If the screen (shell) height has been changed, assume it is the
8110 * physical screenheight.
8112 if (old_Rows
!= Rows
|| old_Columns
!= Columns
)
8114 /* Changing the screen size is not allowed while updating the screen. */
8115 if (updating_screen
)
8117 else if (full_screen
8122 set_shellsize((int)Columns
, (int)Rows
, TRUE
);
8125 /* Postpone the resizing; check the size and cmdline position for
8128 if (cmdline_row
> Rows
- p_ch
&& Rows
> p_ch
)
8129 cmdline_row
= Rows
- p_ch
;
8131 if (p_window
>= Rows
|| !option_was_set((char_u
*)"window"))
8132 p_window
= Rows
- 1;
8135 if (curbuf
->b_p_sts
< 0)
8137 errmsg
= e_positive
;
8138 curbuf
->b_p_sts
= 0;
8140 if (curbuf
->b_p_ts
<= 0)
8142 errmsg
= e_positive
;
8145 if (curbuf
->b_p_tw
< 0)
8147 errmsg
= e_positive
;
8152 errmsg
= e_positive
;
8155 if ((curwin
->w_p_scr
<= 0
8156 || (curwin
->w_p_scr
> curwin
->w_height
8157 && curwin
->w_height
> 0))
8160 if (pp
== &(curwin
->w_p_scr
))
8162 if (curwin
->w_p_scr
!= 0)
8164 win_comp_scroll(curwin
);
8166 /* If 'scroll' became invalid because of a side effect silently adjust
8168 else if (curwin
->w_p_scr
<= 0)
8169 curwin
->w_p_scr
= 1;
8170 else /* curwin->w_p_scr > curwin->w_height */
8171 curwin
->w_p_scr
= curwin
->w_height
;
8175 errmsg
= e_positive
;
8180 errmsg
= e_positive
;
8183 if ((p_sj
< -100 || p_sj
>= Rows
) && full_screen
)
8185 if (Rows
!= old_Rows
) /* Rows changed, just adjust p_sj */
8193 if (p_so
< 0 && full_screen
)
8198 if (p_siso
< 0 && full_screen
)
8200 errmsg
= e_positive
;
8206 errmsg
= e_positive
;
8212 errmsg
= e_positive
;
8217 errmsg
= e_positive
;
8221 /* May set global value for local option. */
8222 if ((opt_flags
& (OPT_LOCAL
| OPT_GLOBAL
)) == 0)
8223 *(long *)get_varp_scope(&(options
[opt_idx
]), OPT_GLOBAL
) = *pp
;
8225 options
[opt_idx
].flags
|= P_WAS_SET
;
8227 comp_col(); /* in case 'columns' or 'ls' changed */
8228 if (curwin
->w_curswant
!= MAXCOL
)
8229 curwin
->w_set_curswant
= TRUE
; /* in case 'tabstop' changed */
8230 check_redraw(options
[opt_idx
].flags
);
8236 * Called after an option changed: check if something needs to be redrawn.
8242 /* Careful: P_RCLR and P_RALL are a combination of other P_ flags */
8243 int clear
= (flags
& P_RCLR
) == P_RCLR
;
8244 int all
= ((flags
& P_RALL
) == P_RALL
|| clear
);
8247 if ((flags
& P_RSTAT
) || all
) /* mark all status lines dirty */
8248 status_redraw_all();
8251 if ((flags
& P_RBUF
) || (flags
& P_RWIN
) || all
)
8252 changed_window_setting();
8254 redraw_curbuf_later(NOT_VALID
);
8256 redraw_all_later(CLEAR
);
8258 redraw_all_later(NOT_VALID
);
8262 * Find index for option 'arg'.
8263 * Return -1 if not found.
8271 static short quick_tab
[27] = {0, 0}; /* quick access table */
8275 * For first call: Initialize the quick-access table.
8276 * It contains the index for the first option that starts with a certain
8277 * letter. There are 26 letters, plus the first "t_" option.
8279 if (quick_tab
[1] == 0)
8281 p
= options
[0].fullname
;
8282 for (opt_idx
= 1; (s
= options
[opt_idx
].fullname
) != NULL
; opt_idx
++)
8286 if (s
[0] == 't' && s
[1] == '_')
8287 quick_tab
[26] = opt_idx
;
8289 quick_tab
[CharOrdLow(s
[0])] = opt_idx
;
8296 * Check for name starting with an illegal character.
8299 if (!islower(arg
[0]))
8301 if (arg
[0] < 'a' || arg
[0] > 'z')
8305 is_term_opt
= (arg
[0] == 't' && arg
[1] == '_');
8307 opt_idx
= quick_tab
[26];
8309 opt_idx
= quick_tab
[CharOrdLow(arg
[0])];
8310 for ( ; (s
= options
[opt_idx
].fullname
) != NULL
; opt_idx
++)
8312 if (STRCMP(arg
, s
) == 0) /* match full name */
8315 if (s
== NULL
&& !is_term_opt
)
8317 opt_idx
= quick_tab
[CharOrdLow(arg
[0])];
8318 for ( ; options
[opt_idx
].fullname
!= NULL
; opt_idx
++)
8320 s
= options
[opt_idx
].shortname
;
8321 if (s
!= NULL
&& STRCMP(arg
, s
) == 0) /* match short name */
8331 #if defined(FEAT_EVAL) || defined(FEAT_TCL) || defined(FEAT_MZSCHEME)
8333 * Get the value for an option.
8336 * Number or Toggle option: 1, *numval gets value.
8337 * String option: 0, *stringval gets allocated string.
8338 * Hidden Number or Toggle option: -1.
8339 * hidden String option: -2.
8340 * unknown option: -3.
8343 get_option_value(name
, numval
, stringval
, opt_flags
)
8346 char_u
**stringval
; /* NULL when only checking existance */
8352 opt_idx
= findoption(name
);
8353 if (opt_idx
< 0) /* unknown option */
8356 varp
= get_varp_scope(&(options
[opt_idx
]), opt_flags
);
8358 if (options
[opt_idx
].flags
& P_STRING
)
8360 if (varp
== NULL
) /* hidden option */
8362 if (stringval
!= NULL
)
8365 /* never return the value of the crypt key */
8366 if ((char_u
**)varp
== &curbuf
->b_p_key
8367 && **(char_u
**)(varp
) != NUL
)
8368 *stringval
= vim_strsave((char_u
*)"*****");
8371 *stringval
= vim_strsave(*(char_u
**)(varp
));
8376 if (varp
== NULL
) /* hidden option */
8378 if (options
[opt_idx
].flags
& P_NUM
)
8379 *numval
= *(long *)varp
;
8382 /* Special case: 'modified' is b_changed, but we also want to consider
8383 * it set when 'ff' or 'fenc' changed. */
8384 if ((int *)varp
== &curbuf
->b_changed
)
8385 *numval
= curbufIsChanged();
8387 *numval
= *(int *)varp
;
8394 * Set the value of option "name".
8395 * Use "string" for string options, use "number" for other options.
8398 set_option_value(name
, number
, string
, opt_flags
)
8402 int opt_flags
; /* OPT_LOCAL or 0 (both) */
8408 opt_idx
= findoption(name
);
8410 EMSG2(_("E355: Unknown option: %s"), name
);
8413 flags
= options
[opt_idx
].flags
;
8415 /* Disallow changing some options in the sandbox */
8416 if (sandbox
> 0 && (flags
& P_SECURE
))
8422 if (flags
& P_STRING
)
8423 set_string_option(opt_idx
, string
, opt_flags
);
8426 varp
= get_varp_scope(&(options
[opt_idx
]), opt_flags
);
8427 if (varp
!= NULL
) /* hidden option is not changed */
8429 if (number
== 0 && string
!= NULL
)
8433 /* Either we are given a string or we are setting option
8435 for (idx
= 0; string
[idx
] == '0'; ++idx
)
8437 if (string
[idx
] != NUL
|| idx
== 0)
8439 /* There's another character after zeros or the string
8440 * is empty. In both cases, we are trying to set a
8441 * num option using a string. */
8442 EMSG3(_("E521: Number required: &%s = '%s'"),
8444 return; /* do nothing as we hit an error */
8449 (void)set_num_option(opt_idx
, varp
, number
,
8450 NULL
, 0, opt_flags
);
8452 (void)set_bool_option(opt_idx
, varp
, (int)number
,
8460 * Get the terminal code for a terminal option.
8461 * Returns NULL when not found.
8464 get_term_code(tname
)
8470 if (tname
[0] != 't' || tname
[1] != '_' ||
8471 tname
[2] == NUL
|| tname
[3] == NUL
)
8473 if ((opt_idx
= findoption(tname
)) >= 0)
8475 varp
= get_varp(&(options
[opt_idx
]));
8477 varp
= *(char_u
**)(varp
);
8480 return find_termcode(tname
+ 2);
8484 get_highlight_default()
8488 i
= findoption((char_u
*)"hl");
8490 return options
[i
].def_val
[VI_DEFAULT
];
8491 return (char_u
*)NULL
;
8494 #if defined(FEAT_MBYTE) || defined(PROTO)
8496 get_encoding_default()
8500 i
= findoption((char_u
*)"enc");
8502 return options
[i
].def_val
[VI_DEFAULT
];
8503 return (char_u
*)NULL
;
8508 * Translate a string like "t_xx", "<t_xx>" or "<S-Tab>" to a key number.
8511 find_key_option(arg
)
8518 * Don't use get_special_key_code() for t_xx, we don't want it to call
8519 * add_termcap_entry().
8521 if (arg
[0] == 't' && arg
[1] == '_' && arg
[2] && arg
[3])
8522 key
= TERMCAP2KEY(arg
[2], arg
[3]);
8525 --arg
; /* put arg at the '<' */
8527 key
= find_special_key(&arg
, &modifiers
, TRUE
, TRUE
);
8528 if (modifiers
) /* can't handle modifiers here */
8535 * if 'all' == 0: show changed options
8536 * if 'all' == 1: show all normal options
8537 * if 'all' == 2: show all terminal options
8540 showoptions(all
, opt_flags
)
8542 int opt_flags
; /* OPT_LOCAL and/or OPT_GLOBAL */
8544 struct vimoption
*p
;
8548 struct vimoption
**items
;
8559 items
= (struct vimoption
**)alloc((unsigned)(sizeof(struct vimoption
*) *
8564 /* Highlight title */
8566 MSG_PUTS_TITLE(_("\n--- Terminal codes ---"));
8567 else if (opt_flags
& OPT_GLOBAL
)
8568 MSG_PUTS_TITLE(_("\n--- Global option values ---"));
8569 else if (opt_flags
& OPT_LOCAL
)
8570 MSG_PUTS_TITLE(_("\n--- Local option values ---"));
8572 MSG_PUTS_TITLE(_("\n--- Options ---"));
8575 * do the loop two times:
8576 * 1. display the short items
8577 * 2. display the long items (only strings and numbers)
8579 for (run
= 1; run
<= 2 && !got_int
; ++run
)
8582 * collect the items in items[]
8585 for (p
= &options
[0]; p
->fullname
!= NULL
; p
++)
8588 isterm
= istermoption(p
);
8591 if (p
->indir
!= PV_NONE
&& !isterm
)
8592 varp
= get_varp_scope(p
, opt_flags
);
8597 && ((all
== 2 && isterm
)
8598 || (all
== 1 && !isterm
)
8599 || (all
== 0 && !optval_default(p
, varp
))))
8601 if (p
->flags
& P_BOOL
)
8602 len
= 1; /* a toggle option fits always */
8605 option_value2string(p
, opt_flags
);
8606 len
= (int)STRLEN(p
->fullname
) + vim_strsize(NameBuff
) + 1;
8608 if ((len
<= INC
- GAP
&& run
== 1) ||
8609 (len
> INC
- GAP
&& run
== 2))
8610 items
[item_count
++] = p
;
8619 cols
= (Columns
+ GAP
- 3) / INC
;
8622 rows
= (item_count
+ cols
- 1) / cols
;
8626 for (row
= 0; row
< rows
&& !got_int
; ++row
)
8628 msg_putchar('\n'); /* go to next line */
8629 if (got_int
) /* 'q' typed in more */
8632 for (i
= row
; i
< item_count
; i
+= rows
)
8634 msg_col
= col
; /* make columns */
8635 showoneopt(items
[i
], opt_flags
);
8646 * Return TRUE if option "p" has its default value.
8649 optval_default(p
, varp
)
8650 struct vimoption
*p
;
8656 return TRUE
; /* hidden option is always at default */
8657 dvi
= ((p
->flags
& P_VI_DEF
) || p_cp
) ? VI_DEFAULT
: VIM_DEFAULT
;
8658 if (p
->flags
& P_NUM
)
8659 return (*(long *)varp
== (long)(long_i
)p
->def_val
[dvi
]);
8660 if (p
->flags
& P_BOOL
)
8661 /* the cast to long is required for Manx C, long_i is
8662 * needed for MSVC */
8663 return (*(int *)varp
== (int)(long)(long_i
)p
->def_val
[dvi
]);
8665 return (STRCMP(*(char_u
**)varp
, p
->def_val
[dvi
]) == 0);
8669 * showoneopt: show the value of one option
8670 * must not be called with a hidden option!
8673 showoneopt(p
, opt_flags
)
8674 struct vimoption
*p
;
8675 int opt_flags
; /* OPT_LOCAL or OPT_GLOBAL */
8678 int save_silent
= silent_mode
;
8680 silent_mode
= FALSE
;
8681 info_message
= TRUE
; /* use mch_msg(), not mch_errmsg() */
8683 varp
= get_varp_scope(p
, opt_flags
);
8685 /* for 'modified' we also need to check if 'ff' or 'fenc' changed. */
8686 if ((p
->flags
& P_BOOL
) && ((int *)varp
== &curbuf
->b_changed
8687 ? !curbufIsChanged() : !*(int *)varp
))
8689 else if ((p
->flags
& P_BOOL
) && *(int *)varp
< 0)
8693 MSG_PUTS(p
->fullname
);
8694 if (!(p
->flags
& P_BOOL
))
8697 /* put value string in NameBuff */
8698 option_value2string(p
, opt_flags
);
8699 msg_outtrans(NameBuff
);
8702 silent_mode
= save_silent
;
8703 info_message
= FALSE
;
8707 * Write modified options as ":set" commands to a file.
8709 * There are three values for "opt_flags":
8710 * OPT_GLOBAL: Write global option values and fresh values of
8711 * buffer-local options (used for start of a session
8713 * OPT_GLOBAL + OPT_LOCAL: Idem, add fresh values of window-local options for
8714 * curwin (used for a vimrc file).
8715 * OPT_LOCAL: Write buffer-local option values for curbuf, fresh
8716 * and local values for window-local options of
8717 * curwin. Local values are also written when at the
8718 * default value, because a modeline or autocommand
8719 * may have set them when doing ":edit file" and the
8720 * user has set them back at the default or fresh
8722 * When "local_only" is TRUE, don't write fresh
8723 * values, only local values (for ":mkview").
8724 * (fresh value = value used for a new buffer or window for a local option).
8726 * Return FAIL on error, OK otherwise.
8729 makeset(fd
, opt_flags
, local_only
)
8734 struct vimoption
*p
;
8735 char_u
*varp
; /* currently used value */
8736 char_u
*varp_fresh
; /* local value */
8737 char_u
*varp_local
= NULL
; /* fresh value */
8743 * The options that don't have a default (terminal name, columns, lines)
8744 * are never written. Terminal options are also not written.
8745 * Do the loop over "options[]" twice: once for options with the
8746 * P_PRI_MKRC flag and once without.
8748 for (pri
= 1; pri
>= 0; --pri
)
8750 for (p
= &options
[0]; !istermoption(p
); p
++)
8751 if (!(p
->flags
& P_NO_MKRC
)
8753 && ((pri
== 1) == ((p
->flags
& P_PRI_MKRC
) != 0)))
8755 /* skip global option when only doing locals */
8756 if (p
->indir
== PV_NONE
&& !(opt_flags
& OPT_GLOBAL
))
8759 /* Do not store options like 'bufhidden' and 'syntax' in a vimrc
8760 * file, they are always buffer-specific. */
8761 if ((opt_flags
& OPT_GLOBAL
) && (p
->flags
& P_NOGLOB
))
8764 /* Global values are only written when not at the default value. */
8765 varp
= get_varp_scope(p
, opt_flags
);
8766 if ((opt_flags
& OPT_GLOBAL
) && optval_default(p
, varp
))
8770 if (p
->indir
!= PV_NONE
)
8772 if (p
->var
== VAR_WIN
)
8774 /* skip window-local option when only doing globals */
8775 if (!(opt_flags
& OPT_LOCAL
))
8777 /* When fresh value of window-local option is not at the
8778 * default, need to write it too. */
8779 if (!(opt_flags
& OPT_GLOBAL
) && !local_only
)
8781 varp_fresh
= get_varp_scope(p
, OPT_GLOBAL
);
8782 if (!optval_default(p
, varp_fresh
))
8792 /* Round 1: fresh value for window-local options.
8793 * Round 2: other values */
8794 for ( ; round
<= 2; varp
= varp_local
, ++round
)
8796 if (round
== 1 || (opt_flags
& OPT_GLOBAL
))
8801 if (p
->flags
& P_BOOL
)
8803 if (put_setbool(fd
, cmd
, p
->fullname
, *(int *)varp
) == FAIL
)
8806 else if (p
->flags
& P_NUM
)
8808 if (put_setnum(fd
, cmd
, p
->fullname
, (long *)varp
) == FAIL
)
8813 #if defined(FEAT_SYN_HL) || defined(FEAT_AUTOCMD)
8814 int do_endif
= FALSE
;
8816 /* Don't set 'syntax' and 'filetype' again if the value is
8817 * already right, avoids reloading the syntax file. */
8819 # if defined(FEAT_SYN_HL)
8821 # if defined(FEAT_AUTOCMD)
8825 # if defined(FEAT_AUTOCMD)
8830 if (fprintf(fd
, "if &%s != '%s'", p
->fullname
,
8831 *(char_u
**)(varp
)) < 0
8837 if (put_setstring(fd
, cmd
, p
->fullname
, (char_u
**)varp
,
8838 (p
->flags
& P_EXPAND
) != 0) == FAIL
)
8840 #if defined(FEAT_SYN_HL) || defined(FEAT_AUTOCMD)
8843 if (put_line(fd
, "endif") == FAIL
)
8854 #if defined(FEAT_FOLDING) || defined(PROTO)
8856 * Generate set commands for the local fold options only. Used when
8857 * 'sessionoptions' or 'viewoptions' contains "folds" but not "options".
8863 if (put_setstring(fd
, "setlocal", "fdm", &curwin
->w_p_fdm
, FALSE
) == FAIL
8865 || put_setstring(fd
, "setlocal", "fde", &curwin
->w_p_fde
, FALSE
)
8868 || put_setstring(fd
, "setlocal", "fmr", &curwin
->w_p_fmr
, FALSE
)
8870 || put_setstring(fd
, "setlocal", "fdi", &curwin
->w_p_fdi
, FALSE
)
8872 || put_setnum(fd
, "setlocal", "fdl", &curwin
->w_p_fdl
) == FAIL
8873 || put_setnum(fd
, "setlocal", "fml", &curwin
->w_p_fml
) == FAIL
8874 || put_setnum(fd
, "setlocal", "fdn", &curwin
->w_p_fdn
) == FAIL
8875 || put_setbool(fd
, "setlocal", "fen", curwin
->w_p_fen
) == FAIL
8884 put_setstring(fd
, cmd
, name
, valuep
, expand
)
8892 char_u buf
[MAXPATHL
];
8894 if (fprintf(fd
, "%s %s=", cmd
, name
) < 0)
8896 if (*valuep
!= NULL
)
8898 /* Output 'pastetoggle' as key names. For other
8899 * options some characters have to be escaped with
8900 * CTRL-V or backslash */
8901 if (valuep
== &p_pt
)
8905 if (put_escstr(fd
, str2special(&s
, FALSE
), 2) == FAIL
)
8910 home_replace(NULL
, *valuep
, buf
, MAXPATHL
, FALSE
);
8911 if (put_escstr(fd
, buf
, 2) == FAIL
)
8914 else if (put_escstr(fd
, *valuep
, 2) == FAIL
)
8917 if (put_eol(fd
) < 0)
8923 put_setnum(fd
, cmd
, name
, valuep
)
8931 if (fprintf(fd
, "%s %s=", cmd
, name
) < 0)
8933 if (wc_use_keyname((char_u
*)valuep
, &wc
))
8935 /* print 'wildchar' and 'wildcharm' as a key name */
8936 if (fputs((char *)get_special_key_name((int)wc
, 0), fd
) < 0)
8939 else if (fprintf(fd
, "%ld", *valuep
) < 0)
8941 if (put_eol(fd
) < 0)
8947 put_setbool(fd
, cmd
, name
, value
)
8953 if (value
< 0) /* global/local option using global value */
8955 if (fprintf(fd
, "%s %s%s", cmd
, value
? "" : "no", name
) < 0
8962 * Clear all the terminal options.
8963 * If the option has been allocated, free the memory.
8964 * Terminal options are never hidden or indirect.
8970 * Reset a few things before clearing the old options. This may cause
8971 * outputting a few things that the terminal doesn't understand, but the
8972 * screen will be cleared later, so this is OK.
8974 #ifdef FEAT_MOUSE_TTY
8975 mch_setmouse(FALSE
); /* switch mouse off */
8978 mch_restore_title(3); /* restore window titles */
8980 #if defined(FEAT_XCLIPBOARD) && defined(FEAT_GUI)
8981 /* When starting the GUI close the display opened for the clipboard.
8982 * After restoring the title, because that will need the display. */
8988 * Check if this is allowed now.
8990 if (can_end_termcap_mode(FALSE
) == TRUE
)
8992 stoptermcap(); /* stop termcap mode */
9000 struct vimoption
*p
;
9002 for (p
= &options
[0]; p
->fullname
!= NULL
; p
++)
9003 if (istermoption(p
))
9005 if (p
->flags
& P_ALLOCED
)
9006 free_string_option(*(char_u
**)(p
->var
));
9007 if (p
->flags
& P_DEF_ALLOCED
)
9008 free_string_option(p
->def_val
[VI_DEFAULT
]);
9009 *(char_u
**)(p
->var
) = empty_option
;
9010 p
->def_val
[VI_DEFAULT
] = empty_option
;
9011 p
->flags
&= ~(P_ALLOCED
|P_DEF_ALLOCED
);
9017 * Free the string for one term option, if it was allocated.
9018 * Set the string to empty_option and clear allocated flag.
9019 * "var" points to the option value.
9022 free_one_termoption(var
)
9025 struct vimoption
*p
;
9027 for (p
= &options
[0]; p
->fullname
!= NULL
; p
++)
9030 if (p
->flags
& P_ALLOCED
)
9031 free_string_option(*(char_u
**)(p
->var
));
9032 *(char_u
**)(p
->var
) = empty_option
;
9033 p
->flags
&= ~P_ALLOCED
;
9039 * Set the terminal option defaults to the current value.
9040 * Used after setting the terminal name.
9045 struct vimoption
*p
;
9047 for (p
= &options
[0]; p
->fullname
!= NULL
; p
++)
9049 if (istermoption(p
) && p
->def_val
[VI_DEFAULT
] != *(char_u
**)(p
->var
))
9051 if (p
->flags
& P_DEF_ALLOCED
)
9053 free_string_option(p
->def_val
[VI_DEFAULT
]);
9054 p
->flags
&= ~P_DEF_ALLOCED
;
9056 p
->def_val
[VI_DEFAULT
] = *(char_u
**)(p
->var
);
9057 if (p
->flags
& P_ALLOCED
)
9059 p
->flags
|= P_DEF_ALLOCED
;
9060 p
->flags
&= ~P_ALLOCED
; /* don't free the value now */
9067 * return TRUE if 'p' starts with 't_'
9071 struct vimoption
*p
;
9073 return (p
->fullname
[0] == 't' && p
->fullname
[1] == '_');
9077 * Compute columns for ruler and shown command. 'sc_col' is also used to
9078 * decide what the maximum length of a message on the status line can be.
9079 * If there is a status line for the last window, 'sc_col' is independent
9083 #define COL_RULER 17 /* columns needed by standard ruler */
9088 #if defined(FEAT_CMDL_INFO) && defined(FEAT_WINDOWS)
9089 int last_has_status
= (p_ls
== 2 || (p_ls
== 1 && firstwin
!= lastwin
));
9096 ru_col
= (ru_wid
? ru_wid
: COL_RULER
) + 1;
9098 ru_col
= COL_RULER
+ 1;
9100 /* no last status line, adjust sc_col */
9101 if (!last_has_status
)
9106 sc_col
+= SHOWCMD_COLS
;
9107 if (!p_ru
|| last_has_status
) /* no need for separating space */
9110 sc_col
= Columns
- sc_col
;
9111 ru_col
= Columns
- ru_col
;
9112 if (sc_col
<= 0) /* screen too narrow, will become a mess */
9123 * Get pointer to option variable, depending on local or global scope.
9126 get_varp_scope(p
, opt_flags
)
9127 struct vimoption
*p
;
9130 if ((opt_flags
& OPT_GLOBAL
) && p
->indir
!= PV_NONE
)
9132 if (p
->var
== VAR_WIN
)
9133 return (char_u
*)GLOBAL_WO(get_varp(p
));
9136 if ((opt_flags
& OPT_LOCAL
) && ((int)p
->indir
& PV_BOTH
))
9138 switch ((int)p
->indir
)
9140 #ifdef FEAT_QUICKFIX
9141 case PV_EFM
: return (char_u
*)&(curbuf
->b_p_efm
);
9142 case PV_GP
: return (char_u
*)&(curbuf
->b_p_gp
);
9143 case PV_MP
: return (char_u
*)&(curbuf
->b_p_mp
);
9145 case PV_EP
: return (char_u
*)&(curbuf
->b_p_ep
);
9146 case PV_KP
: return (char_u
*)&(curbuf
->b_p_kp
);
9147 case PV_PATH
: return (char_u
*)&(curbuf
->b_p_path
);
9148 case PV_AR
: return (char_u
*)&(curbuf
->b_p_ar
);
9149 case PV_TAGS
: return (char_u
*)&(curbuf
->b_p_tags
);
9151 case PV_DEF
: return (char_u
*)&(curbuf
->b_p_def
);
9152 case PV_INC
: return (char_u
*)&(curbuf
->b_p_inc
);
9154 #ifdef FEAT_INS_EXPAND
9155 case PV_DICT
: return (char_u
*)&(curbuf
->b_p_dict
);
9156 case PV_TSR
: return (char_u
*)&(curbuf
->b_p_tsr
);
9158 #if defined(FEAT_BEVAL) && defined(FEAT_EVAL)
9159 case PV_BEXPR
: return (char_u
*)&(curbuf
->b_p_bexpr
);
9162 case PV_STL
: return (char_u
*)&(curwin
->w_p_stl
);
9165 return NULL
; /* "cannot happen" */
9171 * Get pointer to option variable.
9175 struct vimoption
*p
;
9177 /* hidden option, always return NULL */
9181 switch ((int)p
->indir
)
9183 case PV_NONE
: return p
->var
;
9185 /* global option with local value: use local value if it's been set */
9186 case PV_EP
: return *curbuf
->b_p_ep
!= NUL
9187 ? (char_u
*)&curbuf
->b_p_ep
: p
->var
;
9188 case PV_KP
: return *curbuf
->b_p_kp
!= NUL
9189 ? (char_u
*)&curbuf
->b_p_kp
: p
->var
;
9190 case PV_PATH
: return *curbuf
->b_p_path
!= NUL
9191 ? (char_u
*)&(curbuf
->b_p_path
) : p
->var
;
9192 case PV_AR
: return curbuf
->b_p_ar
>= 0
9193 ? (char_u
*)&(curbuf
->b_p_ar
) : p
->var
;
9194 case PV_TAGS
: return *curbuf
->b_p_tags
!= NUL
9195 ? (char_u
*)&(curbuf
->b_p_tags
) : p
->var
;
9197 case PV_DEF
: return *curbuf
->b_p_def
!= NUL
9198 ? (char_u
*)&(curbuf
->b_p_def
) : p
->var
;
9199 case PV_INC
: return *curbuf
->b_p_inc
!= NUL
9200 ? (char_u
*)&(curbuf
->b_p_inc
) : p
->var
;
9202 #ifdef FEAT_INS_EXPAND
9203 case PV_DICT
: return *curbuf
->b_p_dict
!= NUL
9204 ? (char_u
*)&(curbuf
->b_p_dict
) : p
->var
;
9205 case PV_TSR
: return *curbuf
->b_p_tsr
!= NUL
9206 ? (char_u
*)&(curbuf
->b_p_tsr
) : p
->var
;
9208 #ifdef FEAT_QUICKFIX
9209 case PV_EFM
: return *curbuf
->b_p_efm
!= NUL
9210 ? (char_u
*)&(curbuf
->b_p_efm
) : p
->var
;
9211 case PV_GP
: return *curbuf
->b_p_gp
!= NUL
9212 ? (char_u
*)&(curbuf
->b_p_gp
) : p
->var
;
9213 case PV_MP
: return *curbuf
->b_p_mp
!= NUL
9214 ? (char_u
*)&(curbuf
->b_p_mp
) : p
->var
;
9216 #if defined(FEAT_BEVAL) && defined(FEAT_EVAL)
9217 case PV_BEXPR
: return *curbuf
->b_p_bexpr
!= NUL
9218 ? (char_u
*)&(curbuf
->b_p_bexpr
) : p
->var
;
9221 case PV_STL
: return *curwin
->w_p_stl
!= NUL
9222 ? (char_u
*)&(curwin
->w_p_stl
) : p
->var
;
9226 case PV_ARAB
: return (char_u
*)&(curwin
->w_p_arab
);
9228 case PV_LIST
: return (char_u
*)&(curwin
->w_p_list
);
9230 case PV_SPELL
: return (char_u
*)&(curwin
->w_p_spell
);
9233 case PV_CUC
: return (char_u
*)&(curwin
->w_p_cuc
);
9234 case PV_CUL
: return (char_u
*)&(curwin
->w_p_cul
);
9237 case PV_DIFF
: return (char_u
*)&(curwin
->w_p_diff
);
9240 case PV_FDC
: return (char_u
*)&(curwin
->w_p_fdc
);
9241 case PV_FEN
: return (char_u
*)&(curwin
->w_p_fen
);
9242 case PV_FDI
: return (char_u
*)&(curwin
->w_p_fdi
);
9243 case PV_FDL
: return (char_u
*)&(curwin
->w_p_fdl
);
9244 case PV_FDM
: return (char_u
*)&(curwin
->w_p_fdm
);
9245 case PV_FML
: return (char_u
*)&(curwin
->w_p_fml
);
9246 case PV_FDN
: return (char_u
*)&(curwin
->w_p_fdn
);
9248 case PV_FDE
: return (char_u
*)&(curwin
->w_p_fde
);
9249 case PV_FDT
: return (char_u
*)&(curwin
->w_p_fdt
);
9251 case PV_FMR
: return (char_u
*)&(curwin
->w_p_fmr
);
9253 case PV_NU
: return (char_u
*)&(curwin
->w_p_nu
);
9254 #ifdef FEAT_LINEBREAK
9255 case PV_NUW
: return (char_u
*)&(curwin
->w_p_nuw
);
9258 case PV_WFH
: return (char_u
*)&(curwin
->w_p_wfh
);
9260 #ifdef FEAT_VERTSPLIT
9261 case PV_WFW
: return (char_u
*)&(curwin
->w_p_wfw
);
9263 #if defined(FEAT_WINDOWS) && defined(FEAT_QUICKFIX)
9264 case PV_PVW
: return (char_u
*)&(curwin
->w_p_pvw
);
9266 #ifdef FEAT_RIGHTLEFT
9267 case PV_RL
: return (char_u
*)&(curwin
->w_p_rl
);
9268 case PV_RLC
: return (char_u
*)&(curwin
->w_p_rlc
);
9270 case PV_SCROLL
: return (char_u
*)&(curwin
->w_p_scr
);
9271 case PV_WRAP
: return (char_u
*)&(curwin
->w_p_wrap
);
9272 #ifdef FEAT_LINEBREAK
9273 case PV_LBR
: return (char_u
*)&(curwin
->w_p_lbr
);
9275 #ifdef FEAT_SCROLLBIND
9276 case PV_SCBIND
: return (char_u
*)&(curwin
->w_p_scb
);
9279 case PV_AI
: return (char_u
*)&(curbuf
->b_p_ai
);
9280 case PV_BIN
: return (char_u
*)&(curbuf
->b_p_bin
);
9282 case PV_BOMB
: return (char_u
*)&(curbuf
->b_p_bomb
);
9284 #if defined(FEAT_QUICKFIX)
9285 case PV_BH
: return (char_u
*)&(curbuf
->b_p_bh
);
9286 case PV_BT
: return (char_u
*)&(curbuf
->b_p_bt
);
9288 case PV_BL
: return (char_u
*)&(curbuf
->b_p_bl
);
9289 case PV_CI
: return (char_u
*)&(curbuf
->b_p_ci
);
9291 case PV_CIN
: return (char_u
*)&(curbuf
->b_p_cin
);
9292 case PV_CINK
: return (char_u
*)&(curbuf
->b_p_cink
);
9293 case PV_CINO
: return (char_u
*)&(curbuf
->b_p_cino
);
9295 #if defined(FEAT_SMARTINDENT) || defined(FEAT_CINDENT)
9296 case PV_CINW
: return (char_u
*)&(curbuf
->b_p_cinw
);
9298 #ifdef FEAT_COMMENTS
9299 case PV_COM
: return (char_u
*)&(curbuf
->b_p_com
);
9302 case PV_CMS
: return (char_u
*)&(curbuf
->b_p_cms
);
9304 #ifdef FEAT_INS_EXPAND
9305 case PV_CPT
: return (char_u
*)&(curbuf
->b_p_cpt
);
9307 #ifdef FEAT_COMPL_FUNC
9308 case PV_CFU
: return (char_u
*)&(curbuf
->b_p_cfu
);
9309 case PV_OFU
: return (char_u
*)&(curbuf
->b_p_ofu
);
9311 case PV_EOL
: return (char_u
*)&(curbuf
->b_p_eol
);
9312 case PV_ET
: return (char_u
*)&(curbuf
->b_p_et
);
9314 case PV_FENC
: return (char_u
*)&(curbuf
->b_p_fenc
);
9316 case PV_FF
: return (char_u
*)&(curbuf
->b_p_ff
);
9318 case PV_FT
: return (char_u
*)&(curbuf
->b_p_ft
);
9320 case PV_FO
: return (char_u
*)&(curbuf
->b_p_fo
);
9321 case PV_FLP
: return (char_u
*)&(curbuf
->b_p_flp
);
9322 case PV_IMI
: return (char_u
*)&(curbuf
->b_p_iminsert
);
9323 case PV_IMS
: return (char_u
*)&(curbuf
->b_p_imsearch
);
9324 case PV_INF
: return (char_u
*)&(curbuf
->b_p_inf
);
9325 case PV_ISK
: return (char_u
*)&(curbuf
->b_p_isk
);
9328 case PV_INEX
: return (char_u
*)&(curbuf
->b_p_inex
);
9331 #if defined(FEAT_CINDENT) && defined(FEAT_EVAL)
9332 case PV_INDE
: return (char_u
*)&(curbuf
->b_p_inde
);
9333 case PV_INDK
: return (char_u
*)&(curbuf
->b_p_indk
);
9336 case PV_FEX
: return (char_u
*)&(curbuf
->b_p_fex
);
9339 case PV_KEY
: return (char_u
*)&(curbuf
->b_p_key
);
9342 case PV_LISP
: return (char_u
*)&(curbuf
->b_p_lisp
);
9344 case PV_ML
: return (char_u
*)&(curbuf
->b_p_ml
);
9345 case PV_MPS
: return (char_u
*)&(curbuf
->b_p_mps
);
9346 case PV_MA
: return (char_u
*)&(curbuf
->b_p_ma
);
9348 case PV_MIG
: return (char_u
*)&(curbuf
->b_p_migemo
);
9350 case PV_MOD
: return (char_u
*)&(curbuf
->b_changed
);
9351 case PV_NF
: return (char_u
*)&(curbuf
->b_p_nf
);
9352 #ifdef FEAT_OSFILETYPE
9353 case PV_OFT
: return (char_u
*)&(curbuf
->b_p_oft
);
9355 case PV_PI
: return (char_u
*)&(curbuf
->b_p_pi
);
9357 case PV_QE
: return (char_u
*)&(curbuf
->b_p_qe
);
9359 case PV_RO
: return (char_u
*)&(curbuf
->b_p_ro
);
9360 #ifdef FEAT_SMARTINDENT
9361 case PV_SI
: return (char_u
*)&(curbuf
->b_p_si
);
9364 case PV_SN
: return (char_u
*)&(curbuf
->b_p_sn
);
9366 case PV_STS
: return (char_u
*)&(curbuf
->b_p_sts
);
9367 #ifdef FEAT_SEARCHPATH
9368 case PV_SUA
: return (char_u
*)&(curbuf
->b_p_sua
);
9370 case PV_SWF
: return (char_u
*)&(curbuf
->b_p_swf
);
9372 case PV_SMC
: return (char_u
*)&(curbuf
->b_p_smc
);
9373 case PV_SYN
: return (char_u
*)&(curbuf
->b_p_syn
);
9376 case PV_SPC
: return (char_u
*)&(curbuf
->b_p_spc
);
9377 case PV_SPF
: return (char_u
*)&(curbuf
->b_p_spf
);
9378 case PV_SPL
: return (char_u
*)&(curbuf
->b_p_spl
);
9380 case PV_SW
: return (char_u
*)&(curbuf
->b_p_sw
);
9381 case PV_TS
: return (char_u
*)&(curbuf
->b_p_ts
);
9382 case PV_TW
: return (char_u
*)&(curbuf
->b_p_tw
);
9383 case PV_TX
: return (char_u
*)&(curbuf
->b_p_tx
);
9384 case PV_WM
: return (char_u
*)&(curbuf
->b_p_wm
);
9386 case PV_KMAP
: return (char_u
*)&(curbuf
->b_p_keymap
);
9388 default: EMSG(_("E356: get_varp ERROR"));
9390 /* always return a valid pointer to avoid a crash! */
9391 return (char_u
*)&(curbuf
->b_p_wm
);
9395 * Get the value of 'equalprg', either the buffer-local one or the global one.
9400 if (*curbuf
->b_p_ep
== NUL
)
9402 return curbuf
->b_p_ep
;
9405 #if defined(FEAT_WINDOWS) || defined(PROTO)
9407 * Copy options from one window to another.
9408 * Used when splitting a window.
9411 win_copy_options(wp_from
, wp_to
)
9415 copy_winopt(&wp_from
->w_onebuf_opt
, &wp_to
->w_onebuf_opt
);
9416 copy_winopt(&wp_from
->w_allbuf_opt
, &wp_to
->w_allbuf_opt
);
9417 # ifdef FEAT_RIGHTLEFT
9419 /* Is this right? */
9420 wp_to
->w_farsi
= wp_from
->w_farsi
;
9427 * Copy the options from one winopt_T to another.
9428 * Doesn't free the old option values in "to", use clear_winopt() for that.
9429 * The 'scroll' option is not copied, because it depends on the window height.
9430 * The 'previewwindow' option is reset, there can be only one preview window.
9433 copy_winopt(from
, to
)
9438 to
->wo_arab
= from
->wo_arab
;
9440 to
->wo_list
= from
->wo_list
;
9441 to
->wo_nu
= from
->wo_nu
;
9442 #ifdef FEAT_LINEBREAK
9443 to
->wo_nuw
= from
->wo_nuw
;
9445 #ifdef FEAT_RIGHTLEFT
9446 to
->wo_rl
= from
->wo_rl
;
9447 to
->wo_rlc
= vim_strsave(from
->wo_rlc
);
9450 to
->wo_stl
= vim_strsave(from
->wo_stl
);
9452 to
->wo_wrap
= from
->wo_wrap
;
9453 #ifdef FEAT_LINEBREAK
9454 to
->wo_lbr
= from
->wo_lbr
;
9456 #ifdef FEAT_SCROLLBIND
9457 to
->wo_scb
= from
->wo_scb
;
9460 to
->wo_spell
= from
->wo_spell
;
9463 to
->wo_cuc
= from
->wo_cuc
;
9464 to
->wo_cul
= from
->wo_cul
;
9467 to
->wo_diff
= from
->wo_diff
;
9470 to
->wo_fdc
= from
->wo_fdc
;
9471 to
->wo_fen
= from
->wo_fen
;
9472 to
->wo_fdi
= vim_strsave(from
->wo_fdi
);
9473 to
->wo_fml
= from
->wo_fml
;
9474 to
->wo_fdl
= from
->wo_fdl
;
9475 to
->wo_fdm
= vim_strsave(from
->wo_fdm
);
9476 to
->wo_fdn
= from
->wo_fdn
;
9478 to
->wo_fde
= vim_strsave(from
->wo_fde
);
9479 to
->wo_fdt
= vim_strsave(from
->wo_fdt
);
9481 to
->wo_fmr
= vim_strsave(from
->wo_fmr
);
9483 check_winopt(to
); /* don't want NULL pointers */
9487 * Check string options in a window for a NULL value.
9490 check_win_options(win
)
9493 check_winopt(&win
->w_onebuf_opt
);
9494 check_winopt(&win
->w_allbuf_opt
);
9498 * Check for NULL pointers in a winopt_T and replace them with empty_option.
9502 winopt_T
*wop UNUSED
;
9505 check_string_option(&wop
->wo_fdi
);
9506 check_string_option(&wop
->wo_fdm
);
9508 check_string_option(&wop
->wo_fde
);
9509 check_string_option(&wop
->wo_fdt
);
9511 check_string_option(&wop
->wo_fmr
);
9513 #ifdef FEAT_RIGHTLEFT
9514 check_string_option(&wop
->wo_rlc
);
9517 check_string_option(&wop
->wo_stl
);
9522 * Free the allocated memory inside a winopt_T.
9526 winopt_T
*wop UNUSED
;
9529 clear_string_option(&wop
->wo_fdi
);
9530 clear_string_option(&wop
->wo_fdm
);
9532 clear_string_option(&wop
->wo_fde
);
9533 clear_string_option(&wop
->wo_fdt
);
9535 clear_string_option(&wop
->wo_fmr
);
9537 #ifdef FEAT_RIGHTLEFT
9538 clear_string_option(&wop
->wo_rlc
);
9541 clear_string_option(&wop
->wo_stl
);
9546 * Copy global option values to local options for one buffer.
9547 * Used when creating a new buffer and sometimes when entering a buffer.
9549 * BCO_ENTER We will enter the buf buffer.
9550 * BCO_ALWAYS Always copy the options, but only set b_p_initialized when
9552 * BCO_NOHELP Don't copy the values to a help buffer.
9555 buf_copy_options(buf
, flags
)
9559 int should_copy
= TRUE
;
9560 char_u
*save_p_isk
= NULL
; /* init for GCC */
9562 int did_isk
= FALSE
;
9565 * Don't do anything of the buffer is invalid.
9567 if (buf
== NULL
|| !buf_valid(buf
))
9571 * Skip this when the option defaults have not been set yet. Happens when
9572 * main() allocates the first buffer.
9577 * Always copy when entering and 'cpo' contains 'S'.
9578 * Don't copy when already initialized.
9579 * Don't copy when 'cpo' contains 's' and not entering.
9580 * 'S' BCO_ENTER initialized 's' should_copy
9582 * yes no yes X FALSE
9588 if ((vim_strchr(p_cpo
, CPO_BUFOPTGLOB
) == NULL
|| !(flags
& BCO_ENTER
))
9589 && (buf
->b_p_initialized
9590 || (!(flags
& BCO_ENTER
)
9591 && vim_strchr(p_cpo
, CPO_BUFOPT
) != NULL
)))
9592 should_copy
= FALSE
;
9594 if (should_copy
|| (flags
& BCO_ALWAYS
))
9596 /* Don't copy the options specific to a help buffer when
9597 * BCO_NOHELP is given or the options were initialized already
9598 * (jumping back to a help file with CTRL-T or CTRL-O) */
9599 dont_do_help
= ((flags
& BCO_NOHELP
) && buf
->b_help
)
9600 || buf
->b_p_initialized
;
9601 if (dont_do_help
) /* don't free b_p_isk */
9603 save_p_isk
= buf
->b_p_isk
;
9604 buf
->b_p_isk
= NULL
;
9607 * Always free the allocated strings.
9608 * If not already initialized, set 'readonly' and copy 'fileformat'.
9610 if (!buf
->b_p_initialized
)
9612 free_buf_options(buf
, TRUE
);
9613 buf
->b_p_ro
= FALSE
; /* don't copy readonly */
9616 buf
->b_p_fenc
= vim_strsave(p_fenc
);
9618 buf
->b_p_ff
= vim_strsave(p_ff
);
9619 #if defined(FEAT_QUICKFIX)
9620 buf
->b_p_bh
= empty_option
;
9621 buf
->b_p_bt
= empty_option
;
9625 free_buf_options(buf
, FALSE
);
9628 buf
->b_p_ai_nopaste
= p_ai_nopaste
;
9631 buf
->b_p_tw_nopaste
= p_tw_nopaste
;
9632 buf
->b_p_tw_nobin
= p_tw_nobin
;
9634 buf
->b_p_wm_nopaste
= p_wm_nopaste
;
9635 buf
->b_p_wm_nobin
= p_wm_nobin
;
9636 buf
->b_p_bin
= p_bin
;
9638 buf
->b_p_bomb
= p_bomb
;
9641 buf
->b_p_et_nobin
= p_et_nobin
;
9643 buf
->b_p_ml_nobin
= p_ml_nobin
;
9644 buf
->b_p_inf
= p_inf
;
9645 buf
->b_p_swf
= p_swf
;
9646 #ifdef FEAT_INS_EXPAND
9647 buf
->b_p_cpt
= vim_strsave(p_cpt
);
9649 #ifdef FEAT_COMPL_FUNC
9650 buf
->b_p_cfu
= vim_strsave(p_cfu
);
9651 buf
->b_p_ofu
= vim_strsave(p_ofu
);
9653 buf
->b_p_sts
= p_sts
;
9654 buf
->b_p_sts_nopaste
= p_sts_nopaste
;
9658 #ifdef FEAT_COMMENTS
9659 buf
->b_p_com
= vim_strsave(p_com
);
9662 buf
->b_p_cms
= vim_strsave(p_cms
);
9664 buf
->b_p_fo
= vim_strsave(p_fo
);
9665 buf
->b_p_flp
= vim_strsave(p_flp
);
9666 buf
->b_p_nf
= vim_strsave(p_nf
);
9667 buf
->b_p_mps
= vim_strsave(p_mps
);
9668 #ifdef FEAT_SMARTINDENT
9673 buf
->b_p_cin
= p_cin
;
9674 buf
->b_p_cink
= vim_strsave(p_cink
);
9675 buf
->b_p_cino
= vim_strsave(p_cino
);
9678 /* Don't copy 'filetype', it must be detected */
9679 buf
->b_p_ft
= empty_option
;
9681 #ifdef FEAT_OSFILETYPE
9682 buf
->b_p_oft
= vim_strsave(p_oft
);
9685 #if defined(FEAT_SMARTINDENT) || defined(FEAT_CINDENT)
9686 buf
->b_p_cinw
= vim_strsave(p_cinw
);
9689 buf
->b_p_lisp
= p_lisp
;
9692 /* Don't copy 'syntax', it must be set */
9693 buf
->b_p_syn
= empty_option
;
9694 buf
->b_p_smc
= p_smc
;
9697 buf
->b_p_spc
= vim_strsave(p_spc
);
9698 (void)compile_cap_prog(buf
);
9699 buf
->b_p_spf
= vim_strsave(p_spf
);
9700 buf
->b_p_spl
= vim_strsave(p_spl
);
9702 #if defined(FEAT_CINDENT) && defined(FEAT_EVAL)
9703 buf
->b_p_inde
= vim_strsave(p_inde
);
9704 buf
->b_p_indk
= vim_strsave(p_indk
);
9706 #if defined(FEAT_EVAL)
9707 buf
->b_p_fex
= vim_strsave(p_fex
);
9710 buf
->b_p_key
= vim_strsave(p_key
);
9712 #ifdef FEAT_SEARCHPATH
9713 buf
->b_p_sua
= vim_strsave(p_sua
);
9716 buf
->b_p_keymap
= vim_strsave(p_keymap
);
9717 buf
->b_kmap_state
|= KEYMAP_INIT
;
9719 /* This isn't really an option, but copying the langmap and IME
9720 * state from the current buffer is better than resetting it. */
9721 buf
->b_p_iminsert
= p_iminsert
;
9722 buf
->b_p_imsearch
= p_imsearch
;
9725 /* This is migemo extension */
9726 buf
->b_p_migemo
= p_migemo
;
9729 /* options that are normally global but also have a local value
9730 * are not copied, start using the global value */
9732 #ifdef FEAT_QUICKFIX
9733 buf
->b_p_gp
= empty_option
;
9734 buf
->b_p_mp
= empty_option
;
9735 buf
->b_p_efm
= empty_option
;
9737 buf
->b_p_ep
= empty_option
;
9738 buf
->b_p_kp
= empty_option
;
9739 buf
->b_p_path
= empty_option
;
9740 buf
->b_p_tags
= empty_option
;
9742 buf
->b_p_def
= empty_option
;
9743 buf
->b_p_inc
= empty_option
;
9745 buf
->b_p_inex
= vim_strsave(p_inex
);
9748 #ifdef FEAT_INS_EXPAND
9749 buf
->b_p_dict
= empty_option
;
9750 buf
->b_p_tsr
= empty_option
;
9753 buf
->b_p_qe
= vim_strsave(p_qe
);
9755 #if defined(FEAT_BEVAL) && defined(FEAT_EVAL)
9756 buf
->b_p_bexpr
= empty_option
;
9760 * Don't copy the options set by ex_help(), use the saved values,
9761 * when going from a help buffer to a non-help buffer.
9762 * Don't touch these at all when BCO_NOHELP is used and going from
9763 * or to a help buffer.
9766 buf
->b_p_isk
= save_p_isk
;
9769 buf
->b_p_isk
= vim_strsave(p_isk
);
9772 buf
->b_help
= FALSE
;
9773 #ifdef FEAT_QUICKFIX
9774 if (buf
->b_p_bt
[0] == 'h')
9775 clear_string_option(&buf
->b_p_bt
);
9782 * When the options should be copied (ignoring BCO_ALWAYS), set the
9783 * flag that indicates that the options have been initialized.
9786 buf
->b_p_initialized
= TRUE
;
9789 check_buf_options(buf
); /* make sure we don't have NULLs */
9791 (void)buf_init_chartab(buf
, FALSE
);
9795 * Reset the 'modifiable' option and its default value.
9802 curbuf
->b_p_ma
= FALSE
;
9804 opt_idx
= findoption((char_u
*)"ma");
9806 options
[opt_idx
].def_val
[VI_DEFAULT
] = FALSE
;
9810 * Set the global value for 'iminsert' to the local value.
9813 set_iminsert_global()
9815 p_iminsert
= curbuf
->b_p_iminsert
;
9819 * Set the global value for 'imsearch' to the local value.
9822 set_imsearch_global()
9824 p_imsearch
= curbuf
->b_p_imsearch
;
9827 #if defined(FEAT_CMDL_COMPL) || defined(PROTO)
9828 static int expand_option_idx
= -1;
9829 static char_u expand_option_name
[5] = {'t', '_', NUL
, NUL
, NUL
};
9830 static int expand_option_flags
= 0;
9833 set_context_in_set_cmd(xp
, arg
, opt_flags
)
9836 int opt_flags
; /* OPT_GLOBAL and/or OPT_LOCAL */
9839 long_u flags
= 0; /* init for GCC */
9840 int opt_idx
= 0; /* init for GCC */
9843 int is_term_option
= FALSE
;
9846 expand_option_flags
= opt_flags
;
9848 xp
->xp_context
= EXPAND_SETTINGS
;
9851 xp
->xp_pattern
= arg
;
9854 p
= arg
+ STRLEN(arg
) - 1;
9855 if (*p
== ' ' && *(p
- 1) != '\\')
9857 xp
->xp_pattern
= p
+ 1;
9863 /* count number of backslashes before ' ' or ',' */
9864 if (*p
== ' ' || *p
== ',')
9866 while (s
> arg
&& *(s
- 1) == '\\')
9869 /* break at a space with an even number of backslashes */
9870 if (*p
== ' ' && ((p
- s
) & 1) == 0)
9877 if (STRNCMP(p
, "no", 2) == 0 && STRNCMP(p
, "novice", 6) != 0)
9879 xp
->xp_context
= EXPAND_BOOL_SETTINGS
;
9882 if (STRNCMP(p
, "inv", 3) == 0)
9884 xp
->xp_context
= EXPAND_BOOL_SETTINGS
;
9887 xp
->xp_pattern
= arg
= p
;
9891 if (*p
++ == NUL
) /* expand terminal option name */
9893 key
= get_special_key_code(arg
+ 1);
9894 if (key
== 0) /* unknown name */
9896 xp
->xp_context
= EXPAND_NOTHING
;
9900 is_term_option
= TRUE
;
9901 expand_option_name
[2] = KEY2TERMCAP0(key
);
9902 expand_option_name
[3] = KEY2TERMCAP1(key
);
9906 if (p
[0] == 't' && p
[1] == '_')
9912 return; /* expand option name */
9914 is_term_option
= TRUE
;
9915 expand_option_name
[2] = p
[-2];
9916 expand_option_name
[3] = p
[-1];
9920 /* Allow * wildcard */
9921 while (ASCII_ISALNUM(*p
) || *p
== '_' || *p
== '*')
9927 opt_idx
= findoption(arg
);
9929 if (opt_idx
== -1 || options
[opt_idx
].var
== NULL
)
9931 xp
->xp_context
= EXPAND_NOTHING
;
9934 flags
= options
[opt_idx
].flags
;
9937 xp
->xp_context
= EXPAND_NOTHING
;
9942 /* handle "-=" and "+=" */
9943 if ((nextchar
== '-' || nextchar
== '+' || nextchar
== '^') && p
[1] == '=')
9948 if ((nextchar
!= '=' && nextchar
!= ':')
9949 || xp
->xp_context
== EXPAND_BOOL_SETTINGS
)
9951 xp
->xp_context
= EXPAND_UNSUCCESSFUL
;
9954 if (xp
->xp_context
!= EXPAND_BOOL_SETTINGS
&& p
[1] == NUL
)
9956 xp
->xp_context
= EXPAND_OLD_SETTING
;
9958 expand_option_idx
= -1;
9960 expand_option_idx
= opt_idx
;
9961 xp
->xp_pattern
= p
+ 1;
9964 xp
->xp_context
= EXPAND_NOTHING
;
9965 if (is_term_option
|| (flags
& P_NUM
))
9968 xp
->xp_pattern
= p
+ 1;
9970 if (flags
& P_EXPAND
)
9972 p
= options
[opt_idx
].var
;
9973 if (p
== (char_u
*)&p_bdir
9974 || p
== (char_u
*)&p_dir
9975 || p
== (char_u
*)&p_path
9976 || p
== (char_u
*)&p_rtp
9977 #ifdef FEAT_SEARCHPATH
9978 || p
== (char_u
*)&p_cdpath
9981 || p
== (char_u
*)&p_vdir
9985 xp
->xp_context
= EXPAND_DIRECTORIES
;
9986 if (p
== (char_u
*)&p_path
9987 #ifdef FEAT_SEARCHPATH
9988 || p
== (char_u
*)&p_cdpath
9991 xp
->xp_backslash
= XP_BS_THREE
;
9993 xp
->xp_backslash
= XP_BS_ONE
;
9997 xp
->xp_context
= EXPAND_FILES
;
9998 /* for 'tags' need three backslashes for a space */
9999 if (p
== (char_u
*)&p_tags
)
10000 xp
->xp_backslash
= XP_BS_THREE
;
10002 xp
->xp_backslash
= XP_BS_ONE
;
10006 /* For an option that is a list of file names, find the start of the
10007 * last file name. */
10008 for (p
= arg
+ STRLEN(arg
) - 1; p
> xp
->xp_pattern
; --p
)
10010 /* count number of backslashes before ' ' or ',' */
10011 if (*p
== ' ' || *p
== ',')
10014 while (s
> xp
->xp_pattern
&& *(s
- 1) == '\\')
10016 if ((*p
== ' ' && (xp
->xp_backslash
== XP_BS_THREE
&& (p
- s
) < 3))
10017 || (*p
== ',' && (flags
& P_COMMA
) && ((p
- s
) & 1) == 0))
10019 xp
->xp_pattern
= p
+ 1;
10025 /* for 'spellsuggest' start at "file:" */
10026 if (options
[opt_idx
].var
== (char_u
*)&p_sps
10027 && STRNCMP(p
, "file:", 5) == 0)
10029 xp
->xp_pattern
= p
+ 5;
10039 ExpandSettings(xp
, regmatch
, num_file
, file
)
10041 regmatch_T
*regmatch
;
10045 int num_normal
= 0; /* Nr of matching non-term-code settings */
10046 int num_term
= 0; /* Nr of matching terminal code settings */
10053 char_u name_buf
[MAX_KEY_NAME_LEN
];
10054 static char *(names
[]) = {"all", "termcap"};
10055 int ic
= regmatch
->rm_ic
; /* remember the ignore-case flag */
10057 /* do this loop twice:
10058 * loop == 0: count the number of matching options
10059 * loop == 1: copy the matching options into allocated memory
10061 for (loop
= 0; loop
<= 1; ++loop
)
10063 regmatch
->rm_ic
= ic
;
10064 if (xp
->xp_context
!= EXPAND_BOOL_SETTINGS
)
10066 for (match
= 0; match
< (int)(sizeof(names
) / sizeof(char *));
10068 if (vim_regexec(regmatch
, (char_u
*)names
[match
], (colnr_T
)0))
10073 (*file
)[count
++] = vim_strsave((char_u
*)names
[match
]);
10076 for (opt_idx
= 0; (str
= (char_u
*)options
[opt_idx
].fullname
) != NULL
;
10079 if (options
[opt_idx
].var
== NULL
)
10081 if (xp
->xp_context
== EXPAND_BOOL_SETTINGS
10082 && !(options
[opt_idx
].flags
& P_BOOL
))
10084 is_term_opt
= istermoption(&options
[opt_idx
]);
10085 if (is_term_opt
&& num_normal
> 0)
10088 if (vim_regexec(regmatch
, str
, (colnr_T
)0)
10089 || (options
[opt_idx
].shortname
!= NULL
10090 && vim_regexec(regmatch
,
10091 (char_u
*)options
[opt_idx
].shortname
, (colnr_T
)0)))
10093 else if (is_term_opt
)
10098 name_buf
[3] = str
[2];
10099 name_buf
[4] = str
[3];
10102 if (vim_regexec(regmatch
, name_buf
, (colnr_T
)0))
10118 (*file
)[count
++] = vim_strsave(str
);
10122 * Check terminal key codes, these are not in the option table
10124 if (xp
->xp_context
!= EXPAND_BOOL_SETTINGS
&& num_normal
== 0)
10126 for (opt_idx
= 0; (str
= get_termcode(opt_idx
)) != NULL
; opt_idx
++)
10128 if (!isprint(str
[0]) || !isprint(str
[1]))
10133 name_buf
[2] = str
[0];
10134 name_buf
[3] = str
[1];
10138 if (vim_regexec(regmatch
, name_buf
, (colnr_T
)0))
10145 name_buf
[3] = str
[0];
10146 name_buf
[4] = str
[1];
10150 if (vim_regexec(regmatch
, name_buf
, (colnr_T
)0))
10158 (*file
)[count
++] = vim_strsave(name_buf
);
10163 * Check special key names.
10165 regmatch
->rm_ic
= TRUE
; /* ignore case here */
10166 for (opt_idx
= 0; (str
= get_key_name(opt_idx
)) != NULL
; opt_idx
++)
10169 STRCPY(name_buf
+ 1, str
);
10170 STRCAT(name_buf
, ">");
10172 if (vim_regexec(regmatch
, name_buf
, (colnr_T
)0))
10177 (*file
)[count
++] = vim_strsave(name_buf
);
10183 if (num_normal
> 0)
10184 *num_file
= num_normal
;
10185 else if (num_term
> 0)
10186 *num_file
= num_term
;
10189 *file
= (char_u
**)alloc((unsigned)(*num_file
* sizeof(char_u
*)));
10192 *file
= (char_u
**)"";
10201 ExpandOldSetting(num_file
, file
)
10205 char_u
*var
= NULL
; /* init for GCC */
10209 *file
= (char_u
**)alloc((unsigned)sizeof(char_u
*));
10214 * For a terminal key code expand_option_idx is < 0.
10216 if (expand_option_idx
< 0)
10218 var
= find_termcode(expand_option_name
+ 2);
10220 expand_option_idx
= findoption(expand_option_name
);
10223 if (expand_option_idx
>= 0)
10225 /* put string of option value in NameBuff */
10226 option_value2string(&options
[expand_option_idx
], expand_option_flags
);
10229 else if (var
== NULL
)
10230 var
= (char_u
*)"";
10232 /* A backslash is required before some characters. This is the reverse of
10233 * what happens in do_set(). */
10234 buf
= vim_strsave_escaped(var
, escape_chars
);
10243 #ifdef BACKSLASH_IN_FILENAME
10244 /* For MS-Windows et al. we don't double backslashes at the start and
10245 * before a file name character. */
10246 for (var
= buf
; *var
!= NUL
; mb_ptr_adv(var
))
10247 if (var
[0] == '\\' && var
[1] == '\\'
10248 && expand_option_idx
>= 0
10249 && (options
[expand_option_idx
].flags
& P_EXPAND
)
10250 && vim_isfilec(var
[2])
10251 && (var
[2] != '\\' || (var
== buf
&& var
[4] != '\\')))
10252 STRMOVE(var
, var
+ 1);
10262 * Get the value for the numeric or string option *opp in a nice format into
10263 * NameBuff[]. Must not be called with a hidden option!
10266 option_value2string(opp
, opt_flags
)
10267 struct vimoption
*opp
;
10268 int opt_flags
; /* OPT_GLOBAL and/or OPT_LOCAL */
10272 varp
= get_varp_scope(opp
, opt_flags
);
10274 if (opp
->flags
& P_NUM
)
10278 if (wc_use_keyname(varp
, &wc
))
10279 STRCPY(NameBuff
, get_special_key_name((int)wc
, 0));
10281 STRCPY(NameBuff
, transchar((int)wc
));
10283 sprintf((char *)NameBuff
, "%ld", *(long *)varp
);
10285 else /* P_STRING */
10287 varp
= *(char_u
**)(varp
);
10288 if (varp
== NULL
) /* just in case */
10291 /* don't show the actual value of 'key', only that it's set */
10292 else if (opp
->var
== (char_u
*)&p_key
&& *varp
)
10293 STRCPY(NameBuff
, "*****");
10295 else if (opp
->flags
& P_EXPAND
)
10296 home_replace(NULL
, varp
, NameBuff
, MAXPATHL
, FALSE
);
10297 /* Translate 'pastetoggle' into special key names */
10298 else if ((char_u
**)opp
->var
== &p_pt
)
10299 str2specialbuf(p_pt
, NameBuff
, MAXPATHL
);
10301 vim_strncpy(NameBuff
, varp
, MAXPATHL
- 1);
10306 * Return TRUE if "varp" points to 'wildchar' or 'wildcharm' and it can be
10307 * printed as a keyname.
10308 * "*wcp" is set to the value of the option if it's 'wildchar' or 'wildcharm'.
10311 wc_use_keyname(varp
, wcp
)
10315 if (((long *)varp
== &p_wc
) || ((long *)varp
== &p_wcm
))
10317 *wcp
= *(long *)varp
;
10318 if (IS_SPECIAL(*wcp
) || find_special_key_in_table((int)*wcp
) >= 0)
10324 #ifdef FEAT_LANGMAP
10326 * Any character has an equivalent 'langmap' character. This is used for
10327 * keyboards that have a special language mode that sends characters above
10328 * 128 (although other characters can be translated too). The "to" field is a
10329 * Vim command character. This avoids having to switch the keyboard back to
10330 * ASCII mode when leaving Insert mode.
10332 * langmap_mapchar[] maps any of 256 chars to an ASCII char used for Vim
10334 * When FEAT_MBYTE is defined langmap_mapga.ga_data is a sorted table of
10335 * langmap_entry_T. This does the same as langmap_mapchar[] for characters >=
10340 * With multi-byte support use growarray for 'langmap' chars >= 256
10348 static garray_T langmap_mapga
;
10349 static void langmap_set_entry
__ARGS((int from
, int to
));
10352 * Search for an entry in "langmap_mapga" for "from". If found set the "to"
10353 * field. If not found insert a new entry at the appropriate location.
10356 langmap_set_entry(from
, to
)
10360 langmap_entry_T
*entries
= (langmap_entry_T
*)(langmap_mapga
.ga_data
);
10362 int b
= langmap_mapga
.ga_len
;
10364 /* Do a binary search for an existing entry. */
10367 int i
= (a
+ b
) / 2;
10368 int d
= entries
[i
].from
- from
;
10372 entries
[i
].to
= to
;
10381 if (ga_grow(&langmap_mapga
, 1) != OK
)
10382 return; /* out of memory */
10384 /* insert new entry at position "a" */
10385 entries
= (langmap_entry_T
*)(langmap_mapga
.ga_data
) + a
;
10386 mch_memmove(entries
+ 1, entries
,
10387 (langmap_mapga
.ga_len
- a
) * sizeof(langmap_entry_T
));
10388 ++langmap_mapga
.ga_len
;
10389 entries
[0].from
= from
;
10390 entries
[0].to
= to
;
10394 * Apply 'langmap' to multi-byte character "c" and return the result.
10397 langmap_adjust_mb(c
)
10400 langmap_entry_T
*entries
= (langmap_entry_T
*)(langmap_mapga
.ga_data
);
10402 int b
= langmap_mapga
.ga_len
;
10406 int i
= (a
+ b
) / 2;
10407 int d
= entries
[i
].from
- c
;
10410 return entries
[i
].to
; /* found matching entry */
10416 return c
; /* no entry found, return "c" unmodified */
10425 for (i
= 0; i
< 256; i
++)
10426 langmap_mapchar
[i
] = i
; /* we init with a one-to-one map */
10428 ga_init2(&langmap_mapga
, sizeof(langmap_entry_T
), 8);
10433 * Called when langmap option is set; the language map can be
10434 * changed at any time!
10444 ga_clear(&langmap_mapga
); /* clear the previous map first */
10446 langmap_init(); /* back to one-to-one map */
10448 for (p
= p_langmap
; p
[0] != NUL
; )
10450 for (p2
= p
; p2
[0] != NUL
&& p2
[0] != ',' && p2
[0] != ';';
10453 if (p2
[0] == '\\' && p2
[1] != NUL
)
10457 ++p2
; /* abcd;ABCD form, p2 points to A */
10459 p2
= NULL
; /* aAbBcCdD form, p2 is NULL */
10462 if (p
[0] == '\\' && p
[1] != NUL
)
10465 from
= (*mb_ptr2char
)(p
);
10475 to
= (*mb_ptr2char
)(p
);
10485 to
= (*mb_ptr2char
)(p2
);
10492 EMSG2(_("E357: 'langmap': Matching character missing for %s"),
10499 langmap_set_entry(from
, to
);
10502 langmap_mapchar
[from
& 255] = to
;
10504 /* Advance to next pair */
10524 EMSG2(_("E358: 'langmap': Extra characters after semicolon: %s"), p
);
10538 * Return TRUE if format option 'x' is in effect.
10539 * Take care of no formatting when 'paste' is set.
10542 has_format_option(x
)
10547 return (vim_strchr(curbuf
->b_p_fo
, x
) != NULL
);
10551 * Return TRUE if "x" is present in 'shortmess' option, or
10552 * 'shortmess' contains 'a' and "x" is present in SHM_A.
10558 return ( vim_strchr(p_shm
, x
) != NULL
10559 || (vim_strchr(p_shm
, 'a') != NULL
10560 && vim_strchr((char_u
*)SHM_A
, x
) != NULL
));
10564 * paste_option_changed() - Called after p_paste was set or reset.
10567 paste_option_changed()
10569 static int old_p_paste
= FALSE
;
10570 static int save_sm
= 0;
10571 #ifdef FEAT_CMDL_INFO
10572 static int save_ru
= 0;
10574 #ifdef FEAT_RIGHTLEFT
10575 static int save_ri
= 0;
10576 static int save_hkmap
= 0;
10583 * Paste switched from off to on.
10584 * Save the current values, so they can be restored later.
10588 /* save options for each buffer */
10589 for (buf
= firstbuf
; buf
!= NULL
; buf
= buf
->b_next
)
10591 buf
->b_p_tw_nopaste
= buf
->b_p_tw
;
10592 buf
->b_p_wm_nopaste
= buf
->b_p_wm
;
10593 buf
->b_p_sts_nopaste
= buf
->b_p_sts
;
10594 buf
->b_p_ai_nopaste
= buf
->b_p_ai
;
10597 /* save global options */
10599 #ifdef FEAT_CMDL_INFO
10602 #ifdef FEAT_RIGHTLEFT
10604 save_hkmap
= p_hkmap
;
10606 /* save global values for local buffer options */
10607 p_tw_nopaste
= p_tw
;
10608 p_wm_nopaste
= p_wm
;
10609 p_sts_nopaste
= p_sts
;
10610 p_ai_nopaste
= p_ai
;
10614 * Always set the option values, also when 'paste' is set when it is
10617 /* set options for each buffer */
10618 for (buf
= firstbuf
; buf
!= NULL
; buf
= buf
->b_next
)
10620 buf
->b_p_tw
= 0; /* textwidth is 0 */
10621 buf
->b_p_wm
= 0; /* wrapmargin is 0 */
10622 buf
->b_p_sts
= 0; /* softtabstop is 0 */
10623 buf
->b_p_ai
= 0; /* no auto-indent */
10626 /* set global options */
10627 p_sm
= 0; /* no showmatch */
10628 #ifdef FEAT_CMDL_INFO
10629 # ifdef FEAT_WINDOWS
10631 status_redraw_all(); /* redraw to remove the ruler */
10633 p_ru
= 0; /* no ruler */
10635 #ifdef FEAT_RIGHTLEFT
10636 p_ri
= 0; /* no reverse insert */
10637 p_hkmap
= 0; /* no Hebrew keyboard */
10639 /* set global values for local buffer options */
10647 * Paste switched from on to off: Restore saved values.
10649 else if (old_p_paste
)
10651 /* restore options for each buffer */
10652 for (buf
= firstbuf
; buf
!= NULL
; buf
= buf
->b_next
)
10654 buf
->b_p_tw
= buf
->b_p_tw_nopaste
;
10655 buf
->b_p_wm
= buf
->b_p_wm_nopaste
;
10656 buf
->b_p_sts
= buf
->b_p_sts_nopaste
;
10657 buf
->b_p_ai
= buf
->b_p_ai_nopaste
;
10660 /* restore global options */
10662 #ifdef FEAT_CMDL_INFO
10663 # ifdef FEAT_WINDOWS
10664 if (p_ru
!= save_ru
)
10665 status_redraw_all(); /* redraw to draw the ruler */
10669 #ifdef FEAT_RIGHTLEFT
10671 p_hkmap
= save_hkmap
;
10673 /* set global values for local buffer options */
10674 p_tw
= p_tw_nopaste
;
10675 p_wm
= p_wm_nopaste
;
10676 p_sts
= p_sts_nopaste
;
10677 p_ai
= p_ai_nopaste
;
10680 old_p_paste
= p_paste
;
10684 * vimrc_found() - Called when a ".vimrc" or "VIMINIT" has been found.
10686 * Reset 'compatible' and set the values for options that didn't get set yet
10687 * to the Vim defaults.
10688 * Don't do this if the 'compatible' option has been set or reset before.
10689 * When "fname" is not NULL, use it to set $"envname" when it wasn't set yet.
10692 vimrc_found(fname
, envname
)
10697 int dofree
= FALSE
;
10700 if (!option_was_set((char_u
*)"cp"))
10703 for (opt_idx
= 0; !istermoption(&options
[opt_idx
]); opt_idx
++)
10704 if (!(options
[opt_idx
].flags
& (P_WAS_SET
|P_VI_DEF
)))
10705 set_option_default(opt_idx
, OPT_FREE
, FALSE
);
10711 p
= vim_getenv(envname
, &dofree
);
10714 /* Set $MYVIMRC to the first vimrc file found. */
10715 p
= FullName_save(fname
, FALSE
);
10718 vim_setenv(envname
, p
);
10728 * Set 'compatible' on or off. Called for "-C" and "-N" command line arg.
10731 change_compatible(on
)
10741 opt_idx
= findoption((char_u
*)"cp");
10743 options
[opt_idx
].flags
|= P_WAS_SET
;
10747 * Return TRUE when option "name" has been set.
10750 option_was_set(name
)
10755 idx
= findoption(name
);
10756 if (idx
< 0) /* unknown option */
10758 if (options
[idx
].flags
& P_WAS_SET
)
10764 * compatible_set() - Called when 'compatible' has been set or unset.
10766 * When 'compatible' set: Set all relevant options (those that have the P_VIM)
10767 * flag) to a Vi compatible value.
10768 * When 'compatible' is unset: Set all options that have a different default
10769 * for Vim (without the P_VI_DEF flag) to that default.
10776 for (opt_idx
= 0; !istermoption(&options
[opt_idx
]); opt_idx
++)
10777 if ( ((options
[opt_idx
].flags
& P_VIM
) && p_cp
)
10778 || (!(options
[opt_idx
].flags
& P_VI_DEF
) && !p_cp
))
10779 set_option_default(opt_idx
, OPT_FREE
, p_cp
);
10783 #ifdef FEAT_LINEBREAK
10785 # if defined(__BORLANDC__) && (__BORLANDC__ < 0x500)
10786 /* Borland C++ screws up loop optimisation here (negri) */
10787 #pragma option -O-l
10791 * fill_breakat_flags() -- called when 'breakat' changes value.
10794 fill_breakat_flags()
10799 for (i
= 0; i
< 256; i
++)
10800 breakat_flags
[i
] = FALSE
;
10802 if (p_breakat
!= NULL
)
10803 for (p
= p_breakat
; *p
; p
++)
10804 breakat_flags
[*p
] = TRUE
;
10807 # if defined(__BORLANDC__) && (__BORLANDC__ < 0x500)
10808 #pragma option -O.l
10814 * Check an option that can be a range of string values.
10816 * Return OK for correct value, FAIL otherwise.
10817 * Empty is always OK.
10820 check_opt_strings(val
, values
, list
)
10823 int list
; /* when TRUE: accept a list of values */
10825 return opt_strings_flags(val
, values
, NULL
, list
);
10829 * Handle an option that can be a range of string values.
10830 * Set a flag in "*flagp" for each string present.
10832 * Return OK for correct value, FAIL otherwise.
10833 * Empty is always OK.
10836 opt_strings_flags(val
, values
, flagp
, list
)
10837 char_u
*val
; /* new value */
10838 char **values
; /* array of valid string values */
10840 int list
; /* when TRUE: accept a list of values */
10844 unsigned new_flags
= 0;
10850 if (values
[i
] == NULL
) /* val not found in values[] */
10853 len
= (int)STRLEN(values
[i
]);
10854 if (STRNCMP(values
[i
], val
, len
) == 0
10855 && ((list
&& val
[len
] == ',') || val
[len
] == NUL
))
10857 val
+= len
+ (val
[len
] == ',');
10858 new_flags
|= (1 << i
);
10859 break; /* check next item in val list */
10864 *flagp
= new_flags
;
10870 * Read the 'wildmode' option, fill wim_flags[].
10875 char_u new_wim_flags
[4];
10880 for (i
= 0; i
< 4; ++i
)
10881 new_wim_flags
[i
] = 0;
10883 for (p
= p_wim
; *p
; ++p
)
10885 for (i
= 0; ASCII_ISALPHA(p
[i
]); ++i
)
10887 if (p
[i
] != NUL
&& p
[i
] != ',' && p
[i
] != ':')
10889 if (i
== 7 && STRNCMP(p
, "longest", 7) == 0)
10890 new_wim_flags
[idx
] |= WIM_LONGEST
;
10891 else if (i
== 4 && STRNCMP(p
, "full", 4) == 0)
10892 new_wim_flags
[idx
] |= WIM_FULL
;
10893 else if (i
== 4 && STRNCMP(p
, "list", 4) == 0)
10894 new_wim_flags
[idx
] |= WIM_LIST
;
10908 /* fill remaining entries with last flag */
10911 new_wim_flags
[idx
+ 1] = new_wim_flags
[idx
];
10915 /* only when there are no errors, wim_flags[] is changed */
10916 for (i
= 0; i
< 4; ++i
)
10917 wim_flags
[i
] = new_wim_flags
[i
];
10922 * Check if backspacing over something is allowed.
10926 int what
; /* BS_INDENT, BS_EOL or BS_START */
10930 case '2': return TRUE
;
10931 case '1': return (what
!= BS_START
);
10932 case '0': return FALSE
;
10934 return vim_strchr(p_bs
, what
) != NULL
;
10938 * Save the current values of 'fileformat' and 'fileencoding', so that we know
10939 * the file must be considered changed when the value is different.
10945 buf
->b_start_ffc
= *buf
->b_p_ff
;
10946 buf
->b_start_eol
= buf
->b_p_eol
;
10948 buf
->b_start_bomb
= buf
->b_p_bomb
;
10950 /* Only use free/alloc when necessary, they take time. */
10951 if (buf
->b_start_fenc
== NULL
10952 || STRCMP(buf
->b_start_fenc
, buf
->b_p_fenc
) != 0)
10954 vim_free(buf
->b_start_fenc
);
10955 buf
->b_start_fenc
= vim_strsave(buf
->b_p_fenc
);
10961 * Return TRUE if 'fileformat' and/or 'fileencoding' has a different value
10962 * from when editing started (save_file_ff() called).
10963 * Also when 'endofline' was changed and 'binary' is set, or when 'bomb' was
10964 * changed and 'binary' is not set.
10965 * Don't consider a new, empty buffer to be changed.
10968 file_ff_differs(buf
)
10971 /* In a buffer that was never loaded the options are not valid. */
10972 if (buf
->b_flags
& BF_NEVERLOADED
)
10974 if ((buf
->b_flags
& BF_NEW
)
10975 && buf
->b_ml
.ml_line_count
== 1
10976 && *ml_get_buf(buf
, (linenr_T
)1, FALSE
) == NUL
)
10978 if (buf
->b_start_ffc
!= *buf
->b_p_ff
)
10980 if (buf
->b_p_bin
&& buf
->b_start_eol
!= buf
->b_p_eol
)
10983 if (!buf
->b_p_bin
&& buf
->b_start_bomb
!= buf
->b_p_bomb
)
10985 if (buf
->b_start_fenc
== NULL
)
10986 return (*buf
->b_p_fenc
!= NUL
);
10987 return (STRCMP(buf
->b_start_fenc
, buf
->b_p_fenc
) != 0);
10994 * return OK if "p" is a valid fileformat name, FAIL otherwise.
11000 return check_opt_strings(p
, p_ff_values
, FALSE
);