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)
138 #define PV_ML OPT_BUF(BV_ML)
139 #define PV_MOD OPT_BUF(BV_MOD)
140 #define PV_MPS OPT_BUF(BV_MPS)
141 #define PV_NF OPT_BUF(BV_NF)
142 #ifdef FEAT_OSFILETYPE
143 # define PV_OFT OPT_BUF(BV_OFT)
145 #ifdef FEAT_COMPL_FUNC
146 # define PV_OFU OPT_BUF(BV_OFU)
148 #define PV_PATH OPT_BOTH(OPT_BUF(BV_PATH))
149 #define PV_PI OPT_BUF(BV_PI)
151 # define PV_QE OPT_BUF(BV_QE)
153 #define PV_RO OPT_BUF(BV_RO)
154 #ifdef FEAT_SMARTINDENT
155 # define PV_SI OPT_BUF(BV_SI)
158 # define PV_SN OPT_BUF(BV_SN)
161 # define PV_SMC OPT_BUF(BV_SMC)
162 # define PV_SYN OPT_BUF(BV_SYN)
165 # define PV_SPC OPT_BUF(BV_SPC)
166 # define PV_SPF OPT_BUF(BV_SPF)
167 # define PV_SPL OPT_BUF(BV_SPL)
169 #define PV_STS OPT_BUF(BV_STS)
170 #ifdef FEAT_SEARCHPATH
171 # define PV_SUA OPT_BUF(BV_SUA)
173 #define PV_SW OPT_BUF(BV_SW)
174 #define PV_SWF OPT_BUF(BV_SWF)
175 #define PV_TAGS OPT_BOTH(OPT_BUF(BV_TAGS))
176 #define PV_TS OPT_BUF(BV_TS)
177 #define PV_TW OPT_BUF(BV_TW)
178 #define PV_TX OPT_BUF(BV_TX)
179 #define PV_WM OPT_BUF(BV_WM)
182 * Definition of the PV_ values for window-local options.
183 * The WV_ values are defined in option.h.
185 #define PV_LIST OPT_WIN(WV_LIST)
187 # define PV_ARAB OPT_WIN(WV_ARAB)
189 #ifdef FEAT_LINEBREAK
190 # define PV_BRI OPT_WIN(WV_BRI)
191 # define PV_BRIMIN OPT_WIN(WV_BRIMIN)
192 # define PV_BRISHIFT OPT_WIN(WV_BRISHIFT)
195 # define PV_DIFF OPT_WIN(WV_DIFF)
198 # define PV_FDC OPT_WIN(WV_FDC)
199 # define PV_FEN OPT_WIN(WV_FEN)
200 # define PV_FDI OPT_WIN(WV_FDI)
201 # define PV_FDL OPT_WIN(WV_FDL)
202 # define PV_FDM OPT_WIN(WV_FDM)
203 # define PV_FML OPT_WIN(WV_FML)
204 # define PV_FDN OPT_WIN(WV_FDN)
206 # define PV_FDE OPT_WIN(WV_FDE)
207 # define PV_FDT OPT_WIN(WV_FDT)
209 # define PV_FMR OPT_WIN(WV_FMR)
211 #ifdef FEAT_LINEBREAK
212 # define PV_LBR OPT_WIN(WV_LBR)
214 #define PV_NU OPT_WIN(WV_NU)
215 #ifdef FEAT_LINEBREAK
216 # define PV_NUW OPT_WIN(WV_NUW)
218 #if defined(FEAT_WINDOWS) && defined(FEAT_QUICKFIX)
219 # define PV_PVW OPT_WIN(WV_PVW)
221 #ifdef FEAT_RIGHTLEFT
222 # define PV_RL OPT_WIN(WV_RL)
223 # define PV_RLC OPT_WIN(WV_RLC)
225 #ifdef FEAT_SCROLLBIND
226 # define PV_SCBIND OPT_WIN(WV_SCBIND)
228 #define PV_SCROLL OPT_WIN(WV_SCROLL)
230 # define PV_SPELL OPT_WIN(WV_SPELL)
233 # define PV_CUC OPT_WIN(WV_CUC)
234 # define PV_CUL OPT_WIN(WV_CUL)
237 # define PV_STL OPT_BOTH(OPT_WIN(WV_STL))
240 # define PV_WFH OPT_WIN(WV_WFH)
242 #ifdef FEAT_VERTSPLIT
243 # define PV_WFW OPT_WIN(WV_WFW)
245 #define PV_WRAP OPT_WIN(WV_WRAP)
248 /* WV_ and BV_ values get typecasted to this for the "indir" field */
252 PV_MAXVAL
= 0xffff /* to avoid warnings for value out of range */
256 * Options local to a window have a value local to a buffer and global to all
257 * buffers. Indicate this by setting "var" to VAR_WIN.
259 #define VAR_WIN ((char_u *)-1)
262 * These are the global values for options which are also local to a buffer.
263 * Only to be used in option.c!
270 #if defined(FEAT_QUICKFIX)
278 static char_u
*p_cink
;
279 static char_u
*p_cino
;
281 #if defined(FEAT_SMARTINDENT) || defined(FEAT_CINDENT)
282 static char_u
*p_cinw
;
285 static char_u
*p_com
;
288 static char_u
*p_cms
;
290 #ifdef FEAT_INS_EXPAND
291 static char_u
*p_cpt
;
293 #ifdef FEAT_COMPL_FUNC
294 static char_u
*p_cfu
;
295 static char_u
*p_ofu
;
300 static char_u
*p_fenc
;
304 static char_u
*p_flp
;
308 static long p_iminsert
;
309 static long p_imsearch
;
310 #if defined(FEAT_FIND_ID) && defined(FEAT_EVAL)
311 static char_u
*p_inex
;
313 #if defined(FEAT_CINDENT) && defined(FEAT_EVAL)
314 static char_u
*p_inde
;
315 static char_u
*p_indk
;
317 #if defined(FEAT_EVAL)
318 static char_u
*p_fex
;
321 static char_u
*p_isk
;
323 static char_u
*p_key
;
331 static char_u
*p_mps
;
333 #ifdef FEAT_OSFILETYPE
334 static char_u
*p_oft
;
341 #ifdef FEAT_SMARTINDENT
348 #if defined(FEAT_SEARCHPATH)
349 static char_u
*p_sua
;
355 static char_u
*p_syn
;
358 static char_u
*p_spc
;
359 static char_u
*p_spf
;
360 static char_u
*p_spl
;
367 static char_u
*p_keymap
;
370 /* Saved values for when 'bin' is set. */
371 static int p_et_nobin
;
372 static int p_ml_nobin
;
373 static long p_tw_nobin
;
374 static long p_wm_nobin
;
376 /* Saved values for when 'paste' is set */
377 static long p_tw_nopaste
;
378 static long p_wm_nopaste
;
379 static long p_sts_nopaste
;
380 static int p_ai_nopaste
;
384 char *fullname
; /* full option name */
385 char *shortname
; /* permissible abbreviation */
386 long_u flags
; /* see below */
387 char_u
*var
; /* global option: pointer to variable;
388 * window-local option: VAR_WIN;
389 * buffer-local option: global value */
390 idopt_T indir
; /* global option: PV_NONE;
391 * local option: indirect option index */
392 char_u
*def_val
[2]; /* default values for variable (vi and vim) */
394 scid_T scriptID
; /* script in which the option was last set */
395 # define SCRIPTID_INIT , 0
397 # define SCRIPTID_INIT
401 #define VI_DEFAULT 0 /* def_val[VI_DEFAULT] is Vi default value */
402 #define VIM_DEFAULT 1 /* def_val[VIM_DEFAULT] is Vim default value */
407 #define P_BOOL 0x01 /* the option is boolean */
408 #define P_NUM 0x02 /* the option is numeric */
409 #define P_STRING 0x04 /* the option is a string */
410 #define P_ALLOCED 0x08 /* the string option is in allocated memory,
411 must use free_string_option() when
412 assigning new value. Not set if default is
414 #define P_EXPAND 0x10 /* environment expansion. NOTE: P_EXPAND can
415 never be used for local or hidden options! */
416 #define P_NODEFAULT 0x40 /* don't set to default value */
417 #define P_DEF_ALLOCED 0x80 /* default value is in allocated memory, must
418 use vim_free() when assigning new value */
419 #define P_WAS_SET 0x100 /* option has been set/reset */
420 #define P_NO_MKRC 0x200 /* don't include in :mkvimrc output */
421 #define P_VI_DEF 0x400 /* Use Vi default for Vim */
422 #define P_VIM 0x800 /* Vim option, reset when 'cp' set */
424 /* when option changed, what to display: */
425 #define P_RSTAT 0x1000 /* redraw status lines */
426 #define P_RWIN 0x2000 /* redraw current window */
427 #define P_RBUF 0x4000 /* redraw current buffer */
428 #define P_RALL 0x6000 /* redraw all windows */
429 #define P_RCLR 0x7000 /* clear and redraw all */
431 #define P_COMMA 0x8000 /* comma separated list */
432 #define P_NODUP 0x10000L/* don't allow duplicate strings */
433 #define P_FLAGLIST 0x20000L/* list of single-char flags */
435 #define P_SECURE 0x40000L/* cannot change in modeline or secure mode */
436 #define P_GETTEXT 0x80000L/* expand default value with _() */
437 #define P_NOGLOB 0x100000L/* do not use local value for global vimrc */
438 #define P_NFNAME 0x200000L/* only normal file name chars allowed */
439 #define P_INSECURE 0x400000L/* option was set from a modeline */
440 #define P_PRI_MKRC 0x800000L/* priority for :mkvimrc (setting option has
443 #define ISK_LATIN1 (char_u *)"@,48-57,_,192-255"
445 /* 'isprint' for latin1 is also used for MS-Windows cp1252, where 0x80 is used
446 * for the currency sign. */
447 #if defined(MSDOS) || defined(MSWIN) || defined(OS2)
448 # define ISP_LATIN1 (char_u *)"@,~-255"
450 # define ISP_LATIN1 (char_u *)"@,161-255"
453 /* The 16 bit MS-DOS version is low on space, make the string as short as
454 * possible when compiling with few features. */
455 #if defined(FEAT_DIFF) || defined(FEAT_FOLDING) || defined(FEAT_SPELL) \
456 || defined(FEAT_VERTSPLIT) || defined(FEAT_CLIPBOARD) \
457 || defined(FEAT_INS_EXPAND) || defined(FEAT_SYN_HL)
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,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"
460 # 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"
464 * options[] is initialized here.
465 * The order of the options MUST be alphabetic for ":set all" and findoption().
466 * All option names MUST start with a lowercase letter (for findoption()).
467 * Exception: "t_" options are at the end.
468 * The options with a NULL variable are 'hidden': a set command for them is
469 * ignored and they are not printed.
471 static struct vimoption
477 {"aleph", "al", P_NUM
|P_VI_DEF
,
478 #ifdef FEAT_RIGHTLEFT
479 (char_u
*)&p_aleph
, PV_NONE
,
481 (char_u
*)NULL
, PV_NONE
,
484 #if (defined(MSDOS) || defined(WIN3264) || defined(OS2)) && !defined(FEAT_GUI_W32)
489 (char_u
*)0L} SCRIPTID_INIT
},
490 {"antialias", "anti", P_BOOL
|P_VI_DEF
|P_VIM
|P_RCLR
,
491 #if defined(FEAT_GUI) && defined(MACOS_X)
492 (char_u
*)&p_antialias
, PV_NONE
,
493 {(char_u
*)FALSE
, (char_u
*)FALSE
}
495 (char_u
*)NULL
, PV_NONE
,
496 {(char_u
*)FALSE
, (char_u
*)FALSE
}
499 {"arabic", "arab", P_BOOL
|P_VI_DEF
|P_VIM
,
501 (char_u
*)VAR_WIN
, PV_ARAB
,
503 (char_u
*)NULL
, PV_NONE
,
505 {(char_u
*)FALSE
, (char_u
*)0L} SCRIPTID_INIT
},
506 {"arabicshape", "arshape", P_BOOL
|P_VI_DEF
|P_VIM
|P_RCLR
,
508 (char_u
*)&p_arshape
, PV_NONE
,
510 (char_u
*)NULL
, PV_NONE
,
512 {(char_u
*)TRUE
, (char_u
*)0L} SCRIPTID_INIT
},
513 {"allowrevins", "ari", P_BOOL
|P_VI_DEF
|P_VIM
,
514 #ifdef FEAT_RIGHTLEFT
515 (char_u
*)&p_ari
, PV_NONE
,
517 (char_u
*)NULL
, PV_NONE
,
519 {(char_u
*)FALSE
, (char_u
*)0L} SCRIPTID_INIT
},
520 {"altkeymap", "akm", P_BOOL
|P_VI_DEF
,
522 (char_u
*)&p_altkeymap
, PV_NONE
,
524 (char_u
*)NULL
, PV_NONE
,
526 {(char_u
*)FALSE
, (char_u
*)0L} SCRIPTID_INIT
},
527 {"ambiwidth", "ambw", P_STRING
|P_VI_DEF
|P_RCLR
,
528 #if defined(FEAT_MBYTE)
529 (char_u
*)&p_ambw
, PV_NONE
,
530 {(char_u
*)"single", (char_u
*)0L}
532 (char_u
*)NULL
, PV_NONE
,
533 {(char_u
*)0L, (char_u
*)0L}
536 #ifdef FEAT_AUTOCHDIR
537 {"autochdir", "acd", P_BOOL
|P_VI_DEF
,
538 (char_u
*)&p_acd
, PV_NONE
,
539 {(char_u
*)FALSE
, (char_u
*)0L} SCRIPTID_INIT
},
541 {"autoindent", "ai", P_BOOL
|P_VI_DEF
,
542 (char_u
*)&p_ai
, PV_AI
,
543 {(char_u
*)FALSE
, (char_u
*)0L} SCRIPTID_INIT
},
544 {"autoprint", "ap", P_BOOL
|P_VI_DEF
,
545 (char_u
*)NULL
, PV_NONE
,
546 {(char_u
*)FALSE
, (char_u
*)0L} SCRIPTID_INIT
},
547 {"autoread", "ar", P_BOOL
|P_VI_DEF
,
548 (char_u
*)&p_ar
, PV_AR
,
549 {(char_u
*)FALSE
, (char_u
*)0L} SCRIPTID_INIT
},
550 {"autowrite", "aw", P_BOOL
|P_VI_DEF
,
551 (char_u
*)&p_aw
, PV_NONE
,
552 {(char_u
*)FALSE
, (char_u
*)0L} SCRIPTID_INIT
},
553 {"autowriteall","awa", P_BOOL
|P_VI_DEF
,
554 (char_u
*)&p_awa
, PV_NONE
,
555 {(char_u
*)FALSE
, (char_u
*)0L} SCRIPTID_INIT
},
556 {"background", "bg", P_STRING
|P_VI_DEF
|P_RCLR
,
557 (char_u
*)&p_bg
, PV_NONE
,
559 #if (defined(MSDOS) || defined(OS2) || defined(WIN3264)) && !defined(FEAT_GUI)
564 (char_u
*)0L} SCRIPTID_INIT
},
565 {"backspace", "bs", P_STRING
|P_VI_DEF
|P_VIM
|P_COMMA
|P_NODUP
,
566 (char_u
*)&p_bs
, PV_NONE
,
567 {(char_u
*)"", (char_u
*)0L} SCRIPTID_INIT
},
568 {"backup", "bk", P_BOOL
|P_VI_DEF
|P_VIM
,
569 (char_u
*)&p_bk
, PV_NONE
,
570 {(char_u
*)FALSE
, (char_u
*)0L} SCRIPTID_INIT
},
571 {"backupcopy", "bkc", P_STRING
|P_VIM
|P_COMMA
|P_NODUP
,
572 (char_u
*)&p_bkc
, PV_NONE
,
574 {(char_u
*)"yes", (char_u
*)"auto"}
576 {(char_u
*)"auto", (char_u
*)"auto"}
579 {"backupdir", "bdir", P_STRING
|P_EXPAND
|P_VI_DEF
|P_COMMA
|P_NODUP
|P_SECURE
,
580 (char_u
*)&p_bdir
, PV_NONE
,
581 {(char_u
*)DFLT_BDIR
, (char_u
*)0L} SCRIPTID_INIT
},
582 {"backupext", "bex", P_STRING
|P_VI_DEF
|P_NFNAME
,
583 (char_u
*)&p_bex
, PV_NONE
,
590 (char_u
*)0L} SCRIPTID_INIT
},
591 {"backupskip", "bsk", P_STRING
|P_VI_DEF
|P_COMMA
,
593 (char_u
*)&p_bsk
, PV_NONE
,
594 {(char_u
*)"", (char_u
*)0L}
596 (char_u
*)NULL
, PV_NONE
,
597 {(char_u
*)0L, (char_u
*)0L}
601 {"balloondelay","bdlay",P_NUM
|P_VI_DEF
,
602 (char_u
*)&p_bdlay
, PV_NONE
,
603 {(char_u
*)600L, (char_u
*)0L} SCRIPTID_INIT
},
604 {"ballooneval", "beval",P_BOOL
|P_VI_DEF
|P_NO_MKRC
,
605 (char_u
*)&p_beval
, PV_NONE
,
606 {(char_u
*)FALSE
, (char_u
*)0L} SCRIPTID_INIT
},
608 {"balloonexpr", "bexpr", P_STRING
|P_ALLOCED
|P_VI_DEF
|P_VIM
,
609 (char_u
*)&p_bexpr
, PV_BEXPR
,
610 {(char_u
*)"", (char_u
*)0L} SCRIPTID_INIT
},
613 {"beautify", "bf", P_BOOL
|P_VI_DEF
,
614 (char_u
*)NULL
, PV_NONE
,
615 {(char_u
*)FALSE
, (char_u
*)0L} SCRIPTID_INIT
},
616 {"binary", "bin", P_BOOL
|P_VI_DEF
|P_RSTAT
,
617 (char_u
*)&p_bin
, PV_BIN
,
618 {(char_u
*)FALSE
, (char_u
*)0L} SCRIPTID_INIT
},
619 {"bioskey", "biosk",P_BOOL
|P_VI_DEF
,
621 (char_u
*)&p_biosk
, PV_NONE
,
623 (char_u
*)NULL
, PV_NONE
,
625 {(char_u
*)TRUE
, (char_u
*)0L} SCRIPTID_INIT
},
626 {"bomb", NULL
, P_BOOL
|P_NO_MKRC
|P_VI_DEF
|P_RSTAT
,
628 (char_u
*)&p_bomb
, PV_BOMB
,
630 (char_u
*)NULL
, PV_NONE
,
632 {(char_u
*)FALSE
, (char_u
*)0L} SCRIPTID_INIT
},
633 {"breakat", "brk", P_STRING
|P_VI_DEF
|P_RALL
|P_FLAGLIST
,
634 #ifdef FEAT_LINEBREAK
635 (char_u
*)&p_breakat
, PV_NONE
,
636 {(char_u
*)" \t!@*-+;:,./?", (char_u
*)0L}
638 (char_u
*)NULL
, PV_NONE
,
639 {(char_u
*)0L, (char_u
*)0L}
642 {"breakindent", "bri", P_BOOL
|P_VI_DEF
|P_VIM
|P_RWIN
,
643 #ifdef FEAT_LINEBREAK
644 (char_u
*)VAR_WIN
, PV_BRI
,
646 (char_u
*)NULL
, PV_NONE
,
648 {(char_u
*)FALSE
, (char_u
*)0L} SCRIPTID_INIT
},
649 {"breakindentmin", "brimin", P_NUM
|P_VI_DEF
|P_VIM
|P_RWIN
,
650 #ifdef FEAT_LINEBREAK
651 (char_u
*)VAR_WIN
, PV_BRIMIN
,
653 (char_u
*)NULL
, PV_NONE
,
655 {(char_u
*)20L, (char_u
*)20L} SCRIPTID_INIT
},
656 {"breakindentshift", "brishift", P_NUM
|P_VI_DEF
|P_VIM
|P_RWIN
,
657 #ifdef FEAT_LINEBREAK
658 (char_u
*)VAR_WIN
, PV_BRISHIFT
,
660 (char_u
*)NULL
, PV_NONE
,
662 {(char_u
*)0L, (char_u
*)0L} SCRIPTID_INIT
},
663 {"browsedir", "bsdir",P_STRING
|P_VI_DEF
,
665 (char_u
*)&p_bsdir
, PV_NONE
,
666 {(char_u
*)"last", (char_u
*)0L}
668 (char_u
*)NULL
, PV_NONE
,
669 {(char_u
*)0L, (char_u
*)0L}
672 {"bufhidden", "bh", P_STRING
|P_ALLOCED
|P_VI_DEF
|P_NOGLOB
,
673 #if defined(FEAT_QUICKFIX)
674 (char_u
*)&p_bh
, PV_BH
,
675 {(char_u
*)"", (char_u
*)0L}
677 (char_u
*)NULL
, PV_NONE
,
678 {(char_u
*)0L, (char_u
*)0L}
681 {"buflisted", "bl", P_BOOL
|P_VI_DEF
|P_NOGLOB
,
682 (char_u
*)&p_bl
, PV_BL
,
683 {(char_u
*)1L, (char_u
*)0L}
685 {"buftype", "bt", P_STRING
|P_ALLOCED
|P_VI_DEF
|P_NOGLOB
,
686 #if defined(FEAT_QUICKFIX)
687 (char_u
*)&p_bt
, PV_BT
,
688 {(char_u
*)"", (char_u
*)0L}
690 (char_u
*)NULL
, PV_NONE
,
691 {(char_u
*)0L, (char_u
*)0L}
694 {"casemap", "cmp", P_STRING
|P_VI_DEF
|P_COMMA
|P_NODUP
,
696 (char_u
*)&p_cmp
, PV_NONE
,
697 {(char_u
*)"internal,keepascii", (char_u
*)0L}
699 (char_u
*)NULL
, PV_NONE
,
700 {(char_u
*)0L, (char_u
*)0L}
703 {"cdpath", "cd", P_STRING
|P_EXPAND
|P_VI_DEF
|P_COMMA
|P_NODUP
,
704 #ifdef FEAT_SEARCHPATH
705 (char_u
*)&p_cdpath
, PV_NONE
,
706 {(char_u
*)",,", (char_u
*)0L}
708 (char_u
*)NULL
, PV_NONE
,
709 {(char_u
*)0L, (char_u
*)0L}
712 {"cedit", NULL
, P_STRING
,
714 (char_u
*)&p_cedit
, PV_NONE
,
715 {(char_u
*)"", (char_u
*)CTRL_F_STR
}
717 (char_u
*)NULL
, PV_NONE
,
718 {(char_u
*)0L, (char_u
*)0L}
721 {"charconvert", "ccv", P_STRING
|P_VI_DEF
|P_SECURE
,
722 #if defined(FEAT_MBYTE) && defined(FEAT_EVAL)
723 (char_u
*)&p_ccv
, PV_NONE
,
724 {(char_u
*)"", (char_u
*)0L}
726 (char_u
*)NULL
, PV_NONE
,
727 {(char_u
*)0L, (char_u
*)0L}
730 {"cindent", "cin", P_BOOL
|P_VI_DEF
|P_VIM
,
732 (char_u
*)&p_cin
, PV_CIN
,
734 (char_u
*)NULL
, PV_NONE
,
736 {(char_u
*)FALSE
, (char_u
*)0L} SCRIPTID_INIT
},
737 {"cinkeys", "cink", P_STRING
|P_ALLOCED
|P_VI_DEF
|P_COMMA
|P_NODUP
,
739 (char_u
*)&p_cink
, PV_CINK
,
740 {(char_u
*)"0{,0},0),:,0#,!^F,o,O,e", (char_u
*)0L}
742 (char_u
*)NULL
, PV_NONE
,
743 {(char_u
*)0L, (char_u
*)0L}
746 {"cinoptions", "cino", P_STRING
|P_ALLOCED
|P_VI_DEF
|P_COMMA
|P_NODUP
,
748 (char_u
*)&p_cino
, PV_CINO
,
750 (char_u
*)NULL
, PV_NONE
,
752 {(char_u
*)"", (char_u
*)0L} SCRIPTID_INIT
},
753 {"cinwords", "cinw", P_STRING
|P_ALLOCED
|P_VI_DEF
|P_COMMA
|P_NODUP
,
754 #if defined(FEAT_SMARTINDENT) || defined(FEAT_CINDENT)
755 (char_u
*)&p_cinw
, PV_CINW
,
756 {(char_u
*)"if,else,while,do,for,switch",
759 (char_u
*)NULL
, PV_NONE
,
760 {(char_u
*)0L, (char_u
*)0L}
763 {"clipboard", "cb", P_STRING
|P_VI_DEF
|P_COMMA
|P_NODUP
,
764 #ifdef FEAT_CLIPBOARD
765 (char_u
*)&p_cb
, PV_NONE
,
766 # ifdef FEAT_XCLIPBOARD
767 {(char_u
*)"autoselect,exclude:cons\\|linux",
770 {(char_u
*)"", (char_u
*)0L}
773 (char_u
*)NULL
, PV_NONE
,
774 {(char_u
*)"", (char_u
*)0L}
777 {"cmdheight", "ch", P_NUM
|P_VI_DEF
|P_RALL
,
778 (char_u
*)&p_ch
, PV_NONE
,
779 {(char_u
*)1L, (char_u
*)0L} SCRIPTID_INIT
},
780 {"cmdwinheight", "cwh", P_NUM
|P_VI_DEF
,
782 (char_u
*)&p_cwh
, PV_NONE
,
784 (char_u
*)NULL
, PV_NONE
,
786 {(char_u
*)7L, (char_u
*)0L} SCRIPTID_INIT
},
787 {"columns", "co", P_NUM
|P_NODEFAULT
|P_NO_MKRC
|P_VI_DEF
|P_RCLR
,
788 (char_u
*)&Columns
, PV_NONE
,
789 {(char_u
*)80L, (char_u
*)0L} SCRIPTID_INIT
},
790 {"comments", "com", P_STRING
|P_ALLOCED
|P_VI_DEF
|P_COMMA
|P_NODUP
,
792 (char_u
*)&p_com
, PV_COM
,
793 {(char_u
*)"s1:/*,mb:*,ex:*/,://,b:#,:%,:XCOMM,n:>,fb:-",
796 (char_u
*)NULL
, PV_NONE
,
797 {(char_u
*)0L, (char_u
*)0L}
800 {"commentstring", "cms", P_STRING
|P_ALLOCED
|P_VI_DEF
,
802 (char_u
*)&p_cms
, PV_CMS
,
803 {(char_u
*)"/*%s*/", (char_u
*)0L}
805 (char_u
*)NULL
, PV_NONE
,
806 {(char_u
*)0L, (char_u
*)0L}
809 /* P_PRI_MKRC isn't needed here, optval_default()
810 * always returns TRUE for 'compatible' */
811 {"compatible", "cp", P_BOOL
|P_RALL
,
812 (char_u
*)&p_cp
, PV_NONE
,
813 {(char_u
*)TRUE
, (char_u
*)FALSE
} SCRIPTID_INIT
},
814 {"complete", "cpt", P_STRING
|P_ALLOCED
|P_VI_DEF
|P_COMMA
|P_NODUP
,
815 #ifdef FEAT_INS_EXPAND
816 (char_u
*)&p_cpt
, PV_CPT
,
817 {(char_u
*)".,w,b,u,t,i", (char_u
*)0L}
819 (char_u
*)NULL
, PV_NONE
,
820 {(char_u
*)0L, (char_u
*)0L}
823 {"completefunc", "cfu", P_STRING
|P_ALLOCED
|P_VI_DEF
|P_SECURE
,
824 #ifdef FEAT_COMPL_FUNC
825 (char_u
*)&p_cfu
, PV_CFU
,
826 {(char_u
*)"", (char_u
*)0L}
828 (char_u
*)NULL
, PV_NONE
,
829 {(char_u
*)0L, (char_u
*)0L}
832 {"completeopt", "cot", P_STRING
|P_VI_DEF
|P_COMMA
|P_NODUP
,
833 #ifdef FEAT_INS_EXPAND
834 (char_u
*)&p_cot
, PV_NONE
,
835 {(char_u
*)"menu,preview", (char_u
*)0L}
837 (char_u
*)NULL
, PV_NONE
,
838 {(char_u
*)0L, (char_u
*)0L}
841 {"confirm", "cf", P_BOOL
|P_VI_DEF
,
842 #if defined(FEAT_GUI_DIALOG) || defined(FEAT_CON_DIALOG)
843 (char_u
*)&p_confirm
, PV_NONE
,
845 (char_u
*)NULL
, PV_NONE
,
847 {(char_u
*)FALSE
, (char_u
*)0L} SCRIPTID_INIT
},
848 {"conskey", "consk",P_BOOL
|P_VI_DEF
,
850 (char_u
*)&p_consk
, PV_NONE
,
852 (char_u
*)NULL
, PV_NONE
,
854 {(char_u
*)FALSE
, (char_u
*)0L} SCRIPTID_INIT
},
855 {"copyindent", "ci", P_BOOL
|P_VI_DEF
|P_VIM
,
856 (char_u
*)&p_ci
, PV_CI
,
857 {(char_u
*)FALSE
, (char_u
*)0L} SCRIPTID_INIT
},
858 {"cpoptions", "cpo", P_STRING
|P_VIM
|P_RALL
|P_FLAGLIST
,
859 (char_u
*)&p_cpo
, PV_NONE
,
860 {(char_u
*)CPO_VI
, (char_u
*)CPO_VIM
}
862 {"cscopepathcomp", "cspc", P_NUM
|P_VI_DEF
|P_VIM
,
864 (char_u
*)&p_cspc
, PV_NONE
,
866 (char_u
*)NULL
, PV_NONE
,
868 {(char_u
*)0L, (char_u
*)0L} SCRIPTID_INIT
},
869 {"cscopeprg", "csprg", P_STRING
|P_EXPAND
|P_VI_DEF
|P_SECURE
,
871 (char_u
*)&p_csprg
, PV_NONE
,
872 {(char_u
*)"cscope", (char_u
*)0L}
874 (char_u
*)NULL
, PV_NONE
,
875 {(char_u
*)0L, (char_u
*)0L}
878 {"cscopequickfix", "csqf", P_STRING
|P_VI_DEF
|P_COMMA
|P_NODUP
,
879 #if defined(FEAT_CSCOPE) && defined(FEAT_QUICKFIX)
880 (char_u
*)&p_csqf
, PV_NONE
,
881 {(char_u
*)"", (char_u
*)0L}
883 (char_u
*)NULL
, PV_NONE
,
884 {(char_u
*)0L, (char_u
*)0L}
887 {"cscopetag", "cst", P_BOOL
|P_VI_DEF
|P_VIM
,
889 (char_u
*)&p_cst
, PV_NONE
,
891 (char_u
*)NULL
, PV_NONE
,
893 {(char_u
*)0L, (char_u
*)0L} SCRIPTID_INIT
},
894 {"cscopetagorder", "csto", P_NUM
|P_VI_DEF
|P_VIM
,
896 (char_u
*)&p_csto
, PV_NONE
,
898 (char_u
*)NULL
, PV_NONE
,
900 {(char_u
*)0L, (char_u
*)0L} SCRIPTID_INIT
},
901 {"cscopeverbose", "csverb", P_BOOL
|P_VI_DEF
|P_VIM
,
903 (char_u
*)&p_csverbose
, PV_NONE
,
905 (char_u
*)NULL
, PV_NONE
,
907 {(char_u
*)0L, (char_u
*)0L} SCRIPTID_INIT
},
908 {"cursorcolumn", "cuc", P_BOOL
|P_VI_DEF
|P_RWIN
,
910 (char_u
*)VAR_WIN
, PV_CUC
,
912 (char_u
*)NULL
, PV_NONE
,
914 {(char_u
*)FALSE
, (char_u
*)0L} SCRIPTID_INIT
},
915 {"cursorline", "cul", P_BOOL
|P_VI_DEF
|P_RWIN
,
917 (char_u
*)VAR_WIN
, PV_CUL
,
919 (char_u
*)NULL
, PV_NONE
,
921 {(char_u
*)FALSE
, (char_u
*)0L} SCRIPTID_INIT
},
922 {"debug", NULL
, P_STRING
|P_VI_DEF
,
923 (char_u
*)&p_debug
, PV_NONE
,
924 {(char_u
*)"", (char_u
*)0L} SCRIPTID_INIT
},
925 {"define", "def", P_STRING
|P_ALLOCED
|P_VI_DEF
,
927 (char_u
*)&p_def
, PV_DEF
,
928 {(char_u
*)"^\\s*#\\s*define", (char_u
*)0L}
930 (char_u
*)NULL
, PV_NONE
,
931 {(char_u
*)NULL
, (char_u
*)0L}
934 {"delcombine", "deco", P_BOOL
|P_VI_DEF
|P_VIM
,
936 (char_u
*)&p_deco
, PV_NONE
,
938 (char_u
*)NULL
, PV_NONE
,
940 {(char_u
*)FALSE
, (char_u
*)0L} SCRIPTID_INIT
},
941 {"dictionary", "dict", P_STRING
|P_EXPAND
|P_VI_DEF
|P_COMMA
|P_NODUP
,
942 #ifdef FEAT_INS_EXPAND
943 (char_u
*)&p_dict
, PV_DICT
,
945 (char_u
*)NULL
, PV_NONE
,
947 {(char_u
*)"", (char_u
*)0L} SCRIPTID_INIT
},
948 {"diff", NULL
, P_BOOL
|P_VI_DEF
|P_RWIN
|P_NOGLOB
,
950 (char_u
*)VAR_WIN
, PV_DIFF
,
952 (char_u
*)NULL
, PV_NONE
,
954 {(char_u
*)FALSE
, (char_u
*)0L} SCRIPTID_INIT
},
955 {"diffexpr", "dex", P_STRING
|P_VI_DEF
|P_SECURE
,
956 #if defined(FEAT_DIFF) && defined(FEAT_EVAL)
957 (char_u
*)&p_dex
, PV_NONE
,
958 {(char_u
*)"", (char_u
*)0L}
960 (char_u
*)NULL
, PV_NONE
,
961 {(char_u
*)0L, (char_u
*)0L}
964 {"diffopt", "dip", P_STRING
|P_ALLOCED
|P_VI_DEF
|P_RWIN
|P_COMMA
|P_NODUP
,
966 (char_u
*)&p_dip
, PV_NONE
,
967 {(char_u
*)"filler", (char_u
*)NULL
}
969 (char_u
*)NULL
, PV_NONE
,
970 {(char_u
*)"", (char_u
*)NULL
}
973 {"digraph", "dg", P_BOOL
|P_VI_DEF
|P_VIM
,
975 (char_u
*)&p_dg
, PV_NONE
,
977 (char_u
*)NULL
, PV_NONE
,
979 {(char_u
*)FALSE
, (char_u
*)0L} SCRIPTID_INIT
},
980 {"directory", "dir", P_STRING
|P_EXPAND
|P_VI_DEF
|P_COMMA
|P_NODUP
|P_SECURE
,
981 (char_u
*)&p_dir
, PV_NONE
,
982 {(char_u
*)DFLT_DIR
, (char_u
*)0L} SCRIPTID_INIT
},
983 {"display", "dy", P_STRING
|P_VI_DEF
|P_COMMA
|P_RALL
|P_NODUP
,
984 (char_u
*)&p_dy
, PV_NONE
,
985 {(char_u
*)"", (char_u
*)0L} SCRIPTID_INIT
},
986 {"eadirection", "ead", P_STRING
|P_VI_DEF
,
987 #ifdef FEAT_VERTSPLIT
988 (char_u
*)&p_ead
, PV_NONE
,
989 {(char_u
*)"both", (char_u
*)0L}
991 (char_u
*)NULL
, PV_NONE
,
992 {(char_u
*)NULL
, (char_u
*)0L}
995 {"edcompatible","ed", P_BOOL
|P_VI_DEF
,
996 (char_u
*)&p_ed
, PV_NONE
,
997 {(char_u
*)FALSE
, (char_u
*)0L} SCRIPTID_INIT
},
998 {"encoding", "enc", P_STRING
|P_VI_DEF
|P_RCLR
,
1000 (char_u
*)&p_enc
, PV_NONE
,
1001 {(char_u
*)ENC_DFLT
, (char_u
*)0L}
1003 (char_u
*)NULL
, PV_NONE
,
1004 {(char_u
*)0L, (char_u
*)0L}
1007 {"endofline", "eol", P_BOOL
|P_NO_MKRC
|P_VI_DEF
|P_RSTAT
,
1008 (char_u
*)&p_eol
, PV_EOL
,
1009 {(char_u
*)TRUE
, (char_u
*)0L} SCRIPTID_INIT
},
1010 {"equalalways", "ea", P_BOOL
|P_VI_DEF
|P_RALL
,
1011 (char_u
*)&p_ea
, PV_NONE
,
1012 {(char_u
*)TRUE
, (char_u
*)0L} SCRIPTID_INIT
},
1013 {"equalprg", "ep", P_STRING
|P_EXPAND
|P_VI_DEF
|P_SECURE
,
1014 (char_u
*)&p_ep
, PV_EP
,
1015 {(char_u
*)"", (char_u
*)0L} SCRIPTID_INIT
},
1016 {"errorbells", "eb", P_BOOL
|P_VI_DEF
,
1017 (char_u
*)&p_eb
, PV_NONE
,
1018 {(char_u
*)FALSE
, (char_u
*)0L} SCRIPTID_INIT
},
1019 {"errorfile", "ef", P_STRING
|P_EXPAND
|P_VI_DEF
|P_SECURE
,
1020 #ifdef FEAT_QUICKFIX
1021 (char_u
*)&p_ef
, PV_NONE
,
1022 {(char_u
*)DFLT_ERRORFILE
, (char_u
*)0L}
1024 (char_u
*)NULL
, PV_NONE
,
1025 {(char_u
*)NULL
, (char_u
*)0L}
1028 {"errorformat", "efm", P_STRING
|P_VI_DEF
|P_COMMA
|P_NODUP
,
1029 #ifdef FEAT_QUICKFIX
1030 (char_u
*)&p_efm
, PV_EFM
,
1031 {(char_u
*)DFLT_EFM
, (char_u
*)0L}
1033 (char_u
*)NULL
, PV_NONE
,
1034 {(char_u
*)NULL
, (char_u
*)0L}
1037 {"esckeys", "ek", P_BOOL
|P_VIM
,
1038 (char_u
*)&p_ek
, PV_NONE
,
1039 {(char_u
*)FALSE
, (char_u
*)TRUE
} SCRIPTID_INIT
},
1040 {"eventignore", "ei", P_STRING
|P_VI_DEF
|P_COMMA
|P_NODUP
,
1042 (char_u
*)&p_ei
, PV_NONE
,
1044 (char_u
*)NULL
, PV_NONE
,
1046 {(char_u
*)"", (char_u
*)0L} SCRIPTID_INIT
},
1047 {"expandtab", "et", P_BOOL
|P_VI_DEF
|P_VIM
,
1048 (char_u
*)&p_et
, PV_ET
,
1049 {(char_u
*)FALSE
, (char_u
*)0L} SCRIPTID_INIT
},
1050 {"exrc", "ex", P_BOOL
|P_VI_DEF
|P_SECURE
,
1051 (char_u
*)&p_exrc
, PV_NONE
,
1052 {(char_u
*)FALSE
, (char_u
*)0L} SCRIPTID_INIT
},
1053 {"fileencoding","fenc", P_STRING
|P_ALLOCED
|P_VI_DEF
|P_RSTAT
|P_RBUF
|P_NO_MKRC
,
1055 (char_u
*)&p_fenc
, PV_FENC
,
1056 {(char_u
*)"", (char_u
*)0L}
1058 (char_u
*)NULL
, PV_NONE
,
1059 {(char_u
*)0L, (char_u
*)0L}
1062 {"fileencodings","fencs", P_STRING
|P_VI_DEF
|P_COMMA
,
1064 (char_u
*)&p_fencs
, PV_NONE
,
1065 {(char_u
*)"ucs-bom", (char_u
*)0L}
1067 (char_u
*)NULL
, PV_NONE
,
1068 {(char_u
*)0L, (char_u
*)0L}
1071 {"fileformat", "ff", P_STRING
|P_ALLOCED
|P_VI_DEF
|P_RSTAT
|P_NO_MKRC
,
1072 (char_u
*)&p_ff
, PV_FF
,
1073 {(char_u
*)DFLT_FF
, (char_u
*)0L} SCRIPTID_INIT
},
1074 {"fileformats", "ffs", P_STRING
|P_VIM
|P_COMMA
|P_NODUP
,
1075 (char_u
*)&p_ffs
, PV_NONE
,
1076 {(char_u
*)DFLT_FFS_VI
, (char_u
*)DFLT_FFS_VIM
}
1078 {"filetype", "ft", P_STRING
|P_ALLOCED
|P_VI_DEF
|P_NOGLOB
|P_NFNAME
,
1080 (char_u
*)&p_ft
, PV_FT
,
1081 {(char_u
*)"", (char_u
*)0L}
1083 (char_u
*)NULL
, PV_NONE
,
1084 {(char_u
*)0L, (char_u
*)0L}
1087 {"fillchars", "fcs", P_STRING
|P_VI_DEF
|P_RALL
|P_COMMA
|P_NODUP
,
1088 #if defined(FEAT_WINDOWS) || defined(FEAT_FOLDING)
1089 (char_u
*)&p_fcs
, PV_NONE
,
1090 {(char_u
*)"vert:|,fold:-", (char_u
*)0L}
1092 (char_u
*)NULL
, PV_NONE
,
1093 {(char_u
*)"", (char_u
*)0L}
1096 {"fkmap", "fk", P_BOOL
|P_VI_DEF
,
1098 (char_u
*)&p_fkmap
, PV_NONE
,
1100 (char_u
*)NULL
, PV_NONE
,
1102 {(char_u
*)FALSE
, (char_u
*)0L} SCRIPTID_INIT
},
1103 {"flash", "fl", P_BOOL
|P_VI_DEF
,
1104 (char_u
*)NULL
, PV_NONE
,
1105 {(char_u
*)FALSE
, (char_u
*)0L} SCRIPTID_INIT
},
1107 {"foldclose", "fcl", P_STRING
|P_VI_DEF
|P_COMMA
|P_NODUP
|P_RWIN
,
1108 (char_u
*)&p_fcl
, PV_NONE
,
1109 {(char_u
*)"", (char_u
*)0L} SCRIPTID_INIT
},
1110 {"foldcolumn", "fdc", P_NUM
|P_VI_DEF
|P_RWIN
,
1111 (char_u
*)VAR_WIN
, PV_FDC
,
1112 {(char_u
*)FALSE
, (char_u
*)0L} SCRIPTID_INIT
},
1113 {"foldenable", "fen", P_BOOL
|P_VI_DEF
|P_RWIN
,
1114 (char_u
*)VAR_WIN
, PV_FEN
,
1115 {(char_u
*)TRUE
, (char_u
*)0L} SCRIPTID_INIT
},
1116 {"foldexpr", "fde", P_STRING
|P_ALLOCED
|P_VIM
|P_VI_DEF
|P_RWIN
,
1118 (char_u
*)VAR_WIN
, PV_FDE
,
1119 {(char_u
*)"0", (char_u
*)NULL
}
1121 (char_u
*)NULL
, PV_NONE
,
1122 {(char_u
*)NULL
, (char_u
*)0L}
1125 {"foldignore", "fdi", P_STRING
|P_ALLOCED
|P_VIM
|P_VI_DEF
|P_RWIN
,
1126 (char_u
*)VAR_WIN
, PV_FDI
,
1127 {(char_u
*)"#", (char_u
*)NULL
} SCRIPTID_INIT
},
1128 {"foldlevel", "fdl", P_NUM
|P_VI_DEF
|P_RWIN
,
1129 (char_u
*)VAR_WIN
, PV_FDL
,
1130 {(char_u
*)0L, (char_u
*)0L} SCRIPTID_INIT
},
1131 {"foldlevelstart","fdls", P_NUM
|P_VI_DEF
,
1132 (char_u
*)&p_fdls
, PV_NONE
,
1133 {(char_u
*)-1L, (char_u
*)0L} SCRIPTID_INIT
},
1134 {"foldmarker", "fmr", P_STRING
|P_ALLOCED
|P_VIM
|P_VI_DEF
|
1135 P_RWIN
|P_COMMA
|P_NODUP
,
1136 (char_u
*)VAR_WIN
, PV_FMR
,
1137 {(char_u
*)"{{{,}}}", (char_u
*)NULL
}
1139 {"foldmethod", "fdm", P_STRING
|P_ALLOCED
|P_VIM
|P_VI_DEF
|P_RWIN
,
1140 (char_u
*)VAR_WIN
, PV_FDM
,
1141 {(char_u
*)"manual", (char_u
*)NULL
} SCRIPTID_INIT
},
1142 {"foldminlines","fml", P_NUM
|P_VI_DEF
|P_RWIN
,
1143 (char_u
*)VAR_WIN
, PV_FML
,
1144 {(char_u
*)1L, (char_u
*)0L} SCRIPTID_INIT
},
1145 {"foldnestmax", "fdn", P_NUM
|P_VI_DEF
|P_RWIN
,
1146 (char_u
*)VAR_WIN
, PV_FDN
,
1147 {(char_u
*)20L, (char_u
*)0L} SCRIPTID_INIT
},
1148 {"foldopen", "fdo", P_STRING
|P_VI_DEF
|P_COMMA
|P_NODUP
,
1149 (char_u
*)&p_fdo
, PV_NONE
,
1150 {(char_u
*)"block,hor,mark,percent,quickfix,search,tag,undo",
1151 (char_u
*)0L} SCRIPTID_INIT
},
1152 {"foldtext", "fdt", P_STRING
|P_ALLOCED
|P_VIM
|P_VI_DEF
|P_RWIN
,
1154 (char_u
*)VAR_WIN
, PV_FDT
,
1155 {(char_u
*)"foldtext()", (char_u
*)NULL
}
1157 (char_u
*)NULL
, PV_NONE
,
1158 {(char_u
*)NULL
, (char_u
*)0L}
1162 {"formatexpr", "fex", P_STRING
|P_ALLOCED
|P_VI_DEF
|P_VIM
,
1164 (char_u
*)&p_fex
, PV_FEX
,
1165 {(char_u
*)"", (char_u
*)0L}
1167 (char_u
*)NULL
, PV_NONE
,
1168 {(char_u
*)0L, (char_u
*)0L}
1171 {"formatoptions","fo", P_STRING
|P_ALLOCED
|P_VIM
|P_FLAGLIST
,
1172 (char_u
*)&p_fo
, PV_FO
,
1173 {(char_u
*)DFLT_FO_VI
, (char_u
*)DFLT_FO_VIM
}
1175 {"formatlistpat","flp", P_STRING
|P_ALLOCED
|P_VI_DEF
,
1176 (char_u
*)&p_flp
, PV_FLP
,
1177 {(char_u
*)"^\\s*\\d\\+[\\]:.)}\\t ]\\s*",
1178 (char_u
*)0L} SCRIPTID_INIT
},
1179 {"formatprg", "fp", P_STRING
|P_EXPAND
|P_VI_DEF
|P_SECURE
,
1180 (char_u
*)&p_fp
, PV_NONE
,
1181 {(char_u
*)"", (char_u
*)0L} SCRIPTID_INIT
},
1182 {"fsync", "fs", P_BOOL
|P_SECURE
|P_VI_DEF
,
1184 (char_u
*)&p_fs
, PV_NONE
,
1185 {(char_u
*)TRUE
, (char_u
*)0L}
1187 (char_u
*)NULL
, PV_NONE
,
1188 {(char_u
*)FALSE
, (char_u
*)0L}
1191 {"gdefault", "gd", P_BOOL
|P_VI_DEF
|P_VIM
,
1192 (char_u
*)&p_gd
, PV_NONE
,
1193 {(char_u
*)FALSE
, (char_u
*)0L} SCRIPTID_INIT
},
1194 {"graphic", "gr", P_BOOL
|P_VI_DEF
,
1195 (char_u
*)NULL
, PV_NONE
,
1196 {(char_u
*)FALSE
, (char_u
*)0L} SCRIPTID_INIT
},
1197 {"grepformat", "gfm", P_STRING
|P_VI_DEF
|P_COMMA
|P_NODUP
,
1198 #ifdef FEAT_QUICKFIX
1199 (char_u
*)&p_gefm
, PV_NONE
,
1200 {(char_u
*)DFLT_GREPFORMAT
, (char_u
*)0L}
1202 (char_u
*)NULL
, PV_NONE
,
1203 {(char_u
*)NULL
, (char_u
*)0L}
1206 {"grepprg", "gp", P_STRING
|P_EXPAND
|P_VI_DEF
|P_SECURE
,
1207 #ifdef FEAT_QUICKFIX
1208 (char_u
*)&p_gp
, PV_GP
,
1211 /* may be changed to "grep -n" in os_win32.c */
1212 (char_u
*)"findstr /n",
1215 /* Add an extra file name so that grep will always
1216 * insert a file name in the match line. */
1217 (char_u
*)"grep -n $* /dev/null",
1220 (char_u
*)"SEARCH/NUMBERS ",
1222 (char_u
*)"grep -n ",
1228 (char_u
*)NULL
, PV_NONE
,
1229 {(char_u
*)NULL
, (char_u
*)0L}
1232 {"guicursor", "gcr", P_STRING
|P_VI_DEF
|P_COMMA
|P_NODUP
,
1234 (char_u
*)&p_guicursor
, PV_NONE
,
1237 (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",
1238 # else /* MSDOS or Win32 console */
1239 (char_u
*)"n-v-c:block,o:hor50,i-ci:hor15,r-cr:hor30,sm:block",
1243 (char_u
*)NULL
, PV_NONE
,
1244 {(char_u
*)NULL
, (char_u
*)0L}
1247 {"guifont", "gfn", P_STRING
|P_VI_DEF
|P_RCLR
|P_COMMA
|P_NODUP
,
1249 (char_u
*)&p_guifont
, PV_NONE
,
1250 {(char_u
*)"", (char_u
*)0L}
1252 (char_u
*)NULL
, PV_NONE
,
1253 {(char_u
*)NULL
, (char_u
*)0L}
1256 {"guifontset", "gfs", P_STRING
|P_VI_DEF
|P_RCLR
|P_COMMA
,
1257 #if defined(FEAT_GUI) && defined(FEAT_XFONTSET)
1258 (char_u
*)&p_guifontset
, PV_NONE
,
1259 {(char_u
*)"", (char_u
*)0L}
1261 (char_u
*)NULL
, PV_NONE
,
1262 {(char_u
*)NULL
, (char_u
*)0L}
1265 {"guifontwide", "gfw", P_STRING
|P_VI_DEF
|P_RCLR
|P_COMMA
|P_NODUP
,
1266 #if defined(FEAT_GUI) && defined(FEAT_MBYTE)
1267 (char_u
*)&p_guifontwide
, PV_NONE
,
1268 {(char_u
*)"", (char_u
*)0L}
1270 (char_u
*)NULL
, PV_NONE
,
1271 {(char_u
*)NULL
, (char_u
*)0L}
1274 {"guiheadroom", "ghr", P_NUM
|P_VI_DEF
,
1275 #if defined(FEAT_GUI_GTK) || defined(FEAT_GUI_X11)
1276 (char_u
*)&p_ghr
, PV_NONE
,
1278 (char_u
*)NULL
, PV_NONE
,
1280 {(char_u
*)50L, (char_u
*)0L} SCRIPTID_INIT
},
1281 {"guioptions", "go", P_STRING
|P_VI_DEF
|P_RALL
|P_FLAGLIST
,
1282 #if defined(FEAT_GUI)
1283 (char_u
*)&p_go
, PV_NONE
,
1284 # if defined(UNIX) && !defined(MACOS)
1285 {(char_u
*)"aegimrLtT", (char_u
*)0L}
1287 {(char_u
*)"egmrLtT", (char_u
*)0L}
1290 (char_u
*)NULL
, PV_NONE
,
1291 {(char_u
*)NULL
, (char_u
*)0L}
1294 {"guipty", NULL
, P_BOOL
|P_VI_DEF
,
1295 #if defined(FEAT_GUI)
1296 (char_u
*)&p_guipty
, PV_NONE
,
1298 (char_u
*)NULL
, PV_NONE
,
1300 {(char_u
*)TRUE
, (char_u
*)0L} SCRIPTID_INIT
},
1301 {"guitablabel", "gtl", P_STRING
|P_VI_DEF
|P_RWIN
,
1302 #if defined(FEAT_GUI_TABLINE)
1303 (char_u
*)&p_gtl
, PV_NONE
,
1304 {(char_u
*)"", (char_u
*)0L}
1306 (char_u
*)NULL
, PV_NONE
,
1307 {(char_u
*)NULL
, (char_u
*)0L}
1310 {"guitabtooltip", "gtt", P_STRING
|P_VI_DEF
|P_RWIN
,
1311 #if defined(FEAT_GUI_TABLINE)
1312 (char_u
*)&p_gtt
, PV_NONE
,
1313 {(char_u
*)"", (char_u
*)0L}
1315 (char_u
*)NULL
, PV_NONE
,
1316 {(char_u
*)NULL
, (char_u
*)0L}
1319 {"hardtabs", "ht", P_NUM
|P_VI_DEF
,
1320 (char_u
*)NULL
, PV_NONE
,
1321 {(char_u
*)0L, (char_u
*)0L} SCRIPTID_INIT
},
1322 {"helpfile", "hf", P_STRING
|P_EXPAND
|P_VI_DEF
|P_SECURE
,
1323 (char_u
*)&p_hf
, PV_NONE
,
1324 {(char_u
*)DFLT_HELPFILE
, (char_u
*)0L}
1326 {"helpheight", "hh", P_NUM
|P_VI_DEF
,
1328 (char_u
*)&p_hh
, PV_NONE
,
1330 (char_u
*)NULL
, PV_NONE
,
1332 {(char_u
*)20L, (char_u
*)0L} SCRIPTID_INIT
},
1333 {"helplang", "hlg", P_STRING
|P_VI_DEF
|P_COMMA
,
1334 #ifdef FEAT_MULTI_LANG
1335 (char_u
*)&p_hlg
, PV_NONE
,
1336 {(char_u
*)"", (char_u
*)0L}
1338 (char_u
*)NULL
, PV_NONE
,
1339 {(char_u
*)0L, (char_u
*)0L}
1342 {"hidden", "hid", P_BOOL
|P_VI_DEF
,
1343 (char_u
*)&p_hid
, PV_NONE
,
1344 {(char_u
*)FALSE
, (char_u
*)0L} SCRIPTID_INIT
},
1345 {"highlight", "hl", P_STRING
|P_VI_DEF
|P_RCLR
|P_COMMA
|P_NODUP
,
1346 (char_u
*)&p_hl
, PV_NONE
,
1347 {(char_u
*)HIGHLIGHT_INIT
, (char_u
*)0L}
1349 {"history", "hi", P_NUM
|P_VIM
,
1350 (char_u
*)&p_hi
, PV_NONE
,
1351 {(char_u
*)0L, (char_u
*)20L} SCRIPTID_INIT
},
1352 {"hkmap", "hk", P_BOOL
|P_VI_DEF
|P_VIM
,
1353 #ifdef FEAT_RIGHTLEFT
1354 (char_u
*)&p_hkmap
, PV_NONE
,
1356 (char_u
*)NULL
, PV_NONE
,
1358 {(char_u
*)FALSE
, (char_u
*)0L} SCRIPTID_INIT
},
1359 {"hkmapp", "hkp", P_BOOL
|P_VI_DEF
|P_VIM
,
1360 #ifdef FEAT_RIGHTLEFT
1361 (char_u
*)&p_hkmapp
, PV_NONE
,
1363 (char_u
*)NULL
, PV_NONE
,
1365 {(char_u
*)FALSE
, (char_u
*)0L} SCRIPTID_INIT
},
1366 {"hlsearch", "hls", P_BOOL
|P_VI_DEF
|P_VIM
|P_RALL
,
1367 (char_u
*)&p_hls
, PV_NONE
,
1368 {(char_u
*)FALSE
, (char_u
*)0L} SCRIPTID_INIT
},
1369 {"icon", NULL
, P_BOOL
|P_VI_DEF
,
1371 (char_u
*)&p_icon
, PV_NONE
,
1373 (char_u
*)NULL
, PV_NONE
,
1375 {(char_u
*)FALSE
, (char_u
*)0L} SCRIPTID_INIT
},
1376 {"iconstring", NULL
, P_STRING
|P_VI_DEF
,
1378 (char_u
*)&p_iconstring
, PV_NONE
,
1380 (char_u
*)NULL
, PV_NONE
,
1382 {(char_u
*)"", (char_u
*)0L} SCRIPTID_INIT
},
1383 {"ignorecase", "ic", P_BOOL
|P_VI_DEF
,
1384 (char_u
*)&p_ic
, PV_NONE
,
1385 {(char_u
*)FALSE
, (char_u
*)0L} SCRIPTID_INIT
},
1386 {"imactivatekey","imak",P_STRING
|P_VI_DEF
,
1387 #if defined(FEAT_XIM) && defined(FEAT_GUI_GTK)
1388 (char_u
*)&p_imak
, PV_NONE
,
1390 (char_u
*)NULL
, PV_NONE
,
1392 {(char_u
*)"", (char_u
*)0L} SCRIPTID_INIT
},
1393 {"imcmdline", "imc", P_BOOL
|P_VI_DEF
,
1394 #ifdef USE_IM_CONTROL
1395 (char_u
*)&p_imcmdline
, PV_NONE
,
1397 (char_u
*)NULL
, PV_NONE
,
1399 {(char_u
*)FALSE
, (char_u
*)0L} SCRIPTID_INIT
},
1400 {"imdisable", "imd", P_BOOL
|P_VI_DEF
,
1401 #ifdef USE_IM_CONTROL
1402 (char_u
*)&p_imdisable
, PV_NONE
,
1404 (char_u
*)NULL
, PV_NONE
,
1407 {(char_u
*)TRUE
, (char_u
*)0L}
1409 {(char_u
*)FALSE
, (char_u
*)0L}
1412 {"iminsert", "imi", P_NUM
|P_VI_DEF
,
1413 (char_u
*)&p_iminsert
, PV_IMI
,
1415 {(char_u
*)B_IMODE_IM
, (char_u
*)0L}
1417 {(char_u
*)B_IMODE_NONE
, (char_u
*)0L}
1420 {"imsearch", "ims", P_NUM
|P_VI_DEF
,
1421 (char_u
*)&p_imsearch
, PV_IMS
,
1423 {(char_u
*)B_IMODE_IM
, (char_u
*)0L}
1425 {(char_u
*)B_IMODE_NONE
, (char_u
*)0L}
1428 {"include", "inc", P_STRING
|P_ALLOCED
|P_VI_DEF
,
1430 (char_u
*)&p_inc
, PV_INC
,
1431 {(char_u
*)"^\\s*#\\s*include", (char_u
*)0L}
1433 (char_u
*)NULL
, PV_NONE
,
1434 {(char_u
*)0L, (char_u
*)0L}
1437 {"includeexpr", "inex", P_STRING
|P_ALLOCED
|P_VI_DEF
,
1438 #if defined(FEAT_FIND_ID) && defined(FEAT_EVAL)
1439 (char_u
*)&p_inex
, PV_INEX
,
1440 {(char_u
*)"", (char_u
*)0L}
1442 (char_u
*)NULL
, PV_NONE
,
1443 {(char_u
*)0L, (char_u
*)0L}
1446 {"incsearch", "is", P_BOOL
|P_VI_DEF
|P_VIM
,
1447 (char_u
*)&p_is
, PV_NONE
,
1448 {(char_u
*)FALSE
, (char_u
*)0L} SCRIPTID_INIT
},
1449 {"indentexpr", "inde", P_STRING
|P_ALLOCED
|P_VI_DEF
|P_VIM
,
1450 #if defined(FEAT_CINDENT) && defined(FEAT_EVAL)
1451 (char_u
*)&p_inde
, PV_INDE
,
1452 {(char_u
*)"", (char_u
*)0L}
1454 (char_u
*)NULL
, PV_NONE
,
1455 {(char_u
*)0L, (char_u
*)0L}
1458 {"indentkeys", "indk", P_STRING
|P_ALLOCED
|P_VI_DEF
|P_COMMA
|P_NODUP
,
1459 #if defined(FEAT_CINDENT) && defined(FEAT_EVAL)
1460 (char_u
*)&p_indk
, PV_INDK
,
1461 {(char_u
*)"0{,0},:,0#,!^F,o,O,e", (char_u
*)0L}
1463 (char_u
*)NULL
, PV_NONE
,
1464 {(char_u
*)0L, (char_u
*)0L}
1467 {"infercase", "inf", P_BOOL
|P_VI_DEF
,
1468 (char_u
*)&p_inf
, PV_INF
,
1469 {(char_u
*)FALSE
, (char_u
*)0L} SCRIPTID_INIT
},
1470 {"insertmode", "im", P_BOOL
|P_VI_DEF
|P_VIM
,
1471 (char_u
*)&p_im
, PV_NONE
,
1472 {(char_u
*)FALSE
, (char_u
*)0L} SCRIPTID_INIT
},
1473 {"isfname", "isf", P_STRING
|P_VI_DEF
|P_COMMA
|P_NODUP
,
1474 (char_u
*)&p_isf
, PV_NONE
,
1476 #ifdef BACKSLASH_IN_FILENAME
1477 /* Excluded are: & and ^ are special in cmd.exe
1478 * ( and ) are used in text separating fnames */
1479 (char_u
*)"@,48-57,/,\\,.,-,_,+,,,#,$,%,{,},[,],:,@-@,!,~,=",
1482 (char_u
*)"@,48-57,/,.,-,_,+,,,$,:",
1485 (char_u
*)"@,48-57,/,.,-,_,+,,,#,$,%,<,>,[,],:,;,~",
1486 # else /* UNIX et al. */
1488 (char_u
*)"@,240-249,/,.,-,_,+,,,#,$,%,~,=",
1490 (char_u
*)"@,48-57,/,.,-,_,+,,,#,$,%,~,=",
1495 (char_u
*)0L} SCRIPTID_INIT
},
1496 {"isident", "isi", P_STRING
|P_VI_DEF
|P_COMMA
|P_NODUP
,
1497 (char_u
*)&p_isi
, PV_NONE
,
1499 #if defined(MSDOS) || defined(MSWIN) || defined(OS2)
1500 (char_u
*)"@,48-57,_,128-167,224-235",
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,_,192-255",
1512 (char_u
*)0L} SCRIPTID_INIT
},
1513 {"iskeyword", "isk", P_STRING
|P_ALLOCED
|P_VIM
|P_COMMA
|P_NODUP
,
1514 (char_u
*)&p_isk
, PV_ISK
,
1517 (char_u
*)"@,240-249,_",
1518 /* TODO: EBCDIC Check this! @ == isalpha()*/
1519 (char_u
*)"@,240-249,_,66-73,81-89,98-105,"
1520 "112-120,128,140-142,156,158,172,"
1521 "174,186,191,203-207,219-225,235-239,"
1524 (char_u
*)"@,48-57,_",
1525 # if defined(MSDOS) || defined(MSWIN) || defined(OS2)
1526 (char_u
*)"@,48-57,_,128-167,224-235"
1532 {"isprint", "isp", P_STRING
|P_VI_DEF
|P_RALL
|P_COMMA
|P_NODUP
,
1533 (char_u
*)&p_isp
, PV_NONE
,
1535 #if defined(MSDOS) || defined(MSWIN) || defined(OS2) \
1536 || (defined(MACOS) && !defined(MACOS_X)) \
1538 (char_u
*)"@,~-255",
1541 /* all chars above 63 are printable */
1547 (char_u
*)0L} SCRIPTID_INIT
},
1548 {"joinspaces", "js", P_BOOL
|P_VI_DEF
|P_VIM
,
1549 (char_u
*)&p_js
, PV_NONE
,
1550 {(char_u
*)TRUE
, (char_u
*)0L} SCRIPTID_INIT
},
1551 {"key", NULL
, P_STRING
|P_ALLOCED
|P_VI_DEF
|P_NO_MKRC
,
1553 (char_u
*)&p_key
, PV_KEY
,
1554 {(char_u
*)"", (char_u
*)0L}
1556 (char_u
*)NULL
, PV_NONE
,
1557 {(char_u
*)0L, (char_u
*)0L}
1560 {"keymap", "kmp", P_STRING
|P_ALLOCED
|P_VI_DEF
|P_RBUF
|P_RSTAT
|P_NFNAME
|P_PRI_MKRC
,
1562 (char_u
*)&p_keymap
, PV_KMAP
,
1563 {(char_u
*)"", (char_u
*)0L}
1565 (char_u
*)NULL
, PV_NONE
,
1566 {(char_u
*)"", (char_u
*)0L}
1569 {"keymodel", "km", P_STRING
|P_VI_DEF
|P_COMMA
|P_NODUP
,
1571 (char_u
*)&p_km
, PV_NONE
,
1573 (char_u
*)NULL
, PV_NONE
,
1575 {(char_u
*)"", (char_u
*)0L} SCRIPTID_INIT
},
1576 {"keywordprg", "kp", P_STRING
|P_EXPAND
|P_VI_DEF
|P_SECURE
,
1577 (char_u
*)&p_kp
, PV_KP
,
1579 #if defined(MSDOS) || defined(MSWIN)
1596 (char_u
*)0L} SCRIPTID_INIT
},
1597 {"langmap", "lmap", P_STRING
|P_VI_DEF
|P_COMMA
|P_NODUP
,
1599 (char_u
*)&p_langmap
, PV_NONE
,
1600 {(char_u
*)"", /* unmatched } */
1602 (char_u
*)NULL
, PV_NONE
,
1605 (char_u
*)0L} SCRIPTID_INIT
},
1606 {"langmenu", "lm", P_STRING
|P_VI_DEF
|P_NFNAME
,
1607 #if defined(FEAT_MENU) && defined(FEAT_MULTI_LANG)
1608 (char_u
*)&p_lm
, PV_NONE
,
1610 (char_u
*)NULL
, PV_NONE
,
1612 {(char_u
*)"", (char_u
*)0L} SCRIPTID_INIT
},
1613 {"laststatus", "ls", P_NUM
|P_VI_DEF
|P_RALL
,
1615 (char_u
*)&p_ls
, PV_NONE
,
1617 (char_u
*)NULL
, PV_NONE
,
1619 {(char_u
*)1L, (char_u
*)0L} SCRIPTID_INIT
},
1620 {"lazyredraw", "lz", P_BOOL
|P_VI_DEF
,
1621 (char_u
*)&p_lz
, PV_NONE
,
1622 {(char_u
*)FALSE
, (char_u
*)0L} SCRIPTID_INIT
},
1623 {"linebreak", "lbr", P_BOOL
|P_VI_DEF
|P_RWIN
,
1624 #ifdef FEAT_LINEBREAK
1625 (char_u
*)VAR_WIN
, PV_LBR
,
1627 (char_u
*)NULL
, PV_NONE
,
1629 {(char_u
*)FALSE
, (char_u
*)0L} SCRIPTID_INIT
},
1630 {"lines", NULL
, P_NUM
|P_NODEFAULT
|P_NO_MKRC
|P_VI_DEF
|P_RCLR
,
1631 (char_u
*)&Rows
, PV_NONE
,
1633 #if defined(MSDOS) || defined(WIN3264) || defined(OS2)
1638 (char_u
*)0L} SCRIPTID_INIT
},
1639 {"linespace", "lsp", P_NUM
|P_VI_DEF
|P_RCLR
,
1641 (char_u
*)&p_linespace
, PV_NONE
,
1643 (char_u
*)NULL
, PV_NONE
,
1646 {(char_u
*)1L, (char_u
*)0L}
1648 {(char_u
*)0L, (char_u
*)0L}
1651 {"lisp", NULL
, P_BOOL
|P_VI_DEF
,
1653 (char_u
*)&p_lisp
, PV_LISP
,
1655 (char_u
*)NULL
, PV_NONE
,
1657 {(char_u
*)FALSE
, (char_u
*)0L} SCRIPTID_INIT
},
1658 {"lispwords", "lw", P_STRING
|P_VI_DEF
|P_COMMA
|P_NODUP
,
1660 (char_u
*)&p_lispwords
, PV_NONE
,
1661 {(char_u
*)LISPWORD_VALUE
, (char_u
*)0L}
1663 (char_u
*)NULL
, PV_NONE
,
1664 {(char_u
*)"", (char_u
*)0L}
1667 {"list", NULL
, P_BOOL
|P_VI_DEF
|P_RWIN
,
1668 (char_u
*)VAR_WIN
, PV_LIST
,
1669 {(char_u
*)FALSE
, (char_u
*)0L} SCRIPTID_INIT
},
1670 {"listchars", "lcs", P_STRING
|P_VI_DEF
|P_RALL
|P_COMMA
|P_NODUP
,
1671 (char_u
*)&p_lcs
, PV_NONE
,
1672 {(char_u
*)"eol:$", (char_u
*)0L} SCRIPTID_INIT
},
1673 {"loadplugins", "lpl", P_BOOL
|P_VI_DEF
,
1674 (char_u
*)&p_lpl
, PV_NONE
,
1675 {(char_u
*)TRUE
, (char_u
*)0L} SCRIPTID_INIT
},
1677 {"macatsui", NULL
, P_BOOL
|P_VI_DEF
|P_RCLR
,
1678 (char_u
*)&p_macatsui
, PV_NONE
,
1679 {(char_u
*)TRUE
, (char_u
*)0L} SCRIPTID_INIT
},
1681 {"magic", NULL
, P_BOOL
|P_VI_DEF
,
1682 (char_u
*)&p_magic
, PV_NONE
,
1683 {(char_u
*)TRUE
, (char_u
*)0L} SCRIPTID_INIT
},
1684 {"makeef", "mef", P_STRING
|P_EXPAND
|P_VI_DEF
|P_SECURE
,
1685 #ifdef FEAT_QUICKFIX
1686 (char_u
*)&p_mef
, PV_NONE
,
1687 {(char_u
*)"", (char_u
*)0L}
1689 (char_u
*)NULL
, PV_NONE
,
1690 {(char_u
*)NULL
, (char_u
*)0L}
1693 {"makeprg", "mp", P_STRING
|P_EXPAND
|P_VI_DEF
|P_SECURE
,
1694 #ifdef FEAT_QUICKFIX
1695 (char_u
*)&p_mp
, PV_MP
,
1697 {(char_u
*)"MMS", (char_u
*)0L}
1699 {(char_u
*)"make", (char_u
*)0L}
1702 (char_u
*)NULL
, PV_NONE
,
1703 {(char_u
*)NULL
, (char_u
*)0L}
1706 {"matchpairs", "mps", P_STRING
|P_ALLOCED
|P_VI_DEF
|P_COMMA
|P_NODUP
,
1707 (char_u
*)&p_mps
, PV_MPS
,
1708 {(char_u
*)"(:),{:},[:]", (char_u
*)0L}
1710 {"matchtime", "mat", P_NUM
|P_VI_DEF
,
1711 (char_u
*)&p_mat
, PV_NONE
,
1712 {(char_u
*)5L, (char_u
*)0L} SCRIPTID_INIT
},
1713 {"maxcombine", "mco", P_NUM
|P_VI_DEF
,
1715 (char_u
*)&p_mco
, PV_NONE
,
1717 (char_u
*)NULL
, PV_NONE
,
1719 {(char_u
*)2, (char_u
*)0L} SCRIPTID_INIT
},
1720 {"maxfuncdepth", "mfd", P_NUM
|P_VI_DEF
,
1722 (char_u
*)&p_mfd
, PV_NONE
,
1724 (char_u
*)NULL
, PV_NONE
,
1726 {(char_u
*)100L, (char_u
*)0L} SCRIPTID_INIT
},
1727 {"maxmapdepth", "mmd", P_NUM
|P_VI_DEF
,
1728 (char_u
*)&p_mmd
, PV_NONE
,
1729 {(char_u
*)1000L, (char_u
*)0L} SCRIPTID_INIT
},
1730 {"maxmem", "mm", P_NUM
|P_VI_DEF
,
1731 (char_u
*)&p_mm
, PV_NONE
,
1732 {(char_u
*)DFLT_MAXMEM
, (char_u
*)0L}
1734 {"maxmempattern","mmp", P_NUM
|P_VI_DEF
,
1735 (char_u
*)&p_mmp
, PV_NONE
,
1736 {(char_u
*)1000L, (char_u
*)0L} SCRIPTID_INIT
},
1737 {"maxmemtot", "mmt", P_NUM
|P_VI_DEF
,
1738 (char_u
*)&p_mmt
, PV_NONE
,
1739 {(char_u
*)DFLT_MAXMEMTOT
, (char_u
*)0L}
1741 {"menuitems", "mis", P_NUM
|P_VI_DEF
,
1743 (char_u
*)&p_mis
, PV_NONE
,
1745 (char_u
*)NULL
, PV_NONE
,
1747 {(char_u
*)25L, (char_u
*)0L} SCRIPTID_INIT
},
1748 {"mesg", NULL
, P_BOOL
|P_VI_DEF
,
1749 (char_u
*)NULL
, PV_NONE
,
1750 {(char_u
*)FALSE
, (char_u
*)0L} SCRIPTID_INIT
},
1751 {"mkspellmem", "msm", P_STRING
|P_VI_DEF
|P_EXPAND
|P_SECURE
,
1753 (char_u
*)&p_msm
, PV_NONE
,
1754 {(char_u
*)"460000,2000,500", (char_u
*)0L}
1756 (char_u
*)NULL
, PV_NONE
,
1757 {(char_u
*)0L, (char_u
*)0L}
1760 {"modeline", "ml", P_BOOL
|P_VIM
,
1761 (char_u
*)&p_ml
, PV_ML
,
1762 {(char_u
*)FALSE
, (char_u
*)TRUE
} SCRIPTID_INIT
},
1763 {"modelines", "mls", P_NUM
|P_VI_DEF
,
1764 (char_u
*)&p_mls
, PV_NONE
,
1765 {(char_u
*)5L, (char_u
*)0L} SCRIPTID_INIT
},
1766 {"modifiable", "ma", P_BOOL
|P_VI_DEF
|P_NOGLOB
,
1767 (char_u
*)&p_ma
, PV_MA
,
1768 {(char_u
*)TRUE
, (char_u
*)0L} SCRIPTID_INIT
},
1769 {"modified", "mod", P_BOOL
|P_NO_MKRC
|P_VI_DEF
|P_RSTAT
,
1770 (char_u
*)&p_mod
, PV_MOD
,
1771 {(char_u
*)FALSE
, (char_u
*)0L} SCRIPTID_INIT
},
1772 {"more", NULL
, P_BOOL
|P_VIM
,
1773 (char_u
*)&p_more
, PV_NONE
,
1774 {(char_u
*)FALSE
, (char_u
*)TRUE
} SCRIPTID_INIT
},
1775 {"mouse", NULL
, P_STRING
|P_VI_DEF
|P_FLAGLIST
,
1776 (char_u
*)&p_mouse
, PV_NONE
,
1778 #if defined(MSDOS) || defined(WIN3264)
1783 (char_u
*)0L} SCRIPTID_INIT
},
1784 {"mousefocus", "mousef", P_BOOL
|P_VI_DEF
,
1786 (char_u
*)&p_mousef
, PV_NONE
,
1788 (char_u
*)NULL
, PV_NONE
,
1790 {(char_u
*)FALSE
, (char_u
*)0L} SCRIPTID_INIT
},
1791 {"mousehide", "mh", P_BOOL
|P_VI_DEF
,
1793 (char_u
*)&p_mh
, PV_NONE
,
1795 (char_u
*)NULL
, PV_NONE
,
1797 {(char_u
*)TRUE
, (char_u
*)0L} SCRIPTID_INIT
},
1798 {"mousemodel", "mousem", P_STRING
|P_VI_DEF
,
1799 (char_u
*)&p_mousem
, PV_NONE
,
1801 #if defined(MSDOS) || defined(MSWIN)
1805 (char_u
*)"popup_setpos",
1810 (char_u
*)0L} SCRIPTID_INIT
},
1811 {"mouseshape", "mouses", P_STRING
|P_VI_DEF
|P_COMMA
|P_NODUP
,
1812 #ifdef FEAT_MOUSESHAPE
1813 (char_u
*)&p_mouseshape
, PV_NONE
,
1814 {(char_u
*)"i-r:beam,s:updown,sd:udsizing,vs:leftright,vd:lrsizing,m:no,ml:up-arrow,v:rightup-arrow", (char_u
*)0L}
1816 (char_u
*)NULL
, PV_NONE
,
1817 {(char_u
*)NULL
, (char_u
*)0L}
1820 {"mousetime", "mouset", P_NUM
|P_VI_DEF
,
1821 (char_u
*)&p_mouset
, PV_NONE
,
1822 {(char_u
*)500L, (char_u
*)0L} SCRIPTID_INIT
},
1823 {"mzquantum", "mzq", P_NUM
,
1824 #ifdef FEAT_MZSCHEME
1825 (char_u
*)&p_mzq
, PV_NONE
,
1827 (char_u
*)NULL
, PV_NONE
,
1829 {(char_u
*)100L, (char_u
*)100L} SCRIPTID_INIT
},
1830 {"novice", NULL
, P_BOOL
|P_VI_DEF
,
1831 (char_u
*)NULL
, PV_NONE
,
1832 {(char_u
*)FALSE
, (char_u
*)0L} SCRIPTID_INIT
},
1833 {"nrformats", "nf", P_STRING
|P_ALLOCED
|P_VI_DEF
|P_COMMA
|P_NODUP
,
1834 (char_u
*)&p_nf
, PV_NF
,
1835 {(char_u
*)"octal,hex", (char_u
*)0L}
1837 {"number", "nu", P_BOOL
|P_VI_DEF
|P_RWIN
,
1838 (char_u
*)VAR_WIN
, PV_NU
,
1839 {(char_u
*)FALSE
, (char_u
*)0L} SCRIPTID_INIT
},
1840 {"numberwidth", "nuw", P_NUM
|P_RWIN
|P_VIM
,
1841 #ifdef FEAT_LINEBREAK
1842 (char_u
*)VAR_WIN
, PV_NUW
,
1844 (char_u
*)NULL
, PV_NONE
,
1846 {(char_u
*)8L, (char_u
*)4L} SCRIPTID_INIT
},
1847 {"omnifunc", "ofu", P_STRING
|P_ALLOCED
|P_VI_DEF
|P_SECURE
,
1848 #ifdef FEAT_COMPL_FUNC
1849 (char_u
*)&p_ofu
, PV_OFU
,
1850 {(char_u
*)"", (char_u
*)0L}
1852 (char_u
*)NULL
, PV_NONE
,
1853 {(char_u
*)0L, (char_u
*)0L}
1856 {"open", NULL
, P_BOOL
|P_VI_DEF
,
1857 (char_u
*)NULL
, PV_NONE
,
1858 {(char_u
*)FALSE
, (char_u
*)0L} SCRIPTID_INIT
},
1859 {"opendevice", "odev", P_BOOL
|P_VI_DEF
,
1860 #if defined(MSDOS) || defined(MSWIN) || defined(OS2)
1861 (char_u
*)&p_odev
, PV_NONE
,
1863 (char_u
*)NULL
, PV_NONE
,
1865 {(char_u
*)FALSE
, (char_u
*)FALSE
}
1867 {"operatorfunc", "opfunc", P_STRING
|P_VI_DEF
|P_SECURE
,
1868 (char_u
*)&p_opfunc
, PV_NONE
,
1869 {(char_u
*)"", (char_u
*)0L} SCRIPTID_INIT
},
1870 {"optimize", "opt", P_BOOL
|P_VI_DEF
,
1871 (char_u
*)NULL
, PV_NONE
,
1872 {(char_u
*)FALSE
, (char_u
*)0L} SCRIPTID_INIT
},
1873 {"osfiletype", "oft", P_STRING
|P_ALLOCED
|P_VI_DEF
,
1874 #ifdef FEAT_OSFILETYPE
1875 (char_u
*)&p_oft
, PV_OFT
,
1876 {(char_u
*)DFLT_OFT
, (char_u
*)0L}
1878 (char_u
*)NULL
, PV_NONE
,
1879 {(char_u
*)0L, (char_u
*)0L}
1882 {"paragraphs", "para", P_STRING
|P_VI_DEF
,
1883 (char_u
*)&p_para
, PV_NONE
,
1884 {(char_u
*)"IPLPPPQPP TPHPLIPpLpItpplpipbp",
1885 (char_u
*)0L} SCRIPTID_INIT
},
1886 {"paste", NULL
, P_BOOL
|P_VI_DEF
|P_PRI_MKRC
,
1887 (char_u
*)&p_paste
, PV_NONE
,
1888 {(char_u
*)FALSE
, (char_u
*)0L} SCRIPTID_INIT
},
1889 {"pastetoggle", "pt", P_STRING
|P_VI_DEF
,
1890 (char_u
*)&p_pt
, PV_NONE
,
1891 {(char_u
*)"", (char_u
*)0L} SCRIPTID_INIT
},
1892 {"patchexpr", "pex", P_STRING
|P_VI_DEF
|P_SECURE
,
1893 #if defined(FEAT_DIFF) && defined(FEAT_EVAL)
1894 (char_u
*)&p_pex
, PV_NONE
,
1895 {(char_u
*)"", (char_u
*)0L}
1897 (char_u
*)NULL
, PV_NONE
,
1898 {(char_u
*)0L, (char_u
*)0L}
1901 {"patchmode", "pm", P_STRING
|P_VI_DEF
|P_NFNAME
,
1902 (char_u
*)&p_pm
, PV_NONE
,
1903 {(char_u
*)"", (char_u
*)0L} SCRIPTID_INIT
},
1904 {"path", "pa", P_STRING
|P_EXPAND
|P_VI_DEF
|P_COMMA
|P_NODUP
,
1905 (char_u
*)&p_path
, PV_PATH
,
1907 #if defined AMIGA || defined MSDOS || defined MSWIN
1910 # if defined(__EMX__)
1911 (char_u
*)".,/emx/include,,",
1912 # else /* Unix, probably */
1913 (char_u
*)".,/usr/include,,",
1916 (char_u
*)0L} SCRIPTID_INIT
},
1917 {"preserveindent", "pi", P_BOOL
|P_VI_DEF
|P_VIM
,
1918 (char_u
*)&p_pi
, PV_PI
,
1919 {(char_u
*)FALSE
, (char_u
*)0L} SCRIPTID_INIT
},
1920 {"previewheight", "pvh", P_NUM
|P_VI_DEF
,
1921 #if defined(FEAT_WINDOWS) && defined(FEAT_QUICKFIX)
1922 (char_u
*)&p_pvh
, PV_NONE
,
1924 (char_u
*)NULL
, PV_NONE
,
1926 {(char_u
*)12L, (char_u
*)0L} SCRIPTID_INIT
},
1927 {"previewwindow", "pvw", P_BOOL
|P_VI_DEF
|P_RSTAT
|P_NOGLOB
,
1928 #if defined(FEAT_WINDOWS) && defined(FEAT_QUICKFIX)
1929 (char_u
*)VAR_WIN
, PV_PVW
,
1931 (char_u
*)NULL
, PV_NONE
,
1933 {(char_u
*)FALSE
, (char_u
*)0L} SCRIPTID_INIT
},
1934 {"printdevice", "pdev", P_STRING
|P_VI_DEF
|P_SECURE
,
1936 (char_u
*)&p_pdev
, PV_NONE
,
1937 {(char_u
*)"", (char_u
*)0L}
1939 (char_u
*)NULL
, PV_NONE
,
1940 {(char_u
*)NULL
, (char_u
*)0L}
1943 {"printencoding", "penc", P_STRING
|P_VI_DEF
,
1944 #ifdef FEAT_POSTSCRIPT
1945 (char_u
*)&p_penc
, PV_NONE
,
1946 {(char_u
*)"", (char_u
*)0L}
1948 (char_u
*)NULL
, PV_NONE
,
1949 {(char_u
*)NULL
, (char_u
*)0L}
1952 {"printexpr", "pexpr", P_STRING
|P_VI_DEF
,
1953 #ifdef FEAT_POSTSCRIPT
1954 (char_u
*)&p_pexpr
, PV_NONE
,
1955 {(char_u
*)"", (char_u
*)0L}
1957 (char_u
*)NULL
, PV_NONE
,
1958 {(char_u
*)NULL
, (char_u
*)0L}
1961 {"printfont", "pfn", P_STRING
|P_VI_DEF
,
1963 (char_u
*)&p_pfn
, PV_NONE
,
1966 (char_u
*)"Courier_New:h10",
1968 (char_u
*)"courier",
1972 (char_u
*)NULL
, PV_NONE
,
1973 {(char_u
*)NULL
, (char_u
*)0L}
1976 {"printheader", "pheader", P_STRING
|P_VI_DEF
|P_GETTEXT
,
1978 (char_u
*)&p_header
, PV_NONE
,
1979 {(char_u
*)N_("%<%f%h%m%=Page %N"), (char_u
*)0L}
1981 (char_u
*)NULL
, PV_NONE
,
1982 {(char_u
*)NULL
, (char_u
*)0L}
1985 {"printmbcharset", "pmbcs", P_STRING
|P_VI_DEF
,
1986 #if defined(FEAT_POSTSCRIPT) && defined(FEAT_MBYTE)
1987 (char_u
*)&p_pmcs
, PV_NONE
,
1988 {(char_u
*)"", (char_u
*)0L}
1990 (char_u
*)NULL
, PV_NONE
,
1991 {(char_u
*)NULL
, (char_u
*)0L}
1994 {"printmbfont", "pmbfn", P_STRING
|P_VI_DEF
,
1995 #if defined(FEAT_POSTSCRIPT) && defined(FEAT_MBYTE)
1996 (char_u
*)&p_pmfn
, PV_NONE
,
1997 {(char_u
*)"", (char_u
*)0L}
1999 (char_u
*)NULL
, PV_NONE
,
2000 {(char_u
*)NULL
, (char_u
*)0L}
2003 {"printoptions", "popt", P_STRING
|P_VI_DEF
|P_COMMA
|P_NODUP
,
2005 (char_u
*)&p_popt
, PV_NONE
,
2006 {(char_u
*)"", (char_u
*)0L}
2008 (char_u
*)NULL
, PV_NONE
,
2009 {(char_u
*)NULL
, (char_u
*)0L}
2012 {"prompt", NULL
, P_BOOL
|P_VI_DEF
,
2013 (char_u
*)&p_prompt
, PV_NONE
,
2014 {(char_u
*)TRUE
, (char_u
*)0L} SCRIPTID_INIT
},
2015 {"pumheight", "ph", P_NUM
|P_VI_DEF
,
2016 #ifdef FEAT_INS_EXPAND
2017 (char_u
*)&p_ph
, PV_NONE
,
2019 (char_u
*)NULL
, PV_NONE
,
2021 {(char_u
*)0L, (char_u
*)0L} SCRIPTID_INIT
},
2022 {"quoteescape", "qe", P_STRING
|P_ALLOCED
|P_VI_DEF
,
2024 (char_u
*)&p_qe
, PV_QE
,
2025 {(char_u
*)"\\", (char_u
*)0L}
2027 (char_u
*)NULL
, PV_NONE
,
2028 {(char_u
*)NULL
, (char_u
*)0L}
2031 {"readonly", "ro", P_BOOL
|P_VI_DEF
|P_RSTAT
|P_NOGLOB
,
2032 (char_u
*)&p_ro
, PV_RO
,
2033 {(char_u
*)FALSE
, (char_u
*)0L} SCRIPTID_INIT
},
2034 {"redraw", NULL
, P_BOOL
|P_VI_DEF
,
2035 (char_u
*)NULL
, PV_NONE
,
2036 {(char_u
*)FALSE
, (char_u
*)0L} SCRIPTID_INIT
},
2037 {"redrawtime", "rdt", P_NUM
|P_VI_DEF
,
2039 (char_u
*)&p_rdt
, PV_NONE
,
2041 (char_u
*)NULL
, PV_NONE
,
2043 {(char_u
*)2000L, (char_u
*)0L} SCRIPTID_INIT
},
2044 {"remap", NULL
, P_BOOL
|P_VI_DEF
,
2045 (char_u
*)&p_remap
, PV_NONE
,
2046 {(char_u
*)TRUE
, (char_u
*)0L} SCRIPTID_INIT
},
2047 {"report", NULL
, P_NUM
|P_VI_DEF
,
2048 (char_u
*)&p_report
, PV_NONE
,
2049 {(char_u
*)2L, (char_u
*)0L} SCRIPTID_INIT
},
2050 {"restorescreen", "rs", P_BOOL
|P_VI_DEF
,
2052 (char_u
*)&p_rs
, PV_NONE
,
2054 (char_u
*)NULL
, PV_NONE
,
2056 {(char_u
*)TRUE
, (char_u
*)0L} SCRIPTID_INIT
},
2057 {"revins", "ri", P_BOOL
|P_VI_DEF
|P_VIM
,
2058 #ifdef FEAT_RIGHTLEFT
2059 (char_u
*)&p_ri
, PV_NONE
,
2061 (char_u
*)NULL
, PV_NONE
,
2063 {(char_u
*)FALSE
, (char_u
*)0L} SCRIPTID_INIT
},
2064 {"rightleft", "rl", P_BOOL
|P_VI_DEF
|P_RWIN
,
2065 #ifdef FEAT_RIGHTLEFT
2066 (char_u
*)VAR_WIN
, PV_RL
,
2068 (char_u
*)NULL
, PV_NONE
,
2070 {(char_u
*)FALSE
, (char_u
*)0L} SCRIPTID_INIT
},
2071 {"rightleftcmd", "rlc", P_STRING
|P_ALLOCED
|P_VI_DEF
|P_RWIN
,
2072 #ifdef FEAT_RIGHTLEFT
2073 (char_u
*)VAR_WIN
, PV_RLC
,
2074 {(char_u
*)"search", (char_u
*)NULL
}
2076 (char_u
*)NULL
, PV_NONE
,
2077 {(char_u
*)NULL
, (char_u
*)0L}
2080 {"ruler", "ru", P_BOOL
|P_VI_DEF
|P_VIM
|P_RSTAT
,
2081 #ifdef FEAT_CMDL_INFO
2082 (char_u
*)&p_ru
, PV_NONE
,
2084 (char_u
*)NULL
, PV_NONE
,
2086 {(char_u
*)FALSE
, (char_u
*)0L} SCRIPTID_INIT
},
2087 {"rulerformat", "ruf", P_STRING
|P_VI_DEF
|P_ALLOCED
|P_RSTAT
,
2089 (char_u
*)&p_ruf
, PV_NONE
,
2091 (char_u
*)NULL
, PV_NONE
,
2093 {(char_u
*)"", (char_u
*)0L} SCRIPTID_INIT
},
2094 {"runtimepath", "rtp", P_STRING
|P_VI_DEF
|P_EXPAND
|P_COMMA
|P_NODUP
|P_SECURE
,
2095 (char_u
*)&p_rtp
, PV_NONE
,
2096 {(char_u
*)DFLT_RUNTIMEPATH
, (char_u
*)0L}
2098 {"scroll", "scr", P_NUM
|P_NO_MKRC
|P_VI_DEF
,
2099 (char_u
*)VAR_WIN
, PV_SCROLL
,
2100 {(char_u
*)12L, (char_u
*)0L} SCRIPTID_INIT
},
2101 {"scrollbind", "scb", P_BOOL
|P_VI_DEF
,
2102 #ifdef FEAT_SCROLLBIND
2103 (char_u
*)VAR_WIN
, PV_SCBIND
,
2105 (char_u
*)NULL
, PV_NONE
,
2107 {(char_u
*)FALSE
, (char_u
*)0L} SCRIPTID_INIT
},
2108 {"scrolljump", "sj", P_NUM
|P_VI_DEF
|P_VIM
,
2109 (char_u
*)&p_sj
, PV_NONE
,
2110 {(char_u
*)1L, (char_u
*)0L} SCRIPTID_INIT
},
2111 {"scrolloff", "so", P_NUM
|P_VI_DEF
|P_VIM
|P_RALL
,
2112 (char_u
*)&p_so
, PV_NONE
,
2113 {(char_u
*)0L, (char_u
*)0L} SCRIPTID_INIT
},
2114 {"scrollopt", "sbo", P_STRING
|P_VI_DEF
|P_COMMA
|P_NODUP
,
2115 #ifdef FEAT_SCROLLBIND
2116 (char_u
*)&p_sbo
, PV_NONE
,
2117 {(char_u
*)"ver,jump", (char_u
*)0L}
2119 (char_u
*)NULL
, PV_NONE
,
2120 {(char_u
*)0L, (char_u
*)0L}
2123 {"sections", "sect", P_STRING
|P_VI_DEF
,
2124 (char_u
*)&p_sections
, PV_NONE
,
2125 {(char_u
*)"SHNHH HUnhsh", (char_u
*)0L}
2127 {"secure", NULL
, P_BOOL
|P_VI_DEF
|P_SECURE
,
2128 (char_u
*)&p_secure
, PV_NONE
,
2129 {(char_u
*)FALSE
, (char_u
*)0L} SCRIPTID_INIT
},
2130 {"selection", "sel", P_STRING
|P_VI_DEF
,
2132 (char_u
*)&p_sel
, PV_NONE
,
2134 (char_u
*)NULL
, PV_NONE
,
2136 {(char_u
*)"inclusive", (char_u
*)0L}
2138 {"selectmode", "slm", P_STRING
|P_VI_DEF
|P_COMMA
|P_NODUP
,
2140 (char_u
*)&p_slm
, PV_NONE
,
2142 (char_u
*)NULL
, PV_NONE
,
2144 {(char_u
*)"", (char_u
*)0L} SCRIPTID_INIT
},
2145 {"sessionoptions", "ssop", P_STRING
|P_VI_DEF
|P_COMMA
|P_NODUP
,
2147 (char_u
*)&p_ssop
, PV_NONE
,
2148 {(char_u
*)"blank,buffers,curdir,folds,help,options,tabpages,winsize",
2151 (char_u
*)NULL
, PV_NONE
,
2152 {(char_u
*)0L, (char_u
*)0L}
2155 {"shell", "sh", P_STRING
|P_EXPAND
|P_VI_DEF
|P_SECURE
,
2156 (char_u
*)&p_sh
, PV_NONE
,
2162 (char_u
*)"command",
2165 (char_u
*)"command.com",
2167 # if defined(WIN3264)
2168 (char_u
*)"", /* set in set_init_1() */
2171 (char_u
*)"cmd.exe",
2173 # if defined(ARCHIE)
2183 (char_u
*)0L} SCRIPTID_INIT
},
2184 {"shellcmdflag","shcf", P_STRING
|P_VI_DEF
|P_SECURE
,
2185 (char_u
*)&p_shcf
, PV_NONE
,
2187 #if defined(MSDOS) || defined(MSWIN)
2196 (char_u
*)0L} SCRIPTID_INIT
},
2197 {"shellpipe", "sp", P_STRING
|P_VI_DEF
|P_SECURE
,
2198 #ifdef FEAT_QUICKFIX
2199 (char_u
*)&p_sp
, PV_NONE
,
2201 #if defined(UNIX) || defined(OS2)
2212 (char_u
*)NULL
, PV_NONE
,
2213 {(char_u
*)0L, (char_u
*)0L}
2216 {"shellquote", "shq", P_STRING
|P_VI_DEF
|P_SECURE
,
2217 (char_u
*)&p_shq
, PV_NONE
,
2218 {(char_u
*)"", (char_u
*)0L} SCRIPTID_INIT
},
2219 {"shellredir", "srr", P_STRING
|P_VI_DEF
|P_SECURE
,
2220 (char_u
*)&p_srr
, PV_NONE
,
2221 {(char_u
*)">", (char_u
*)0L} SCRIPTID_INIT
},
2222 {"shellslash", "ssl", P_BOOL
|P_VI_DEF
,
2223 #ifdef BACKSLASH_IN_FILENAME
2224 (char_u
*)&p_ssl
, PV_NONE
,
2226 (char_u
*)NULL
, PV_NONE
,
2228 {(char_u
*)FALSE
, (char_u
*)0L} SCRIPTID_INIT
},
2229 {"shelltemp", "stmp", P_BOOL
,
2230 (char_u
*)&p_stmp
, PV_NONE
,
2231 {(char_u
*)FALSE
, (char_u
*)TRUE
} SCRIPTID_INIT
},
2232 {"shelltype", "st", P_NUM
|P_VI_DEF
,
2234 (char_u
*)&p_st
, PV_NONE
,
2236 (char_u
*)NULL
, PV_NONE
,
2238 {(char_u
*)0L, (char_u
*)0L} SCRIPTID_INIT
},
2239 {"shellxquote", "sxq", P_STRING
|P_VI_DEF
|P_SECURE
,
2240 (char_u
*)&p_sxq
, PV_NONE
,
2242 #if defined(UNIX) && defined(USE_SYSTEM) && !defined(__EMX__)
2247 (char_u
*)0L} SCRIPTID_INIT
},
2248 {"shiftround", "sr", P_BOOL
|P_VI_DEF
|P_VIM
,
2249 (char_u
*)&p_sr
, PV_NONE
,
2250 {(char_u
*)FALSE
, (char_u
*)0L} SCRIPTID_INIT
},
2251 {"shiftwidth", "sw", P_NUM
|P_VI_DEF
,
2252 (char_u
*)&p_sw
, PV_SW
,
2253 {(char_u
*)8L, (char_u
*)0L} SCRIPTID_INIT
},
2254 {"shortmess", "shm", P_STRING
|P_VIM
|P_FLAGLIST
,
2255 (char_u
*)&p_shm
, PV_NONE
,
2256 {(char_u
*)"", (char_u
*)"filnxtToO"}
2258 {"shortname", "sn", P_BOOL
|P_VI_DEF
,
2260 (char_u
*)NULL
, PV_NONE
,
2262 (char_u
*)&p_sn
, PV_SN
,
2264 {(char_u
*)FALSE
, (char_u
*)0L} SCRIPTID_INIT
},
2265 {"showbreak", "sbr", P_STRING
|P_VI_DEF
|P_RALL
,
2266 #ifdef FEAT_LINEBREAK
2267 (char_u
*)&p_sbr
, PV_NONE
,
2269 (char_u
*)NULL
, PV_NONE
,
2271 {(char_u
*)"", (char_u
*)0L} SCRIPTID_INIT
},
2272 {"showcmd", "sc", P_BOOL
|P_VIM
,
2273 #ifdef FEAT_CMDL_INFO
2274 (char_u
*)&p_sc
, PV_NONE
,
2276 (char_u
*)NULL
, PV_NONE
,
2285 {"showfulltag", "sft", P_BOOL
|P_VI_DEF
,
2286 (char_u
*)&p_sft
, PV_NONE
,
2287 {(char_u
*)FALSE
, (char_u
*)0L} SCRIPTID_INIT
},
2288 {"showmatch", "sm", P_BOOL
|P_VI_DEF
,
2289 (char_u
*)&p_sm
, PV_NONE
,
2290 {(char_u
*)FALSE
, (char_u
*)0L} SCRIPTID_INIT
},
2291 {"showmode", "smd", P_BOOL
|P_VIM
,
2292 (char_u
*)&p_smd
, PV_NONE
,
2293 {(char_u
*)FALSE
, (char_u
*)TRUE
} SCRIPTID_INIT
},
2294 {"showtabline", "stal", P_NUM
|P_VI_DEF
|P_RALL
,
2296 (char_u
*)&p_stal
, PV_NONE
,
2298 (char_u
*)NULL
, PV_NONE
,
2300 {(char_u
*)1L, (char_u
*)0L} SCRIPTID_INIT
},
2301 {"sidescroll", "ss", P_NUM
|P_VI_DEF
,
2302 (char_u
*)&p_ss
, PV_NONE
,
2303 {(char_u
*)0L, (char_u
*)0L} SCRIPTID_INIT
},
2304 {"sidescrolloff", "siso", P_NUM
|P_VI_DEF
|P_VIM
|P_RBUF
,
2305 (char_u
*)&p_siso
, PV_NONE
,
2306 {(char_u
*)0L, (char_u
*)0L} SCRIPTID_INIT
},
2307 {"slowopen", "slow", P_BOOL
|P_VI_DEF
,
2308 (char_u
*)NULL
, PV_NONE
,
2309 {(char_u
*)FALSE
, (char_u
*)0L} SCRIPTID_INIT
},
2310 {"smartcase", "scs", P_BOOL
|P_VI_DEF
|P_VIM
,
2311 (char_u
*)&p_scs
, PV_NONE
,
2312 {(char_u
*)FALSE
, (char_u
*)0L} SCRIPTID_INIT
},
2313 {"smartindent", "si", P_BOOL
|P_VI_DEF
|P_VIM
,
2314 #ifdef FEAT_SMARTINDENT
2315 (char_u
*)&p_si
, PV_SI
,
2317 (char_u
*)NULL
, PV_NONE
,
2319 {(char_u
*)FALSE
, (char_u
*)0L} SCRIPTID_INIT
},
2320 {"smarttab", "sta", P_BOOL
|P_VI_DEF
|P_VIM
,
2321 (char_u
*)&p_sta
, PV_NONE
,
2322 {(char_u
*)FALSE
, (char_u
*)0L} SCRIPTID_INIT
},
2323 {"softtabstop", "sts", P_NUM
|P_VI_DEF
|P_VIM
,
2324 (char_u
*)&p_sts
, PV_STS
,
2325 {(char_u
*)0L, (char_u
*)0L} SCRIPTID_INIT
},
2326 {"sourceany", NULL
, P_BOOL
|P_VI_DEF
,
2327 (char_u
*)NULL
, PV_NONE
,
2328 {(char_u
*)FALSE
, (char_u
*)0L} SCRIPTID_INIT
},
2329 {"spell", NULL
, P_BOOL
|P_VI_DEF
|P_RWIN
,
2331 (char_u
*)VAR_WIN
, PV_SPELL
,
2333 (char_u
*)NULL
, PV_NONE
,
2335 {(char_u
*)FALSE
, (char_u
*)0L} SCRIPTID_INIT
},
2336 {"spellcapcheck", "spc", P_STRING
|P_ALLOCED
|P_VI_DEF
|P_RBUF
,
2338 (char_u
*)&p_spc
, PV_SPC
,
2339 {(char_u
*)"[.?!]\\_[\\])'\" ]\\+", (char_u
*)0L}
2341 (char_u
*)NULL
, PV_NONE
,
2342 {(char_u
*)0L, (char_u
*)0L}
2345 {"spellfile", "spf", P_STRING
|P_EXPAND
|P_ALLOCED
|P_VI_DEF
|P_SECURE
|P_COMMA
,
2347 (char_u
*)&p_spf
, PV_SPF
,
2348 {(char_u
*)"", (char_u
*)0L}
2350 (char_u
*)NULL
, PV_NONE
,
2351 {(char_u
*)0L, (char_u
*)0L}
2354 {"spelllang", "spl", P_STRING
|P_ALLOCED
|P_VI_DEF
|P_COMMA
|P_RBUF
|P_EXPAND
,
2356 (char_u
*)&p_spl
, PV_SPL
,
2357 {(char_u
*)"en", (char_u
*)0L}
2359 (char_u
*)NULL
, PV_NONE
,
2360 {(char_u
*)0L, (char_u
*)0L}
2363 {"spellsuggest", "sps", P_STRING
|P_VI_DEF
|P_EXPAND
|P_SECURE
|P_COMMA
,
2365 (char_u
*)&p_sps
, PV_NONE
,
2366 {(char_u
*)"best", (char_u
*)0L}
2368 (char_u
*)NULL
, PV_NONE
,
2369 {(char_u
*)0L, (char_u
*)0L}
2372 {"splitbelow", "sb", P_BOOL
|P_VI_DEF
,
2374 (char_u
*)&p_sb
, PV_NONE
,
2376 (char_u
*)NULL
, PV_NONE
,
2378 {(char_u
*)FALSE
, (char_u
*)0L} SCRIPTID_INIT
},
2379 {"splitright", "spr", P_BOOL
|P_VI_DEF
,
2380 #ifdef FEAT_VERTSPLIT
2381 (char_u
*)&p_spr
, PV_NONE
,
2383 (char_u
*)NULL
, PV_NONE
,
2385 {(char_u
*)FALSE
, (char_u
*)0L} SCRIPTID_INIT
},
2386 {"startofline", "sol", P_BOOL
|P_VI_DEF
|P_VIM
,
2387 (char_u
*)&p_sol
, PV_NONE
,
2388 {(char_u
*)TRUE
, (char_u
*)0L} SCRIPTID_INIT
},
2389 {"statusline" ,"stl", P_STRING
|P_VI_DEF
|P_ALLOCED
|P_RSTAT
,
2391 (char_u
*)&p_stl
, PV_STL
,
2393 (char_u
*)NULL
, PV_NONE
,
2395 {(char_u
*)"", (char_u
*)0L} SCRIPTID_INIT
},
2396 {"suffixes", "su", P_STRING
|P_VI_DEF
|P_COMMA
|P_NODUP
,
2397 (char_u
*)&p_su
, PV_NONE
,
2398 {(char_u
*)".bak,~,.o,.h,.info,.swp,.obj",
2399 (char_u
*)0L} SCRIPTID_INIT
},
2400 {"suffixesadd", "sua", P_STRING
|P_VI_DEF
|P_ALLOCED
|P_COMMA
|P_NODUP
,
2401 #ifdef FEAT_SEARCHPATH
2402 (char_u
*)&p_sua
, PV_SUA
,
2403 {(char_u
*)"", (char_u
*)0L}
2405 (char_u
*)NULL
, PV_NONE
,
2406 {(char_u
*)0L, (char_u
*)0L}
2409 {"swapfile", "swf", P_BOOL
|P_VI_DEF
|P_RSTAT
,
2410 (char_u
*)&p_swf
, PV_SWF
,
2411 {(char_u
*)TRUE
, (char_u
*)0L} SCRIPTID_INIT
},
2412 {"swapsync", "sws", P_STRING
|P_VI_DEF
,
2413 (char_u
*)&p_sws
, PV_NONE
,
2414 {(char_u
*)"fsync", (char_u
*)0L} SCRIPTID_INIT
},
2415 {"switchbuf", "swb", P_STRING
|P_VI_DEF
|P_COMMA
|P_NODUP
,
2416 (char_u
*)&p_swb
, PV_NONE
,
2417 {(char_u
*)"", (char_u
*)0L} SCRIPTID_INIT
},
2418 {"synmaxcol", "smc", P_NUM
|P_VI_DEF
|P_RBUF
,
2420 (char_u
*)&p_smc
, PV_SMC
,
2421 {(char_u
*)3000L, (char_u
*)0L}
2423 (char_u
*)NULL
, PV_NONE
,
2424 {(char_u
*)0L, (char_u
*)0L}
2427 {"syntax", "syn", P_STRING
|P_ALLOCED
|P_VI_DEF
|P_NOGLOB
|P_NFNAME
,
2429 (char_u
*)&p_syn
, PV_SYN
,
2430 {(char_u
*)"", (char_u
*)0L}
2432 (char_u
*)NULL
, PV_NONE
,
2433 {(char_u
*)0L, (char_u
*)0L}
2436 {"tabline", "tal", P_STRING
|P_VI_DEF
|P_RALL
,
2438 (char_u
*)&p_tal
, PV_NONE
,
2440 (char_u
*)NULL
, PV_NONE
,
2442 {(char_u
*)"", (char_u
*)0L} SCRIPTID_INIT
},
2443 {"tabpagemax", "tpm", P_NUM
|P_VI_DEF
,
2445 (char_u
*)&p_tpm
, PV_NONE
,
2447 (char_u
*)NULL
, PV_NONE
,
2449 {(char_u
*)10L, (char_u
*)0L} SCRIPTID_INIT
},
2450 {"tabstop", "ts", P_NUM
|P_VI_DEF
|P_RBUF
,
2451 (char_u
*)&p_ts
, PV_TS
,
2452 {(char_u
*)8L, (char_u
*)0L} SCRIPTID_INIT
},
2453 {"tagbsearch", "tbs", P_BOOL
|P_VI_DEF
,
2454 (char_u
*)&p_tbs
, PV_NONE
,
2455 #ifdef VMS /* binary searching doesn't appear to work on VMS */
2456 {(char_u
*)0L, (char_u
*)0L}
2458 {(char_u
*)TRUE
, (char_u
*)0L}
2461 {"taglength", "tl", P_NUM
|P_VI_DEF
,
2462 (char_u
*)&p_tl
, PV_NONE
,
2463 {(char_u
*)0L, (char_u
*)0L} SCRIPTID_INIT
},
2464 {"tagrelative", "tr", P_BOOL
|P_VIM
,
2465 (char_u
*)&p_tr
, PV_NONE
,
2466 {(char_u
*)FALSE
, (char_u
*)TRUE
} SCRIPTID_INIT
},
2467 {"tags", "tag", P_STRING
|P_EXPAND
|P_VI_DEF
|P_COMMA
|P_NODUP
,
2468 (char_u
*)&p_tags
, PV_TAGS
,
2470 #if defined(FEAT_EMACS_TAGS) && !defined(CASE_INSENSITIVE_FILENAME)
2471 (char_u
*)"./tags,./TAGS,tags,TAGS",
2473 (char_u
*)"./tags,tags",
2475 (char_u
*)0L} SCRIPTID_INIT
},
2476 {"tagstack", "tgst", P_BOOL
|P_VI_DEF
,
2477 (char_u
*)&p_tgst
, PV_NONE
,
2478 {(char_u
*)TRUE
, (char_u
*)0L} SCRIPTID_INIT
},
2479 {"term", NULL
, P_STRING
|P_EXPAND
|P_NODEFAULT
|P_NO_MKRC
|P_VI_DEF
|P_RALL
,
2480 (char_u
*)&T_NAME
, PV_NONE
,
2481 {(char_u
*)"", (char_u
*)0L} SCRIPTID_INIT
},
2482 {"termbidi", "tbidi", P_BOOL
|P_VI_DEF
,
2484 (char_u
*)&p_tbidi
, PV_NONE
,
2486 (char_u
*)NULL
, PV_NONE
,
2488 {(char_u
*)FALSE
, (char_u
*)0L} SCRIPTID_INIT
},
2489 {"termencoding", "tenc", P_STRING
|P_VI_DEF
|P_RCLR
,
2491 (char_u
*)&p_tenc
, PV_NONE
,
2492 {(char_u
*)"", (char_u
*)0L}
2494 (char_u
*)NULL
, PV_NONE
,
2495 {(char_u
*)0L, (char_u
*)0L}
2498 {"terse", NULL
, P_BOOL
|P_VI_DEF
,
2499 (char_u
*)&p_terse
, PV_NONE
,
2500 {(char_u
*)FALSE
, (char_u
*)0L} SCRIPTID_INIT
},
2501 {"textauto", "ta", P_BOOL
|P_VIM
,
2502 (char_u
*)&p_ta
, PV_NONE
,
2503 {(char_u
*)DFLT_TEXTAUTO
, (char_u
*)TRUE
}
2505 {"textmode", "tx", P_BOOL
|P_VI_DEF
|P_NO_MKRC
,
2506 (char_u
*)&p_tx
, PV_TX
,
2513 (char_u
*)0L} SCRIPTID_INIT
},
2514 {"textwidth", "tw", P_NUM
|P_VI_DEF
|P_VIM
,
2515 (char_u
*)&p_tw
, PV_TW
,
2516 {(char_u
*)0L, (char_u
*)0L} SCRIPTID_INIT
},
2517 {"thesaurus", "tsr", P_STRING
|P_EXPAND
|P_VI_DEF
|P_COMMA
|P_NODUP
,
2518 #ifdef FEAT_INS_EXPAND
2519 (char_u
*)&p_tsr
, PV_TSR
,
2521 (char_u
*)NULL
, PV_NONE
,
2523 {(char_u
*)"", (char_u
*)0L} SCRIPTID_INIT
},
2524 {"tildeop", "top", P_BOOL
|P_VI_DEF
|P_VIM
,
2525 (char_u
*)&p_to
, PV_NONE
,
2526 {(char_u
*)FALSE
, (char_u
*)0L} SCRIPTID_INIT
},
2527 {"timeout", "to", P_BOOL
|P_VI_DEF
,
2528 (char_u
*)&p_timeout
, PV_NONE
,
2529 {(char_u
*)TRUE
, (char_u
*)0L} SCRIPTID_INIT
},
2530 {"timeoutlen", "tm", P_NUM
|P_VI_DEF
,
2531 (char_u
*)&p_tm
, PV_NONE
,
2532 {(char_u
*)1000L, (char_u
*)0L} SCRIPTID_INIT
},
2533 {"title", NULL
, P_BOOL
|P_VI_DEF
,
2535 (char_u
*)&p_title
, PV_NONE
,
2537 (char_u
*)NULL
, PV_NONE
,
2539 {(char_u
*)FALSE
, (char_u
*)0L} SCRIPTID_INIT
},
2540 {"titlelen", NULL
, P_NUM
|P_VI_DEF
,
2542 (char_u
*)&p_titlelen
, PV_NONE
,
2544 (char_u
*)NULL
, PV_NONE
,
2546 {(char_u
*)85L, (char_u
*)0L} SCRIPTID_INIT
},
2547 {"titleold", NULL
, P_STRING
|P_VI_DEF
|P_GETTEXT
|P_SECURE
|P_NO_MKRC
,
2549 (char_u
*)&p_titleold
, PV_NONE
,
2550 {(char_u
*)N_("Thanks for flying Vim"),
2553 (char_u
*)NULL
, PV_NONE
,
2554 {(char_u
*)0L, (char_u
*)0L}
2557 {"titlestring", NULL
, P_STRING
|P_VI_DEF
,
2559 (char_u
*)&p_titlestring
, PV_NONE
,
2561 (char_u
*)NULL
, PV_NONE
,
2563 {(char_u
*)"", (char_u
*)0L} SCRIPTID_INIT
},
2564 #if defined(FEAT_TOOLBAR) && !defined(FEAT_GUI_W32)
2565 {"toolbar", "tb", P_STRING
|P_COMMA
|P_VI_DEF
|P_NODUP
,
2566 (char_u
*)&p_toolbar
, PV_NONE
,
2567 {(char_u
*)"icons,tooltips", (char_u
*)0L}
2570 #if defined(FEAT_TOOLBAR) && defined(FEAT_GUI_GTK) && defined(HAVE_GTK2)
2571 {"toolbariconsize", "tbis", P_STRING
|P_VI_DEF
,
2572 (char_u
*)&p_tbis
, PV_NONE
,
2573 {(char_u
*)"small", (char_u
*)0L} SCRIPTID_INIT
},
2575 {"ttimeout", NULL
, P_BOOL
|P_VI_DEF
|P_VIM
,
2576 (char_u
*)&p_ttimeout
, PV_NONE
,
2577 {(char_u
*)FALSE
, (char_u
*)0L} SCRIPTID_INIT
},
2578 {"ttimeoutlen", "ttm", P_NUM
|P_VI_DEF
,
2579 (char_u
*)&p_ttm
, PV_NONE
,
2580 {(char_u
*)-1L, (char_u
*)0L} SCRIPTID_INIT
},
2581 {"ttybuiltin", "tbi", P_BOOL
|P_VI_DEF
,
2582 (char_u
*)&p_tbi
, PV_NONE
,
2583 {(char_u
*)TRUE
, (char_u
*)0L} SCRIPTID_INIT
},
2584 {"ttyfast", "tf", P_BOOL
|P_NO_MKRC
|P_VI_DEF
,
2585 (char_u
*)&p_tf
, PV_NONE
,
2586 {(char_u
*)FALSE
, (char_u
*)0L} SCRIPTID_INIT
},
2587 {"ttymouse", "ttym", P_STRING
|P_NODEFAULT
|P_NO_MKRC
|P_VI_DEF
,
2588 #if defined(FEAT_MOUSE) && (defined(UNIX) || defined(VMS))
2589 (char_u
*)&p_ttym
, PV_NONE
,
2591 (char_u
*)NULL
, PV_NONE
,
2593 {(char_u
*)"", (char_u
*)0L} SCRIPTID_INIT
},
2594 {"ttyscroll", "tsl", P_NUM
|P_VI_DEF
,
2595 (char_u
*)&p_ttyscroll
, PV_NONE
,
2596 {(char_u
*)999L, (char_u
*)0L} SCRIPTID_INIT
},
2597 {"ttytype", "tty", P_STRING
|P_EXPAND
|P_NODEFAULT
|P_NO_MKRC
|P_VI_DEF
|P_RALL
,
2598 (char_u
*)&T_NAME
, PV_NONE
,
2599 {(char_u
*)"", (char_u
*)0L} SCRIPTID_INIT
},
2600 {"undolevels", "ul", P_NUM
|P_VI_DEF
,
2601 (char_u
*)&p_ul
, PV_NONE
,
2603 #if defined(UNIX) || defined(WIN3264) || defined(OS2) || defined(VMS)
2608 (char_u
*)0L} SCRIPTID_INIT
},
2609 {"updatecount", "uc", P_NUM
|P_VI_DEF
,
2610 (char_u
*)&p_uc
, PV_NONE
,
2611 {(char_u
*)200L, (char_u
*)0L} SCRIPTID_INIT
},
2612 {"updatetime", "ut", P_NUM
|P_VI_DEF
,
2613 (char_u
*)&p_ut
, PV_NONE
,
2614 {(char_u
*)4000L, (char_u
*)0L} SCRIPTID_INIT
},
2615 {"verbose", "vbs", P_NUM
|P_VI_DEF
,
2616 (char_u
*)&p_verbose
, PV_NONE
,
2617 {(char_u
*)0L, (char_u
*)0L} SCRIPTID_INIT
},
2618 {"verbosefile", "vfile", P_STRING
|P_EXPAND
|P_VI_DEF
|P_SECURE
,
2619 (char_u
*)&p_vfile
, PV_NONE
,
2620 {(char_u
*)"", (char_u
*)0L} SCRIPTID_INIT
},
2621 {"viewdir", "vdir", P_STRING
|P_EXPAND
|P_VI_DEF
|P_SECURE
,
2623 (char_u
*)&p_vdir
, PV_NONE
,
2624 {(char_u
*)DFLT_VDIR
, (char_u
*)0L}
2626 (char_u
*)NULL
, PV_NONE
,
2627 {(char_u
*)0L, (char_u
*)0L}
2630 {"viewoptions", "vop", P_STRING
|P_VI_DEF
|P_COMMA
|P_NODUP
,
2632 (char_u
*)&p_vop
, PV_NONE
,
2633 {(char_u
*)"folds,options,cursor", (char_u
*)0L}
2635 (char_u
*)NULL
, PV_NONE
,
2636 {(char_u
*)0L, (char_u
*)0L}
2639 {"viminfo", "vi", P_STRING
|P_COMMA
|P_NODUP
|P_SECURE
,
2641 (char_u
*)&p_viminfo
, PV_NONE
,
2642 #if defined(MSDOS) || defined(MSWIN) || defined(OS2)
2643 {(char_u
*)"", (char_u
*)"'100,<50,s10,h,rA:,rB:"}
2647 (char_u
*)"'100,<50,s10,h,rdf0:,rdf1:,rdf2:"}
2649 {(char_u
*)"", (char_u
*)"'100,<50,s10,h"}
2653 (char_u
*)NULL
, PV_NONE
,
2654 {(char_u
*)0L, (char_u
*)0L}
2657 {"virtualedit", "ve", P_STRING
|P_COMMA
|P_NODUP
|P_VI_DEF
|P_VIM
,
2658 #ifdef FEAT_VIRTUALEDIT
2659 (char_u
*)&p_ve
, PV_NONE
,
2660 {(char_u
*)"", (char_u
*)""}
2662 (char_u
*)NULL
, PV_NONE
,
2663 {(char_u
*)0L, (char_u
*)0L}
2666 {"visualbell", "vb", P_BOOL
|P_VI_DEF
,
2667 (char_u
*)&p_vb
, PV_NONE
,
2668 {(char_u
*)FALSE
, (char_u
*)0L} SCRIPTID_INIT
},
2669 {"w300", NULL
, P_NUM
|P_VI_DEF
,
2670 (char_u
*)NULL
, PV_NONE
,
2671 {(char_u
*)0L, (char_u
*)0L} SCRIPTID_INIT
},
2672 {"w1200", NULL
, P_NUM
|P_VI_DEF
,
2673 (char_u
*)NULL
, PV_NONE
,
2674 {(char_u
*)0L, (char_u
*)0L} SCRIPTID_INIT
},
2675 {"w9600", NULL
, P_NUM
|P_VI_DEF
,
2676 (char_u
*)NULL
, PV_NONE
,
2677 {(char_u
*)0L, (char_u
*)0L} SCRIPTID_INIT
},
2678 {"warn", NULL
, P_BOOL
|P_VI_DEF
,
2679 (char_u
*)&p_warn
, PV_NONE
,
2680 {(char_u
*)TRUE
, (char_u
*)0L} SCRIPTID_INIT
},
2681 {"weirdinvert", "wiv", P_BOOL
|P_VI_DEF
|P_RCLR
,
2682 (char_u
*)&p_wiv
, PV_NONE
,
2683 {(char_u
*)FALSE
, (char_u
*)0L} SCRIPTID_INIT
},
2684 {"whichwrap", "ww", P_STRING
|P_VIM
|P_COMMA
|P_FLAGLIST
,
2685 (char_u
*)&p_ww
, PV_NONE
,
2686 {(char_u
*)"", (char_u
*)"b,s"} SCRIPTID_INIT
},
2687 {"wildchar", "wc", P_NUM
|P_VIM
,
2688 (char_u
*)&p_wc
, PV_NONE
,
2689 {(char_u
*)(long)Ctrl_E
, (char_u
*)(long)TAB
}
2691 {"wildcharm", "wcm", P_NUM
|P_VI_DEF
,
2692 (char_u
*)&p_wcm
, PV_NONE
,
2693 {(char_u
*)0L, (char_u
*)0L} SCRIPTID_INIT
},
2694 {"wildignore", "wig", P_STRING
|P_VI_DEF
|P_COMMA
|P_NODUP
,
2696 (char_u
*)&p_wig
, PV_NONE
,
2698 (char_u
*)NULL
, PV_NONE
,
2700 {(char_u
*)"", (char_u
*)0L} SCRIPTID_INIT
},
2701 {"wildmenu", "wmnu", P_BOOL
|P_VI_DEF
,
2702 #ifdef FEAT_WILDMENU
2703 (char_u
*)&p_wmnu
, PV_NONE
,
2705 (char_u
*)NULL
, PV_NONE
,
2707 {(char_u
*)FALSE
, (char_u
*)0L} SCRIPTID_INIT
},
2708 {"wildmode", "wim", P_STRING
|P_VI_DEF
|P_COMMA
|P_NODUP
,
2709 (char_u
*)&p_wim
, PV_NONE
,
2710 {(char_u
*)"full", (char_u
*)0L} SCRIPTID_INIT
},
2711 {"wildoptions", "wop", P_STRING
|P_VI_DEF
,
2712 #ifdef FEAT_CMDL_COMPL
2713 (char_u
*)&p_wop
, PV_NONE
,
2714 {(char_u
*)"", (char_u
*)0L}
2716 (char_u
*)NULL
, PV_NONE
,
2717 {(char_u
*)NULL
, (char_u
*)0L}
2720 {"winaltkeys", "wak", P_STRING
|P_VI_DEF
,
2722 (char_u
*)&p_wak
, PV_NONE
,
2723 {(char_u
*)"menu", (char_u
*)0L}
2725 (char_u
*)NULL
, PV_NONE
,
2726 {(char_u
*)NULL
, (char_u
*)0L}
2729 {"window", "wi", P_NUM
|P_VI_DEF
,
2730 (char_u
*)&p_window
, PV_NONE
,
2731 {(char_u
*)0L, (char_u
*)0L} SCRIPTID_INIT
},
2732 {"winheight", "wh", P_NUM
|P_VI_DEF
,
2734 (char_u
*)&p_wh
, PV_NONE
,
2736 (char_u
*)NULL
, PV_NONE
,
2738 {(char_u
*)1L, (char_u
*)0L} SCRIPTID_INIT
},
2739 {"winfixheight", "wfh", P_BOOL
|P_VI_DEF
|P_RSTAT
,
2741 (char_u
*)VAR_WIN
, PV_WFH
,
2743 (char_u
*)NULL
, PV_NONE
,
2745 {(char_u
*)FALSE
, (char_u
*)0L} SCRIPTID_INIT
},
2746 {"winfixwidth", "wfw", P_BOOL
|P_VI_DEF
|P_RSTAT
,
2747 #ifdef FEAT_VERTSPLIT
2748 (char_u
*)VAR_WIN
, PV_WFW
,
2750 (char_u
*)NULL
, PV_NONE
,
2752 {(char_u
*)FALSE
, (char_u
*)0L} SCRIPTID_INIT
},
2753 {"winminheight", "wmh", P_NUM
|P_VI_DEF
,
2755 (char_u
*)&p_wmh
, PV_NONE
,
2757 (char_u
*)NULL
, PV_NONE
,
2759 {(char_u
*)1L, (char_u
*)0L} SCRIPTID_INIT
},
2760 {"winminwidth", "wmw", P_NUM
|P_VI_DEF
,
2761 #ifdef FEAT_VERTSPLIT
2762 (char_u
*)&p_wmw
, PV_NONE
,
2764 (char_u
*)NULL
, PV_NONE
,
2766 {(char_u
*)1L, (char_u
*)0L} SCRIPTID_INIT
},
2767 {"winwidth", "wiw", P_NUM
|P_VI_DEF
,
2768 #ifdef FEAT_VERTSPLIT
2769 (char_u
*)&p_wiw
, PV_NONE
,
2771 (char_u
*)NULL
, PV_NONE
,
2773 {(char_u
*)20L, (char_u
*)0L} SCRIPTID_INIT
},
2774 {"wrap", NULL
, P_BOOL
|P_VI_DEF
|P_RWIN
,
2775 (char_u
*)VAR_WIN
, PV_WRAP
,
2776 {(char_u
*)TRUE
, (char_u
*)0L} SCRIPTID_INIT
},
2777 {"wrapmargin", "wm", P_NUM
|P_VI_DEF
,
2778 (char_u
*)&p_wm
, PV_WM
,
2779 {(char_u
*)0L, (char_u
*)0L} SCRIPTID_INIT
},
2780 {"wrapscan", "ws", P_BOOL
|P_VI_DEF
,
2781 (char_u
*)&p_ws
, PV_NONE
,
2782 {(char_u
*)TRUE
, (char_u
*)0L} SCRIPTID_INIT
},
2783 {"write", NULL
, P_BOOL
|P_VI_DEF
,
2784 (char_u
*)&p_write
, PV_NONE
,
2785 {(char_u
*)TRUE
, (char_u
*)0L} SCRIPTID_INIT
},
2786 {"writeany", "wa", P_BOOL
|P_VI_DEF
,
2787 (char_u
*)&p_wa
, PV_NONE
,
2788 {(char_u
*)FALSE
, (char_u
*)0L} SCRIPTID_INIT
},
2789 {"writebackup", "wb", P_BOOL
|P_VI_DEF
|P_VIM
,
2790 (char_u
*)&p_wb
, PV_NONE
,
2792 #ifdef FEAT_WRITEBACKUP
2797 (char_u
*)0L} SCRIPTID_INIT
},
2798 {"writedelay", "wd", P_NUM
|P_VI_DEF
,
2799 (char_u
*)&p_wd
, PV_NONE
,
2800 {(char_u
*)0L, (char_u
*)0L} SCRIPTID_INIT
},
2802 /* terminal output codes */
2803 #define p_term(sss, vvv) {sss, NULL, P_STRING|P_VI_DEF|P_RALL|P_SECURE, \
2804 (char_u *)&vvv, PV_NONE, \
2805 {(char_u *)"", (char_u *)0L} SCRIPTID_INIT},
2807 p_term("t_AB", T_CAB
)
2808 p_term("t_AF", T_CAF
)
2809 p_term("t_AL", T_CAL
)
2810 p_term("t_al", T_AL
)
2811 p_term("t_bc", T_BC
)
2812 p_term("t_cd", T_CD
)
2813 p_term("t_ce", T_CE
)
2814 p_term("t_cl", T_CL
)
2815 p_term("t_cm", T_CM
)
2816 p_term("t_Co", T_CCO
)
2817 p_term("t_CS", T_CCS
)
2818 p_term("t_cs", T_CS
)
2819 #ifdef FEAT_VERTSPLIT
2820 p_term("t_CV", T_CSV
)
2822 p_term("t_ut", T_UT
)
2823 p_term("t_da", T_DA
)
2824 p_term("t_db", T_DB
)
2825 p_term("t_DL", T_CDL
)
2826 p_term("t_dl", T_DL
)
2827 p_term("t_fs", T_FS
)
2828 p_term("t_IE", T_CIE
)
2829 p_term("t_IS", T_CIS
)
2830 p_term("t_ke", T_KE
)
2831 p_term("t_ks", T_KS
)
2832 p_term("t_le", T_LE
)
2833 p_term("t_mb", T_MB
)
2834 p_term("t_md", T_MD
)
2835 p_term("t_me", T_ME
)
2836 p_term("t_mr", T_MR
)
2837 p_term("t_ms", T_MS
)
2838 p_term("t_nd", T_ND
)
2839 p_term("t_op", T_OP
)
2840 p_term("t_RI", T_CRI
)
2841 p_term("t_RV", T_CRV
)
2842 p_term("t_Sb", T_CSB
)
2843 p_term("t_Sf", T_CSF
)
2844 p_term("t_se", T_SE
)
2845 p_term("t_so", T_SO
)
2846 p_term("t_sr", T_SR
)
2847 p_term("t_ts", T_TS
)
2848 p_term("t_te", T_TE
)
2849 p_term("t_ti", T_TI
)
2850 p_term("t_ue", T_UE
)
2851 p_term("t_us", T_US
)
2852 p_term("t_vb", T_VB
)
2853 p_term("t_ve", T_VE
)
2854 p_term("t_vi", T_VI
)
2855 p_term("t_vs", T_VS
)
2856 p_term("t_WP", T_CWP
)
2857 p_term("t_WS", T_CWS
)
2858 p_term("t_SI", T_CSI
)
2859 p_term("t_EI", T_CEI
)
2860 p_term("t_xs", T_XS
)
2861 p_term("t_ZH", T_CZH
)
2862 p_term("t_ZR", T_CZR
)
2864 /* terminal key codes are not in here */
2867 {NULL
, NULL
, 0, NULL
, PV_NONE
, {NULL
, NULL
} SCRIPTID_INIT
}
2870 #define PARAM_COUNT (sizeof(options) / sizeof(struct vimoption))
2873 static char *(p_ambw_values
[]) = {"single", "double", NULL
};
2875 static char *(p_bg_values
[]) = {"light", "dark", NULL
};
2876 static char *(p_nf_values
[]) = {"octal", "hex", "alpha", NULL
};
2877 static char *(p_ff_values
[]) = {FF_UNIX
, FF_DOS
, FF_MAC
, NULL
};
2878 #ifdef FEAT_CMDL_COMPL
2879 static char *(p_wop_values
[]) = {"tagfile", NULL
};
2882 static char *(p_wak_values
[]) = {"yes", "menu", "no", NULL
};
2884 static char *(p_mousem_values
[]) = {"extend", "popup", "popup_setpos", "mac", NULL
};
2886 static char *(p_sel_values
[]) = {"inclusive", "exclusive", "old", NULL
};
2887 static char *(p_slm_values
[]) = {"mouse", "key", "cmd", NULL
};
2890 static char *(p_km_values
[]) = {"startsel", "stopsel", NULL
};
2893 static char *(p_bsdir_values
[]) = {"current", "last", "buffer", NULL
};
2895 #ifdef FEAT_SCROLLBIND
2896 static char *(p_scbopt_values
[]) = {"ver", "hor", "jump", NULL
};
2898 static char *(p_debug_values
[]) = {"msg", "throw", "beep", NULL
};
2899 #ifdef FEAT_VERTSPLIT
2900 static char *(p_ead_values
[]) = {"both", "ver", "hor", NULL
};
2902 #if defined(FEAT_QUICKFIX)
2903 # ifdef FEAT_AUTOCMD
2904 static char *(p_buftype_values
[]) = {"nofile", "nowrite", "quickfix", "help", "acwrite", NULL
};
2906 static char *(p_buftype_values
[]) = {"nofile", "nowrite", "quickfix", "help", NULL
};
2908 static char *(p_bufhidden_values
[]) = {"hide", "unload", "delete", "wipe", NULL
};
2910 static char *(p_bs_values
[]) = {"indent", "eol", "start", NULL
};
2912 static char *(p_fdm_values
[]) = {"manual", "expr", "marker", "indent", "syntax",
2917 static char *(p_fcl_values
[]) = {"all", NULL
};
2919 #ifdef FEAT_INS_EXPAND
2920 static char *(p_cot_values
[]) = {"menu", "menuone", "longest", "preview", NULL
};
2923 static void set_option_default
__ARGS((int, int opt_flags
, int compatible
));
2924 static void set_options_default
__ARGS((int opt_flags
));
2925 static char_u
*term_bg_default
__ARGS((void));
2926 static void did_set_option
__ARGS((int opt_idx
, int opt_flags
, int new_value
));
2927 static char_u
*illegal_char
__ARGS((char_u
*, int));
2928 static int string_to_key
__ARGS((char_u
*arg
));
2930 static char_u
*check_cedit
__ARGS((void));
2933 static void did_set_title
__ARGS((int icon
));
2935 static char_u
*option_expand
__ARGS((int opt_idx
, char_u
*val
));
2936 static void didset_options
__ARGS((void));
2937 static void check_string_option
__ARGS((char_u
**pp
));
2938 #if defined(FEAT_EVAL) || defined(PROTO)
2939 static long_u
*insecure_flag
__ARGS((int opt_idx
, int opt_flags
));
2941 # define insecure_flag(opt_idx, opt_flags) (&options[opt_idx].flags)
2943 static void set_string_option_global
__ARGS((int opt_idx
, char_u
**varp
));
2944 static void set_string_option
__ARGS((int opt_idx
, char_u
*value
, int opt_flags
));
2945 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
));
2946 static char_u
*set_chars_option
__ARGS((char_u
**varp
));
2947 #ifdef FEAT_CLIPBOARD
2948 static char_u
*check_clipboard_option
__ARGS((void));
2951 static char_u
*compile_cap_prog
__ARGS((buf_T
*buf
));
2954 static void set_option_scriptID_idx
__ARGS((int opt_idx
, int opt_flags
, int id
));
2956 static char_u
*set_bool_option
__ARGS((int opt_idx
, char_u
*varp
, int value
, int opt_flags
));
2957 static char_u
*set_num_option
__ARGS((int opt_idx
, char_u
*varp
, long value
, char_u
*errbuf
, size_t errbuflen
, int opt_flags
));
2958 static void check_redraw
__ARGS((long_u flags
));
2959 static int findoption
__ARGS((char_u
*));
2960 static int find_key_option
__ARGS((char_u
*));
2961 static void showoptions
__ARGS((int all
, int opt_flags
));
2962 static int optval_default
__ARGS((struct vimoption
*, char_u
*varp
));
2963 static void showoneopt
__ARGS((struct vimoption
*, int opt_flags
));
2964 static int put_setstring
__ARGS((FILE *fd
, char *cmd
, char *name
, char_u
**valuep
, int expand
));
2965 static int put_setnum
__ARGS((FILE *fd
, char *cmd
, char *name
, long *valuep
));
2966 static int put_setbool
__ARGS((FILE *fd
, char *cmd
, char *name
, int value
));
2967 static int istermoption
__ARGS((struct vimoption
*));
2968 static char_u
*get_varp_scope
__ARGS((struct vimoption
*p
, int opt_flags
));
2969 static char_u
*get_varp
__ARGS((struct vimoption
*));
2970 static void option_value2string
__ARGS((struct vimoption
*, int opt_flags
));
2971 static int wc_use_keyname
__ARGS((char_u
*varp
, long *wcp
));
2973 static void langmap_init
__ARGS((void));
2974 static void langmap_set
__ARGS((void));
2976 static void paste_option_changed
__ARGS((void));
2977 static void compatible_set
__ARGS((void));
2978 #ifdef FEAT_LINEBREAK
2979 static void fill_breakat_flags
__ARGS((void));
2981 static int opt_strings_flags
__ARGS((char_u
*val
, char **values
, unsigned *flagp
, int list
));
2982 static int check_opt_strings
__ARGS((char_u
*val
, char **values
, int));
2983 static int check_opt_wim
__ARGS((void));
2986 * Initialize the options, first part.
2988 * Called only once from main(), just after creating the first buffer.
3001 /* Be Vi compatible by default */
3004 /* Use POSIX compatibility when $VIM_POSIX is set. */
3005 if (mch_getenv((char_u
*)"VIM_POSIX") != NULL
)
3007 set_string_default("cpo", (char_u
*)CPO_ALL
);
3008 set_string_default("shm", (char_u
*)"A");
3012 * Find default value for 'shell' option.
3013 * Don't use it if it is empty.
3015 if (((p
= mch_getenv((char_u
*)"SHELL")) != NULL
&& *p
!= NUL
)
3016 #if defined(MSDOS) || defined(MSWIN) || defined(OS2)
3018 || ((p
= mch_getenv((char_u
*)"EMXSHELL")) != NULL
&& *p
!= NUL
)
3020 || ((p
= mch_getenv((char_u
*)"COMSPEC")) != NULL
&& *p
!= NUL
)
3022 || ((p
= default_shell()) != NULL
&& *p
!= NUL
)
3026 set_string_default("sh", p
);
3030 * Set the default for 'backupskip' to include environment variables for
3035 static char *(names
[4]) = {"", "TMPDIR", "TEMP", "TMP"};
3037 static char *(names
[3]) = {"TMPDIR", "TEMP", "TMP"};
3043 ga_init2(&ga
, 1, 100);
3044 for (n
= 0; n
< (long)(sizeof(names
) / sizeof(char *)); ++n
)
3048 if (*names
[n
] == NUL
)
3049 p
= (char_u
*)"/tmp";
3052 p
= vim_getenv((char_u
*)names
[n
], &mustfree
);
3053 if (p
!= NULL
&& *p
!= NUL
)
3055 /* First time count the NUL, otherwise count the ','. */
3056 len
= (int)STRLEN(p
) + 3;
3057 if (ga_grow(&ga
, len
) == OK
)
3060 STRCAT(ga
.ga_data
, ",");
3061 STRCAT(ga
.ga_data
, p
);
3062 add_pathsep(ga
.ga_data
);
3063 STRCAT(ga
.ga_data
, "*");
3070 if (ga
.ga_data
!= NULL
)
3072 set_string_default("bsk", ga
.ga_data
);
3073 vim_free(ga
.ga_data
);
3079 * 'maxmemtot' and 'maxmem' may have to be adjusted for available memory
3081 opt_idx
= findoption((char_u
*)"maxmemtot");
3084 #if !defined(HAVE_AVAIL_MEM) && !defined(HAVE_TOTAL_MEM)
3085 if (options
[opt_idx
].def_val
[VI_DEFAULT
] == (char_u
*)0L)
3088 #ifdef HAVE_AVAIL_MEM
3089 /* Use amount of memory available at this moment. */
3090 n
= (mch_avail_mem(FALSE
) >> 11);
3092 # ifdef HAVE_TOTAL_MEM
3093 /* Use amount of memory available to Vim. */
3094 n
= (mch_total_mem(FALSE
) >> 1);
3096 n
= (0x7fffffff >> 11);
3099 options
[opt_idx
].def_val
[VI_DEFAULT
] = (char_u
*)n
;
3100 opt_idx
= findoption((char_u
*)"maxmem");
3103 #if !defined(HAVE_AVAIL_MEM) && !defined(HAVE_TOTAL_MEM)
3104 if ((long)options
[opt_idx
].def_val
[VI_DEFAULT
] > n
3105 || (long)options
[opt_idx
].def_val
[VI_DEFAULT
] == 0L)
3107 options
[opt_idx
].def_val
[VI_DEFAULT
] = (char_u
*)n
;
3113 /* force 'shortname' for Win32s */
3114 if (gui_is_win32s())
3116 opt_idx
= findoption((char_u
*)"shortname");
3118 options
[opt_idx
].def_val
[VI_DEFAULT
] = (char_u
*)TRUE
;
3122 #ifdef FEAT_SEARCHPATH
3128 int mustfree
= FALSE
;
3130 /* Initialize the 'cdpath' option's default value. */
3131 cdpath
= vim_getenv((char_u
*)"CDPATH", &mustfree
);
3134 buf
= alloc((unsigned)((STRLEN(cdpath
) << 1) + 2));
3137 buf
[0] = ','; /* start with ",", current dir first */
3139 for (i
= 0; cdpath
[i
] != NUL
; ++i
)
3141 if (vim_ispathlistsep(cdpath
[i
]))
3145 if (cdpath
[i
] == ' ' || cdpath
[i
] == ',')
3147 buf
[j
++] = cdpath
[i
];
3151 opt_idx
= findoption((char_u
*)"cdpath");
3154 options
[opt_idx
].def_val
[VI_DEFAULT
] = buf
;
3155 options
[opt_idx
].flags
|= P_DEF_ALLOCED
;
3164 #if defined(FEAT_POSTSCRIPT) && (defined(MSWIN) || defined(OS2) || defined(VMS) || defined(EBCDIC) || defined(MAC) || defined(hpux))
3165 /* Set print encoding on platforms that don't default to latin1 */
3166 set_string_default("penc",
3167 # if defined(MSWIN) || defined(OS2)
3174 (char_u
*)"ebcdic-uk"
3177 (char_u
*)"mac-roman"
3179 (char_u
*)"hp-roman8"
3187 #ifdef FEAT_POSTSCRIPT
3188 /* 'printexpr' must be allocated to be able to evaluate it. */
3189 set_string_default("pexpr",
3190 # if defined(MSWIN) || defined(MSDOS) || defined(OS2)
3191 (char_u
*)"system('copy' . ' ' . v:fname_in . (&printdevice == '' ? ' LPT1:' : (' \"' . &printdevice . '\"'))) . delete(v:fname_in)"
3194 (char_u
*)"system('print/delete' . (&printdevice == '' ? '' : ' /queue=' . &printdevice) . ' ' . v:fname_in)"
3197 (char_u
*)"system('lpr' . (&printdevice == '' ? '' : ' -P' . &printdevice) . ' ' . v:fname_in) . delete(v:fname_in) + v:shell_error"
3204 * Set all the options (except the terminal options) to their default
3205 * value. Also set the global value for local options.
3207 set_options_default(0);
3210 if (found_reverse_arg
)
3211 set_option_value((char_u
*)"bg", 0L, (char_u
*)"dark", 0);
3214 curbuf
->b_p_initialized
= TRUE
;
3215 curbuf
->b_p_ar
= -1; /* no local 'autoread' value */
3216 check_buf_options(curbuf
);
3217 check_win_options(curwin
);
3220 /* Must be before option_expand(), because that one needs vim_isIDc() */
3224 /* Use the current chartab for the generic chartab. */
3225 init_spell_chartab();
3228 #ifdef FEAT_LINEBREAK
3230 * initialize the table for 'breakat'.
3232 fill_breakat_flags();
3236 * Expand environment variables and things like "~" for the defaults.
3237 * If option_expand() returns non-NULL the variable is expanded. This can
3238 * only happen for non-indirect options.
3239 * Also set the default to the expanded value, so ":set" does not list
3241 * Don't set the P_ALLOCED flag, because we don't want to free the
3244 for (opt_idx
= 0; !istermoption(&options
[opt_idx
]); opt_idx
++)
3246 if ((options
[opt_idx
].flags
& P_GETTEXT
)
3247 && options
[opt_idx
].var
!= NULL
)
3248 p
= (char_u
*)_(*(char **)options
[opt_idx
].var
);
3250 p
= option_expand(opt_idx
, NULL
);
3251 if (p
!= NULL
&& (p
= vim_strsave(p
)) != NULL
)
3253 *(char_u
**)options
[opt_idx
].var
= p
;
3255 * Defaults for all expanded options are currently the same for Vi
3256 * and Vim. When this changes, add some code here! Also need to
3257 * split P_DEF_ALLOCED in two.
3259 if (options
[opt_idx
].flags
& P_DEF_ALLOCED
)
3260 vim_free(options
[opt_idx
].def_val
[VI_DEFAULT
]);
3261 options
[opt_idx
].def_val
[VI_DEFAULT
] = p
;
3262 options
[opt_idx
].flags
|= P_DEF_ALLOCED
;
3266 /* Initialize the highlight_attr[] table. */
3267 highlight_changed();
3269 save_file_ff(curbuf
); /* Buffer is unchanged */
3271 /* Parse default for 'wildmode' */
3274 #if defined(FEAT_ARABIC)
3275 /* Detect use of mlterm.
3276 * Mlterm is a terminal emulator akin to xterm that has some special
3277 * abilities (bidi namely).
3278 * NOTE: mlterm's author is being asked to 'set' a variable
3279 * instead of an environment variable due to inheritance.
3281 if (mch_getenv((char_u
*)"MLTERM") != NULL
)
3282 set_option_value((char_u
*)"tbidi", 1L, NULL
, 0);
3285 #if defined(FEAT_WINDOWS) || defined(FEAT_FOLDING)
3286 /* Parse default for 'fillchars'. */
3287 (void)set_chars_option(&p_fcs
);
3290 #ifdef FEAT_CLIPBOARD
3291 /* Parse default for 'clipboard' */
3292 (void)check_clipboard_option();
3296 # if defined(WIN3264) && defined(FEAT_GETTEXT)
3298 * If $LANG isn't set, try to get a good value for it. This makes the
3299 * right language be used automatically. Don't do this for English.
3301 if (mch_getenv((char_u
*)"LANG") == NULL
)
3305 /* Could use LOCALE_SISO639LANGNAME, but it's not in Win95.
3306 * LOCALE_SABBREVLANGNAME gives us three letters, like "enu", we use
3307 * only the first two. */
3308 n
= GetLocaleInfo(LOCALE_USER_DEFAULT
, LOCALE_SABBREVLANGNAME
,
3310 if (n
>= 2 && STRNICMP(buf
, "en", 2) != 0)
3312 /* There are a few exceptions (probably more) */
3313 if (STRNICMP(buf
, "cht", 3) == 0 || STRNICMP(buf
, "zht", 3) == 0)
3314 STRCPY(buf
, "zh_TW");
3315 else if (STRNICMP(buf
, "chs", 3) == 0
3316 || STRNICMP(buf
, "zhc", 3) == 0)
3317 STRCPY(buf
, "zh_CN");
3318 else if (STRNICMP(buf
, "jp", 2) == 0)
3321 buf
[2] = NUL
; /* truncate to two-letter code */
3322 vim_setenv("LANG", buf
);
3326 # ifdef MACOS_CONVERT
3327 /* Moved to os_mac_conv.c to avoid dependency problems. */
3332 /* enc_locale() will try to find the encoding of the current locale. */
3338 /* Try setting 'encoding' and check if the value is valid.
3339 * If not, go back to the default "latin1". */
3342 if (STRCMP(p_enc
, "gb18030") == 0)
3344 /* We don't support "gb18030", but "cp936" is a good substitute
3345 * for practical purposes, thus use that. It's not an alias to
3346 * still support conversion between gb18030 and utf-8. */
3347 p_enc
= vim_strsave((char_u
*)"cp936");
3350 if (mb_init() == NULL
)
3352 opt_idx
= findoption((char_u
*)"encoding");
3355 options
[opt_idx
].def_val
[VI_DEFAULT
] = p_enc
;
3356 options
[opt_idx
].flags
|= P_DEF_ALLOCED
;
3359 #if defined(MSDOS) || defined(MSWIN) || defined(OS2) || defined(MACOS) \
3361 if (STRCMP(p_enc
, "latin1") == 0
3367 /* Adjust the default for 'isprint' and 'iskeyword' to match
3368 * latin1. Also set the defaults for when 'nocompatible' is
3370 set_string_option_direct((char_u
*)"isp", -1,
3371 ISP_LATIN1
, OPT_FREE
, SID_NONE
);
3372 set_string_option_direct((char_u
*)"isk", -1,
3373 ISK_LATIN1
, OPT_FREE
, SID_NONE
);
3374 opt_idx
= findoption((char_u
*)"isp");
3376 options
[opt_idx
].def_val
[VIM_DEFAULT
] = ISP_LATIN1
;
3377 opt_idx
= findoption((char_u
*)"isk");
3379 options
[opt_idx
].def_val
[VIM_DEFAULT
] = ISK_LATIN1
;
3380 (void)init_chartab();
3384 # if defined(WIN3264) && !defined(FEAT_GUI)
3385 /* Win32 console: When GetACP() returns a different value from
3386 * GetConsoleCP() set 'termencoding'. */
3387 if (GetACP() != GetConsoleCP())
3391 sprintf(buf
, "cp%ld", (long)GetConsoleCP());
3392 p_tenc
= vim_strsave((char_u
*)buf
);
3395 opt_idx
= findoption((char_u
*)"termencoding");
3398 options
[opt_idx
].def_val
[VI_DEFAULT
] = p_tenc
;
3399 options
[opt_idx
].flags
|= P_DEF_ALLOCED
;
3401 convert_setup(&input_conv
, p_tenc
, p_enc
);
3402 convert_setup(&output_conv
, p_enc
, p_tenc
);
3405 p_tenc
= empty_option
;
3408 # if defined(WIN3264) && defined(FEAT_MBYTE)
3409 /* $HOME may have characters in active code page. */
3421 #ifdef FEAT_MULTI_LANG
3422 /* Set the default for 'helplang'. */
3423 set_helplang_default(get_mess_lang());
3428 * Set an option to its default value.
3429 * This does not take care of side effects!
3432 set_option_default(opt_idx
, opt_flags
, compatible
)
3434 int opt_flags
; /* OPT_FREE, OPT_LOCAL and/or OPT_GLOBAL */
3435 int compatible
; /* use Vi default value */
3437 char_u
*varp
; /* pointer to variable for current option */
3438 int dvi
; /* index in def_val[] */
3441 int both
= (opt_flags
& (OPT_LOCAL
| OPT_GLOBAL
)) == 0;
3443 varp
= get_varp_scope(&(options
[opt_idx
]), both
? OPT_LOCAL
: opt_flags
);
3444 flags
= options
[opt_idx
].flags
;
3445 if (varp
!= NULL
) /* skip hidden option, nothing to do for it */
3447 dvi
= ((flags
& P_VI_DEF
) || compatible
) ? VI_DEFAULT
: VIM_DEFAULT
;
3448 if (flags
& P_STRING
)
3450 /* Use set_string_option_direct() for local options to handle
3451 * freeing and allocating the value. */
3452 if (options
[opt_idx
].indir
!= PV_NONE
)
3453 set_string_option_direct(NULL
, opt_idx
,
3454 options
[opt_idx
].def_val
[dvi
], opt_flags
, 0);
3457 if ((opt_flags
& OPT_FREE
) && (flags
& P_ALLOCED
))
3458 free_string_option(*(char_u
**)(varp
));
3459 *(char_u
**)varp
= options
[opt_idx
].def_val
[dvi
];
3460 options
[opt_idx
].flags
&= ~P_ALLOCED
;
3463 else if (flags
& P_NUM
)
3465 if (options
[opt_idx
].indir
== PV_SCROLL
)
3466 win_comp_scroll(curwin
);
3469 *(long *)varp
= (long)(long_i
)options
[opt_idx
].def_val
[dvi
];
3470 /* May also set global value for local option. */
3472 *(long *)get_varp_scope(&(options
[opt_idx
]), OPT_GLOBAL
) =
3478 /* the cast to long is required for Manx C, long_i is needed for
3480 *(int *)varp
= (int)(long)(long_i
)options
[opt_idx
].def_val
[dvi
];
3482 /* 'modeline' defaults to off for root */
3483 if (options
[opt_idx
].indir
== PV_ML
&& getuid() == ROOT_UID
)
3484 *(int *)varp
= FALSE
;
3486 /* May also set global value for local option. */
3488 *(int *)get_varp_scope(&(options
[opt_idx
]), OPT_GLOBAL
) =
3492 /* The default value is not insecure. */
3493 flagsp
= insecure_flag(opt_idx
, opt_flags
);
3494 *flagsp
= *flagsp
& ~P_INSECURE
;
3498 set_option_scriptID_idx(opt_idx
, opt_flags
, current_SID
);
3503 * Set all options (except terminal options) to their default value.
3506 set_options_default(opt_flags
)
3507 int opt_flags
; /* OPT_FREE, OPT_LOCAL and/or OPT_GLOBAL */
3515 for (i
= 0; !istermoption(&options
[i
]); i
++)
3516 if (!(options
[i
].flags
& P_NODEFAULT
))
3517 set_option_default(i
, opt_flags
, p_cp
);
3520 /* The 'scroll' option must be computed for all windows. */
3521 FOR_ALL_TAB_WINDOWS(tp
, wp
)
3522 win_comp_scroll(wp
);
3524 win_comp_scroll(curwin
);
3529 * Set the Vi-default value of a string option.
3530 * Used for 'sh', 'backupskip' and 'term'.
3533 set_string_default(name
, val
)
3540 p
= vim_strsave(val
);
3541 if (p
!= NULL
) /* we don't want a NULL */
3543 opt_idx
= findoption((char_u
*)name
);
3546 if (options
[opt_idx
].flags
& P_DEF_ALLOCED
)
3547 vim_free(options
[opt_idx
].def_val
[VI_DEFAULT
]);
3548 options
[opt_idx
].def_val
[VI_DEFAULT
] = p
;
3549 options
[opt_idx
].flags
|= P_DEF_ALLOCED
;
3555 * Set the Vi-default value of a number option.
3556 * Used for 'lines' and 'columns'.
3559 set_number_default(name
, val
)
3565 opt_idx
= findoption((char_u
*)name
);
3567 options
[opt_idx
].def_val
[VI_DEFAULT
] = (char_u
*)(long_i
)val
;
3570 #if defined(EXITFREE) || defined(PROTO)
3579 for (i
= 0; !istermoption(&options
[i
]); i
++)
3581 if (options
[i
].indir
== PV_NONE
)
3583 /* global option: free value and default value. */
3584 if (options
[i
].flags
& P_ALLOCED
&& options
[i
].var
!= NULL
)
3585 free_string_option(*(char_u
**)options
[i
].var
);
3586 if (options
[i
].flags
& P_DEF_ALLOCED
)
3587 free_string_option(options
[i
].def_val
[VI_DEFAULT
]);
3589 else if (options
[i
].var
!= VAR_WIN
3590 && (options
[i
].flags
& P_STRING
))
3591 /* buffer-local option: free global value */
3592 free_string_option(*(char_u
**)options
[i
].var
);
3599 * Initialize the options, part two: After getting Rows and Columns and
3608 * 'scroll' defaults to half the window height. Note that this default is
3609 * wrong when the window height changes.
3611 set_number_default("scroll", (long)((long_u
)Rows
>> 1));
3612 idx
= findoption((char_u
*)"scroll");
3613 if (idx
>= 0 && !(options
[idx
].flags
& P_WAS_SET
))
3614 set_option_default(idx
, OPT_LOCAL
, p_cp
);
3618 * 'window' is only for backwards compatibility with Vi.
3619 * Default is Rows - 1.
3621 if (!option_was_set((char_u
*)"window"))
3622 p_window
= Rows
- 1;
3623 set_number_default("window", Rows
- 1);
3625 /* For DOS console the default is always black. */
3626 #if !((defined(MSDOS) || defined(OS2) || defined(WIN3264)) && !defined(FEAT_GUI))
3628 * If 'background' wasn't set by the user, try guessing the value,
3629 * depending on the terminal name. Only need to check for terminals
3630 * with a dark background, that can handle color.
3632 idx
= findoption((char_u
*)"bg");
3633 if (idx
>= 0 && !(options
[idx
].flags
& P_WAS_SET
)
3634 && *term_bg_default() == 'd')
3636 set_string_option_direct(NULL
, idx
, (char_u
*)"dark", OPT_FREE
, 0);
3637 /* don't mark it as set, when starting the GUI it may be
3639 options
[idx
].flags
&= ~P_WAS_SET
;
3644 parse_shape_opt(SHAPE_CURSOR
); /* set cursor shapes from 'guicursor' */
3646 #ifdef FEAT_MOUSESHAPE
3647 parse_shape_opt(SHAPE_MOUSE
); /* set mouse shapes from 'mouseshape' */
3650 (void)parse_printoptions(); /* parse 'printoptions' default value */
3655 * Return "dark" or "light" depending on the kind of terminal.
3656 * This is just guessing! Recognized are:
3657 * "linux" Linux console
3658 * "screen.linux" Linux console with screen
3659 * "cygwin" Cygwin shell
3660 * "putty" Putty program
3661 * We also check the COLORFGBG environment variable, which is set by
3662 * rxvt and derivatives. This variable contains either two or three
3663 * values separated by semicolons; we want the last value in either
3664 * case. If this value is 0-6 or 8, our background is dark.
3669 #if defined(MSDOS) || defined(OS2) || defined(WIN3264)
3670 /* DOS console nearly always black */
3671 return (char_u
*)"dark";
3675 if (STRCMP(T_NAME
, "linux") == 0
3676 || STRCMP(T_NAME
, "screen.linux") == 0
3677 || STRCMP(T_NAME
, "cygwin") == 0
3678 || STRCMP(T_NAME
, "putty") == 0
3679 || ((p
= mch_getenv((char_u
*)"COLORFGBG")) != NULL
3680 && (p
= vim_strrchr(p
, ';')) != NULL
3681 && ((p
[1] >= '0' && p
[1] <= '6') || p
[1] == '8')
3683 return (char_u
*)"dark";
3684 return (char_u
*)"light";
3689 * Initialize the options, part three: After reading the .vimrc
3694 #if defined(UNIX) || defined(OS2) || defined(WIN3264)
3696 * Set 'shellpipe' and 'shellredir', depending on the 'shell' option.
3697 * This is done after other initializations, where 'shell' might have been
3698 * set, but only if they have not been set before.
3703 #ifdef FEAT_QUICKFIX
3708 idx_srr
= findoption((char_u
*)"srr");
3712 do_srr
= !(options
[idx_srr
].flags
& P_WAS_SET
);
3713 #ifdef FEAT_QUICKFIX
3714 idx_sp
= findoption((char_u
*)"sp");
3718 do_sp
= !(options
[idx_sp
].flags
& P_WAS_SET
);
3722 * Isolate the name of the shell:
3723 * - Skip beyond any path. E.g., "/usr/bin/csh -f" -> "csh -f".
3724 * - Remove any argument. E.g., "csh -f" -> "csh".
3727 p
= vim_strnsave(p
, (int)(skiptowhite(p
) - p
));
3731 * Default for p_sp is "| tee", for p_srr is ">".
3732 * For known shells it is changed here to include stderr.
3734 if ( fnamecmp(p
, "csh") == 0
3735 || fnamecmp(p
, "tcsh") == 0
3736 # if defined(OS2) || defined(WIN3264) /* also check with .exe extension */
3737 || fnamecmp(p
, "csh.exe") == 0
3738 || fnamecmp(p
, "tcsh.exe") == 0
3742 #if defined(FEAT_QUICKFIX)
3746 p_sp
= (char_u
*)">&";
3748 p_sp
= (char_u
*)"|& tee";
3750 options
[idx_sp
].def_val
[VI_DEFAULT
] = p_sp
;
3755 p_srr
= (char_u
*)">&";
3756 options
[idx_srr
].def_val
[VI_DEFAULT
] = p_srr
;
3760 # ifndef OS2 /* Always use bourne shell style redirection if we reach this */
3761 if ( fnamecmp(p
, "sh") == 0
3762 || fnamecmp(p
, "ksh") == 0
3763 || fnamecmp(p
, "zsh") == 0
3764 || fnamecmp(p
, "zsh-beta") == 0
3765 || fnamecmp(p
, "bash") == 0
3767 || fnamecmp(p
, "cmd") == 0
3768 || fnamecmp(p
, "sh.exe") == 0
3769 || fnamecmp(p
, "ksh.exe") == 0
3770 || fnamecmp(p
, "zsh.exe") == 0
3771 || fnamecmp(p
, "zsh-beta.exe") == 0
3772 || fnamecmp(p
, "bash.exe") == 0
3773 || fnamecmp(p
, "cmd.exe") == 0
3778 #if defined(FEAT_QUICKFIX)
3782 p_sp
= (char_u
*)">%s 2>&1";
3784 p_sp
= (char_u
*)"2>&1| tee";
3786 options
[idx_sp
].def_val
[VI_DEFAULT
] = p_sp
;
3791 p_srr
= (char_u
*)">%s 2>&1";
3792 options
[idx_srr
].def_val
[VI_DEFAULT
] = p_srr
;
3799 #if defined(MSDOS) || defined(WIN3264) || defined(OS2)
3801 * Set 'shellcmdflag and 'shellquote' depending on the 'shell' option.
3802 * This is done after other initializations, where 'shell' might have been
3803 * set, but only if they have not been set before. Default for p_shcf is
3804 * "/c", for p_shq is "". For "sh" like shells it is changed here to
3805 * "-c" and "\"", but not for DJGPP, because it starts the shell without
3806 * command.com. And for Win32 we need to set p_sxq instead.
3808 if (strstr((char *)gettail(p_sh
), "sh") != NULL
)
3812 idx3
= findoption((char_u
*)"shcf");
3813 if (idx3
>= 0 && !(options
[idx3
].flags
& P_WAS_SET
))
3815 p_shcf
= (char_u
*)"-c";
3816 options
[idx3
].def_val
[VI_DEFAULT
] = p_shcf
;
3821 /* Somehow Win32 requires the quotes around the redirection too */
3822 idx3
= findoption((char_u
*)"sxq");
3823 if (idx3
>= 0 && !(options
[idx3
].flags
& P_WAS_SET
))
3825 p_sxq
= (char_u
*)"\"";
3826 options
[idx3
].def_val
[VI_DEFAULT
] = p_sxq
;
3829 idx3
= findoption((char_u
*)"shq");
3830 if (idx3
>= 0 && !(options
[idx3
].flags
& P_WAS_SET
))
3832 p_shq
= (char_u
*)"\"";
3833 options
[idx3
].def_val
[VI_DEFAULT
] = p_shq
;
3841 set_title_defaults();
3845 #if defined(FEAT_MULTI_LANG) || defined(PROTO)
3847 * When 'helplang' is still at its default value, set it to "lang".
3848 * Only the first two characters of "lang" are used.
3851 set_helplang_default(lang
)
3856 if (lang
== NULL
|| STRLEN(lang
) < 2) /* safety check */
3858 idx
= findoption((char_u
*)"hlg");
3859 if (idx
>= 0 && !(options
[idx
].flags
& P_WAS_SET
))
3861 if (options
[idx
].flags
& P_ALLOCED
)
3862 free_string_option(p_hlg
);
3863 p_hlg
= vim_strsave(lang
);
3865 p_hlg
= empty_option
;
3868 /* zh_CN becomes "cn", zh_TW becomes "tw". */
3869 if (STRNICMP(p_hlg
, "zh_", 3) == 0 && STRLEN(p_hlg
) >= 5)
3871 p_hlg
[0] = TOLOWER_ASC(p_hlg
[3]);
3872 p_hlg
[1] = TOLOWER_ASC(p_hlg
[4]);
3876 options
[idx
].flags
|= P_ALLOCED
;
3882 static char_u
*gui_bg_default
__ARGS((void));
3887 if (gui_get_lightness(gui
.back_pixel
) < 127)
3888 return (char_u
*)"dark";
3889 return (char_u
*)"light";
3893 * Option initializations that can only be done after opening the GUI window.
3898 /* Set the 'background' option according to the lightness of the
3899 * background color, unless the user has set it already. */
3900 if (!option_was_set((char_u
*)"bg") && STRCMP(p_bg
, gui_bg_default()) != 0)
3902 set_option_value((char_u
*)"bg", 0L, gui_bg_default(), 0);
3903 highlight_changed();
3910 * 'title' and 'icon' only default to true if they have not been set or reset
3911 * in .vimrc and we can read the old value.
3912 * When 'title' and 'icon' have been reset in .vimrc, we won't even check if
3913 * they can be reset. This reduces startup time when using X on a remote
3917 set_title_defaults()
3923 * If GUI is (going to be) used, we can always set the window title and
3924 * icon name. Saves a bit of time, because the X11 display server does
3925 * not need to be contacted.
3927 idx1
= findoption((char_u
*)"title");
3928 if (idx1
>= 0 && !(options
[idx1
].flags
& P_WAS_SET
))
3931 if (gui
.starting
|| gui
.in_use
)
3935 val
= mch_can_restore_title();
3936 options
[idx1
].def_val
[VI_DEFAULT
] = (char_u
*)(long_i
)val
;
3939 idx1
= findoption((char_u
*)"icon");
3940 if (idx1
>= 0 && !(options
[idx1
].flags
& P_WAS_SET
))
3943 if (gui
.starting
|| gui
.in_use
)
3947 val
= mch_can_restore_icon();
3948 options
[idx1
].def_val
[VI_DEFAULT
] = (char_u
*)(long_i
)val
;
3955 * Parse 'arg' for option settings.
3957 * 'arg' may be IObuff, but only when no errors can be present and option
3958 * does not need to be expanded with option_expand().
3961 * OPT_GLOBAL for ":setglobal"
3962 * OPT_LOCAL for ":setlocal" and a modeline
3963 * OPT_MODELINE for a modeline
3964 * OPT_WINONLY to only set window-local options
3965 * OPT_NOWIN to skip setting window-local options
3967 * returns FAIL if an error is detected, OK otherwise
3970 do_set(arg
, opt_flags
)
3971 char_u
*arg
; /* option string (may be written to!) */
3978 int prefix
; /* 1: nothing, 0: "no", 2: "inv" in front of name */
3979 int nextchar
; /* next non-white char after option name */
3980 int afterchar
; /* character just after option name */
3985 long_u flags
; /* flags for current option */
3986 char_u
*varp
= NULL
; /* pointer to variable for current option */
3987 int did_show
= FALSE
; /* already showed one value */
3988 int adding
; /* "opt+=arg" */
3989 int prepending
; /* "opt^=arg" */
3990 int removing
; /* "opt-=arg" */
3996 showoptions(0, opt_flags
);
4001 while (*arg
!= NUL
) /* loop to process all options */
4004 startarg
= arg
; /* remember for error message */
4006 if (STRNCMP(arg
, "all", 3) == 0 && !isalpha(arg
[3])
4007 && !(opt_flags
& OPT_MODELINE
))
4010 * ":set all" show all options.
4011 * ":set all&" set all options to their default value.
4017 /* Only for :set command set global value of local options. */
4018 set_options_default(OPT_FREE
| opt_flags
);
4022 showoptions(1, opt_flags
);
4026 else if (STRNCMP(arg
, "termcap", 7) == 0 && !(opt_flags
& OPT_MODELINE
))
4028 showoptions(2, opt_flags
);
4036 if (STRNCMP(arg
, "no", 2) == 0 && STRNCMP(arg
, "novice", 6) != 0)
4041 else if (STRNCMP(arg
, "inv", 3) == 0)
4047 /* find end of name */
4053 /* look out for <t_>;> */
4054 if (arg
[1] == 't' && arg
[2] == '_' && arg
[3] && arg
[4])
4059 while (arg
[len
] != NUL
&& arg
[len
] != '>')
4062 if (arg
[len
] != '>')
4067 arg
[len
] = NUL
; /* put NUL after name */
4068 if (arg
[1] == 't' && arg
[2] == '_') /* could be term code */
4069 opt_idx
= findoption(arg
+ 1);
4070 arg
[len
++] = '>'; /* restore '>' */
4072 key
= find_key_option(arg
+ 1);
4078 * The two characters after "t_" may not be alphanumeric.
4080 if (arg
[0] == 't' && arg
[1] == '_' && arg
[2] && arg
[3])
4083 while (ASCII_ISALNUM(arg
[len
]) || arg
[len
] == '_')
4085 nextchar
= arg
[len
];
4086 arg
[len
] = NUL
; /* put NUL after name */
4087 opt_idx
= findoption(arg
);
4088 arg
[len
] = nextchar
; /* restore nextchar */
4090 key
= find_key_option(arg
);
4093 /* remember character after option name */
4094 afterchar
= arg
[len
];
4096 /* skip white space, allow ":set ai ?" */
4097 while (vim_iswhite(arg
[len
]))
4103 if (arg
[len
] != NUL
&& arg
[len
+ 1] == '=')
4105 if (arg
[len
] == '+')
4107 adding
= TRUE
; /* "+=" */
4110 else if (arg
[len
] == '^')
4112 prepending
= TRUE
; /* "^=" */
4115 else if (arg
[len
] == '-')
4117 removing
= TRUE
; /* "-=" */
4121 nextchar
= arg
[len
];
4123 if (opt_idx
== -1 && key
== 0) /* found a mismatch: skip */
4125 errmsg
= (char_u
*)N_("E518: Unknown option");
4131 if (options
[opt_idx
].var
== NULL
) /* hidden option: skip */
4133 /* Only give an error message when requesting the value of
4134 * a hidden option, ignore setting it. */
4135 if (vim_strchr((char_u
*)"=:!&<", nextchar
) == NULL
4136 && (!(options
[opt_idx
].flags
& P_BOOL
)
4137 || nextchar
== '?'))
4138 errmsg
= (char_u
*)N_("E519: Option not supported");
4142 flags
= options
[opt_idx
].flags
;
4143 varp
= get_varp_scope(&(options
[opt_idx
]), opt_flags
);
4150 key_name
[0] = KEY2TERMCAP0(key
);
4151 key_name
[1] = KEY2TERMCAP1(key
);
4155 key_name
[0] = KS_KEY
;
4156 key_name
[1] = (key
& 0xff);
4160 /* Skip all options that are not window-local (used when showing
4161 * an already loaded buffer in a window). */
4162 if ((opt_flags
& OPT_WINONLY
)
4163 && (opt_idx
< 0 || options
[opt_idx
].var
!= VAR_WIN
))
4166 /* Skip all options that are window-local (used for :vimgrep). */
4167 if ((opt_flags
& OPT_NOWIN
) && opt_idx
>= 0
4168 && options
[opt_idx
].var
== VAR_WIN
)
4171 /* Disallow changing some options from modelines. */
4172 if (opt_flags
& OPT_MODELINE
)
4174 if (flags
& P_SECURE
)
4176 errmsg
= (char_u
*)_("E520: Not allowed in a modeline");
4180 /* In diff mode some options are overruled. This avoids that
4181 * 'foldmethod' becomes "marker" instead of "diff" and that
4182 * "wrap" gets set. */
4183 if (curwin
->w_p_diff
4184 && (options
[opt_idx
].indir
== PV_FDM
4185 || options
[opt_idx
].indir
== PV_WRAP
))
4191 /* Disallow changing some options in the sandbox */
4192 if (sandbox
!= 0 && (flags
& P_SECURE
))
4194 errmsg
= (char_u
*)_(e_sandbox
);
4199 if (vim_strchr((char_u
*)"?=:!&<", nextchar
) != NULL
)
4203 if (nextchar
== '&' && arg
[1] == 'v' && arg
[2] == 'i')
4205 if (arg
[3] == 'm') /* "opt&vim": set to Vim default */
4210 else /* "opt&vi": set to Vi default */
4216 if (vim_strchr((char_u
*)"?!&<", nextchar
) != NULL
4217 && arg
[1] != NUL
&& !vim_iswhite(arg
[1]))
4219 errmsg
= e_trailing
;
4225 * allow '=' and ':' as MSDOS command.com allows only one
4226 * '=' character per "set" command line. grrr. (jw)
4230 && vim_strchr((char_u
*)"=:&<", nextchar
) == NULL
4231 && !(flags
& P_BOOL
)))
4237 msg_putchar('\n'); /* cursor below last one */
4240 gotocmdline(TRUE
); /* cursor at status line */
4241 did_show
= TRUE
; /* remember that we did a line */
4245 showoneopt(&options
[opt_idx
], opt_flags
);
4249 /* Mention where the option was last set. */
4250 if (varp
== options
[opt_idx
].var
)
4251 last_set_msg(options
[opt_idx
].scriptID
);
4252 else if ((int)options
[opt_idx
].indir
& PV_WIN
)
4253 last_set_msg(curwin
->w_p_scriptID
[
4254 (int)options
[opt_idx
].indir
& PV_MASK
]);
4255 else if ((int)options
[opt_idx
].indir
& PV_BUF
)
4256 last_set_msg(curbuf
->b_p_scriptID
[
4257 (int)options
[opt_idx
].indir
& PV_MASK
]);
4265 p
= find_termcode(key_name
);
4268 errmsg
= (char_u
*)N_("E518: Unknown option");
4272 (void)show_one_termcode(key_name
, p
, TRUE
);
4275 && nextchar
!= NUL
&& !vim_iswhite(afterchar
))
4276 errmsg
= e_trailing
;
4280 if (flags
& P_BOOL
) /* boolean */
4282 if (nextchar
== '=' || nextchar
== ':')
4289 * ":set opt!": invert
4290 * ":set opt&": reset to default value
4291 * ":set opt<": reset to global value
4293 if (nextchar
== '!')
4294 value
= *(int *)(varp
) ^ 1;
4295 else if (nextchar
== '&')
4296 value
= (int)(long)(long_i
)options
[opt_idx
].def_val
[
4297 ((flags
& P_VI_DEF
) || cp_val
)
4298 ? VI_DEFAULT
: VIM_DEFAULT
];
4299 else if (nextchar
== '<')
4301 /* For 'autoread' -1 means to use global value. */
4302 if ((int *)varp
== &curbuf
->b_p_ar
4303 && opt_flags
== OPT_LOCAL
)
4306 value
= *(int *)get_varp_scope(&(options
[opt_idx
]),
4312 * ":set invopt": invert
4313 * ":set opt" or ":set noopt": set or reset
4315 if (nextchar
!= NUL
&& !vim_iswhite(afterchar
))
4317 errmsg
= e_trailing
;
4320 if (prefix
== 2) /* inv */
4321 value
= *(int *)(varp
) ^ 1;
4326 errmsg
= set_bool_option(opt_idx
, varp
, (int)value
,
4329 else /* numeric or string */
4331 if (vim_strchr((char_u
*)"=:&<", nextchar
) == NULL
4338 if (flags
& P_NUM
) /* numeric */
4341 * Different ways to set a number option:
4342 * & set to default value
4343 * < set to global value
4344 * <xx> accept special key codes for 'wildchar'
4345 * c accept any non-digit for 'wildchar'
4350 if (nextchar
== '&')
4351 value
= (long)(long_i
)options
[opt_idx
].def_val
[
4352 ((flags
& P_VI_DEF
) || cp_val
)
4353 ? VI_DEFAULT
: VIM_DEFAULT
];
4354 else if (nextchar
== '<')
4355 value
= *(long *)get_varp_scope(&(options
[opt_idx
]),
4357 else if (((long *)varp
== &p_wc
4358 || (long *)varp
== &p_wcm
)
4361 || ((!arg
[1] || vim_iswhite(arg
[1]))
4362 && !VIM_ISDIGIT(*arg
))))
4364 value
= string_to_key(arg
);
4365 if (value
== 0 && (long *)varp
!= &p_wcm
)
4371 /* allow negative numbers (for 'undolevels') */
4372 else if (*arg
== '-' || VIM_ISDIGIT(*arg
))
4378 value
= strtol((char *)arg
, NULL
, 0);
4379 if (arg
[i
] == '0' && TOLOWER_ASC(arg
[i
+ 1]) == 'x')
4382 value
= atol((char *)arg
);
4384 while (VIM_ISDIGIT(arg
[i
]))
4386 if (arg
[i
] != NUL
&& !vim_iswhite(arg
[i
]))
4394 errmsg
= (char_u
*)N_("E521: Number required after =");
4399 value
= *(long *)varp
+ value
;
4401 value
= *(long *)varp
* value
;
4403 value
= *(long *)varp
- value
;
4404 errmsg
= set_num_option(opt_idx
, varp
, value
,
4405 errbuf
, sizeof(errbuf
), opt_flags
);
4407 else if (opt_idx
>= 0) /* string */
4409 char_u
*save_arg
= NULL
;
4411 char_u
*oldval
; /* previous value if *varp */
4417 int new_value_alloced
; /* new string option
4420 /* When using ":set opt=val" for a global option
4421 * with a local value the local value will be
4422 * reset, use the global value here. */
4423 if ((opt_flags
& (OPT_LOCAL
| OPT_GLOBAL
)) == 0
4424 && ((int)options
[opt_idx
].indir
& PV_BOTH
))
4425 varp
= options
[opt_idx
].var
;
4427 /* The old value is kept until we are sure that the
4428 * new value is valid. */
4429 oldval
= *(char_u
**)varp
;
4430 if (nextchar
== '&') /* set to default val */
4432 newval
= options
[opt_idx
].def_val
[
4433 ((flags
& P_VI_DEF
) || cp_val
)
4434 ? VI_DEFAULT
: VIM_DEFAULT
];
4435 if ((char_u
**)varp
== &p_bg
)
4437 /* guess the value of 'background' */
4440 newval
= gui_bg_default();
4443 newval
= term_bg_default();
4446 /* expand environment variables and ~ (since the
4447 * default value was already expanded, only
4448 * required when an environment variable was set
4451 newval
= empty_option
;
4454 s
= option_expand(opt_idx
, newval
);
4457 newval
= vim_strsave(s
);
4459 new_value_alloced
= TRUE
;
4461 else if (nextchar
== '<') /* set to global val */
4463 newval
= vim_strsave(*(char_u
**)get_varp_scope(
4464 &(options
[opt_idx
]), OPT_GLOBAL
));
4465 new_value_alloced
= TRUE
;
4469 ++arg
; /* jump to after the '=' or ':' */
4472 * Set 'keywordprg' to ":help" if an empty
4473 * value was passed to :set by the user.
4474 * Misuse errbuf[] for the resulting string.
4476 if (varp
== (char_u
*)&p_kp
4477 && (*arg
== NUL
|| *arg
== ' '))
4479 STRCPY(errbuf
, ":help");
4484 * Convert 'whichwrap' number to string, for
4485 * backwards compatibility with Vim 3.0.
4486 * Misuse errbuf[] for the resulting string.
4488 else if (varp
== (char_u
*)&p_ww
4489 && VIM_ISDIGIT(*arg
))
4492 i
= getdigits(&arg
);
4494 STRCAT(errbuf
, "b,");
4496 STRCAT(errbuf
, "s,");
4498 STRCAT(errbuf
, "h,l,");
4500 STRCAT(errbuf
, "<,>,");
4502 STRCAT(errbuf
, "[,],");
4503 if (*errbuf
!= NUL
) /* remove trailing , */
4504 errbuf
[STRLEN(errbuf
) - 1] = NUL
;
4509 * Remove '>' before 'dir' and 'bdir', for
4510 * backwards compatibility with version 3.0
4512 else if ( *arg
== '>'
4513 && (varp
== (char_u
*)&p_dir
4514 || varp
== (char_u
*)&p_bdir
))
4519 /* When setting the local value of a global
4520 * option, the old value may be the global value. */
4521 if (((int)options
[opt_idx
].indir
& PV_BOTH
)
4522 && (opt_flags
& OPT_LOCAL
))
4523 origval
= *(char_u
**)get_varp(
4529 * Copy the new string into allocated memory.
4530 * Can't use set_string_option_direct(), because
4531 * we need to remove the backslashes.
4533 /* get a bit too much */
4534 newlen
= (unsigned)STRLEN(arg
) + 1;
4535 if (adding
|| prepending
|| removing
)
4536 newlen
+= (unsigned)STRLEN(origval
) + 1;
4537 newval
= alloc(newlen
);
4538 if (newval
== NULL
) /* out of mem, don't change */
4543 * Copy the string, skip over escaped chars.
4544 * For MS-DOS and WIN32 backslashes before normal
4545 * file name characters are not removed, and keep
4546 * backslash at start, for "\\machine\path", but
4547 * do remove it for "\\\\machine\\path".
4548 * The reverse is found in ExpandOldSetting().
4550 while (*arg
&& !vim_iswhite(*arg
))
4552 if (*arg
== '\\' && arg
[1] != NUL
4553 #ifdef BACKSLASH_IN_FILENAME
4554 && !((flags
& P_EXPAND
)
4555 && vim_isfilec(arg
[1])
4558 && arg
[2] != '\\')))
4561 ++arg
; /* remove backslash */
4564 && (i
= (*mb_ptr2len
)(arg
)) > 1)
4566 /* copy multibyte char */
4567 mch_memmove(s
, arg
, (size_t)i
);
4578 * Expand environment variables and ~.
4579 * Don't do it when adding without inserting a
4582 if (!(adding
|| prepending
|| removing
)
4583 || (flags
& P_COMMA
))
4585 s
= option_expand(opt_idx
, newval
);
4589 newlen
= (unsigned)STRLEN(s
) + 1;
4590 if (adding
|| prepending
|| removing
)
4591 newlen
+= (unsigned)STRLEN(origval
) + 1;
4592 newval
= alloc(newlen
);
4599 /* locate newval[] in origval[] when removing it
4600 * and when adding to avoid duplicates */
4601 i
= 0; /* init for GCC */
4602 if (removing
|| (flags
& P_NODUP
))
4604 i
= (int)STRLEN(newval
);
4606 for (s
= origval
; *s
; ++s
)
4608 if ((!(flags
& P_COMMA
)
4610 || (s
[-1] == ',' && !(bs
& 1)))
4611 && STRNCMP(s
, newval
, i
) == 0
4612 && (!(flags
& P_COMMA
)
4616 /* Count backspaces. Only a comma with an
4617 * even number of backspaces before it is
4618 * recognized as a separator */
4619 if (s
> origval
&& s
[-1] == '\\')
4625 /* do not add if already there */
4626 if ((adding
|| prepending
) && *s
)
4630 STRCPY(newval
, origval
);
4634 /* concatenate the two strings; add a ',' if
4636 if (adding
|| prepending
)
4638 comma
= ((flags
& P_COMMA
) && *origval
!= NUL
4642 i
= (int)STRLEN(origval
);
4643 mch_memmove(newval
+ i
+ comma
, newval
,
4644 STRLEN(newval
) + 1);
4645 mch_memmove(newval
, origval
, (size_t)i
);
4649 i
= (int)STRLEN(newval
);
4650 STRMOVE(newval
+ i
+ comma
, origval
);
4656 /* Remove newval[] from origval[]. (Note: "i" has
4657 * been set above and is used here). */
4660 STRCPY(newval
, origval
);
4663 /* may need to remove a comma */
4664 if (flags
& P_COMMA
)
4668 /* include comma after string */
4674 /* include comma before string */
4679 STRMOVE(newval
+ (s
- origval
), s
+ i
);
4683 if (flags
& P_FLAGLIST
)
4685 /* Remove flags that appear twice. */
4686 for (s
= newval
; *s
; ++s
)
4687 if ((!(flags
& P_COMMA
) || *s
!= ',')
4688 && vim_strchr(s
+ 1, *s
) != NULL
)
4695 if (save_arg
!= NULL
) /* number for 'whichwrap' */
4697 new_value_alloced
= TRUE
;
4700 /* Set the new value. */
4701 *(char_u
**)(varp
) = newval
;
4703 /* Handle side effects, and set the global value for
4704 * ":set" on local options. */
4705 errmsg
= did_set_string_option(opt_idx
, (char_u
**)varp
,
4706 new_value_alloced
, oldval
, errbuf
, opt_flags
);
4708 /* If error detected, print the error message. */
4712 else /* key code option */
4716 if (nextchar
== '&')
4718 if (add_termcap_entry(key_name
, TRUE
) == FAIL
)
4719 errmsg
= (char_u
*)N_("E522: Not found in termcap");
4723 ++arg
; /* jump to after the '=' or ':' */
4724 for (p
= arg
; *p
&& !vim_iswhite(*p
); ++p
)
4725 if (*p
== '\\' && p
[1] != NUL
)
4729 add_termcode(key_name
, arg
, FALSE
);
4734 redraw_all_later(CLEAR
);
4739 did_set_option(opt_idx
, opt_flags
,
4740 !prepending
&& !adding
&& !removing
);
4745 * Advance to next argument.
4746 * - skip until a blank found, taking care of backslashes
4748 * - skip one "=val" argument (for hidden options ":set gfn =xx")
4750 for (i
= 0; i
< 2 ; ++i
)
4752 while (*arg
!= NUL
&& !vim_iswhite(*arg
))
4753 if (*arg
++ == '\\' && *arg
!= NUL
)
4755 arg
= skipwhite(arg
);
4763 vim_strncpy(IObuff
, (char_u
*)_(errmsg
), IOSIZE
- 1);
4764 i
= (int)STRLEN(IObuff
) + 2;
4765 if (i
+ (arg
- startarg
) < IOSIZE
)
4767 /* append the argument with the error */
4768 STRCAT(IObuff
, ": ");
4769 mch_memmove(IObuff
+ i
, startarg
, (arg
- startarg
));
4770 IObuff
[i
+ (arg
- startarg
)] = NUL
;
4772 /* make sure all characters are printable */
4773 trans_characters(IObuff
, IOSIZE
);
4775 ++no_wait_return
; /* wait_return done later */
4776 emsg(IObuff
); /* show error highlighted */
4782 arg
= skipwhite(arg
);
4786 if (silent_mode
&& did_show
)
4788 /* After displaying option values in silent mode. */
4789 silent_mode
= FALSE
;
4790 info_message
= TRUE
; /* use mch_msg(), not mch_errmsg() */
4792 cursor_on(); /* msg_start() switches it off */
4795 info_message
= FALSE
; /* use mch_msg(), not mch_errmsg() */
4802 * Call this when an option has been given a new value through a user command.
4803 * Sets the P_WAS_SET flag and takes care of the P_INSECURE flag.
4806 did_set_option(opt_idx
, opt_flags
, new_value
)
4808 int opt_flags
; /* possibly with OPT_MODELINE */
4809 int new_value
; /* value was replaced completely */
4813 options
[opt_idx
].flags
|= P_WAS_SET
;
4815 /* When an option is set in the sandbox, from a modeline or in secure mode
4816 * set the P_INSECURE flag. Otherwise, if a new value is stored reset the
4818 p
= insecure_flag(opt_idx
, opt_flags
);
4823 || (opt_flags
& OPT_MODELINE
))
4824 *p
= *p
| P_INSECURE
;
4826 *p
= *p
& ~P_INSECURE
;
4830 illegal_char(errbuf
, c
)
4835 return (char_u
*)"";
4836 sprintf((char *)errbuf
, _("E539: Illegal character <%s>"),
4837 (char *)transchar(c
));
4842 * Convert a key name or string into a key value.
4843 * Used for 'wildchar' and 'cedit' options.
4850 return find_key_option(arg
+ 1);
4852 return Ctrl_chr(arg
[1]);
4858 * Check value of 'cedit' and set cedit_key.
4859 * Returns NULL if value is OK, error message otherwise.
4866 if (*p_cedit
== NUL
)
4870 n
= string_to_key(p_cedit
);
4871 if (vim_isprintc(n
))
4881 * When changing 'title', 'titlestring', 'icon' or 'iconstring', call
4882 * maketitle() to create and display it.
4883 * When switching the title or icon off, call mch_restore_title() to get
4884 * the old value back.
4888 int icon
; /* Did set icon instead of title */
4890 if (starting
!= NO_SCREEN
4900 mch_restore_title(2);
4905 mch_restore_title(1);
4912 * set_options_bin - called when 'bin' changes value.
4915 set_options_bin(oldval
, newval
, opt_flags
)
4918 int opt_flags
; /* OPT_LOCAL and/or OPT_GLOBAL */
4921 * The option values that are changed when 'bin' changes are
4922 * copied when 'bin is set and restored when 'bin' is reset.
4926 if (!oldval
) /* switched on */
4928 if (!(opt_flags
& OPT_GLOBAL
))
4930 curbuf
->b_p_tw_nobin
= curbuf
->b_p_tw
;
4931 curbuf
->b_p_wm_nobin
= curbuf
->b_p_wm
;
4932 curbuf
->b_p_ml_nobin
= curbuf
->b_p_ml
;
4933 curbuf
->b_p_et_nobin
= curbuf
->b_p_et
;
4935 if (!(opt_flags
& OPT_LOCAL
))
4944 if (!(opt_flags
& OPT_GLOBAL
))
4946 curbuf
->b_p_tw
= 0; /* no automatic line wrap */
4947 curbuf
->b_p_wm
= 0; /* no automatic line wrap */
4948 curbuf
->b_p_ml
= 0; /* no modelines */
4949 curbuf
->b_p_et
= 0; /* no expandtab */
4951 if (!(opt_flags
& OPT_LOCAL
))
4957 p_bin
= TRUE
; /* needed when called for the "-b" argument */
4960 else if (oldval
) /* switched off */
4962 if (!(opt_flags
& OPT_GLOBAL
))
4964 curbuf
->b_p_tw
= curbuf
->b_p_tw_nobin
;
4965 curbuf
->b_p_wm
= curbuf
->b_p_wm_nobin
;
4966 curbuf
->b_p_ml
= curbuf
->b_p_ml_nobin
;
4967 curbuf
->b_p_et
= curbuf
->b_p_et_nobin
;
4969 if (!(opt_flags
& OPT_LOCAL
))
4981 * Find the parameter represented by the given character (eg ', :, ", or /),
4982 * and return its associated value in the 'viminfo' string.
4983 * Only works for number parameters, not for 'r' or 'n'.
4984 * If the parameter is not specified in the string or there is no following
4985 * number, return -1.
4988 get_viminfo_parameter(type
)
4993 p
= find_viminfo_parameter(type
);
4994 if (p
!= NULL
&& VIM_ISDIGIT(*p
))
4995 return atoi((char *)p
);
5000 * Find the parameter represented by the given character (eg ''', ':', '"', or
5001 * '/') in the 'viminfo' option and return a pointer to the string after it.
5002 * Return NULL if the parameter is not specified in the string.
5005 find_viminfo_parameter(type
)
5010 for (p
= p_viminfo
; *p
; ++p
)
5014 if (*p
== 'n') /* 'n' is always the last one */
5016 p
= vim_strchr(p
, ','); /* skip until next ',' */
5017 if (p
== NULL
) /* hit the end without finding parameter */
5025 * Expand environment variables for some string options.
5026 * These string options cannot be indirect!
5027 * If "val" is NULL expand the current value of the option.
5028 * Return pointer to NameBuff, or NULL when not expanded.
5031 option_expand(opt_idx
, val
)
5035 /* if option doesn't need expansion nothing to do */
5036 if (!(options
[opt_idx
].flags
& P_EXPAND
) || options
[opt_idx
].var
== NULL
)
5039 /* If val is longer than MAXPATHL no meaningful expansion can be done,
5040 * expand_env() would truncate the string. */
5041 if (val
!= NULL
&& STRLEN(val
) > MAXPATHL
)
5045 val
= *(char_u
**)options
[opt_idx
].var
;
5048 * Expanding this with NameBuff, expand_env() must not be passed IObuff.
5049 * Escape spaces when expanding 'tags', they are used to separate file
5051 * For 'spellsuggest' expand after "file:".
5053 expand_env_esc(val
, NameBuff
, MAXPATHL
,
5054 (char_u
**)options
[opt_idx
].var
== &p_tags
, FALSE
,
5056 (char_u
**)options
[opt_idx
].var
== &p_sps
? (char_u
*)"file:" :
5059 if (STRCMP(NameBuff
, val
) == 0) /* they are the same */
5066 * After setting various option values: recompute variables that depend on
5072 /* initialize the table for 'iskeyword' et.al. */
5073 (void)init_chartab();
5076 (void)opt_strings_flags(p_cmp
, p_cmp_values
, &cmp_flags
, TRUE
);
5078 (void)opt_strings_flags(p_bkc
, p_bkc_values
, &bkc_flags
, TRUE
);
5080 (void)opt_strings_flags(p_ssop
, p_ssop_values
, &ssop_flags
, TRUE
);
5081 (void)opt_strings_flags(p_vop
, p_ssop_values
, &vop_flags
, TRUE
);
5084 (void)opt_strings_flags(p_fdo
, p_fdo_values
, &fdo_flags
, TRUE
);
5086 (void)opt_strings_flags(p_dy
, p_dy_values
, &dy_flags
, TRUE
);
5087 #ifdef FEAT_VIRTUALEDIT
5088 (void)opt_strings_flags(p_ve
, p_ve_values
, &ve_flags
, TRUE
);
5090 #if defined(FEAT_MOUSE) && (defined(UNIX) || defined(VMS))
5091 (void)opt_strings_flags(p_ttym
, p_ttym_values
, &ttym_flags
, FALSE
);
5094 (void)spell_check_msm();
5095 (void)spell_check_sps();
5096 (void)compile_cap_prog(curbuf
);
5098 #if defined(FEAT_TOOLBAR) && !defined(FEAT_GUI_W32)
5099 (void)opt_strings_flags(p_toolbar
, p_toolbar_values
, &toolbar_flags
, TRUE
);
5101 #if defined(FEAT_TOOLBAR) && defined(FEAT_GUI_GTK) && defined(HAVE_GTK2)
5102 (void)opt_strings_flags(p_tbis
, p_tbis_values
, &tbis_flags
, FALSE
);
5106 (void)check_cedit();
5111 * Check for string options that are NULL (normally only termcap options).
5118 for (opt_idx
= 0; options
[opt_idx
].fullname
!= NULL
; opt_idx
++)
5119 if ((options
[opt_idx
].flags
& P_STRING
) && options
[opt_idx
].var
!= NULL
)
5120 check_string_option((char_u
**)get_varp(&(options
[opt_idx
])));
5124 * Check string options in a buffer for NULL value.
5127 check_buf_options(buf
)
5130 #if defined(FEAT_QUICKFIX)
5131 check_string_option(&buf
->b_p_bh
);
5132 check_string_option(&buf
->b_p_bt
);
5135 check_string_option(&buf
->b_p_fenc
);
5137 check_string_option(&buf
->b_p_ff
);
5139 check_string_option(&buf
->b_p_def
);
5140 check_string_option(&buf
->b_p_inc
);
5142 check_string_option(&buf
->b_p_inex
);
5145 #if defined(FEAT_CINDENT) && defined(FEAT_EVAL)
5146 check_string_option(&buf
->b_p_inde
);
5147 check_string_option(&buf
->b_p_indk
);
5149 #if defined(FEAT_BEVAL) && defined(FEAT_EVAL)
5150 check_string_option(&buf
->b_p_bexpr
);
5152 #if defined(FEAT_EVAL)
5153 check_string_option(&buf
->b_p_fex
);
5156 check_string_option(&buf
->b_p_key
);
5158 check_string_option(&buf
->b_p_kp
);
5159 check_string_option(&buf
->b_p_mps
);
5160 check_string_option(&buf
->b_p_fo
);
5161 check_string_option(&buf
->b_p_flp
);
5162 check_string_option(&buf
->b_p_isk
);
5163 #ifdef FEAT_COMMENTS
5164 check_string_option(&buf
->b_p_com
);
5167 check_string_option(&buf
->b_p_cms
);
5169 check_string_option(&buf
->b_p_nf
);
5171 check_string_option(&buf
->b_p_qe
);
5174 check_string_option(&buf
->b_p_syn
);
5177 check_string_option(&buf
->b_p_spc
);
5178 check_string_option(&buf
->b_p_spf
);
5179 check_string_option(&buf
->b_p_spl
);
5181 #ifdef FEAT_SEARCHPATH
5182 check_string_option(&buf
->b_p_sua
);
5185 check_string_option(&buf
->b_p_cink
);
5186 check_string_option(&buf
->b_p_cino
);
5189 check_string_option(&buf
->b_p_ft
);
5191 #ifdef FEAT_OSFILETYPE
5192 check_string_option(&buf
->b_p_oft
);
5194 #if defined(FEAT_SMARTINDENT) || defined(FEAT_CINDENT)
5195 check_string_option(&buf
->b_p_cinw
);
5197 #ifdef FEAT_INS_EXPAND
5198 check_string_option(&buf
->b_p_cpt
);
5200 #ifdef FEAT_COMPL_FUNC
5201 check_string_option(&buf
->b_p_cfu
);
5202 check_string_option(&buf
->b_p_ofu
);
5205 check_string_option(&buf
->b_p_keymap
);
5207 #ifdef FEAT_QUICKFIX
5208 check_string_option(&buf
->b_p_gp
);
5209 check_string_option(&buf
->b_p_mp
);
5210 check_string_option(&buf
->b_p_efm
);
5212 check_string_option(&buf
->b_p_ep
);
5213 check_string_option(&buf
->b_p_path
);
5214 check_string_option(&buf
->b_p_tags
);
5215 #ifdef FEAT_INS_EXPAND
5216 check_string_option(&buf
->b_p_dict
);
5217 check_string_option(&buf
->b_p_tsr
);
5222 * Free the string allocated for an option.
5223 * Checks for the string being empty_option. This may happen if we're out of
5224 * memory, vim_strsave() returned NULL, which was replaced by empty_option by
5226 * Does NOT check for P_ALLOCED flag!
5229 free_string_option(p
)
5232 if (p
!= empty_option
)
5237 clear_string_option(pp
)
5240 if (*pp
!= empty_option
)
5246 check_string_option(pp
)
5254 * Mark a terminal option as allocated, found by a pointer into term_strings[].
5257 set_term_option_alloced(p
)
5262 for (opt_idx
= 1; options
[opt_idx
].fullname
!= NULL
; opt_idx
++)
5263 if (options
[opt_idx
].var
== (char_u
*)p
)
5265 options
[opt_idx
].flags
|= P_ALLOCED
;
5268 return; /* cannot happen: didn't find it! */
5271 #if defined(FEAT_EVAL) || defined(PROTO)
5273 * Return TRUE when option "opt" was set from a modeline or in secure mode.
5274 * Return FALSE when it wasn't.
5275 * Return -1 for an unknown option.
5278 was_set_insecurely(opt
, opt_flags
)
5282 int idx
= findoption(opt
);
5287 flagp
= insecure_flag(idx
, opt_flags
);
5288 return (*flagp
& P_INSECURE
) != 0;
5290 EMSG2(_(e_intern2
), "was_set_insecurely()");
5295 * Get a pointer to the flags used for the P_INSECURE flag of option
5296 * "opt_idx". For some local options a local flags field is used.
5299 insecure_flag(opt_idx
, opt_flags
)
5303 if (opt_flags
& OPT_LOCAL
)
5304 switch ((int)options
[opt_idx
].indir
)
5307 case PV_STL
: return &curwin
->w_p_stl_flags
;
5310 # ifdef FEAT_FOLDING
5311 case PV_FDE
: return &curwin
->w_p_fde_flags
;
5312 case PV_FDT
: return &curwin
->w_p_fdt_flags
;
5315 case PV_BEXPR
: return &curbuf
->b_p_bexpr_flags
;
5317 # if defined(FEAT_CINDENT)
5318 case PV_INDE
: return &curbuf
->b_p_inde_flags
;
5320 case PV_FEX
: return &curbuf
->b_p_fex_flags
;
5321 # ifdef FEAT_FIND_ID
5322 case PV_INEX
: return &curbuf
->b_p_inex_flags
;
5327 /* Nothing special, return global flags field. */
5328 return &options
[opt_idx
].flags
;
5333 static void redraw_titles
__ARGS((void));
5336 * Redraw the window title and/or tab page text later.
5338 static void redraw_titles()
5340 need_maketitle
= TRUE
;
5341 # ifdef FEAT_WINDOWS
5342 redraw_tabline
= TRUE
;
5348 * Set a string option to a new value (without checking the effect).
5349 * The string is copied into allocated memory.
5350 * if ("opt_idx" == -1) "name" is used, otherwise "opt_idx" is used.
5351 * When "set_sid" is zero set the scriptID to current_SID. When "set_sid" is
5352 * SID_NONE don't set the scriptID. Otherwise set the scriptID to "set_sid".
5355 set_string_option_direct(name
, opt_idx
, val
, opt_flags
, set_sid
)
5359 int opt_flags
; /* OPT_FREE, OPT_LOCAL and/or OPT_GLOBAL */
5364 int both
= (opt_flags
& (OPT_LOCAL
| OPT_GLOBAL
)) == 0;
5367 if (idx
== -1) /* use name */
5369 idx
= findoption(name
);
5370 if (idx
< 0) /* not found (should not happen) */
5372 EMSG2(_(e_intern2
), "set_string_option_direct()");
5377 if (options
[idx
].var
== NULL
) /* can't set hidden option */
5380 s
= vim_strsave(val
);
5383 varp
= (char_u
**)get_varp_scope(&(options
[idx
]),
5384 both
? OPT_LOCAL
: opt_flags
);
5385 if ((opt_flags
& OPT_FREE
) && (options
[idx
].flags
& P_ALLOCED
))
5386 free_string_option(*varp
);
5389 /* For buffer/window local option may also set the global value. */
5391 set_string_option_global(idx
, varp
);
5393 options
[idx
].flags
|= P_ALLOCED
;
5395 /* When setting both values of a global option with a local value,
5396 * make the local value empty, so that the global value is used. */
5397 if (((int)options
[idx
].indir
& PV_BOTH
) && both
)
5399 free_string_option(*varp
);
5400 *varp
= empty_option
;
5403 if (set_sid
!= SID_NONE
)
5404 set_option_scriptID_idx(idx
, opt_flags
,
5405 set_sid
== 0 ? current_SID
: set_sid
);
5411 * Set global value for string option when it's a local option.
5414 set_string_option_global(opt_idx
, varp
)
5415 int opt_idx
; /* option index */
5416 char_u
**varp
; /* pointer to option variable */
5420 /* the global value is always allocated */
5421 if (options
[opt_idx
].var
== VAR_WIN
)
5422 p
= (char_u
**)GLOBAL_WO(varp
);
5424 p
= (char_u
**)options
[opt_idx
].var
;
5425 if (options
[opt_idx
].indir
!= PV_NONE
5427 && (s
= vim_strsave(*varp
)) != NULL
)
5429 free_string_option(*p
);
5435 * Set a string option to a new value, and handle the effects.
5438 set_string_option(opt_idx
, value
, opt_flags
)
5441 int opt_flags
; /* OPT_LOCAL and/or OPT_GLOBAL */
5447 if (options
[opt_idx
].var
== NULL
) /* don't set hidden option */
5450 s
= vim_strsave(value
);
5453 varp
= (char_u
**)get_varp_scope(&(options
[opt_idx
]),
5454 (opt_flags
& (OPT_LOCAL
| OPT_GLOBAL
)) == 0
5455 ? (((int)options
[opt_idx
].indir
& PV_BOTH
)
5456 ? OPT_GLOBAL
: OPT_LOCAL
)
5460 if (did_set_string_option(opt_idx
, varp
, TRUE
, oldval
, NULL
,
5462 did_set_option(opt_idx
, opt_flags
, TRUE
);
5467 * Handle string options that need some action to perform when changed.
5468 * Returns NULL for success, or an error message for an error.
5471 did_set_string_option(opt_idx
, varp
, new_value_alloced
, oldval
, errbuf
,
5473 int opt_idx
; /* index in options[] table */
5474 char_u
**varp
; /* pointer to the option variable */
5475 int new_value_alloced
; /* new value was allocated */
5476 char_u
*oldval
; /* previous value of the option */
5477 char_u
*errbuf
; /* buffer for errors, or NULL */
5478 int opt_flags
; /* OPT_LOCAL and/or OPT_GLOBAL */
5480 char_u
*errmsg
= NULL
;
5482 int did_chartab
= FALSE
;
5484 long_u free_oldval
= (options
[opt_idx
].flags
& P_ALLOCED
);
5486 /* set when changing an option that only requires a redraw in the GUI */
5487 int redraw_gui_only
= FALSE
;
5490 /* Get the global option to compare with, otherwise we would have to check
5491 * two values for all local options. */
5492 gvarp
= (char_u
**)get_varp_scope(&(options
[opt_idx
]), OPT_GLOBAL
);
5494 /* Disallow changing some options from secure mode */
5499 ) && (options
[opt_idx
].flags
& P_SECURE
))
5504 /* Check for a "normal" file name in some options. Disallow a path
5505 * separator (slash and/or backslash), wildcards and characters that are
5506 * often illegal in a file name. */
5507 else if ((options
[opt_idx
].flags
& P_NFNAME
)
5508 && vim_strpbrk(*varp
, (char_u
*)"/\\*?[|<>") != NULL
)
5514 else if (varp
== &T_NAME
)
5516 if (T_NAME
[0] == NUL
)
5517 errmsg
= (char_u
*)N_("E529: Cannot set 'term' to empty string");
5520 errmsg
= (char_u
*)N_("E530: Cannot change term in GUI");
5521 else if (term_is_gui(T_NAME
))
5522 errmsg
= (char_u
*)N_("E531: Use \":gui\" to start the GUI");
5524 else if (set_termname(T_NAME
) == FAIL
)
5525 errmsg
= (char_u
*)N_("E522: Not found in termcap");
5527 /* Screen colors may have changed. */
5528 redraw_later_clear();
5532 else if (varp
== &p_bkc
)
5534 if (opt_strings_flags(p_bkc
, p_bkc_values
, &bkc_flags
, TRUE
) != OK
)
5536 if (((bkc_flags
& BKC_AUTO
) != 0)
5537 + ((bkc_flags
& BKC_YES
) != 0)
5538 + ((bkc_flags
& BKC_NO
) != 0) != 1)
5540 /* Must have exactly one of "auto", "yes" and "no". */
5541 (void)opt_strings_flags(oldval
, p_bkc_values
, &bkc_flags
, TRUE
);
5546 /* 'backupext' and 'patchmode' */
5547 else if (varp
== &p_bex
|| varp
== &p_pm
)
5549 if (STRCMP(*p_bex
== '.' ? p_bex
+ 1 : p_bex
,
5550 *p_pm
== '.' ? p_pm
+ 1 : p_pm
) == 0)
5551 errmsg
= (char_u
*)N_("E589: 'backupext' and 'patchmode' are equal");
5555 * 'isident', 'iskeyword', 'isprint or 'isfname' option: refill chartab[]
5556 * If the new option is invalid, use old value. 'lisp' option: refill
5557 * chartab[] for '-' char
5559 else if ( varp
== &p_isi
5560 || varp
== &(curbuf
->b_p_isk
)
5564 if (init_chartab() == FAIL
)
5566 did_chartab
= TRUE
; /* need to restore it below */
5567 errmsg
= e_invarg
; /* error in value */
5572 else if (varp
== &p_hf
)
5574 /* May compute new values for $VIM and $VIMRUNTIME */
5577 vim_setenv((char_u
*)"VIM", (char_u
*)"");
5580 if (didset_vimruntime
)
5582 vim_setenv((char_u
*)"VIMRUNTIME", (char_u
*)"");
5583 didset_vimruntime
= FALSE
;
5587 #ifdef FEAT_MULTI_LANG
5589 else if (varp
== &p_hlg
)
5591 /* Check for "", "ab", "ab,cd", etc. */
5592 for (s
= p_hlg
; *s
!= NUL
; s
+= 3)
5594 if (s
[1] == NUL
|| ((s
[2] != ',' || s
[3] == NUL
) && s
[2] != NUL
))
5606 else if (varp
== &p_hl
)
5608 if (highlight_changed() == FAIL
)
5609 errmsg
= e_invarg
; /* invalid flags */
5613 else if (gvarp
== &p_nf
)
5615 if (check_opt_strings(*varp
, p_nf_values
, TRUE
) != OK
)
5620 /* 'sessionoptions' */
5621 else if (varp
== &p_ssop
)
5623 if (opt_strings_flags(p_ssop
, p_ssop_values
, &ssop_flags
, TRUE
) != OK
)
5625 if ((ssop_flags
& SSOP_CURDIR
) && (ssop_flags
& SSOP_SESDIR
))
5627 /* Don't allow both "sesdir" and "curdir". */
5628 (void)opt_strings_flags(oldval
, p_ssop_values
, &ssop_flags
, TRUE
);
5633 else if (varp
== &p_vop
)
5635 if (opt_strings_flags(p_vop
, p_ssop_values
, &vop_flags
, TRUE
) != OK
)
5641 #ifdef FEAT_SCROLLBIND
5642 else if (varp
== &p_sbo
)
5644 if (check_opt_strings(p_sbo
, p_scbopt_values
, TRUE
) != OK
)
5651 else if (varp
== &p_ambw
)
5653 if (check_opt_strings(p_ambw
, p_ambw_values
, FALSE
) != OK
)
5659 else if (varp
== &p_bg
)
5661 if (check_opt_strings(p_bg
, p_bg_values
, FALSE
) == OK
)
5664 int dark
= (*p_bg
== 'd');
5667 init_highlight(FALSE
, FALSE
);
5670 if (dark
!= (*p_bg
== 'd')
5671 && get_var_value((char_u
*)"g:colors_name") != NULL
)
5673 /* The color scheme must have set 'background' back to another
5674 * value, that's not what we want here. Disable the color
5675 * scheme and set the colors again. */
5676 do_unlet((char_u
*)"g:colors_name", TRUE
);
5677 free_string_option(p_bg
);
5678 p_bg
= vim_strsave((char_u
*)(dark
? "dark" : "light"));
5679 check_string_option(&p_bg
);
5680 init_highlight(FALSE
, FALSE
);
5689 else if (varp
== &p_wim
)
5691 if (check_opt_wim() == FAIL
)
5695 #ifdef FEAT_CMDL_COMPL
5697 else if (varp
== &p_wop
)
5699 if (check_opt_strings(p_wop
, p_wop_values
, TRUE
) != OK
)
5706 else if (varp
== &p_wak
)
5709 || check_opt_strings(p_wak
, p_wak_values
, FALSE
) != OK
)
5712 # ifdef FEAT_GUI_MOTIF
5713 else if (gui
.in_use
)
5714 gui_motif_set_mnemonics(p_wak
[0] == 'y' || p_wak
[0] == 'm');
5716 # ifdef FEAT_GUI_GTK
5717 else if (gui
.in_use
)
5718 gui_gtk_set_mnemonics(p_wak
[0] == 'y' || p_wak
[0] == 'm');
5727 else if (varp
== &p_ei
)
5729 if (check_ei() == FAIL
)
5735 /* 'encoding' and 'fileencoding' */
5736 else if (varp
== &p_enc
|| gvarp
== &p_fenc
|| varp
== &p_tenc
)
5738 if (gvarp
== &p_fenc
)
5740 if (!curbuf
->b_p_ma
&& opt_flags
!= OPT_GLOBAL
)
5741 errmsg
= e_modifiable
;
5742 else if (vim_strchr(*varp
, ',') != NULL
)
5743 /* No comma allowed in 'fileencoding'; catches confusing it
5744 * with 'fileencodings'. */
5749 /* May show a "+" in the title now. */
5752 /* Add 'fileencoding' to the swap file. */
5753 ml_setflags(curbuf
);
5758 /* canonize the value, so that STRCMP() can be used on it */
5759 p
= enc_canonize(*varp
);
5774 # if defined(FEAT_GUI_GTK) && defined(HAVE_GTK2)
5775 if (errmsg
== NULL
&& varp
== &p_tenc
&& gui
.in_use
)
5777 /* GTK+ 2 uses only a single encoding, and that is UTF-8. */
5778 if (STRCMP(p_tenc
, "utf-8") != 0)
5779 errmsg
= (char_u
*)N_("E617: Cannot be changed in the GTK+ 2 GUI");
5786 /* When 'keymap' is used and 'encoding' changes, reload the keymap
5787 * (with another encoding). */
5788 if (varp
== &p_enc
&& *curbuf
->b_p_keymap
!= NUL
)
5789 (void)keymap_init();
5792 /* When 'termencoding' is not empty and 'encoding' changes or when
5793 * 'termencoding' changes, need to setup for keyboard input and
5794 * display output conversion. */
5795 if (((varp
== &p_enc
&& *p_tenc
!= NUL
) || varp
== &p_tenc
))
5797 convert_setup(&input_conv
, p_tenc
, p_enc
);
5798 convert_setup(&output_conv
, p_enc
, p_tenc
);
5801 # if defined(WIN3264) && defined(FEAT_MBYTE)
5802 /* $HOME may have characters in active code page. */
5810 #if defined(FEAT_POSTSCRIPT)
5811 else if (varp
== &p_penc
)
5813 /* Canonize printencoding if VIM standard one */
5814 p
= enc_canonize(p_penc
);
5822 /* Ensure lower case and '-' for '_' */
5823 for (s
= p_penc
; *s
!= NUL
; s
++)
5828 *s
= TOLOWER_ASC(*s
);
5834 #if defined(FEAT_XIM) && defined(FEAT_GUI_GTK)
5835 else if (varp
== &p_imak
)
5837 if (gui
.in_use
&& !im_xim_isvalid_imactivate())
5843 else if (varp
== &curbuf
->b_p_keymap
)
5845 /* load or unload key mapping tables */
5846 errmsg
= keymap_init();
5850 if (*curbuf
->b_p_keymap
!= NUL
)
5852 /* Installed a new keymap, switch on using it. */
5853 curbuf
->b_p_iminsert
= B_IMODE_LMAP
;
5854 if (curbuf
->b_p_imsearch
!= B_IMODE_USE_INSERT
)
5855 curbuf
->b_p_imsearch
= B_IMODE_LMAP
;
5859 /* Cleared the keymap, may reset 'iminsert' and 'imsearch'. */
5860 if (curbuf
->b_p_iminsert
== B_IMODE_LMAP
)
5861 curbuf
->b_p_iminsert
= B_IMODE_NONE
;
5862 if (curbuf
->b_p_imsearch
== B_IMODE_LMAP
)
5863 curbuf
->b_p_imsearch
= B_IMODE_USE_INSERT
;
5865 if ((opt_flags
& OPT_LOCAL
) == 0)
5867 set_iminsert_global();
5868 set_imsearch_global();
5870 # ifdef FEAT_WINDOWS
5871 status_redraw_curbuf();
5878 else if (gvarp
== &p_ff
)
5880 if (!curbuf
->b_p_ma
&& !(opt_flags
& OPT_GLOBAL
))
5881 errmsg
= e_modifiable
;
5882 else if (check_opt_strings(*varp
, p_ff_values
, FALSE
) != OK
)
5886 /* may also change 'textmode' */
5887 if (get_fileformat(curbuf
) == EOL_DOS
)
5888 curbuf
->b_p_tx
= TRUE
;
5890 curbuf
->b_p_tx
= FALSE
;
5894 /* update flag in swap file */
5895 ml_setflags(curbuf
);
5896 /* Redraw needed when switching to/from "mac": a CR in the text
5897 * will be displayed differently. */
5898 if (get_fileformat(curbuf
) == EOL_MAC
|| *oldval
== 'm')
5899 redraw_curbuf_later(NOT_VALID
);
5904 else if (varp
== &p_ffs
)
5906 if (check_opt_strings(p_ffs
, p_ff_values
, TRUE
) != OK
)
5910 /* also change 'textauto' */
5918 #if defined(FEAT_CRYPT) && defined(FEAT_CMDHIST)
5920 else if (gvarp
== &p_key
)
5922 /* Make sure the ":set" command doesn't show the new value in the
5924 remove_key_from_history();
5929 else if (gvarp
== &p_mps
)
5931 /* Check for "x:y,x:y" */
5932 for (p
= *varp
; *p
!= NUL
; p
+= 4)
5934 if (p
[1] != ':' || p
[2] == NUL
|| (p
[3] != NUL
&& p
[3] != ','))
5944 #ifdef FEAT_COMMENTS
5946 else if (gvarp
== &p_com
)
5948 for (s
= *varp
; *s
; )
5950 while (*s
&& *s
!= ':')
5952 if (vim_strchr((char_u
*)COM_ALL
, *s
) == NULL
5953 && !VIM_ISDIGIT(*s
) && *s
!= '-')
5955 errmsg
= illegal_char(errbuf
, *s
);
5961 errmsg
= (char_u
*)N_("E524: Missing colon");
5962 else if (*s
== ',' || *s
== NUL
)
5963 errmsg
= (char_u
*)N_("E525: Zero length string");
5966 while (*s
&& *s
!= ',')
5968 if (*s
== '\\' && s
[1] != NUL
)
5972 s
= skip_to_option_part(s
);
5978 else if (varp
== &p_lcs
)
5980 errmsg
= set_chars_option(varp
);
5983 #if defined(FEAT_WINDOWS) || defined(FEAT_FOLDING)
5985 else if (varp
== &p_fcs
)
5987 errmsg
= set_chars_option(varp
);
5993 else if (varp
== &p_cedit
)
5995 errmsg
= check_cedit();
6000 else if (varp
== &p_vfile
)
6003 if (*p_vfile
!= NUL
&& verbose_open() == FAIL
)
6009 else if (varp
== &p_viminfo
)
6011 for (s
= p_viminfo
; *s
;)
6013 /* Check it's a valid character */
6014 if (vim_strchr((char_u
*)"!\"%'/:<@cfhnrs", *s
) == NULL
)
6016 errmsg
= illegal_char(errbuf
, *s
);
6019 if (*s
== 'n') /* name is always last one */
6023 else if (*s
== 'r') /* skip until next ',' */
6025 while (*++s
&& *s
!= ',')
6030 /* optional number */
6031 while (vim_isdigit(*++s
))
6034 else if (*s
== '!' || *s
== 'h' || *s
== 'c')
6035 ++s
; /* no extra chars */
6036 else /* must have a number */
6038 while (vim_isdigit(*++s
))
6041 if (!VIM_ISDIGIT(*(s
- 1)))
6045 sprintf((char *)errbuf
,
6046 _("E526: Missing number after <%s>"),
6047 transchar_byte(*(s
- 1)));
6051 errmsg
= (char_u
*)"";
6060 errmsg
= (char_u
*)N_("E527: Missing comma");
6062 errmsg
= (char_u
*)"";
6066 if (*p_viminfo
&& errmsg
== NULL
&& get_viminfo_parameter('\'') < 0)
6067 errmsg
= (char_u
*)N_("E528: Must specify a ' value");
6069 #endif /* FEAT_VIMINFO */
6071 /* terminal options */
6072 else if (istermoption(&options
[opt_idx
]) && full_screen
)
6074 /* ":set t_Co=0" and ":set t_Co=1" do ":set t_Co=" */
6077 int colors
= atoi((char *)T_CCO
);
6079 /* Only reinitialize colors if t_Co value has really changed to
6080 * avoid expensive reload of colorscheme if t_Co is set to the
6081 * same value multiple times. */
6082 if (colors
!= t_colors
)
6087 if (new_value_alloced
)
6089 T_CCO
= empty_option
;
6091 /* We now have a different color setup, initialize it again. */
6092 init_highlight(TRUE
, FALSE
);
6099 redraw_later(CLEAR
);
6100 #if defined(MSDOS) || (defined(WIN3264) && !defined(FEAT_GUI_W32))
6101 /* Since t_me has been set, this probably means that the user
6102 * wants to use this as default colors. Need to reset default
6103 * background/foreground colors. */
6104 mch_set_normal_colors();
6109 #ifdef FEAT_LINEBREAK
6111 else if (varp
== &p_sbr
)
6113 for (s
= p_sbr
; *s
; )
6115 if (ptr2cells(s
) != 1)
6116 errmsg
= (char_u
*)N_("E595: contains unprintable or wide character");
6124 else if (varp
== &p_guifont
)
6129 # if defined(FEAT_GUI_GTK)
6131 * Put up a font dialog and let the user select a new value.
6132 * If this is cancelled go back to the old value but don't
6133 * give an error message.
6135 if (STRCMP(p
, "*") == 0)
6137 p
= gui_mch_font_dialog(oldval
);
6139 if (new_value_alloced
)
6140 free_string_option(p_guifont
);
6142 p_guifont
= (p
!= NULL
) ? p
: vim_strsave(oldval
);
6143 new_value_alloced
= TRUE
;
6146 if (p
!= NULL
&& gui_init_font(p_guifont
, FALSE
) != OK
)
6148 # if defined(FEAT_GUI_MSWIN) || defined(FEAT_GUI_PHOTON)
6149 if (STRCMP(p_guifont
, "*") == 0)
6151 /* Dialog was cancelled: Keep the old value without giving
6152 * an error message. */
6153 if (new_value_alloced
)
6154 free_string_option(p_guifont
);
6155 p_guifont
= vim_strsave(oldval
);
6156 new_value_alloced
= TRUE
;
6160 errmsg
= (char_u
*)N_("E596: Invalid font(s)");
6163 redraw_gui_only
= TRUE
;
6165 # ifdef FEAT_XFONTSET
6166 else if (varp
== &p_guifontset
)
6168 if (STRCMP(p_guifontset
, "*") == 0)
6169 errmsg
= (char_u
*)N_("E597: can't select fontset");
6170 else if (gui
.in_use
&& gui_init_font(p_guifontset
, TRUE
) != OK
)
6171 errmsg
= (char_u
*)N_("E598: Invalid fontset");
6172 redraw_gui_only
= TRUE
;
6176 else if (varp
== &p_guifontwide
)
6178 if (STRCMP(p_guifontwide
, "*") == 0)
6179 errmsg
= (char_u
*)N_("E533: can't select wide font");
6180 else if (gui_get_wide_font() == FAIL
)
6181 errmsg
= (char_u
*)N_("E534: Invalid wide font");
6182 redraw_gui_only
= TRUE
;
6189 else if (varp
== &p_guicursor
)
6190 errmsg
= parse_shape_opt(SHAPE_CURSOR
);
6193 #ifdef FEAT_MOUSESHAPE
6195 else if (varp
== &p_mouseshape
)
6197 errmsg
= parse_shape_opt(SHAPE_MOUSE
);
6198 update_mouseshape(-1);
6203 else if (varp
== &p_popt
)
6204 errmsg
= parse_printoptions();
6205 # if defined(FEAT_MBYTE) && defined(FEAT_POSTSCRIPT)
6206 else if (varp
== &p_pmfn
)
6207 errmsg
= parse_printmbfont();
6213 else if (varp
== &p_langmap
)
6217 #ifdef FEAT_LINEBREAK
6219 else if (varp
== &p_breakat
)
6220 fill_breakat_flags();
6224 /* 'titlestring' and 'iconstring' */
6225 else if (varp
== &p_titlestring
|| varp
== &p_iconstring
)
6227 # ifdef FEAT_STL_OPT
6228 int flagval
= (varp
== &p_titlestring
) ? STL_IN_TITLE
: STL_IN_ICON
;
6230 /* NULL => statusline syntax */
6231 if (vim_strchr(*varp
, '%') && check_stl_option(*varp
) == NULL
)
6232 stl_syntax
|= flagval
;
6234 stl_syntax
&= ~flagval
;
6236 did_set_title(varp
== &p_iconstring
);
6243 else if (varp
== &p_go
)
6245 gui_init_which_components(oldval
);
6246 redraw_gui_only
= TRUE
;
6250 #if defined(FEAT_GUI_TABLINE)
6252 else if (varp
== &p_gtl
)
6254 redraw_tabline
= TRUE
;
6255 redraw_gui_only
= TRUE
;
6257 /* 'guitabtooltip' */
6258 else if (varp
== &p_gtt
)
6260 redraw_gui_only
= TRUE
;
6264 #if defined(FEAT_MOUSE_TTY) && (defined(UNIX) || defined(VMS))
6266 else if (varp
== &p_ttym
)
6268 /* Switch the mouse off before changing the escape sequences used for
6270 mch_setmouse(FALSE
);
6271 if (opt_strings_flags(p_ttym
, p_ttym_values
, &ttym_flags
, FALSE
) != OK
)
6274 check_mouse_termcode();
6276 setmouse(); /* may switch it on again */
6282 else if (varp
== &p_sel
)
6285 || check_opt_strings(p_sel
, p_sel_values
, FALSE
) != OK
)
6290 else if (varp
== &p_slm
)
6292 if (check_opt_strings(p_slm
, p_slm_values
, TRUE
) != OK
)
6299 else if (varp
== &p_bsdir
)
6301 if (check_opt_strings(p_bsdir
, p_bsdir_values
, FALSE
) != OK
6302 && !mch_isdir(p_bsdir
))
6309 else if (varp
== &p_km
)
6311 if (check_opt_strings(p_km
, p_km_values
, TRUE
) != OK
)
6315 km_stopsel
= (vim_strchr(p_km
, 'o') != NULL
);
6316 km_startsel
= (vim_strchr(p_km
, 'a') != NULL
);
6322 else if (varp
== &p_mousem
)
6324 if (check_opt_strings(p_mousem
, p_mousem_values
, FALSE
) != OK
)
6326 #if defined(FEAT_GUI_MOTIF) && defined(FEAT_MENU) && (XmVersion <= 1002)
6327 else if (*p_mousem
!= *oldval
)
6328 /* Changed from "extend" to "popup" or "popup_setpos" or vv: need
6329 * to create or delete the popup menus. */
6330 gui_motif_update_mousemodel(root_menu
);
6335 else if (varp
== &p_swb
)
6337 if (opt_strings_flags(p_swb
, p_swb_values
, &swb_flags
, TRUE
) != OK
)
6342 else if (varp
== &p_debug
)
6344 if (check_opt_strings(p_debug
, p_debug_values
, TRUE
) != OK
)
6349 else if (varp
== &p_dy
)
6351 if (opt_strings_flags(p_dy
, p_dy_values
, &dy_flags
, TRUE
) != OK
)
6354 (void)init_chartab();
6358 #ifdef FEAT_VERTSPLIT
6360 else if (varp
== &p_ead
)
6362 if (check_opt_strings(p_ead
, p_ead_values
, FALSE
) != OK
)
6367 #ifdef FEAT_CLIPBOARD
6369 else if (varp
== &p_cb
)
6370 errmsg
= check_clipboard_option();
6374 /* When 'spelllang' or 'spellfile' is set and there is a window for this
6375 * buffer in which 'spell' is set load the wordlists. */
6376 else if (varp
== &(curbuf
->b_p_spl
) || varp
== &(curbuf
->b_p_spf
))
6381 if (varp
== &(curbuf
->b_p_spf
))
6383 l
= (int)STRLEN(curbuf
->b_p_spf
);
6384 if (l
> 0 && (l
< 4 || STRCMP(curbuf
->b_p_spf
+ l
- 4,
6392 if (wp
->w_buffer
== curbuf
&& wp
->w_p_spell
)
6394 errmsg
= did_set_spelllang(curbuf
);
6395 # ifdef FEAT_WINDOWS
6401 /* When 'spellcapcheck' is set compile the regexp program. */
6402 else if (varp
== &(curbuf
->b_p_spc
))
6404 errmsg
= compile_cap_prog(curbuf
);
6406 /* 'spellsuggest' */
6407 else if (varp
== &p_sps
)
6409 if (spell_check_sps() != OK
)
6413 else if (varp
== &p_msm
)
6415 if (spell_check_msm() != OK
)
6420 #ifdef FEAT_QUICKFIX
6421 /* When 'bufhidden' is set, check for valid value. */
6422 else if (gvarp
== &p_bh
)
6424 if (check_opt_strings(curbuf
->b_p_bh
, p_bufhidden_values
, FALSE
) != OK
)
6428 /* When 'buftype' is set, check for valid value. */
6429 else if (gvarp
== &p_bt
)
6431 if (check_opt_strings(curbuf
->b_p_bt
, p_buftype_values
, FALSE
) != OK
)
6435 # ifdef FEAT_WINDOWS
6436 if (curwin
->w_status_height
)
6438 curwin
->w_redr_status
= TRUE
;
6439 redraw_later(VALID
);
6442 curbuf
->b_help
= (curbuf
->b_p_bt
[0] == 'h');
6451 /* 'statusline' or 'rulerformat' */
6452 else if (gvarp
== &p_stl
|| varp
== &p_ruf
)
6456 if (varp
== &p_ruf
) /* reset ru_wid first */
6459 if (varp
== &p_ruf
&& *s
== '%')
6461 /* set ru_wid if 'ruf' starts with "%99(" */
6462 if (*++s
== '-') /* ignore a '-' */
6464 wid
= getdigits(&s
);
6465 if (wid
&& *s
== '(' && (errmsg
= check_stl_option(p_ruf
)) == NULL
)
6468 errmsg
= check_stl_option(p_ruf
);
6470 /* check 'statusline' only if it doesn't start with "%!" */
6471 else if (varp
== &p_ruf
|| s
[0] != '%' || s
[1] != '!')
6472 errmsg
= check_stl_option(s
);
6473 if (varp
== &p_ruf
&& errmsg
== NULL
)
6478 #ifdef FEAT_INS_EXPAND
6479 /* check if it is a valid value for 'complete' -- Acevedo */
6480 else if (gvarp
== &p_cpt
)
6482 for (s
= *varp
; *s
;)
6484 while(*s
== ',' || *s
== ' ')
6488 if (vim_strchr((char_u
*)".wbuksid]tU", *s
) == NULL
)
6490 errmsg
= illegal_char(errbuf
, *s
);
6493 if (*++s
!= NUL
&& *s
!= ',' && *s
!= ' ')
6495 if (s
[-1] == 'k' || s
[-1] == 's')
6497 /* skip optional filename after 'k' and 's' */
6498 while (*s
&& *s
!= ',' && *s
!= ' ')
6509 sprintf((char *)errbuf
,
6510 _("E535: Illegal character after <%c>"),
6515 errmsg
= (char_u
*)"";
6523 else if (varp
== &p_cot
)
6525 if (check_opt_strings(p_cot
, p_cot_values
, TRUE
) != OK
)
6528 #endif /* FEAT_INS_EXPAND */
6531 #if defined(FEAT_TOOLBAR) && !defined(FEAT_GUI_W32)
6532 else if (varp
== &p_toolbar
)
6534 if (opt_strings_flags(p_toolbar
, p_toolbar_values
,
6535 &toolbar_flags
, TRUE
) != OK
)
6540 gui_mch_show_toolbar((toolbar_flags
&
6541 (TOOLBAR_TEXT
| TOOLBAR_ICONS
)) != 0);
6546 #if defined(FEAT_TOOLBAR) && defined(FEAT_GUI_GTK) && defined(HAVE_GTK2)
6547 /* 'toolbariconsize': GTK+ 2 only */
6548 else if (varp
== &p_tbis
)
6550 if (opt_strings_flags(p_tbis
, p_tbis_values
, &tbis_flags
, FALSE
) != OK
)
6555 gui_mch_show_toolbar((toolbar_flags
&
6556 (TOOLBAR_TEXT
| TOOLBAR_ICONS
)) != 0);
6561 /* 'pastetoggle': translate key codes like in a mapping */
6562 else if (varp
== &p_pt
)
6566 (void)replace_termcodes(p_pt
, &p
, TRUE
, TRUE
, FALSE
);
6569 if (new_value_alloced
)
6570 free_string_option(p_pt
);
6572 new_value_alloced
= TRUE
;
6578 else if (varp
== &p_bs
)
6580 if (VIM_ISDIGIT(*p_bs
))
6582 if (*p_bs
>'2' || p_bs
[1] != NUL
)
6585 else if (check_opt_strings(p_bs
, p_bs_values
, TRUE
) != OK
)
6591 else if (varp
== &p_cmp
)
6593 if (opt_strings_flags(p_cmp
, p_cmp_values
, &cmp_flags
, TRUE
) != OK
)
6600 else if (varp
== &p_dip
)
6602 if (diffopt_changed() == FAIL
)
6609 else if (gvarp
== &curwin
->w_allbuf_opt
.wo_fdm
)
6611 if (check_opt_strings(*varp
, p_fdm_values
, FALSE
) != OK
6612 || *curwin
->w_p_fdm
== NUL
)
6615 foldUpdateAll(curwin
);
6619 else if (varp
== &curwin
->w_p_fde
)
6621 if (foldmethodIsExpr(curwin
))
6622 foldUpdateAll(curwin
);
6626 else if (gvarp
== &curwin
->w_allbuf_opt
.wo_fmr
)
6628 p
= vim_strchr(*varp
, ',');
6630 errmsg
= (char_u
*)N_("E536: comma required");
6631 else if (p
== *varp
|| p
[1] == NUL
)
6633 else if (foldmethodIsMarker(curwin
))
6634 foldUpdateAll(curwin
);
6636 /* 'commentstring' */
6637 else if (gvarp
== &p_cms
)
6639 if (**varp
!= NUL
&& strstr((char *)*varp
, "%s") == NULL
)
6640 errmsg
= (char_u
*)N_("E537: 'commentstring' must be empty or contain %s");
6643 else if (varp
== &p_fdo
)
6645 if (opt_strings_flags(p_fdo
, p_fdo_values
, &fdo_flags
, TRUE
) != OK
)
6649 else if (varp
== &p_fcl
)
6651 if (check_opt_strings(p_fcl
, p_fcl_values
, TRUE
) != OK
)
6655 else if (gvarp
== &curwin
->w_allbuf_opt
.wo_fdi
)
6657 if (foldmethodIsIndent(curwin
))
6658 foldUpdateAll(curwin
);
6662 #ifdef FEAT_VIRTUALEDIT
6664 else if (varp
== &p_ve
)
6666 if (opt_strings_flags(p_ve
, p_ve_values
, &ve_flags
, TRUE
) != OK
)
6668 else if (STRCMP(p_ve
, oldval
) != 0)
6670 /* Recompute cursor position in case the new 've' setting
6671 * changes something. */
6673 coladvance(curwin
->w_virtcol
);
6678 #if defined(FEAT_CSCOPE) && defined(FEAT_QUICKFIX)
6679 else if (varp
== &p_csqf
)
6686 if (vim_strchr((char_u
*)CSQF_CMDS
, *p
) == NULL
6688 || vim_strchr((char_u
*)CSQF_FLAGS
, p
[1]) == NULL
6689 || (p
[2] != NUL
&& p
[2] != ','))
6694 else if (p
[2] == NUL
)
6703 /* Options that are a list of flags. */
6708 p
= (char_u
*)WW_ALL
;
6710 p
= (char_u
*)SHM_ALL
;
6711 else if (varp
== &(p_cpo
))
6712 p
= (char_u
*)CPO_ALL
;
6713 else if (varp
== &(curbuf
->b_p_fo
))
6714 p
= (char_u
*)FO_ALL
;
6715 else if (varp
== &p_mouse
)
6718 p
= (char_u
*)MOUSE_ALL
;
6720 if (*p_mouse
!= NUL
)
6721 errmsg
= (char_u
*)N_("E538: No mouse support");
6724 #if defined(FEAT_GUI)
6725 else if (varp
== &p_go
)
6726 p
= (char_u
*)GO_ALL
;
6730 for (s
= *varp
; *s
; ++s
)
6731 if (vim_strchr(p
, *s
) == NULL
)
6733 errmsg
= illegal_char(errbuf
, *s
);
6740 * If error detected, restore the previous value.
6744 if (new_value_alloced
)
6745 free_string_option(*varp
);
6748 * When resetting some values, need to act on it.
6751 (void)init_chartab();
6753 (void)highlight_changed();
6758 /* Remember where the option was set. */
6759 set_option_scriptID_idx(opt_idx
, opt_flags
, current_SID
);
6762 * Free string options that are in allocated memory.
6763 * Use "free_oldval", because recursiveness may change the flags under
6764 * our fingers (esp. init_highlight()).
6767 free_string_option(oldval
);
6768 if (new_value_alloced
)
6769 options
[opt_idx
].flags
|= P_ALLOCED
;
6771 options
[opt_idx
].flags
&= ~P_ALLOCED
;
6773 if ((opt_flags
& (OPT_LOCAL
| OPT_GLOBAL
)) == 0
6774 && ((int)options
[opt_idx
].indir
& PV_BOTH
))
6776 /* global option with local value set to use global value; free
6777 * the local value and make it empty */
6778 p
= get_varp_scope(&(options
[opt_idx
]), OPT_LOCAL
);
6779 free_string_option(*(char_u
**)p
);
6780 *(char_u
**)p
= empty_option
;
6783 /* May set global value for local option. */
6784 else if (!(opt_flags
& OPT_LOCAL
) && opt_flags
!= OPT_GLOBAL
)
6785 set_string_option_global(opt_idx
, varp
);
6789 * Trigger the autocommand only after setting the flags.
6792 /* When 'syntax' is set, load the syntax of that name */
6793 if (varp
== &(curbuf
->b_p_syn
))
6795 apply_autocmds(EVENT_SYNTAX
, curbuf
->b_p_syn
,
6796 curbuf
->b_fname
, TRUE
, curbuf
);
6799 else if (varp
== &(curbuf
->b_p_ft
))
6801 /* 'filetype' is set, trigger the FileType autocommand */
6802 did_filetype
= TRUE
;
6803 apply_autocmds(EVENT_FILETYPE
, curbuf
->b_p_ft
,
6804 curbuf
->b_fname
, TRUE
, curbuf
);
6808 if (varp
== &(curbuf
->b_p_spl
))
6813 * Source the spell/LANG.vim in 'runtimepath'.
6814 * They could set 'spellcapcheck' depending on the language.
6815 * Use the first name in 'spelllang' up to '_region' or
6818 for (p
= curbuf
->b_p_spl
; *p
!= NUL
; ++p
)
6819 if (vim_strchr((char_u
*)"_.,", *p
) != NULL
)
6821 vim_snprintf((char *)fname
, 200, "spell/%.*s.vim",
6822 (int)(p
- curbuf
->b_p_spl
), curbuf
->b_p_spl
);
6823 source_runtime(fname
, TRUE
);
6829 if (varp
== &p_mouse
)
6831 # ifdef FEAT_MOUSE_TTY
6832 if (*p_mouse
== NUL
)
6833 mch_setmouse(FALSE
); /* switch mouse off */
6836 setmouse(); /* in case 'mouse' changed */
6840 if (curwin
->w_curswant
!= MAXCOL
)
6841 curwin
->w_set_curswant
= TRUE
; /* in case 'showbreak' changed */
6843 /* check redraw when it's not a GUI option or the GUI is active. */
6844 if (!redraw_gui_only
|| gui
.in_use
)
6846 check_redraw(options
[opt_idx
].flags
);
6852 * Handle setting 'listchars' or 'fillchars'.
6853 * Returns error message, NULL if it's OK.
6856 set_chars_option(varp
)
6859 int round
, i
, len
, entries
;
6867 #if defined(FEAT_WINDOWS) || defined(FEAT_FOLDING)
6868 static struct charstab filltab
[] =
6871 {&fill_stlnc
, "stlnc"},
6872 {&fill_vert
, "vert"},
6873 {&fill_fold
, "fold"},
6874 {&fill_diff
, "diff"},
6877 static struct charstab lcstab
[] =
6880 {&lcs_ext
, "extends"},
6881 {&lcs_nbsp
, "nbsp"},
6882 {&lcs_prec
, "precedes"},
6884 {&lcs_trail
, "trail"},
6886 struct charstab
*tab
;
6888 #if defined(FEAT_WINDOWS) || defined(FEAT_FOLDING)
6893 entries
= sizeof(lcstab
) / sizeof(struct charstab
);
6895 #if defined(FEAT_WINDOWS) || defined(FEAT_FOLDING)
6899 entries
= sizeof(filltab
) / sizeof(struct charstab
);
6903 /* first round: check for valid value, second round: assign values */
6904 for (round
= 0; round
<= 1; ++round
)
6908 /* After checking that the value is valid: set defaults: space for
6909 * 'fillchars', NUL for 'listchars' */
6910 for (i
= 0; i
< entries
; ++i
)
6911 *(tab
[i
].cp
) = (varp
== &p_lcs
? NUL
: ' ');
6914 #if defined(FEAT_WINDOWS) || defined(FEAT_FOLDING)
6922 for (i
= 0; i
< entries
; ++i
)
6924 len
= (int)STRLEN(tab
[i
].name
);
6925 if (STRNCMP(p
, tab
[i
].name
, len
) == 0
6927 && p
[len
+ 1] != NUL
)
6931 c1
= mb_ptr2char_adv(&s
);
6932 if (mb_char2cells(c1
) > 1)
6937 if (tab
[i
].cp
== &lcs_tab2
)
6942 c2
= mb_ptr2char_adv(&s
);
6943 if (mb_char2cells(c2
) > 1)
6949 if (*s
== ',' || *s
== NUL
)
6953 if (tab
[i
].cp
== &lcs_tab2
)
6975 return NULL
; /* no error */
6980 * Check validity of options with the 'statusline' format.
6981 * Return error message or NULL.
6989 static char_u errbuf
[80];
6991 while (*s
&& itemcnt
< STL_MAX_ITEM
)
6993 /* Check for valid keys after % sequences */
6994 while (*s
&& *s
!= '%')
6999 if (*s
!= '%' && *s
!= ')')
7001 if (*s
== '%' || *s
== STL_TRUNCMARK
|| *s
== STL_MIDDLEMARK
)
7009 if (--groupdepth
< 0)
7015 while (VIM_ISDIGIT(*s
))
7017 if (*s
== STL_USER_HL
)
7022 while (*s
&& VIM_ISDIGIT(*s
))
7030 if (vim_strchr(STL_ALL
, *s
) == NULL
)
7032 return illegal_char(errbuf
, *s
);
7037 while (*s
!= '}' && *s
)
7040 return (char_u
*)N_("E540: Unclosed expression sequence");
7043 if (itemcnt
>= STL_MAX_ITEM
)
7044 return (char_u
*)N_("E541: too many items");
7045 if (groupdepth
!= 0)
7046 return (char_u
*)N_("E542: unbalanced groups");
7051 #ifdef FEAT_CLIPBOARD
7053 * Extract the items in the 'clipboard' option and set global values.
7056 check_clipboard_option()
7058 int new_unnamed
= FALSE
;
7059 int new_autoselect
= FALSE
;
7060 int new_autoselectml
= FALSE
;
7061 int new_html
= FALSE
;
7062 regprog_T
*new_exclude_prog
= NULL
;
7063 char_u
*errmsg
= NULL
;
7066 for (p
= p_cb
; *p
!= NUL
; )
7068 if (STRNCMP(p
, "unnamed", 7) == 0 && (p
[7] == ',' || p
[7] == NUL
))
7073 else if (STRNCMP(p
, "autoselect", 10) == 0
7074 && (p
[10] == ',' || p
[10] == NUL
))
7076 new_autoselect
= TRUE
;
7079 else if (STRNCMP(p
, "autoselectml", 12) == 0
7080 && (p
[12] == ',' || p
[12] == NUL
))
7082 new_autoselectml
= TRUE
;
7085 else if (STRNCMP(p
, "html", 4) == 0 && (p
[4] == ',' || p
[4] == NUL
))
7090 else if (STRNCMP(p
, "exclude:", 8) == 0 && new_exclude_prog
== NULL
)
7093 new_exclude_prog
= vim_regcomp(p
, RE_MAGIC
);
7094 if (new_exclude_prog
== NULL
)
7108 clip_unnamed
= new_unnamed
;
7109 clip_autoselect
= new_autoselect
;
7110 clip_autoselectml
= new_autoselectml
;
7111 clip_html
= new_html
;
7112 vim_free(clip_exclude_prog
);
7113 clip_exclude_prog
= new_exclude_prog
;
7116 vim_free(new_exclude_prog
);
7124 * Set curbuf->b_cap_prog to the regexp program for 'spellcapcheck'.
7125 * Return error message when failed, NULL when OK.
7128 compile_cap_prog(buf
)
7131 regprog_T
*rp
= buf
->b_cap_prog
;
7134 if (*buf
->b_p_spc
== NUL
)
7135 buf
->b_cap_prog
= NULL
;
7138 /* Prepend a ^ so that we only match at one column */
7139 re
= concat_str((char_u
*)"^", buf
->b_p_spc
);
7142 buf
->b_cap_prog
= vim_regcomp(re
, RE_MAGIC
);
7143 if (buf
->b_cap_prog
== NULL
)
7145 buf
->b_cap_prog
= rp
; /* restore the previous program */
7157 #if defined(FEAT_EVAL) || defined(PROTO)
7159 * Set the scriptID for an option, taking care of setting the buffer- or
7160 * window-local value.
7163 set_option_scriptID_idx(opt_idx
, opt_flags
, id
)
7168 int both
= (opt_flags
& (OPT_LOCAL
| OPT_GLOBAL
)) == 0;
7169 int indir
= (int)options
[opt_idx
].indir
;
7171 /* Remember where the option was set. For local options need to do that
7172 * in the buffer or window structure. */
7173 if (both
|| (opt_flags
& OPT_GLOBAL
) || (indir
& (PV_BUF
|PV_WIN
)) == 0)
7174 options
[opt_idx
].scriptID
= id
;
7175 if (both
|| (opt_flags
& OPT_LOCAL
))
7178 curbuf
->b_p_scriptID
[indir
& PV_MASK
] = id
;
7179 else if (indir
& PV_WIN
)
7180 curwin
->w_p_scriptID
[indir
& PV_MASK
] = id
;
7186 * Set the value of a boolean option, and take care of side effects.
7187 * Returns NULL for success, or an error message for an error.
7190 set_bool_option(opt_idx
, varp
, value
, opt_flags
)
7191 int opt_idx
; /* index in options[] table */
7192 char_u
*varp
; /* pointer to the option variable */
7193 int value
; /* new value */
7194 int opt_flags
; /* OPT_LOCAL and/or OPT_GLOBAL */
7196 int old_value
= *(int *)varp
;
7198 /* Disallow changing some options from secure mode */
7203 ) && (options
[opt_idx
].flags
& P_SECURE
))
7206 *(int *)varp
= value
; /* set the new value */
7208 /* Remember where the option was set. */
7209 set_option_scriptID_idx(opt_idx
, opt_flags
, current_SID
);
7213 need_mouse_correct
= TRUE
;
7216 /* May set global value for local option. */
7217 if ((opt_flags
& (OPT_LOCAL
| OPT_GLOBAL
)) == 0)
7218 *(int *)get_varp_scope(&(options
[opt_idx
]), OPT_GLOBAL
) = value
;
7221 * Handle side effects of changing a bool option.
7225 if ((int *)varp
== &p_cp
)
7230 /* 'list', 'number' */
7231 else if ((int *)varp
== &curwin
->w_p_list
7232 || (int *)varp
== &curwin
->w_p_nu
)
7234 if (curwin
->w_curswant
!= MAXCOL
)
7235 curwin
->w_set_curswant
= TRUE
;
7238 else if ((int *)varp
== &curbuf
->b_p_ro
)
7240 /* when 'readonly' is reset globally, also reset readonlymode */
7241 if (!curbuf
->b_p_ro
&& (opt_flags
& OPT_LOCAL
) == 0)
7242 readonlymode
= FALSE
;
7244 /* when 'readonly' is set may give W10 again */
7246 curbuf
->b_did_warn
= FALSE
;
7254 /* when 'modifiable' is changed, redraw the window title */
7255 else if ((int *)varp
== &curbuf
->b_p_ma
)
7259 /* when 'endofline' is changed, redraw the window title */
7260 else if ((int *)varp
== &curbuf
->b_p_eol
)
7265 /* when 'bomb' is changed, redraw the window title and tab page text */
7266 else if ((int *)varp
== &curbuf
->b_p_bomb
)
7273 /* when 'bin' is set also set some other options */
7274 else if ((int *)varp
== &curbuf
->b_p_bin
)
7276 set_options_bin(old_value
, curbuf
->b_p_bin
, opt_flags
);
7283 /* when 'buflisted' changes, trigger autocommands */
7284 else if ((int *)varp
== &curbuf
->b_p_bl
&& old_value
!= curbuf
->b_p_bl
)
7286 apply_autocmds(curbuf
->b_p_bl
? EVENT_BUFADD
: EVENT_BUFDELETE
,
7287 NULL
, NULL
, TRUE
, curbuf
);
7291 /* when 'swf' is set, create swapfile, when reset remove swapfile */
7292 else if ((int *)varp
== &curbuf
->b_p_swf
)
7294 if (curbuf
->b_p_swf
&& p_uc
)
7295 ml_open_file(curbuf
); /* create the swap file */
7297 /* no need to reset curbuf->b_may_swap, ml_open_file() will check
7299 mf_close_file(curbuf
, TRUE
); /* remove the swap file */
7302 /* when 'terse' is set change 'shortmess' */
7303 else if ((int *)varp
== &p_terse
)
7307 p
= vim_strchr(p_shm
, SHM_SEARCH
);
7309 /* insert 's' in p_shm */
7310 if (p_terse
&& p
== NULL
)
7312 STRCPY(IObuff
, p_shm
);
7313 STRCAT(IObuff
, "s");
7314 set_string_option_direct((char_u
*)"shm", -1, IObuff
, OPT_FREE
, 0);
7316 /* remove 's' from p_shm */
7317 else if (!p_terse
&& p
!= NULL
)
7321 /* when 'paste' is set or reset also change other options */
7322 else if ((int *)varp
== &p_paste
)
7324 paste_option_changed();
7327 /* when 'insertmode' is set from an autocommand need to do work here */
7328 else if ((int *)varp
== &p_im
)
7332 if ((State
& INSERT
) == 0)
7333 need_start_insertmode
= TRUE
;
7334 stop_insert_mode
= FALSE
;
7338 need_start_insertmode
= FALSE
;
7339 stop_insert_mode
= TRUE
;
7340 if (restart_edit
!= 0 && mode_displayed
)
7341 clear_cmdline
= TRUE
; /* remove "(insert)" */
7346 /* when 'ignorecase' is set or reset and 'hlsearch' is set, redraw */
7347 else if ((int *)varp
== &p_ic
&& p_hls
)
7349 redraw_all_later(SOME_VALID
);
7352 #ifdef FEAT_SEARCH_EXTRA
7353 /* when 'hlsearch' is set or reset: reset no_hlsearch */
7354 else if ((int *)varp
== &p_hls
)
7356 no_hlsearch
= FALSE
;
7360 #ifdef FEAT_SCROLLBIND
7361 /* when 'scrollbind' is set: snapshot the current position to avoid a jump
7362 * at the end of normal_cmd() */
7363 else if ((int *)varp
== &curwin
->w_p_scb
)
7365 if (curwin
->w_p_scb
)
7366 do_check_scrollbind(FALSE
);
7370 #if defined(FEAT_WINDOWS) && defined(FEAT_QUICKFIX)
7371 /* There can be only one window with 'previewwindow' set. */
7372 else if ((int *)varp
== &curwin
->w_p_pvw
)
7374 if (curwin
->w_p_pvw
)
7378 for (win
= firstwin
; win
!= NULL
; win
= win
->w_next
)
7379 if (win
->w_p_pvw
&& win
!= curwin
)
7381 curwin
->w_p_pvw
= FALSE
;
7382 return (char_u
*)N_("E590: A preview window already exists");
7388 /* when 'textmode' is set or reset also change 'fileformat' */
7389 else if ((int *)varp
== &curbuf
->b_p_tx
)
7391 set_fileformat(curbuf
->b_p_tx
? EOL_DOS
: EOL_UNIX
, opt_flags
);
7394 /* when 'textauto' is set or reset also change 'fileformats' */
7395 else if ((int *)varp
== &p_ta
)
7396 set_string_option_direct((char_u
*)"ffs", -1,
7397 p_ta
? (char_u
*)DFLT_FFS_VIM
: (char_u
*)"",
7398 OPT_FREE
| opt_flags
, 0);
7401 * When 'lisp' option changes include/exclude '-' in
7402 * keyword characters.
7405 else if (varp
== (char_u
*)&(curbuf
->b_p_lisp
))
7407 (void)buf_init_chartab(curbuf
, FALSE
); /* ignore errors */
7412 /* when 'title' changed, may need to change the title; same for 'icon' */
7413 else if ((int *)varp
== &p_title
)
7415 did_set_title(FALSE
);
7418 else if ((int *)varp
== &p_icon
)
7420 did_set_title(TRUE
);
7424 else if ((int *)varp
== &curbuf
->b_changed
)
7427 save_file_ff(curbuf
); /* Buffer is unchanged */
7432 modified_was_set
= value
;
7436 #ifdef BACKSLASH_IN_FILENAME
7437 else if ((int *)varp
== &p_ssl
)
7452 /* need to adjust the file name arguments and buffer names. */
7453 buflist_slash_adjust();
7454 alist_slash_adjust();
7456 scriptnames_slash_adjust();
7461 /* If 'wrap' is set, set w_leftcol to zero. */
7462 else if ((int *)varp
== &curwin
->w_p_wrap
)
7464 if (curwin
->w_p_wrap
)
7465 curwin
->w_leftcol
= 0;
7466 if (curwin
->w_curswant
!= MAXCOL
)
7467 curwin
->w_set_curswant
= TRUE
;
7471 else if ((int *)varp
== &p_ea
)
7473 if (p_ea
&& !old_value
)
7474 win_equal(curwin
, FALSE
, 0);
7478 else if ((int *)varp
== &p_wiv
)
7481 * When 'weirdinvert' changed, set/reset 't_xs'.
7482 * Then set 'weirdinvert' according to value of 't_xs'.
7484 if (p_wiv
&& !old_value
)
7485 T_XS
= (char_u
*)"y";
7486 else if (!p_wiv
&& old_value
)
7487 T_XS
= empty_option
;
7488 p_wiv
= (*T_XS
!= NUL
);
7492 else if ((int *)varp
== &p_beval
)
7494 if (p_beval
== TRUE
)
7495 gui_mch_enable_beval_area(balloonEval
);
7497 gui_mch_disable_beval_area(balloonEval
);
7501 #ifdef FEAT_AUTOCHDIR
7502 else if ((int *)varp
== &p_acd
)
7504 /* Change directories when the 'acd' option is set now. */
7511 else if ((int *)varp
== &curwin
->w_p_diff
)
7513 /* May add or remove the buffer from the list of diff buffers. */
7514 diff_buf_adjust(curwin
);
7515 # ifdef FEAT_FOLDING
7516 if (foldmethodIsDiff(curwin
))
7517 foldUpdateAll(curwin
);
7522 #ifdef USE_IM_CONTROL
7524 else if ((int *)varp
== &p_imdisable
)
7526 /* Only de-activate it here, it will be enabled when changing mode. */
7528 im_set_active(FALSE
);
7534 else if ((int *)varp
== &curwin
->w_p_spell
)
7536 if (curwin
->w_p_spell
)
7538 char_u
*errmsg
= did_set_spelllang(curbuf
);
7547 else if ((int *)varp
== &p_altkeymap
)
7549 if (old_value
!= p_altkeymap
)
7561 (void)init_chartab();
7566 * In case some second language keymapping options have changed, check
7567 * and correct the setting in a consistent way.
7571 * If hkmap or fkmap are set, reset Arabic keymapping.
7573 if ((p_hkmap
|| p_fkmap
) && p_altkeymap
)
7575 p_altkeymap
= p_fkmap
;
7577 curwin
->w_p_arab
= FALSE
;
7579 (void)init_chartab();
7583 * If hkmap set, reset Farsi keymapping.
7585 if (p_hkmap
&& p_altkeymap
)
7590 curwin
->w_p_arab
= FALSE
;
7592 (void)init_chartab();
7596 * If fkmap set, reset Hebrew keymapping.
7598 if (p_fkmap
&& !p_altkeymap
)
7603 curwin
->w_p_arab
= FALSE
;
7605 (void)init_chartab();
7610 if ((int *)varp
== &curwin
->w_p_arab
)
7612 if (curwin
->w_p_arab
)
7615 * 'arabic' is set, handle various sub-settings.
7619 /* set rightleft mode */
7620 if (!curwin
->w_p_rl
)
7622 curwin
->w_p_rl
= TRUE
;
7623 changed_window_setting();
7626 /* Enable Arabic shaping (major part of what Arabic requires) */
7630 redraw_later_clear();
7634 /* Arabic requires a utf-8 encoding, inform the user if its not
7636 if (STRCMP(p_enc
, "utf-8") != 0)
7638 static char *w_arabic
= N_("W17: Arabic requires UTF-8, do ':set encoding=utf-8'");
7640 msg_source(hl_attr(HLF_W
));
7641 MSG_ATTR(_(w_arabic
), hl_attr(HLF_W
));
7643 set_vim_var_string(VV_WARNINGMSG
, (char_u
*)_(w_arabic
), -1);
7648 /* set 'delcombine' */
7653 /* Force-set the necessary keymap for arabic */
7654 set_option_value((char_u
*)"keymap", 0L, (char_u
*)"arabic",
7661 (void)init_chartab();
7667 * 'arabic' is reset, handle various sub-settings.
7671 /* reset rightleft mode */
7674 curwin
->w_p_rl
= FALSE
;
7675 changed_window_setting();
7678 /* 'arabicshape' isn't reset, it is a global option and
7679 * another window may still need it "on". */
7682 /* 'delcombine' isn't reset, it is a global option and another
7683 * window may still want it "on". */
7686 /* Revert to the default keymap */
7687 curbuf
->b_p_iminsert
= B_IMODE_NONE
;
7688 curbuf
->b_p_imsearch
= B_IMODE_USE_INSERT
;
7691 if (curwin
->w_curswant
!= MAXCOL
)
7692 curwin
->w_set_curswant
= TRUE
;
7695 else if ((int *)varp
== &p_arshape
)
7697 if (curwin
->w_curswant
!= MAXCOL
)
7698 curwin
->w_set_curswant
= TRUE
;
7702 #ifdef FEAT_LINEBREAK
7703 if ((int *)varp
== &curwin
->w_p_lbr
)
7705 if (curwin
->w_curswant
!= MAXCOL
)
7706 curwin
->w_set_curswant
= TRUE
;
7710 #ifdef FEAT_RIGHTLEFT
7711 if ((int *)varp
== &curwin
->w_p_rl
)
7713 if (curwin
->w_curswant
!= MAXCOL
)
7714 curwin
->w_set_curswant
= TRUE
;
7719 * End of handling side effects for bool options.
7722 options
[opt_idx
].flags
|= P_WAS_SET
;
7724 comp_col(); /* in case 'ruler' or 'showcmd' changed */
7726 check_redraw(options
[opt_idx
].flags
);
7732 * Set the value of a number option, and take care of side effects.
7733 * Returns NULL for success, or an error message for an error.
7736 set_num_option(opt_idx
, varp
, value
, errbuf
, errbuflen
, opt_flags
)
7737 int opt_idx
; /* index in options[] table */
7738 char_u
*varp
; /* pointer to the option variable */
7739 long value
; /* new value */
7740 char_u
*errbuf
; /* buffer for error messages */
7741 size_t errbuflen
; /* length of "errbuf" */
7742 int opt_flags
; /* OPT_LOCAL, OPT_GLOBAL and
7745 char_u
*errmsg
= NULL
;
7746 long old_value
= *(long *)varp
;
7747 long old_Rows
= Rows
; /* remember old Rows */
7748 long old_Columns
= Columns
; /* remember old Columns */
7749 long *pp
= (long *)varp
;
7751 /* Disallow changing some options from secure mode. */
7756 ) && (options
[opt_idx
].flags
& P_SECURE
))
7761 /* Remember where the option was set. */
7762 set_option_scriptID_idx(opt_idx
, opt_flags
, current_SID
);
7765 need_mouse_correct
= TRUE
;
7768 if (curbuf
->b_p_sw
<= 0)
7770 errmsg
= e_positive
;
7771 curbuf
->b_p_sw
= curbuf
->b_p_ts
;
7775 * Number options that need some action when changed
7778 if (pp
== &p_wh
|| pp
== &p_hh
)
7782 errmsg
= e_positive
;
7787 errmsg
= e_winheight
;
7792 errmsg
= e_positive
;
7796 /* Change window height NOW */
7797 if (lastwin
!= firstwin
)
7799 if (pp
== &p_wh
&& curwin
->w_height
< p_wh
)
7800 win_setheight((int)p_wh
);
7801 if (pp
== &p_hh
&& curbuf
->b_help
&& curwin
->w_height
< p_hh
)
7802 win_setheight((int)p_hh
);
7806 /* 'winminheight' */
7807 else if (pp
== &p_wmh
)
7811 errmsg
= e_positive
;
7816 errmsg
= e_winheight
;
7822 # ifdef FEAT_VERTSPLIT
7823 else if (pp
== &p_wiw
)
7827 errmsg
= e_positive
;
7832 errmsg
= e_winwidth
;
7836 /* Change window width NOW */
7837 if (lastwin
!= firstwin
&& curwin
->w_width
< p_wiw
)
7838 win_setwidth((int)p_wiw
);
7842 else if (pp
== &p_wmw
)
7846 errmsg
= e_positive
;
7851 errmsg
= e_winwidth
;
7861 /* (re)set last window status line */
7862 else if (pp
== &p_ls
)
7867 /* (re)set tab page line */
7868 else if (pp
== &p_stal
)
7870 shell_new_rows(); /* recompute window positions and heights */
7875 else if (pp
== &p_linespace
)
7877 /* Recompute gui.char_height and resize the Vim window to keep the
7878 * same number of lines. */
7879 if (gui
.in_use
&& gui_mch_adjust_charheight() == OK
)
7880 gui_set_shellsize(FALSE
, FALSE
, RESIZE_VERT
);
7886 else if (pp
== &curwin
->w_p_fdl
)
7888 if (curwin
->w_p_fdl
< 0)
7889 curwin
->w_p_fdl
= 0;
7893 /* 'foldminlines' */
7894 else if (pp
== &curwin
->w_p_fml
)
7896 foldUpdateAll(curwin
);
7900 else if (pp
== &curwin
->w_p_fdn
)
7902 if (foldmethodIsSyntax(curwin
) || foldmethodIsIndent(curwin
))
7903 foldUpdateAll(curwin
);
7907 else if (pp
== &curwin
->w_p_fdc
)
7909 if (curwin
->w_p_fdc
< 0)
7911 errmsg
= e_positive
;
7912 curwin
->w_p_fdc
= 0;
7914 else if (curwin
->w_p_fdc
> 12)
7917 curwin
->w_p_fdc
= 12;
7921 /* 'shiftwidth' or 'tabstop' */
7922 else if (pp
== &curbuf
->b_p_sw
|| pp
== &curbuf
->b_p_ts
)
7924 if (foldmethodIsIndent(curwin
))
7925 foldUpdateAll(curwin
);
7927 #endif /* FEAT_FOLDING */
7931 else if (pp
== &p_mco
)
7933 if (p_mco
> MAX_MCO
)
7937 screenclear(); /* will re-allocate the screen */
7941 else if (pp
== &curbuf
->b_p_iminsert
)
7943 if (curbuf
->b_p_iminsert
< 0 || curbuf
->b_p_iminsert
> B_IMODE_LAST
)
7946 curbuf
->b_p_iminsert
= B_IMODE_NONE
;
7948 p_iminsert
= curbuf
->b_p_iminsert
;
7949 if (termcap_active
) /* don't do this in the alternate screen */
7951 #if defined(FEAT_WINDOWS) && defined(FEAT_KEYMAP)
7952 /* Show/unshow value of 'keymap' in status lines. */
7953 status_redraw_curbuf();
7957 else if (pp
== &p_window
)
7961 else if (p_window
>= Rows
)
7962 p_window
= Rows
- 1;
7965 else if (pp
== &curbuf
->b_p_imsearch
)
7967 if (curbuf
->b_p_imsearch
< -1 || curbuf
->b_p_imsearch
> B_IMODE_LAST
)
7970 curbuf
->b_p_imsearch
= B_IMODE_NONE
;
7972 p_imsearch
= curbuf
->b_p_imsearch
;
7976 /* if 'titlelen' has changed, redraw the title */
7977 else if (pp
== &p_titlelen
)
7981 errmsg
= e_positive
;
7984 if (starting
!= NO_SCREEN
&& old_value
!= p_titlelen
)
7985 need_maketitle
= TRUE
;
7989 /* if p_ch changed value, change the command line height */
7990 else if (pp
== &p_ch
)
7994 errmsg
= e_positive
;
7997 if (p_ch
> Rows
- min_rows() + 1)
7998 p_ch
= Rows
- min_rows() + 1;
8000 /* Only compute the new window layout when startup has been
8001 * completed. Otherwise the frame sizes may be wrong. */
8002 if (p_ch
!= old_value
&& full_screen
8010 /* when 'updatecount' changes from zero to non-zero, open swap files */
8011 else if (pp
== &p_uc
)
8015 errmsg
= e_positive
;
8018 if (p_uc
&& !old_value
)
8021 #ifdef MZSCHEME_GUI_THREADS
8022 else if (pp
== &p_mzq
)
8023 mzvim_reset_timer();
8026 /* sync undo before 'undolevels' changes */
8027 else if (pp
== &p_ul
)
8029 /* use the old value, otherwise u_sync() may not work properly */
8035 #ifdef FEAT_LINEBREAK
8036 /* 'numberwidth' must be positive */
8037 else if (pp
== &curwin
->w_p_nuw
)
8039 if (curwin
->w_p_nuw
< 1)
8041 errmsg
= e_positive
;
8042 curwin
->w_p_nuw
= 1;
8044 if (curwin
->w_p_nuw
> 10)
8047 curwin
->w_p_nuw
= 10;
8049 curwin
->w_nrwidth_line_count
= 0;
8052 /* 'breakindentmin' must be positive */
8053 else if (pp
== &curwin
->w_p_brimin
)
8055 if (curwin
->w_p_brimin
< 1)
8057 errmsg
= e_positive
;
8058 curwin
->w_p_brimin
= 1;
8064 * Check the bounds for numeric options here
8066 if (Rows
< min_rows() && full_screen
)
8070 vim_snprintf((char *)errbuf
, errbuflen
,
8071 _("E593: Need at least %d lines"), min_rows());
8076 if (Columns
< MIN_COLUMNS
&& full_screen
)
8080 vim_snprintf((char *)errbuf
, errbuflen
,
8081 _("E594: Need at least %d columns"), MIN_COLUMNS
);
8084 Columns
= MIN_COLUMNS
;
8086 /* Limit the values to avoid an overflow in Rows * Columns. */
8087 if (Columns
> 10000)
8093 /* avoid a crash by checking for a too large value of 'columns' */
8094 if (old_Columns
!= Columns
&& full_screen
&& term_console
)
8095 mch_check_columns();
8099 * If the screen (shell) height has been changed, assume it is the
8100 * physical screenheight.
8102 if (old_Rows
!= Rows
|| old_Columns
!= Columns
)
8104 /* Changing the screen size is not allowed while updating the screen. */
8105 if (updating_screen
)
8107 else if (full_screen
8112 set_shellsize((int)Columns
, (int)Rows
, TRUE
);
8115 /* Postpone the resizing; check the size and cmdline position for
8118 if (cmdline_row
> Rows
- p_ch
&& Rows
> p_ch
)
8119 cmdline_row
= Rows
- p_ch
;
8121 if (p_window
>= Rows
|| !option_was_set((char_u
*)"window"))
8122 p_window
= Rows
- 1;
8125 if (curbuf
->b_p_sts
< 0)
8127 errmsg
= e_positive
;
8128 curbuf
->b_p_sts
= 0;
8130 if (curbuf
->b_p_ts
<= 0)
8132 errmsg
= e_positive
;
8135 if (curbuf
->b_p_tw
< 0)
8137 errmsg
= e_positive
;
8142 errmsg
= e_positive
;
8145 if ((curwin
->w_p_scr
<= 0
8146 || (curwin
->w_p_scr
> curwin
->w_height
8147 && curwin
->w_height
> 0))
8150 if (pp
== &(curwin
->w_p_scr
))
8152 if (curwin
->w_p_scr
!= 0)
8154 win_comp_scroll(curwin
);
8156 /* If 'scroll' became invalid because of a side effect silently adjust
8158 else if (curwin
->w_p_scr
<= 0)
8159 curwin
->w_p_scr
= 1;
8160 else /* curwin->w_p_scr > curwin->w_height */
8161 curwin
->w_p_scr
= curwin
->w_height
;
8165 errmsg
= e_positive
;
8170 errmsg
= e_positive
;
8173 if ((p_sj
< -100 || p_sj
>= Rows
) && full_screen
)
8175 if (Rows
!= old_Rows
) /* Rows changed, just adjust p_sj */
8183 if (p_so
< 0 && full_screen
)
8188 if (p_siso
< 0 && full_screen
)
8190 errmsg
= e_positive
;
8196 errmsg
= e_positive
;
8202 errmsg
= e_positive
;
8207 errmsg
= e_positive
;
8211 /* May set global value for local option. */
8212 if ((opt_flags
& (OPT_LOCAL
| OPT_GLOBAL
)) == 0)
8213 *(long *)get_varp_scope(&(options
[opt_idx
]), OPT_GLOBAL
) = *pp
;
8215 options
[opt_idx
].flags
|= P_WAS_SET
;
8217 comp_col(); /* in case 'columns' or 'ls' changed */
8218 if (curwin
->w_curswant
!= MAXCOL
)
8219 curwin
->w_set_curswant
= TRUE
; /* in case 'tabstop' changed */
8220 check_redraw(options
[opt_idx
].flags
);
8226 * Called after an option changed: check if something needs to be redrawn.
8232 /* Careful: P_RCLR and P_RALL are a combination of other P_ flags */
8233 int clear
= (flags
& P_RCLR
) == P_RCLR
;
8234 int all
= ((flags
& P_RALL
) == P_RALL
|| clear
);
8237 if ((flags
& P_RSTAT
) || all
) /* mark all status lines dirty */
8238 status_redraw_all();
8241 if ((flags
& P_RBUF
) || (flags
& P_RWIN
) || all
)
8242 changed_window_setting();
8244 redraw_curbuf_later(NOT_VALID
);
8246 redraw_all_later(CLEAR
);
8248 redraw_all_later(NOT_VALID
);
8252 * Find index for option 'arg'.
8253 * Return -1 if not found.
8261 static short quick_tab
[27] = {0, 0}; /* quick access table */
8265 * For first call: Initialize the quick-access table.
8266 * It contains the index for the first option that starts with a certain
8267 * letter. There are 26 letters, plus the first "t_" option.
8269 if (quick_tab
[1] == 0)
8271 p
= options
[0].fullname
;
8272 for (opt_idx
= 1; (s
= options
[opt_idx
].fullname
) != NULL
; opt_idx
++)
8276 if (s
[0] == 't' && s
[1] == '_')
8277 quick_tab
[26] = opt_idx
;
8279 quick_tab
[CharOrdLow(s
[0])] = opt_idx
;
8286 * Check for name starting with an illegal character.
8289 if (!islower(arg
[0]))
8291 if (arg
[0] < 'a' || arg
[0] > 'z')
8295 is_term_opt
= (arg
[0] == 't' && arg
[1] == '_');
8297 opt_idx
= quick_tab
[26];
8299 opt_idx
= quick_tab
[CharOrdLow(arg
[0])];
8300 for ( ; (s
= options
[opt_idx
].fullname
) != NULL
; opt_idx
++)
8302 if (STRCMP(arg
, s
) == 0) /* match full name */
8305 if (s
== NULL
&& !is_term_opt
)
8307 opt_idx
= quick_tab
[CharOrdLow(arg
[0])];
8308 for ( ; options
[opt_idx
].fullname
!= NULL
; opt_idx
++)
8310 s
= options
[opt_idx
].shortname
;
8311 if (s
!= NULL
&& STRCMP(arg
, s
) == 0) /* match short name */
8321 #if defined(FEAT_EVAL) || defined(FEAT_TCL) || defined(FEAT_MZSCHEME)
8323 * Get the value for an option.
8326 * Number or Toggle option: 1, *numval gets value.
8327 * String option: 0, *stringval gets allocated string.
8328 * Hidden Number or Toggle option: -1.
8329 * hidden String option: -2.
8330 * unknown option: -3.
8333 get_option_value(name
, numval
, stringval
, opt_flags
)
8336 char_u
**stringval
; /* NULL when only checking existance */
8342 opt_idx
= findoption(name
);
8343 if (opt_idx
< 0) /* unknown option */
8346 varp
= get_varp_scope(&(options
[opt_idx
]), opt_flags
);
8348 if (options
[opt_idx
].flags
& P_STRING
)
8350 if (varp
== NULL
) /* hidden option */
8352 if (stringval
!= NULL
)
8355 /* never return the value of the crypt key */
8356 if ((char_u
**)varp
== &curbuf
->b_p_key
8357 && **(char_u
**)(varp
) != NUL
)
8358 *stringval
= vim_strsave((char_u
*)"*****");
8361 *stringval
= vim_strsave(*(char_u
**)(varp
));
8366 if (varp
== NULL
) /* hidden option */
8368 if (options
[opt_idx
].flags
& P_NUM
)
8369 *numval
= *(long *)varp
;
8372 /* Special case: 'modified' is b_changed, but we also want to consider
8373 * it set when 'ff' or 'fenc' changed. */
8374 if ((int *)varp
== &curbuf
->b_changed
)
8375 *numval
= curbufIsChanged();
8377 *numval
= *(int *)varp
;
8384 * Set the value of option "name".
8385 * Use "string" for string options, use "number" for other options.
8388 set_option_value(name
, number
, string
, opt_flags
)
8392 int opt_flags
; /* OPT_LOCAL or 0 (both) */
8398 opt_idx
= findoption(name
);
8400 EMSG2(_("E355: Unknown option: %s"), name
);
8403 flags
= options
[opt_idx
].flags
;
8405 /* Disallow changing some options in the sandbox */
8406 if (sandbox
> 0 && (flags
& P_SECURE
))
8412 if (flags
& P_STRING
)
8413 set_string_option(opt_idx
, string
, opt_flags
);
8416 varp
= get_varp_scope(&(options
[opt_idx
]), opt_flags
);
8417 if (varp
!= NULL
) /* hidden option is not changed */
8419 if (number
== 0 && string
!= NULL
)
8423 /* Either we are given a string or we are setting option
8425 for (idx
= 0; string
[idx
] == '0'; ++idx
)
8427 if (string
[idx
] != NUL
|| idx
== 0)
8429 /* There's another character after zeros or the string
8430 * is empty. In both cases, we are trying to set a
8431 * num option using a string. */
8432 EMSG3(_("E521: Number required: &%s = '%s'"),
8434 return; /* do nothing as we hit an error */
8439 (void)set_num_option(opt_idx
, varp
, number
,
8440 NULL
, 0, opt_flags
);
8442 (void)set_bool_option(opt_idx
, varp
, (int)number
,
8450 * Get the terminal code for a terminal option.
8451 * Returns NULL when not found.
8454 get_term_code(tname
)
8460 if (tname
[0] != 't' || tname
[1] != '_' ||
8461 tname
[2] == NUL
|| tname
[3] == NUL
)
8463 if ((opt_idx
= findoption(tname
)) >= 0)
8465 varp
= get_varp(&(options
[opt_idx
]));
8467 varp
= *(char_u
**)(varp
);
8470 return find_termcode(tname
+ 2);
8474 get_highlight_default()
8478 i
= findoption((char_u
*)"hl");
8480 return options
[i
].def_val
[VI_DEFAULT
];
8481 return (char_u
*)NULL
;
8484 #if defined(FEAT_MBYTE) || defined(PROTO)
8486 get_encoding_default()
8490 i
= findoption((char_u
*)"enc");
8492 return options
[i
].def_val
[VI_DEFAULT
];
8493 return (char_u
*)NULL
;
8498 * Translate a string like "t_xx", "<t_xx>" or "<S-Tab>" to a key number.
8501 find_key_option(arg
)
8508 * Don't use get_special_key_code() for t_xx, we don't want it to call
8509 * add_termcap_entry().
8511 if (arg
[0] == 't' && arg
[1] == '_' && arg
[2] && arg
[3])
8512 key
= TERMCAP2KEY(arg
[2], arg
[3]);
8515 --arg
; /* put arg at the '<' */
8517 key
= find_special_key(&arg
, &modifiers
, TRUE
, TRUE
);
8518 if (modifiers
) /* can't handle modifiers here */
8525 * if 'all' == 0: show changed options
8526 * if 'all' == 1: show all normal options
8527 * if 'all' == 2: show all terminal options
8530 showoptions(all
, opt_flags
)
8532 int opt_flags
; /* OPT_LOCAL and/or OPT_GLOBAL */
8534 struct vimoption
*p
;
8538 struct vimoption
**items
;
8549 items
= (struct vimoption
**)alloc((unsigned)(sizeof(struct vimoption
*) *
8554 /* Highlight title */
8556 MSG_PUTS_TITLE(_("\n--- Terminal codes ---"));
8557 else if (opt_flags
& OPT_GLOBAL
)
8558 MSG_PUTS_TITLE(_("\n--- Global option values ---"));
8559 else if (opt_flags
& OPT_LOCAL
)
8560 MSG_PUTS_TITLE(_("\n--- Local option values ---"));
8562 MSG_PUTS_TITLE(_("\n--- Options ---"));
8565 * do the loop two times:
8566 * 1. display the short items
8567 * 2. display the long items (only strings and numbers)
8569 for (run
= 1; run
<= 2 && !got_int
; ++run
)
8572 * collect the items in items[]
8575 for (p
= &options
[0]; p
->fullname
!= NULL
; p
++)
8578 isterm
= istermoption(p
);
8581 if (p
->indir
!= PV_NONE
&& !isterm
)
8582 varp
= get_varp_scope(p
, opt_flags
);
8587 && ((all
== 2 && isterm
)
8588 || (all
== 1 && !isterm
)
8589 || (all
== 0 && !optval_default(p
, varp
))))
8591 if (p
->flags
& P_BOOL
)
8592 len
= 1; /* a toggle option fits always */
8595 option_value2string(p
, opt_flags
);
8596 len
= (int)STRLEN(p
->fullname
) + vim_strsize(NameBuff
) + 1;
8598 if ((len
<= INC
- GAP
&& run
== 1) ||
8599 (len
> INC
- GAP
&& run
== 2))
8600 items
[item_count
++] = p
;
8609 cols
= (Columns
+ GAP
- 3) / INC
;
8612 rows
= (item_count
+ cols
- 1) / cols
;
8616 for (row
= 0; row
< rows
&& !got_int
; ++row
)
8618 msg_putchar('\n'); /* go to next line */
8619 if (got_int
) /* 'q' typed in more */
8622 for (i
= row
; i
< item_count
; i
+= rows
)
8624 msg_col
= col
; /* make columns */
8625 showoneopt(items
[i
], opt_flags
);
8636 * Return TRUE if option "p" has its default value.
8639 optval_default(p
, varp
)
8640 struct vimoption
*p
;
8646 return TRUE
; /* hidden option is always at default */
8647 dvi
= ((p
->flags
& P_VI_DEF
) || p_cp
) ? VI_DEFAULT
: VIM_DEFAULT
;
8648 if (p
->flags
& P_NUM
)
8649 return (*(long *)varp
== (long)(long_i
)p
->def_val
[dvi
]);
8650 if (p
->flags
& P_BOOL
)
8651 /* the cast to long is required for Manx C, long_i is
8652 * needed for MSVC */
8653 return (*(int *)varp
== (int)(long)(long_i
)p
->def_val
[dvi
]);
8655 return (STRCMP(*(char_u
**)varp
, p
->def_val
[dvi
]) == 0);
8659 * showoneopt: show the value of one option
8660 * must not be called with a hidden option!
8663 showoneopt(p
, opt_flags
)
8664 struct vimoption
*p
;
8665 int opt_flags
; /* OPT_LOCAL or OPT_GLOBAL */
8668 int save_silent
= silent_mode
;
8670 silent_mode
= FALSE
;
8671 info_message
= TRUE
; /* use mch_msg(), not mch_errmsg() */
8673 varp
= get_varp_scope(p
, opt_flags
);
8675 /* for 'modified' we also need to check if 'ff' or 'fenc' changed. */
8676 if ((p
->flags
& P_BOOL
) && ((int *)varp
== &curbuf
->b_changed
8677 ? !curbufIsChanged() : !*(int *)varp
))
8679 else if ((p
->flags
& P_BOOL
) && *(int *)varp
< 0)
8683 MSG_PUTS(p
->fullname
);
8684 if (!(p
->flags
& P_BOOL
))
8687 /* put value string in NameBuff */
8688 option_value2string(p
, opt_flags
);
8689 msg_outtrans(NameBuff
);
8692 silent_mode
= save_silent
;
8693 info_message
= FALSE
;
8697 * Write modified options as ":set" commands to a file.
8699 * There are three values for "opt_flags":
8700 * OPT_GLOBAL: Write global option values and fresh values of
8701 * buffer-local options (used for start of a session
8703 * OPT_GLOBAL + OPT_LOCAL: Idem, add fresh values of window-local options for
8704 * curwin (used for a vimrc file).
8705 * OPT_LOCAL: Write buffer-local option values for curbuf, fresh
8706 * and local values for window-local options of
8707 * curwin. Local values are also written when at the
8708 * default value, because a modeline or autocommand
8709 * may have set them when doing ":edit file" and the
8710 * user has set them back at the default or fresh
8712 * When "local_only" is TRUE, don't write fresh
8713 * values, only local values (for ":mkview").
8714 * (fresh value = value used for a new buffer or window for a local option).
8716 * Return FAIL on error, OK otherwise.
8719 makeset(fd
, opt_flags
, local_only
)
8724 struct vimoption
*p
;
8725 char_u
*varp
; /* currently used value */
8726 char_u
*varp_fresh
; /* local value */
8727 char_u
*varp_local
= NULL
; /* fresh value */
8733 * The options that don't have a default (terminal name, columns, lines)
8734 * are never written. Terminal options are also not written.
8735 * Do the loop over "options[]" twice: once for options with the
8736 * P_PRI_MKRC flag and once without.
8738 for (pri
= 1; pri
>= 0; --pri
)
8740 for (p
= &options
[0]; !istermoption(p
); p
++)
8741 if (!(p
->flags
& P_NO_MKRC
)
8743 && ((pri
== 1) == ((p
->flags
& P_PRI_MKRC
) != 0)))
8745 /* skip global option when only doing locals */
8746 if (p
->indir
== PV_NONE
&& !(opt_flags
& OPT_GLOBAL
))
8749 /* Do not store options like 'bufhidden' and 'syntax' in a vimrc
8750 * file, they are always buffer-specific. */
8751 if ((opt_flags
& OPT_GLOBAL
) && (p
->flags
& P_NOGLOB
))
8754 /* Global values are only written when not at the default value. */
8755 varp
= get_varp_scope(p
, opt_flags
);
8756 if ((opt_flags
& OPT_GLOBAL
) && optval_default(p
, varp
))
8760 if (p
->indir
!= PV_NONE
)
8762 if (p
->var
== VAR_WIN
)
8764 /* skip window-local option when only doing globals */
8765 if (!(opt_flags
& OPT_LOCAL
))
8767 /* When fresh value of window-local option is not at the
8768 * default, need to write it too. */
8769 if (!(opt_flags
& OPT_GLOBAL
) && !local_only
)
8771 varp_fresh
= get_varp_scope(p
, OPT_GLOBAL
);
8772 if (!optval_default(p
, varp_fresh
))
8782 /* Round 1: fresh value for window-local options.
8783 * Round 2: other values */
8784 for ( ; round
<= 2; varp
= varp_local
, ++round
)
8786 if (round
== 1 || (opt_flags
& OPT_GLOBAL
))
8791 if (p
->flags
& P_BOOL
)
8793 if (put_setbool(fd
, cmd
, p
->fullname
, *(int *)varp
) == FAIL
)
8796 else if (p
->flags
& P_NUM
)
8798 if (put_setnum(fd
, cmd
, p
->fullname
, (long *)varp
) == FAIL
)
8803 #if defined(FEAT_SYN_HL) || defined(FEAT_AUTOCMD)
8804 int do_endif
= FALSE
;
8806 /* Don't set 'syntax' and 'filetype' again if the value is
8807 * already right, avoids reloading the syntax file. */
8809 # if defined(FEAT_SYN_HL)
8811 # if defined(FEAT_AUTOCMD)
8815 # if defined(FEAT_AUTOCMD)
8820 if (fprintf(fd
, "if &%s != '%s'", p
->fullname
,
8821 *(char_u
**)(varp
)) < 0
8827 if (put_setstring(fd
, cmd
, p
->fullname
, (char_u
**)varp
,
8828 (p
->flags
& P_EXPAND
) != 0) == FAIL
)
8830 #if defined(FEAT_SYN_HL) || defined(FEAT_AUTOCMD)
8833 if (put_line(fd
, "endif") == FAIL
)
8844 #if defined(FEAT_FOLDING) || defined(PROTO)
8846 * Generate set commands for the local fold options only. Used when
8847 * 'sessionoptions' or 'viewoptions' contains "folds" but not "options".
8853 if (put_setstring(fd
, "setlocal", "fdm", &curwin
->w_p_fdm
, FALSE
) == FAIL
8855 || put_setstring(fd
, "setlocal", "fde", &curwin
->w_p_fde
, FALSE
)
8858 || put_setstring(fd
, "setlocal", "fmr", &curwin
->w_p_fmr
, FALSE
)
8860 || put_setstring(fd
, "setlocal", "fdi", &curwin
->w_p_fdi
, FALSE
)
8862 || put_setnum(fd
, "setlocal", "fdl", &curwin
->w_p_fdl
) == FAIL
8863 || put_setnum(fd
, "setlocal", "fml", &curwin
->w_p_fml
) == FAIL
8864 || put_setnum(fd
, "setlocal", "fdn", &curwin
->w_p_fdn
) == FAIL
8865 || put_setbool(fd
, "setlocal", "fen", curwin
->w_p_fen
) == FAIL
8874 put_setstring(fd
, cmd
, name
, valuep
, expand
)
8882 char_u buf
[MAXPATHL
];
8884 if (fprintf(fd
, "%s %s=", cmd
, name
) < 0)
8886 if (*valuep
!= NULL
)
8888 /* Output 'pastetoggle' as key names. For other
8889 * options some characters have to be escaped with
8890 * CTRL-V or backslash */
8891 if (valuep
== &p_pt
)
8895 if (put_escstr(fd
, str2special(&s
, FALSE
), 2) == FAIL
)
8900 home_replace(NULL
, *valuep
, buf
, MAXPATHL
, FALSE
);
8901 if (put_escstr(fd
, buf
, 2) == FAIL
)
8904 else if (put_escstr(fd
, *valuep
, 2) == FAIL
)
8907 if (put_eol(fd
) < 0)
8913 put_setnum(fd
, cmd
, name
, valuep
)
8921 if (fprintf(fd
, "%s %s=", cmd
, name
) < 0)
8923 if (wc_use_keyname((char_u
*)valuep
, &wc
))
8925 /* print 'wildchar' and 'wildcharm' as a key name */
8926 if (fputs((char *)get_special_key_name((int)wc
, 0), fd
) < 0)
8929 else if (fprintf(fd
, "%ld", *valuep
) < 0)
8931 if (put_eol(fd
) < 0)
8937 put_setbool(fd
, cmd
, name
, value
)
8943 if (value
< 0) /* global/local option using global value */
8945 if (fprintf(fd
, "%s %s%s", cmd
, value
? "" : "no", name
) < 0
8952 * Clear all the terminal options.
8953 * If the option has been allocated, free the memory.
8954 * Terminal options are never hidden or indirect.
8960 * Reset a few things before clearing the old options. This may cause
8961 * outputting a few things that the terminal doesn't understand, but the
8962 * screen will be cleared later, so this is OK.
8964 #ifdef FEAT_MOUSE_TTY
8965 mch_setmouse(FALSE
); /* switch mouse off */
8968 mch_restore_title(3); /* restore window titles */
8970 #if defined(FEAT_XCLIPBOARD) && defined(FEAT_GUI)
8971 /* When starting the GUI close the display opened for the clipboard.
8972 * After restoring the title, because that will need the display. */
8978 * Check if this is allowed now.
8980 if (can_end_termcap_mode(FALSE
) == TRUE
)
8982 stoptermcap(); /* stop termcap mode */
8990 struct vimoption
*p
;
8992 for (p
= &options
[0]; p
->fullname
!= NULL
; p
++)
8993 if (istermoption(p
))
8995 if (p
->flags
& P_ALLOCED
)
8996 free_string_option(*(char_u
**)(p
->var
));
8997 if (p
->flags
& P_DEF_ALLOCED
)
8998 free_string_option(p
->def_val
[VI_DEFAULT
]);
8999 *(char_u
**)(p
->var
) = empty_option
;
9000 p
->def_val
[VI_DEFAULT
] = empty_option
;
9001 p
->flags
&= ~(P_ALLOCED
|P_DEF_ALLOCED
);
9007 * Free the string for one term option, if it was allocated.
9008 * Set the string to empty_option and clear allocated flag.
9009 * "var" points to the option value.
9012 free_one_termoption(var
)
9015 struct vimoption
*p
;
9017 for (p
= &options
[0]; p
->fullname
!= NULL
; p
++)
9020 if (p
->flags
& P_ALLOCED
)
9021 free_string_option(*(char_u
**)(p
->var
));
9022 *(char_u
**)(p
->var
) = empty_option
;
9023 p
->flags
&= ~P_ALLOCED
;
9029 * Set the terminal option defaults to the current value.
9030 * Used after setting the terminal name.
9035 struct vimoption
*p
;
9037 for (p
= &options
[0]; p
->fullname
!= NULL
; p
++)
9039 if (istermoption(p
) && p
->def_val
[VI_DEFAULT
] != *(char_u
**)(p
->var
))
9041 if (p
->flags
& P_DEF_ALLOCED
)
9043 free_string_option(p
->def_val
[VI_DEFAULT
]);
9044 p
->flags
&= ~P_DEF_ALLOCED
;
9046 p
->def_val
[VI_DEFAULT
] = *(char_u
**)(p
->var
);
9047 if (p
->flags
& P_ALLOCED
)
9049 p
->flags
|= P_DEF_ALLOCED
;
9050 p
->flags
&= ~P_ALLOCED
; /* don't free the value now */
9057 * return TRUE if 'p' starts with 't_'
9061 struct vimoption
*p
;
9063 return (p
->fullname
[0] == 't' && p
->fullname
[1] == '_');
9067 * Compute columns for ruler and shown command. 'sc_col' is also used to
9068 * decide what the maximum length of a message on the status line can be.
9069 * If there is a status line for the last window, 'sc_col' is independent
9073 #define COL_RULER 17 /* columns needed by standard ruler */
9078 #if defined(FEAT_CMDL_INFO) && defined(FEAT_WINDOWS)
9079 int last_has_status
= (p_ls
== 2 || (p_ls
== 1 && firstwin
!= lastwin
));
9086 ru_col
= (ru_wid
? ru_wid
: COL_RULER
) + 1;
9088 ru_col
= COL_RULER
+ 1;
9090 /* no last status line, adjust sc_col */
9091 if (!last_has_status
)
9096 sc_col
+= SHOWCMD_COLS
;
9097 if (!p_ru
|| last_has_status
) /* no need for separating space */
9100 sc_col
= Columns
- sc_col
;
9101 ru_col
= Columns
- ru_col
;
9102 if (sc_col
<= 0) /* screen too narrow, will become a mess */
9113 * Get pointer to option variable, depending on local or global scope.
9116 get_varp_scope(p
, opt_flags
)
9117 struct vimoption
*p
;
9120 if ((opt_flags
& OPT_GLOBAL
) && p
->indir
!= PV_NONE
)
9122 if (p
->var
== VAR_WIN
)
9123 return (char_u
*)GLOBAL_WO(get_varp(p
));
9126 if ((opt_flags
& OPT_LOCAL
) && ((int)p
->indir
& PV_BOTH
))
9128 switch ((int)p
->indir
)
9130 #ifdef FEAT_QUICKFIX
9131 case PV_EFM
: return (char_u
*)&(curbuf
->b_p_efm
);
9132 case PV_GP
: return (char_u
*)&(curbuf
->b_p_gp
);
9133 case PV_MP
: return (char_u
*)&(curbuf
->b_p_mp
);
9135 case PV_EP
: return (char_u
*)&(curbuf
->b_p_ep
);
9136 case PV_KP
: return (char_u
*)&(curbuf
->b_p_kp
);
9137 case PV_PATH
: return (char_u
*)&(curbuf
->b_p_path
);
9138 case PV_AR
: return (char_u
*)&(curbuf
->b_p_ar
);
9139 case PV_TAGS
: return (char_u
*)&(curbuf
->b_p_tags
);
9141 case PV_DEF
: return (char_u
*)&(curbuf
->b_p_def
);
9142 case PV_INC
: return (char_u
*)&(curbuf
->b_p_inc
);
9144 #ifdef FEAT_INS_EXPAND
9145 case PV_DICT
: return (char_u
*)&(curbuf
->b_p_dict
);
9146 case PV_TSR
: return (char_u
*)&(curbuf
->b_p_tsr
);
9148 #if defined(FEAT_BEVAL) && defined(FEAT_EVAL)
9149 case PV_BEXPR
: return (char_u
*)&(curbuf
->b_p_bexpr
);
9152 case PV_STL
: return (char_u
*)&(curwin
->w_p_stl
);
9155 return NULL
; /* "cannot happen" */
9161 * Get pointer to option variable.
9165 struct vimoption
*p
;
9167 /* hidden option, always return NULL */
9171 switch ((int)p
->indir
)
9173 case PV_NONE
: return p
->var
;
9175 /* global option with local value: use local value if it's been set */
9176 case PV_EP
: return *curbuf
->b_p_ep
!= NUL
9177 ? (char_u
*)&curbuf
->b_p_ep
: p
->var
;
9178 case PV_KP
: return *curbuf
->b_p_kp
!= NUL
9179 ? (char_u
*)&curbuf
->b_p_kp
: p
->var
;
9180 case PV_PATH
: return *curbuf
->b_p_path
!= NUL
9181 ? (char_u
*)&(curbuf
->b_p_path
) : p
->var
;
9182 case PV_AR
: return curbuf
->b_p_ar
>= 0
9183 ? (char_u
*)&(curbuf
->b_p_ar
) : p
->var
;
9184 case PV_TAGS
: return *curbuf
->b_p_tags
!= NUL
9185 ? (char_u
*)&(curbuf
->b_p_tags
) : p
->var
;
9187 case PV_DEF
: return *curbuf
->b_p_def
!= NUL
9188 ? (char_u
*)&(curbuf
->b_p_def
) : p
->var
;
9189 case PV_INC
: return *curbuf
->b_p_inc
!= NUL
9190 ? (char_u
*)&(curbuf
->b_p_inc
) : p
->var
;
9192 #ifdef FEAT_INS_EXPAND
9193 case PV_DICT
: return *curbuf
->b_p_dict
!= NUL
9194 ? (char_u
*)&(curbuf
->b_p_dict
) : p
->var
;
9195 case PV_TSR
: return *curbuf
->b_p_tsr
!= NUL
9196 ? (char_u
*)&(curbuf
->b_p_tsr
) : p
->var
;
9198 #ifdef FEAT_QUICKFIX
9199 case PV_EFM
: return *curbuf
->b_p_efm
!= NUL
9200 ? (char_u
*)&(curbuf
->b_p_efm
) : p
->var
;
9201 case PV_GP
: return *curbuf
->b_p_gp
!= NUL
9202 ? (char_u
*)&(curbuf
->b_p_gp
) : p
->var
;
9203 case PV_MP
: return *curbuf
->b_p_mp
!= NUL
9204 ? (char_u
*)&(curbuf
->b_p_mp
) : p
->var
;
9206 #if defined(FEAT_BEVAL) && defined(FEAT_EVAL)
9207 case PV_BEXPR
: return *curbuf
->b_p_bexpr
!= NUL
9208 ? (char_u
*)&(curbuf
->b_p_bexpr
) : p
->var
;
9211 case PV_STL
: return *curwin
->w_p_stl
!= NUL
9212 ? (char_u
*)&(curwin
->w_p_stl
) : p
->var
;
9216 case PV_ARAB
: return (char_u
*)&(curwin
->w_p_arab
);
9218 case PV_LIST
: return (char_u
*)&(curwin
->w_p_list
);
9220 case PV_SPELL
: return (char_u
*)&(curwin
->w_p_spell
);
9223 case PV_CUC
: return (char_u
*)&(curwin
->w_p_cuc
);
9224 case PV_CUL
: return (char_u
*)&(curwin
->w_p_cul
);
9227 case PV_DIFF
: return (char_u
*)&(curwin
->w_p_diff
);
9230 case PV_FDC
: return (char_u
*)&(curwin
->w_p_fdc
);
9231 case PV_FEN
: return (char_u
*)&(curwin
->w_p_fen
);
9232 case PV_FDI
: return (char_u
*)&(curwin
->w_p_fdi
);
9233 case PV_FDL
: return (char_u
*)&(curwin
->w_p_fdl
);
9234 case PV_FDM
: return (char_u
*)&(curwin
->w_p_fdm
);
9235 case PV_FML
: return (char_u
*)&(curwin
->w_p_fml
);
9236 case PV_FDN
: return (char_u
*)&(curwin
->w_p_fdn
);
9238 case PV_FDE
: return (char_u
*)&(curwin
->w_p_fde
);
9239 case PV_FDT
: return (char_u
*)&(curwin
->w_p_fdt
);
9241 case PV_FMR
: return (char_u
*)&(curwin
->w_p_fmr
);
9243 case PV_NU
: return (char_u
*)&(curwin
->w_p_nu
);
9244 #ifdef FEAT_LINEBREAK
9245 case PV_NUW
: return (char_u
*)&(curwin
->w_p_nuw
);
9248 case PV_WFH
: return (char_u
*)&(curwin
->w_p_wfh
);
9250 #ifdef FEAT_VERTSPLIT
9251 case PV_WFW
: return (char_u
*)&(curwin
->w_p_wfw
);
9253 #if defined(FEAT_WINDOWS) && defined(FEAT_QUICKFIX)
9254 case PV_PVW
: return (char_u
*)&(curwin
->w_p_pvw
);
9256 #ifdef FEAT_RIGHTLEFT
9257 case PV_RL
: return (char_u
*)&(curwin
->w_p_rl
);
9258 case PV_RLC
: return (char_u
*)&(curwin
->w_p_rlc
);
9260 case PV_SCROLL
: return (char_u
*)&(curwin
->w_p_scr
);
9261 case PV_WRAP
: return (char_u
*)&(curwin
->w_p_wrap
);
9262 #ifdef FEAT_LINEBREAK
9263 case PV_LBR
: return (char_u
*)&(curwin
->w_p_lbr
);
9264 case PV_BRI
: return (char_u
*)&(curwin
->w_p_bri
);
9265 case PV_BRIMIN
: return (char_u
*)&(curwin
->w_p_brimin
);
9266 case PV_BRISHIFT
: return (char_u
*)&(curwin
->w_p_brishift
);
9268 #ifdef FEAT_SCROLLBIND
9269 case PV_SCBIND
: return (char_u
*)&(curwin
->w_p_scb
);
9272 case PV_AI
: return (char_u
*)&(curbuf
->b_p_ai
);
9273 case PV_BIN
: return (char_u
*)&(curbuf
->b_p_bin
);
9275 case PV_BOMB
: return (char_u
*)&(curbuf
->b_p_bomb
);
9277 #if defined(FEAT_QUICKFIX)
9278 case PV_BH
: return (char_u
*)&(curbuf
->b_p_bh
);
9279 case PV_BT
: return (char_u
*)&(curbuf
->b_p_bt
);
9281 case PV_BL
: return (char_u
*)&(curbuf
->b_p_bl
);
9282 case PV_CI
: return (char_u
*)&(curbuf
->b_p_ci
);
9284 case PV_CIN
: return (char_u
*)&(curbuf
->b_p_cin
);
9285 case PV_CINK
: return (char_u
*)&(curbuf
->b_p_cink
);
9286 case PV_CINO
: return (char_u
*)&(curbuf
->b_p_cino
);
9288 #if defined(FEAT_SMARTINDENT) || defined(FEAT_CINDENT)
9289 case PV_CINW
: return (char_u
*)&(curbuf
->b_p_cinw
);
9291 #ifdef FEAT_COMMENTS
9292 case PV_COM
: return (char_u
*)&(curbuf
->b_p_com
);
9295 case PV_CMS
: return (char_u
*)&(curbuf
->b_p_cms
);
9297 #ifdef FEAT_INS_EXPAND
9298 case PV_CPT
: return (char_u
*)&(curbuf
->b_p_cpt
);
9300 #ifdef FEAT_COMPL_FUNC
9301 case PV_CFU
: return (char_u
*)&(curbuf
->b_p_cfu
);
9302 case PV_OFU
: return (char_u
*)&(curbuf
->b_p_ofu
);
9304 case PV_EOL
: return (char_u
*)&(curbuf
->b_p_eol
);
9305 case PV_ET
: return (char_u
*)&(curbuf
->b_p_et
);
9307 case PV_FENC
: return (char_u
*)&(curbuf
->b_p_fenc
);
9309 case PV_FF
: return (char_u
*)&(curbuf
->b_p_ff
);
9311 case PV_FT
: return (char_u
*)&(curbuf
->b_p_ft
);
9313 case PV_FO
: return (char_u
*)&(curbuf
->b_p_fo
);
9314 case PV_FLP
: return (char_u
*)&(curbuf
->b_p_flp
);
9315 case PV_IMI
: return (char_u
*)&(curbuf
->b_p_iminsert
);
9316 case PV_IMS
: return (char_u
*)&(curbuf
->b_p_imsearch
);
9317 case PV_INF
: return (char_u
*)&(curbuf
->b_p_inf
);
9318 case PV_ISK
: return (char_u
*)&(curbuf
->b_p_isk
);
9321 case PV_INEX
: return (char_u
*)&(curbuf
->b_p_inex
);
9324 #if defined(FEAT_CINDENT) && defined(FEAT_EVAL)
9325 case PV_INDE
: return (char_u
*)&(curbuf
->b_p_inde
);
9326 case PV_INDK
: return (char_u
*)&(curbuf
->b_p_indk
);
9329 case PV_FEX
: return (char_u
*)&(curbuf
->b_p_fex
);
9332 case PV_KEY
: return (char_u
*)&(curbuf
->b_p_key
);
9335 case PV_LISP
: return (char_u
*)&(curbuf
->b_p_lisp
);
9337 case PV_ML
: return (char_u
*)&(curbuf
->b_p_ml
);
9338 case PV_MPS
: return (char_u
*)&(curbuf
->b_p_mps
);
9339 case PV_MA
: return (char_u
*)&(curbuf
->b_p_ma
);
9340 case PV_MOD
: return (char_u
*)&(curbuf
->b_changed
);
9341 case PV_NF
: return (char_u
*)&(curbuf
->b_p_nf
);
9342 #ifdef FEAT_OSFILETYPE
9343 case PV_OFT
: return (char_u
*)&(curbuf
->b_p_oft
);
9345 case PV_PI
: return (char_u
*)&(curbuf
->b_p_pi
);
9347 case PV_QE
: return (char_u
*)&(curbuf
->b_p_qe
);
9349 case PV_RO
: return (char_u
*)&(curbuf
->b_p_ro
);
9350 #ifdef FEAT_SMARTINDENT
9351 case PV_SI
: return (char_u
*)&(curbuf
->b_p_si
);
9354 case PV_SN
: return (char_u
*)&(curbuf
->b_p_sn
);
9356 case PV_STS
: return (char_u
*)&(curbuf
->b_p_sts
);
9357 #ifdef FEAT_SEARCHPATH
9358 case PV_SUA
: return (char_u
*)&(curbuf
->b_p_sua
);
9360 case PV_SWF
: return (char_u
*)&(curbuf
->b_p_swf
);
9362 case PV_SMC
: return (char_u
*)&(curbuf
->b_p_smc
);
9363 case PV_SYN
: return (char_u
*)&(curbuf
->b_p_syn
);
9366 case PV_SPC
: return (char_u
*)&(curbuf
->b_p_spc
);
9367 case PV_SPF
: return (char_u
*)&(curbuf
->b_p_spf
);
9368 case PV_SPL
: return (char_u
*)&(curbuf
->b_p_spl
);
9370 case PV_SW
: return (char_u
*)&(curbuf
->b_p_sw
);
9371 case PV_TS
: return (char_u
*)&(curbuf
->b_p_ts
);
9372 case PV_TW
: return (char_u
*)&(curbuf
->b_p_tw
);
9373 case PV_TX
: return (char_u
*)&(curbuf
->b_p_tx
);
9374 case PV_WM
: return (char_u
*)&(curbuf
->b_p_wm
);
9376 case PV_KMAP
: return (char_u
*)&(curbuf
->b_p_keymap
);
9378 default: EMSG(_("E356: get_varp ERROR"));
9380 /* always return a valid pointer to avoid a crash! */
9381 return (char_u
*)&(curbuf
->b_p_wm
);
9385 * Get the value of 'equalprg', either the buffer-local one or the global one.
9390 if (*curbuf
->b_p_ep
== NUL
)
9392 return curbuf
->b_p_ep
;
9395 #if defined(FEAT_WINDOWS) || defined(PROTO)
9397 * Copy options from one window to another.
9398 * Used when splitting a window.
9401 win_copy_options(wp_from
, wp_to
)
9405 copy_winopt(&wp_from
->w_onebuf_opt
, &wp_to
->w_onebuf_opt
);
9406 copy_winopt(&wp_from
->w_allbuf_opt
, &wp_to
->w_allbuf_opt
);
9407 # ifdef FEAT_RIGHTLEFT
9409 /* Is this right? */
9410 wp_to
->w_farsi
= wp_from
->w_farsi
;
9417 * Copy the options from one winopt_T to another.
9418 * Doesn't free the old option values in "to", use clear_winopt() for that.
9419 * The 'scroll' option is not copied, because it depends on the window height.
9420 * The 'previewwindow' option is reset, there can be only one preview window.
9423 copy_winopt(from
, to
)
9428 to
->wo_arab
= from
->wo_arab
;
9430 to
->wo_list
= from
->wo_list
;
9431 to
->wo_nu
= from
->wo_nu
;
9432 #ifdef FEAT_LINEBREAK
9433 to
->wo_nuw
= from
->wo_nuw
;
9435 #ifdef FEAT_RIGHTLEFT
9436 to
->wo_rl
= from
->wo_rl
;
9437 to
->wo_rlc
= vim_strsave(from
->wo_rlc
);
9440 to
->wo_stl
= vim_strsave(from
->wo_stl
);
9442 to
->wo_wrap
= from
->wo_wrap
;
9443 #ifdef FEAT_LINEBREAK
9444 to
->wo_lbr
= from
->wo_lbr
;
9445 to
->wo_bri
= from
->wo_bri
;
9446 to
->wo_brimin
= from
->wo_brimin
;
9448 #ifdef FEAT_SCROLLBIND
9449 to
->wo_scb
= from
->wo_scb
;
9452 to
->wo_spell
= from
->wo_spell
;
9455 to
->wo_cuc
= from
->wo_cuc
;
9456 to
->wo_cul
= from
->wo_cul
;
9459 to
->wo_diff
= from
->wo_diff
;
9462 to
->wo_fdc
= from
->wo_fdc
;
9463 to
->wo_fen
= from
->wo_fen
;
9464 to
->wo_fdi
= vim_strsave(from
->wo_fdi
);
9465 to
->wo_fml
= from
->wo_fml
;
9466 to
->wo_fdl
= from
->wo_fdl
;
9467 to
->wo_fdm
= vim_strsave(from
->wo_fdm
);
9468 to
->wo_fdn
= from
->wo_fdn
;
9470 to
->wo_fde
= vim_strsave(from
->wo_fde
);
9471 to
->wo_fdt
= vim_strsave(from
->wo_fdt
);
9473 to
->wo_fmr
= vim_strsave(from
->wo_fmr
);
9475 check_winopt(to
); /* don't want NULL pointers */
9479 * Check string options in a window for a NULL value.
9482 check_win_options(win
)
9485 check_winopt(&win
->w_onebuf_opt
);
9486 check_winopt(&win
->w_allbuf_opt
);
9490 * Check for NULL pointers in a winopt_T and replace them with empty_option.
9494 winopt_T
*wop UNUSED
;
9497 check_string_option(&wop
->wo_fdi
);
9498 check_string_option(&wop
->wo_fdm
);
9500 check_string_option(&wop
->wo_fde
);
9501 check_string_option(&wop
->wo_fdt
);
9503 check_string_option(&wop
->wo_fmr
);
9505 #ifdef FEAT_RIGHTLEFT
9506 check_string_option(&wop
->wo_rlc
);
9509 check_string_option(&wop
->wo_stl
);
9514 * Free the allocated memory inside a winopt_T.
9518 winopt_T
*wop UNUSED
;
9521 clear_string_option(&wop
->wo_fdi
);
9522 clear_string_option(&wop
->wo_fdm
);
9524 clear_string_option(&wop
->wo_fde
);
9525 clear_string_option(&wop
->wo_fdt
);
9527 clear_string_option(&wop
->wo_fmr
);
9529 #ifdef FEAT_RIGHTLEFT
9530 clear_string_option(&wop
->wo_rlc
);
9533 clear_string_option(&wop
->wo_stl
);
9538 * Copy global option values to local options for one buffer.
9539 * Used when creating a new buffer and sometimes when entering a buffer.
9541 * BCO_ENTER We will enter the buf buffer.
9542 * BCO_ALWAYS Always copy the options, but only set b_p_initialized when
9544 * BCO_NOHELP Don't copy the values to a help buffer.
9547 buf_copy_options(buf
, flags
)
9551 int should_copy
= TRUE
;
9552 char_u
*save_p_isk
= NULL
; /* init for GCC */
9554 int did_isk
= FALSE
;
9557 * Don't do anything of the buffer is invalid.
9559 if (buf
== NULL
|| !buf_valid(buf
))
9563 * Skip this when the option defaults have not been set yet. Happens when
9564 * main() allocates the first buffer.
9569 * Always copy when entering and 'cpo' contains 'S'.
9570 * Don't copy when already initialized.
9571 * Don't copy when 'cpo' contains 's' and not entering.
9572 * 'S' BCO_ENTER initialized 's' should_copy
9574 * yes no yes X FALSE
9580 if ((vim_strchr(p_cpo
, CPO_BUFOPTGLOB
) == NULL
|| !(flags
& BCO_ENTER
))
9581 && (buf
->b_p_initialized
9582 || (!(flags
& BCO_ENTER
)
9583 && vim_strchr(p_cpo
, CPO_BUFOPT
) != NULL
)))
9584 should_copy
= FALSE
;
9586 if (should_copy
|| (flags
& BCO_ALWAYS
))
9588 /* Don't copy the options specific to a help buffer when
9589 * BCO_NOHELP is given or the options were initialized already
9590 * (jumping back to a help file with CTRL-T or CTRL-O) */
9591 dont_do_help
= ((flags
& BCO_NOHELP
) && buf
->b_help
)
9592 || buf
->b_p_initialized
;
9593 if (dont_do_help
) /* don't free b_p_isk */
9595 save_p_isk
= buf
->b_p_isk
;
9596 buf
->b_p_isk
= NULL
;
9599 * Always free the allocated strings.
9600 * If not already initialized, set 'readonly' and copy 'fileformat'.
9602 if (!buf
->b_p_initialized
)
9604 free_buf_options(buf
, TRUE
);
9605 buf
->b_p_ro
= FALSE
; /* don't copy readonly */
9608 buf
->b_p_fenc
= vim_strsave(p_fenc
);
9610 buf
->b_p_ff
= vim_strsave(p_ff
);
9611 #if defined(FEAT_QUICKFIX)
9612 buf
->b_p_bh
= empty_option
;
9613 buf
->b_p_bt
= empty_option
;
9617 free_buf_options(buf
, FALSE
);
9620 buf
->b_p_ai_nopaste
= p_ai_nopaste
;
9623 buf
->b_p_tw_nopaste
= p_tw_nopaste
;
9624 buf
->b_p_tw_nobin
= p_tw_nobin
;
9626 buf
->b_p_wm_nopaste
= p_wm_nopaste
;
9627 buf
->b_p_wm_nobin
= p_wm_nobin
;
9628 buf
->b_p_bin
= p_bin
;
9630 buf
->b_p_bomb
= p_bomb
;
9633 buf
->b_p_et_nobin
= p_et_nobin
;
9635 buf
->b_p_ml_nobin
= p_ml_nobin
;
9636 buf
->b_p_inf
= p_inf
;
9637 buf
->b_p_swf
= p_swf
;
9638 #ifdef FEAT_INS_EXPAND
9639 buf
->b_p_cpt
= vim_strsave(p_cpt
);
9641 #ifdef FEAT_COMPL_FUNC
9642 buf
->b_p_cfu
= vim_strsave(p_cfu
);
9643 buf
->b_p_ofu
= vim_strsave(p_ofu
);
9645 buf
->b_p_sts
= p_sts
;
9646 buf
->b_p_sts_nopaste
= p_sts_nopaste
;
9650 #ifdef FEAT_COMMENTS
9651 buf
->b_p_com
= vim_strsave(p_com
);
9654 buf
->b_p_cms
= vim_strsave(p_cms
);
9656 buf
->b_p_fo
= vim_strsave(p_fo
);
9657 buf
->b_p_flp
= vim_strsave(p_flp
);
9658 buf
->b_p_nf
= vim_strsave(p_nf
);
9659 buf
->b_p_mps
= vim_strsave(p_mps
);
9660 #ifdef FEAT_SMARTINDENT
9665 buf
->b_p_cin
= p_cin
;
9666 buf
->b_p_cink
= vim_strsave(p_cink
);
9667 buf
->b_p_cino
= vim_strsave(p_cino
);
9670 /* Don't copy 'filetype', it must be detected */
9671 buf
->b_p_ft
= empty_option
;
9673 #ifdef FEAT_OSFILETYPE
9674 buf
->b_p_oft
= vim_strsave(p_oft
);
9677 #if defined(FEAT_SMARTINDENT) || defined(FEAT_CINDENT)
9678 buf
->b_p_cinw
= vim_strsave(p_cinw
);
9681 buf
->b_p_lisp
= p_lisp
;
9684 /* Don't copy 'syntax', it must be set */
9685 buf
->b_p_syn
= empty_option
;
9686 buf
->b_p_smc
= p_smc
;
9689 buf
->b_p_spc
= vim_strsave(p_spc
);
9690 (void)compile_cap_prog(buf
);
9691 buf
->b_p_spf
= vim_strsave(p_spf
);
9692 buf
->b_p_spl
= vim_strsave(p_spl
);
9694 #if defined(FEAT_CINDENT) && defined(FEAT_EVAL)
9695 buf
->b_p_inde
= vim_strsave(p_inde
);
9696 buf
->b_p_indk
= vim_strsave(p_indk
);
9698 #if defined(FEAT_EVAL)
9699 buf
->b_p_fex
= vim_strsave(p_fex
);
9702 buf
->b_p_key
= vim_strsave(p_key
);
9704 #ifdef FEAT_SEARCHPATH
9705 buf
->b_p_sua
= vim_strsave(p_sua
);
9708 buf
->b_p_keymap
= vim_strsave(p_keymap
);
9709 buf
->b_kmap_state
|= KEYMAP_INIT
;
9711 /* This isn't really an option, but copying the langmap and IME
9712 * state from the current buffer is better than resetting it. */
9713 buf
->b_p_iminsert
= p_iminsert
;
9714 buf
->b_p_imsearch
= p_imsearch
;
9716 /* options that are normally global but also have a local value
9717 * are not copied, start using the global value */
9719 #ifdef FEAT_QUICKFIX
9720 buf
->b_p_gp
= empty_option
;
9721 buf
->b_p_mp
= empty_option
;
9722 buf
->b_p_efm
= empty_option
;
9724 buf
->b_p_ep
= empty_option
;
9725 buf
->b_p_kp
= empty_option
;
9726 buf
->b_p_path
= empty_option
;
9727 buf
->b_p_tags
= empty_option
;
9729 buf
->b_p_def
= empty_option
;
9730 buf
->b_p_inc
= empty_option
;
9732 buf
->b_p_inex
= vim_strsave(p_inex
);
9735 #ifdef FEAT_INS_EXPAND
9736 buf
->b_p_dict
= empty_option
;
9737 buf
->b_p_tsr
= empty_option
;
9740 buf
->b_p_qe
= vim_strsave(p_qe
);
9742 #if defined(FEAT_BEVAL) && defined(FEAT_EVAL)
9743 buf
->b_p_bexpr
= empty_option
;
9747 * Don't copy the options set by ex_help(), use the saved values,
9748 * when going from a help buffer to a non-help buffer.
9749 * Don't touch these at all when BCO_NOHELP is used and going from
9750 * or to a help buffer.
9753 buf
->b_p_isk
= save_p_isk
;
9756 buf
->b_p_isk
= vim_strsave(p_isk
);
9759 buf
->b_help
= FALSE
;
9760 #ifdef FEAT_QUICKFIX
9761 if (buf
->b_p_bt
[0] == 'h')
9762 clear_string_option(&buf
->b_p_bt
);
9769 * When the options should be copied (ignoring BCO_ALWAYS), set the
9770 * flag that indicates that the options have been initialized.
9773 buf
->b_p_initialized
= TRUE
;
9776 check_buf_options(buf
); /* make sure we don't have NULLs */
9778 (void)buf_init_chartab(buf
, FALSE
);
9782 * Reset the 'modifiable' option and its default value.
9789 curbuf
->b_p_ma
= FALSE
;
9791 opt_idx
= findoption((char_u
*)"ma");
9793 options
[opt_idx
].def_val
[VI_DEFAULT
] = FALSE
;
9797 * Set the global value for 'iminsert' to the local value.
9800 set_iminsert_global()
9802 p_iminsert
= curbuf
->b_p_iminsert
;
9806 * Set the global value for 'imsearch' to the local value.
9809 set_imsearch_global()
9811 p_imsearch
= curbuf
->b_p_imsearch
;
9814 #if defined(FEAT_CMDL_COMPL) || defined(PROTO)
9815 static int expand_option_idx
= -1;
9816 static char_u expand_option_name
[5] = {'t', '_', NUL
, NUL
, NUL
};
9817 static int expand_option_flags
= 0;
9820 set_context_in_set_cmd(xp
, arg
, opt_flags
)
9823 int opt_flags
; /* OPT_GLOBAL and/or OPT_LOCAL */
9826 long_u flags
= 0; /* init for GCC */
9827 int opt_idx
= 0; /* init for GCC */
9830 int is_term_option
= FALSE
;
9833 expand_option_flags
= opt_flags
;
9835 xp
->xp_context
= EXPAND_SETTINGS
;
9838 xp
->xp_pattern
= arg
;
9841 p
= arg
+ STRLEN(arg
) - 1;
9842 if (*p
== ' ' && *(p
- 1) != '\\')
9844 xp
->xp_pattern
= p
+ 1;
9850 /* count number of backslashes before ' ' or ',' */
9851 if (*p
== ' ' || *p
== ',')
9853 while (s
> arg
&& *(s
- 1) == '\\')
9856 /* break at a space with an even number of backslashes */
9857 if (*p
== ' ' && ((p
- s
) & 1) == 0)
9864 if (STRNCMP(p
, "no", 2) == 0 && STRNCMP(p
, "novice", 6) != 0)
9866 xp
->xp_context
= EXPAND_BOOL_SETTINGS
;
9869 if (STRNCMP(p
, "inv", 3) == 0)
9871 xp
->xp_context
= EXPAND_BOOL_SETTINGS
;
9874 xp
->xp_pattern
= arg
= p
;
9878 if (*p
++ == NUL
) /* expand terminal option name */
9880 key
= get_special_key_code(arg
+ 1);
9881 if (key
== 0) /* unknown name */
9883 xp
->xp_context
= EXPAND_NOTHING
;
9887 is_term_option
= TRUE
;
9888 expand_option_name
[2] = KEY2TERMCAP0(key
);
9889 expand_option_name
[3] = KEY2TERMCAP1(key
);
9893 if (p
[0] == 't' && p
[1] == '_')
9899 return; /* expand option name */
9901 is_term_option
= TRUE
;
9902 expand_option_name
[2] = p
[-2];
9903 expand_option_name
[3] = p
[-1];
9907 /* Allow * wildcard */
9908 while (ASCII_ISALNUM(*p
) || *p
== '_' || *p
== '*')
9914 opt_idx
= findoption(arg
);
9916 if (opt_idx
== -1 || options
[opt_idx
].var
== NULL
)
9918 xp
->xp_context
= EXPAND_NOTHING
;
9921 flags
= options
[opt_idx
].flags
;
9924 xp
->xp_context
= EXPAND_NOTHING
;
9929 /* handle "-=" and "+=" */
9930 if ((nextchar
== '-' || nextchar
== '+' || nextchar
== '^') && p
[1] == '=')
9935 if ((nextchar
!= '=' && nextchar
!= ':')
9936 || xp
->xp_context
== EXPAND_BOOL_SETTINGS
)
9938 xp
->xp_context
= EXPAND_UNSUCCESSFUL
;
9941 if (xp
->xp_context
!= EXPAND_BOOL_SETTINGS
&& p
[1] == NUL
)
9943 xp
->xp_context
= EXPAND_OLD_SETTING
;
9945 expand_option_idx
= -1;
9947 expand_option_idx
= opt_idx
;
9948 xp
->xp_pattern
= p
+ 1;
9951 xp
->xp_context
= EXPAND_NOTHING
;
9952 if (is_term_option
|| (flags
& P_NUM
))
9955 xp
->xp_pattern
= p
+ 1;
9957 if (flags
& P_EXPAND
)
9959 p
= options
[opt_idx
].var
;
9960 if (p
== (char_u
*)&p_bdir
9961 || p
== (char_u
*)&p_dir
9962 || p
== (char_u
*)&p_path
9963 || p
== (char_u
*)&p_rtp
9964 #ifdef FEAT_SEARCHPATH
9965 || p
== (char_u
*)&p_cdpath
9968 || p
== (char_u
*)&p_vdir
9972 xp
->xp_context
= EXPAND_DIRECTORIES
;
9973 if (p
== (char_u
*)&p_path
9974 #ifdef FEAT_SEARCHPATH
9975 || p
== (char_u
*)&p_cdpath
9978 xp
->xp_backslash
= XP_BS_THREE
;
9980 xp
->xp_backslash
= XP_BS_ONE
;
9984 xp
->xp_context
= EXPAND_FILES
;
9985 /* for 'tags' need three backslashes for a space */
9986 if (p
== (char_u
*)&p_tags
)
9987 xp
->xp_backslash
= XP_BS_THREE
;
9989 xp
->xp_backslash
= XP_BS_ONE
;
9993 /* For an option that is a list of file names, find the start of the
9994 * last file name. */
9995 for (p
= arg
+ STRLEN(arg
) - 1; p
> xp
->xp_pattern
; --p
)
9997 /* count number of backslashes before ' ' or ',' */
9998 if (*p
== ' ' || *p
== ',')
10001 while (s
> xp
->xp_pattern
&& *(s
- 1) == '\\')
10003 if ((*p
== ' ' && (xp
->xp_backslash
== XP_BS_THREE
&& (p
- s
) < 3))
10004 || (*p
== ',' && (flags
& P_COMMA
) && ((p
- s
) & 1) == 0))
10006 xp
->xp_pattern
= p
+ 1;
10012 /* for 'spellsuggest' start at "file:" */
10013 if (options
[opt_idx
].var
== (char_u
*)&p_sps
10014 && STRNCMP(p
, "file:", 5) == 0)
10016 xp
->xp_pattern
= p
+ 5;
10026 ExpandSettings(xp
, regmatch
, num_file
, file
)
10028 regmatch_T
*regmatch
;
10032 int num_normal
= 0; /* Nr of matching non-term-code settings */
10033 int num_term
= 0; /* Nr of matching terminal code settings */
10040 char_u name_buf
[MAX_KEY_NAME_LEN
];
10041 static char *(names
[]) = {"all", "termcap"};
10042 int ic
= regmatch
->rm_ic
; /* remember the ignore-case flag */
10044 /* do this loop twice:
10045 * loop == 0: count the number of matching options
10046 * loop == 1: copy the matching options into allocated memory
10048 for (loop
= 0; loop
<= 1; ++loop
)
10050 regmatch
->rm_ic
= ic
;
10051 if (xp
->xp_context
!= EXPAND_BOOL_SETTINGS
)
10053 for (match
= 0; match
< (int)(sizeof(names
) / sizeof(char *));
10055 if (vim_regexec(regmatch
, (char_u
*)names
[match
], (colnr_T
)0))
10060 (*file
)[count
++] = vim_strsave((char_u
*)names
[match
]);
10063 for (opt_idx
= 0; (str
= (char_u
*)options
[opt_idx
].fullname
) != NULL
;
10066 if (options
[opt_idx
].var
== NULL
)
10068 if (xp
->xp_context
== EXPAND_BOOL_SETTINGS
10069 && !(options
[opt_idx
].flags
& P_BOOL
))
10071 is_term_opt
= istermoption(&options
[opt_idx
]);
10072 if (is_term_opt
&& num_normal
> 0)
10075 if (vim_regexec(regmatch
, str
, (colnr_T
)0)
10076 || (options
[opt_idx
].shortname
!= NULL
10077 && vim_regexec(regmatch
,
10078 (char_u
*)options
[opt_idx
].shortname
, (colnr_T
)0)))
10080 else if (is_term_opt
)
10085 name_buf
[3] = str
[2];
10086 name_buf
[4] = str
[3];
10089 if (vim_regexec(regmatch
, name_buf
, (colnr_T
)0))
10105 (*file
)[count
++] = vim_strsave(str
);
10109 * Check terminal key codes, these are not in the option table
10111 if (xp
->xp_context
!= EXPAND_BOOL_SETTINGS
&& num_normal
== 0)
10113 for (opt_idx
= 0; (str
= get_termcode(opt_idx
)) != NULL
; opt_idx
++)
10115 if (!isprint(str
[0]) || !isprint(str
[1]))
10120 name_buf
[2] = str
[0];
10121 name_buf
[3] = str
[1];
10125 if (vim_regexec(regmatch
, name_buf
, (colnr_T
)0))
10132 name_buf
[3] = str
[0];
10133 name_buf
[4] = str
[1];
10137 if (vim_regexec(regmatch
, name_buf
, (colnr_T
)0))
10145 (*file
)[count
++] = vim_strsave(name_buf
);
10150 * Check special key names.
10152 regmatch
->rm_ic
= TRUE
; /* ignore case here */
10153 for (opt_idx
= 0; (str
= get_key_name(opt_idx
)) != NULL
; opt_idx
++)
10156 STRCPY(name_buf
+ 1, str
);
10157 STRCAT(name_buf
, ">");
10159 if (vim_regexec(regmatch
, name_buf
, (colnr_T
)0))
10164 (*file
)[count
++] = vim_strsave(name_buf
);
10170 if (num_normal
> 0)
10171 *num_file
= num_normal
;
10172 else if (num_term
> 0)
10173 *num_file
= num_term
;
10176 *file
= (char_u
**)alloc((unsigned)(*num_file
* sizeof(char_u
*)));
10179 *file
= (char_u
**)"";
10188 ExpandOldSetting(num_file
, file
)
10192 char_u
*var
= NULL
; /* init for GCC */
10196 *file
= (char_u
**)alloc((unsigned)sizeof(char_u
*));
10201 * For a terminal key code expand_option_idx is < 0.
10203 if (expand_option_idx
< 0)
10205 var
= find_termcode(expand_option_name
+ 2);
10207 expand_option_idx
= findoption(expand_option_name
);
10210 if (expand_option_idx
>= 0)
10212 /* put string of option value in NameBuff */
10213 option_value2string(&options
[expand_option_idx
], expand_option_flags
);
10216 else if (var
== NULL
)
10217 var
= (char_u
*)"";
10219 /* A backslash is required before some characters. This is the reverse of
10220 * what happens in do_set(). */
10221 buf
= vim_strsave_escaped(var
, escape_chars
);
10230 #ifdef BACKSLASH_IN_FILENAME
10231 /* For MS-Windows et al. we don't double backslashes at the start and
10232 * before a file name character. */
10233 for (var
= buf
; *var
!= NUL
; mb_ptr_adv(var
))
10234 if (var
[0] == '\\' && var
[1] == '\\'
10235 && expand_option_idx
>= 0
10236 && (options
[expand_option_idx
].flags
& P_EXPAND
)
10237 && vim_isfilec(var
[2])
10238 && (var
[2] != '\\' || (var
== buf
&& var
[4] != '\\')))
10239 STRMOVE(var
, var
+ 1);
10249 * Get the value for the numeric or string option *opp in a nice format into
10250 * NameBuff[]. Must not be called with a hidden option!
10253 option_value2string(opp
, opt_flags
)
10254 struct vimoption
*opp
;
10255 int opt_flags
; /* OPT_GLOBAL and/or OPT_LOCAL */
10259 varp
= get_varp_scope(opp
, opt_flags
);
10261 if (opp
->flags
& P_NUM
)
10265 if (wc_use_keyname(varp
, &wc
))
10266 STRCPY(NameBuff
, get_special_key_name((int)wc
, 0));
10268 STRCPY(NameBuff
, transchar((int)wc
));
10270 sprintf((char *)NameBuff
, "%ld", *(long *)varp
);
10272 else /* P_STRING */
10274 varp
= *(char_u
**)(varp
);
10275 if (varp
== NULL
) /* just in case */
10278 /* don't show the actual value of 'key', only that it's set */
10279 else if (opp
->var
== (char_u
*)&p_key
&& *varp
)
10280 STRCPY(NameBuff
, "*****");
10282 else if (opp
->flags
& P_EXPAND
)
10283 home_replace(NULL
, varp
, NameBuff
, MAXPATHL
, FALSE
);
10284 /* Translate 'pastetoggle' into special key names */
10285 else if ((char_u
**)opp
->var
== &p_pt
)
10286 str2specialbuf(p_pt
, NameBuff
, MAXPATHL
);
10288 vim_strncpy(NameBuff
, varp
, MAXPATHL
- 1);
10293 * Return TRUE if "varp" points to 'wildchar' or 'wildcharm' and it can be
10294 * printed as a keyname.
10295 * "*wcp" is set to the value of the option if it's 'wildchar' or 'wildcharm'.
10298 wc_use_keyname(varp
, wcp
)
10302 if (((long *)varp
== &p_wc
) || ((long *)varp
== &p_wcm
))
10304 *wcp
= *(long *)varp
;
10305 if (IS_SPECIAL(*wcp
) || find_special_key_in_table((int)*wcp
) >= 0)
10311 #ifdef FEAT_LANGMAP
10313 * Any character has an equivalent 'langmap' character. This is used for
10314 * keyboards that have a special language mode that sends characters above
10315 * 128 (although other characters can be translated too). The "to" field is a
10316 * Vim command character. This avoids having to switch the keyboard back to
10317 * ASCII mode when leaving Insert mode.
10319 * langmap_mapchar[] maps any of 256 chars to an ASCII char used for Vim
10321 * When FEAT_MBYTE is defined langmap_mapga.ga_data is a sorted table of
10322 * langmap_entry_T. This does the same as langmap_mapchar[] for characters >=
10327 * With multi-byte support use growarray for 'langmap' chars >= 256
10335 static garray_T langmap_mapga
;
10336 static void langmap_set_entry
__ARGS((int from
, int to
));
10339 * Search for an entry in "langmap_mapga" for "from". If found set the "to"
10340 * field. If not found insert a new entry at the appropriate location.
10343 langmap_set_entry(from
, to
)
10347 langmap_entry_T
*entries
= (langmap_entry_T
*)(langmap_mapga
.ga_data
);
10349 int b
= langmap_mapga
.ga_len
;
10351 /* Do a binary search for an existing entry. */
10354 int i
= (a
+ b
) / 2;
10355 int d
= entries
[i
].from
- from
;
10359 entries
[i
].to
= to
;
10368 if (ga_grow(&langmap_mapga
, 1) != OK
)
10369 return; /* out of memory */
10371 /* insert new entry at position "a" */
10372 entries
= (langmap_entry_T
*)(langmap_mapga
.ga_data
) + a
;
10373 mch_memmove(entries
+ 1, entries
,
10374 (langmap_mapga
.ga_len
- a
) * sizeof(langmap_entry_T
));
10375 ++langmap_mapga
.ga_len
;
10376 entries
[0].from
= from
;
10377 entries
[0].to
= to
;
10381 * Apply 'langmap' to multi-byte character "c" and return the result.
10384 langmap_adjust_mb(c
)
10387 langmap_entry_T
*entries
= (langmap_entry_T
*)(langmap_mapga
.ga_data
);
10389 int b
= langmap_mapga
.ga_len
;
10393 int i
= (a
+ b
) / 2;
10394 int d
= entries
[i
].from
- c
;
10397 return entries
[i
].to
; /* found matching entry */
10403 return c
; /* no entry found, return "c" unmodified */
10412 for (i
= 0; i
< 256; i
++)
10413 langmap_mapchar
[i
] = i
; /* we init with a one-to-one map */
10415 ga_init2(&langmap_mapga
, sizeof(langmap_entry_T
), 8);
10420 * Called when langmap option is set; the language map can be
10421 * changed at any time!
10431 ga_clear(&langmap_mapga
); /* clear the previous map first */
10433 langmap_init(); /* back to one-to-one map */
10435 for (p
= p_langmap
; p
[0] != NUL
; )
10437 for (p2
= p
; p2
[0] != NUL
&& p2
[0] != ',' && p2
[0] != ';';
10440 if (p2
[0] == '\\' && p2
[1] != NUL
)
10444 ++p2
; /* abcd;ABCD form, p2 points to A */
10446 p2
= NULL
; /* aAbBcCdD form, p2 is NULL */
10449 if (p
[0] == '\\' && p
[1] != NUL
)
10452 from
= (*mb_ptr2char
)(p
);
10462 to
= (*mb_ptr2char
)(p
);
10472 to
= (*mb_ptr2char
)(p2
);
10479 EMSG2(_("E357: 'langmap': Matching character missing for %s"),
10486 langmap_set_entry(from
, to
);
10489 langmap_mapchar
[from
& 255] = to
;
10491 /* Advance to next pair */
10511 EMSG2(_("E358: 'langmap': Extra characters after semicolon: %s"), p
);
10525 * Return TRUE if format option 'x' is in effect.
10526 * Take care of no formatting when 'paste' is set.
10529 has_format_option(x
)
10534 return (vim_strchr(curbuf
->b_p_fo
, x
) != NULL
);
10538 * Return TRUE if "x" is present in 'shortmess' option, or
10539 * 'shortmess' contains 'a' and "x" is present in SHM_A.
10545 return ( vim_strchr(p_shm
, x
) != NULL
10546 || (vim_strchr(p_shm
, 'a') != NULL
10547 && vim_strchr((char_u
*)SHM_A
, x
) != NULL
));
10551 * paste_option_changed() - Called after p_paste was set or reset.
10554 paste_option_changed()
10556 static int old_p_paste
= FALSE
;
10557 static int save_sm
= 0;
10558 #ifdef FEAT_CMDL_INFO
10559 static int save_ru
= 0;
10561 #ifdef FEAT_RIGHTLEFT
10562 static int save_ri
= 0;
10563 static int save_hkmap
= 0;
10570 * Paste switched from off to on.
10571 * Save the current values, so they can be restored later.
10575 /* save options for each buffer */
10576 for (buf
= firstbuf
; buf
!= NULL
; buf
= buf
->b_next
)
10578 buf
->b_p_tw_nopaste
= buf
->b_p_tw
;
10579 buf
->b_p_wm_nopaste
= buf
->b_p_wm
;
10580 buf
->b_p_sts_nopaste
= buf
->b_p_sts
;
10581 buf
->b_p_ai_nopaste
= buf
->b_p_ai
;
10584 /* save global options */
10586 #ifdef FEAT_CMDL_INFO
10589 #ifdef FEAT_RIGHTLEFT
10591 save_hkmap
= p_hkmap
;
10593 /* save global values for local buffer options */
10594 p_tw_nopaste
= p_tw
;
10595 p_wm_nopaste
= p_wm
;
10596 p_sts_nopaste
= p_sts
;
10597 p_ai_nopaste
= p_ai
;
10601 * Always set the option values, also when 'paste' is set when it is
10604 /* set options for each buffer */
10605 for (buf
= firstbuf
; buf
!= NULL
; buf
= buf
->b_next
)
10607 buf
->b_p_tw
= 0; /* textwidth is 0 */
10608 buf
->b_p_wm
= 0; /* wrapmargin is 0 */
10609 buf
->b_p_sts
= 0; /* softtabstop is 0 */
10610 buf
->b_p_ai
= 0; /* no auto-indent */
10613 /* set global options */
10614 p_sm
= 0; /* no showmatch */
10615 #ifdef FEAT_CMDL_INFO
10616 # ifdef FEAT_WINDOWS
10618 status_redraw_all(); /* redraw to remove the ruler */
10620 p_ru
= 0; /* no ruler */
10622 #ifdef FEAT_RIGHTLEFT
10623 p_ri
= 0; /* no reverse insert */
10624 p_hkmap
= 0; /* no Hebrew keyboard */
10626 /* set global values for local buffer options */
10634 * Paste switched from on to off: Restore saved values.
10636 else if (old_p_paste
)
10638 /* restore options for each buffer */
10639 for (buf
= firstbuf
; buf
!= NULL
; buf
= buf
->b_next
)
10641 buf
->b_p_tw
= buf
->b_p_tw_nopaste
;
10642 buf
->b_p_wm
= buf
->b_p_wm_nopaste
;
10643 buf
->b_p_sts
= buf
->b_p_sts_nopaste
;
10644 buf
->b_p_ai
= buf
->b_p_ai_nopaste
;
10647 /* restore global options */
10649 #ifdef FEAT_CMDL_INFO
10650 # ifdef FEAT_WINDOWS
10651 if (p_ru
!= save_ru
)
10652 status_redraw_all(); /* redraw to draw the ruler */
10656 #ifdef FEAT_RIGHTLEFT
10658 p_hkmap
= save_hkmap
;
10660 /* set global values for local buffer options */
10661 p_tw
= p_tw_nopaste
;
10662 p_wm
= p_wm_nopaste
;
10663 p_sts
= p_sts_nopaste
;
10664 p_ai
= p_ai_nopaste
;
10667 old_p_paste
= p_paste
;
10671 * vimrc_found() - Called when a ".vimrc" or "VIMINIT" has been found.
10673 * Reset 'compatible' and set the values for options that didn't get set yet
10674 * to the Vim defaults.
10675 * Don't do this if the 'compatible' option has been set or reset before.
10676 * When "fname" is not NULL, use it to set $"envname" when it wasn't set yet.
10679 vimrc_found(fname
, envname
)
10684 int dofree
= FALSE
;
10687 if (!option_was_set((char_u
*)"cp"))
10690 for (opt_idx
= 0; !istermoption(&options
[opt_idx
]); opt_idx
++)
10691 if (!(options
[opt_idx
].flags
& (P_WAS_SET
|P_VI_DEF
)))
10692 set_option_default(opt_idx
, OPT_FREE
, FALSE
);
10698 p
= vim_getenv(envname
, &dofree
);
10701 /* Set $MYVIMRC to the first vimrc file found. */
10702 p
= FullName_save(fname
, FALSE
);
10705 vim_setenv(envname
, p
);
10715 * Set 'compatible' on or off. Called for "-C" and "-N" command line arg.
10718 change_compatible(on
)
10728 opt_idx
= findoption((char_u
*)"cp");
10730 options
[opt_idx
].flags
|= P_WAS_SET
;
10734 * Return TRUE when option "name" has been set.
10737 option_was_set(name
)
10742 idx
= findoption(name
);
10743 if (idx
< 0) /* unknown option */
10745 if (options
[idx
].flags
& P_WAS_SET
)
10751 * compatible_set() - Called when 'compatible' has been set or unset.
10753 * When 'compatible' set: Set all relevant options (those that have the P_VIM)
10754 * flag) to a Vi compatible value.
10755 * When 'compatible' is unset: Set all options that have a different default
10756 * for Vim (without the P_VI_DEF flag) to that default.
10763 for (opt_idx
= 0; !istermoption(&options
[opt_idx
]); opt_idx
++)
10764 if ( ((options
[opt_idx
].flags
& P_VIM
) && p_cp
)
10765 || (!(options
[opt_idx
].flags
& P_VI_DEF
) && !p_cp
))
10766 set_option_default(opt_idx
, OPT_FREE
, p_cp
);
10770 #ifdef FEAT_LINEBREAK
10772 # if defined(__BORLANDC__) && (__BORLANDC__ < 0x500)
10773 /* Borland C++ screws up loop optimisation here (negri) */
10774 #pragma option -O-l
10778 * fill_breakat_flags() -- called when 'breakat' changes value.
10781 fill_breakat_flags()
10786 for (i
= 0; i
< 256; i
++)
10787 breakat_flags
[i
] = FALSE
;
10789 if (p_breakat
!= NULL
)
10790 for (p
= p_breakat
; *p
; p
++)
10791 breakat_flags
[*p
] = TRUE
;
10794 # if defined(__BORLANDC__) && (__BORLANDC__ < 0x500)
10795 #pragma option -O.l
10801 * Check an option that can be a range of string values.
10803 * Return OK for correct value, FAIL otherwise.
10804 * Empty is always OK.
10807 check_opt_strings(val
, values
, list
)
10810 int list
; /* when TRUE: accept a list of values */
10812 return opt_strings_flags(val
, values
, NULL
, list
);
10816 * Handle an option that can be a range of string values.
10817 * Set a flag in "*flagp" for each string present.
10819 * Return OK for correct value, FAIL otherwise.
10820 * Empty is always OK.
10823 opt_strings_flags(val
, values
, flagp
, list
)
10824 char_u
*val
; /* new value */
10825 char **values
; /* array of valid string values */
10827 int list
; /* when TRUE: accept a list of values */
10831 unsigned new_flags
= 0;
10837 if (values
[i
] == NULL
) /* val not found in values[] */
10840 len
= (int)STRLEN(values
[i
]);
10841 if (STRNCMP(values
[i
], val
, len
) == 0
10842 && ((list
&& val
[len
] == ',') || val
[len
] == NUL
))
10844 val
+= len
+ (val
[len
] == ',');
10845 new_flags
|= (1 << i
);
10846 break; /* check next item in val list */
10851 *flagp
= new_flags
;
10857 * Read the 'wildmode' option, fill wim_flags[].
10862 char_u new_wim_flags
[4];
10867 for (i
= 0; i
< 4; ++i
)
10868 new_wim_flags
[i
] = 0;
10870 for (p
= p_wim
; *p
; ++p
)
10872 for (i
= 0; ASCII_ISALPHA(p
[i
]); ++i
)
10874 if (p
[i
] != NUL
&& p
[i
] != ',' && p
[i
] != ':')
10876 if (i
== 7 && STRNCMP(p
, "longest", 7) == 0)
10877 new_wim_flags
[idx
] |= WIM_LONGEST
;
10878 else if (i
== 4 && STRNCMP(p
, "full", 4) == 0)
10879 new_wim_flags
[idx
] |= WIM_FULL
;
10880 else if (i
== 4 && STRNCMP(p
, "list", 4) == 0)
10881 new_wim_flags
[idx
] |= WIM_LIST
;
10895 /* fill remaining entries with last flag */
10898 new_wim_flags
[idx
+ 1] = new_wim_flags
[idx
];
10902 /* only when there are no errors, wim_flags[] is changed */
10903 for (i
= 0; i
< 4; ++i
)
10904 wim_flags
[i
] = new_wim_flags
[i
];
10909 * Check if backspacing over something is allowed.
10913 int what
; /* BS_INDENT, BS_EOL or BS_START */
10917 case '2': return TRUE
;
10918 case '1': return (what
!= BS_START
);
10919 case '0': return FALSE
;
10921 return vim_strchr(p_bs
, what
) != NULL
;
10925 * Save the current values of 'fileformat' and 'fileencoding', so that we know
10926 * the file must be considered changed when the value is different.
10932 buf
->b_start_ffc
= *buf
->b_p_ff
;
10933 buf
->b_start_eol
= buf
->b_p_eol
;
10935 buf
->b_start_bomb
= buf
->b_p_bomb
;
10937 /* Only use free/alloc when necessary, they take time. */
10938 if (buf
->b_start_fenc
== NULL
10939 || STRCMP(buf
->b_start_fenc
, buf
->b_p_fenc
) != 0)
10941 vim_free(buf
->b_start_fenc
);
10942 buf
->b_start_fenc
= vim_strsave(buf
->b_p_fenc
);
10948 * Return TRUE if 'fileformat' and/or 'fileencoding' has a different value
10949 * from when editing started (save_file_ff() called).
10950 * Also when 'endofline' was changed and 'binary' is set, or when 'bomb' was
10951 * changed and 'binary' is not set.
10952 * Don't consider a new, empty buffer to be changed.
10955 file_ff_differs(buf
)
10958 /* In a buffer that was never loaded the options are not valid. */
10959 if (buf
->b_flags
& BF_NEVERLOADED
)
10961 if ((buf
->b_flags
& BF_NEW
)
10962 && buf
->b_ml
.ml_line_count
== 1
10963 && *ml_get_buf(buf
, (linenr_T
)1, FALSE
) == NUL
)
10965 if (buf
->b_start_ffc
!= *buf
->b_p_ff
)
10967 if (buf
->b_p_bin
&& buf
->b_start_eol
!= buf
->b_p_eol
)
10970 if (!buf
->b_p_bin
&& buf
->b_start_bomb
!= buf
->b_p_bomb
)
10972 if (buf
->b_start_fenc
== NULL
)
10973 return (*buf
->b_p_fenc
!= NUL
);
10974 return (STRCMP(buf
->b_start_fenc
, buf
->b_p_fenc
) != 0);
10981 * return OK if "p" is a valid fileformat name, FAIL otherwise.
10987 return check_opt_strings(p
, p_ff_values
, FALSE
);