1 /* vi:set ts=8 sts=4 sw=4:
3 * VIM - Vi IMproved by Bram Moolenaar
5 * Do ":help uganda" in Vim to read copying and usage conditions.
6 * Do ":help credits" in Vim to see a list of people who contributed.
7 * See README.txt for an overview of the Vim source code.
11 * Code to handle user-settable options. This is all pretty much table-
12 * driven. Checklist for adding a new option:
13 * - Put it in the options array below (copy an existing entry).
14 * - For a global option: Add a variable for it in option.h.
15 * - For a buffer or window local option:
16 * - Add a PV_XX entry to the enum below.
17 * - Add a variable to the window or buffer struct in structs.h.
18 * - For a window option, add some code to copy_winopt().
19 * - For a buffer option, add some code to buf_copy_options().
20 * - For a buffer string option, add code to check_buf_options().
21 * - If it's a numeric option, add any necessary bounds checks to do_set().
22 * - If it's a list of flags, add some code in do_set(), search for WW_ALL.
23 * - When adding an option with expansion (P_EXPAND), but with a different
24 * default for Vi and Vim (no P_VI_DEF), add some code at VIMEXP.
25 * - Add documentation! One line in doc/help.txt, full description in
26 * options.txt, and any other related places.
27 * - Add an entry in runtime/optwin.vim.
28 * When making changes:
29 * - Adjust the help for the option in doc/option.txt.
30 * - When an entry has the P_VIM flag, or is lacking the P_VI_DEF flag, add a
31 * comment at the help for the 'compatible' option.
38 * The options that are local to a window or buffer have "indir" set to one of
39 * these values. Special values:
40 * PV_NONE: global option.
41 * PV_WIN is added: window-local option
42 * PV_BUF is added: buffer-local option
43 * PV_BOTH is added: global option which also has a local value.
45 #define PV_BOTH 0x1000
48 #define PV_MASK 0x0fff
49 #define OPT_WIN(x) (idopt_T)(PV_WIN + (int)(x))
50 #define OPT_BUF(x) (idopt_T)(PV_BUF + (int)(x))
51 #define OPT_BOTH(x) (idopt_T)(PV_BOTH + (int)(x))
54 * Definition of the PV_ values for buffer-local options.
55 * The BV_ values are defined in option.h.
57 #define PV_AI OPT_BUF(BV_AI)
58 #define PV_AR OPT_BOTH(OPT_BUF(BV_AR))
60 # define PV_BH OPT_BUF(BV_BH)
61 # define PV_BT OPT_BUF(BV_BT)
62 # define PV_EFM OPT_BOTH(OPT_BUF(BV_EFM))
63 # define PV_GP OPT_BOTH(OPT_BUF(BV_GP))
64 # define PV_MP OPT_BOTH(OPT_BUF(BV_MP))
66 #define PV_BIN OPT_BUF(BV_BIN)
67 #define PV_BL OPT_BUF(BV_BL)
69 # define PV_BOMB OPT_BUF(BV_BOMB)
71 #define PV_CI OPT_BUF(BV_CI)
73 # define PV_CIN OPT_BUF(BV_CIN)
74 # define PV_CINK OPT_BUF(BV_CINK)
75 # define PV_CINO OPT_BUF(BV_CINO)
77 #if defined(FEAT_SMARTINDENT) || defined(FEAT_CINDENT)
78 # define PV_CINW OPT_BUF(BV_CINW)
81 # define PV_CMS OPT_BUF(BV_CMS)
84 # define PV_COM OPT_BUF(BV_COM)
86 #ifdef FEAT_INS_EXPAND
87 # define PV_CPT OPT_BUF(BV_CPT)
88 # define PV_DICT OPT_BOTH(OPT_BUF(BV_DICT))
89 # define PV_TSR OPT_BOTH(OPT_BUF(BV_TSR))
91 #ifdef FEAT_COMPL_FUNC
92 # define PV_CFU OPT_BUF(BV_CFU)
95 # define PV_DEF OPT_BOTH(OPT_BUF(BV_DEF))
96 # define PV_INC OPT_BOTH(OPT_BUF(BV_INC))
98 #define PV_EOL OPT_BUF(BV_EOL)
99 #define PV_EP OPT_BOTH(OPT_BUF(BV_EP))
100 #define PV_ET OPT_BUF(BV_ET)
102 # define PV_FENC OPT_BUF(BV_FENC)
104 #if defined(FEAT_BEVAL) && defined(FEAT_EVAL)
105 # define PV_BEXPR OPT_BOTH(OPT_BUF(BV_BEXPR))
108 # define PV_FEX OPT_BUF(BV_FEX)
110 #define PV_FF OPT_BUF(BV_FF)
111 #define PV_FLP OPT_BUF(BV_FLP)
112 #define PV_FO OPT_BUF(BV_FO)
114 # define PV_FT OPT_BUF(BV_FT)
116 #define PV_IMI OPT_BUF(BV_IMI)
117 #define PV_IMS OPT_BUF(BV_IMS)
118 #if defined(FEAT_CINDENT) && defined(FEAT_EVAL)
119 # define PV_INDE OPT_BUF(BV_INDE)
120 # define PV_INDK OPT_BUF(BV_INDK)
122 #if defined(FEAT_FIND_ID) && defined(FEAT_EVAL)
123 # define PV_INEX OPT_BUF(BV_INEX)
125 #define PV_INF OPT_BUF(BV_INF)
126 #define PV_ISK OPT_BUF(BV_ISK)
128 # define PV_KEY OPT_BUF(BV_KEY)
131 # define PV_KMAP OPT_BUF(BV_KMAP)
133 #define PV_KP OPT_BOTH(OPT_BUF(BV_KP))
135 # define PV_LISP OPT_BUF(BV_LISP)
137 #define PV_MA OPT_BUF(BV_MA)
139 # define PV_MIG OPT_BUF(BV_MIG)
141 #define PV_ML OPT_BUF(BV_ML)
142 #define PV_MOD OPT_BUF(BV_MOD)
143 #define PV_MPS OPT_BUF(BV_MPS)
144 #ifdef FEAT_GUI_MACVIM
145 #define PV_MMTA OPT_BUF(BV_MMTA)
147 #define PV_NF OPT_BUF(BV_NF)
148 #ifdef FEAT_OSFILETYPE
149 # define PV_OFT OPT_BUF(BV_OFT)
151 #ifdef FEAT_COMPL_FUNC
152 # define PV_OFU OPT_BUF(BV_OFU)
154 #define PV_PATH OPT_BOTH(OPT_BUF(BV_PATH))
155 #define PV_PI OPT_BUF(BV_PI)
157 # define PV_QE OPT_BUF(BV_QE)
159 #define PV_RO OPT_BUF(BV_RO)
160 #ifdef FEAT_SMARTINDENT
161 # define PV_SI OPT_BUF(BV_SI)
164 # define PV_SN OPT_BUF(BV_SN)
167 # define PV_SMC OPT_BUF(BV_SMC)
168 # define PV_SYN OPT_BUF(BV_SYN)
171 # define PV_SPC OPT_BUF(BV_SPC)
172 # define PV_SPF OPT_BUF(BV_SPF)
173 # define PV_SPL OPT_BUF(BV_SPL)
175 #define PV_STS OPT_BUF(BV_STS)
176 #ifdef FEAT_SEARCHPATH
177 # define PV_SUA OPT_BUF(BV_SUA)
179 #define PV_SW OPT_BUF(BV_SW)
180 #define PV_SWF OPT_BUF(BV_SWF)
181 #define PV_TAGS OPT_BOTH(OPT_BUF(BV_TAGS))
182 #define PV_TS OPT_BUF(BV_TS)
183 #define PV_TW OPT_BUF(BV_TW)
184 #define PV_TX OPT_BUF(BV_TX)
185 #define PV_WM OPT_BUF(BV_WM)
188 * Definition of the PV_ values for window-local options.
189 * The WV_ values are defined in option.h.
191 #define PV_LIST OPT_WIN(WV_LIST)
193 # define PV_ARAB OPT_WIN(WV_ARAB)
196 # define PV_DIFF OPT_WIN(WV_DIFF)
199 # define PV_FDC OPT_WIN(WV_FDC)
200 # define PV_FEN OPT_WIN(WV_FEN)
201 # define PV_FDI OPT_WIN(WV_FDI)
202 # define PV_FDL OPT_WIN(WV_FDL)
203 # define PV_FDM OPT_WIN(WV_FDM)
204 # define PV_FML OPT_WIN(WV_FML)
205 # define PV_FDN OPT_WIN(WV_FDN)
207 # define PV_FDE OPT_WIN(WV_FDE)
208 # define PV_FDT OPT_WIN(WV_FDT)
210 # define PV_FMR OPT_WIN(WV_FMR)
212 #ifdef FEAT_LINEBREAK
213 # define PV_LBR OPT_WIN(WV_LBR)
215 #define PV_NU OPT_WIN(WV_NU)
216 #ifdef FEAT_LINEBREAK
217 # define PV_NUW OPT_WIN(WV_NUW)
219 #if defined(FEAT_WINDOWS) && defined(FEAT_QUICKFIX)
220 # define PV_PVW OPT_WIN(WV_PVW)
222 #ifdef FEAT_RIGHTLEFT
223 # define PV_RL OPT_WIN(WV_RL)
224 # define PV_RLC OPT_WIN(WV_RLC)
226 #ifdef FEAT_SCROLLBIND
227 # define PV_SCBIND OPT_WIN(WV_SCBIND)
229 #define PV_SCROLL OPT_WIN(WV_SCROLL)
231 # define PV_SPELL OPT_WIN(WV_SPELL)
234 # define PV_CUC OPT_WIN(WV_CUC)
235 # define PV_CUL OPT_WIN(WV_CUL)
238 # define PV_STL OPT_BOTH(OPT_WIN(WV_STL))
241 # define PV_WFH OPT_WIN(WV_WFH)
243 #ifdef FEAT_VERTSPLIT
244 # define PV_WFW OPT_WIN(WV_WFW)
246 #define PV_WRAP OPT_WIN(WV_WRAP)
249 /* WV_ and BV_ values get typecasted to this for the "indir" field */
253 PV_MAXVAL
= 0xffff /* to avoid warnings for value out of range */
257 * Options local to a window have a value local to a buffer and global to all
258 * buffers. Indicate this by setting "var" to VAR_WIN.
260 #define VAR_WIN ((char_u *)-1)
263 * These are the global values for options which are also local to a buffer.
264 * Only to be used in option.c!
271 #if defined(FEAT_QUICKFIX)
279 static char_u
*p_cink
;
280 static char_u
*p_cino
;
282 #if defined(FEAT_SMARTINDENT) || defined(FEAT_CINDENT)
283 static char_u
*p_cinw
;
286 static char_u
*p_com
;
289 static char_u
*p_cms
;
291 #ifdef FEAT_INS_EXPAND
292 static char_u
*p_cpt
;
294 #ifdef FEAT_COMPL_FUNC
295 static char_u
*p_cfu
;
296 static char_u
*p_ofu
;
301 static char_u
*p_fenc
;
305 static char_u
*p_flp
;
309 static long p_iminsert
;
310 static long p_imsearch
;
311 #if defined(FEAT_FIND_ID) && defined(FEAT_EVAL)
312 static char_u
*p_inex
;
314 #if defined(FEAT_CINDENT) && defined(FEAT_EVAL)
315 static char_u
*p_inde
;
316 static char_u
*p_indk
;
318 #if defined(FEAT_EVAL)
319 static char_u
*p_fex
;
322 static char_u
*p_isk
;
324 static char_u
*p_key
;
331 #ifdef FEAT_GUI_MACVIM
335 static char_u
*p_mps
;
337 #ifdef FEAT_OSFILETYPE
338 static char_u
*p_oft
;
345 #ifdef FEAT_SMARTINDENT
352 #if defined(FEAT_SEARCHPATH)
353 static char_u
*p_sua
;
359 static char_u
*p_syn
;
362 static char_u
*p_spc
;
363 static char_u
*p_spf
;
364 static char_u
*p_spl
;
371 static char_u
*p_keymap
;
374 /* Saved values for when 'bin' is set. */
375 static int p_et_nobin
;
376 static int p_ml_nobin
;
377 static long p_tw_nobin
;
378 static long p_wm_nobin
;
380 /* Saved values for when 'paste' is set */
381 static long p_tw_nopaste
;
382 static long p_wm_nopaste
;
383 static long p_sts_nopaste
;
384 static int p_ai_nopaste
;
388 char *fullname
; /* full option name */
389 char *shortname
; /* permissible abbreviation */
390 long_u flags
; /* see below */
391 char_u
*var
; /* global option: pointer to variable;
392 * window-local option: VAR_WIN;
393 * buffer-local option: global value */
394 idopt_T indir
; /* global option: PV_NONE;
395 * local option: indirect option index */
396 char_u
*def_val
[2]; /* default values for variable (vi and vim) */
398 scid_T scriptID
; /* script in which the option was last set */
402 #define VI_DEFAULT 0 /* def_val[VI_DEFAULT] is Vi default value */
403 #define VIM_DEFAULT 1 /* def_val[VIM_DEFAULT] is Vim default value */
408 #define P_BOOL 0x01 /* the option is boolean */
409 #define P_NUM 0x02 /* the option is numeric */
410 #define P_STRING 0x04 /* the option is a string */
411 #define P_ALLOCED 0x08 /* the string option is in allocated memory,
412 must use vim_free() when assigning new
413 value. Not set if default is the same. */
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)
490 {"antialias", "anti", P_BOOL
|P_VI_DEF
|P_VIM
|P_RCLR
,
491 #ifdef FEAT_ANTIALIAS
492 (char_u
*)&p_antialias
, PV_NONE
,
494 (char_u
*)NULL
, PV_NONE
,
497 {(char_u
*)TRUE
, (char_u
*)0L}},
499 {(char_u
*)FALSE
, (char_u
*)0L}},
501 {"arabic", "arab", P_BOOL
|P_VI_DEF
|P_VIM
,
503 (char_u
*)VAR_WIN
, PV_ARAB
,
505 (char_u
*)NULL
, PV_NONE
,
507 {(char_u
*)FALSE
, (char_u
*)0L}},
508 {"arabicshape", "arshape", P_BOOL
|P_VI_DEF
|P_VIM
|P_RCLR
,
510 (char_u
*)&p_arshape
, PV_NONE
,
512 (char_u
*)NULL
, PV_NONE
,
514 {(char_u
*)TRUE
, (char_u
*)0L}},
515 {"allowrevins", "ari", P_BOOL
|P_VI_DEF
|P_VIM
,
516 #ifdef FEAT_RIGHTLEFT
517 (char_u
*)&p_ari
, PV_NONE
,
519 (char_u
*)NULL
, PV_NONE
,
521 {(char_u
*)FALSE
, (char_u
*)0L}},
522 {"altkeymap", "akm", P_BOOL
|P_VI_DEF
,
524 (char_u
*)&p_altkeymap
, PV_NONE
,
526 (char_u
*)NULL
, PV_NONE
,
528 {(char_u
*)FALSE
, (char_u
*)0L}},
529 {"ambiwidth", "ambw", P_STRING
|P_VI_DEF
|P_RCLR
,
530 #if defined(FEAT_MBYTE)
531 (char_u
*)&p_ambw
, PV_NONE
,
532 {(char_u
*)"single", (char_u
*)0L}
534 (char_u
*)NULL
, PV_NONE
,
535 {(char_u
*)0L, (char_u
*)0L}
538 #ifdef FEAT_AUTOCHDIR
539 {"autochdir", "acd", P_BOOL
|P_VI_DEF
,
540 (char_u
*)&p_acd
, PV_NONE
,
541 {(char_u
*)FALSE
, (char_u
*)0L}},
543 {"autoindent", "ai", P_BOOL
|P_VI_DEF
,
544 (char_u
*)&p_ai
, PV_AI
,
545 {(char_u
*)FALSE
, (char_u
*)0L}},
546 {"autoprint", "ap", P_BOOL
|P_VI_DEF
,
547 (char_u
*)NULL
, PV_NONE
,
548 {(char_u
*)FALSE
, (char_u
*)0L}},
549 {"autoread", "ar", P_BOOL
|P_VI_DEF
,
550 (char_u
*)&p_ar
, PV_AR
,
551 {(char_u
*)FALSE
, (char_u
*)0L}},
552 {"autowrite", "aw", P_BOOL
|P_VI_DEF
,
553 (char_u
*)&p_aw
, PV_NONE
,
554 {(char_u
*)FALSE
, (char_u
*)0L}},
555 {"autowriteall","awa", P_BOOL
|P_VI_DEF
,
556 (char_u
*)&p_awa
, PV_NONE
,
557 {(char_u
*)FALSE
, (char_u
*)0L}},
558 {"background", "bg", P_STRING
|P_VI_DEF
|P_RCLR
,
559 (char_u
*)&p_bg
, PV_NONE
,
561 #if (defined(MSDOS) || defined(OS2) || defined(WIN3264)) && !defined(FEAT_GUI)
567 {"backspace", "bs", P_STRING
|P_VI_DEF
|P_VIM
|P_COMMA
|P_NODUP
,
568 (char_u
*)&p_bs
, PV_NONE
,
569 {(char_u
*)"", (char_u
*)0L}},
570 {"backup", "bk", P_BOOL
|P_VI_DEF
|P_VIM
,
571 (char_u
*)&p_bk
, PV_NONE
,
572 {(char_u
*)FALSE
, (char_u
*)0L}},
573 {"backupcopy", "bkc", P_STRING
|P_VIM
|P_COMMA
|P_NODUP
,
574 (char_u
*)&p_bkc
, PV_NONE
,
576 {(char_u
*)"yes", (char_u
*)"auto"}
578 {(char_u
*)"auto", (char_u
*)"auto"}
581 {"backupdir", "bdir", P_STRING
|P_EXPAND
|P_VI_DEF
|P_COMMA
|P_NODUP
|P_SECURE
,
582 (char_u
*)&p_bdir
, PV_NONE
,
583 {(char_u
*)DFLT_BDIR
, (char_u
*)0L}},
584 {"backupext", "bex", P_STRING
|P_VI_DEF
|P_NFNAME
,
585 (char_u
*)&p_bex
, PV_NONE
,
593 {"backupskip", "bsk", P_STRING
|P_VI_DEF
|P_COMMA
,
595 (char_u
*)&p_bsk
, PV_NONE
,
596 {(char_u
*)"", (char_u
*)0L}
598 (char_u
*)NULL
, PV_NONE
,
599 {(char_u
*)0L, (char_u
*)0L}
603 {"balloondelay","bdlay",P_NUM
|P_VI_DEF
,
604 (char_u
*)&p_bdlay
, PV_NONE
,
605 {(char_u
*)600L, (char_u
*)0L}},
606 {"ballooneval", "beval",P_BOOL
|P_VI_DEF
|P_NO_MKRC
,
607 (char_u
*)&p_beval
, PV_NONE
,
608 {(char_u
*)FALSE
, (char_u
*)0L}},
610 {"balloonexpr", "bexpr", P_STRING
|P_ALLOCED
|P_VI_DEF
|P_VIM
,
611 (char_u
*)&p_bexpr
, PV_BEXPR
,
612 {(char_u
*)"", (char_u
*)0L}},
615 {"beautify", "bf", P_BOOL
|P_VI_DEF
,
616 (char_u
*)NULL
, PV_NONE
,
617 {(char_u
*)FALSE
, (char_u
*)0L}},
618 {"binary", "bin", P_BOOL
|P_VI_DEF
|P_RSTAT
,
619 (char_u
*)&p_bin
, PV_BIN
,
620 {(char_u
*)FALSE
, (char_u
*)0L}},
621 {"bioskey", "biosk",P_BOOL
|P_VI_DEF
,
623 (char_u
*)&p_biosk
, PV_NONE
,
625 (char_u
*)NULL
, PV_NONE
,
627 {(char_u
*)TRUE
, (char_u
*)0L}},
628 {"bomb", NULL
, P_BOOL
|P_NO_MKRC
|P_VI_DEF
|P_RSTAT
,
630 (char_u
*)&p_bomb
, PV_BOMB
,
632 (char_u
*)NULL
, PV_NONE
,
634 {(char_u
*)FALSE
, (char_u
*)0L}},
635 {"breakat", "brk", P_STRING
|P_VI_DEF
|P_RALL
|P_FLAGLIST
,
636 #ifdef FEAT_LINEBREAK
637 (char_u
*)&p_breakat
, PV_NONE
,
638 {(char_u
*)" \t!@*-+;:,./?", (char_u
*)0L}
640 (char_u
*)NULL
, PV_NONE
,
641 {(char_u
*)0L, (char_u
*)0L}
644 {"browsedir", "bsdir",P_STRING
|P_VI_DEF
,
646 (char_u
*)&p_bsdir
, PV_NONE
,
647 {(char_u
*)"last", (char_u
*)0L}
649 (char_u
*)NULL
, PV_NONE
,
650 {(char_u
*)0L, (char_u
*)0L}
653 {"bufhidden", "bh", P_STRING
|P_ALLOCED
|P_VI_DEF
|P_NOGLOB
,
654 #if defined(FEAT_QUICKFIX)
655 (char_u
*)&p_bh
, PV_BH
,
656 {(char_u
*)"", (char_u
*)0L}
658 (char_u
*)NULL
, PV_NONE
,
659 {(char_u
*)0L, (char_u
*)0L}
662 {"buflisted", "bl", P_BOOL
|P_VI_DEF
|P_NOGLOB
,
663 (char_u
*)&p_bl
, PV_BL
,
664 {(char_u
*)1L, (char_u
*)0L}
666 {"buftype", "bt", P_STRING
|P_ALLOCED
|P_VI_DEF
|P_NOGLOB
,
667 #if defined(FEAT_QUICKFIX)
668 (char_u
*)&p_bt
, PV_BT
,
669 {(char_u
*)"", (char_u
*)0L}
671 (char_u
*)NULL
, PV_NONE
,
672 {(char_u
*)0L, (char_u
*)0L}
675 {"casemap", "cmp", P_STRING
|P_VI_DEF
|P_COMMA
|P_NODUP
,
677 (char_u
*)&p_cmp
, PV_NONE
,
678 {(char_u
*)"internal,keepascii", (char_u
*)0L}
680 (char_u
*)NULL
, PV_NONE
,
681 {(char_u
*)0L, (char_u
*)0L}
684 {"cdpath", "cd", P_STRING
|P_EXPAND
|P_VI_DEF
|P_COMMA
|P_NODUP
,
685 #ifdef FEAT_SEARCHPATH
686 (char_u
*)&p_cdpath
, PV_NONE
,
687 {(char_u
*)",,", (char_u
*)0L}
689 (char_u
*)NULL
, PV_NONE
,
690 {(char_u
*)0L, (char_u
*)0L}
693 {"cedit", NULL
, P_STRING
,
695 (char_u
*)&p_cedit
, PV_NONE
,
696 {(char_u
*)"", (char_u
*)CTRL_F_STR
}
698 (char_u
*)NULL
, PV_NONE
,
699 {(char_u
*)0L, (char_u
*)0L}
702 {"charconvert", "ccv", P_STRING
|P_VI_DEF
|P_SECURE
,
703 #if defined(FEAT_MBYTE) && defined(FEAT_EVAL)
704 (char_u
*)&p_ccv
, PV_NONE
,
705 {(char_u
*)"", (char_u
*)0L}
707 (char_u
*)NULL
, PV_NONE
,
708 {(char_u
*)0L, (char_u
*)0L}
711 {"charspace", "csp", P_NUM
|P_NODEFAULT
|P_VIM
|P_RCLR
,
713 (char_u
*)&p_charspace
, PV_NONE
,
715 (char_u
*)NULL
, PV_NONE
,
717 {(char_u
*)0L, (char_u
*)0L}
719 {"cindent", "cin", P_BOOL
|P_VI_DEF
|P_VIM
,
721 (char_u
*)&p_cin
, PV_CIN
,
723 (char_u
*)NULL
, PV_NONE
,
725 {(char_u
*)FALSE
, (char_u
*)0L}},
726 {"cinkeys", "cink", P_STRING
|P_ALLOCED
|P_VI_DEF
|P_COMMA
|P_NODUP
,
728 (char_u
*)&p_cink
, PV_CINK
,
729 {(char_u
*)"0{,0},0),:,0#,!^F,o,O,e", (char_u
*)0L}
731 (char_u
*)NULL
, PV_NONE
,
732 {(char_u
*)0L, (char_u
*)0L}
735 {"cinoptions", "cino", P_STRING
|P_ALLOCED
|P_VI_DEF
|P_COMMA
|P_NODUP
,
737 (char_u
*)&p_cino
, PV_CINO
,
739 (char_u
*)NULL
, PV_NONE
,
741 {(char_u
*)"", (char_u
*)0L}},
742 {"cinwords", "cinw", P_STRING
|P_ALLOCED
|P_VI_DEF
|P_COMMA
|P_NODUP
,
743 #if defined(FEAT_SMARTINDENT) || defined(FEAT_CINDENT)
744 (char_u
*)&p_cinw
, PV_CINW
,
745 {(char_u
*)"if,else,while,do,for,switch",
748 (char_u
*)NULL
, PV_NONE
,
749 {(char_u
*)0L, (char_u
*)0L}
752 {"clipboard", "cb", P_STRING
|P_VI_DEF
|P_COMMA
|P_NODUP
,
753 #ifdef FEAT_CLIPBOARD
754 (char_u
*)&p_cb
, PV_NONE
,
755 # ifdef FEAT_XCLIPBOARD
756 {(char_u
*)"autoselect,exclude:cons\\|linux",
759 {(char_u
*)"", (char_u
*)0L}
762 (char_u
*)NULL
, PV_NONE
,
763 {(char_u
*)"", (char_u
*)0L}
766 {"cmdheight", "ch", P_NUM
|P_VI_DEF
|P_RALL
,
767 (char_u
*)&p_ch
, PV_NONE
,
768 {(char_u
*)1L, (char_u
*)0L}},
769 {"cmdwinheight", "cwh", P_NUM
|P_VI_DEF
,
771 (char_u
*)&p_cwh
, PV_NONE
,
773 (char_u
*)NULL
, PV_NONE
,
775 {(char_u
*)7L, (char_u
*)0L}},
776 {"columns", "co", P_NUM
|P_NODEFAULT
|P_NO_MKRC
|P_VI_DEF
|P_RCLR
,
777 (char_u
*)&Columns
, PV_NONE
,
778 {(char_u
*)80L, (char_u
*)0L}},
779 {"comments", "com", P_STRING
|P_ALLOCED
|P_VI_DEF
|P_COMMA
|P_NODUP
,
781 (char_u
*)&p_com
, PV_COM
,
782 {(char_u
*)"s1:/*,mb:*,ex:*/,://,b:#,:%,:XCOMM,n:>,fb:-",
785 (char_u
*)NULL
, PV_NONE
,
786 {(char_u
*)0L, (char_u
*)0L}
789 {"commentstring", "cms", P_STRING
|P_ALLOCED
|P_VI_DEF
,
791 (char_u
*)&p_cms
, PV_CMS
,
792 {(char_u
*)"/*%s*/", (char_u
*)0L}
794 (char_u
*)NULL
, PV_NONE
,
795 {(char_u
*)0L, (char_u
*)0L}
798 /* P_PRI_MKRC isn't needed here, optval_default()
799 * always returns TRUE for 'compatible' */
800 {"compatible", "cp", P_BOOL
|P_RALL
,
801 (char_u
*)&p_cp
, PV_NONE
,
802 {(char_u
*)TRUE
, (char_u
*)FALSE
}},
803 {"complete", "cpt", P_STRING
|P_ALLOCED
|P_VI_DEF
|P_COMMA
|P_NODUP
,
804 #ifdef FEAT_INS_EXPAND
805 (char_u
*)&p_cpt
, PV_CPT
,
806 {(char_u
*)".,w,b,u,t,i", (char_u
*)0L}
808 (char_u
*)NULL
, PV_NONE
,
809 {(char_u
*)0L, (char_u
*)0L}
812 {"completefunc", "cfu", P_STRING
|P_ALLOCED
|P_VI_DEF
|P_SECURE
,
813 #ifdef FEAT_COMPL_FUNC
814 (char_u
*)&p_cfu
, PV_CFU
,
815 {(char_u
*)"", (char_u
*)0L}
817 (char_u
*)NULL
, PV_NONE
,
818 {(char_u
*)0L, (char_u
*)0L}
821 {"completeopt", "cot", P_STRING
|P_VI_DEF
|P_COMMA
|P_NODUP
,
822 #ifdef FEAT_INS_EXPAND
823 (char_u
*)&p_cot
, PV_NONE
,
824 {(char_u
*)"menu,preview", (char_u
*)0L}
826 (char_u
*)NULL
, PV_NONE
,
827 {(char_u
*)0L, (char_u
*)0L}
830 {"confirm", "cf", P_BOOL
|P_VI_DEF
,
831 #if defined(FEAT_GUI_DIALOG) || defined(FEAT_CON_DIALOG)
832 (char_u
*)&p_confirm
, PV_NONE
,
834 (char_u
*)NULL
, PV_NONE
,
836 {(char_u
*)FALSE
, (char_u
*)0L}},
837 {"conskey", "consk",P_BOOL
|P_VI_DEF
,
839 (char_u
*)&p_consk
, PV_NONE
,
841 (char_u
*)NULL
, PV_NONE
,
843 {(char_u
*)FALSE
, (char_u
*)0L}},
844 {"copyindent", "ci", P_BOOL
|P_VI_DEF
|P_VIM
,
845 (char_u
*)&p_ci
, PV_CI
,
846 {(char_u
*)FALSE
, (char_u
*)0L}},
847 {"cpoptions", "cpo", P_STRING
|P_VIM
|P_RALL
|P_FLAGLIST
,
848 (char_u
*)&p_cpo
, PV_NONE
,
849 {(char_u
*)CPO_VI
, (char_u
*)CPO_VIM
}},
850 {"cscopepathcomp", "cspc", P_NUM
|P_VI_DEF
|P_VIM
,
852 (char_u
*)&p_cspc
, PV_NONE
,
854 (char_u
*)NULL
, PV_NONE
,
856 {(char_u
*)0L, (char_u
*)0L}},
857 {"cscopeprg", "csprg", P_STRING
|P_EXPAND
|P_VI_DEF
|P_SECURE
,
859 (char_u
*)&p_csprg
, PV_NONE
,
860 {(char_u
*)"cscope", (char_u
*)0L}
862 (char_u
*)NULL
, PV_NONE
,
863 {(char_u
*)0L, (char_u
*)0L}
866 {"cscopequickfix", "csqf", P_STRING
|P_VI_DEF
|P_COMMA
|P_NODUP
,
867 #if defined(FEAT_CSCOPE) && defined(FEAT_QUICKFIX)
868 (char_u
*)&p_csqf
, PV_NONE
,
869 {(char_u
*)"", (char_u
*)0L}
871 (char_u
*)NULL
, PV_NONE
,
872 {(char_u
*)0L, (char_u
*)0L}
875 {"cscopetag", "cst", P_BOOL
|P_VI_DEF
|P_VIM
,
877 (char_u
*)&p_cst
, PV_NONE
,
879 (char_u
*)NULL
, PV_NONE
,
881 {(char_u
*)0L, (char_u
*)0L}},
882 {"cscopetagorder", "csto", P_NUM
|P_VI_DEF
|P_VIM
,
884 (char_u
*)&p_csto
, PV_NONE
,
886 (char_u
*)NULL
, PV_NONE
,
888 {(char_u
*)0L, (char_u
*)0L}},
889 {"cscopeverbose", "csverb", P_BOOL
|P_VI_DEF
|P_VIM
,
891 (char_u
*)&p_csverbose
, PV_NONE
,
893 (char_u
*)NULL
, PV_NONE
,
895 {(char_u
*)0L, (char_u
*)0L}},
896 {"cursorcolumn", "cuc", P_BOOL
|P_VI_DEF
|P_RWIN
,
898 (char_u
*)VAR_WIN
, PV_CUC
,
900 (char_u
*)NULL
, PV_NONE
,
902 {(char_u
*)FALSE
, (char_u
*)0L}},
903 {"cursorline", "cul", P_BOOL
|P_VI_DEF
|P_RWIN
,
905 (char_u
*)VAR_WIN
, PV_CUL
,
907 (char_u
*)NULL
, PV_NONE
,
909 {(char_u
*)FALSE
, (char_u
*)0L}},
910 {"debug", NULL
, P_STRING
|P_VI_DEF
,
911 (char_u
*)&p_debug
, PV_NONE
,
912 {(char_u
*)"", (char_u
*)0L}},
913 {"define", "def", P_STRING
|P_ALLOCED
|P_VI_DEF
,
915 (char_u
*)&p_def
, PV_DEF
,
916 {(char_u
*)"^\\s*#\\s*define", (char_u
*)0L}
918 (char_u
*)NULL
, PV_NONE
,
919 {(char_u
*)NULL
, (char_u
*)0L}
922 {"delcombine", "deco", P_BOOL
|P_VI_DEF
|P_VIM
,
924 (char_u
*)&p_deco
, PV_NONE
,
926 (char_u
*)NULL
, PV_NONE
,
928 {(char_u
*)FALSE
, (char_u
*)0L}},
929 {"dictionary", "dict", P_STRING
|P_EXPAND
|P_VI_DEF
|P_COMMA
|P_NODUP
,
930 #ifdef FEAT_INS_EXPAND
931 (char_u
*)&p_dict
, PV_DICT
,
933 (char_u
*)NULL
, PV_NONE
,
935 {(char_u
*)"", (char_u
*)0L}},
936 {"diff", NULL
, P_BOOL
|P_VI_DEF
|P_RWIN
|P_NOGLOB
,
938 (char_u
*)VAR_WIN
, PV_DIFF
,
940 (char_u
*)NULL
, PV_NONE
,
942 {(char_u
*)FALSE
, (char_u
*)0L}},
943 {"diffexpr", "dex", P_STRING
|P_VI_DEF
|P_SECURE
,
944 #if defined(FEAT_DIFF) && defined(FEAT_EVAL)
945 (char_u
*)&p_dex
, PV_NONE
,
946 {(char_u
*)"", (char_u
*)0L}
948 (char_u
*)NULL
, PV_NONE
,
949 {(char_u
*)0L, (char_u
*)0L}
952 {"diffopt", "dip", P_STRING
|P_ALLOCED
|P_VI_DEF
|P_RWIN
|P_COMMA
|P_NODUP
,
954 (char_u
*)&p_dip
, PV_NONE
,
955 {(char_u
*)"filler", (char_u
*)NULL
}
957 (char_u
*)NULL
, PV_NONE
,
958 {(char_u
*)"", (char_u
*)NULL
}
961 {"digraph", "dg", P_BOOL
|P_VI_DEF
|P_VIM
,
963 (char_u
*)&p_dg
, PV_NONE
,
965 (char_u
*)NULL
, PV_NONE
,
967 {(char_u
*)FALSE
, (char_u
*)0L}},
968 {"directory", "dir", P_STRING
|P_EXPAND
|P_VI_DEF
|P_COMMA
|P_NODUP
|P_SECURE
,
969 (char_u
*)&p_dir
, PV_NONE
,
970 {(char_u
*)DFLT_DIR
, (char_u
*)0L}},
971 {"display", "dy", P_STRING
|P_VI_DEF
|P_COMMA
|P_RALL
|P_NODUP
,
972 (char_u
*)&p_dy
, PV_NONE
,
973 {(char_u
*)"", (char_u
*)0L}},
974 {"eadirection", "ead", P_STRING
|P_VI_DEF
,
975 #ifdef FEAT_VERTSPLIT
976 (char_u
*)&p_ead
, PV_NONE
,
977 {(char_u
*)"both", (char_u
*)0L}
979 (char_u
*)NULL
, PV_NONE
,
980 {(char_u
*)NULL
, (char_u
*)0L}
983 {"edcompatible","ed", P_BOOL
|P_VI_DEF
,
984 (char_u
*)&p_ed
, PV_NONE
,
985 {(char_u
*)FALSE
, (char_u
*)0L}},
986 {"encoding", "enc", P_STRING
|P_VI_DEF
|P_RCLR
,
988 (char_u
*)&p_enc
, PV_NONE
,
989 {(char_u
*)ENC_DFLT
, (char_u
*)0L}
991 (char_u
*)NULL
, PV_NONE
,
992 {(char_u
*)0L, (char_u
*)0L}
995 {"endofline", "eol", P_BOOL
|P_NO_MKRC
|P_VI_DEF
|P_RSTAT
,
996 (char_u
*)&p_eol
, PV_EOL
,
997 {(char_u
*)TRUE
, (char_u
*)0L}},
998 {"equalalways", "ea", P_BOOL
|P_VI_DEF
|P_RALL
,
999 (char_u
*)&p_ea
, PV_NONE
,
1000 {(char_u
*)TRUE
, (char_u
*)0L}},
1001 {"equalprg", "ep", P_STRING
|P_EXPAND
|P_VI_DEF
|P_SECURE
,
1002 (char_u
*)&p_ep
, PV_EP
,
1003 {(char_u
*)"", (char_u
*)0L}},
1004 {"errorbells", "eb", P_BOOL
|P_VI_DEF
,
1005 (char_u
*)&p_eb
, PV_NONE
,
1006 {(char_u
*)FALSE
, (char_u
*)0L}},
1007 {"errorfile", "ef", P_STRING
|P_EXPAND
|P_VI_DEF
|P_SECURE
,
1008 #ifdef FEAT_QUICKFIX
1009 (char_u
*)&p_ef
, PV_NONE
,
1010 {(char_u
*)DFLT_ERRORFILE
, (char_u
*)0L}
1012 (char_u
*)NULL
, PV_NONE
,
1013 {(char_u
*)NULL
, (char_u
*)0L}
1016 {"errorformat", "efm", P_STRING
|P_VI_DEF
|P_COMMA
|P_NODUP
,
1017 #ifdef FEAT_QUICKFIX
1018 (char_u
*)&p_efm
, PV_EFM
,
1019 {(char_u
*)DFLT_EFM
, (char_u
*)0L},
1021 (char_u
*)NULL
, PV_NONE
,
1022 {(char_u
*)NULL
, (char_u
*)0L}
1025 {"esckeys", "ek", P_BOOL
|P_VIM
,
1026 (char_u
*)&p_ek
, PV_NONE
,
1027 {(char_u
*)FALSE
, (char_u
*)TRUE
}},
1028 {"eventignore", "ei", P_STRING
|P_VI_DEF
|P_COMMA
|P_NODUP
,
1030 (char_u
*)&p_ei
, PV_NONE
,
1032 (char_u
*)NULL
, PV_NONE
,
1034 {(char_u
*)"", (char_u
*)0L}},
1035 {"expandtab", "et", P_BOOL
|P_VI_DEF
|P_VIM
,
1036 (char_u
*)&p_et
, PV_ET
,
1037 {(char_u
*)FALSE
, (char_u
*)0L}},
1038 {"exrc", "ex", P_BOOL
|P_VI_DEF
|P_SECURE
,
1039 (char_u
*)&p_exrc
, PV_NONE
,
1040 {(char_u
*)FALSE
, (char_u
*)0L}},
1041 {"fileencoding","fenc", P_STRING
|P_ALLOCED
|P_VI_DEF
|P_RSTAT
|P_RBUF
|P_NO_MKRC
,
1043 (char_u
*)&p_fenc
, PV_FENC
,
1044 {(char_u
*)"", (char_u
*)0L}
1046 (char_u
*)NULL
, PV_NONE
,
1047 {(char_u
*)0L, (char_u
*)0L}
1050 {"fileencodings","fencs", P_STRING
|P_VI_DEF
|P_COMMA
,
1052 (char_u
*)&p_fencs
, PV_NONE
,
1053 {(char_u
*)"ucs-bom", (char_u
*)0L}
1055 (char_u
*)NULL
, PV_NONE
,
1056 {(char_u
*)0L, (char_u
*)0L}
1059 {"fileformat", "ff", P_STRING
|P_ALLOCED
|P_VI_DEF
|P_RSTAT
|P_NO_MKRC
,
1060 (char_u
*)&p_ff
, PV_FF
,
1061 {(char_u
*)DFLT_FF
, (char_u
*)0L}},
1062 {"fileformats", "ffs", P_STRING
|P_VIM
|P_COMMA
|P_NODUP
,
1063 (char_u
*)&p_ffs
, PV_NONE
,
1064 {(char_u
*)DFLT_FFS_VI
, (char_u
*)DFLT_FFS_VIM
}},
1065 {"filetype", "ft", P_STRING
|P_ALLOCED
|P_VI_DEF
|P_NOGLOB
|P_NFNAME
,
1067 (char_u
*)&p_ft
, PV_FT
,
1068 {(char_u
*)"", (char_u
*)0L}
1070 (char_u
*)NULL
, PV_NONE
,
1071 {(char_u
*)0L, (char_u
*)0L}
1074 {"fillchars", "fcs", P_STRING
|P_VI_DEF
|P_RALL
|P_COMMA
|P_NODUP
,
1075 #if defined(FEAT_WINDOWS) || defined(FEAT_FOLDING)
1076 (char_u
*)&p_fcs
, PV_NONE
,
1077 {(char_u
*)"vert:|,fold:-", (char_u
*)0L}
1079 (char_u
*)NULL
, PV_NONE
,
1080 {(char_u
*)"", (char_u
*)0L}
1083 {"fkmap", "fk", P_BOOL
|P_VI_DEF
,
1085 (char_u
*)&p_fkmap
, PV_NONE
,
1087 (char_u
*)NULL
, PV_NONE
,
1089 {(char_u
*)FALSE
, (char_u
*)0L}},
1090 {"flash", "fl", P_BOOL
|P_VI_DEF
,
1091 (char_u
*)NULL
, PV_NONE
,
1092 {(char_u
*)FALSE
, (char_u
*)0L}},
1094 {"foldclose", "fcl", P_STRING
|P_VI_DEF
|P_COMMA
|P_NODUP
|P_RWIN
,
1095 (char_u
*)&p_fcl
, PV_NONE
,
1096 {(char_u
*)"", (char_u
*)0L}},
1097 {"foldcolumn", "fdc", P_NUM
|P_VI_DEF
|P_RWIN
,
1098 (char_u
*)VAR_WIN
, PV_FDC
,
1099 {(char_u
*)FALSE
, (char_u
*)0L}},
1100 {"foldenable", "fen", P_BOOL
|P_VI_DEF
|P_RWIN
,
1101 (char_u
*)VAR_WIN
, PV_FEN
,
1102 {(char_u
*)TRUE
, (char_u
*)0L}},
1103 {"foldexpr", "fde", P_STRING
|P_ALLOCED
|P_VIM
|P_VI_DEF
|P_RWIN
,
1105 (char_u
*)VAR_WIN
, PV_FDE
,
1106 {(char_u
*)"0", (char_u
*)NULL
}
1108 (char_u
*)NULL
, PV_NONE
,
1109 {(char_u
*)NULL
, (char_u
*)0L}
1112 {"foldignore", "fdi", P_STRING
|P_ALLOCED
|P_VIM
|P_VI_DEF
|P_RWIN
,
1113 (char_u
*)VAR_WIN
, PV_FDI
,
1114 {(char_u
*)"#", (char_u
*)NULL
}},
1115 {"foldlevel", "fdl", P_NUM
|P_VI_DEF
|P_RWIN
,
1116 (char_u
*)VAR_WIN
, PV_FDL
,
1117 {(char_u
*)0L, (char_u
*)0L}},
1118 {"foldlevelstart","fdls", P_NUM
|P_VI_DEF
,
1119 (char_u
*)&p_fdls
, PV_NONE
,
1120 {(char_u
*)-1L, (char_u
*)0L}},
1121 {"foldmarker", "fmr", P_STRING
|P_ALLOCED
|P_VIM
|P_VI_DEF
|
1122 P_RWIN
|P_COMMA
|P_NODUP
,
1123 (char_u
*)VAR_WIN
, PV_FMR
,
1124 {(char_u
*)"{{{,}}}", (char_u
*)NULL
}},
1125 {"foldmethod", "fdm", P_STRING
|P_ALLOCED
|P_VIM
|P_VI_DEF
|P_RWIN
,
1126 (char_u
*)VAR_WIN
, PV_FDM
,
1127 {(char_u
*)"manual", (char_u
*)NULL
}},
1128 {"foldminlines","fml", P_NUM
|P_VI_DEF
|P_RWIN
,
1129 (char_u
*)VAR_WIN
, PV_FML
,
1130 {(char_u
*)1L, (char_u
*)0L}},
1131 {"foldnestmax", "fdn", P_NUM
|P_VI_DEF
|P_RWIN
,
1132 (char_u
*)VAR_WIN
, PV_FDN
,
1133 {(char_u
*)20L, (char_u
*)0L}},
1134 {"foldopen", "fdo", P_STRING
|P_VI_DEF
|P_COMMA
|P_NODUP
,
1135 (char_u
*)&p_fdo
, PV_NONE
,
1136 {(char_u
*)"block,hor,mark,percent,quickfix,search,tag,undo",
1138 {"foldtext", "fdt", P_STRING
|P_ALLOCED
|P_VIM
|P_VI_DEF
|P_RWIN
,
1140 (char_u
*)VAR_WIN
, PV_FDT
,
1141 {(char_u
*)"foldtext()", (char_u
*)NULL
}
1143 (char_u
*)NULL
, PV_NONE
,
1144 {(char_u
*)NULL
, (char_u
*)0L}
1148 {"formatexpr", "fex", P_STRING
|P_ALLOCED
|P_VI_DEF
|P_VIM
,
1150 (char_u
*)&p_fex
, PV_FEX
,
1151 {(char_u
*)"", (char_u
*)0L}
1153 (char_u
*)NULL
, PV_NONE
,
1154 {(char_u
*)0L, (char_u
*)0L}
1157 {"formatoptions","fo", P_STRING
|P_ALLOCED
|P_VIM
|P_FLAGLIST
,
1158 (char_u
*)&p_fo
, PV_FO
,
1159 {(char_u
*)DFLT_FO_VI
, (char_u
*)DFLT_FO_VIM
}},
1160 {"formatlistpat","flp", P_STRING
|P_ALLOCED
|P_VI_DEF
,
1161 (char_u
*)&p_flp
, PV_FLP
,
1162 {(char_u
*)"^\\s*\\d\\+[\\]:.)}\\t ]\\s*", (char_u
*)0L}},
1163 {"formatprg", "fp", P_STRING
|P_EXPAND
|P_VI_DEF
|P_SECURE
,
1164 (char_u
*)&p_fp
, PV_NONE
,
1165 {(char_u
*)"", (char_u
*)0L}},
1166 {"fsync", "fs", P_BOOL
|P_SECURE
|P_VI_DEF
,
1168 (char_u
*)&p_fs
, PV_NONE
,
1169 {(char_u
*)TRUE
, (char_u
*)0L}
1171 (char_u
*)NULL
, PV_NONE
,
1172 {(char_u
*)FALSE
, (char_u
*)0L}
1175 {"fullscreen", "fu", P_BOOL
|P_NO_MKRC
,
1176 #ifdef FEAT_FULLSCREEN
1177 (char_u
*)&p_fullscreen
, PV_NONE
,
1179 (char_u
*)NULL
, PV_NONE
,
1181 {(char_u
*)FALSE
, (char_u
*)0L}},
1182 {"fuoptions", "fuopt", P_STRING
|P_COMMA
|P_NODUP
|P_VI_DEF
,
1183 #ifdef FEAT_FULLSCREEN
1184 (char_u
*)&p_fuoptions
, PV_NONE
,
1185 {(char_u
*)"maxvert", (char_u
*)0L}},
1187 (char_u
*)NULL
, PV_NONE
,
1188 {(char_u
*)NULL
, (char_u
*)0L}},
1190 {"gdefault", "gd", P_BOOL
|P_VI_DEF
|P_VIM
,
1191 (char_u
*)&p_gd
, PV_NONE
,
1192 {(char_u
*)FALSE
, (char_u
*)0L}},
1193 {"graphic", "gr", P_BOOL
|P_VI_DEF
,
1194 (char_u
*)NULL
, PV_NONE
,
1195 {(char_u
*)FALSE
, (char_u
*)0L}},
1196 {"grepformat", "gfm", P_STRING
|P_VI_DEF
|P_COMMA
|P_NODUP
,
1197 #ifdef FEAT_QUICKFIX
1198 (char_u
*)&p_gefm
, PV_NONE
,
1199 {(char_u
*)DFLT_GREPFORMAT
, (char_u
*)0L},
1201 (char_u
*)NULL
, PV_NONE
,
1202 {(char_u
*)NULL
, (char_u
*)0L}
1205 {"grepprg", "gp", P_STRING
|P_EXPAND
|P_VI_DEF
|P_SECURE
,
1206 #ifdef FEAT_QUICKFIX
1207 (char_u
*)&p_gp
, PV_GP
,
1210 /* may be changed to "grep -n" in os_win32.c */
1211 (char_u
*)"findstr /n",
1214 /* Add an extra file name so that grep will always
1215 * insert a file name in the match line. */
1216 (char_u
*)"grep -n $* /dev/null",
1219 (char_u
*)"SEARCH/NUMBERS ",
1221 (char_u
*)"grep -n ",
1227 (char_u
*)NULL
, PV_NONE
,
1228 {(char_u
*)NULL
, (char_u
*)0L}
1231 {"guicursor", "gcr", P_STRING
|P_VI_DEF
|P_COMMA
|P_NODUP
,
1233 (char_u
*)&p_guicursor
, PV_NONE
,
1236 (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",
1237 # else /* MSDOS or Win32 console */
1238 (char_u
*)"n-v-c:block,o:hor50,i-ci:hor15,r-cr:hor30,sm:block",
1242 (char_u
*)NULL
, PV_NONE
,
1243 {(char_u
*)NULL
, (char_u
*)0L}
1246 {"guifont", "gfn", P_STRING
|P_VI_DEF
|P_RCLR
|P_COMMA
|P_NODUP
,
1248 (char_u
*)&p_guifont
, PV_NONE
,
1249 {(char_u
*)"", (char_u
*)0L}
1251 (char_u
*)NULL
, PV_NONE
,
1252 {(char_u
*)NULL
, (char_u
*)0L}
1255 {"guifontset", "gfs", P_STRING
|P_VI_DEF
|P_RCLR
|P_COMMA
,
1256 #if defined(FEAT_GUI) && defined(FEAT_XFONTSET)
1257 (char_u
*)&p_guifontset
, PV_NONE
,
1258 {(char_u
*)"", (char_u
*)0L}
1260 (char_u
*)NULL
, PV_NONE
,
1261 {(char_u
*)NULL
, (char_u
*)0L}
1264 {"guifontwide", "gfw", P_STRING
|P_VI_DEF
|P_RCLR
|P_COMMA
|P_NODUP
,
1265 #if defined(FEAT_GUI) && defined(FEAT_MBYTE)
1266 (char_u
*)&p_guifontwide
, PV_NONE
,
1267 {(char_u
*)"", (char_u
*)0L}
1269 (char_u
*)NULL
, PV_NONE
,
1270 {(char_u
*)NULL
, (char_u
*)0L}
1273 {"guiheadroom", "ghr", P_NUM
|P_VI_DEF
,
1274 #if defined(FEAT_GUI_GTK) || defined(FEAT_GUI_X11)
1275 (char_u
*)&p_ghr
, PV_NONE
,
1277 (char_u
*)NULL
, PV_NONE
,
1279 {(char_u
*)50L, (char_u
*)0L}},
1280 {"guioptions", "go", P_STRING
|P_VI_DEF
|P_RALL
|P_FLAGLIST
,
1281 #if defined(FEAT_GUI)
1282 (char_u
*)&p_go
, PV_NONE
,
1283 # if defined(UNIX) && !defined(MACOS)
1284 {(char_u
*)"aegimrLtT", (char_u
*)0L}
1286 {(char_u
*)"egmrLtT", (char_u
*)0L}
1289 (char_u
*)NULL
, PV_NONE
,
1290 {(char_u
*)NULL
, (char_u
*)0L}
1293 {"guipty", NULL
, P_BOOL
|P_VI_DEF
,
1294 #if defined(FEAT_GUI)
1295 (char_u
*)&p_guipty
, PV_NONE
,
1297 (char_u
*)NULL
, PV_NONE
,
1299 {(char_u
*)TRUE
, (char_u
*)0L}},
1300 {"guitablabel", "gtl", P_STRING
|P_VI_DEF
|P_RWIN
,
1301 #if defined(FEAT_GUI_TABLINE)
1302 (char_u
*)&p_gtl
, PV_NONE
,
1303 {(char_u
*)"", (char_u
*)0L}
1305 (char_u
*)NULL
, PV_NONE
,
1306 {(char_u
*)NULL
, (char_u
*)0L}
1309 {"guitabtooltip", "gtt", P_STRING
|P_VI_DEF
|P_RWIN
,
1310 #if defined(FEAT_GUI_TABLINE)
1311 (char_u
*)&p_gtt
, PV_NONE
,
1312 {(char_u
*)"", (char_u
*)0L}
1314 (char_u
*)NULL
, PV_NONE
,
1315 {(char_u
*)NULL
, (char_u
*)0L}
1318 {"hardtabs", "ht", P_NUM
|P_VI_DEF
,
1319 (char_u
*)NULL
, PV_NONE
,
1320 {(char_u
*)0L, (char_u
*)0L}},
1321 {"helpfile", "hf", P_STRING
|P_EXPAND
|P_VI_DEF
|P_SECURE
,
1322 (char_u
*)&p_hf
, PV_NONE
,
1323 {(char_u
*)DFLT_HELPFILE
, (char_u
*)0L}},
1324 {"helpheight", "hh", P_NUM
|P_VI_DEF
,
1326 (char_u
*)&p_hh
, PV_NONE
,
1328 (char_u
*)NULL
, PV_NONE
,
1330 {(char_u
*)20L, (char_u
*)0L}},
1331 {"helplang", "hlg", P_STRING
|P_VI_DEF
|P_COMMA
,
1332 #ifdef FEAT_MULTI_LANG
1333 (char_u
*)&p_hlg
, PV_NONE
,
1334 {(char_u
*)"", (char_u
*)0L}
1336 (char_u
*)NULL
, PV_NONE
,
1337 {(char_u
*)0L, (char_u
*)0L}
1340 {"hidden", "hid", P_BOOL
|P_VI_DEF
,
1341 (char_u
*)&p_hid
, PV_NONE
,
1342 {(char_u
*)FALSE
, (char_u
*)0L}},
1343 {"highlight", "hl", P_STRING
|P_VI_DEF
|P_RCLR
|P_COMMA
|P_NODUP
,
1344 (char_u
*)&p_hl
, PV_NONE
,
1345 {(char_u
*)HIGHLIGHT_INIT
, (char_u
*)0L}},
1346 {"history", "hi", P_NUM
|P_VIM
,
1347 (char_u
*)&p_hi
, PV_NONE
,
1348 {(char_u
*)0L, (char_u
*)20L}},
1349 {"hkmap", "hk", P_BOOL
|P_VI_DEF
|P_VIM
,
1350 #ifdef FEAT_RIGHTLEFT
1351 (char_u
*)&p_hkmap
, PV_NONE
,
1353 (char_u
*)NULL
, PV_NONE
,
1355 {(char_u
*)FALSE
, (char_u
*)0L}},
1356 {"hkmapp", "hkp", P_BOOL
|P_VI_DEF
|P_VIM
,
1357 #ifdef FEAT_RIGHTLEFT
1358 (char_u
*)&p_hkmapp
, PV_NONE
,
1360 (char_u
*)NULL
, PV_NONE
,
1362 {(char_u
*)FALSE
, (char_u
*)0L}},
1363 {"hlsearch", "hls", P_BOOL
|P_VI_DEF
|P_VIM
|P_RALL
,
1364 (char_u
*)&p_hls
, PV_NONE
,
1365 {(char_u
*)FALSE
, (char_u
*)0L}},
1366 {"icon", NULL
, P_BOOL
|P_VI_DEF
,
1368 (char_u
*)&p_icon
, PV_NONE
,
1370 (char_u
*)NULL
, PV_NONE
,
1372 {(char_u
*)FALSE
, (char_u
*)0L}},
1373 {"iconstring", NULL
, P_STRING
|P_VI_DEF
,
1375 (char_u
*)&p_iconstring
, PV_NONE
,
1377 (char_u
*)NULL
, PV_NONE
,
1379 {(char_u
*)"", (char_u
*)0L}},
1380 {"ignorecase", "ic", P_BOOL
|P_VI_DEF
,
1381 (char_u
*)&p_ic
, PV_NONE
,
1382 {(char_u
*)FALSE
, (char_u
*)0L}},
1383 {"imactivatekey","imak",P_STRING
|P_VI_DEF
,
1384 #if defined(FEAT_XIM) && defined(FEAT_GUI_GTK)
1385 (char_u
*)&p_imak
, PV_NONE
,
1387 (char_u
*)NULL
, PV_NONE
,
1389 {(char_u
*)"", (char_u
*)0L}},
1390 {"imcmdline", "imc", P_BOOL
|P_VI_DEF
,
1391 #ifdef USE_IM_CONTROL
1392 (char_u
*)&p_imcmdline
, PV_NONE
,
1394 (char_u
*)NULL
, PV_NONE
,
1396 {(char_u
*)FALSE
, (char_u
*)0L}},
1397 {"imdisable", "imd", P_BOOL
|P_VI_DEF
,
1398 #ifdef USE_IM_CONTROL
1399 (char_u
*)&p_imdisable
, PV_NONE
,
1401 (char_u
*)NULL
, PV_NONE
,
1403 #if defined(__sgi) || defined(FEAT_GUI_MACVIM)
1404 {(char_u
*)TRUE
, (char_u
*)0L}
1406 {(char_u
*)FALSE
, (char_u
*)0L}
1409 {"iminsert", "imi", P_NUM
|P_VI_DEF
,
1410 (char_u
*)&p_iminsert
, PV_IMI
,
1412 {(char_u
*)B_IMODE_IM
, (char_u
*)0L}
1414 {(char_u
*)B_IMODE_NONE
, (char_u
*)0L}
1417 {"imsearch", "ims", P_NUM
|P_VI_DEF
,
1418 (char_u
*)&p_imsearch
, PV_IMS
,
1420 {(char_u
*)B_IMODE_IM
, (char_u
*)0L}
1422 {(char_u
*)B_IMODE_NONE
, (char_u
*)0L}
1425 {"include", "inc", P_STRING
|P_ALLOCED
|P_VI_DEF
,
1427 (char_u
*)&p_inc
, PV_INC
,
1428 {(char_u
*)"^\\s*#\\s*include", (char_u
*)0L}
1430 (char_u
*)NULL
, PV_NONE
,
1431 {(char_u
*)0L, (char_u
*)0L}
1434 {"includeexpr", "inex", P_STRING
|P_ALLOCED
|P_VI_DEF
,
1435 #if defined(FEAT_FIND_ID) && defined(FEAT_EVAL)
1436 (char_u
*)&p_inex
, PV_INEX
,
1437 {(char_u
*)"", (char_u
*)0L}
1439 (char_u
*)NULL
, PV_NONE
,
1440 {(char_u
*)0L, (char_u
*)0L}
1443 {"incsearch", "is", P_BOOL
|P_VI_DEF
|P_VIM
,
1444 (char_u
*)&p_is
, PV_NONE
,
1445 {(char_u
*)FALSE
, (char_u
*)0L}},
1446 {"indentexpr", "inde", P_STRING
|P_ALLOCED
|P_VI_DEF
|P_VIM
,
1447 #if defined(FEAT_CINDENT) && defined(FEAT_EVAL)
1448 (char_u
*)&p_inde
, PV_INDE
,
1449 {(char_u
*)"", (char_u
*)0L}
1451 (char_u
*)NULL
, PV_NONE
,
1452 {(char_u
*)0L, (char_u
*)0L}
1455 {"indentkeys", "indk", P_STRING
|P_ALLOCED
|P_VI_DEF
|P_COMMA
|P_NODUP
,
1456 #if defined(FEAT_CINDENT) && defined(FEAT_EVAL)
1457 (char_u
*)&p_indk
, PV_INDK
,
1458 {(char_u
*)"0{,0},:,0#,!^F,o,O,e", (char_u
*)0L}
1460 (char_u
*)NULL
, PV_NONE
,
1461 {(char_u
*)0L, (char_u
*)0L}
1464 {"infercase", "inf", P_BOOL
|P_VI_DEF
,
1465 (char_u
*)&p_inf
, PV_INF
,
1466 {(char_u
*)FALSE
, (char_u
*)0L}},
1467 {"insertmode", "im", P_BOOL
|P_VI_DEF
|P_VIM
,
1468 (char_u
*)&p_im
, PV_NONE
,
1469 {(char_u
*)FALSE
, (char_u
*)0L}},
1470 {"isfname", "isf", P_STRING
|P_VI_DEF
|P_COMMA
|P_NODUP
,
1471 (char_u
*)&p_isf
, PV_NONE
,
1473 #ifdef BACKSLASH_IN_FILENAME
1474 /* Excluded are: & and ^ are special in cmd.exe
1475 * ( and ) are used in text separating fnames */
1476 (char_u
*)"@,48-57,/,\\,.,-,_,+,,,#,$,%,{,},[,],:,@-@,!,~,=",
1479 (char_u
*)"@,48-57,/,.,-,_,+,,,$,:",
1482 (char_u
*)"@,48-57,/,.,-,_,+,,,#,$,%,<,>,[,],:,;,~",
1483 # else /* UNIX et al. */
1485 (char_u
*)"@,240-249,/,.,-,_,+,,,#,$,%,~,=",
1487 (char_u
*)"@,48-57,/,.,-,_,+,,,#,$,%,~,=",
1493 {"isident", "isi", P_STRING
|P_VI_DEF
|P_COMMA
|P_NODUP
,
1494 (char_u
*)&p_isi
, PV_NONE
,
1496 #if defined(MSDOS) || defined(MSWIN) || defined(OS2)
1497 (char_u
*)"@,48-57,_,128-167,224-235",
1500 /* TODO: EBCDIC Check this! @ == isalpha()*/
1501 (char_u
*)"@,240-249,_,66-73,81-89,98-105,"
1502 "112-120,128,140-142,156,158,172,"
1503 "174,186,191,203-207,219-225,235-239,"
1506 (char_u
*)"@,48-57,_,192-255",
1510 {"iskeyword", "isk", P_STRING
|P_ALLOCED
|P_VIM
|P_COMMA
|P_NODUP
,
1511 (char_u
*)&p_isk
, PV_ISK
,
1514 (char_u
*)"@,240-249,_",
1515 /* TODO: EBCDIC Check this! @ == isalpha()*/
1516 (char_u
*)"@,240-249,_,66-73,81-89,98-105,"
1517 "112-120,128,140-142,156,158,172,"
1518 "174,186,191,203-207,219-225,235-239,"
1521 (char_u
*)"@,48-57,_",
1522 # if defined(MSDOS) || defined(MSWIN) || defined(OS2)
1523 (char_u
*)"@,48-57,_,128-167,224-235"
1529 {"isprint", "isp", P_STRING
|P_VI_DEF
|P_RALL
|P_COMMA
|P_NODUP
,
1530 (char_u
*)&p_isp
, PV_NONE
,
1532 #if defined(MSDOS) || defined(MSWIN) || defined(OS2) \
1533 || (defined(MACOS) && !defined(MACOS_X)) \
1535 (char_u
*)"@,~-255",
1538 /* all chars above 63 are printable */
1545 {"joinspaces", "js", P_BOOL
|P_VI_DEF
|P_VIM
,
1546 (char_u
*)&p_js
, PV_NONE
,
1547 {(char_u
*)TRUE
, (char_u
*)0L}},
1548 {"key", NULL
, P_STRING
|P_ALLOCED
|P_VI_DEF
|P_NO_MKRC
,
1550 (char_u
*)&p_key
, PV_KEY
,
1551 {(char_u
*)"", (char_u
*)0L}
1553 (char_u
*)NULL
, PV_NONE
,
1554 {(char_u
*)0L, (char_u
*)0L}
1557 {"keymap", "kmp", P_STRING
|P_ALLOCED
|P_VI_DEF
|P_RBUF
|P_RSTAT
|P_NFNAME
|P_PRI_MKRC
,
1559 (char_u
*)&p_keymap
, PV_KMAP
,
1560 {(char_u
*)"", (char_u
*)0L}
1562 (char_u
*)NULL
, PV_NONE
,
1563 {(char_u
*)"", (char_u
*)0L}
1566 {"keymodel", "km", P_STRING
|P_VI_DEF
|P_COMMA
|P_NODUP
,
1568 (char_u
*)&p_km
, PV_NONE
,
1570 (char_u
*)NULL
, PV_NONE
,
1572 {(char_u
*)"", (char_u
*)0L}},
1573 {"keywordprg", "kp", P_STRING
|P_EXPAND
|P_VI_DEF
|P_SECURE
,
1574 (char_u
*)&p_kp
, PV_KP
,
1576 #if defined(MSDOS) || defined(MSWIN)
1594 {"langmap", "lmap", P_STRING
|P_VI_DEF
|P_COMMA
|P_NODUP
,
1596 (char_u
*)&p_langmap
, PV_NONE
,
1597 {(char_u
*)"", /* unmatched } */
1599 (char_u
*)NULL
, PV_NONE
,
1603 {"langmenu", "lm", P_STRING
|P_VI_DEF
|P_NFNAME
,
1604 #if defined(FEAT_MENU) && defined(FEAT_MULTI_LANG)
1605 (char_u
*)&p_lm
, PV_NONE
,
1607 (char_u
*)NULL
, PV_NONE
,
1609 {(char_u
*)"", (char_u
*)0L}},
1610 {"laststatus", "ls", P_NUM
|P_VI_DEF
|P_RALL
,
1612 (char_u
*)&p_ls
, PV_NONE
,
1614 (char_u
*)NULL
, PV_NONE
,
1616 {(char_u
*)1L, (char_u
*)0L}},
1617 {"lazyredraw", "lz", P_BOOL
|P_VI_DEF
,
1618 (char_u
*)&p_lz
, PV_NONE
,
1619 {(char_u
*)FALSE
, (char_u
*)0L}},
1620 {"linebreak", "lbr", P_BOOL
|P_VI_DEF
|P_RWIN
,
1621 #ifdef FEAT_LINEBREAK
1622 (char_u
*)VAR_WIN
, PV_LBR
,
1624 (char_u
*)NULL
, PV_NONE
,
1626 {(char_u
*)FALSE
, (char_u
*)0L}},
1627 {"lines", NULL
, P_NUM
|P_NODEFAULT
|P_NO_MKRC
|P_VI_DEF
|P_RCLR
,
1628 (char_u
*)&Rows
, PV_NONE
,
1630 #if defined(MSDOS) || defined(WIN3264) || defined(OS2)
1636 {"linespace", "lsp", P_NUM
|P_VI_DEF
|P_RCLR
,
1638 (char_u
*)&p_linespace
, PV_NONE
,
1640 (char_u
*)NULL
, PV_NONE
,
1643 {(char_u
*)1L, (char_u
*)0L}
1645 {(char_u
*)0L, (char_u
*)0L}
1648 {"lisp", NULL
, P_BOOL
|P_VI_DEF
,
1650 (char_u
*)&p_lisp
, PV_LISP
,
1652 (char_u
*)NULL
, PV_NONE
,
1654 {(char_u
*)FALSE
, (char_u
*)0L}},
1655 {"lispwords", "lw", P_STRING
|P_VI_DEF
|P_COMMA
|P_NODUP
,
1657 (char_u
*)&p_lispwords
, PV_NONE
,
1658 {(char_u
*)LISPWORD_VALUE
, (char_u
*)0L}
1660 (char_u
*)NULL
, PV_NONE
,
1661 {(char_u
*)"", (char_u
*)0L}
1664 {"list", NULL
, P_BOOL
|P_VI_DEF
|P_RWIN
,
1665 (char_u
*)VAR_WIN
, PV_LIST
,
1666 {(char_u
*)FALSE
, (char_u
*)0L}},
1667 {"listchars", "lcs", P_STRING
|P_VI_DEF
|P_RALL
|P_COMMA
|P_NODUP
,
1668 (char_u
*)&p_lcs
, PV_NONE
,
1669 {(char_u
*)"eol:$", (char_u
*)0L}},
1670 {"loadplugins", "lpl", P_BOOL
|P_VI_DEF
,
1671 (char_u
*)&p_lpl
, PV_NONE
,
1672 {(char_u
*)TRUE
, (char_u
*)0L}},
1674 {"macatsui", NULL
, P_BOOL
|P_VI_DEF
|P_RCLR
,
1675 (char_u
*)&p_macatsui
, PV_NONE
,
1676 {(char_u
*)TRUE
, (char_u
*)0L}},
1678 {"macmeta", "mmta", P_BOOL
|P_VI_DEF
,
1679 #ifdef FEAT_GUI_MACVIM
1680 (char_u
*)&p_mmta
, PV_MMTA
,
1682 (char_u
*)NULL
, PV_NONE
,
1684 {(char_u
*)FALSE
, (char_u
*)0L}},
1685 {"magic", NULL
, P_BOOL
|P_VI_DEF
,
1686 (char_u
*)&p_magic
, PV_NONE
,
1687 {(char_u
*)TRUE
, (char_u
*)0L}},
1688 {"makeef", "mef", P_STRING
|P_EXPAND
|P_VI_DEF
|P_SECURE
,
1689 #ifdef FEAT_QUICKFIX
1690 (char_u
*)&p_mef
, PV_NONE
,
1691 {(char_u
*)"", (char_u
*)0L}
1693 (char_u
*)NULL
, PV_NONE
,
1694 {(char_u
*)NULL
, (char_u
*)0L}
1697 {"makeprg", "mp", P_STRING
|P_EXPAND
|P_VI_DEF
|P_SECURE
,
1698 #ifdef FEAT_QUICKFIX
1699 (char_u
*)&p_mp
, PV_MP
,
1701 {(char_u
*)"MMS", (char_u
*)0L}
1703 {(char_u
*)"make", (char_u
*)0L}
1706 (char_u
*)NULL
, PV_NONE
,
1707 {(char_u
*)NULL
, (char_u
*)0L}
1710 {"matchpairs", "mps", P_STRING
|P_ALLOCED
|P_VI_DEF
|P_COMMA
|P_NODUP
,
1711 (char_u
*)&p_mps
, PV_MPS
,
1712 {(char_u
*)"(:),{:},[:]", (char_u
*)0L}},
1713 {"matchtime", "mat", P_NUM
|P_VI_DEF
,
1714 (char_u
*)&p_mat
, PV_NONE
,
1715 {(char_u
*)5L, (char_u
*)0L}},
1716 {"maxcombine", "mco", P_NUM
|P_VI_DEF
,
1718 (char_u
*)&p_mco
, PV_NONE
,
1720 (char_u
*)NULL
, PV_NONE
,
1722 {(char_u
*)2, (char_u
*)0L}},
1723 {"maxfuncdepth", "mfd", P_NUM
|P_VI_DEF
,
1725 (char_u
*)&p_mfd
, PV_NONE
,
1727 (char_u
*)NULL
, PV_NONE
,
1729 {(char_u
*)100L, (char_u
*)0L}},
1730 {"maxmapdepth", "mmd", P_NUM
|P_VI_DEF
,
1731 (char_u
*)&p_mmd
, PV_NONE
,
1732 {(char_u
*)1000L, (char_u
*)0L}},
1733 {"maxmem", "mm", P_NUM
|P_VI_DEF
,
1734 (char_u
*)&p_mm
, PV_NONE
,
1735 {(char_u
*)DFLT_MAXMEM
, (char_u
*)0L}},
1736 {"maxmempattern","mmp", P_NUM
|P_VI_DEF
,
1737 (char_u
*)&p_mmp
, PV_NONE
,
1738 {(char_u
*)1000L, (char_u
*)0L}},
1739 {"maxmemtot", "mmt", P_NUM
|P_VI_DEF
,
1740 (char_u
*)&p_mmt
, PV_NONE
,
1741 {(char_u
*)DFLT_MAXMEMTOT
, (char_u
*)0L}},
1742 {"menuitems", "mis", P_NUM
|P_VI_DEF
,
1744 (char_u
*)&p_mis
, PV_NONE
,
1746 (char_u
*)NULL
, PV_NONE
,
1748 {(char_u
*)25L, (char_u
*)0L}},
1749 {"mesg", NULL
, P_BOOL
|P_VI_DEF
,
1750 (char_u
*)NULL
, PV_NONE
,
1751 {(char_u
*)FALSE
, (char_u
*)0L}},
1753 {"migemo", "mgm", P_BOOL
|P_VI_DEF
|P_VIM
,
1754 (char_u
*)&p_migemo
, PV_MIG
,
1755 {(char_u
*)FALSE
, (char_u
*)0L}},
1756 {"migemodict", "mgd", P_STRING
|P_EXPAND
|P_VI_DEF
|P_VIM
,
1757 (char_u
*)&p_migdict
, PV_NONE
,
1758 {(char_u
*)"", (char_u
*)0L}},
1759 #endif /* USE_MIGEMO */
1760 {"mkspellmem", "msm", P_STRING
|P_VI_DEF
|P_EXPAND
|P_SECURE
,
1762 (char_u
*)&p_msm
, PV_NONE
,
1763 {(char_u
*)"460000,2000,500", (char_u
*)0L}
1765 (char_u
*)NULL
, PV_NONE
,
1766 {(char_u
*)0L, (char_u
*)0L}
1769 {"modeline", "ml", P_BOOL
|P_VIM
,
1770 (char_u
*)&p_ml
, PV_ML
,
1771 {(char_u
*)FALSE
, (char_u
*)TRUE
}},
1772 {"modelines", "mls", P_NUM
|P_VI_DEF
,
1773 (char_u
*)&p_mls
, PV_NONE
,
1774 {(char_u
*)5L, (char_u
*)0L}},
1775 {"modifiable", "ma", P_BOOL
|P_VI_DEF
|P_NOGLOB
,
1776 (char_u
*)&p_ma
, PV_MA
,
1777 {(char_u
*)TRUE
, (char_u
*)0L}},
1778 {"modified", "mod", P_BOOL
|P_NO_MKRC
|P_VI_DEF
|P_RSTAT
,
1779 (char_u
*)&p_mod
, PV_MOD
,
1780 {(char_u
*)FALSE
, (char_u
*)0L}},
1781 {"more", NULL
, P_BOOL
|P_VIM
,
1782 (char_u
*)&p_more
, PV_NONE
,
1783 {(char_u
*)FALSE
, (char_u
*)TRUE
}},
1784 {"mouse", NULL
, P_STRING
|P_VI_DEF
|P_FLAGLIST
,
1785 (char_u
*)&p_mouse
, PV_NONE
,
1787 #if defined(MSDOS) || defined(WIN3264)
1793 {"mousefocus", "mousef", P_BOOL
|P_VI_DEF
,
1795 (char_u
*)&p_mousef
, PV_NONE
,
1797 (char_u
*)NULL
, PV_NONE
,
1799 {(char_u
*)FALSE
, (char_u
*)0L}},
1800 {"mousehide", "mh", P_BOOL
|P_VI_DEF
,
1802 (char_u
*)&p_mh
, PV_NONE
,
1804 (char_u
*)NULL
, PV_NONE
,
1806 {(char_u
*)TRUE
, (char_u
*)0L}},
1807 {"mousemodel", "mousem", P_STRING
|P_VI_DEF
,
1808 (char_u
*)&p_mousem
, PV_NONE
,
1810 #if defined(MSDOS) || defined(MSWIN)
1814 (char_u
*)"popup_setpos",
1820 {"mouseshape", "mouses", P_STRING
|P_VI_DEF
|P_COMMA
|P_NODUP
,
1821 #ifdef FEAT_MOUSESHAPE
1822 (char_u
*)&p_mouseshape
, PV_NONE
,
1823 {(char_u
*)"i-r:beam,s:updown,sd:udsizing,vs:leftright,vd:lrsizing,m:no,ml:up-arrow,v:rightup-arrow", (char_u
*)0L}
1825 (char_u
*)NULL
, PV_NONE
,
1826 {(char_u
*)NULL
, (char_u
*)0L}
1829 {"mousetime", "mouset", P_NUM
|P_VI_DEF
,
1830 (char_u
*)&p_mouset
, PV_NONE
,
1831 {(char_u
*)500L, (char_u
*)0L}},
1832 {"mzquantum", "mzq", P_NUM
,
1833 #ifdef FEAT_MZSCHEME
1834 (char_u
*)&p_mzq
, PV_NONE
,
1836 (char_u
*)NULL
, PV_NONE
,
1838 {(char_u
*)100L, (char_u
*)100L}},
1839 {"novice", NULL
, P_BOOL
|P_VI_DEF
,
1840 (char_u
*)NULL
, PV_NONE
,
1841 {(char_u
*)FALSE
, (char_u
*)0L}},
1842 {"nrformats", "nf", P_STRING
|P_ALLOCED
|P_VI_DEF
|P_COMMA
|P_NODUP
,
1843 (char_u
*)&p_nf
, PV_NF
,
1844 {(char_u
*)"octal,hex", (char_u
*)0L}},
1845 {"number", "nu", P_BOOL
|P_VI_DEF
|P_RWIN
,
1846 (char_u
*)VAR_WIN
, PV_NU
,
1847 {(char_u
*)FALSE
, (char_u
*)0L}},
1848 {"numberwidth", "nuw", P_NUM
|P_RWIN
|P_VIM
,
1849 #ifdef FEAT_LINEBREAK
1850 (char_u
*)VAR_WIN
, PV_NUW
,
1852 (char_u
*)NULL
, PV_NONE
,
1854 {(char_u
*)8L, (char_u
*)4L}},
1855 {"omnifunc", "ofu", P_STRING
|P_ALLOCED
|P_VI_DEF
|P_SECURE
,
1856 #ifdef FEAT_COMPL_FUNC
1857 (char_u
*)&p_ofu
, PV_OFU
,
1858 {(char_u
*)"", (char_u
*)0L}
1860 (char_u
*)NULL
, PV_NONE
,
1861 {(char_u
*)0L, (char_u
*)0L}
1864 {"open", NULL
, P_BOOL
|P_VI_DEF
,
1865 (char_u
*)NULL
, PV_NONE
,
1866 {(char_u
*)FALSE
, (char_u
*)0L}},
1867 {"opendevice", "odev", P_BOOL
|P_VI_DEF
,
1868 #if defined(MSDOS) || defined(MSWIN) || defined(OS2)
1869 (char_u
*)&p_odev
, PV_NONE
,
1871 (char_u
*)NULL
, PV_NONE
,
1873 {(char_u
*)FALSE
, (char_u
*)FALSE
}
1875 {"operatorfunc", "opfunc", P_STRING
|P_VI_DEF
|P_SECURE
,
1876 (char_u
*)&p_opfunc
, PV_NONE
,
1877 {(char_u
*)"", (char_u
*)0L} },
1878 {"optimize", "opt", P_BOOL
|P_VI_DEF
,
1879 (char_u
*)NULL
, PV_NONE
,
1880 {(char_u
*)FALSE
, (char_u
*)0L}},
1881 {"osfiletype", "oft", P_STRING
|P_ALLOCED
|P_VI_DEF
,
1882 #ifdef FEAT_OSFILETYPE
1883 (char_u
*)&p_oft
, PV_OFT
,
1884 {(char_u
*)DFLT_OFT
, (char_u
*)0L}
1886 (char_u
*)NULL
, PV_NONE
,
1887 {(char_u
*)0L, (char_u
*)0L}
1890 {"paragraphs", "para", P_STRING
|P_VI_DEF
,
1891 (char_u
*)&p_para
, PV_NONE
,
1892 {(char_u
*)"IPLPPPQPP TPHPLIPpLpItpplpipbp",
1894 {"paste", NULL
, P_BOOL
|P_VI_DEF
|P_PRI_MKRC
,
1895 (char_u
*)&p_paste
, PV_NONE
,
1896 {(char_u
*)FALSE
, (char_u
*)0L}},
1897 {"pastetoggle", "pt", P_STRING
|P_VI_DEF
,
1898 (char_u
*)&p_pt
, PV_NONE
,
1899 {(char_u
*)"", (char_u
*)0L}},
1900 {"patchexpr", "pex", P_STRING
|P_VI_DEF
|P_SECURE
,
1901 #if defined(FEAT_DIFF) && defined(FEAT_EVAL)
1902 (char_u
*)&p_pex
, PV_NONE
,
1903 {(char_u
*)"", (char_u
*)0L}
1905 (char_u
*)NULL
, PV_NONE
,
1906 {(char_u
*)0L, (char_u
*)0L}
1909 {"patchmode", "pm", P_STRING
|P_VI_DEF
|P_NFNAME
,
1910 (char_u
*)&p_pm
, PV_NONE
,
1911 {(char_u
*)"", (char_u
*)0L}},
1912 {"path", "pa", P_STRING
|P_EXPAND
|P_VI_DEF
|P_COMMA
|P_NODUP
,
1913 (char_u
*)&p_path
, PV_PATH
,
1915 #if defined AMIGA || defined MSDOS || defined MSWIN
1918 # if defined(__EMX__)
1919 (char_u
*)".,/emx/include,,",
1920 # else /* Unix, probably */
1921 (char_u
*)".,/usr/include,,",
1925 {"preserveindent", "pi", P_BOOL
|P_VI_DEF
|P_VIM
,
1926 (char_u
*)&p_pi
, PV_PI
,
1927 {(char_u
*)FALSE
, (char_u
*)0L}},
1928 {"previewheight", "pvh", P_NUM
|P_VI_DEF
,
1929 #if defined(FEAT_WINDOWS) && defined(FEAT_QUICKFIX)
1930 (char_u
*)&p_pvh
, PV_NONE
,
1932 (char_u
*)NULL
, PV_NONE
,
1934 {(char_u
*)12L, (char_u
*)0L}},
1935 {"previewwindow", "pvw", P_BOOL
|P_VI_DEF
|P_RSTAT
|P_NOGLOB
,
1936 #if defined(FEAT_WINDOWS) && defined(FEAT_QUICKFIX)
1937 (char_u
*)VAR_WIN
, PV_PVW
,
1939 (char_u
*)NULL
, PV_NONE
,
1941 {(char_u
*)FALSE
, (char_u
*)0L}},
1942 {"printdevice", "pdev", P_STRING
|P_VI_DEF
|P_SECURE
,
1944 (char_u
*)&p_pdev
, PV_NONE
,
1945 {(char_u
*)"", (char_u
*)0L}
1947 (char_u
*)NULL
, PV_NONE
,
1948 {(char_u
*)NULL
, (char_u
*)0L}
1951 {"printencoding", "penc", P_STRING
|P_VI_DEF
,
1952 #ifdef FEAT_POSTSCRIPT
1953 (char_u
*)&p_penc
, PV_NONE
,
1954 {(char_u
*)"", (char_u
*)0L}
1956 (char_u
*)NULL
, PV_NONE
,
1957 {(char_u
*)NULL
, (char_u
*)0L}
1960 {"printexpr", "pexpr", P_STRING
|P_VI_DEF
,
1961 #ifdef FEAT_POSTSCRIPT
1962 (char_u
*)&p_pexpr
, PV_NONE
,
1963 {(char_u
*)"", (char_u
*)0L}
1965 (char_u
*)NULL
, PV_NONE
,
1966 {(char_u
*)NULL
, (char_u
*)0L}
1969 {"printfont", "pfn", P_STRING
|P_VI_DEF
,
1971 (char_u
*)&p_pfn
, PV_NONE
,
1974 (char_u
*)"Courier_New:h10",
1976 (char_u
*)"courier",
1980 (char_u
*)NULL
, PV_NONE
,
1981 {(char_u
*)NULL
, (char_u
*)0L}
1984 {"printheader", "pheader", P_STRING
|P_VI_DEF
|P_GETTEXT
,
1986 (char_u
*)&p_header
, PV_NONE
,
1987 {(char_u
*)N_("%<%f%h%m%=Page %N"), (char_u
*)0L}
1989 (char_u
*)NULL
, PV_NONE
,
1990 {(char_u
*)NULL
, (char_u
*)0L}
1993 {"printmbcharset", "pmbcs", P_STRING
|P_VI_DEF
,
1994 #if defined(FEAT_POSTSCRIPT) && defined(FEAT_MBYTE)
1995 (char_u
*)&p_pmcs
, PV_NONE
,
1996 {(char_u
*)"", (char_u
*)0L}
1998 (char_u
*)NULL
, PV_NONE
,
1999 {(char_u
*)NULL
, (char_u
*)0L}
2002 {"printmbfont", "pmbfn", P_STRING
|P_VI_DEF
,
2003 #if defined(FEAT_POSTSCRIPT) && defined(FEAT_MBYTE)
2004 (char_u
*)&p_pmfn
, PV_NONE
,
2005 {(char_u
*)"", (char_u
*)0L}
2007 (char_u
*)NULL
, PV_NONE
,
2008 {(char_u
*)NULL
, (char_u
*)0L}
2011 {"printoptions", "popt", P_STRING
|P_VI_DEF
|P_COMMA
|P_NODUP
,
2013 (char_u
*)&p_popt
, PV_NONE
,
2014 {(char_u
*)"", (char_u
*)0L}
2016 (char_u
*)NULL
, PV_NONE
,
2017 {(char_u
*)NULL
, (char_u
*)0L}
2020 {"prompt", NULL
, P_BOOL
|P_VI_DEF
,
2021 (char_u
*)&p_prompt
, PV_NONE
,
2022 {(char_u
*)TRUE
, (char_u
*)0L}},
2023 {"pumheight", "ph", P_NUM
|P_VI_DEF
,
2024 #ifdef FEAT_INS_EXPAND
2025 (char_u
*)&p_ph
, PV_NONE
,
2027 (char_u
*)NULL
, PV_NONE
,
2029 {(char_u
*)0L, (char_u
*)0L}},
2030 {"quoteescape", "qe", P_STRING
|P_ALLOCED
|P_VI_DEF
,
2032 (char_u
*)&p_qe
, PV_QE
,
2033 {(char_u
*)"\\", (char_u
*)0L}
2035 (char_u
*)NULL
, PV_NONE
,
2036 {(char_u
*)NULL
, (char_u
*)0L}
2039 {"readonly", "ro", P_BOOL
|P_VI_DEF
|P_RSTAT
|P_NOGLOB
,
2040 (char_u
*)&p_ro
, PV_RO
,
2041 {(char_u
*)FALSE
, (char_u
*)0L}},
2042 {"redraw", NULL
, P_BOOL
|P_VI_DEF
,
2043 (char_u
*)NULL
, PV_NONE
,
2044 {(char_u
*)FALSE
, (char_u
*)0L}},
2045 {"redrawtime", "rdt", P_NUM
|P_VI_DEF
,
2047 (char_u
*)&p_rdt
, PV_NONE
,
2049 (char_u
*)NULL
, PV_NONE
,
2051 {(char_u
*)2000L, (char_u
*)0L}},
2052 {"remap", NULL
, P_BOOL
|P_VI_DEF
,
2053 (char_u
*)&p_remap
, PV_NONE
,
2054 {(char_u
*)TRUE
, (char_u
*)0L}},
2055 {"report", NULL
, P_NUM
|P_VI_DEF
,
2056 (char_u
*)&p_report
, PV_NONE
,
2057 {(char_u
*)2L, (char_u
*)0L}},
2058 {"restorescreen", "rs", P_BOOL
|P_VI_DEF
,
2060 (char_u
*)&p_rs
, PV_NONE
,
2062 (char_u
*)NULL
, PV_NONE
,
2064 {(char_u
*)TRUE
, (char_u
*)0L}},
2065 {"revins", "ri", P_BOOL
|P_VI_DEF
|P_VIM
,
2066 #ifdef FEAT_RIGHTLEFT
2067 (char_u
*)&p_ri
, PV_NONE
,
2069 (char_u
*)NULL
, PV_NONE
,
2071 {(char_u
*)FALSE
, (char_u
*)0L}},
2072 {"rightleft", "rl", P_BOOL
|P_VI_DEF
|P_RWIN
,
2073 #ifdef FEAT_RIGHTLEFT
2074 (char_u
*)VAR_WIN
, PV_RL
,
2076 (char_u
*)NULL
, PV_NONE
,
2078 {(char_u
*)FALSE
, (char_u
*)0L}},
2079 {"rightleftcmd", "rlc", P_STRING
|P_ALLOCED
|P_VI_DEF
|P_RWIN
,
2080 #ifdef FEAT_RIGHTLEFT
2081 (char_u
*)VAR_WIN
, PV_RLC
,
2082 {(char_u
*)"search", (char_u
*)NULL
}
2084 (char_u
*)NULL
, PV_NONE
,
2085 {(char_u
*)NULL
, (char_u
*)0L}
2088 {"ruler", "ru", P_BOOL
|P_VI_DEF
|P_VIM
|P_RSTAT
,
2089 #ifdef FEAT_CMDL_INFO
2090 (char_u
*)&p_ru
, PV_NONE
,
2092 (char_u
*)NULL
, PV_NONE
,
2094 {(char_u
*)FALSE
, (char_u
*)0L}},
2095 {"rulerformat", "ruf", P_STRING
|P_VI_DEF
|P_ALLOCED
|P_RSTAT
,
2097 (char_u
*)&p_ruf
, PV_NONE
,
2099 (char_u
*)NULL
, PV_NONE
,
2101 {(char_u
*)"", (char_u
*)0L}},
2102 {"runtimepath", "rtp", P_STRING
|P_VI_DEF
|P_EXPAND
|P_COMMA
|P_NODUP
|P_SECURE
,
2103 (char_u
*)&p_rtp
, PV_NONE
,
2104 {(char_u
*)DFLT_RUNTIMEPATH
, (char_u
*)0L}},
2105 {"scroll", "scr", P_NUM
|P_NO_MKRC
|P_VI_DEF
,
2106 (char_u
*)VAR_WIN
, PV_SCROLL
,
2107 {(char_u
*)12L, (char_u
*)0L}},
2108 {"scrollbind", "scb", P_BOOL
|P_VI_DEF
,
2109 #ifdef FEAT_SCROLLBIND
2110 (char_u
*)VAR_WIN
, PV_SCBIND
,
2112 (char_u
*)NULL
, PV_NONE
,
2114 {(char_u
*)FALSE
, (char_u
*)0L}},
2115 {"scrolljump", "sj", P_NUM
|P_VI_DEF
|P_VIM
,
2116 (char_u
*)&p_sj
, PV_NONE
,
2117 {(char_u
*)1L, (char_u
*)0L}},
2118 {"scrolloff", "so", P_NUM
|P_VI_DEF
|P_VIM
|P_RALL
,
2119 (char_u
*)&p_so
, PV_NONE
,
2120 {(char_u
*)0L, (char_u
*)0L}},
2121 {"scrollopt", "sbo", P_STRING
|P_VI_DEF
|P_COMMA
|P_NODUP
,
2122 #ifdef FEAT_SCROLLBIND
2123 (char_u
*)&p_sbo
, PV_NONE
,
2124 {(char_u
*)"ver,jump", (char_u
*)0L}
2126 (char_u
*)NULL
, PV_NONE
,
2127 {(char_u
*)0L, (char_u
*)0L}
2130 {"sections", "sect", P_STRING
|P_VI_DEF
,
2131 (char_u
*)&p_sections
, PV_NONE
,
2132 {(char_u
*)"SHNHH HUnhsh", (char_u
*)0L}},
2133 {"secure", NULL
, P_BOOL
|P_VI_DEF
|P_SECURE
,
2134 (char_u
*)&p_secure
, PV_NONE
,
2135 {(char_u
*)FALSE
, (char_u
*)0L}},
2136 {"selection", "sel", P_STRING
|P_VI_DEF
,
2138 (char_u
*)&p_sel
, PV_NONE
,
2140 (char_u
*)NULL
, PV_NONE
,
2142 {(char_u
*)"inclusive", (char_u
*)0L}},
2143 {"selectmode", "slm", P_STRING
|P_VI_DEF
|P_COMMA
|P_NODUP
,
2145 (char_u
*)&p_slm
, PV_NONE
,
2147 (char_u
*)NULL
, PV_NONE
,
2149 {(char_u
*)"", (char_u
*)0L}},
2150 {"sessionoptions", "ssop", P_STRING
|P_VI_DEF
|P_COMMA
|P_NODUP
,
2152 (char_u
*)&p_ssop
, PV_NONE
,
2153 {(char_u
*)"blank,buffers,curdir,folds,help,options,tabpages,winsize",
2156 (char_u
*)NULL
, PV_NONE
,
2157 {(char_u
*)0L, (char_u
*)0L}
2160 {"shell", "sh", P_STRING
|P_EXPAND
|P_VI_DEF
|P_SECURE
,
2161 (char_u
*)&p_sh
, PV_NONE
,
2167 (char_u
*)"command",
2170 (char_u
*)"command.com",
2172 # if defined(WIN3264)
2173 (char_u
*)"", /* set in set_init_1() */
2176 (char_u
*)"cmd.exe",
2178 # if defined(ARCHIE)
2189 {"shellcmdflag","shcf", P_STRING
|P_VI_DEF
|P_SECURE
,
2190 (char_u
*)&p_shcf
, PV_NONE
,
2192 #if defined(MSDOS) || defined(MSWIN)
2202 {"shellpipe", "sp", P_STRING
|P_VI_DEF
|P_SECURE
,
2203 #ifdef FEAT_QUICKFIX
2204 (char_u
*)&p_sp
, PV_NONE
,
2206 #if defined(UNIX) || defined(OS2)
2217 (char_u
*)NULL
, PV_NONE
,
2218 {(char_u
*)0L, (char_u
*)0L}
2221 {"shellquote", "shq", P_STRING
|P_VI_DEF
|P_SECURE
,
2222 (char_u
*)&p_shq
, PV_NONE
,
2223 {(char_u
*)"", (char_u
*)0L}},
2224 {"shellredir", "srr", P_STRING
|P_VI_DEF
|P_SECURE
,
2225 (char_u
*)&p_srr
, PV_NONE
,
2226 {(char_u
*)">", (char_u
*)0L}},
2227 {"shellslash", "ssl", P_BOOL
|P_VI_DEF
,
2228 #ifdef BACKSLASH_IN_FILENAME
2229 (char_u
*)&p_ssl
, PV_NONE
,
2231 (char_u
*)NULL
, PV_NONE
,
2233 {(char_u
*)FALSE
, (char_u
*)0L}},
2234 {"shelltemp", "stmp", P_BOOL
,
2235 (char_u
*)&p_stmp
, PV_NONE
,
2236 {(char_u
*)FALSE
, (char_u
*)TRUE
}},
2237 {"shelltype", "st", P_NUM
|P_VI_DEF
,
2239 (char_u
*)&p_st
, PV_NONE
,
2241 (char_u
*)NULL
, PV_NONE
,
2243 {(char_u
*)0L, (char_u
*)0L}},
2244 {"shellxquote", "sxq", P_STRING
|P_VI_DEF
|P_SECURE
,
2245 (char_u
*)&p_sxq
, PV_NONE
,
2247 #if defined(UNIX) && defined(USE_SYSTEM) && !defined(__EMX__)
2253 {"shiftround", "sr", P_BOOL
|P_VI_DEF
|P_VIM
,
2254 (char_u
*)&p_sr
, PV_NONE
,
2255 {(char_u
*)FALSE
, (char_u
*)0L}},
2256 {"shiftwidth", "sw", P_NUM
|P_VI_DEF
,
2257 (char_u
*)&p_sw
, PV_SW
,
2258 {(char_u
*)8L, (char_u
*)0L}},
2259 {"shortmess", "shm", P_STRING
|P_VIM
|P_FLAGLIST
,
2260 (char_u
*)&p_shm
, PV_NONE
,
2261 {(char_u
*)"", (char_u
*)"filnxtToO"}},
2262 {"shortname", "sn", P_BOOL
|P_VI_DEF
,
2264 (char_u
*)NULL
, PV_NONE
,
2266 (char_u
*)&p_sn
, PV_SN
,
2268 {(char_u
*)FALSE
, (char_u
*)0L}},
2269 {"showbreak", "sbr", P_STRING
|P_VI_DEF
|P_RALL
,
2270 #ifdef FEAT_LINEBREAK
2271 (char_u
*)&p_sbr
, PV_NONE
,
2273 (char_u
*)NULL
, PV_NONE
,
2275 {(char_u
*)"", (char_u
*)0L}},
2276 {"showcmd", "sc", P_BOOL
|P_VIM
,
2277 #ifdef FEAT_CMDL_INFO
2278 (char_u
*)&p_sc
, PV_NONE
,
2280 (char_u
*)NULL
, PV_NONE
,
2289 {"showfulltag", "sft", P_BOOL
|P_VI_DEF
,
2290 (char_u
*)&p_sft
, PV_NONE
,
2291 {(char_u
*)FALSE
, (char_u
*)0L}},
2292 {"showmatch", "sm", P_BOOL
|P_VI_DEF
,
2293 (char_u
*)&p_sm
, PV_NONE
,
2294 {(char_u
*)FALSE
, (char_u
*)0L}},
2295 {"showmode", "smd", P_BOOL
|P_VIM
,
2296 (char_u
*)&p_smd
, PV_NONE
,
2297 {(char_u
*)FALSE
, (char_u
*)TRUE
}},
2298 {"showtabline", "stal", P_NUM
|P_VI_DEF
|P_RALL
,
2300 (char_u
*)&p_stal
, PV_NONE
,
2302 (char_u
*)NULL
, PV_NONE
,
2304 {(char_u
*)1L, (char_u
*)0L}},
2305 {"sidescroll", "ss", P_NUM
|P_VI_DEF
,
2306 (char_u
*)&p_ss
, PV_NONE
,
2307 {(char_u
*)0L, (char_u
*)0L}},
2308 {"sidescrolloff", "siso", P_NUM
|P_VI_DEF
|P_VIM
|P_RBUF
,
2309 (char_u
*)&p_siso
, PV_NONE
,
2310 {(char_u
*)0L, (char_u
*)0L}},
2311 {"slowopen", "slow", P_BOOL
|P_VI_DEF
,
2312 (char_u
*)NULL
, PV_NONE
,
2313 {(char_u
*)FALSE
, (char_u
*)0L}},
2314 {"smartcase", "scs", P_BOOL
|P_VI_DEF
|P_VIM
,
2315 (char_u
*)&p_scs
, PV_NONE
,
2316 {(char_u
*)FALSE
, (char_u
*)0L}},
2317 {"smartindent", "si", P_BOOL
|P_VI_DEF
|P_VIM
,
2318 #ifdef FEAT_SMARTINDENT
2319 (char_u
*)&p_si
, PV_SI
,
2321 (char_u
*)NULL
, PV_NONE
,
2323 {(char_u
*)FALSE
, (char_u
*)0L}},
2324 {"smarttab", "sta", P_BOOL
|P_VI_DEF
|P_VIM
,
2325 (char_u
*)&p_sta
, PV_NONE
,
2326 {(char_u
*)FALSE
, (char_u
*)0L}},
2327 {"softtabstop", "sts", P_NUM
|P_VI_DEF
|P_VIM
,
2328 (char_u
*)&p_sts
, PV_STS
,
2329 {(char_u
*)0L, (char_u
*)0L}},
2330 {"sourceany", NULL
, P_BOOL
|P_VI_DEF
,
2331 (char_u
*)NULL
, PV_NONE
,
2332 {(char_u
*)FALSE
, (char_u
*)0L}},
2333 {"spell", NULL
, P_BOOL
|P_VI_DEF
|P_RWIN
,
2335 (char_u
*)VAR_WIN
, PV_SPELL
,
2337 (char_u
*)NULL
, PV_NONE
,
2339 {(char_u
*)FALSE
, (char_u
*)0L}},
2340 {"spellcapcheck", "spc", P_STRING
|P_ALLOCED
|P_VI_DEF
|P_RBUF
,
2342 (char_u
*)&p_spc
, PV_SPC
,
2343 {(char_u
*)"[.?!]\\_[\\])'\" ]\\+", (char_u
*)0L}
2345 (char_u
*)NULL
, PV_NONE
,
2346 {(char_u
*)0L, (char_u
*)0L}
2349 {"spellfile", "spf", P_STRING
|P_EXPAND
|P_ALLOCED
|P_VI_DEF
|P_SECURE
|P_COMMA
,
2351 (char_u
*)&p_spf
, PV_SPF
,
2352 {(char_u
*)"", (char_u
*)0L}
2354 (char_u
*)NULL
, PV_NONE
,
2355 {(char_u
*)0L, (char_u
*)0L}
2358 {"spelllang", "spl", P_STRING
|P_ALLOCED
|P_VI_DEF
|P_COMMA
|P_RBUF
|P_EXPAND
,
2360 (char_u
*)&p_spl
, PV_SPL
,
2361 {(char_u
*)"en", (char_u
*)0L}
2363 (char_u
*)NULL
, PV_NONE
,
2364 {(char_u
*)0L, (char_u
*)0L}
2367 {"spellsuggest", "sps", P_STRING
|P_VI_DEF
|P_EXPAND
|P_SECURE
|P_COMMA
,
2369 (char_u
*)&p_sps
, PV_NONE
,
2370 {(char_u
*)"best", (char_u
*)0L}
2372 (char_u
*)NULL
, PV_NONE
,
2373 {(char_u
*)0L, (char_u
*)0L}
2376 {"splitbelow", "sb", P_BOOL
|P_VI_DEF
,
2378 (char_u
*)&p_sb
, PV_NONE
,
2380 (char_u
*)NULL
, PV_NONE
,
2382 {(char_u
*)FALSE
, (char_u
*)0L}},
2383 {"splitright", "spr", P_BOOL
|P_VI_DEF
,
2384 #ifdef FEAT_VERTSPLIT
2385 (char_u
*)&p_spr
, PV_NONE
,
2387 (char_u
*)NULL
, PV_NONE
,
2389 {(char_u
*)FALSE
, (char_u
*)0L}},
2390 {"startofline", "sol", P_BOOL
|P_VI_DEF
|P_VIM
,
2391 (char_u
*)&p_sol
, PV_NONE
,
2392 {(char_u
*)TRUE
, (char_u
*)0L}},
2393 {"statusline" ,"stl", P_STRING
|P_VI_DEF
|P_ALLOCED
|P_RSTAT
,
2395 (char_u
*)&p_stl
, PV_STL
,
2397 (char_u
*)NULL
, PV_NONE
,
2399 {(char_u
*)"", (char_u
*)0L}},
2400 {"suffixes", "su", P_STRING
|P_VI_DEF
|P_COMMA
|P_NODUP
,
2401 (char_u
*)&p_su
, PV_NONE
,
2402 {(char_u
*)".bak,~,.o,.h,.info,.swp,.obj",
2404 {"suffixesadd", "sua", P_STRING
|P_VI_DEF
|P_ALLOCED
|P_COMMA
|P_NODUP
,
2405 #ifdef FEAT_SEARCHPATH
2406 (char_u
*)&p_sua
, PV_SUA
,
2407 {(char_u
*)"", (char_u
*)0L}
2409 (char_u
*)NULL
, PV_NONE
,
2410 {(char_u
*)0L, (char_u
*)0L}
2413 {"swapfile", "swf", P_BOOL
|P_VI_DEF
|P_RSTAT
,
2414 (char_u
*)&p_swf
, PV_SWF
,
2415 {(char_u
*)TRUE
, (char_u
*)0L}},
2416 {"swapsync", "sws", P_STRING
|P_VI_DEF
,
2417 (char_u
*)&p_sws
, PV_NONE
,
2418 {(char_u
*)"fsync", (char_u
*)0L}},
2419 {"switchbuf", "swb", P_STRING
|P_VI_DEF
|P_COMMA
|P_NODUP
,
2420 (char_u
*)&p_swb
, PV_NONE
,
2421 {(char_u
*)"", (char_u
*)0L}},
2422 {"synmaxcol", "smc", P_NUM
|P_VI_DEF
|P_RBUF
,
2424 (char_u
*)&p_smc
, PV_SMC
,
2425 {(char_u
*)3000L, (char_u
*)0L}
2427 (char_u
*)NULL
, PV_NONE
,
2428 {(char_u
*)0L, (char_u
*)0L}
2431 {"syntax", "syn", P_STRING
|P_ALLOCED
|P_VI_DEF
|P_NOGLOB
|P_NFNAME
,
2433 (char_u
*)&p_syn
, PV_SYN
,
2434 {(char_u
*)"", (char_u
*)0L}
2436 (char_u
*)NULL
, PV_NONE
,
2437 {(char_u
*)0L, (char_u
*)0L}
2440 {"tabline", "tal", P_STRING
|P_VI_DEF
|P_RALL
,
2442 (char_u
*)&p_tal
, PV_NONE
,
2444 (char_u
*)NULL
, PV_NONE
,
2446 {(char_u
*)"", (char_u
*)0L}},
2447 {"tabpagemax", "tpm", P_NUM
|P_VI_DEF
,
2449 (char_u
*)&p_tpm
, PV_NONE
,
2451 (char_u
*)NULL
, PV_NONE
,
2453 {(char_u
*)10L, (char_u
*)0L}},
2454 {"tabstop", "ts", P_NUM
|P_VI_DEF
|P_RBUF
,
2455 (char_u
*)&p_ts
, PV_TS
,
2456 {(char_u
*)8L, (char_u
*)0L}},
2457 {"tagbsearch", "tbs", P_BOOL
|P_VI_DEF
,
2458 (char_u
*)&p_tbs
, PV_NONE
,
2459 #ifdef VMS /* binary searching doesn't appear to work on VMS */
2460 {(char_u
*)0L, (char_u
*)0L}
2462 {(char_u
*)TRUE
, (char_u
*)0L}
2465 {"taglength", "tl", P_NUM
|P_VI_DEF
,
2466 (char_u
*)&p_tl
, PV_NONE
,
2467 {(char_u
*)0L, (char_u
*)0L}},
2468 {"tagrelative", "tr", P_BOOL
|P_VIM
,
2469 (char_u
*)&p_tr
, PV_NONE
,
2470 {(char_u
*)FALSE
, (char_u
*)TRUE
}},
2471 {"tags", "tag", P_STRING
|P_EXPAND
|P_VI_DEF
|P_COMMA
|P_NODUP
,
2472 (char_u
*)&p_tags
, PV_TAGS
,
2474 #if defined(FEAT_EMACS_TAGS) && !defined(CASE_INSENSITIVE_FILENAME)
2475 (char_u
*)"./tags,./TAGS,tags,TAGS",
2477 (char_u
*)"./tags,tags",
2480 {"tagstack", "tgst", P_BOOL
|P_VI_DEF
,
2481 (char_u
*)&p_tgst
, PV_NONE
,
2482 {(char_u
*)TRUE
, (char_u
*)0L}},
2483 {"term", NULL
, P_STRING
|P_EXPAND
|P_NODEFAULT
|P_NO_MKRC
|P_VI_DEF
|P_RALL
,
2484 (char_u
*)&T_NAME
, PV_NONE
,
2485 {(char_u
*)"", (char_u
*)0L}},
2486 {"termbidi", "tbidi", P_BOOL
|P_VI_DEF
,
2488 (char_u
*)&p_tbidi
, PV_NONE
,
2490 (char_u
*)NULL
, PV_NONE
,
2492 {(char_u
*)FALSE
, (char_u
*)0L}},
2493 {"termencoding", "tenc", P_STRING
|P_VI_DEF
|P_RCLR
,
2495 (char_u
*)&p_tenc
, PV_NONE
,
2496 {(char_u
*)"", (char_u
*)0L}
2498 (char_u
*)NULL
, PV_NONE
,
2499 {(char_u
*)0L, (char_u
*)0L}
2502 {"terse", NULL
, P_BOOL
|P_VI_DEF
,
2503 (char_u
*)&p_terse
, PV_NONE
,
2504 {(char_u
*)FALSE
, (char_u
*)0L}},
2505 {"textauto", "ta", P_BOOL
|P_VIM
,
2506 (char_u
*)&p_ta
, PV_NONE
,
2507 {(char_u
*)DFLT_TEXTAUTO
, (char_u
*)TRUE
}},
2508 {"textmode", "tx", P_BOOL
|P_VI_DEF
|P_NO_MKRC
,
2509 (char_u
*)&p_tx
, PV_TX
,
2517 {"textwidth", "tw", P_NUM
|P_VI_DEF
|P_VIM
,
2518 (char_u
*)&p_tw
, PV_TW
,
2519 {(char_u
*)0L, (char_u
*)0L}},
2520 {"thesaurus", "tsr", P_STRING
|P_EXPAND
|P_VI_DEF
|P_COMMA
|P_NODUP
,
2521 #ifdef FEAT_INS_EXPAND
2522 (char_u
*)&p_tsr
, PV_TSR
,
2524 (char_u
*)NULL
, PV_NONE
,
2526 {(char_u
*)"", (char_u
*)0L}},
2527 {"tildeop", "top", P_BOOL
|P_VI_DEF
|P_VIM
,
2528 (char_u
*)&p_to
, PV_NONE
,
2529 {(char_u
*)FALSE
, (char_u
*)0L}},
2530 {"timeout", "to", P_BOOL
|P_VI_DEF
,
2531 (char_u
*)&p_timeout
, PV_NONE
,
2532 {(char_u
*)TRUE
, (char_u
*)0L}},
2533 {"timeoutlen", "tm", P_NUM
|P_VI_DEF
,
2534 (char_u
*)&p_tm
, PV_NONE
,
2535 {(char_u
*)1000L, (char_u
*)0L}},
2536 {"title", NULL
, P_BOOL
|P_VI_DEF
,
2538 (char_u
*)&p_title
, PV_NONE
,
2540 (char_u
*)NULL
, PV_NONE
,
2542 {(char_u
*)FALSE
, (char_u
*)0L}},
2543 {"titlelen", NULL
, P_NUM
|P_VI_DEF
,
2545 (char_u
*)&p_titlelen
, PV_NONE
,
2547 (char_u
*)NULL
, PV_NONE
,
2549 {(char_u
*)85L, (char_u
*)0L}},
2550 {"titleold", NULL
, P_STRING
|P_VI_DEF
|P_GETTEXT
|P_SECURE
|P_NO_MKRC
,
2552 (char_u
*)&p_titleold
, PV_NONE
,
2553 {(char_u
*)N_("Thanks for flying Vim"),
2556 (char_u
*)NULL
, PV_NONE
,
2557 {(char_u
*)0L, (char_u
*)0L}
2560 {"titlestring", NULL
, P_STRING
|P_VI_DEF
,
2562 (char_u
*)&p_titlestring
, PV_NONE
,
2564 (char_u
*)NULL
, PV_NONE
,
2566 {(char_u
*)"", (char_u
*)0L}},
2567 #if defined(FEAT_TOOLBAR) && !defined(FEAT_GUI_W32)
2568 {"toolbar", "tb", P_STRING
|P_COMMA
|P_VI_DEF
|P_NODUP
,
2569 (char_u
*)&p_toolbar
, PV_NONE
,
2570 {(char_u
*)"icons,tooltips", (char_u
*)0L}},
2572 #if defined(FEAT_TOOLBAR) && ((defined(FEAT_GUI_GTK) && defined(HAVE_GTK2)) \
2573 || defined(FEAT_GUI_MACVIM))
2574 {"toolbariconsize", "tbis", P_STRING
|P_VI_DEF
,
2575 (char_u
*)&p_tbis
, PV_NONE
,
2576 {(char_u
*)"small", (char_u
*)0L}},
2578 {"transparency", "transp", P_NUM
|P_VIM
|P_RCLR
,
2579 #ifdef FEAT_TRANSPARENCY
2580 (char_u
*)&p_transp
, PV_NONE
,
2582 (char_u
*)NULL
, PV_NONE
,
2584 {(char_u
*)0L, (char_u
*)0L} },
2585 {"ttimeout", NULL
, P_BOOL
|P_VI_DEF
|P_VIM
,
2586 (char_u
*)&p_ttimeout
, PV_NONE
,
2587 {(char_u
*)FALSE
, (char_u
*)0L}},
2588 {"ttimeoutlen", "ttm", P_NUM
|P_VI_DEF
,
2589 (char_u
*)&p_ttm
, PV_NONE
,
2590 {(char_u
*)-1L, (char_u
*)0L}},
2591 {"ttybuiltin", "tbi", P_BOOL
|P_VI_DEF
,
2592 (char_u
*)&p_tbi
, PV_NONE
,
2593 {(char_u
*)TRUE
, (char_u
*)0L}},
2594 {"ttyfast", "tf", P_BOOL
|P_NO_MKRC
|P_VI_DEF
,
2595 (char_u
*)&p_tf
, PV_NONE
,
2596 {(char_u
*)FALSE
, (char_u
*)0L}},
2597 {"ttymouse", "ttym", P_STRING
|P_NODEFAULT
|P_NO_MKRC
|P_VI_DEF
,
2598 #if defined(FEAT_MOUSE) && (defined(UNIX) || defined(VMS))
2599 (char_u
*)&p_ttym
, PV_NONE
,
2601 (char_u
*)NULL
, PV_NONE
,
2603 {(char_u
*)"", (char_u
*)0L}},
2604 {"ttyscroll", "tsl", P_NUM
|P_VI_DEF
,
2605 (char_u
*)&p_ttyscroll
, PV_NONE
,
2606 {(char_u
*)999L, (char_u
*)0L}},
2607 {"ttytype", "tty", P_STRING
|P_EXPAND
|P_NODEFAULT
|P_NO_MKRC
|P_VI_DEF
|P_RALL
,
2608 (char_u
*)&T_NAME
, PV_NONE
,
2609 {(char_u
*)"", (char_u
*)0L}},
2610 {"undolevels", "ul", P_NUM
|P_VI_DEF
,
2611 (char_u
*)&p_ul
, PV_NONE
,
2613 #if defined(UNIX) || defined(WIN3264) || defined(OS2) || defined(VMS)
2619 {"updatecount", "uc", P_NUM
|P_VI_DEF
,
2620 (char_u
*)&p_uc
, PV_NONE
,
2621 {(char_u
*)200L, (char_u
*)0L}},
2622 {"updatetime", "ut", P_NUM
|P_VI_DEF
,
2623 (char_u
*)&p_ut
, PV_NONE
,
2624 {(char_u
*)4000L, (char_u
*)0L}},
2625 {"verbose", "vbs", P_NUM
|P_VI_DEF
,
2626 (char_u
*)&p_verbose
, PV_NONE
,
2627 {(char_u
*)0L, (char_u
*)0L}},
2628 {"verbosefile", "vfile", P_STRING
|P_EXPAND
|P_VI_DEF
|P_SECURE
,
2629 (char_u
*)&p_vfile
, PV_NONE
,
2630 {(char_u
*)"", (char_u
*)0L}},
2631 {"viewdir", "vdir", P_STRING
|P_EXPAND
|P_VI_DEF
|P_SECURE
,
2633 (char_u
*)&p_vdir
, PV_NONE
,
2634 {(char_u
*)DFLT_VDIR
, (char_u
*)0L}
2636 (char_u
*)NULL
, PV_NONE
,
2637 {(char_u
*)0L, (char_u
*)0L}
2640 {"viewoptions", "vop", P_STRING
|P_VI_DEF
|P_COMMA
|P_NODUP
,
2642 (char_u
*)&p_vop
, PV_NONE
,
2643 {(char_u
*)"folds,options,cursor", (char_u
*)0L}
2645 (char_u
*)NULL
, PV_NONE
,
2646 {(char_u
*)0L, (char_u
*)0L}
2649 {"viminfo", "vi", P_STRING
|P_COMMA
|P_NODUP
|P_SECURE
,
2651 (char_u
*)&p_viminfo
, PV_NONE
,
2652 #if defined(MSDOS) || defined(MSWIN) || defined(OS2)
2653 {(char_u
*)"", (char_u
*)"'100,<50,s10,h,rA:,rB:"}
2657 (char_u
*)"'100,<50,s10,h,rdf0:,rdf1:,rdf2:"}
2659 {(char_u
*)"", (char_u
*)"'100,<50,s10,h"}
2663 (char_u
*)NULL
, PV_NONE
,
2664 {(char_u
*)0L, (char_u
*)0L}
2667 {"virtualedit", "ve", P_STRING
|P_COMMA
|P_NODUP
|P_VI_DEF
|P_VIM
,
2668 #ifdef FEAT_VIRTUALEDIT
2669 (char_u
*)&p_ve
, PV_NONE
,
2670 {(char_u
*)"", (char_u
*)""}
2672 (char_u
*)NULL
, PV_NONE
,
2673 {(char_u
*)0L, (char_u
*)0L}
2676 {"visualbell", "vb", P_BOOL
|P_VI_DEF
,
2677 (char_u
*)&p_vb
, PV_NONE
,
2678 {(char_u
*)FALSE
, (char_u
*)0L}},
2679 {"w300", NULL
, P_NUM
|P_VI_DEF
,
2680 (char_u
*)NULL
, PV_NONE
,
2681 {(char_u
*)0L, (char_u
*)0L}},
2682 {"w1200", NULL
, P_NUM
|P_VI_DEF
,
2683 (char_u
*)NULL
, PV_NONE
,
2684 {(char_u
*)0L, (char_u
*)0L}},
2685 {"w9600", NULL
, P_NUM
|P_VI_DEF
,
2686 (char_u
*)NULL
, PV_NONE
,
2687 {(char_u
*)0L, (char_u
*)0L}},
2688 {"warn", NULL
, P_BOOL
|P_VI_DEF
,
2689 (char_u
*)&p_warn
, PV_NONE
,
2690 {(char_u
*)TRUE
, (char_u
*)0L}},
2691 {"weirdinvert", "wiv", P_BOOL
|P_VI_DEF
|P_RCLR
,
2692 (char_u
*)&p_wiv
, PV_NONE
,
2693 {(char_u
*)FALSE
, (char_u
*)0L}},
2694 {"whichwrap", "ww", P_STRING
|P_VIM
|P_COMMA
|P_FLAGLIST
,
2695 (char_u
*)&p_ww
, PV_NONE
,
2696 {(char_u
*)"", (char_u
*)"b,s"}},
2697 {"wildchar", "wc", P_NUM
|P_VIM
,
2698 (char_u
*)&p_wc
, PV_NONE
,
2699 {(char_u
*)(long)Ctrl_E
, (char_u
*)(long)TAB
}},
2700 {"wildcharm", "wcm", P_NUM
|P_VI_DEF
,
2701 (char_u
*)&p_wcm
, PV_NONE
,
2702 {(char_u
*)0L, (char_u
*)0L}},
2703 {"wildignore", "wig", P_STRING
|P_VI_DEF
|P_COMMA
|P_NODUP
,
2705 (char_u
*)&p_wig
, PV_NONE
,
2707 (char_u
*)NULL
, PV_NONE
,
2709 {(char_u
*)"", (char_u
*)0L}},
2710 {"wildmenu", "wmnu", P_BOOL
|P_VI_DEF
,
2711 #ifdef FEAT_WILDMENU
2712 (char_u
*)&p_wmnu
, PV_NONE
,
2714 (char_u
*)NULL
, PV_NONE
,
2716 {(char_u
*)FALSE
, (char_u
*)0L}},
2717 {"wildmode", "wim", P_STRING
|P_VI_DEF
|P_COMMA
|P_NODUP
,
2718 (char_u
*)&p_wim
, PV_NONE
,
2719 {(char_u
*)"full", (char_u
*)0L}},
2720 {"wildoptions", "wop", P_STRING
|P_VI_DEF
,
2721 #ifdef FEAT_CMDL_COMPL
2722 (char_u
*)&p_wop
, PV_NONE
,
2723 {(char_u
*)"", (char_u
*)0L}
2725 (char_u
*)NULL
, PV_NONE
,
2726 {(char_u
*)NULL
, (char_u
*)0L}
2729 {"winaltkeys", "wak", P_STRING
|P_VI_DEF
,
2731 (char_u
*)&p_wak
, PV_NONE
,
2732 {(char_u
*)"menu", (char_u
*)0L}
2734 (char_u
*)NULL
, PV_NONE
,
2735 {(char_u
*)NULL
, (char_u
*)0L}
2738 {"window", "wi", P_NUM
|P_VI_DEF
,
2739 (char_u
*)&p_window
, PV_NONE
,
2740 {(char_u
*)0L, (char_u
*)0L}},
2741 {"winheight", "wh", P_NUM
|P_VI_DEF
,
2743 (char_u
*)&p_wh
, PV_NONE
,
2745 (char_u
*)NULL
, PV_NONE
,
2747 {(char_u
*)1L, (char_u
*)0L}},
2748 {"winfixheight", "wfh", P_BOOL
|P_VI_DEF
|P_RSTAT
,
2750 (char_u
*)VAR_WIN
, PV_WFH
,
2752 (char_u
*)NULL
, PV_NONE
,
2754 {(char_u
*)FALSE
, (char_u
*)0L}},
2755 {"winfixwidth", "wfw", P_BOOL
|P_VI_DEF
|P_RSTAT
,
2756 #ifdef FEAT_VERTSPLIT
2757 (char_u
*)VAR_WIN
, PV_WFW
,
2759 (char_u
*)NULL
, PV_NONE
,
2761 {(char_u
*)FALSE
, (char_u
*)0L}},
2762 {"winminheight", "wmh", P_NUM
|P_VI_DEF
,
2764 (char_u
*)&p_wmh
, PV_NONE
,
2766 (char_u
*)NULL
, PV_NONE
,
2768 {(char_u
*)1L, (char_u
*)0L}},
2769 {"winminwidth", "wmw", P_NUM
|P_VI_DEF
,
2770 #ifdef FEAT_VERTSPLIT
2771 (char_u
*)&p_wmw
, PV_NONE
,
2773 (char_u
*)NULL
, PV_NONE
,
2775 {(char_u
*)1L, (char_u
*)0L}},
2776 {"winwidth", "wiw", P_NUM
|P_VI_DEF
,
2777 #ifdef FEAT_VERTSPLIT
2778 (char_u
*)&p_wiw
, PV_NONE
,
2780 (char_u
*)NULL
, PV_NONE
,
2782 {(char_u
*)20L, (char_u
*)0L}},
2783 {"wrap", NULL
, P_BOOL
|P_VI_DEF
|P_RWIN
,
2784 (char_u
*)VAR_WIN
, PV_WRAP
,
2785 {(char_u
*)TRUE
, (char_u
*)0L}},
2786 {"wrapmargin", "wm", P_NUM
|P_VI_DEF
,
2787 (char_u
*)&p_wm
, PV_WM
,
2788 {(char_u
*)0L, (char_u
*)0L}},
2789 {"wrapscan", "ws", P_BOOL
|P_VI_DEF
,
2790 (char_u
*)&p_ws
, PV_NONE
,
2791 {(char_u
*)TRUE
, (char_u
*)0L}},
2792 {"write", NULL
, P_BOOL
|P_VI_DEF
,
2793 (char_u
*)&p_write
, PV_NONE
,
2794 {(char_u
*)TRUE
, (char_u
*)0L}},
2795 {"writeany", "wa", P_BOOL
|P_VI_DEF
,
2796 (char_u
*)&p_wa
, PV_NONE
,
2797 {(char_u
*)FALSE
, (char_u
*)0L}},
2798 {"writebackup", "wb", P_BOOL
|P_VI_DEF
|P_VIM
,
2799 (char_u
*)&p_wb
, PV_NONE
,
2801 #ifdef FEAT_WRITEBACKUP
2807 {"writedelay", "wd", P_NUM
|P_VI_DEF
,
2808 (char_u
*)&p_wd
, PV_NONE
,
2809 {(char_u
*)0L, (char_u
*)0L}},
2811 /* terminal output codes */
2812 #define p_term(sss, vvv) {sss, NULL, P_STRING|P_VI_DEF|P_RALL|P_SECURE, \
2813 (char_u *)&vvv, PV_NONE, \
2814 {(char_u *)"", (char_u *)0L}},
2816 p_term("t_AB", T_CAB
)
2817 p_term("t_AF", T_CAF
)
2818 p_term("t_AL", T_CAL
)
2819 p_term("t_al", T_AL
)
2820 p_term("t_bc", T_BC
)
2821 p_term("t_cd", T_CD
)
2822 p_term("t_ce", T_CE
)
2823 p_term("t_cl", T_CL
)
2824 p_term("t_cm", T_CM
)
2825 p_term("t_Co", T_CCO
)
2826 p_term("t_CS", T_CCS
)
2827 p_term("t_cs", T_CS
)
2828 #ifdef FEAT_VERTSPLIT
2829 p_term("t_CV", T_CSV
)
2831 p_term("t_ut", T_UT
)
2832 p_term("t_da", T_DA
)
2833 p_term("t_db", T_DB
)
2834 p_term("t_DL", T_CDL
)
2835 p_term("t_dl", T_DL
)
2836 p_term("t_fs", T_FS
)
2837 p_term("t_IE", T_CIE
)
2838 p_term("t_IS", T_CIS
)
2839 p_term("t_ke", T_KE
)
2840 p_term("t_ks", T_KS
)
2841 p_term("t_le", T_LE
)
2842 p_term("t_mb", T_MB
)
2843 p_term("t_md", T_MD
)
2844 p_term("t_me", T_ME
)
2845 p_term("t_mr", T_MR
)
2846 p_term("t_ms", T_MS
)
2847 p_term("t_nd", T_ND
)
2848 p_term("t_op", T_OP
)
2849 p_term("t_RI", T_CRI
)
2850 p_term("t_RV", T_CRV
)
2851 p_term("t_Sb", T_CSB
)
2852 p_term("t_Sf", T_CSF
)
2853 p_term("t_se", T_SE
)
2854 p_term("t_so", T_SO
)
2855 p_term("t_sr", T_SR
)
2856 p_term("t_ts", T_TS
)
2857 p_term("t_te", T_TE
)
2858 p_term("t_ti", T_TI
)
2859 p_term("t_ue", T_UE
)
2860 p_term("t_us", T_US
)
2861 p_term("t_vb", T_VB
)
2862 p_term("t_ve", T_VE
)
2863 p_term("t_vi", T_VI
)
2864 p_term("t_vs", T_VS
)
2865 p_term("t_WP", T_CWP
)
2866 p_term("t_WS", T_CWS
)
2867 p_term("t_SI", T_CSI
)
2868 p_term("t_EI", T_CEI
)
2869 p_term("t_xs", T_XS
)
2870 p_term("t_ZH", T_CZH
)
2871 p_term("t_ZR", T_CZR
)
2873 /* terminal key codes are not in here */
2875 {NULL
, NULL
, 0, NULL
, PV_NONE
, {NULL
, NULL
}} /* end marker */
2878 #define PARAM_COUNT (sizeof(options) / sizeof(struct vimoption))
2881 static char *(p_ambw_values
[]) = {"single", "double",
2882 # ifdef USE_AMBIWIDTH_AUTO
2887 static char *(p_bg_values
[]) = {"light", "dark", NULL
};
2888 static char *(p_nf_values
[]) = {"octal", "hex", "alpha", NULL
};
2889 static char *(p_ff_values
[]) = {FF_UNIX
, FF_DOS
, FF_MAC
, NULL
};
2890 #ifdef FEAT_CMDL_COMPL
2891 static char *(p_wop_values
[]) = {"tagfile", NULL
};
2894 static char *(p_wak_values
[]) = {"yes", "menu", "no", NULL
};
2896 static char *(p_mousem_values
[]) = {"extend", "popup", "popup_setpos", "mac", NULL
};
2898 static char *(p_sel_values
[]) = {"inclusive", "exclusive", "old", NULL
};
2899 static char *(p_slm_values
[]) = {"mouse", "key", "cmd", NULL
};
2902 static char *(p_km_values
[]) = {"startsel", "stopsel", NULL
};
2905 static char *(p_bsdir_values
[]) = {"current", "last", "buffer", NULL
};
2907 #ifdef FEAT_SCROLLBIND
2908 static char *(p_scbopt_values
[]) = {"ver", "hor", "jump", NULL
};
2910 static char *(p_debug_values
[]) = {"msg", "throw", "beep", NULL
};
2911 #ifdef FEAT_VERTSPLIT
2912 static char *(p_ead_values
[]) = {"both", "ver", "hor", NULL
};
2914 #if defined(FEAT_QUICKFIX)
2915 # ifdef FEAT_AUTOCMD
2916 static char *(p_buftype_values
[]) = {"nofile", "nowrite", "quickfix", "help", "acwrite", NULL
};
2918 static char *(p_buftype_values
[]) = {"nofile", "nowrite", "quickfix", "help", NULL
};
2920 static char *(p_bufhidden_values
[]) = {"hide", "unload", "delete", "wipe", NULL
};
2922 static char *(p_bs_values
[]) = {"indent", "eol", "start", NULL
};
2924 static char *(p_fdm_values
[]) = {"manual", "expr", "marker", "indent", "syntax",
2929 static char *(p_fcl_values
[]) = {"all", NULL
};
2931 #ifdef FEAT_INS_EXPAND
2932 static char *(p_cot_values
[]) = {"menu", "menuone", "longest", "preview", NULL
};
2935 static void set_option_default
__ARGS((int, int opt_flags
, int compatible
));
2936 static void set_options_default
__ARGS((int opt_flags
));
2937 static char_u
*term_bg_default
__ARGS((void));
2938 static void did_set_option
__ARGS((int opt_idx
, int opt_flags
, int new_value
));
2939 static char_u
*illegal_char
__ARGS((char_u
*, int));
2940 static int string_to_key
__ARGS((char_u
*arg
));
2942 static char_u
*check_cedit
__ARGS((void));
2945 static void did_set_title
__ARGS((int icon
));
2947 static char_u
*option_expand
__ARGS((int opt_idx
, char_u
*val
));
2948 static void didset_options
__ARGS((void));
2949 static void check_string_option
__ARGS((char_u
**pp
));
2950 #if defined(FEAT_EVAL) || defined(PROTO)
2951 static long_u
*insecure_flag
__ARGS((int opt_idx
, int opt_flags
));
2953 # define insecure_flag(opt_idx, opt_flags) (&options[opt_idx].flags)
2955 static void set_string_option_global
__ARGS((int opt_idx
, char_u
**varp
));
2956 static void set_string_option
__ARGS((int opt_idx
, char_u
*value
, int opt_flags
));
2957 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
));
2958 static char_u
*set_chars_option
__ARGS((char_u
**varp
));
2959 #ifdef FEAT_CLIPBOARD
2960 static char_u
*check_clipboard_option
__ARGS((void));
2963 static char_u
*compile_cap_prog
__ARGS((buf_T
*buf
));
2966 static void set_option_scriptID_idx
__ARGS((int opt_idx
, int opt_flags
, int id
));
2968 static char_u
*set_bool_option
__ARGS((int opt_idx
, char_u
*varp
, int value
, int opt_flags
));
2969 static char_u
*set_num_option
__ARGS((int opt_idx
, char_u
*varp
, long value
, char_u
*errbuf
, size_t errbuflen
, int opt_flags
));
2970 static void check_redraw
__ARGS((long_u flags
));
2971 static int findoption
__ARGS((char_u
*));
2972 static int find_key_option
__ARGS((char_u
*));
2973 static void showoptions
__ARGS((int all
, int opt_flags
));
2974 static int optval_default
__ARGS((struct vimoption
*, char_u
*varp
));
2975 static void showoneopt
__ARGS((struct vimoption
*, int opt_flags
));
2976 static int put_setstring
__ARGS((FILE *fd
, char *cmd
, char *name
, char_u
**valuep
, int expand
));
2977 static int put_setnum
__ARGS((FILE *fd
, char *cmd
, char *name
, long *valuep
));
2978 static int put_setbool
__ARGS((FILE *fd
, char *cmd
, char *name
, int value
));
2979 static int istermoption
__ARGS((struct vimoption
*));
2980 static char_u
*get_varp_scope
__ARGS((struct vimoption
*p
, int opt_flags
));
2981 static char_u
*get_varp
__ARGS((struct vimoption
*));
2982 static void option_value2string
__ARGS((struct vimoption
*, int opt_flags
));
2983 static int wc_use_keyname
__ARGS((char_u
*varp
, long *wcp
));
2985 static void langmap_init
__ARGS((void));
2986 static void langmap_set
__ARGS((void));
2988 static void paste_option_changed
__ARGS((void));
2989 static void compatible_set
__ARGS((void));
2990 #ifdef FEAT_LINEBREAK
2991 static void fill_breakat_flags
__ARGS((void));
2993 static int opt_strings_flags
__ARGS((char_u
*val
, char **values
, unsigned *flagp
, int list
));
2994 static int check_opt_strings
__ARGS((char_u
*val
, char **values
, int));
2995 static int check_opt_wim
__ARGS((void));
2996 #ifdef FEAT_FULLSCREEN
2997 static int check_fuoptions
__ARGS((char_u
*, unsigned *, int *));
3001 * Initialize the options, first part.
3003 * Called only once from main(), just after creating the first buffer.
3011 #if defined(FEAT_GUI_MACVIM) && defined(FEAT_MBYTE)
3019 /* Be Vi compatible by default */
3022 /* Use POSIX compatibility when $VIM_POSIX is set. */
3023 if (mch_getenv((char_u
*)"VIM_POSIX") != NULL
)
3025 set_string_default("cpo", (char_u
*)CPO_ALL
);
3026 set_string_default("shm", (char_u
*)"A");
3030 * Find default value for 'shell' option.
3031 * Don't use it if it is empty.
3033 if (((p
= mch_getenv((char_u
*)"SHELL")) != NULL
&& *p
!= NUL
)
3034 #if defined(MSDOS) || defined(MSWIN) || defined(OS2)
3036 || ((p
= mch_getenv((char_u
*)"EMXSHELL")) != NULL
&& *p
!= NUL
)
3038 || ((p
= mch_getenv((char_u
*)"COMSPEC")) != NULL
&& *p
!= NUL
)
3040 || ((p
= default_shell()) != NULL
&& *p
!= NUL
)
3044 set_string_default("sh", p
);
3048 * Set the default for 'backupskip' to include environment variables for
3053 static char *(names
[4]) = {"", "TMPDIR", "TEMP", "TMP"};
3055 static char *(names
[3]) = {"TMPDIR", "TEMP", "TMP"};
3061 ga_init2(&ga
, 1, 100);
3062 for (n
= 0; n
< (long)(sizeof(names
) / sizeof(char *)); ++n
)
3066 if (*names
[n
] == NUL
)
3067 p
= (char_u
*)"/tmp";
3070 p
= vim_getenv((char_u
*)names
[n
], &mustfree
);
3071 if (p
!= NULL
&& *p
!= NUL
)
3073 /* First time count the NUL, otherwise count the ','. */
3074 len
= (int)STRLEN(p
) + 3;
3075 if (ga_grow(&ga
, len
) == OK
)
3078 STRCAT(ga
.ga_data
, ",");
3079 STRCAT(ga
.ga_data
, p
);
3080 add_pathsep(ga
.ga_data
);
3081 STRCAT(ga
.ga_data
, "*");
3088 if (ga
.ga_data
!= NULL
)
3090 set_string_default("bsk", ga
.ga_data
);
3091 vim_free(ga
.ga_data
);
3097 * 'maxmemtot' and 'maxmem' may have to be adjusted for available memory
3099 opt_idx
= findoption((char_u
*)"maxmemtot");
3102 #if !defined(HAVE_AVAIL_MEM) && !defined(HAVE_TOTAL_MEM)
3103 if (options
[opt_idx
].def_val
[VI_DEFAULT
] == (char_u
*)0L)
3106 #ifdef HAVE_AVAIL_MEM
3107 /* Use amount of memory available at this moment. */
3108 n
= (mch_avail_mem(FALSE
) >> 11);
3110 # ifdef HAVE_TOTAL_MEM
3111 /* Use amount of memory available to Vim. */
3112 n
= (mch_total_mem(FALSE
) >> 1);
3114 n
= (0x7fffffff >> 11);
3117 options
[opt_idx
].def_val
[VI_DEFAULT
] = (char_u
*)n
;
3118 opt_idx
= findoption((char_u
*)"maxmem");
3121 #if !defined(HAVE_AVAIL_MEM) && !defined(HAVE_TOTAL_MEM)
3122 if ((long)options
[opt_idx
].def_val
[VI_DEFAULT
] > n
3123 || (long)options
[opt_idx
].def_val
[VI_DEFAULT
] == 0L)
3125 options
[opt_idx
].def_val
[VI_DEFAULT
] = (char_u
*)n
;
3131 /* force 'shortname' for Win32s */
3132 if (gui_is_win32s())
3134 opt_idx
= findoption((char_u
*)"shortname");
3136 options
[opt_idx
].def_val
[VI_DEFAULT
] = (char_u
*)TRUE
;
3140 #ifdef FEAT_SEARCHPATH
3146 int mustfree
= FALSE
;
3148 /* Initialize the 'cdpath' option's default value. */
3149 cdpath
= vim_getenv((char_u
*)"CDPATH", &mustfree
);
3152 buf
= alloc((unsigned)((STRLEN(cdpath
) << 1) + 2));
3155 buf
[0] = ','; /* start with ",", current dir first */
3157 for (i
= 0; cdpath
[i
] != NUL
; ++i
)
3159 if (vim_ispathlistsep(cdpath
[i
]))
3163 if (cdpath
[i
] == ' ' || cdpath
[i
] == ',')
3165 buf
[j
++] = cdpath
[i
];
3169 opt_idx
= findoption((char_u
*)"cdpath");
3172 options
[opt_idx
].def_val
[VI_DEFAULT
] = buf
;
3173 options
[opt_idx
].flags
|= P_DEF_ALLOCED
;
3182 #if defined(FEAT_POSTSCRIPT) && (defined(MSWIN) || defined(OS2) || defined(VMS) || defined(EBCDIC) || defined(MAC) || defined(hpux))
3183 /* Set print encoding on platforms that don't default to latin1 */
3184 set_string_default("penc",
3185 # if defined(MSWIN) || defined(OS2)
3192 (char_u
*)"ebcdic-uk"
3195 (char_u
*)"mac-roman"
3197 (char_u
*)"hp-roman8"
3205 #ifdef FEAT_POSTSCRIPT
3206 /* 'printexpr' must be allocated to be able to evaluate it. */
3207 set_string_default("pexpr",
3208 # if defined(MSWIN) || defined(MSDOS) || defined(OS2)
3209 (char_u
*)"system('copy' . ' ' . v:fname_in . (&printdevice == '' ? ' LPT1:' : (' \"' . &printdevice . '\"'))) . delete(v:fname_in)"
3212 (char_u
*)"system('print/delete' . (&printdevice == '' ? '' : ' /queue=' . &printdevice) . ' ' . v:fname_in)"
3215 (char_u
*)"system('lpr' . (&printdevice == '' ? '' : ' -P' . &printdevice) . ' ' . v:fname_in) . delete(v:fname_in) + v:shell_error"
3222 * Set all the options (except the terminal options) to their default
3223 * value. Also set the global value for local options.
3225 set_options_default(0);
3228 if (found_reverse_arg
)
3229 set_option_value((char_u
*)"bg", 0L, (char_u
*)"dark", 0);
3232 curbuf
->b_p_initialized
= TRUE
;
3233 curbuf
->b_p_ar
= -1; /* no local 'autoread' value */
3234 check_buf_options(curbuf
);
3235 check_win_options(curwin
);
3238 /* Must be before option_expand(), because that one needs vim_isIDc() */
3242 /* Use the current chartab for the generic chartab. */
3243 init_spell_chartab();
3246 #ifdef FEAT_LINEBREAK
3248 * initialize the table for 'breakat'.
3250 fill_breakat_flags();
3254 * Expand environment variables and things like "~" for the defaults.
3255 * If option_expand() returns non-NULL the variable is expanded. This can
3256 * only happen for non-indirect options.
3257 * Also set the default to the expanded value, so ":set" does not list
3259 * Don't set the P_ALLOCED flag, because we don't want to free the
3262 for (opt_idx
= 0; !istermoption(&options
[opt_idx
]); opt_idx
++)
3264 if ((options
[opt_idx
].flags
& P_GETTEXT
)
3265 && options
[opt_idx
].var
!= NULL
)
3266 p
= (char_u
*)_(*(char **)options
[opt_idx
].var
);
3268 p
= option_expand(opt_idx
, NULL
);
3269 if (p
!= NULL
&& (p
= vim_strsave(p
)) != NULL
)
3271 *(char_u
**)options
[opt_idx
].var
= p
;
3273 * Defaults for all expanded options are currently the same for Vi
3274 * and Vim. When this changes, add some code here! Also need to
3275 * split P_DEF_ALLOCED in two.
3277 if (options
[opt_idx
].flags
& P_DEF_ALLOCED
)
3278 vim_free(options
[opt_idx
].def_val
[VI_DEFAULT
]);
3279 options
[opt_idx
].def_val
[VI_DEFAULT
] = p
;
3280 options
[opt_idx
].flags
|= P_DEF_ALLOCED
;
3284 /* Initialize the highlight_attr[] table. */
3285 highlight_changed();
3287 save_file_ff(curbuf
); /* Buffer is unchanged */
3289 /* Parse default for 'wildmode' */
3292 #if defined(FEAT_ARABIC)
3293 /* Detect use of mlterm.
3294 * Mlterm is a terminal emulator akin to xterm that has some special
3295 * abilities (bidi namely).
3296 * NOTE: mlterm's author is being asked to 'set' a variable
3297 * instead of an environment variable due to inheritance.
3299 if (mch_getenv((char_u
*)"MLTERM") != NULL
)
3300 set_option_value((char_u
*)"tbidi", 1L, NULL
, 0);
3303 #if defined(FEAT_WINDOWS) || defined(FEAT_FOLDING)
3304 /* Parse default for 'fillchars'. */
3305 (void)set_chars_option(&p_fcs
);
3308 #ifdef FEAT_CLIPBOARD
3309 /* Parse default for 'clipboard' */
3310 (void)check_clipboard_option();
3314 # if defined(WIN3264) && defined(FEAT_GETTEXT)
3316 * If $LANG isn't set, try to get a good value for it. This makes the
3317 * right language be used automatically. Don't do this for English.
3319 if (mch_getenv((char_u
*)"LANG") == NULL
)
3323 /* Could use LOCALE_SISO639LANGNAME, but it's not in Win95.
3324 * LOCALE_SABBREVLANGNAME gives us three letters, like "enu", we use
3325 * only the first two. */
3326 n
= GetLocaleInfo(LOCALE_USER_DEFAULT
, LOCALE_SABBREVLANGNAME
,
3328 if (n
>= 2 && STRNICMP(buf
, "en", 2) != 0)
3330 /* There are a few exceptions (probably more) */
3331 if (STRNICMP(buf
, "cht", 3) == 0 || STRNICMP(buf
, "zht", 3) == 0)
3332 STRCPY(buf
, "zh_TW");
3333 else if (STRNICMP(buf
, "chs", 3) == 0
3334 || STRNICMP(buf
, "zhc", 3) == 0)
3335 STRCPY(buf
, "zh_CN");
3336 else if (STRNICMP(buf
, "jp", 2) == 0)
3339 buf
[2] = NUL
; /* truncate to two-letter code */
3340 vim_setenv("LANG", buf
);
3344 # ifdef MACOS_CONVERT
3345 /* Moved to os_mac_conv.c to avoid dependency problems. */
3350 /* enc_locale() will try to find the encoding of the current locale. */
3356 /* Try setting 'encoding' and check if the value is valid.
3357 * If not, go back to the default "latin1". */
3360 if (STRCMP(p_enc
, "gb18030") == 0)
3362 /* We don't support "gb18030", but "cp936" is a good substitute
3363 * for practical purposes, thus use that. It's not an alias to
3364 * still support conversion between gb18030 and utf-8. */
3365 p_enc
= vim_strsave((char_u
*)"cp936");
3368 #if defined(FEAT_GUI_MACVIM)
3369 did_mb_init
= (mb_init() == NULL
);
3372 /* The encoding returned by enc_locale() was invalid, so fall back
3373 * on using utf-8 as the default encoding in MacVim. */
3375 p_enc
= vim_strsave((char_u
*)"utf-8");
3376 did_mb_init
= (mb_init() == NULL
);
3379 /* did_mb_init should always be TRUE, but check just in case. */
3382 if (mb_init() == NULL
)
3385 opt_idx
= findoption((char_u
*)"encoding");
3388 options
[opt_idx
].def_val
[VI_DEFAULT
] = p_enc
;
3389 options
[opt_idx
].flags
|= P_DEF_ALLOCED
;
3392 #if defined(MSDOS) || defined(MSWIN) || defined(OS2) || defined(MACOS) \
3394 if (STRCMP(p_enc
, "latin1") == 0
3400 /* Adjust the default for 'isprint' and 'iskeyword' to match
3401 * latin1. Also set the defaults for when 'nocompatible' is
3403 set_string_option_direct((char_u
*)"isp", -1,
3404 ISP_LATIN1
, OPT_FREE
, SID_NONE
);
3405 set_string_option_direct((char_u
*)"isk", -1,
3406 ISK_LATIN1
, OPT_FREE
, SID_NONE
);
3407 opt_idx
= findoption((char_u
*)"isp");
3409 options
[opt_idx
].def_val
[VIM_DEFAULT
] = ISP_LATIN1
;
3410 opt_idx
= findoption((char_u
*)"isk");
3412 options
[opt_idx
].def_val
[VIM_DEFAULT
] = ISK_LATIN1
;
3413 (void)init_chartab();
3417 # if defined(WIN3264) && !defined(FEAT_GUI)
3418 /* Win32 console: When GetACP() returns a different value from
3419 * GetConsoleCP() set 'termencoding'. */
3420 if (GetACP() != GetConsoleCP())
3424 sprintf(buf
, "cp%ld", (long)GetConsoleCP());
3425 p_tenc
= vim_strsave((char_u
*)buf
);
3428 opt_idx
= findoption((char_u
*)"termencoding");
3431 options
[opt_idx
].def_val
[VI_DEFAULT
] = p_tenc
;
3432 options
[opt_idx
].flags
|= P_DEF_ALLOCED
;
3434 convert_setup(&input_conv
, p_tenc
, p_enc
);
3435 convert_setup(&output_conv
, p_enc
, p_tenc
);
3438 p_tenc
= empty_option
;
3441 # if defined(WIN3264) && defined(FEAT_MBYTE)
3442 /* $HOME may have characters in active code page. */
3454 #ifdef FEAT_MULTI_LANG
3455 /* Set the default for 'helplang'. */
3456 set_helplang_default(get_mess_lang());
3461 * Set an option to its default value.
3462 * This does not take care of side effects!
3465 set_option_default(opt_idx
, opt_flags
, compatible
)
3467 int opt_flags
; /* OPT_FREE, OPT_LOCAL and/or OPT_GLOBAL */
3468 int compatible
; /* use Vi default value */
3470 char_u
*varp
; /* pointer to variable for current option */
3471 int dvi
; /* index in def_val[] */
3474 int both
= (opt_flags
& (OPT_LOCAL
| OPT_GLOBAL
)) == 0;
3476 varp
= get_varp_scope(&(options
[opt_idx
]), both
? OPT_LOCAL
: opt_flags
);
3477 flags
= options
[opt_idx
].flags
;
3478 if (varp
!= NULL
) /* skip hidden option, nothing to do for it */
3480 dvi
= ((flags
& P_VI_DEF
) || compatible
) ? VI_DEFAULT
: VIM_DEFAULT
;
3481 if (flags
& P_STRING
)
3483 /* Use set_string_option_direct() for local options to handle
3484 * freeing and allocating the value. */
3485 if (options
[opt_idx
].indir
!= PV_NONE
)
3486 set_string_option_direct(NULL
, opt_idx
,
3487 options
[opt_idx
].def_val
[dvi
], opt_flags
, 0);
3490 if ((opt_flags
& OPT_FREE
) && (flags
& P_ALLOCED
))
3491 free_string_option(*(char_u
**)(varp
));
3492 *(char_u
**)varp
= options
[opt_idx
].def_val
[dvi
];
3493 options
[opt_idx
].flags
&= ~P_ALLOCED
;
3496 else if (flags
& P_NUM
)
3498 if (options
[opt_idx
].indir
== PV_SCROLL
)
3499 win_comp_scroll(curwin
);
3502 *(long *)varp
= (long)(long_i
)options
[opt_idx
].def_val
[dvi
];
3503 /* May also set global value for local option. */
3505 *(long *)get_varp_scope(&(options
[opt_idx
]), OPT_GLOBAL
) =
3511 /* the cast to long is required for Manx C, long_i is needed for
3513 *(int *)varp
= (int)(long)(long_i
)options
[opt_idx
].def_val
[dvi
];
3515 /* 'modeline' defaults to off for root */
3516 if (options
[opt_idx
].indir
== PV_ML
&& getuid() == ROOT_UID
)
3517 *(int *)varp
= FALSE
;
3519 /* May also set global value for local option. */
3521 *(int *)get_varp_scope(&(options
[opt_idx
]), OPT_GLOBAL
) =
3525 /* The default value is not insecure. */
3526 flagsp
= insecure_flag(opt_idx
, opt_flags
);
3527 *flagsp
= *flagsp
& ~P_INSECURE
;
3531 set_option_scriptID_idx(opt_idx
, opt_flags
, current_SID
);
3536 * Set all options (except terminal options) to their default value.
3539 set_options_default(opt_flags
)
3540 int opt_flags
; /* OPT_FREE, OPT_LOCAL and/or OPT_GLOBAL */
3548 for (i
= 0; !istermoption(&options
[i
]); i
++)
3549 if (!(options
[i
].flags
& P_NODEFAULT
))
3550 set_option_default(i
, opt_flags
, p_cp
);
3553 /* The 'scroll' option must be computed for all windows. */
3554 FOR_ALL_TAB_WINDOWS(tp
, wp
)
3555 win_comp_scroll(wp
);
3557 win_comp_scroll(curwin
);
3562 * Set the Vi-default value of a string option.
3563 * Used for 'sh', 'backupskip' and 'term'.
3566 set_string_default(name
, val
)
3573 p
= vim_strsave(val
);
3574 if (p
!= NULL
) /* we don't want a NULL */
3576 opt_idx
= findoption((char_u
*)name
);
3579 if (options
[opt_idx
].flags
& P_DEF_ALLOCED
)
3580 vim_free(options
[opt_idx
].def_val
[VI_DEFAULT
]);
3581 options
[opt_idx
].def_val
[VI_DEFAULT
] = p
;
3582 options
[opt_idx
].flags
|= P_DEF_ALLOCED
;
3588 * Set the Vi-default value of a number option.
3589 * Used for 'lines' and 'columns'.
3592 set_number_default(name
, val
)
3598 opt_idx
= findoption((char_u
*)name
);
3600 options
[opt_idx
].def_val
[VI_DEFAULT
] = (char_u
*)(long_i
)val
;
3603 #if defined(EXITFREE) || defined(PROTO)
3612 for (i
= 0; !istermoption(&options
[i
]); i
++)
3614 if (options
[i
].indir
== PV_NONE
)
3616 /* global option: free value and default value. */
3617 if (options
[i
].flags
& P_ALLOCED
&& options
[i
].var
!= NULL
)
3618 free_string_option(*(char_u
**)options
[i
].var
);
3619 if (options
[i
].flags
& P_DEF_ALLOCED
)
3620 free_string_option(options
[i
].def_val
[VI_DEFAULT
]);
3622 else if (options
[i
].var
!= VAR_WIN
3623 && (options
[i
].flags
& P_STRING
))
3624 /* buffer-local option: free global value */
3625 free_string_option(*(char_u
**)options
[i
].var
);
3632 * Initialize the options, part two: After getting Rows and Columns and
3641 * 'scroll' defaults to half the window height. Note that this default is
3642 * wrong when the window height changes.
3644 set_number_default("scroll", (long)((long_u
)Rows
>> 1));
3645 idx
= findoption((char_u
*)"scroll");
3646 if (idx
>= 0 && !(options
[idx
].flags
& P_WAS_SET
))
3647 set_option_default(idx
, OPT_LOCAL
, p_cp
);
3651 * 'window' is only for backwards compatibility with Vi.
3652 * Default is Rows - 1.
3654 if (!option_was_set((char_u
*)"window"))
3655 p_window
= Rows
- 1;
3656 set_number_default("window", Rows
- 1);
3658 /* For DOS console the default is always black. */
3659 #if !((defined(MSDOS) || defined(OS2) || defined(WIN3264)) && !defined(FEAT_GUI))
3661 * If 'background' wasn't set by the user, try guessing the value,
3662 * depending on the terminal name. Only need to check for terminals
3663 * with a dark background, that can handle color.
3665 idx
= findoption((char_u
*)"bg");
3666 if (idx
>= 0 && !(options
[idx
].flags
& P_WAS_SET
)
3667 && *term_bg_default() == 'd')
3669 set_string_option_direct(NULL
, idx
, (char_u
*)"dark", OPT_FREE
, 0);
3670 /* don't mark it as set, when starting the GUI it may be
3672 options
[idx
].flags
&= ~P_WAS_SET
;
3677 parse_shape_opt(SHAPE_CURSOR
); /* set cursor shapes from 'guicursor' */
3679 #ifdef FEAT_MOUSESHAPE
3680 parse_shape_opt(SHAPE_MOUSE
); /* set mouse shapes from 'mouseshape' */
3683 (void)parse_printoptions(); /* parse 'printoptions' default value */
3688 * Return "dark" or "light" depending on the kind of terminal.
3689 * This is just guessing! Recognized are:
3690 * "linux" Linux console
3691 * "screen.linux" Linux console with screen
3692 * "cygwin" Cygwin shell
3693 * "putty" Putty program
3694 * We also check the COLORFGBG environment variable, which is set by
3695 * rxvt and derivatives. This variable contains either two or three
3696 * values separated by semicolons; we want the last value in either
3697 * case. If this value is 0-6 or 8, our background is dark.
3702 #if defined(MSDOS) || defined(OS2) || defined(WIN3264)
3703 /* DOS console nearly always black */
3704 return (char_u
*)"dark";
3708 if (STRCMP(T_NAME
, "linux") == 0
3709 || STRCMP(T_NAME
, "screen.linux") == 0
3710 || STRCMP(T_NAME
, "cygwin") == 0
3711 || STRCMP(T_NAME
, "putty") == 0
3712 || ((p
= mch_getenv((char_u
*)"COLORFGBG")) != NULL
3713 && (p
= vim_strrchr(p
, ';')) != NULL
3714 && ((p
[1] >= '0' && p
[1] <= '6') || p
[1] == '8')
3716 return (char_u
*)"dark";
3717 return (char_u
*)"light";
3722 * Initialize the options, part three: After reading the .vimrc
3727 #if defined(UNIX) || defined(OS2) || defined(WIN3264)
3729 * Set 'shellpipe' and 'shellredir', depending on the 'shell' option.
3730 * This is done after other initializations, where 'shell' might have been
3731 * set, but only if they have not been set before.
3736 #ifdef FEAT_QUICKFIX
3741 idx_srr
= findoption((char_u
*)"srr");
3745 do_srr
= !(options
[idx_srr
].flags
& P_WAS_SET
);
3746 #ifdef FEAT_QUICKFIX
3747 idx_sp
= findoption((char_u
*)"sp");
3751 do_sp
= !(options
[idx_sp
].flags
& P_WAS_SET
);
3755 * Isolate the name of the shell:
3756 * - Skip beyond any path. E.g., "/usr/bin/csh -f" -> "csh -f".
3757 * - Remove any argument. E.g., "csh -f" -> "csh".
3760 p
= vim_strnsave(p
, (int)(skiptowhite(p
) - p
));
3764 * Default for p_sp is "| tee", for p_srr is ">".
3765 * For known shells it is changed here to include stderr.
3767 if ( fnamecmp(p
, "csh") == 0
3768 || fnamecmp(p
, "tcsh") == 0
3769 # if defined(OS2) || defined(WIN3264) /* also check with .exe extension */
3770 || fnamecmp(p
, "csh.exe") == 0
3771 || fnamecmp(p
, "tcsh.exe") == 0
3775 #if defined(FEAT_QUICKFIX)
3779 p_sp
= (char_u
*)">&";
3781 p_sp
= (char_u
*)"|& tee";
3783 options
[idx_sp
].def_val
[VI_DEFAULT
] = p_sp
;
3788 p_srr
= (char_u
*)">&";
3789 options
[idx_srr
].def_val
[VI_DEFAULT
] = p_srr
;
3793 # ifndef OS2 /* Always use bourne shell style redirection if we reach this */
3794 if ( fnamecmp(p
, "sh") == 0
3795 || fnamecmp(p
, "ksh") == 0
3796 || fnamecmp(p
, "zsh") == 0
3797 || fnamecmp(p
, "zsh-beta") == 0
3798 || fnamecmp(p
, "bash") == 0
3800 || fnamecmp(p
, "cmd") == 0
3801 || fnamecmp(p
, "sh.exe") == 0
3802 || fnamecmp(p
, "ksh.exe") == 0
3803 || fnamecmp(p
, "zsh.exe") == 0
3804 || fnamecmp(p
, "zsh-beta.exe") == 0
3805 || fnamecmp(p
, "bash.exe") == 0
3806 || fnamecmp(p
, "cmd.exe") == 0
3811 #if defined(FEAT_QUICKFIX)
3815 p_sp
= (char_u
*)">%s 2>&1";
3817 p_sp
= (char_u
*)"2>&1| tee";
3819 options
[idx_sp
].def_val
[VI_DEFAULT
] = p_sp
;
3824 p_srr
= (char_u
*)">%s 2>&1";
3825 options
[idx_srr
].def_val
[VI_DEFAULT
] = p_srr
;
3832 #if defined(MSDOS) || defined(WIN3264) || defined(OS2)
3834 * Set 'shellcmdflag and 'shellquote' depending on the 'shell' option.
3835 * This is done after other initializations, where 'shell' might have been
3836 * set, but only if they have not been set before. Default for p_shcf is
3837 * "/c", for p_shq is "". For "sh" like shells it is changed here to
3838 * "-c" and "\"", but not for DJGPP, because it starts the shell without
3839 * command.com. And for Win32 we need to set p_sxq instead.
3841 if (strstr((char *)gettail(p_sh
), "sh") != NULL
)
3845 idx3
= findoption((char_u
*)"shcf");
3846 if (idx3
>= 0 && !(options
[idx3
].flags
& P_WAS_SET
))
3848 p_shcf
= (char_u
*)"-c";
3849 options
[idx3
].def_val
[VI_DEFAULT
] = p_shcf
;
3854 /* Somehow Win32 requires the quotes around the redirection too */
3855 idx3
= findoption((char_u
*)"sxq");
3856 if (idx3
>= 0 && !(options
[idx3
].flags
& P_WAS_SET
))
3858 p_sxq
= (char_u
*)"\"";
3859 options
[idx3
].def_val
[VI_DEFAULT
] = p_sxq
;
3862 idx3
= findoption((char_u
*)"shq");
3863 if (idx3
>= 0 && !(options
[idx3
].flags
& P_WAS_SET
))
3865 p_shq
= (char_u
*)"\"";
3866 options
[idx3
].def_val
[VI_DEFAULT
] = p_shq
;
3874 set_title_defaults();
3878 #if defined(FEAT_MULTI_LANG) || defined(PROTO)
3880 * When 'helplang' is still at its default value, set it to "lang".
3881 * Only the first two characters of "lang" are used.
3884 set_helplang_default(lang
)
3889 if (lang
== NULL
|| STRLEN(lang
) < 2) /* safety check */
3891 idx
= findoption((char_u
*)"hlg");
3892 if (idx
>= 0 && !(options
[idx
].flags
& P_WAS_SET
))
3894 if (options
[idx
].flags
& P_ALLOCED
)
3895 free_string_option(p_hlg
);
3896 p_hlg
= vim_strsave(lang
);
3898 p_hlg
= empty_option
;
3901 /* zh_CN becomes "cn", zh_TW becomes "tw". */
3902 if (STRNICMP(p_hlg
, "zh_", 3) == 0 && STRLEN(p_hlg
) >= 5)
3904 p_hlg
[0] = TOLOWER_ASC(p_hlg
[3]);
3905 p_hlg
[1] = TOLOWER_ASC(p_hlg
[4]);
3909 options
[idx
].flags
|= P_ALLOCED
;
3915 static char_u
*gui_bg_default
__ARGS((void));
3920 if (gui_get_lightness(gui
.back_pixel
) < 127)
3921 return (char_u
*)"dark";
3922 return (char_u
*)"light";
3926 * Option initializations that can only be done after opening the GUI window.
3931 /* Set the 'background' option according to the lightness of the
3932 * background color, unless the user has set it already. */
3933 if (!option_was_set((char_u
*)"bg") && STRCMP(p_bg
, gui_bg_default()) != 0)
3935 set_option_value((char_u
*)"bg", 0L, gui_bg_default(), 0);
3936 highlight_changed();
3943 * 'title' and 'icon' only default to true if they have not been set or reset
3944 * in .vimrc and we can read the old value.
3945 * When 'title' and 'icon' have been reset in .vimrc, we won't even check if
3946 * they can be reset. This reduces startup time when using X on a remote
3950 set_title_defaults()
3956 * If GUI is (going to be) used, we can always set the window title and
3957 * icon name. Saves a bit of time, because the X11 display server does
3958 * not need to be contacted.
3960 idx1
= findoption((char_u
*)"title");
3961 if (idx1
>= 0 && !(options
[idx1
].flags
& P_WAS_SET
))
3964 if (gui
.starting
|| gui
.in_use
)
3968 val
= mch_can_restore_title();
3969 options
[idx1
].def_val
[VI_DEFAULT
] = (char_u
*)(long_i
)val
;
3972 idx1
= findoption((char_u
*)"icon");
3973 if (idx1
>= 0 && !(options
[idx1
].flags
& P_WAS_SET
))
3976 if (gui
.starting
|| gui
.in_use
)
3980 val
= mch_can_restore_icon();
3981 options
[idx1
].def_val
[VI_DEFAULT
] = (char_u
*)(long_i
)val
;
3988 * Parse 'arg' for option settings.
3990 * 'arg' may be IObuff, but only when no errors can be present and option
3991 * does not need to be expanded with option_expand().
3994 * OPT_GLOBAL for ":setglobal"
3995 * OPT_LOCAL for ":setlocal" and a modeline
3996 * OPT_MODELINE for a modeline
3997 * OPT_WINONLY to only set window-local options
3998 * OPT_NOWIN to skip setting window-local options
4000 * returns FAIL if an error is detected, OK otherwise
4003 do_set(arg
, opt_flags
)
4004 char_u
*arg
; /* option string (may be written to!) */
4011 int prefix
; /* 1: nothing, 0: "no", 2: "inv" in front of name */
4012 int nextchar
; /* next non-white char after option name */
4013 int afterchar
; /* character just after option name */
4018 long_u flags
; /* flags for current option */
4019 char_u
*varp
= NULL
; /* pointer to variable for current option */
4020 int did_show
= FALSE
; /* already showed one value */
4021 int adding
; /* "opt+=arg" */
4022 int prepending
; /* "opt^=arg" */
4023 int removing
; /* "opt-=arg" */
4029 showoptions(0, opt_flags
);
4034 while (*arg
!= NUL
) /* loop to process all options */
4037 startarg
= arg
; /* remember for error message */
4039 if (STRNCMP(arg
, "all", 3) == 0 && !isalpha(arg
[3])
4040 && !(opt_flags
& OPT_MODELINE
))
4043 * ":set all" show all options.
4044 * ":set all&" set all options to their default value.
4050 /* Only for :set command set global value of local options. */
4051 set_options_default(OPT_FREE
| opt_flags
);
4055 showoptions(1, opt_flags
);
4059 else if (STRNCMP(arg
, "termcap", 7) == 0 && !(opt_flags
& OPT_MODELINE
))
4061 showoptions(2, opt_flags
);
4069 if (STRNCMP(arg
, "no", 2) == 0)
4074 else if (STRNCMP(arg
, "inv", 3) == 0)
4080 /* find end of name */
4086 /* look out for <t_>;> */
4087 if (arg
[1] == 't' && arg
[2] == '_' && arg
[3] && arg
[4])
4092 while (arg
[len
] != NUL
&& arg
[len
] != '>')
4095 if (arg
[len
] != '>')
4100 arg
[len
] = NUL
; /* put NUL after name */
4101 if (arg
[1] == 't' && arg
[2] == '_') /* could be term code */
4102 opt_idx
= findoption(arg
+ 1);
4103 arg
[len
++] = '>'; /* restore '>' */
4105 key
= find_key_option(arg
+ 1);
4111 * The two characters after "t_" may not be alphanumeric.
4113 if (arg
[0] == 't' && arg
[1] == '_' && arg
[2] && arg
[3])
4116 while (ASCII_ISALNUM(arg
[len
]) || arg
[len
] == '_')
4118 nextchar
= arg
[len
];
4119 arg
[len
] = NUL
; /* put NUL after name */
4120 opt_idx
= findoption(arg
);
4121 arg
[len
] = nextchar
; /* restore nextchar */
4123 key
= find_key_option(arg
);
4126 /* remember character after option name */
4127 afterchar
= arg
[len
];
4129 /* skip white space, allow ":set ai ?" */
4130 while (vim_iswhite(arg
[len
]))
4136 if (arg
[len
] != NUL
&& arg
[len
+ 1] == '=')
4138 if (arg
[len
] == '+')
4140 adding
= TRUE
; /* "+=" */
4143 else if (arg
[len
] == '^')
4145 prepending
= TRUE
; /* "^=" */
4148 else if (arg
[len
] == '-')
4150 removing
= TRUE
; /* "-=" */
4154 nextchar
= arg
[len
];
4156 if (opt_idx
== -1 && key
== 0) /* found a mismatch: skip */
4158 errmsg
= (char_u
*)N_("E518: Unknown option");
4164 if (options
[opt_idx
].var
== NULL
) /* hidden option: skip */
4166 /* Only give an error message when requesting the value of
4167 * a hidden option, ignore setting it. */
4168 if (vim_strchr((char_u
*)"=:!&<", nextchar
) == NULL
4169 && (!(options
[opt_idx
].flags
& P_BOOL
)
4170 || nextchar
== '?'))
4171 errmsg
= (char_u
*)N_("E519: Option not supported");
4175 flags
= options
[opt_idx
].flags
;
4176 varp
= get_varp_scope(&(options
[opt_idx
]), opt_flags
);
4183 key_name
[0] = KEY2TERMCAP0(key
);
4184 key_name
[1] = KEY2TERMCAP1(key
);
4188 key_name
[0] = KS_KEY
;
4189 key_name
[1] = (key
& 0xff);
4193 /* Skip all options that are not window-local (used when showing
4194 * an already loaded buffer in a window). */
4195 if ((opt_flags
& OPT_WINONLY
)
4196 && (opt_idx
< 0 || options
[opt_idx
].var
!= VAR_WIN
))
4199 /* Skip all options that are window-local (used for :vimgrep). */
4200 if ((opt_flags
& OPT_NOWIN
) && opt_idx
>= 0
4201 && options
[opt_idx
].var
== VAR_WIN
)
4204 /* Disallow changing some options from modelines. */
4205 if (opt_flags
& OPT_MODELINE
)
4207 if (flags
& P_SECURE
)
4209 errmsg
= (char_u
*)_("E520: Not allowed in a modeline");
4213 /* In diff mode some options are overruled. This avoids that
4214 * 'foldmethod' becomes "marker" instead of "diff" and that
4215 * "wrap" gets set. */
4216 if (curwin
->w_p_diff
4217 && (options
[opt_idx
].indir
== PV_FDM
4218 || options
[opt_idx
].indir
== PV_WRAP
))
4224 /* Disallow changing some options in the sandbox */
4225 if (sandbox
!= 0 && (flags
& P_SECURE
))
4227 errmsg
= (char_u
*)_(e_sandbox
);
4232 if (vim_strchr((char_u
*)"?=:!&<", nextchar
) != NULL
)
4236 if (nextchar
== '&' && arg
[1] == 'v' && arg
[2] == 'i')
4238 if (arg
[3] == 'm') /* "opt&vim": set to Vim default */
4243 else /* "opt&vi": set to Vi default */
4249 if (vim_strchr((char_u
*)"?!&<", nextchar
) != NULL
4250 && arg
[1] != NUL
&& !vim_iswhite(arg
[1]))
4252 errmsg
= e_trailing
;
4258 * allow '=' and ':' as MSDOS command.com allows only one
4259 * '=' character per "set" command line. grrr. (jw)
4263 && vim_strchr((char_u
*)"=:&<", nextchar
) == NULL
4264 && !(flags
& P_BOOL
)))
4270 msg_putchar('\n'); /* cursor below last one */
4273 gotocmdline(TRUE
); /* cursor at status line */
4274 did_show
= TRUE
; /* remember that we did a line */
4278 showoneopt(&options
[opt_idx
], opt_flags
);
4282 /* Mention where the option was last set. */
4283 if (varp
== options
[opt_idx
].var
)
4284 last_set_msg(options
[opt_idx
].scriptID
);
4285 else if ((int)options
[opt_idx
].indir
& PV_WIN
)
4286 last_set_msg(curwin
->w_p_scriptID
[
4287 (int)options
[opt_idx
].indir
& PV_MASK
]);
4288 else if ((int)options
[opt_idx
].indir
& PV_BUF
)
4289 last_set_msg(curbuf
->b_p_scriptID
[
4290 (int)options
[opt_idx
].indir
& PV_MASK
]);
4298 p
= find_termcode(key_name
);
4301 errmsg
= (char_u
*)N_("E518: Unknown option");
4305 (void)show_one_termcode(key_name
, p
, TRUE
);
4308 && nextchar
!= NUL
&& !vim_iswhite(afterchar
))
4309 errmsg
= e_trailing
;
4313 if (flags
& P_BOOL
) /* boolean */
4315 if (nextchar
== '=' || nextchar
== ':')
4322 * ":set opt!": invert
4323 * ":set opt&": reset to default value
4324 * ":set opt<": reset to global value
4326 if (nextchar
== '!')
4327 value
= *(int *)(varp
) ^ 1;
4328 else if (nextchar
== '&')
4329 value
= (int)(long)(long_i
)options
[opt_idx
].def_val
[
4330 ((flags
& P_VI_DEF
) || cp_val
)
4331 ? VI_DEFAULT
: VIM_DEFAULT
];
4332 else if (nextchar
== '<')
4334 /* For 'autoread' -1 means to use global value. */
4335 if ((int *)varp
== &curbuf
->b_p_ar
4336 && opt_flags
== OPT_LOCAL
)
4339 value
= *(int *)get_varp_scope(&(options
[opt_idx
]),
4345 * ":set invopt": invert
4346 * ":set opt" or ":set noopt": set or reset
4348 if (nextchar
!= NUL
&& !vim_iswhite(afterchar
))
4350 errmsg
= e_trailing
;
4353 if (prefix
== 2) /* inv */
4354 value
= *(int *)(varp
) ^ 1;
4359 errmsg
= set_bool_option(opt_idx
, varp
, (int)value
,
4362 else /* numeric or string */
4364 if (vim_strchr((char_u
*)"=:&<", nextchar
) == NULL
4371 if (flags
& P_NUM
) /* numeric */
4374 * Different ways to set a number option:
4375 * & set to default value
4376 * < set to global value
4377 * <xx> accept special key codes for 'wildchar'
4378 * c accept any non-digit for 'wildchar'
4383 if (nextchar
== '&')
4384 value
= (long)(long_i
)options
[opt_idx
].def_val
[
4385 ((flags
& P_VI_DEF
) || cp_val
)
4386 ? VI_DEFAULT
: VIM_DEFAULT
];
4387 else if (nextchar
== '<')
4388 value
= *(long *)get_varp_scope(&(options
[opt_idx
]),
4390 else if (((long *)varp
== &p_wc
4391 || (long *)varp
== &p_wcm
)
4394 || ((!arg
[1] || vim_iswhite(arg
[1]))
4395 && !VIM_ISDIGIT(*arg
))))
4397 value
= string_to_key(arg
);
4398 if (value
== 0 && (long *)varp
!= &p_wcm
)
4404 /* allow negative numbers (for 'undolevels') */
4405 else if (*arg
== '-' || VIM_ISDIGIT(*arg
))
4411 value
= strtol((char *)arg
, NULL
, 0);
4412 if (arg
[i
] == '0' && TOLOWER_ASC(arg
[i
+ 1]) == 'x')
4415 value
= atol((char *)arg
);
4417 while (VIM_ISDIGIT(arg
[i
]))
4419 if (arg
[i
] != NUL
&& !vim_iswhite(arg
[i
]))
4427 errmsg
= (char_u
*)N_("E521: Number required after =");
4432 value
= *(long *)varp
+ value
;
4434 value
= *(long *)varp
* value
;
4436 value
= *(long *)varp
- value
;
4437 errmsg
= set_num_option(opt_idx
, varp
, value
,
4438 errbuf
, sizeof(errbuf
), opt_flags
);
4440 else if (opt_idx
>= 0) /* string */
4442 char_u
*save_arg
= NULL
;
4444 char_u
*oldval
; /* previous value if *varp */
4450 int new_value_alloced
; /* new string option
4453 /* When using ":set opt=val" for a global option
4454 * with a local value the local value will be
4455 * reset, use the global value here. */
4456 if ((opt_flags
& (OPT_LOCAL
| OPT_GLOBAL
)) == 0
4457 && ((int)options
[opt_idx
].indir
& PV_BOTH
))
4458 varp
= options
[opt_idx
].var
;
4460 /* The old value is kept until we are sure that the
4461 * new value is valid. */
4462 oldval
= *(char_u
**)varp
;
4463 if (nextchar
== '&') /* set to default val */
4465 newval
= options
[opt_idx
].def_val
[
4466 ((flags
& P_VI_DEF
) || cp_val
)
4467 ? VI_DEFAULT
: VIM_DEFAULT
];
4468 if ((char_u
**)varp
== &p_bg
)
4470 /* guess the value of 'background' */
4473 newval
= gui_bg_default();
4476 newval
= term_bg_default();
4479 /* expand environment variables and ~ (since the
4480 * default value was already expanded, only
4481 * required when an environment variable was set
4484 newval
= empty_option
;
4487 s
= option_expand(opt_idx
, newval
);
4490 newval
= vim_strsave(s
);
4492 new_value_alloced
= TRUE
;
4494 else if (nextchar
== '<') /* set to global val */
4496 newval
= vim_strsave(*(char_u
**)get_varp_scope(
4497 &(options
[opt_idx
]), OPT_GLOBAL
));
4498 new_value_alloced
= TRUE
;
4502 ++arg
; /* jump to after the '=' or ':' */
4505 * Set 'keywordprg' to ":help" if an empty
4506 * value was passed to :set by the user.
4507 * Misuse errbuf[] for the resulting string.
4509 if (varp
== (char_u
*)&p_kp
4510 && (*arg
== NUL
|| *arg
== ' '))
4512 STRCPY(errbuf
, ":help");
4517 * Convert 'whichwrap' number to string, for
4518 * backwards compatibility with Vim 3.0.
4519 * Misuse errbuf[] for the resulting string.
4521 else if (varp
== (char_u
*)&p_ww
4522 && VIM_ISDIGIT(*arg
))
4525 i
= getdigits(&arg
);
4527 STRCAT(errbuf
, "b,");
4529 STRCAT(errbuf
, "s,");
4531 STRCAT(errbuf
, "h,l,");
4533 STRCAT(errbuf
, "<,>,");
4535 STRCAT(errbuf
, "[,],");
4536 if (*errbuf
!= NUL
) /* remove trailing , */
4537 errbuf
[STRLEN(errbuf
) - 1] = NUL
;
4542 * Remove '>' before 'dir' and 'bdir', for
4543 * backwards compatibility with version 3.0
4545 else if ( *arg
== '>'
4546 && (varp
== (char_u
*)&p_dir
4547 || varp
== (char_u
*)&p_bdir
))
4552 /* When setting the local value of a global
4553 * option, the old value may be the global value. */
4554 if (((int)options
[opt_idx
].indir
& PV_BOTH
)
4555 && (opt_flags
& OPT_LOCAL
))
4556 origval
= *(char_u
**)get_varp(
4562 * Copy the new string into allocated memory.
4563 * Can't use set_string_option_direct(), because
4564 * we need to remove the backslashes.
4566 /* get a bit too much */
4567 newlen
= (unsigned)STRLEN(arg
) + 1;
4568 if (adding
|| prepending
|| removing
)
4569 newlen
+= (unsigned)STRLEN(origval
) + 1;
4570 newval
= alloc(newlen
);
4571 if (newval
== NULL
) /* out of mem, don't change */
4576 * Copy the string, skip over escaped chars.
4577 * For MS-DOS and WIN32 backslashes before normal
4578 * file name characters are not removed, and keep
4579 * backslash at start, for "\\machine\path", but
4580 * do remove it for "\\\\machine\\path".
4581 * The reverse is found in ExpandOldSetting().
4583 while (*arg
&& !vim_iswhite(*arg
))
4585 if (*arg
== '\\' && arg
[1] != NUL
4586 #ifdef BACKSLASH_IN_FILENAME
4587 && !((flags
& P_EXPAND
)
4588 && vim_isfilec(arg
[1])
4591 && arg
[2] != '\\')))
4594 ++arg
; /* remove backslash */
4597 && (i
= (*mb_ptr2len
)(arg
)) > 1)
4599 /* copy multibyte char */
4600 mch_memmove(s
, arg
, (size_t)i
);
4611 * Expand environment variables and ~.
4612 * Don't do it when adding without inserting a
4615 if (!(adding
|| prepending
|| removing
)
4616 || (flags
& P_COMMA
))
4618 s
= option_expand(opt_idx
, newval
);
4622 newlen
= (unsigned)STRLEN(s
) + 1;
4623 if (adding
|| prepending
|| removing
)
4624 newlen
+= (unsigned)STRLEN(origval
) + 1;
4625 newval
= alloc(newlen
);
4632 /* locate newval[] in origval[] when removing it
4633 * and when adding to avoid duplicates */
4634 i
= 0; /* init for GCC */
4635 if (removing
|| (flags
& P_NODUP
))
4637 i
= (int)STRLEN(newval
);
4639 for (s
= origval
; *s
; ++s
)
4641 if ((!(flags
& P_COMMA
)
4643 || (s
[-1] == ',' && !(bs
& 1)))
4644 && STRNCMP(s
, newval
, i
) == 0
4645 && (!(flags
& P_COMMA
)
4649 /* Count backspaces. Only a comma with an
4650 * even number of backspaces before it is
4651 * recognized as a separator */
4652 if (s
> origval
&& s
[-1] == '\\')
4658 /* do not add if already there */
4659 if ((adding
|| prepending
) && *s
)
4663 STRCPY(newval
, origval
);
4667 /* concatenate the two strings; add a ',' if
4669 if (adding
|| prepending
)
4671 comma
= ((flags
& P_COMMA
) && *origval
!= NUL
4675 i
= (int)STRLEN(origval
);
4676 mch_memmove(newval
+ i
+ comma
, newval
,
4677 STRLEN(newval
) + 1);
4678 mch_memmove(newval
, origval
, (size_t)i
);
4682 i
= (int)STRLEN(newval
);
4683 STRMOVE(newval
+ i
+ comma
, origval
);
4689 /* Remove newval[] from origval[]. (Note: "i" has
4690 * been set above and is used here). */
4693 STRCPY(newval
, origval
);
4696 /* may need to remove a comma */
4697 if (flags
& P_COMMA
)
4701 /* include comma after string */
4707 /* include comma before string */
4712 STRMOVE(newval
+ (s
- origval
), s
+ i
);
4716 if (flags
& P_FLAGLIST
)
4718 /* Remove flags that appear twice. */
4719 for (s
= newval
; *s
; ++s
)
4720 if ((!(flags
& P_COMMA
) || *s
!= ',')
4721 && vim_strchr(s
+ 1, *s
) != NULL
)
4728 if (save_arg
!= NULL
) /* number for 'whichwrap' */
4730 new_value_alloced
= TRUE
;
4733 /* Set the new value. */
4734 *(char_u
**)(varp
) = newval
;
4736 /* Handle side effects, and set the global value for
4737 * ":set" on local options. */
4738 errmsg
= did_set_string_option(opt_idx
, (char_u
**)varp
,
4739 new_value_alloced
, oldval
, errbuf
, opt_flags
);
4741 /* If error detected, print the error message. */
4745 else /* key code option */
4749 if (nextchar
== '&')
4751 if (add_termcap_entry(key_name
, TRUE
) == FAIL
)
4752 errmsg
= (char_u
*)N_("E522: Not found in termcap");
4756 ++arg
; /* jump to after the '=' or ':' */
4757 for (p
= arg
; *p
&& !vim_iswhite(*p
); ++p
)
4758 if (*p
== '\\' && p
[1] != NUL
)
4762 add_termcode(key_name
, arg
, FALSE
);
4767 redraw_all_later(CLEAR
);
4772 did_set_option(opt_idx
, opt_flags
,
4773 !prepending
&& !adding
&& !removing
);
4778 * Advance to next argument.
4779 * - skip until a blank found, taking care of backslashes
4781 * - skip one "=val" argument (for hidden options ":set gfn =xx")
4783 for (i
= 0; i
< 2 ; ++i
)
4785 while (*arg
!= NUL
&& !vim_iswhite(*arg
))
4786 if (*arg
++ == '\\' && *arg
!= NUL
)
4788 arg
= skipwhite(arg
);
4796 vim_strncpy(IObuff
, (char_u
*)_(errmsg
), IOSIZE
- 1);
4797 i
= (int)STRLEN(IObuff
) + 2;
4798 if (i
+ (arg
- startarg
) < IOSIZE
)
4800 /* append the argument with the error */
4801 STRCAT(IObuff
, ": ");
4802 mch_memmove(IObuff
+ i
, startarg
, (arg
- startarg
));
4803 IObuff
[i
+ (arg
- startarg
)] = NUL
;
4805 /* make sure all characters are printable */
4806 trans_characters(IObuff
, IOSIZE
);
4808 ++no_wait_return
; /* wait_return done later */
4809 emsg(IObuff
); /* show error highlighted */
4815 arg
= skipwhite(arg
);
4819 if (silent_mode
&& did_show
)
4821 /* After displaying option values in silent mode. */
4822 silent_mode
= FALSE
;
4823 info_message
= TRUE
; /* use mch_msg(), not mch_errmsg() */
4825 cursor_on(); /* msg_start() switches it off */
4828 info_message
= FALSE
; /* use mch_msg(), not mch_errmsg() */
4835 * Call this when an option has been given a new value through a user command.
4836 * Sets the P_WAS_SET flag and takes care of the P_INSECURE flag.
4839 did_set_option(opt_idx
, opt_flags
, new_value
)
4841 int opt_flags
; /* possibly with OPT_MODELINE */
4842 int new_value
; /* value was replaced completely */
4846 options
[opt_idx
].flags
|= P_WAS_SET
;
4848 /* When an option is set in the sandbox, from a modeline or in secure mode
4849 * set the P_INSECURE flag. Otherwise, if a new value is stored reset the
4851 p
= insecure_flag(opt_idx
, opt_flags
);
4856 || (opt_flags
& OPT_MODELINE
))
4857 *p
= *p
| P_INSECURE
;
4859 *p
= *p
& ~P_INSECURE
;
4863 illegal_char(errbuf
, c
)
4868 return (char_u
*)"";
4869 sprintf((char *)errbuf
, _("E539: Illegal character <%s>"),
4870 (char *)transchar(c
));
4875 * Convert a key name or string into a key value.
4876 * Used for 'wildchar' and 'cedit' options.
4883 return find_key_option(arg
+ 1);
4885 return Ctrl_chr(arg
[1]);
4891 * Check value of 'cedit' and set cedit_key.
4892 * Returns NULL if value is OK, error message otherwise.
4899 if (*p_cedit
== NUL
)
4903 n
= string_to_key(p_cedit
);
4904 if (vim_isprintc(n
))
4914 * When changing 'title', 'titlestring', 'icon' or 'iconstring', call
4915 * maketitle() to create and display it.
4916 * When switching the title or icon off, call mch_restore_title() to get
4917 * the old value back.
4921 int icon
; /* Did set icon instead of title */
4923 if (starting
!= NO_SCREEN
4933 mch_restore_title(2);
4938 mch_restore_title(1);
4945 * set_options_bin - called when 'bin' changes value.
4948 set_options_bin(oldval
, newval
, opt_flags
)
4951 int opt_flags
; /* OPT_LOCAL and/or OPT_GLOBAL */
4954 * The option values that are changed when 'bin' changes are
4955 * copied when 'bin is set and restored when 'bin' is reset.
4959 if (!oldval
) /* switched on */
4961 if (!(opt_flags
& OPT_GLOBAL
))
4963 curbuf
->b_p_tw_nobin
= curbuf
->b_p_tw
;
4964 curbuf
->b_p_wm_nobin
= curbuf
->b_p_wm
;
4965 curbuf
->b_p_ml_nobin
= curbuf
->b_p_ml
;
4966 curbuf
->b_p_et_nobin
= curbuf
->b_p_et
;
4968 if (!(opt_flags
& OPT_LOCAL
))
4977 if (!(opt_flags
& OPT_GLOBAL
))
4979 curbuf
->b_p_tw
= 0; /* no automatic line wrap */
4980 curbuf
->b_p_wm
= 0; /* no automatic line wrap */
4981 curbuf
->b_p_ml
= 0; /* no modelines */
4982 curbuf
->b_p_et
= 0; /* no expandtab */
4984 if (!(opt_flags
& OPT_LOCAL
))
4990 p_bin
= TRUE
; /* needed when called for the "-b" argument */
4993 else if (oldval
) /* switched off */
4995 if (!(opt_flags
& OPT_GLOBAL
))
4997 curbuf
->b_p_tw
= curbuf
->b_p_tw_nobin
;
4998 curbuf
->b_p_wm
= curbuf
->b_p_wm_nobin
;
4999 curbuf
->b_p_ml
= curbuf
->b_p_ml_nobin
;
5000 curbuf
->b_p_et
= curbuf
->b_p_et_nobin
;
5002 if (!(opt_flags
& OPT_LOCAL
))
5014 * Find the parameter represented by the given character (eg ', :, ", or /),
5015 * and return its associated value in the 'viminfo' string.
5016 * Only works for number parameters, not for 'r' or 'n'.
5017 * If the parameter is not specified in the string or there is no following
5018 * number, return -1.
5021 get_viminfo_parameter(type
)
5026 p
= find_viminfo_parameter(type
);
5027 if (p
!= NULL
&& VIM_ISDIGIT(*p
))
5028 return atoi((char *)p
);
5033 * Find the parameter represented by the given character (eg ''', ':', '"', or
5034 * '/') in the 'viminfo' option and return a pointer to the string after it.
5035 * Return NULL if the parameter is not specified in the string.
5038 find_viminfo_parameter(type
)
5043 for (p
= p_viminfo
; *p
; ++p
)
5047 if (*p
== 'n') /* 'n' is always the last one */
5049 p
= vim_strchr(p
, ','); /* skip until next ',' */
5050 if (p
== NULL
) /* hit the end without finding parameter */
5058 * Expand environment variables for some string options.
5059 * These string options cannot be indirect!
5060 * If "val" is NULL expand the current value of the option.
5061 * Return pointer to NameBuff, or NULL when not expanded.
5064 option_expand(opt_idx
, val
)
5068 /* if option doesn't need expansion nothing to do */
5069 if (!(options
[opt_idx
].flags
& P_EXPAND
) || options
[opt_idx
].var
== NULL
)
5072 /* If val is longer than MAXPATHL no meaningful expansion can be done,
5073 * expand_env() would truncate the string. */
5074 if (val
!= NULL
&& STRLEN(val
) > MAXPATHL
)
5078 val
= *(char_u
**)options
[opt_idx
].var
;
5081 * Expanding this with NameBuff, expand_env() must not be passed IObuff.
5082 * Escape spaces when expanding 'tags', they are used to separate file
5084 * For 'spellsuggest' expand after "file:".
5086 expand_env_esc(val
, NameBuff
, MAXPATHL
,
5087 (char_u
**)options
[opt_idx
].var
== &p_tags
, FALSE
,
5089 (char_u
**)options
[opt_idx
].var
== &p_sps
? (char_u
*)"file:" :
5092 if (STRCMP(NameBuff
, val
) == 0) /* they are the same */
5099 * After setting various option values: recompute variables that depend on
5105 /* initialize the table for 'iskeyword' et.al. */
5106 (void)init_chartab();
5109 (void)opt_strings_flags(p_cmp
, p_cmp_values
, &cmp_flags
, TRUE
);
5111 (void)opt_strings_flags(p_bkc
, p_bkc_values
, &bkc_flags
, TRUE
);
5113 (void)opt_strings_flags(p_ssop
, p_ssop_values
, &ssop_flags
, TRUE
);
5114 (void)opt_strings_flags(p_vop
, p_ssop_values
, &vop_flags
, TRUE
);
5117 (void)opt_strings_flags(p_fdo
, p_fdo_values
, &fdo_flags
, TRUE
);
5119 #ifdef FEAT_FULLSCREEN
5120 (void)check_fuoptions(p_fuoptions
, &fuoptions_flags
,
5121 &fuoptions_bgcolor
);
5123 (void)opt_strings_flags(p_dy
, p_dy_values
, &dy_flags
, TRUE
);
5124 #ifdef FEAT_VIRTUALEDIT
5125 (void)opt_strings_flags(p_ve
, p_ve_values
, &ve_flags
, TRUE
);
5127 #if defined(FEAT_MOUSE) && (defined(UNIX) || defined(VMS))
5128 (void)opt_strings_flags(p_ttym
, p_ttym_values
, &ttym_flags
, FALSE
);
5131 (void)spell_check_msm();
5132 (void)spell_check_sps();
5133 (void)compile_cap_prog(curbuf
);
5135 #if defined(FEAT_TOOLBAR) && !defined(FEAT_GUI_W32)
5136 (void)opt_strings_flags(p_toolbar
, p_toolbar_values
, &toolbar_flags
, TRUE
);
5138 #if defined(FEAT_TOOLBAR) && ((defined(FEAT_GUI_GTK) && defined(HAVE_GTK2)) \
5139 || defined(FEAT_GUI_MACVIM))
5140 (void)opt_strings_flags(p_tbis
, p_tbis_values
, &tbis_flags
, FALSE
);
5144 (void)check_cedit();
5149 * Check for string options that are NULL (normally only termcap options).
5156 for (opt_idx
= 0; options
[opt_idx
].fullname
!= NULL
; opt_idx
++)
5157 if ((options
[opt_idx
].flags
& P_STRING
) && options
[opt_idx
].var
!= NULL
)
5158 check_string_option((char_u
**)get_varp(&(options
[opt_idx
])));
5162 * Check string options in a buffer for NULL value.
5165 check_buf_options(buf
)
5168 #if defined(FEAT_QUICKFIX)
5169 check_string_option(&buf
->b_p_bh
);
5170 check_string_option(&buf
->b_p_bt
);
5173 check_string_option(&buf
->b_p_fenc
);
5175 check_string_option(&buf
->b_p_ff
);
5177 check_string_option(&buf
->b_p_def
);
5178 check_string_option(&buf
->b_p_inc
);
5180 check_string_option(&buf
->b_p_inex
);
5183 #if defined(FEAT_CINDENT) && defined(FEAT_EVAL)
5184 check_string_option(&buf
->b_p_inde
);
5185 check_string_option(&buf
->b_p_indk
);
5187 #if defined(FEAT_BEVAL) && defined(FEAT_EVAL)
5188 check_string_option(&buf
->b_p_bexpr
);
5190 #if defined(FEAT_EVAL)
5191 check_string_option(&buf
->b_p_fex
);
5194 check_string_option(&buf
->b_p_key
);
5196 check_string_option(&buf
->b_p_kp
);
5197 check_string_option(&buf
->b_p_mps
);
5198 check_string_option(&buf
->b_p_fo
);
5199 check_string_option(&buf
->b_p_flp
);
5200 check_string_option(&buf
->b_p_isk
);
5201 #ifdef FEAT_COMMENTS
5202 check_string_option(&buf
->b_p_com
);
5205 check_string_option(&buf
->b_p_cms
);
5207 check_string_option(&buf
->b_p_nf
);
5209 check_string_option(&buf
->b_p_qe
);
5212 check_string_option(&buf
->b_p_syn
);
5215 check_string_option(&buf
->b_p_spc
);
5216 check_string_option(&buf
->b_p_spf
);
5217 check_string_option(&buf
->b_p_spl
);
5219 #ifdef FEAT_SEARCHPATH
5220 check_string_option(&buf
->b_p_sua
);
5223 check_string_option(&buf
->b_p_cink
);
5224 check_string_option(&buf
->b_p_cino
);
5227 check_string_option(&buf
->b_p_ft
);
5229 #ifdef FEAT_OSFILETYPE
5230 check_string_option(&buf
->b_p_oft
);
5232 #if defined(FEAT_SMARTINDENT) || defined(FEAT_CINDENT)
5233 check_string_option(&buf
->b_p_cinw
);
5235 #ifdef FEAT_INS_EXPAND
5236 check_string_option(&buf
->b_p_cpt
);
5238 #ifdef FEAT_COMPL_FUNC
5239 check_string_option(&buf
->b_p_cfu
);
5240 check_string_option(&buf
->b_p_ofu
);
5243 check_string_option(&buf
->b_p_keymap
);
5245 #ifdef FEAT_QUICKFIX
5246 check_string_option(&buf
->b_p_gp
);
5247 check_string_option(&buf
->b_p_mp
);
5248 check_string_option(&buf
->b_p_efm
);
5250 check_string_option(&buf
->b_p_ep
);
5251 check_string_option(&buf
->b_p_path
);
5252 check_string_option(&buf
->b_p_tags
);
5253 #ifdef FEAT_INS_EXPAND
5254 check_string_option(&buf
->b_p_dict
);
5255 check_string_option(&buf
->b_p_tsr
);
5260 * Free the string allocated for an option.
5261 * Checks for the string being empty_option. This may happen if we're out of
5262 * memory, vim_strsave() returned NULL, which was replaced by empty_option by
5264 * Does NOT check for P_ALLOCED flag!
5267 free_string_option(p
)
5270 if (p
!= empty_option
)
5275 clear_string_option(pp
)
5278 if (*pp
!= empty_option
)
5284 check_string_option(pp
)
5292 * Mark a terminal option as allocated, found by a pointer into term_strings[].
5295 set_term_option_alloced(p
)
5300 for (opt_idx
= 1; options
[opt_idx
].fullname
!= NULL
; opt_idx
++)
5301 if (options
[opt_idx
].var
== (char_u
*)p
)
5303 options
[opt_idx
].flags
|= P_ALLOCED
;
5306 return; /* cannot happen: didn't find it! */
5309 #if defined(FEAT_EVAL) || defined(PROTO)
5311 * Return TRUE when option "opt" was set from a modeline or in secure mode.
5312 * Return FALSE when it wasn't.
5313 * Return -1 for an unknown option.
5316 was_set_insecurely(opt
, opt_flags
)
5320 int idx
= findoption(opt
);
5325 flagp
= insecure_flag(idx
, opt_flags
);
5326 return (*flagp
& P_INSECURE
) != 0;
5328 EMSG2(_(e_intern2
), "was_set_insecurely()");
5333 * Get a pointer to the flags used for the P_INSECURE flag of option
5334 * "opt_idx". For some local options a local flags field is used.
5337 insecure_flag(opt_idx
, opt_flags
)
5341 if (opt_flags
& OPT_LOCAL
)
5342 switch ((int)options
[opt_idx
].indir
)
5345 case PV_STL
: return &curwin
->w_p_stl_flags
;
5348 # ifdef FEAT_FOLDING
5349 case PV_FDE
: return &curwin
->w_p_fde_flags
;
5350 case PV_FDT
: return &curwin
->w_p_fdt_flags
;
5353 case PV_BEXPR
: return &curbuf
->b_p_bexpr_flags
;
5355 # if defined(FEAT_CINDENT)
5356 case PV_INDE
: return &curbuf
->b_p_inde_flags
;
5358 case PV_FEX
: return &curbuf
->b_p_fex_flags
;
5359 # ifdef FEAT_FIND_ID
5360 case PV_INEX
: return &curbuf
->b_p_inex_flags
;
5365 /* Nothing special, return global flags field. */
5366 return &options
[opt_idx
].flags
;
5371 static void redraw_titles
__ARGS((void));
5374 * Redraw the window title and/or tab page text later.
5376 static void redraw_titles()
5378 need_maketitle
= TRUE
;
5379 # ifdef FEAT_WINDOWS
5380 redraw_tabline
= TRUE
;
5386 * Set a string option to a new value (without checking the effect).
5387 * The string is copied into allocated memory.
5388 * if ("opt_idx" == -1) "name" is used, otherwise "opt_idx" is used.
5389 * When "set_sid" is zero set the scriptID to current_SID. When "set_sid" is
5390 * SID_NONE don't set the scriptID. Otherwise set the scriptID to "set_sid".
5394 set_string_option_direct(name
, opt_idx
, val
, opt_flags
, set_sid
)
5398 int opt_flags
; /* OPT_FREE, OPT_LOCAL and/or OPT_GLOBAL */
5403 int both
= (opt_flags
& (OPT_LOCAL
| OPT_GLOBAL
)) == 0;
5406 if (idx
== -1) /* use name */
5408 idx
= findoption(name
);
5409 if (idx
< 0) /* not found (should not happen) */
5411 EMSG2(_(e_intern2
), "set_string_option_direct()");
5416 if (options
[idx
].var
== NULL
) /* can't set hidden option */
5419 s
= vim_strsave(val
);
5422 varp
= (char_u
**)get_varp_scope(&(options
[idx
]),
5423 both
? OPT_LOCAL
: opt_flags
);
5424 if ((opt_flags
& OPT_FREE
) && (options
[idx
].flags
& P_ALLOCED
))
5425 free_string_option(*varp
);
5428 /* For buffer/window local option may also set the global value. */
5430 set_string_option_global(idx
, varp
);
5432 options
[idx
].flags
|= P_ALLOCED
;
5434 /* When setting both values of a global option with a local value,
5435 * make the local value empty, so that the global value is used. */
5436 if (((int)options
[idx
].indir
& PV_BOTH
) && both
)
5438 free_string_option(*varp
);
5439 *varp
= empty_option
;
5442 if (set_sid
!= SID_NONE
)
5443 set_option_scriptID_idx(idx
, opt_flags
,
5444 set_sid
== 0 ? current_SID
: set_sid
);
5450 * Set global value for string option when it's a local option.
5453 set_string_option_global(opt_idx
, varp
)
5454 int opt_idx
; /* option index */
5455 char_u
**varp
; /* pointer to option variable */
5459 /* the global value is always allocated */
5460 if (options
[opt_idx
].var
== VAR_WIN
)
5461 p
= (char_u
**)GLOBAL_WO(varp
);
5463 p
= (char_u
**)options
[opt_idx
].var
;
5464 if (options
[opt_idx
].indir
!= PV_NONE
5466 && (s
= vim_strsave(*varp
)) != NULL
)
5468 free_string_option(*p
);
5473 if (varp
== &p_migdict
)
5474 reset_migemo(FALSE
);
5479 * Set a string option to a new value, and handle the effects.
5482 set_string_option(opt_idx
, value
, opt_flags
)
5485 int opt_flags
; /* OPT_LOCAL and/or OPT_GLOBAL */
5491 if (options
[opt_idx
].var
== NULL
) /* don't set hidden option */
5494 s
= vim_strsave(value
);
5497 varp
= (char_u
**)get_varp_scope(&(options
[opt_idx
]),
5498 (opt_flags
& (OPT_LOCAL
| OPT_GLOBAL
)) == 0
5499 ? (((int)options
[opt_idx
].indir
& PV_BOTH
)
5500 ? OPT_GLOBAL
: OPT_LOCAL
)
5504 if (did_set_string_option(opt_idx
, varp
, TRUE
, oldval
, NULL
,
5506 did_set_option(opt_idx
, opt_flags
, TRUE
);
5511 * Handle string options that need some action to perform when changed.
5512 * Returns NULL for success, or an error message for an error.
5515 did_set_string_option(opt_idx
, varp
, new_value_alloced
, oldval
, errbuf
,
5517 int opt_idx
; /* index in options[] table */
5518 char_u
**varp
; /* pointer to the option variable */
5519 int new_value_alloced
; /* new value was allocated */
5520 char_u
*oldval
; /* previous value of the option */
5521 char_u
*errbuf
; /* buffer for errors, or NULL */
5522 int opt_flags
; /* OPT_LOCAL and/or OPT_GLOBAL */
5524 char_u
*errmsg
= NULL
;
5526 int did_chartab
= FALSE
;
5528 long_u free_oldval
= (options
[opt_idx
].flags
& P_ALLOCED
);
5530 /* set when changing an option that only requires a redraw in the GUI */
5531 int redraw_gui_only
= FALSE
;
5534 /* Get the global option to compare with, otherwise we would have to check
5535 * two values for all local options. */
5536 gvarp
= (char_u
**)get_varp_scope(&(options
[opt_idx
]), OPT_GLOBAL
);
5538 /* Disallow changing some options from secure mode */
5543 ) && (options
[opt_idx
].flags
& P_SECURE
))
5548 /* Check for a "normal" file name in some options. Disallow a path
5549 * separator (slash and/or backslash), wildcards and characters that are
5550 * often illegal in a file name. */
5551 else if ((options
[opt_idx
].flags
& P_NFNAME
)
5552 && vim_strpbrk(*varp
, (char_u
*)"/\\*?[|<>") != NULL
)
5558 else if (varp
== &T_NAME
)
5560 if (T_NAME
[0] == NUL
)
5561 errmsg
= (char_u
*)N_("E529: Cannot set 'term' to empty string");
5564 errmsg
= (char_u
*)N_("E530: Cannot change term in GUI");
5565 else if (term_is_gui(T_NAME
))
5566 errmsg
= (char_u
*)N_("E531: Use \":gui\" to start the GUI");
5568 else if (set_termname(T_NAME
) == FAIL
)
5569 errmsg
= (char_u
*)N_("E522: Not found in termcap");
5571 /* Screen colors may have changed. */
5572 redraw_later_clear();
5576 else if (varp
== &p_bkc
)
5578 if (opt_strings_flags(p_bkc
, p_bkc_values
, &bkc_flags
, TRUE
) != OK
)
5580 if (((bkc_flags
& BKC_AUTO
) != 0)
5581 + ((bkc_flags
& BKC_YES
) != 0)
5582 + ((bkc_flags
& BKC_NO
) != 0) != 1)
5584 /* Must have exactly one of "auto", "yes" and "no". */
5585 (void)opt_strings_flags(oldval
, p_bkc_values
, &bkc_flags
, TRUE
);
5590 /* 'backupext' and 'patchmode' */
5591 else if (varp
== &p_bex
|| varp
== &p_pm
)
5593 if (STRCMP(*p_bex
== '.' ? p_bex
+ 1 : p_bex
,
5594 *p_pm
== '.' ? p_pm
+ 1 : p_pm
) == 0)
5595 errmsg
= (char_u
*)N_("E589: 'backupext' and 'patchmode' are equal");
5599 * 'isident', 'iskeyword', 'isprint or 'isfname' option: refill chartab[]
5600 * If the new option is invalid, use old value. 'lisp' option: refill
5601 * chartab[] for '-' char
5603 else if ( varp
== &p_isi
5604 || varp
== &(curbuf
->b_p_isk
)
5608 if (init_chartab() == FAIL
)
5610 did_chartab
= TRUE
; /* need to restore it below */
5611 errmsg
= e_invarg
; /* error in value */
5616 else if (varp
== &p_hf
)
5618 /* May compute new values for $VIM and $VIMRUNTIME */
5621 vim_setenv((char_u
*)"VIM", (char_u
*)"");
5624 if (didset_vimruntime
)
5626 vim_setenv((char_u
*)"VIMRUNTIME", (char_u
*)"");
5627 didset_vimruntime
= FALSE
;
5631 #ifdef FEAT_MULTI_LANG
5633 else if (varp
== &p_hlg
)
5635 /* Check for "", "ab", "ab,cd", etc. */
5636 for (s
= p_hlg
; *s
!= NUL
; s
+= 3)
5638 if (s
[1] == NUL
|| ((s
[2] != ',' || s
[3] == NUL
) && s
[2] != NUL
))
5650 else if (varp
== &p_hl
)
5652 if (highlight_changed() == FAIL
)
5653 errmsg
= e_invarg
; /* invalid flags */
5657 else if (gvarp
== &p_nf
)
5659 if (check_opt_strings(*varp
, p_nf_values
, TRUE
) != OK
)
5664 /* 'sessionoptions' */
5665 else if (varp
== &p_ssop
)
5667 if (opt_strings_flags(p_ssop
, p_ssop_values
, &ssop_flags
, TRUE
) != OK
)
5669 if ((ssop_flags
& SSOP_CURDIR
) && (ssop_flags
& SSOP_SESDIR
))
5671 /* Don't allow both "sesdir" and "curdir". */
5672 (void)opt_strings_flags(oldval
, p_ssop_values
, &ssop_flags
, TRUE
);
5677 else if (varp
== &p_vop
)
5679 if (opt_strings_flags(p_vop
, p_ssop_values
, &vop_flags
, TRUE
) != OK
)
5685 #ifdef FEAT_SCROLLBIND
5686 else if (varp
== &p_sbo
)
5688 if (check_opt_strings(p_sbo
, p_scbopt_values
, TRUE
) != OK
)
5695 else if (varp
== &p_ambw
)
5697 if (check_opt_strings(p_ambw
, p_ambw_values
, FALSE
) != OK
)
5703 else if (varp
== &p_bg
)
5705 if (check_opt_strings(p_bg
, p_bg_values
, FALSE
) == OK
)
5708 int dark
= (*p_bg
== 'd');
5711 init_highlight(FALSE
, FALSE
);
5714 if (dark
!= (*p_bg
== 'd')
5715 && get_var_value((char_u
*)"g:colors_name") != NULL
)
5717 /* The color scheme must have set 'background' back to another
5718 * value, that's not what we want here. Disable the color
5719 * scheme and set the colors again. */
5720 do_unlet((char_u
*)"g:colors_name", TRUE
);
5721 free_string_option(p_bg
);
5722 p_bg
= vim_strsave((char_u
*)(dark
? "dark" : "light"));
5723 check_string_option(&p_bg
);
5724 init_highlight(FALSE
, FALSE
);
5733 else if (varp
== &p_wim
)
5735 if (check_opt_wim() == FAIL
)
5739 #ifdef FEAT_CMDL_COMPL
5741 else if (varp
== &p_wop
)
5743 if (check_opt_strings(p_wop
, p_wop_values
, TRUE
) != OK
)
5750 else if (varp
== &p_wak
)
5753 || check_opt_strings(p_wak
, p_wak_values
, FALSE
) != OK
)
5756 # ifdef FEAT_GUI_MOTIF
5757 else if (gui
.in_use
)
5758 gui_motif_set_mnemonics(p_wak
[0] == 'y' || p_wak
[0] == 'm');
5760 # ifdef FEAT_GUI_GTK
5761 else if (gui
.in_use
)
5762 gui_gtk_set_mnemonics(p_wak
[0] == 'y' || p_wak
[0] == 'm');
5771 else if (varp
== &p_ei
)
5773 if (check_ei() == FAIL
)
5779 /* 'encoding' and 'fileencoding' */
5780 else if (varp
== &p_enc
|| gvarp
== &p_fenc
|| varp
== &p_tenc
)
5782 if (gvarp
== &p_fenc
)
5784 if (!curbuf
->b_p_ma
&& opt_flags
!= OPT_GLOBAL
)
5785 errmsg
= e_modifiable
;
5786 else if (vim_strchr(*varp
, ',') != NULL
)
5787 /* No comma allowed in 'fileencoding'; catches confusing it
5788 * with 'fileencodings'. */
5793 /* May show a "+" in the title now. */
5796 /* Add 'fileencoding' to the swap file. */
5797 ml_setflags(curbuf
);
5802 /* canonize the value, so that STRCMP() can be used on it */
5803 p
= enc_canonize(*varp
);
5818 # if (defined(FEAT_GUI_GTK) && defined(HAVE_GTK2)) || defined(FEAT_GUI_MACVIM)
5819 if (errmsg
== NULL
&& varp
== &p_tenc
&& gui
.in_use
)
5821 /* MacVim and GTK+ 2 GUIs force 'tenc' to UTF-8. */
5822 if (STRCMP(p_tenc
, "utf-8") != 0)
5823 # if defined(FEAT_GUI_MACVIM)
5824 errmsg
= (char_u
*)N_("E617: Cannot be changed in MacVim");
5826 errmsg
= (char_u
*)N_("E617: Cannot be changed in the GTK+ 2 GUI");
5834 /* When 'keymap' is used and 'encoding' changes, reload the keymap
5835 * (with another encoding). */
5836 if (varp
== &p_enc
&& *curbuf
->b_p_keymap
!= NUL
)
5837 (void)keymap_init();
5840 /* When 'termencoding' is not empty and 'encoding' changes or when
5841 * 'termencoding' changes, need to setup for keyboard input and
5842 * display output conversion. */
5843 if (((varp
== &p_enc
&& *p_tenc
!= NUL
) || varp
== &p_tenc
))
5845 convert_setup(&input_conv
, p_tenc
, p_enc
);
5846 convert_setup(&output_conv
, p_enc
, p_tenc
);
5849 # if defined(WIN3264) && defined(FEAT_MBYTE)
5850 /* $HOME may have characters in active code page. */
5858 #if defined(FEAT_POSTSCRIPT)
5859 else if (varp
== &p_penc
)
5861 /* Canonize printencoding if VIM standard one */
5862 p
= enc_canonize(p_penc
);
5870 /* Ensure lower case and '-' for '_' */
5871 for (s
= p_penc
; *s
!= NUL
; s
++)
5876 *s
= TOLOWER_ASC(*s
);
5882 #if defined(FEAT_XIM) && defined(FEAT_GUI_GTK)
5883 else if (varp
== &p_imak
)
5885 if (gui
.in_use
&& !im_xim_isvalid_imactivate())
5891 else if (varp
== &curbuf
->b_p_keymap
)
5893 /* load or unload key mapping tables */
5894 errmsg
= keymap_init();
5898 if (*curbuf
->b_p_keymap
!= NUL
)
5900 /* Installed a new keymap, switch on using it. */
5901 curbuf
->b_p_iminsert
= B_IMODE_LMAP
;
5902 if (curbuf
->b_p_imsearch
!= B_IMODE_USE_INSERT
)
5903 curbuf
->b_p_imsearch
= B_IMODE_LMAP
;
5907 /* Cleared the keymap, may reset 'iminsert' and 'imsearch'. */
5908 if (curbuf
->b_p_iminsert
== B_IMODE_LMAP
)
5909 curbuf
->b_p_iminsert
= B_IMODE_NONE
;
5910 if (curbuf
->b_p_imsearch
== B_IMODE_LMAP
)
5911 curbuf
->b_p_imsearch
= B_IMODE_USE_INSERT
;
5913 if ((opt_flags
& OPT_LOCAL
) == 0)
5915 set_iminsert_global();
5916 set_imsearch_global();
5918 # ifdef FEAT_WINDOWS
5919 status_redraw_curbuf();
5926 else if (gvarp
== &p_ff
)
5928 if (!curbuf
->b_p_ma
&& !(opt_flags
& OPT_GLOBAL
))
5929 errmsg
= e_modifiable
;
5930 else if (check_opt_strings(*varp
, p_ff_values
, FALSE
) != OK
)
5934 /* may also change 'textmode' */
5935 if (get_fileformat(curbuf
) == EOL_DOS
)
5936 curbuf
->b_p_tx
= TRUE
;
5938 curbuf
->b_p_tx
= FALSE
;
5942 /* update flag in swap file */
5943 ml_setflags(curbuf
);
5948 else if (varp
== &p_ffs
)
5950 if (check_opt_strings(p_ffs
, p_ff_values
, TRUE
) != OK
)
5954 /* also change 'textauto' */
5962 #if defined(FEAT_CRYPT) && defined(FEAT_CMDHIST)
5964 else if (gvarp
== &p_key
)
5966 /* Make sure the ":set" command doesn't show the new value in the
5968 remove_key_from_history();
5973 else if (gvarp
== &p_mps
)
5975 /* Check for "x:y,x:y" */
5976 for (p
= *varp
; *p
!= NUL
; p
+= 4)
5978 if (p
[1] != ':' || p
[2] == NUL
|| (p
[3] != NUL
&& p
[3] != ','))
5988 #ifdef FEAT_COMMENTS
5990 else if (gvarp
== &p_com
)
5992 for (s
= *varp
; *s
; )
5994 while (*s
&& *s
!= ':')
5996 if (vim_strchr((char_u
*)COM_ALL
, *s
) == NULL
5997 && !VIM_ISDIGIT(*s
) && *s
!= '-')
5999 errmsg
= illegal_char(errbuf
, *s
);
6005 errmsg
= (char_u
*)N_("E524: Missing colon");
6006 else if (*s
== ',' || *s
== NUL
)
6007 errmsg
= (char_u
*)N_("E525: Zero length string");
6010 while (*s
&& *s
!= ',')
6012 if (*s
== '\\' && s
[1] != NUL
)
6016 s
= skip_to_option_part(s
);
6022 else if (varp
== &p_lcs
)
6024 errmsg
= set_chars_option(varp
);
6027 #if defined(FEAT_WINDOWS) || defined(FEAT_FOLDING)
6029 else if (varp
== &p_fcs
)
6031 errmsg
= set_chars_option(varp
);
6037 else if (varp
== &p_cedit
)
6039 errmsg
= check_cedit();
6044 else if (varp
== &p_vfile
)
6047 if (*p_vfile
!= NUL
&& verbose_open() == FAIL
)
6053 else if (varp
== &p_viminfo
)
6055 for (s
= p_viminfo
; *s
;)
6057 /* Check it's a valid character */
6058 if (vim_strchr((char_u
*)"!\"%'/:<@cfhnrs", *s
) == NULL
)
6060 errmsg
= illegal_char(errbuf
, *s
);
6063 if (*s
== 'n') /* name is always last one */
6067 else if (*s
== 'r') /* skip until next ',' */
6069 while (*++s
&& *s
!= ',')
6074 /* optional number */
6075 while (vim_isdigit(*++s
))
6078 else if (*s
== '!' || *s
== 'h' || *s
== 'c')
6079 ++s
; /* no extra chars */
6080 else /* must have a number */
6082 while (vim_isdigit(*++s
))
6085 if (!VIM_ISDIGIT(*(s
- 1)))
6089 sprintf((char *)errbuf
,
6090 _("E526: Missing number after <%s>"),
6091 transchar_byte(*(s
- 1)));
6095 errmsg
= (char_u
*)"";
6104 errmsg
= (char_u
*)N_("E527: Missing comma");
6106 errmsg
= (char_u
*)"";
6110 if (*p_viminfo
&& errmsg
== NULL
&& get_viminfo_parameter('\'') < 0)
6111 errmsg
= (char_u
*)N_("E528: Must specify a ' value");
6113 #endif /* FEAT_VIMINFO */
6115 /* terminal options */
6116 else if (istermoption(&options
[opt_idx
]) && full_screen
)
6118 /* ":set t_Co=0" and ":set t_Co=1" do ":set t_Co=" */
6121 int colors
= atoi((char *)T_CCO
);
6123 /* Only reinitialize colors if t_Co value has really changed to
6124 * avoid expensive reload of colorscheme if t_Co is set to the
6125 * same value multiple times. */
6126 if (colors
!= t_colors
)
6131 if (new_value_alloced
)
6133 T_CCO
= empty_option
;
6135 /* We now have a different color setup, initialize it again. */
6136 init_highlight(TRUE
, FALSE
);
6143 redraw_later(CLEAR
);
6144 #if defined(MSDOS) || (defined(WIN3264) && !defined(FEAT_GUI_W32))
6145 /* Since t_me has been set, this probably means that the user
6146 * wants to use this as default colors. Need to reset default
6147 * background/foreground colors. */
6148 mch_set_normal_colors();
6153 #ifdef FEAT_LINEBREAK
6155 else if (varp
== &p_sbr
)
6157 for (s
= p_sbr
; *s
; )
6159 if (ptr2cells(s
) != 1)
6160 errmsg
= (char_u
*)N_("E595: contains unprintable or wide character");
6168 else if (varp
== &p_guifont
)
6173 # if defined(FEAT_GUI_GTK)
6175 * Put up a font dialog and let the user select a new value.
6176 * If this is cancelled go back to the old value but don't
6177 * give an error message.
6179 if (STRCMP(p
, "*") == 0)
6181 p
= gui_mch_font_dialog(oldval
);
6183 if (new_value_alloced
)
6184 free_string_option(p_guifont
);
6186 p_guifont
= (p
!= NULL
) ? p
: vim_strsave(oldval
);
6187 new_value_alloced
= TRUE
;
6190 if (p
!= NULL
&& gui_init_font(p_guifont
, FALSE
) != OK
)
6192 # if defined(FEAT_GUI_MSWIN) || defined(FEAT_GUI_PHOTON) \
6193 || defined(FEAT_GUI_MACVIM)
6194 if (STRCMP(p_guifont
, "*") == 0)
6196 /* Dialog was cancelled: Keep the old value without giving
6197 * an error message. */
6198 if (new_value_alloced
)
6199 free_string_option(p_guifont
);
6200 p_guifont
= vim_strsave(oldval
);
6201 new_value_alloced
= TRUE
;
6205 errmsg
= (char_u
*)N_("E596: Invalid font(s)");
6208 redraw_gui_only
= TRUE
;
6210 # ifdef FEAT_XFONTSET
6211 else if (varp
== &p_guifontset
)
6213 if (STRCMP(p_guifontset
, "*") == 0)
6214 errmsg
= (char_u
*)N_("E597: can't select fontset");
6215 else if (gui
.in_use
&& gui_init_font(p_guifontset
, TRUE
) != OK
)
6216 errmsg
= (char_u
*)N_("E598: Invalid fontset");
6217 redraw_gui_only
= TRUE
;
6221 else if (varp
== &p_guifontwide
)
6223 if (STRCMP(p_guifontwide
, "*") == 0)
6224 errmsg
= (char_u
*)N_("E533: can't select wide font");
6225 else if (gui_get_wide_font() == FAIL
)
6226 errmsg
= (char_u
*)N_("E534: Invalid wide font");
6227 redraw_gui_only
= TRUE
;
6234 else if (varp
== &p_guicursor
)
6235 errmsg
= parse_shape_opt(SHAPE_CURSOR
);
6238 #ifdef FEAT_MOUSESHAPE
6240 else if (varp
== &p_mouseshape
)
6242 errmsg
= parse_shape_opt(SHAPE_MOUSE
);
6243 update_mouseshape(-1);
6248 else if (varp
== &p_popt
)
6249 errmsg
= parse_printoptions();
6250 # if defined(FEAT_MBYTE) && defined(FEAT_POSTSCRIPT)
6251 else if (varp
== &p_pmfn
)
6252 errmsg
= parse_printmbfont();
6258 else if (varp
== &p_langmap
)
6262 #ifdef FEAT_LINEBREAK
6264 else if (varp
== &p_breakat
)
6265 fill_breakat_flags();
6269 /* 'titlestring' and 'iconstring' */
6270 else if (varp
== &p_titlestring
|| varp
== &p_iconstring
)
6272 # ifdef FEAT_STL_OPT
6273 int flagval
= (varp
== &p_titlestring
) ? STL_IN_TITLE
: STL_IN_ICON
;
6275 /* NULL => statusline syntax */
6276 if (vim_strchr(*varp
, '%') && check_stl_option(*varp
) == NULL
)
6277 stl_syntax
|= flagval
;
6279 stl_syntax
&= ~flagval
;
6281 did_set_title(varp
== &p_iconstring
);
6288 else if (varp
== &p_go
)
6290 gui_init_which_components(oldval
);
6291 redraw_gui_only
= TRUE
;
6295 #if defined(FEAT_GUI_TABLINE)
6297 else if (varp
== &p_gtl
)
6299 redraw_tabline
= TRUE
;
6300 redraw_gui_only
= TRUE
;
6302 /* 'guitabtooltip' */
6303 else if (varp
== &p_gtt
)
6305 redraw_gui_only
= TRUE
;
6309 #if defined(FEAT_MOUSE_TTY) && (defined(UNIX) || defined(VMS))
6311 else if (varp
== &p_ttym
)
6313 /* Switch the mouse off before changing the escape sequences used for
6315 mch_setmouse(FALSE
);
6316 if (opt_strings_flags(p_ttym
, p_ttym_values
, &ttym_flags
, FALSE
) != OK
)
6319 check_mouse_termcode();
6321 setmouse(); /* may switch it on again */
6327 else if (varp
== &p_sel
)
6330 || check_opt_strings(p_sel
, p_sel_values
, FALSE
) != OK
)
6335 else if (varp
== &p_slm
)
6337 if (check_opt_strings(p_slm
, p_slm_values
, TRUE
) != OK
)
6344 else if (varp
== &p_bsdir
)
6346 if (check_opt_strings(p_bsdir
, p_bsdir_values
, FALSE
) != OK
6347 && !mch_isdir(p_bsdir
))
6354 else if (varp
== &p_km
)
6356 if (check_opt_strings(p_km
, p_km_values
, TRUE
) != OK
)
6360 km_stopsel
= (vim_strchr(p_km
, 'o') != NULL
);
6361 km_startsel
= (vim_strchr(p_km
, 'a') != NULL
);
6367 else if (varp
== &p_mousem
)
6369 if (check_opt_strings(p_mousem
, p_mousem_values
, FALSE
) != OK
)
6371 #if defined(FEAT_GUI_MOTIF) && defined(FEAT_MENU) && (XmVersion <= 1002)
6372 else if (*p_mousem
!= *oldval
)
6373 /* Changed from "extend" to "popup" or "popup_setpos" or vv: need
6374 * to create or delete the popup menus. */
6375 gui_motif_update_mousemodel(root_menu
);
6380 else if (varp
== &p_swb
)
6382 if (opt_strings_flags(p_swb
, p_swb_values
, &swb_flags
, TRUE
) != OK
)
6387 else if (varp
== &p_debug
)
6389 if (check_opt_strings(p_debug
, p_debug_values
, TRUE
) != OK
)
6394 else if (varp
== &p_dy
)
6396 if (opt_strings_flags(p_dy
, p_dy_values
, &dy_flags
, TRUE
) != OK
)
6399 (void)init_chartab();
6403 #ifdef FEAT_VERTSPLIT
6405 else if (varp
== &p_ead
)
6407 if (check_opt_strings(p_ead
, p_ead_values
, FALSE
) != OK
)
6412 #ifdef FEAT_CLIPBOARD
6414 else if (varp
== &p_cb
)
6415 errmsg
= check_clipboard_option();
6419 /* When 'spelllang' or 'spellfile' is set and there is a window for this
6420 * buffer in which 'spell' is set load the wordlists. */
6421 else if (varp
== &(curbuf
->b_p_spl
) || varp
== &(curbuf
->b_p_spf
))
6426 if (varp
== &(curbuf
->b_p_spf
))
6428 l
= (int)STRLEN(curbuf
->b_p_spf
);
6429 if (l
> 0 && (l
< 4 || STRCMP(curbuf
->b_p_spf
+ l
- 4,
6437 if (wp
->w_buffer
== curbuf
&& wp
->w_p_spell
)
6439 errmsg
= did_set_spelllang(curbuf
);
6440 # ifdef FEAT_WINDOWS
6446 /* When 'spellcapcheck' is set compile the regexp program. */
6447 else if (varp
== &(curbuf
->b_p_spc
))
6449 errmsg
= compile_cap_prog(curbuf
);
6451 /* 'spellsuggest' */
6452 else if (varp
== &p_sps
)
6454 if (spell_check_sps() != OK
)
6458 else if (varp
== &p_msm
)
6460 if (spell_check_msm() != OK
)
6465 #ifdef FEAT_QUICKFIX
6466 /* When 'bufhidden' is set, check for valid value. */
6467 else if (gvarp
== &p_bh
)
6469 if (check_opt_strings(curbuf
->b_p_bh
, p_bufhidden_values
, FALSE
) != OK
)
6473 /* When 'buftype' is set, check for valid value. */
6474 else if (gvarp
== &p_bt
)
6476 if (check_opt_strings(curbuf
->b_p_bt
, p_buftype_values
, FALSE
) != OK
)
6480 # ifdef FEAT_WINDOWS
6481 if (curwin
->w_status_height
)
6483 curwin
->w_redr_status
= TRUE
;
6484 redraw_later(VALID
);
6487 curbuf
->b_help
= (curbuf
->b_p_bt
[0] == 'h');
6493 /* 'statusline' or 'rulerformat' */
6494 else if (gvarp
== &p_stl
|| varp
== &p_ruf
)
6498 if (varp
== &p_ruf
) /* reset ru_wid first */
6501 if (varp
== &p_ruf
&& *s
== '%')
6503 /* set ru_wid if 'ruf' starts with "%99(" */
6504 if (*++s
== '-') /* ignore a '-' */
6506 wid
= getdigits(&s
);
6507 if (wid
&& *s
== '(' && (errmsg
= check_stl_option(p_ruf
)) == NULL
)
6510 errmsg
= check_stl_option(p_ruf
);
6512 /* check 'statusline' only if it doesn't start with "%!" */
6513 else if (varp
== &p_ruf
|| s
[0] != '%' || s
[1] != '!')
6514 errmsg
= check_stl_option(s
);
6515 if (varp
== &p_ruf
&& errmsg
== NULL
)
6520 #ifdef FEAT_INS_EXPAND
6521 /* check if it is a valid value for 'complete' -- Acevedo */
6522 else if (gvarp
== &p_cpt
)
6524 for (s
= *varp
; *s
;)
6526 while(*s
== ',' || *s
== ' ')
6530 if (vim_strchr((char_u
*)".wbuksid]tU", *s
) == NULL
)
6532 errmsg
= illegal_char(errbuf
, *s
);
6535 if (*++s
!= NUL
&& *s
!= ',' && *s
!= ' ')
6537 if (s
[-1] == 'k' || s
[-1] == 's')
6539 /* skip optional filename after 'k' and 's' */
6540 while (*s
&& *s
!= ',' && *s
!= ' ')
6551 sprintf((char *)errbuf
,
6552 _("E535: Illegal character after <%c>"),
6557 errmsg
= (char_u
*)"";
6565 else if (varp
== &p_cot
)
6567 if (check_opt_strings(p_cot
, p_cot_values
, TRUE
) != OK
)
6570 #endif /* FEAT_INS_EXPAND */
6573 #if defined(FEAT_TOOLBAR) && !defined(FEAT_GUI_W32)
6574 else if (varp
== &p_toolbar
)
6576 if (opt_strings_flags(p_toolbar
, p_toolbar_values
,
6577 &toolbar_flags
, TRUE
) != OK
)
6582 gui_mch_show_toolbar((toolbar_flags
&
6583 (TOOLBAR_TEXT
| TOOLBAR_ICONS
)) != 0);
6588 #if defined(FEAT_TOOLBAR) && ((defined(FEAT_GUI_GTK) && defined(HAVE_GTK2)) \
6589 || defined(FEAT_GUI_MACVIM))
6590 /* 'toolbariconsize': GTK+ 2 and MacVim only */
6591 else if (varp
== &p_tbis
)
6593 if (opt_strings_flags(p_tbis
, p_tbis_values
, &tbis_flags
, FALSE
) != OK
)
6598 gui_mch_show_toolbar((toolbar_flags
&
6599 (TOOLBAR_TEXT
| TOOLBAR_ICONS
)) != 0);
6604 /* 'pastetoggle': translate key codes like in a mapping */
6605 else if (varp
== &p_pt
)
6609 (void)replace_termcodes(p_pt
, &p
, TRUE
, TRUE
, FALSE
);
6612 if (new_value_alloced
)
6613 free_string_option(p_pt
);
6615 new_value_alloced
= TRUE
;
6621 else if (varp
== &p_bs
)
6623 if (VIM_ISDIGIT(*p_bs
))
6625 if (*p_bs
>'2' || p_bs
[1] != NUL
)
6628 else if (check_opt_strings(p_bs
, p_bs_values
, TRUE
) != OK
)
6634 else if (varp
== &p_cmp
)
6636 if (opt_strings_flags(p_cmp
, p_cmp_values
, &cmp_flags
, TRUE
) != OK
)
6643 else if (varp
== &p_dip
)
6645 if (diffopt_changed() == FAIL
)
6652 else if (gvarp
== &curwin
->w_allbuf_opt
.wo_fdm
)
6654 if (check_opt_strings(*varp
, p_fdm_values
, FALSE
) != OK
6655 || *curwin
->w_p_fdm
== NUL
)
6658 foldUpdateAll(curwin
);
6662 else if (varp
== &curwin
->w_p_fde
)
6664 if (foldmethodIsExpr(curwin
))
6665 foldUpdateAll(curwin
);
6669 else if (gvarp
== &curwin
->w_allbuf_opt
.wo_fmr
)
6671 p
= vim_strchr(*varp
, ',');
6673 errmsg
= (char_u
*)N_("E536: comma required");
6674 else if (p
== *varp
|| p
[1] == NUL
)
6676 else if (foldmethodIsMarker(curwin
))
6677 foldUpdateAll(curwin
);
6679 /* 'commentstring' */
6680 else if (gvarp
== &p_cms
)
6682 if (**varp
!= NUL
&& strstr((char *)*varp
, "%s") == NULL
)
6683 errmsg
= (char_u
*)N_("E537: 'commentstring' must be empty or contain %s");
6686 else if (varp
== &p_fdo
)
6688 if (opt_strings_flags(p_fdo
, p_fdo_values
, &fdo_flags
, TRUE
) != OK
)
6692 else if (varp
== &p_fcl
)
6694 if (check_opt_strings(p_fcl
, p_fcl_values
, TRUE
) != OK
)
6698 else if (gvarp
== &curwin
->w_allbuf_opt
.wo_fdi
)
6700 if (foldmethodIsIndent(curwin
))
6701 foldUpdateAll(curwin
);
6705 #ifdef FEAT_FULLSCREEN
6707 else if (varp
== &p_fuoptions
)
6709 if (check_fuoptions(p_fuoptions
, &fuoptions_flags
,
6710 &fuoptions_bgcolor
) != OK
)
6715 #ifdef FEAT_VIRTUALEDIT
6717 else if (varp
== &p_ve
)
6719 if (opt_strings_flags(p_ve
, p_ve_values
, &ve_flags
, TRUE
) != OK
)
6721 else if (STRCMP(p_ve
, oldval
) != 0)
6723 /* Recompute cursor position in case the new 've' setting
6724 * changes something. */
6726 coladvance(curwin
->w_virtcol
);
6731 #if defined(FEAT_CSCOPE) && defined(FEAT_QUICKFIX)
6732 else if (varp
== &p_csqf
)
6739 if (vim_strchr((char_u
*)CSQF_CMDS
, *p
) == NULL
6741 || vim_strchr((char_u
*)CSQF_FLAGS
, p
[1]) == NULL
6742 || (p
[2] != NUL
&& p
[2] != ','))
6747 else if (p
[2] == NUL
)
6756 /* Options that are a list of flags. */
6761 p
= (char_u
*)WW_ALL
;
6763 p
= (char_u
*)SHM_ALL
;
6764 else if (varp
== &(p_cpo
))
6765 p
= (char_u
*)CPO_ALL
;
6766 else if (varp
== &(curbuf
->b_p_fo
))
6767 p
= (char_u
*)FO_ALL
;
6768 else if (varp
== &p_mouse
)
6771 p
= (char_u
*)MOUSE_ALL
;
6773 if (*p_mouse
!= NUL
)
6774 errmsg
= (char_u
*)N_("E538: No mouse support");
6777 #if defined(FEAT_GUI)
6778 else if (varp
== &p_go
)
6779 p
= (char_u
*)GO_ALL
;
6783 for (s
= *varp
; *s
; ++s
)
6784 if (vim_strchr(p
, *s
) == NULL
)
6786 errmsg
= illegal_char(errbuf
, *s
);
6793 * If error detected, restore the previous value.
6797 if (new_value_alloced
)
6798 free_string_option(*varp
);
6801 * When resetting some values, need to act on it.
6804 (void)init_chartab();
6806 (void)highlight_changed();
6811 /* Remember where the option was set. */
6812 set_option_scriptID_idx(opt_idx
, opt_flags
, current_SID
);
6815 * Free string options that are in allocated memory.
6816 * Use "free_oldval", because recursiveness may change the flags under
6817 * our fingers (esp. init_highlight()).
6820 free_string_option(oldval
);
6821 if (new_value_alloced
)
6822 options
[opt_idx
].flags
|= P_ALLOCED
;
6824 options
[opt_idx
].flags
&= ~P_ALLOCED
;
6826 if ((opt_flags
& (OPT_LOCAL
| OPT_GLOBAL
)) == 0
6827 && ((int)options
[opt_idx
].indir
& PV_BOTH
))
6829 /* global option with local value set to use global value; free
6830 * the local value and make it empty */
6831 p
= get_varp_scope(&(options
[opt_idx
]), OPT_LOCAL
);
6832 free_string_option(*(char_u
**)p
);
6833 *(char_u
**)p
= empty_option
;
6836 /* May set global value for local option. */
6837 else if (!(opt_flags
& OPT_LOCAL
) && opt_flags
!= OPT_GLOBAL
)
6838 set_string_option_global(opt_idx
, varp
);
6842 * Trigger the autocommand only after setting the flags.
6845 /* When 'syntax' is set, load the syntax of that name */
6846 if (varp
== &(curbuf
->b_p_syn
))
6848 apply_autocmds(EVENT_SYNTAX
, curbuf
->b_p_syn
,
6849 curbuf
->b_fname
, TRUE
, curbuf
);
6852 else if (varp
== &(curbuf
->b_p_ft
))
6854 /* 'filetype' is set, trigger the FileType autocommand */
6855 did_filetype
= TRUE
;
6856 apply_autocmds(EVENT_FILETYPE
, curbuf
->b_p_ft
,
6857 curbuf
->b_fname
, TRUE
, curbuf
);
6861 if (varp
== &(curbuf
->b_p_spl
))
6866 * Source the spell/LANG.vim in 'runtimepath'.
6867 * They could set 'spellcapcheck' depending on the language.
6868 * Use the first name in 'spelllang' up to '_region' or
6871 for (p
= curbuf
->b_p_spl
; *p
!= NUL
; ++p
)
6872 if (vim_strchr((char_u
*)"_.,", *p
) != NULL
)
6874 vim_snprintf((char *)fname
, 200, "spell/%.*s.vim",
6875 (int)(p
- curbuf
->b_p_spl
), curbuf
->b_p_spl
);
6876 source_runtime(fname
, TRUE
);
6882 if (varp
== &p_mouse
)
6884 # ifdef FEAT_MOUSE_TTY
6885 if (*p_mouse
== NUL
)
6886 mch_setmouse(FALSE
); /* switch mouse off */
6889 setmouse(); /* in case 'mouse' changed */
6893 if (curwin
->w_curswant
!= MAXCOL
)
6894 curwin
->w_set_curswant
= TRUE
; /* in case 'showbreak' changed */
6896 /* check redraw when it's not a GUI option or the GUI is active. */
6897 if (!redraw_gui_only
|| gui
.in_use
)
6899 check_redraw(options
[opt_idx
].flags
);
6905 * Handle setting 'listchars' or 'fillchars'.
6906 * Returns error message, NULL if it's OK.
6909 set_chars_option(varp
)
6912 int round
, i
, len
, entries
;
6920 #if defined(FEAT_WINDOWS) || defined(FEAT_FOLDING)
6921 static struct charstab filltab
[] =
6924 {&fill_stlnc
, "stlnc"},
6925 {&fill_vert
, "vert"},
6926 {&fill_fold
, "fold"},
6927 {&fill_diff
, "diff"},
6930 static struct charstab lcstab
[] =
6933 {&lcs_ext
, "extends"},
6934 {&lcs_nbsp
, "nbsp"},
6935 {&lcs_prec
, "precedes"},
6937 {&lcs_trail
, "trail"},
6939 struct charstab
*tab
;
6941 #if defined(FEAT_WINDOWS) || defined(FEAT_FOLDING)
6946 entries
= sizeof(lcstab
) / sizeof(struct charstab
);
6948 #if defined(FEAT_WINDOWS) || defined(FEAT_FOLDING)
6952 entries
= sizeof(filltab
) / sizeof(struct charstab
);
6956 /* first round: check for valid value, second round: assign values */
6957 for (round
= 0; round
<= 1; ++round
)
6961 /* After checking that the value is valid: set defaults: space for
6962 * 'fillchars', NUL for 'listchars' */
6963 for (i
= 0; i
< entries
; ++i
)
6964 *(tab
[i
].cp
) = (varp
== &p_lcs
? NUL
: ' ');
6967 #if defined(FEAT_WINDOWS) || defined(FEAT_FOLDING)
6975 for (i
= 0; i
< entries
; ++i
)
6977 len
= (int)STRLEN(tab
[i
].name
);
6978 if (STRNCMP(p
, tab
[i
].name
, len
) == 0
6980 && p
[len
+ 1] != NUL
)
6984 c1
= mb_ptr2char_adv(&s
);
6985 if (mb_char2cells(c1
) > 1)
6990 if (tab
[i
].cp
== &lcs_tab2
)
6995 c2
= mb_ptr2char_adv(&s
);
6996 if (mb_char2cells(c2
) > 1)
7002 if (*s
== ',' || *s
== NUL
)
7006 if (tab
[i
].cp
== &lcs_tab2
)
7028 return NULL
; /* no error */
7033 * Check validity of options with the 'statusline' format.
7034 * Return error message or NULL.
7042 static char_u errbuf
[80];
7044 while (*s
&& itemcnt
< STL_MAX_ITEM
)
7046 /* Check for valid keys after % sequences */
7047 while (*s
&& *s
!= '%')
7052 if (*s
!= '%' && *s
!= ')')
7054 if (*s
== '%' || *s
== STL_TRUNCMARK
|| *s
== STL_MIDDLEMARK
)
7062 if (--groupdepth
< 0)
7068 while (VIM_ISDIGIT(*s
))
7070 if (*s
== STL_USER_HL
)
7075 while (*s
&& VIM_ISDIGIT(*s
))
7083 if (vim_strchr(STL_ALL
, *s
) == NULL
)
7085 return illegal_char(errbuf
, *s
);
7090 while (*s
!= '}' && *s
)
7093 return (char_u
*)N_("E540: Unclosed expression sequence");
7096 if (itemcnt
>= STL_MAX_ITEM
)
7097 return (char_u
*)N_("E541: too many items");
7098 if (groupdepth
!= 0)
7099 return (char_u
*)N_("E542: unbalanced groups");
7104 #ifdef FEAT_CLIPBOARD
7106 * Extract the items in the 'clipboard' option and set global values.
7109 check_clipboard_option()
7111 int new_unnamed
= FALSE
;
7112 int new_autoselect
= FALSE
;
7113 int new_autoselectml
= FALSE
;
7114 regprog_T
*new_exclude_prog
= NULL
;
7115 char_u
*errmsg
= NULL
;
7118 for (p
= p_cb
; *p
!= NUL
; )
7120 if (STRNCMP(p
, "unnamed", 7) == 0 && (p
[7] == ',' || p
[7] == NUL
))
7125 else if (STRNCMP(p
, "autoselect", 10) == 0
7126 && (p
[10] == ',' || p
[10] == NUL
))
7128 new_autoselect
= TRUE
;
7131 else if (STRNCMP(p
, "autoselectml", 12) == 0
7132 && (p
[12] == ',' || p
[12] == NUL
))
7134 new_autoselectml
= TRUE
;
7137 else if (STRNCMP(p
, "exclude:", 8) == 0 && new_exclude_prog
== NULL
)
7140 new_exclude_prog
= vim_regcomp(p
, RE_MAGIC
);
7141 if (new_exclude_prog
== NULL
)
7155 clip_unnamed
= new_unnamed
;
7156 clip_autoselect
= new_autoselect
;
7157 clip_autoselectml
= new_autoselectml
;
7158 vim_free(clip_exclude_prog
);
7159 clip_exclude_prog
= new_exclude_prog
;
7162 vim_free(new_exclude_prog
);
7170 * Set curbuf->b_cap_prog to the regexp program for 'spellcapcheck'.
7171 * Return error message when failed, NULL when OK.
7174 compile_cap_prog(buf
)
7177 regprog_T
*rp
= buf
->b_cap_prog
;
7180 if (*buf
->b_p_spc
== NUL
)
7181 buf
->b_cap_prog
= NULL
;
7184 /* Prepend a ^ so that we only match at one column */
7185 re
= concat_str((char_u
*)"^", buf
->b_p_spc
);
7188 buf
->b_cap_prog
= vim_regcomp(re
, RE_MAGIC
);
7189 if (buf
->b_cap_prog
== NULL
)
7191 buf
->b_cap_prog
= rp
; /* restore the previous program */
7203 #if defined(FEAT_EVAL) || defined(PROTO)
7205 * Set the scriptID for an option, taking care of setting the buffer- or
7206 * window-local value.
7209 set_option_scriptID_idx(opt_idx
, opt_flags
, id
)
7214 int both
= (opt_flags
& (OPT_LOCAL
| OPT_GLOBAL
)) == 0;
7215 int indir
= (int)options
[opt_idx
].indir
;
7217 /* Remember where the option was set. For local options need to do that
7218 * in the buffer or window structure. */
7219 if (both
|| (opt_flags
& OPT_GLOBAL
) || (indir
& (PV_BUF
|PV_WIN
)) == 0)
7220 options
[opt_idx
].scriptID
= id
;
7221 if (both
|| (opt_flags
& OPT_LOCAL
))
7224 curbuf
->b_p_scriptID
[indir
& PV_MASK
] = id
;
7225 else if (indir
& PV_WIN
)
7226 curwin
->w_p_scriptID
[indir
& PV_MASK
] = id
;
7232 * Set the value of a boolean option, and take care of side effects.
7233 * Returns NULL for success, or an error message for an error.
7236 set_bool_option(opt_idx
, varp
, value
, opt_flags
)
7237 int opt_idx
; /* index in options[] table */
7238 char_u
*varp
; /* pointer to the option variable */
7239 int value
; /* new value */
7240 int opt_flags
; /* OPT_LOCAL and/or OPT_GLOBAL */
7242 int old_value
= *(int *)varp
;
7244 /* Disallow changing some options from secure mode */
7249 ) && (options
[opt_idx
].flags
& P_SECURE
))
7252 *(int *)varp
= value
; /* set the new value */
7254 /* Remember where the option was set. */
7255 set_option_scriptID_idx(opt_idx
, opt_flags
, current_SID
);
7259 need_mouse_correct
= TRUE
;
7262 /* May set global value for local option. */
7263 if ((opt_flags
& (OPT_LOCAL
| OPT_GLOBAL
)) == 0)
7264 *(int *)get_varp_scope(&(options
[opt_idx
]), OPT_GLOBAL
) = value
;
7267 * Handle side effects of changing a bool option.
7271 if ((int *)varp
== &p_cp
)
7276 else if ((int *)varp
== &curbuf
->b_p_ro
)
7278 /* when 'readonly' is reset globally, also reset readonlymode */
7279 if (!curbuf
->b_p_ro
&& (opt_flags
& OPT_LOCAL
) == 0)
7280 readonlymode
= FALSE
;
7282 /* when 'readonly' is set may give W10 again */
7284 curbuf
->b_did_warn
= FALSE
;
7292 /* when 'modifiable' is changed, redraw the window title */
7293 else if ((int *)varp
== &curbuf
->b_p_ma
)
7297 /* when 'endofline' is changed, redraw the window title */
7298 else if ((int *)varp
== &curbuf
->b_p_eol
)
7303 /* when 'bomb' is changed, redraw the window title and tab page text */
7304 else if ((int *)varp
== &curbuf
->b_p_bomb
)
7311 /* when 'bin' is set also set some other options */
7312 else if ((int *)varp
== &curbuf
->b_p_bin
)
7314 set_options_bin(old_value
, curbuf
->b_p_bin
, opt_flags
);
7321 /* when 'buflisted' changes, trigger autocommands */
7322 else if ((int *)varp
== &curbuf
->b_p_bl
&& old_value
!= curbuf
->b_p_bl
)
7324 apply_autocmds(curbuf
->b_p_bl
? EVENT_BUFADD
: EVENT_BUFDELETE
,
7325 NULL
, NULL
, TRUE
, curbuf
);
7329 /* when 'swf' is set, create swapfile, when reset remove swapfile */
7330 else if ((int *)varp
== &curbuf
->b_p_swf
)
7332 if (curbuf
->b_p_swf
&& p_uc
)
7333 ml_open_file(curbuf
); /* create the swap file */
7335 /* no need to reset curbuf->b_may_swap, ml_open_file() will check
7337 mf_close_file(curbuf
, TRUE
); /* remove the swap file */
7340 /* when 'terse' is set change 'shortmess' */
7341 else if ((int *)varp
== &p_terse
)
7345 p
= vim_strchr(p_shm
, SHM_SEARCH
);
7347 /* insert 's' in p_shm */
7348 if (p_terse
&& p
== NULL
)
7350 STRCPY(IObuff
, p_shm
);
7351 STRCAT(IObuff
, "s");
7352 set_string_option_direct((char_u
*)"shm", -1, IObuff
, OPT_FREE
, 0);
7354 /* remove 's' from p_shm */
7355 else if (!p_terse
&& p
!= NULL
)
7359 /* when 'paste' is set or reset also change other options */
7360 else if ((int *)varp
== &p_paste
)
7362 paste_option_changed();
7365 /* when 'insertmode' is set from an autocommand need to do work here */
7366 else if ((int *)varp
== &p_im
)
7370 if ((State
& INSERT
) == 0)
7371 need_start_insertmode
= TRUE
;
7372 stop_insert_mode
= FALSE
;
7376 need_start_insertmode
= FALSE
;
7377 stop_insert_mode
= TRUE
;
7378 if (restart_edit
!= 0 && mode_displayed
)
7379 clear_cmdline
= TRUE
; /* remove "(insert)" */
7384 /* when 'ignorecase' is set or reset and 'hlsearch' is set, redraw */
7385 else if ((int *)varp
== &p_ic
&& p_hls
)
7387 redraw_all_later(SOME_VALID
);
7390 #ifdef FEAT_SEARCH_EXTRA
7391 /* when 'hlsearch' is set or reset: reset no_hlsearch */
7392 else if ((int *)varp
== &p_hls
)
7394 no_hlsearch
= FALSE
;
7398 #ifdef FEAT_SCROLLBIND
7399 /* when 'scrollbind' is set: snapshot the current position to avoid a jump
7400 * at the end of normal_cmd() */
7401 else if ((int *)varp
== &curwin
->w_p_scb
)
7403 if (curwin
->w_p_scb
)
7404 do_check_scrollbind(FALSE
);
7408 #if defined(FEAT_WINDOWS) && defined(FEAT_QUICKFIX)
7409 /* There can be only one window with 'previewwindow' set. */
7410 else if ((int *)varp
== &curwin
->w_p_pvw
)
7412 if (curwin
->w_p_pvw
)
7416 for (win
= firstwin
; win
!= NULL
; win
= win
->w_next
)
7417 if (win
->w_p_pvw
&& win
!= curwin
)
7419 curwin
->w_p_pvw
= FALSE
;
7420 return (char_u
*)N_("E590: A preview window already exists");
7426 /* when 'textmode' is set or reset also change 'fileformat' */
7427 else if ((int *)varp
== &curbuf
->b_p_tx
)
7429 set_fileformat(curbuf
->b_p_tx
? EOL_DOS
: EOL_UNIX
, opt_flags
);
7432 #ifdef FEAT_FULLSCREEN
7433 /* when 'fullscreen' changes, forward it to the gui */
7434 else if ((int *)varp
== &p_fullscreen
&& gui
.in_use
)
7436 if (p_fullscreen
&& !old_value
)
7439 if (fuoptions_flags
& FUOPT_BGCOLOR_HLGROUP
)
7441 /* Find out background color from colorscheme
7442 * via highlight group id */
7443 syn_id2colors(fuoptions_bgcolor
, &fg
, &bg
);
7447 /* set explicit background color */
7448 bg
= fuoptions_bgcolor
;
7450 gui_mch_enter_fullscreen(fuoptions_flags
, bg
);
7452 else if (!p_fullscreen
&& old_value
)
7454 gui_mch_leave_fullscreen();
7459 #if defined(FEAT_ANTIALIAS) && defined(FEAT_GUI_MACVIM)
7460 else if ((int *)varp
== &p_antialias
)
7462 gui_macvim_set_antialias(p_antialias
);
7466 /* when 'textauto' is set or reset also change 'fileformats' */
7467 else if ((int *)varp
== &p_ta
)
7468 set_string_option_direct((char_u
*)"ffs", -1,
7469 p_ta
? (char_u
*)DFLT_FFS_VIM
: (char_u
*)"",
7470 OPT_FREE
| opt_flags
, 0);
7473 * When 'lisp' option changes include/exclude '-' in
7474 * keyword characters.
7477 else if (varp
== (char_u
*)&(curbuf
->b_p_lisp
))
7479 (void)buf_init_chartab(curbuf
, FALSE
); /* ignore errors */
7484 /* when 'title' changed, may need to change the title; same for 'icon' */
7485 else if ((int *)varp
== &p_title
)
7487 did_set_title(FALSE
);
7490 else if ((int *)varp
== &p_icon
)
7492 did_set_title(TRUE
);
7496 else if ((int *)varp
== &curbuf
->b_changed
)
7499 save_file_ff(curbuf
); /* Buffer is unchanged */
7504 modified_was_set
= value
;
7508 #ifdef BACKSLASH_IN_FILENAME
7509 else if ((int *)varp
== &p_ssl
)
7524 /* need to adjust the file name arguments and buffer names. */
7525 buflist_slash_adjust();
7526 alist_slash_adjust();
7528 scriptnames_slash_adjust();
7533 /* If 'wrap' is set, set w_leftcol to zero. */
7534 else if ((int *)varp
== &curwin
->w_p_wrap
)
7536 if (curwin
->w_p_wrap
)
7537 curwin
->w_leftcol
= 0;
7541 else if ((int *)varp
== &p_ea
)
7543 if (p_ea
&& !old_value
)
7544 win_equal(curwin
, FALSE
, 0);
7548 else if ((int *)varp
== &p_wiv
)
7551 * When 'weirdinvert' changed, set/reset 't_xs'.
7552 * Then set 'weirdinvert' according to value of 't_xs'.
7554 if (p_wiv
&& !old_value
)
7555 T_XS
= (char_u
*)"y";
7556 else if (!p_wiv
&& old_value
)
7557 T_XS
= empty_option
;
7558 p_wiv
= (*T_XS
!= NUL
);
7562 else if ((int *)varp
== &p_beval
)
7564 if (p_beval
== TRUE
)
7565 gui_mch_enable_beval_area(balloonEval
);
7567 gui_mch_disable_beval_area(balloonEval
);
7571 #ifdef FEAT_AUTOCHDIR
7572 else if ((int *)varp
== &p_acd
)
7574 /* Change directories when the 'acd' option is set now. */
7581 else if ((int *)varp
== &curwin
->w_p_diff
)
7583 /* May add or remove the buffer from the list of diff buffers. */
7584 diff_buf_adjust(curwin
);
7585 # ifdef FEAT_FOLDING
7586 if (foldmethodIsDiff(curwin
))
7587 foldUpdateAll(curwin
);
7592 #ifdef USE_IM_CONTROL
7594 else if ((int *)varp
== &p_imdisable
)
7596 /* Only de-activate it here, it will be enabled when changing mode. */
7599 im_set_active(FALSE
);
7601 #ifdef FEAT_GUI_MACVIM
7602 im_set_control(!p_imdisable
);
7609 else if ((int *)varp
== &curwin
->w_p_spell
)
7611 if (curwin
->w_p_spell
)
7613 char_u
*errmsg
= did_set_spelllang(curbuf
);
7622 else if ((int *)varp
== &p_altkeymap
)
7624 if (old_value
!= p_altkeymap
)
7636 (void)init_chartab();
7641 * In case some second language keymapping options have changed, check
7642 * and correct the setting in a consistent way.
7646 * If hkmap or fkmap are set, reset Arabic keymapping.
7648 if ((p_hkmap
|| p_fkmap
) && p_altkeymap
)
7650 p_altkeymap
= p_fkmap
;
7652 curwin
->w_p_arab
= FALSE
;
7654 (void)init_chartab();
7658 * If hkmap set, reset Farsi keymapping.
7660 if (p_hkmap
&& p_altkeymap
)
7665 curwin
->w_p_arab
= FALSE
;
7667 (void)init_chartab();
7671 * If fkmap set, reset Hebrew keymapping.
7673 if (p_fkmap
&& !p_altkeymap
)
7678 curwin
->w_p_arab
= FALSE
;
7680 (void)init_chartab();
7685 if ((int *)varp
== &curwin
->w_p_arab
)
7687 if (curwin
->w_p_arab
)
7690 * 'arabic' is set, handle various sub-settings.
7694 /* set rightleft mode */
7695 if (!curwin
->w_p_rl
)
7697 curwin
->w_p_rl
= TRUE
;
7698 changed_window_setting();
7701 /* Enable Arabic shaping (major part of what Arabic requires) */
7705 redraw_later_clear();
7709 /* Arabic requires a utf-8 encoding, inform the user if its not
7711 if (STRCMP(p_enc
, "utf-8") != 0)
7713 static char *w_arabic
= N_("W17: Arabic requires UTF-8, do ':set encoding=utf-8'");
7715 msg_source(hl_attr(HLF_W
));
7716 MSG_ATTR(_(w_arabic
), hl_attr(HLF_W
));
7718 set_vim_var_string(VV_WARNINGMSG
, (char_u
*)_(w_arabic
), -1);
7723 /* set 'delcombine' */
7728 /* Force-set the necessary keymap for arabic */
7729 set_option_value((char_u
*)"keymap", 0L, (char_u
*)"arabic",
7736 (void)init_chartab();
7742 * 'arabic' is reset, handle various sub-settings.
7746 /* reset rightleft mode */
7749 curwin
->w_p_rl
= FALSE
;
7750 changed_window_setting();
7753 /* 'arabicshape' isn't reset, it is a global option and
7754 * another window may still need it "on". */
7757 /* 'delcombine' isn't reset, it is a global option and another
7758 * window may still want it "on". */
7761 /* Revert to the default keymap */
7762 curbuf
->b_p_iminsert
= B_IMODE_NONE
;
7763 curbuf
->b_p_imsearch
= B_IMODE_USE_INSERT
;
7770 * End of handling side effects for bool options.
7773 options
[opt_idx
].flags
|= P_WAS_SET
;
7775 comp_col(); /* in case 'ruler' or 'showcmd' changed */
7776 if (curwin
->w_curswant
!= MAXCOL
)
7777 curwin
->w_set_curswant
= TRUE
; /* in case 'list' changed */
7778 check_redraw(options
[opt_idx
].flags
);
7784 * Set the value of a number option, and take care of side effects.
7785 * Returns NULL for success, or an error message for an error.
7788 set_num_option(opt_idx
, varp
, value
, errbuf
, errbuflen
, opt_flags
)
7789 int opt_idx
; /* index in options[] table */
7790 char_u
*varp
; /* pointer to the option variable */
7791 long value
; /* new value */
7792 char_u
*errbuf
; /* buffer for error messages */
7793 size_t errbuflen
; /* length of "errbuf" */
7794 int opt_flags
; /* OPT_LOCAL, OPT_GLOBAL and
7797 char_u
*errmsg
= NULL
;
7798 long old_value
= *(long *)varp
;
7799 long old_Rows
= Rows
; /* remember old Rows */
7800 long old_Columns
= Columns
; /* remember old Columns */
7801 long *pp
= (long *)varp
;
7803 /* Disallow changing some options from secure mode. */
7808 ) && (options
[opt_idx
].flags
& P_SECURE
))
7813 /* Remember where the option was set. */
7814 set_option_scriptID_idx(opt_idx
, opt_flags
, current_SID
);
7817 need_mouse_correct
= TRUE
;
7820 if (curbuf
->b_p_sw
<= 0)
7822 errmsg
= e_positive
;
7823 curbuf
->b_p_sw
= curbuf
->b_p_ts
;
7827 * Number options that need some action when changed
7830 if (pp
== &p_wh
|| pp
== &p_hh
)
7834 errmsg
= e_positive
;
7839 errmsg
= e_winheight
;
7844 errmsg
= e_positive
;
7848 /* Change window height NOW */
7849 if (lastwin
!= firstwin
)
7851 if (pp
== &p_wh
&& curwin
->w_height
< p_wh
)
7852 win_setheight((int)p_wh
);
7853 if (pp
== &p_hh
&& curbuf
->b_help
&& curwin
->w_height
< p_hh
)
7854 win_setheight((int)p_hh
);
7858 /* 'winminheight' */
7859 else if (pp
== &p_wmh
)
7863 errmsg
= e_positive
;
7868 errmsg
= e_winheight
;
7874 # ifdef FEAT_VERTSPLIT
7875 else if (pp
== &p_wiw
)
7879 errmsg
= e_positive
;
7884 errmsg
= e_winwidth
;
7888 /* Change window width NOW */
7889 if (lastwin
!= firstwin
&& curwin
->w_width
< p_wiw
)
7890 win_setwidth((int)p_wiw
);
7894 else if (pp
== &p_wmw
)
7898 errmsg
= e_positive
;
7903 errmsg
= e_winwidth
;
7913 /* (re)set last window status line */
7914 else if (pp
== &p_ls
)
7919 /* (re)set tab page line */
7920 else if (pp
== &p_stal
)
7922 shell_new_rows(); /* recompute window positions and heights */
7927 else if (pp
== &p_linespace
|| pp
== &p_charspace
)
7929 /* Recompute gui.char_height and resize the Vim window to keep the
7930 * same number of lines. */
7931 if (gui
.in_use
&& gui_mch_adjust_charheight() == OK
)
7932 gui_set_shellsize(FALSE
, FALSE
, RESIZE_VERT
);
7938 else if (pp
== &curwin
->w_p_fdl
)
7940 if (curwin
->w_p_fdl
< 0)
7941 curwin
->w_p_fdl
= 0;
7945 /* 'foldminlines' */
7946 else if (pp
== &curwin
->w_p_fml
)
7948 foldUpdateAll(curwin
);
7952 else if (pp
== &curwin
->w_p_fdn
)
7954 if (foldmethodIsSyntax(curwin
) || foldmethodIsIndent(curwin
))
7955 foldUpdateAll(curwin
);
7959 else if (pp
== &curwin
->w_p_fdc
)
7961 if (curwin
->w_p_fdc
< 0)
7963 errmsg
= e_positive
;
7964 curwin
->w_p_fdc
= 0;
7966 else if (curwin
->w_p_fdc
> 12)
7969 curwin
->w_p_fdc
= 12;
7973 /* 'shiftwidth' or 'tabstop' */
7974 else if (pp
== &curbuf
->b_p_sw
|| pp
== &curbuf
->b_p_ts
)
7976 if (foldmethodIsIndent(curwin
))
7977 foldUpdateAll(curwin
);
7979 #endif /* FEAT_FOLDING */
7983 else if (pp
== &p_mco
)
7985 if (p_mco
> MAX_MCO
)
7989 screenclear(); /* will re-allocate the screen */
7993 else if (pp
== &curbuf
->b_p_iminsert
)
7995 if (curbuf
->b_p_iminsert
< 0 || curbuf
->b_p_iminsert
> B_IMODE_LAST
)
7998 curbuf
->b_p_iminsert
= B_IMODE_NONE
;
8000 p_iminsert
= curbuf
->b_p_iminsert
;
8001 if (termcap_active
) /* don't do this in the alternate screen */
8003 #if defined(FEAT_WINDOWS) && defined(FEAT_KEYMAP)
8004 /* Show/unshow value of 'keymap' in status lines. */
8005 status_redraw_curbuf();
8009 else if (pp
== &p_window
)
8013 else if (p_window
>= Rows
)
8014 p_window
= Rows
- 1;
8017 else if (pp
== &curbuf
->b_p_imsearch
)
8019 if (curbuf
->b_p_imsearch
< -1 || curbuf
->b_p_imsearch
> B_IMODE_LAST
)
8022 curbuf
->b_p_imsearch
= B_IMODE_NONE
;
8024 p_imsearch
= curbuf
->b_p_imsearch
;
8028 /* if 'titlelen' has changed, redraw the title */
8029 else if (pp
== &p_titlelen
)
8033 errmsg
= e_positive
;
8036 if (starting
!= NO_SCREEN
&& old_value
!= p_titlelen
)
8037 need_maketitle
= TRUE
;
8041 /* if p_ch changed value, change the command line height */
8042 else if (pp
== &p_ch
)
8046 errmsg
= e_positive
;
8049 if (p_ch
> Rows
- min_rows() + 1)
8050 p_ch
= Rows
- min_rows() + 1;
8052 /* Only compute the new window layout when startup has been
8053 * completed. Otherwise the frame sizes may be wrong. */
8054 if (p_ch
!= old_value
&& full_screen
8062 /* when 'updatecount' changes from zero to non-zero, open swap files */
8063 else if (pp
== &p_uc
)
8067 errmsg
= e_positive
;
8070 if (p_uc
&& !old_value
)
8073 #ifdef MZSCHEME_GUI_THREADS
8074 else if (pp
== &p_mzq
)
8075 mzvim_reset_timer();
8078 /* sync undo before 'undolevels' changes */
8079 else if (pp
== &p_ul
)
8081 /* use the old value, otherwise u_sync() may not work properly */
8087 #ifdef FEAT_LINEBREAK
8088 /* 'numberwidth' must be positive */
8089 else if (pp
== &curwin
->w_p_nuw
)
8091 if (curwin
->w_p_nuw
< 1)
8093 errmsg
= e_positive
;
8094 curwin
->w_p_nuw
= 1;
8096 if (curwin
->w_p_nuw
> 10)
8099 curwin
->w_p_nuw
= 10;
8101 curwin
->w_nrwidth_line_count
= 0;
8105 #if defined(FEAT_TRANSPARENCY)
8106 /* 'transparency' is a number between 0 and 100 */
8107 else if (pp
== &p_transp
)
8109 if (p_transp
< 0 || p_transp
> 100)
8112 p_transp
= old_value
;
8114 else if (gui
.in_use
)
8115 gui_mch_new_colors();
8120 * Check the bounds for numeric options here
8122 if (Rows
< min_rows() && full_screen
)
8126 vim_snprintf((char *)errbuf
, errbuflen
,
8127 _("E593: Need at least %d lines"), min_rows());
8132 if (Columns
< MIN_COLUMNS
&& full_screen
)
8136 vim_snprintf((char *)errbuf
, errbuflen
,
8137 _("E594: Need at least %d columns"), MIN_COLUMNS
);
8140 Columns
= MIN_COLUMNS
;
8142 /* Limit the values to avoid an overflow in Rows * Columns. */
8143 if (Columns
> 10000)
8149 /* avoid a crash by checking for a too large value of 'columns' */
8150 if (old_Columns
!= Columns
&& full_screen
&& term_console
)
8151 mch_check_columns();
8155 * If the screen (shell) height has been changed, assume it is the
8156 * physical screenheight.
8158 if (old_Rows
!= Rows
|| old_Columns
!= Columns
)
8160 /* Changing the screen size is not allowed while updating the screen. */
8161 if (updating_screen
)
8163 else if (full_screen
8168 set_shellsize((int)Columns
, (int)Rows
, TRUE
);
8171 /* Postpone the resizing; check the size and cmdline position for
8174 if (cmdline_row
> Rows
- p_ch
&& Rows
> p_ch
)
8175 cmdline_row
= Rows
- p_ch
;
8177 if (p_window
>= Rows
|| !option_was_set((char_u
*)"window"))
8178 p_window
= Rows
- 1;
8181 if (curbuf
->b_p_sts
< 0)
8183 errmsg
= e_positive
;
8184 curbuf
->b_p_sts
= 0;
8186 if (curbuf
->b_p_ts
<= 0)
8188 errmsg
= e_positive
;
8191 if (curbuf
->b_p_tw
< 0)
8193 errmsg
= e_positive
;
8198 errmsg
= e_positive
;
8201 if ((curwin
->w_p_scr
<= 0
8202 || (curwin
->w_p_scr
> curwin
->w_height
8203 && curwin
->w_height
> 0))
8206 if (pp
== &(curwin
->w_p_scr
))
8208 if (curwin
->w_p_scr
!= 0)
8210 win_comp_scroll(curwin
);
8212 /* If 'scroll' became invalid because of a side effect silently adjust
8214 else if (curwin
->w_p_scr
<= 0)
8215 curwin
->w_p_scr
= 1;
8216 else /* curwin->w_p_scr > curwin->w_height */
8217 curwin
->w_p_scr
= curwin
->w_height
;
8221 errmsg
= e_positive
;
8226 errmsg
= e_positive
;
8229 if ((p_sj
< -100 || p_sj
>= Rows
) && full_screen
)
8231 if (Rows
!= old_Rows
) /* Rows changed, just adjust p_sj */
8239 if (p_so
< 0 && full_screen
)
8244 if (p_siso
< 0 && full_screen
)
8246 errmsg
= e_positive
;
8252 errmsg
= e_positive
;
8258 errmsg
= e_positive
;
8263 errmsg
= e_positive
;
8267 /* May set global value for local option. */
8268 if ((opt_flags
& (OPT_LOCAL
| OPT_GLOBAL
)) == 0)
8269 *(long *)get_varp_scope(&(options
[opt_idx
]), OPT_GLOBAL
) = *pp
;
8271 options
[opt_idx
].flags
|= P_WAS_SET
;
8273 comp_col(); /* in case 'columns' or 'ls' changed */
8274 if (curwin
->w_curswant
!= MAXCOL
)
8275 curwin
->w_set_curswant
= TRUE
; /* in case 'tabstop' changed */
8276 check_redraw(options
[opt_idx
].flags
);
8282 * Called after an option changed: check if something needs to be redrawn.
8288 /* Careful: P_RCLR and P_RALL are a combination of other P_ flags */
8289 int clear
= (flags
& P_RCLR
) == P_RCLR
;
8290 int all
= ((flags
& P_RALL
) == P_RALL
|| clear
);
8293 if ((flags
& P_RSTAT
) || all
) /* mark all status lines dirty */
8294 status_redraw_all();
8297 if ((flags
& P_RBUF
) || (flags
& P_RWIN
) || all
)
8298 changed_window_setting();
8300 redraw_curbuf_later(NOT_VALID
);
8302 redraw_all_later(CLEAR
);
8304 redraw_all_later(NOT_VALID
);
8308 * Find index for option 'arg'.
8309 * Return -1 if not found.
8317 static short quick_tab
[27] = {0, 0}; /* quick access table */
8321 * For first call: Initialize the quick-access table.
8322 * It contains the index for the first option that starts with a certain
8323 * letter. There are 26 letters, plus the first "t_" option.
8325 if (quick_tab
[1] == 0)
8327 p
= options
[0].fullname
;
8328 for (opt_idx
= 1; (s
= options
[opt_idx
].fullname
) != NULL
; opt_idx
++)
8332 if (s
[0] == 't' && s
[1] == '_')
8333 quick_tab
[26] = opt_idx
;
8335 quick_tab
[CharOrdLow(s
[0])] = opt_idx
;
8342 * Check for name starting with an illegal character.
8345 if (!islower(arg
[0]))
8347 if (arg
[0] < 'a' || arg
[0] > 'z')
8351 is_term_opt
= (arg
[0] == 't' && arg
[1] == '_');
8353 opt_idx
= quick_tab
[26];
8355 opt_idx
= quick_tab
[CharOrdLow(arg
[0])];
8356 for ( ; (s
= options
[opt_idx
].fullname
) != NULL
; opt_idx
++)
8358 if (STRCMP(arg
, s
) == 0) /* match full name */
8361 if (s
== NULL
&& !is_term_opt
)
8363 opt_idx
= quick_tab
[CharOrdLow(arg
[0])];
8364 for ( ; options
[opt_idx
].fullname
!= NULL
; opt_idx
++)
8366 s
= options
[opt_idx
].shortname
;
8367 if (s
!= NULL
&& STRCMP(arg
, s
) == 0) /* match short name */
8377 #if defined(FEAT_EVAL) || defined(FEAT_TCL) || defined(FEAT_MZSCHEME)
8379 * Get the value for an option.
8382 * Number or Toggle option: 1, *numval gets value.
8383 * String option: 0, *stringval gets allocated string.
8384 * Hidden Number or Toggle option: -1.
8385 * hidden String option: -2.
8386 * unknown option: -3.
8389 get_option_value(name
, numval
, stringval
, opt_flags
)
8392 char_u
**stringval
; /* NULL when only checking existance */
8398 opt_idx
= findoption(name
);
8399 if (opt_idx
< 0) /* unknown option */
8402 varp
= get_varp_scope(&(options
[opt_idx
]), opt_flags
);
8404 if (options
[opt_idx
].flags
& P_STRING
)
8406 if (varp
== NULL
) /* hidden option */
8408 if (stringval
!= NULL
)
8411 /* never return the value of the crypt key */
8412 if ((char_u
**)varp
== &curbuf
->b_p_key
8413 && **(char_u
**)(varp
) != NUL
)
8414 *stringval
= vim_strsave((char_u
*)"*****");
8417 *stringval
= vim_strsave(*(char_u
**)(varp
));
8422 if (varp
== NULL
) /* hidden option */
8424 if (options
[opt_idx
].flags
& P_NUM
)
8425 *numval
= *(long *)varp
;
8428 /* Special case: 'modified' is b_changed, but we also want to consider
8429 * it set when 'ff' or 'fenc' changed. */
8430 if ((int *)varp
== &curbuf
->b_changed
)
8431 *numval
= curbufIsChanged();
8433 *numval
= *(int *)varp
;
8440 * Set the value of option "name".
8441 * Use "string" for string options, use "number" for other options.
8444 set_option_value(name
, number
, string
, opt_flags
)
8448 int opt_flags
; /* OPT_LOCAL or 0 (both) */
8454 opt_idx
= findoption(name
);
8456 EMSG2(_("E355: Unknown option: %s"), name
);
8459 flags
= options
[opt_idx
].flags
;
8461 /* Disallow changing some options in the sandbox */
8462 if (sandbox
> 0 && (flags
& P_SECURE
))
8468 if (flags
& P_STRING
)
8469 set_string_option(opt_idx
, string
, opt_flags
);
8472 varp
= get_varp_scope(&(options
[opt_idx
]), opt_flags
);
8473 if (varp
!= NULL
) /* hidden option is not changed */
8475 if (number
== 0 && string
!= NULL
)
8479 /* Either we are given a string or we are setting option
8481 for (idx
= 0; string
[idx
] == '0'; ++idx
)
8483 if (string
[idx
] != NUL
|| idx
== 0)
8485 /* There's another character after zeros or the string
8486 * is empty. In both cases, we are trying to set a
8487 * num option using a string. */
8488 EMSG3(_("E521: Number required: &%s = '%s'"),
8490 return; /* do nothing as we hit an error */
8495 (void)set_num_option(opt_idx
, varp
, number
,
8496 NULL
, 0, opt_flags
);
8498 (void)set_bool_option(opt_idx
, varp
, (int)number
,
8506 * Get the terminal code for a terminal option.
8507 * Returns NULL when not found.
8510 get_term_code(tname
)
8516 if (tname
[0] != 't' || tname
[1] != '_' ||
8517 tname
[2] == NUL
|| tname
[3] == NUL
)
8519 if ((opt_idx
= findoption(tname
)) >= 0)
8521 varp
= get_varp(&(options
[opt_idx
]));
8523 varp
= *(char_u
**)(varp
);
8526 return find_termcode(tname
+ 2);
8530 get_highlight_default()
8534 i
= findoption((char_u
*)"hl");
8536 return options
[i
].def_val
[VI_DEFAULT
];
8537 return (char_u
*)NULL
;
8540 #if defined(FEAT_MBYTE) || defined(PROTO)
8542 get_encoding_default()
8546 i
= findoption((char_u
*)"enc");
8548 return options
[i
].def_val
[VI_DEFAULT
];
8549 return (char_u
*)NULL
;
8554 * Translate a string like "t_xx", "<t_xx>" or "<S-Tab>" to a key number.
8557 find_key_option(arg
)
8564 * Don't use get_special_key_code() for t_xx, we don't want it to call
8565 * add_termcap_entry().
8567 if (arg
[0] == 't' && arg
[1] == '_' && arg
[2] && arg
[3])
8568 key
= TERMCAP2KEY(arg
[2], arg
[3]);
8571 --arg
; /* put arg at the '<' */
8573 key
= find_special_key(&arg
, &modifiers
, TRUE
, TRUE
);
8574 if (modifiers
) /* can't handle modifiers here */
8581 * if 'all' == 0: show changed options
8582 * if 'all' == 1: show all normal options
8583 * if 'all' == 2: show all terminal options
8586 showoptions(all
, opt_flags
)
8588 int opt_flags
; /* OPT_LOCAL and/or OPT_GLOBAL */
8590 struct vimoption
*p
;
8594 struct vimoption
**items
;
8605 items
= (struct vimoption
**)alloc((unsigned)(sizeof(struct vimoption
*) *
8610 /* Highlight title */
8612 MSG_PUTS_TITLE(_("\n--- Terminal codes ---"));
8613 else if (opt_flags
& OPT_GLOBAL
)
8614 MSG_PUTS_TITLE(_("\n--- Global option values ---"));
8615 else if (opt_flags
& OPT_LOCAL
)
8616 MSG_PUTS_TITLE(_("\n--- Local option values ---"));
8618 MSG_PUTS_TITLE(_("\n--- Options ---"));
8621 * do the loop two times:
8622 * 1. display the short items
8623 * 2. display the long items (only strings and numbers)
8625 for (run
= 1; run
<= 2 && !got_int
; ++run
)
8628 * collect the items in items[]
8631 for (p
= &options
[0]; p
->fullname
!= NULL
; p
++)
8634 isterm
= istermoption(p
);
8637 if (p
->indir
!= PV_NONE
&& !isterm
)
8638 varp
= get_varp_scope(p
, opt_flags
);
8643 && ((all
== 2 && isterm
)
8644 || (all
== 1 && !isterm
)
8645 || (all
== 0 && !optval_default(p
, varp
))))
8647 if (p
->flags
& P_BOOL
)
8648 len
= 1; /* a toggle option fits always */
8651 option_value2string(p
, opt_flags
);
8652 len
= (int)STRLEN(p
->fullname
) + vim_strsize(NameBuff
) + 1;
8654 if ((len
<= INC
- GAP
&& run
== 1) ||
8655 (len
> INC
- GAP
&& run
== 2))
8656 items
[item_count
++] = p
;
8665 cols
= (Columns
+ GAP
- 3) / INC
;
8668 rows
= (item_count
+ cols
- 1) / cols
;
8672 for (row
= 0; row
< rows
&& !got_int
; ++row
)
8674 msg_putchar('\n'); /* go to next line */
8675 if (got_int
) /* 'q' typed in more */
8678 for (i
= row
; i
< item_count
; i
+= rows
)
8680 msg_col
= col
; /* make columns */
8681 showoneopt(items
[i
], opt_flags
);
8692 * Return TRUE if option "p" has its default value.
8695 optval_default(p
, varp
)
8696 struct vimoption
*p
;
8702 return TRUE
; /* hidden option is always at default */
8703 dvi
= ((p
->flags
& P_VI_DEF
) || p_cp
) ? VI_DEFAULT
: VIM_DEFAULT
;
8704 if (p
->flags
& P_NUM
)
8705 return (*(long *)varp
== (long)(long_i
)p
->def_val
[dvi
]);
8706 if (p
->flags
& P_BOOL
)
8707 /* the cast to long is required for Manx C, long_i is
8708 * needed for MSVC */
8709 return (*(int *)varp
== (int)(long)(long_i
)p
->def_val
[dvi
]);
8711 return (STRCMP(*(char_u
**)varp
, p
->def_val
[dvi
]) == 0);
8715 * showoneopt: show the value of one option
8716 * must not be called with a hidden option!
8719 showoneopt(p
, opt_flags
)
8720 struct vimoption
*p
;
8721 int opt_flags
; /* OPT_LOCAL or OPT_GLOBAL */
8724 int save_silent
= silent_mode
;
8726 silent_mode
= FALSE
;
8727 info_message
= TRUE
; /* use mch_msg(), not mch_errmsg() */
8729 varp
= get_varp_scope(p
, opt_flags
);
8731 /* for 'modified' we also need to check if 'ff' or 'fenc' changed. */
8732 if ((p
->flags
& P_BOOL
) && ((int *)varp
== &curbuf
->b_changed
8733 ? !curbufIsChanged() : !*(int *)varp
))
8735 else if ((p
->flags
& P_BOOL
) && *(int *)varp
< 0)
8739 MSG_PUTS(p
->fullname
);
8740 if (!(p
->flags
& P_BOOL
))
8743 /* put value string in NameBuff */
8744 option_value2string(p
, opt_flags
);
8745 msg_outtrans(NameBuff
);
8748 silent_mode
= save_silent
;
8749 info_message
= FALSE
;
8753 * Write modified options as ":set" commands to a file.
8755 * There are three values for "opt_flags":
8756 * OPT_GLOBAL: Write global option values and fresh values of
8757 * buffer-local options (used for start of a session
8759 * OPT_GLOBAL + OPT_LOCAL: Idem, add fresh values of window-local options for
8760 * curwin (used for a vimrc file).
8761 * OPT_LOCAL: Write buffer-local option values for curbuf, fresh
8762 * and local values for window-local options of
8763 * curwin. Local values are also written when at the
8764 * default value, because a modeline or autocommand
8765 * may have set them when doing ":edit file" and the
8766 * user has set them back at the default or fresh
8768 * When "local_only" is TRUE, don't write fresh
8769 * values, only local values (for ":mkview").
8770 * (fresh value = value used for a new buffer or window for a local option).
8772 * Return FAIL on error, OK otherwise.
8775 makeset(fd
, opt_flags
, local_only
)
8780 struct vimoption
*p
;
8781 char_u
*varp
; /* currently used value */
8782 char_u
*varp_fresh
; /* local value */
8783 char_u
*varp_local
= NULL
; /* fresh value */
8789 * The options that don't have a default (terminal name, columns, lines)
8790 * are never written. Terminal options are also not written.
8791 * Do the loop over "options[]" twice: once for options with the
8792 * P_PRI_MKRC flag and once without.
8794 for (pri
= 1; pri
>= 0; --pri
)
8796 for (p
= &options
[0]; !istermoption(p
); p
++)
8797 if (!(p
->flags
& P_NO_MKRC
)
8799 && ((pri
== 1) == ((p
->flags
& P_PRI_MKRC
) != 0)))
8801 /* skip global option when only doing locals */
8802 if (p
->indir
== PV_NONE
&& !(opt_flags
& OPT_GLOBAL
))
8805 /* Do not store options like 'bufhidden' and 'syntax' in a vimrc
8806 * file, they are always buffer-specific. */
8807 if ((opt_flags
& OPT_GLOBAL
) && (p
->flags
& P_NOGLOB
))
8810 /* Global values are only written when not at the default value. */
8811 varp
= get_varp_scope(p
, opt_flags
);
8812 if ((opt_flags
& OPT_GLOBAL
) && optval_default(p
, varp
))
8816 if (p
->indir
!= PV_NONE
)
8818 if (p
->var
== VAR_WIN
)
8820 /* skip window-local option when only doing globals */
8821 if (!(opt_flags
& OPT_LOCAL
))
8823 /* When fresh value of window-local option is not at the
8824 * default, need to write it too. */
8825 if (!(opt_flags
& OPT_GLOBAL
) && !local_only
)
8827 varp_fresh
= get_varp_scope(p
, OPT_GLOBAL
);
8828 if (!optval_default(p
, varp_fresh
))
8838 /* Round 1: fresh value for window-local options.
8839 * Round 2: other values */
8840 for ( ; round
<= 2; varp
= varp_local
, ++round
)
8842 if (round
== 1 || (opt_flags
& OPT_GLOBAL
))
8847 if (p
->flags
& P_BOOL
)
8849 if (put_setbool(fd
, cmd
, p
->fullname
, *(int *)varp
) == FAIL
)
8852 else if (p
->flags
& P_NUM
)
8854 if (put_setnum(fd
, cmd
, p
->fullname
, (long *)varp
) == FAIL
)
8859 #if defined(FEAT_SYN_HL) || defined(FEAT_AUTOCMD)
8860 int do_endif
= FALSE
;
8862 /* Don't set 'syntax' and 'filetype' again if the value is
8863 * already right, avoids reloading the syntax file. */
8865 # if defined(FEAT_SYN_HL)
8867 # if defined(FEAT_AUTOCMD)
8871 # if defined(FEAT_AUTOCMD)
8876 if (fprintf(fd
, "if &%s != '%s'", p
->fullname
,
8877 *(char_u
**)(varp
)) < 0
8883 if (put_setstring(fd
, cmd
, p
->fullname
, (char_u
**)varp
,
8884 (p
->flags
& P_EXPAND
) != 0) == FAIL
)
8886 #if defined(FEAT_SYN_HL) || defined(FEAT_AUTOCMD)
8889 if (put_line(fd
, "endif") == FAIL
)
8900 #if defined(FEAT_FOLDING) || defined(PROTO)
8902 * Generate set commands for the local fold options only. Used when
8903 * 'sessionoptions' or 'viewoptions' contains "folds" but not "options".
8909 if (put_setstring(fd
, "setlocal", "fdm", &curwin
->w_p_fdm
, FALSE
) == FAIL
8911 || put_setstring(fd
, "setlocal", "fde", &curwin
->w_p_fde
, FALSE
)
8914 || put_setstring(fd
, "setlocal", "fmr", &curwin
->w_p_fmr
, FALSE
)
8916 || put_setstring(fd
, "setlocal", "fdi", &curwin
->w_p_fdi
, FALSE
)
8918 || put_setnum(fd
, "setlocal", "fdl", &curwin
->w_p_fdl
) == FAIL
8919 || put_setnum(fd
, "setlocal", "fml", &curwin
->w_p_fml
) == FAIL
8920 || put_setnum(fd
, "setlocal", "fdn", &curwin
->w_p_fdn
) == FAIL
8921 || put_setbool(fd
, "setlocal", "fen", curwin
->w_p_fen
) == FAIL
8930 put_setstring(fd
, cmd
, name
, valuep
, expand
)
8938 char_u buf
[MAXPATHL
];
8940 if (fprintf(fd
, "%s %s=", cmd
, name
) < 0)
8942 if (*valuep
!= NULL
)
8944 /* Output 'pastetoggle' as key names. For other
8945 * options some characters have to be escaped with
8946 * CTRL-V or backslash */
8947 if (valuep
== &p_pt
)
8951 if (put_escstr(fd
, str2special(&s
, FALSE
), 2) == FAIL
)
8956 home_replace(NULL
, *valuep
, buf
, MAXPATHL
, FALSE
);
8957 if (put_escstr(fd
, buf
, 2) == FAIL
)
8960 else if (put_escstr(fd
, *valuep
, 2) == FAIL
)
8963 if (put_eol(fd
) < 0)
8969 put_setnum(fd
, cmd
, name
, valuep
)
8977 if (fprintf(fd
, "%s %s=", cmd
, name
) < 0)
8979 if (wc_use_keyname((char_u
*)valuep
, &wc
))
8981 /* print 'wildchar' and 'wildcharm' as a key name */
8982 if (fputs((char *)get_special_key_name((int)wc
, 0), fd
) < 0)
8985 else if (fprintf(fd
, "%ld", *valuep
) < 0)
8987 if (put_eol(fd
) < 0)
8993 put_setbool(fd
, cmd
, name
, value
)
8999 if (value
< 0) /* global/local option using global value */
9001 if (fprintf(fd
, "%s %s%s", cmd
, value
? "" : "no", name
) < 0
9008 * Clear all the terminal options.
9009 * If the option has been allocated, free the memory.
9010 * Terminal options are never hidden or indirect.
9016 * Reset a few things before clearing the old options. This may cause
9017 * outputting a few things that the terminal doesn't understand, but the
9018 * screen will be cleared later, so this is OK.
9020 #ifdef FEAT_MOUSE_TTY
9021 mch_setmouse(FALSE
); /* switch mouse off */
9024 mch_restore_title(3); /* restore window titles */
9026 #if defined(FEAT_XCLIPBOARD) && defined(FEAT_GUI)
9027 /* When starting the GUI close the display opened for the clipboard.
9028 * After restoring the title, because that will need the display. */
9034 * Check if this is allowed now.
9036 if (can_end_termcap_mode(FALSE
) == TRUE
)
9038 stoptermcap(); /* stop termcap mode */
9046 struct vimoption
*p
;
9048 for (p
= &options
[0]; p
->fullname
!= NULL
; p
++)
9049 if (istermoption(p
))
9051 if (p
->flags
& P_ALLOCED
)
9052 free_string_option(*(char_u
**)(p
->var
));
9053 if (p
->flags
& P_DEF_ALLOCED
)
9054 free_string_option(p
->def_val
[VI_DEFAULT
]);
9055 *(char_u
**)(p
->var
) = empty_option
;
9056 p
->def_val
[VI_DEFAULT
] = empty_option
;
9057 p
->flags
&= ~(P_ALLOCED
|P_DEF_ALLOCED
);
9063 * Set the terminal option defaults to the current value.
9064 * Used after setting the terminal name.
9069 struct vimoption
*p
;
9071 for (p
= &options
[0]; p
->fullname
!= NULL
; p
++)
9073 if (istermoption(p
) && p
->def_val
[VI_DEFAULT
] != *(char_u
**)(p
->var
))
9075 if (p
->flags
& P_DEF_ALLOCED
)
9077 free_string_option(p
->def_val
[VI_DEFAULT
]);
9078 p
->flags
&= ~P_DEF_ALLOCED
;
9080 p
->def_val
[VI_DEFAULT
] = *(char_u
**)(p
->var
);
9081 if (p
->flags
& P_ALLOCED
)
9083 p
->flags
|= P_DEF_ALLOCED
;
9084 p
->flags
&= ~P_ALLOCED
; /* don't free the value now */
9091 * return TRUE if 'p' starts with 't_'
9095 struct vimoption
*p
;
9097 return (p
->fullname
[0] == 't' && p
->fullname
[1] == '_');
9101 * Compute columns for ruler and shown command. 'sc_col' is also used to
9102 * decide what the maximum length of a message on the status line can be.
9103 * If there is a status line for the last window, 'sc_col' is independent
9107 #define COL_RULER 17 /* columns needed by standard ruler */
9112 #if defined(FEAT_CMDL_INFO) && defined(FEAT_WINDOWS)
9113 int last_has_status
= (p_ls
== 2 || (p_ls
== 1 && firstwin
!= lastwin
));
9120 ru_col
= (ru_wid
? ru_wid
: COL_RULER
) + 1;
9122 ru_col
= COL_RULER
+ 1;
9124 /* no last status line, adjust sc_col */
9125 if (!last_has_status
)
9130 sc_col
+= SHOWCMD_COLS
;
9131 if (!p_ru
|| last_has_status
) /* no need for separating space */
9134 sc_col
= Columns
- sc_col
;
9135 ru_col
= Columns
- ru_col
;
9136 if (sc_col
<= 0) /* screen too narrow, will become a mess */
9147 * Get pointer to option variable, depending on local or global scope.
9150 get_varp_scope(p
, opt_flags
)
9151 struct vimoption
*p
;
9154 if ((opt_flags
& OPT_GLOBAL
) && p
->indir
!= PV_NONE
)
9156 if (p
->var
== VAR_WIN
)
9157 return (char_u
*)GLOBAL_WO(get_varp(p
));
9160 if ((opt_flags
& OPT_LOCAL
) && ((int)p
->indir
& PV_BOTH
))
9162 switch ((int)p
->indir
)
9164 #ifdef FEAT_QUICKFIX
9165 case PV_EFM
: return (char_u
*)&(curbuf
->b_p_efm
);
9166 case PV_GP
: return (char_u
*)&(curbuf
->b_p_gp
);
9167 case PV_MP
: return (char_u
*)&(curbuf
->b_p_mp
);
9169 case PV_EP
: return (char_u
*)&(curbuf
->b_p_ep
);
9170 case PV_KP
: return (char_u
*)&(curbuf
->b_p_kp
);
9171 case PV_PATH
: return (char_u
*)&(curbuf
->b_p_path
);
9172 case PV_AR
: return (char_u
*)&(curbuf
->b_p_ar
);
9173 case PV_TAGS
: return (char_u
*)&(curbuf
->b_p_tags
);
9175 case PV_DEF
: return (char_u
*)&(curbuf
->b_p_def
);
9176 case PV_INC
: return (char_u
*)&(curbuf
->b_p_inc
);
9178 #ifdef FEAT_INS_EXPAND
9179 case PV_DICT
: return (char_u
*)&(curbuf
->b_p_dict
);
9180 case PV_TSR
: return (char_u
*)&(curbuf
->b_p_tsr
);
9182 #if defined(FEAT_BEVAL) && defined(FEAT_EVAL)
9183 case PV_BEXPR
: return (char_u
*)&(curbuf
->b_p_bexpr
);
9186 case PV_STL
: return (char_u
*)&(curwin
->w_p_stl
);
9189 return NULL
; /* "cannot happen" */
9195 * Get pointer to option variable.
9199 struct vimoption
*p
;
9201 /* hidden option, always return NULL */
9205 switch ((int)p
->indir
)
9207 case PV_NONE
: return p
->var
;
9209 /* global option with local value: use local value if it's been set */
9210 case PV_EP
: return *curbuf
->b_p_ep
!= NUL
9211 ? (char_u
*)&curbuf
->b_p_ep
: p
->var
;
9212 case PV_KP
: return *curbuf
->b_p_kp
!= NUL
9213 ? (char_u
*)&curbuf
->b_p_kp
: p
->var
;
9214 case PV_PATH
: return *curbuf
->b_p_path
!= NUL
9215 ? (char_u
*)&(curbuf
->b_p_path
) : p
->var
;
9216 case PV_AR
: return curbuf
->b_p_ar
>= 0
9217 ? (char_u
*)&(curbuf
->b_p_ar
) : p
->var
;
9218 case PV_TAGS
: return *curbuf
->b_p_tags
!= NUL
9219 ? (char_u
*)&(curbuf
->b_p_tags
) : p
->var
;
9221 case PV_DEF
: return *curbuf
->b_p_def
!= NUL
9222 ? (char_u
*)&(curbuf
->b_p_def
) : p
->var
;
9223 case PV_INC
: return *curbuf
->b_p_inc
!= NUL
9224 ? (char_u
*)&(curbuf
->b_p_inc
) : p
->var
;
9226 #ifdef FEAT_INS_EXPAND
9227 case PV_DICT
: return *curbuf
->b_p_dict
!= NUL
9228 ? (char_u
*)&(curbuf
->b_p_dict
) : p
->var
;
9229 case PV_TSR
: return *curbuf
->b_p_tsr
!= NUL
9230 ? (char_u
*)&(curbuf
->b_p_tsr
) : p
->var
;
9232 #ifdef FEAT_QUICKFIX
9233 case PV_EFM
: return *curbuf
->b_p_efm
!= NUL
9234 ? (char_u
*)&(curbuf
->b_p_efm
) : p
->var
;
9235 case PV_GP
: return *curbuf
->b_p_gp
!= NUL
9236 ? (char_u
*)&(curbuf
->b_p_gp
) : p
->var
;
9237 case PV_MP
: return *curbuf
->b_p_mp
!= NUL
9238 ? (char_u
*)&(curbuf
->b_p_mp
) : p
->var
;
9240 #if defined(FEAT_BEVAL) && defined(FEAT_EVAL)
9241 case PV_BEXPR
: return *curbuf
->b_p_bexpr
!= NUL
9242 ? (char_u
*)&(curbuf
->b_p_bexpr
) : p
->var
;
9245 case PV_STL
: return *curwin
->w_p_stl
!= NUL
9246 ? (char_u
*)&(curwin
->w_p_stl
) : p
->var
;
9250 case PV_ARAB
: return (char_u
*)&(curwin
->w_p_arab
);
9252 case PV_LIST
: return (char_u
*)&(curwin
->w_p_list
);
9254 case PV_SPELL
: return (char_u
*)&(curwin
->w_p_spell
);
9257 case PV_CUC
: return (char_u
*)&(curwin
->w_p_cuc
);
9258 case PV_CUL
: return (char_u
*)&(curwin
->w_p_cul
);
9261 case PV_DIFF
: return (char_u
*)&(curwin
->w_p_diff
);
9264 case PV_FDC
: return (char_u
*)&(curwin
->w_p_fdc
);
9265 case PV_FEN
: return (char_u
*)&(curwin
->w_p_fen
);
9266 case PV_FDI
: return (char_u
*)&(curwin
->w_p_fdi
);
9267 case PV_FDL
: return (char_u
*)&(curwin
->w_p_fdl
);
9268 case PV_FDM
: return (char_u
*)&(curwin
->w_p_fdm
);
9269 case PV_FML
: return (char_u
*)&(curwin
->w_p_fml
);
9270 case PV_FDN
: return (char_u
*)&(curwin
->w_p_fdn
);
9272 case PV_FDE
: return (char_u
*)&(curwin
->w_p_fde
);
9273 case PV_FDT
: return (char_u
*)&(curwin
->w_p_fdt
);
9275 case PV_FMR
: return (char_u
*)&(curwin
->w_p_fmr
);
9277 case PV_NU
: return (char_u
*)&(curwin
->w_p_nu
);
9278 #ifdef FEAT_LINEBREAK
9279 case PV_NUW
: return (char_u
*)&(curwin
->w_p_nuw
);
9282 case PV_WFH
: return (char_u
*)&(curwin
->w_p_wfh
);
9284 #ifdef FEAT_VERTSPLIT
9285 case PV_WFW
: return (char_u
*)&(curwin
->w_p_wfw
);
9287 #if defined(FEAT_WINDOWS) && defined(FEAT_QUICKFIX)
9288 case PV_PVW
: return (char_u
*)&(curwin
->w_p_pvw
);
9290 #ifdef FEAT_RIGHTLEFT
9291 case PV_RL
: return (char_u
*)&(curwin
->w_p_rl
);
9292 case PV_RLC
: return (char_u
*)&(curwin
->w_p_rlc
);
9294 case PV_SCROLL
: return (char_u
*)&(curwin
->w_p_scr
);
9295 case PV_WRAP
: return (char_u
*)&(curwin
->w_p_wrap
);
9296 #ifdef FEAT_LINEBREAK
9297 case PV_LBR
: return (char_u
*)&(curwin
->w_p_lbr
);
9299 #ifdef FEAT_SCROLLBIND
9300 case PV_SCBIND
: return (char_u
*)&(curwin
->w_p_scb
);
9303 case PV_AI
: return (char_u
*)&(curbuf
->b_p_ai
);
9304 case PV_BIN
: return (char_u
*)&(curbuf
->b_p_bin
);
9306 case PV_BOMB
: return (char_u
*)&(curbuf
->b_p_bomb
);
9308 #if defined(FEAT_QUICKFIX)
9309 case PV_BH
: return (char_u
*)&(curbuf
->b_p_bh
);
9310 case PV_BT
: return (char_u
*)&(curbuf
->b_p_bt
);
9312 case PV_BL
: return (char_u
*)&(curbuf
->b_p_bl
);
9313 case PV_CI
: return (char_u
*)&(curbuf
->b_p_ci
);
9315 case PV_CIN
: return (char_u
*)&(curbuf
->b_p_cin
);
9316 case PV_CINK
: return (char_u
*)&(curbuf
->b_p_cink
);
9317 case PV_CINO
: return (char_u
*)&(curbuf
->b_p_cino
);
9319 #if defined(FEAT_SMARTINDENT) || defined(FEAT_CINDENT)
9320 case PV_CINW
: return (char_u
*)&(curbuf
->b_p_cinw
);
9322 #ifdef FEAT_COMMENTS
9323 case PV_COM
: return (char_u
*)&(curbuf
->b_p_com
);
9326 case PV_CMS
: return (char_u
*)&(curbuf
->b_p_cms
);
9328 #ifdef FEAT_INS_EXPAND
9329 case PV_CPT
: return (char_u
*)&(curbuf
->b_p_cpt
);
9331 #ifdef FEAT_COMPL_FUNC
9332 case PV_CFU
: return (char_u
*)&(curbuf
->b_p_cfu
);
9333 case PV_OFU
: return (char_u
*)&(curbuf
->b_p_ofu
);
9335 case PV_EOL
: return (char_u
*)&(curbuf
->b_p_eol
);
9336 case PV_ET
: return (char_u
*)&(curbuf
->b_p_et
);
9338 case PV_FENC
: return (char_u
*)&(curbuf
->b_p_fenc
);
9340 case PV_FF
: return (char_u
*)&(curbuf
->b_p_ff
);
9342 case PV_FT
: return (char_u
*)&(curbuf
->b_p_ft
);
9344 case PV_FO
: return (char_u
*)&(curbuf
->b_p_fo
);
9345 case PV_FLP
: return (char_u
*)&(curbuf
->b_p_flp
);
9346 case PV_IMI
: return (char_u
*)&(curbuf
->b_p_iminsert
);
9347 case PV_IMS
: return (char_u
*)&(curbuf
->b_p_imsearch
);
9348 case PV_INF
: return (char_u
*)&(curbuf
->b_p_inf
);
9349 case PV_ISK
: return (char_u
*)&(curbuf
->b_p_isk
);
9352 case PV_INEX
: return (char_u
*)&(curbuf
->b_p_inex
);
9355 #if defined(FEAT_CINDENT) && defined(FEAT_EVAL)
9356 case PV_INDE
: return (char_u
*)&(curbuf
->b_p_inde
);
9357 case PV_INDK
: return (char_u
*)&(curbuf
->b_p_indk
);
9360 case PV_FEX
: return (char_u
*)&(curbuf
->b_p_fex
);
9363 case PV_KEY
: return (char_u
*)&(curbuf
->b_p_key
);
9366 case PV_LISP
: return (char_u
*)&(curbuf
->b_p_lisp
);
9368 case PV_ML
: return (char_u
*)&(curbuf
->b_p_ml
);
9369 case PV_MPS
: return (char_u
*)&(curbuf
->b_p_mps
);
9370 #ifdef FEAT_GUI_MACVIM
9371 case PV_MMTA
: return (char_u
*)&(curbuf
->b_p_mmta
);
9373 case PV_MA
: return (char_u
*)&(curbuf
->b_p_ma
);
9375 case PV_MIG
: return (char_u
*)&(curbuf
->b_p_migemo
);
9377 case PV_MOD
: return (char_u
*)&(curbuf
->b_changed
);
9378 case PV_NF
: return (char_u
*)&(curbuf
->b_p_nf
);
9379 #ifdef FEAT_OSFILETYPE
9380 case PV_OFT
: return (char_u
*)&(curbuf
->b_p_oft
);
9382 case PV_PI
: return (char_u
*)&(curbuf
->b_p_pi
);
9384 case PV_QE
: return (char_u
*)&(curbuf
->b_p_qe
);
9386 case PV_RO
: return (char_u
*)&(curbuf
->b_p_ro
);
9387 #ifdef FEAT_SMARTINDENT
9388 case PV_SI
: return (char_u
*)&(curbuf
->b_p_si
);
9391 case PV_SN
: return (char_u
*)&(curbuf
->b_p_sn
);
9393 case PV_STS
: return (char_u
*)&(curbuf
->b_p_sts
);
9394 #ifdef FEAT_SEARCHPATH
9395 case PV_SUA
: return (char_u
*)&(curbuf
->b_p_sua
);
9397 case PV_SWF
: return (char_u
*)&(curbuf
->b_p_swf
);
9399 case PV_SMC
: return (char_u
*)&(curbuf
->b_p_smc
);
9400 case PV_SYN
: return (char_u
*)&(curbuf
->b_p_syn
);
9403 case PV_SPC
: return (char_u
*)&(curbuf
->b_p_spc
);
9404 case PV_SPF
: return (char_u
*)&(curbuf
->b_p_spf
);
9405 case PV_SPL
: return (char_u
*)&(curbuf
->b_p_spl
);
9407 case PV_SW
: return (char_u
*)&(curbuf
->b_p_sw
);
9408 case PV_TS
: return (char_u
*)&(curbuf
->b_p_ts
);
9409 case PV_TW
: return (char_u
*)&(curbuf
->b_p_tw
);
9410 case PV_TX
: return (char_u
*)&(curbuf
->b_p_tx
);
9411 case PV_WM
: return (char_u
*)&(curbuf
->b_p_wm
);
9413 case PV_KMAP
: return (char_u
*)&(curbuf
->b_p_keymap
);
9415 default: EMSG(_("E356: get_varp ERROR"));
9417 /* always return a valid pointer to avoid a crash! */
9418 return (char_u
*)&(curbuf
->b_p_wm
);
9422 * Get the value of 'equalprg', either the buffer-local one or the global one.
9427 if (*curbuf
->b_p_ep
== NUL
)
9429 return curbuf
->b_p_ep
;
9432 #if defined(FEAT_WINDOWS) || defined(PROTO)
9434 * Copy options from one window to another.
9435 * Used when splitting a window.
9438 win_copy_options(wp_from
, wp_to
)
9442 copy_winopt(&wp_from
->w_onebuf_opt
, &wp_to
->w_onebuf_opt
);
9443 copy_winopt(&wp_from
->w_allbuf_opt
, &wp_to
->w_allbuf_opt
);
9444 # ifdef FEAT_RIGHTLEFT
9446 /* Is this right? */
9447 wp_to
->w_farsi
= wp_from
->w_farsi
;
9454 * Copy the options from one winopt_T to another.
9455 * Doesn't free the old option values in "to", use clear_winopt() for that.
9456 * The 'scroll' option is not copied, because it depends on the window height.
9457 * The 'previewwindow' option is reset, there can be only one preview window.
9460 copy_winopt(from
, to
)
9465 to
->wo_arab
= from
->wo_arab
;
9467 to
->wo_list
= from
->wo_list
;
9468 to
->wo_nu
= from
->wo_nu
;
9469 #ifdef FEAT_LINEBREAK
9470 to
->wo_nuw
= from
->wo_nuw
;
9472 #ifdef FEAT_RIGHTLEFT
9473 to
->wo_rl
= from
->wo_rl
;
9474 to
->wo_rlc
= vim_strsave(from
->wo_rlc
);
9477 to
->wo_stl
= vim_strsave(from
->wo_stl
);
9479 to
->wo_wrap
= from
->wo_wrap
;
9480 #ifdef FEAT_LINEBREAK
9481 to
->wo_lbr
= from
->wo_lbr
;
9483 #ifdef FEAT_SCROLLBIND
9484 to
->wo_scb
= from
->wo_scb
;
9487 to
->wo_spell
= from
->wo_spell
;
9490 to
->wo_cuc
= from
->wo_cuc
;
9491 to
->wo_cul
= from
->wo_cul
;
9494 to
->wo_diff
= from
->wo_diff
;
9497 to
->wo_fdc
= from
->wo_fdc
;
9498 to
->wo_fen
= from
->wo_fen
;
9499 to
->wo_fdi
= vim_strsave(from
->wo_fdi
);
9500 to
->wo_fml
= from
->wo_fml
;
9501 to
->wo_fdl
= from
->wo_fdl
;
9502 to
->wo_fdm
= vim_strsave(from
->wo_fdm
);
9503 to
->wo_fdn
= from
->wo_fdn
;
9505 to
->wo_fde
= vim_strsave(from
->wo_fde
);
9506 to
->wo_fdt
= vim_strsave(from
->wo_fdt
);
9508 to
->wo_fmr
= vim_strsave(from
->wo_fmr
);
9510 check_winopt(to
); /* don't want NULL pointers */
9514 * Check string options in a window for a NULL value.
9517 check_win_options(win
)
9520 check_winopt(&win
->w_onebuf_opt
);
9521 check_winopt(&win
->w_allbuf_opt
);
9525 * Check for NULL pointers in a winopt_T and replace them with empty_option.
9533 check_string_option(&wop
->wo_fdi
);
9534 check_string_option(&wop
->wo_fdm
);
9536 check_string_option(&wop
->wo_fde
);
9537 check_string_option(&wop
->wo_fdt
);
9539 check_string_option(&wop
->wo_fmr
);
9541 #ifdef FEAT_RIGHTLEFT
9542 check_string_option(&wop
->wo_rlc
);
9545 check_string_option(&wop
->wo_stl
);
9550 * Free the allocated memory inside a winopt_T.
9558 clear_string_option(&wop
->wo_fdi
);
9559 clear_string_option(&wop
->wo_fdm
);
9561 clear_string_option(&wop
->wo_fde
);
9562 clear_string_option(&wop
->wo_fdt
);
9564 clear_string_option(&wop
->wo_fmr
);
9566 #ifdef FEAT_RIGHTLEFT
9567 clear_string_option(&wop
->wo_rlc
);
9570 clear_string_option(&wop
->wo_stl
);
9575 * Copy global option values to local options for one buffer.
9576 * Used when creating a new buffer and sometimes when entering a buffer.
9578 * BCO_ENTER We will enter the buf buffer.
9579 * BCO_ALWAYS Always copy the options, but only set b_p_initialized when
9581 * BCO_NOHELP Don't copy the values to a help buffer.
9584 buf_copy_options(buf
, flags
)
9588 int should_copy
= TRUE
;
9589 char_u
*save_p_isk
= NULL
; /* init for GCC */
9591 int did_isk
= FALSE
;
9594 * Don't do anything of the buffer is invalid.
9596 if (buf
== NULL
|| !buf_valid(buf
))
9600 * Skip this when the option defaults have not been set yet. Happens when
9601 * main() allocates the first buffer.
9606 * Always copy when entering and 'cpo' contains 'S'.
9607 * Don't copy when already initialized.
9608 * Don't copy when 'cpo' contains 's' and not entering.
9609 * 'S' BCO_ENTER initialized 's' should_copy
9611 * yes no yes X FALSE
9617 if ((vim_strchr(p_cpo
, CPO_BUFOPTGLOB
) == NULL
|| !(flags
& BCO_ENTER
))
9618 && (buf
->b_p_initialized
9619 || (!(flags
& BCO_ENTER
)
9620 && vim_strchr(p_cpo
, CPO_BUFOPT
) != NULL
)))
9621 should_copy
= FALSE
;
9623 if (should_copy
|| (flags
& BCO_ALWAYS
))
9625 /* Don't copy the options specific to a help buffer when
9626 * BCO_NOHELP is given or the options were initialized already
9627 * (jumping back to a help file with CTRL-T or CTRL-O) */
9628 dont_do_help
= ((flags
& BCO_NOHELP
) && buf
->b_help
)
9629 || buf
->b_p_initialized
;
9630 if (dont_do_help
) /* don't free b_p_isk */
9632 save_p_isk
= buf
->b_p_isk
;
9633 buf
->b_p_isk
= NULL
;
9636 * Always free the allocated strings.
9637 * If not already initialized, set 'readonly' and copy 'fileformat'.
9639 if (!buf
->b_p_initialized
)
9641 free_buf_options(buf
, TRUE
);
9642 buf
->b_p_ro
= FALSE
; /* don't copy readonly */
9645 buf
->b_p_fenc
= vim_strsave(p_fenc
);
9647 buf
->b_p_ff
= vim_strsave(p_ff
);
9648 #if defined(FEAT_QUICKFIX)
9649 buf
->b_p_bh
= empty_option
;
9650 buf
->b_p_bt
= empty_option
;
9654 free_buf_options(buf
, FALSE
);
9657 buf
->b_p_ai_nopaste
= p_ai_nopaste
;
9660 buf
->b_p_tw_nopaste
= p_tw_nopaste
;
9661 buf
->b_p_tw_nobin
= p_tw_nobin
;
9663 buf
->b_p_wm_nopaste
= p_wm_nopaste
;
9664 buf
->b_p_wm_nobin
= p_wm_nobin
;
9665 buf
->b_p_bin
= p_bin
;
9667 buf
->b_p_bomb
= p_bomb
;
9670 buf
->b_p_et_nobin
= p_et_nobin
;
9672 buf
->b_p_ml_nobin
= p_ml_nobin
;
9673 buf
->b_p_inf
= p_inf
;
9674 buf
->b_p_swf
= p_swf
;
9675 #ifdef FEAT_INS_EXPAND
9676 buf
->b_p_cpt
= vim_strsave(p_cpt
);
9678 #ifdef FEAT_COMPL_FUNC
9679 buf
->b_p_cfu
= vim_strsave(p_cfu
);
9680 buf
->b_p_ofu
= vim_strsave(p_ofu
);
9682 buf
->b_p_sts
= p_sts
;
9683 buf
->b_p_sts_nopaste
= p_sts_nopaste
;
9687 #ifdef FEAT_COMMENTS
9688 buf
->b_p_com
= vim_strsave(p_com
);
9691 buf
->b_p_cms
= vim_strsave(p_cms
);
9693 buf
->b_p_fo
= vim_strsave(p_fo
);
9694 buf
->b_p_flp
= vim_strsave(p_flp
);
9695 buf
->b_p_nf
= vim_strsave(p_nf
);
9696 buf
->b_p_mps
= vim_strsave(p_mps
);
9697 #ifdef FEAT_SMARTINDENT
9702 buf
->b_p_cin
= p_cin
;
9703 buf
->b_p_cink
= vim_strsave(p_cink
);
9704 buf
->b_p_cino
= vim_strsave(p_cino
);
9707 /* Don't copy 'filetype', it must be detected */
9708 buf
->b_p_ft
= empty_option
;
9710 #ifdef FEAT_OSFILETYPE
9711 buf
->b_p_oft
= vim_strsave(p_oft
);
9714 #if defined(FEAT_SMARTINDENT) || defined(FEAT_CINDENT)
9715 buf
->b_p_cinw
= vim_strsave(p_cinw
);
9718 buf
->b_p_lisp
= p_lisp
;
9721 /* Don't copy 'syntax', it must be set */
9722 buf
->b_p_syn
= empty_option
;
9723 buf
->b_p_smc
= p_smc
;
9726 buf
->b_p_spc
= vim_strsave(p_spc
);
9727 (void)compile_cap_prog(buf
);
9728 buf
->b_p_spf
= vim_strsave(p_spf
);
9729 buf
->b_p_spl
= vim_strsave(p_spl
);
9731 #if defined(FEAT_CINDENT) && defined(FEAT_EVAL)
9732 buf
->b_p_inde
= vim_strsave(p_inde
);
9733 buf
->b_p_indk
= vim_strsave(p_indk
);
9735 #if defined(FEAT_EVAL)
9736 buf
->b_p_fex
= vim_strsave(p_fex
);
9739 buf
->b_p_key
= vim_strsave(p_key
);
9741 #ifdef FEAT_SEARCHPATH
9742 buf
->b_p_sua
= vim_strsave(p_sua
);
9745 buf
->b_p_keymap
= vim_strsave(p_keymap
);
9746 buf
->b_kmap_state
|= KEYMAP_INIT
;
9748 #ifdef FEAT_GUI_MACVIM
9749 buf
->b_p_mmta
= p_mmta
;
9751 /* This isn't really an option, but copying the langmap and IME
9752 * state from the current buffer is better than resetting it. */
9753 buf
->b_p_iminsert
= p_iminsert
;
9754 buf
->b_p_imsearch
= p_imsearch
;
9757 /* This is migemo extension */
9758 buf
->b_p_migemo
= p_migemo
;
9761 /* options that are normally global but also have a local value
9762 * are not copied, start using the global value */
9764 #ifdef FEAT_QUICKFIX
9765 buf
->b_p_gp
= empty_option
;
9766 buf
->b_p_mp
= empty_option
;
9767 buf
->b_p_efm
= empty_option
;
9769 buf
->b_p_ep
= empty_option
;
9770 buf
->b_p_kp
= empty_option
;
9771 buf
->b_p_path
= empty_option
;
9772 buf
->b_p_tags
= empty_option
;
9774 buf
->b_p_def
= empty_option
;
9775 buf
->b_p_inc
= empty_option
;
9777 buf
->b_p_inex
= vim_strsave(p_inex
);
9780 #ifdef FEAT_INS_EXPAND
9781 buf
->b_p_dict
= empty_option
;
9782 buf
->b_p_tsr
= empty_option
;
9785 buf
->b_p_qe
= vim_strsave(p_qe
);
9787 #if defined(FEAT_BEVAL) && defined(FEAT_EVAL)
9788 buf
->b_p_bexpr
= empty_option
;
9792 * Don't copy the options set by ex_help(), use the saved values,
9793 * when going from a help buffer to a non-help buffer.
9794 * Don't touch these at all when BCO_NOHELP is used and going from
9795 * or to a help buffer.
9798 buf
->b_p_isk
= save_p_isk
;
9801 buf
->b_p_isk
= vim_strsave(p_isk
);
9804 buf
->b_help
= FALSE
;
9805 #ifdef FEAT_QUICKFIX
9806 if (buf
->b_p_bt
[0] == 'h')
9807 clear_string_option(&buf
->b_p_bt
);
9814 * When the options should be copied (ignoring BCO_ALWAYS), set the
9815 * flag that indicates that the options have been initialized.
9818 buf
->b_p_initialized
= TRUE
;
9821 check_buf_options(buf
); /* make sure we don't have NULLs */
9823 (void)buf_init_chartab(buf
, FALSE
);
9827 * Reset the 'modifiable' option and its default value.
9834 curbuf
->b_p_ma
= FALSE
;
9836 opt_idx
= findoption((char_u
*)"ma");
9838 options
[opt_idx
].def_val
[VI_DEFAULT
] = FALSE
;
9842 * Set the global value for 'iminsert' to the local value.
9845 set_iminsert_global()
9847 p_iminsert
= curbuf
->b_p_iminsert
;
9851 * Set the global value for 'imsearch' to the local value.
9854 set_imsearch_global()
9856 p_imsearch
= curbuf
->b_p_imsearch
;
9859 #if defined(FEAT_CMDL_COMPL) || defined(PROTO)
9860 static int expand_option_idx
= -1;
9861 static char_u expand_option_name
[5] = {'t', '_', NUL
, NUL
, NUL
};
9862 static int expand_option_flags
= 0;
9865 set_context_in_set_cmd(xp
, arg
, opt_flags
)
9868 int opt_flags
; /* OPT_GLOBAL and/or OPT_LOCAL */
9871 long_u flags
= 0; /* init for GCC */
9872 int opt_idx
= 0; /* init for GCC */
9875 int is_term_option
= FALSE
;
9878 expand_option_flags
= opt_flags
;
9880 xp
->xp_context
= EXPAND_SETTINGS
;
9883 xp
->xp_pattern
= arg
;
9886 p
= arg
+ STRLEN(arg
) - 1;
9887 if (*p
== ' ' && *(p
- 1) != '\\')
9889 xp
->xp_pattern
= p
+ 1;
9895 /* count number of backslashes before ' ' or ',' */
9896 if (*p
== ' ' || *p
== ',')
9898 while (s
> arg
&& *(s
- 1) == '\\')
9901 /* break at a space with an even number of backslashes */
9902 if (*p
== ' ' && ((p
- s
) & 1) == 0)
9909 if (STRNCMP(p
, "no", 2) == 0)
9911 xp
->xp_context
= EXPAND_BOOL_SETTINGS
;
9914 if (STRNCMP(p
, "inv", 3) == 0)
9916 xp
->xp_context
= EXPAND_BOOL_SETTINGS
;
9919 xp
->xp_pattern
= arg
= p
;
9923 if (*p
++ == NUL
) /* expand terminal option name */
9925 key
= get_special_key_code(arg
+ 1);
9926 if (key
== 0) /* unknown name */
9928 xp
->xp_context
= EXPAND_NOTHING
;
9932 is_term_option
= TRUE
;
9933 expand_option_name
[2] = KEY2TERMCAP0(key
);
9934 expand_option_name
[3] = KEY2TERMCAP1(key
);
9938 if (p
[0] == 't' && p
[1] == '_')
9944 return; /* expand option name */
9946 is_term_option
= TRUE
;
9947 expand_option_name
[2] = p
[-2];
9948 expand_option_name
[3] = p
[-1];
9952 /* Allow * wildcard */
9953 while (ASCII_ISALNUM(*p
) || *p
== '_' || *p
== '*')
9959 opt_idx
= findoption(arg
);
9961 if (opt_idx
== -1 || options
[opt_idx
].var
== NULL
)
9963 xp
->xp_context
= EXPAND_NOTHING
;
9966 flags
= options
[opt_idx
].flags
;
9969 xp
->xp_context
= EXPAND_NOTHING
;
9974 /* handle "-=" and "+=" */
9975 if ((nextchar
== '-' || nextchar
== '+' || nextchar
== '^') && p
[1] == '=')
9980 if ((nextchar
!= '=' && nextchar
!= ':')
9981 || xp
->xp_context
== EXPAND_BOOL_SETTINGS
)
9983 xp
->xp_context
= EXPAND_UNSUCCESSFUL
;
9986 if (xp
->xp_context
!= EXPAND_BOOL_SETTINGS
&& p
[1] == NUL
)
9988 xp
->xp_context
= EXPAND_OLD_SETTING
;
9990 expand_option_idx
= -1;
9992 expand_option_idx
= opt_idx
;
9993 xp
->xp_pattern
= p
+ 1;
9996 xp
->xp_context
= EXPAND_NOTHING
;
9997 if (is_term_option
|| (flags
& P_NUM
))
10000 xp
->xp_pattern
= p
+ 1;
10002 if (flags
& P_EXPAND
)
10004 p
= options
[opt_idx
].var
;
10005 if (p
== (char_u
*)&p_bdir
10006 || p
== (char_u
*)&p_dir
10007 || p
== (char_u
*)&p_path
10008 || p
== (char_u
*)&p_rtp
10009 #ifdef FEAT_SEARCHPATH
10010 || p
== (char_u
*)&p_cdpath
10012 #ifdef FEAT_SESSION
10013 || p
== (char_u
*)&p_vdir
10017 xp
->xp_context
= EXPAND_DIRECTORIES
;
10018 if (p
== (char_u
*)&p_path
10019 #ifdef FEAT_SEARCHPATH
10020 || p
== (char_u
*)&p_cdpath
10023 xp
->xp_backslash
= XP_BS_THREE
;
10025 xp
->xp_backslash
= XP_BS_ONE
;
10029 xp
->xp_context
= EXPAND_FILES
;
10030 /* for 'tags' need three backslashes for a space */
10031 if (p
== (char_u
*)&p_tags
)
10032 xp
->xp_backslash
= XP_BS_THREE
;
10034 xp
->xp_backslash
= XP_BS_ONE
;
10038 /* For an option that is a list of file names, find the start of the
10039 * last file name. */
10040 for (p
= arg
+ STRLEN(arg
) - 1; p
> xp
->xp_pattern
; --p
)
10042 /* count number of backslashes before ' ' or ',' */
10043 if (*p
== ' ' || *p
== ',')
10046 while (s
> xp
->xp_pattern
&& *(s
- 1) == '\\')
10048 if ((*p
== ' ' && (xp
->xp_backslash
== XP_BS_THREE
&& (p
- s
) < 3))
10049 || (*p
== ',' && (flags
& P_COMMA
) && ((p
- s
) & 1) == 0))
10051 xp
->xp_pattern
= p
+ 1;
10057 /* for 'spellsuggest' start at "file:" */
10058 if (options
[opt_idx
].var
== (char_u
*)&p_sps
10059 && STRNCMP(p
, "file:", 5) == 0)
10061 xp
->xp_pattern
= p
+ 5;
10071 ExpandSettings(xp
, regmatch
, num_file
, file
)
10073 regmatch_T
*regmatch
;
10077 int num_normal
= 0; /* Nr of matching non-term-code settings */
10078 int num_term
= 0; /* Nr of matching terminal code settings */
10085 char_u name_buf
[MAX_KEY_NAME_LEN
];
10086 static char *(names
[]) = {"all", "termcap"};
10087 int ic
= regmatch
->rm_ic
; /* remember the ignore-case flag */
10089 /* do this loop twice:
10090 * loop == 0: count the number of matching options
10091 * loop == 1: copy the matching options into allocated memory
10093 for (loop
= 0; loop
<= 1; ++loop
)
10095 regmatch
->rm_ic
= ic
;
10096 if (xp
->xp_context
!= EXPAND_BOOL_SETTINGS
)
10098 for (match
= 0; match
< sizeof(names
) / sizeof(char *); ++match
)
10099 if (vim_regexec(regmatch
, (char_u
*)names
[match
], (colnr_T
)0))
10104 (*file
)[count
++] = vim_strsave((char_u
*)names
[match
]);
10107 for (opt_idx
= 0; (str
= (char_u
*)options
[opt_idx
].fullname
) != NULL
;
10110 if (options
[opt_idx
].var
== NULL
)
10112 if (xp
->xp_context
== EXPAND_BOOL_SETTINGS
10113 && !(options
[opt_idx
].flags
& P_BOOL
))
10115 is_term_opt
= istermoption(&options
[opt_idx
]);
10116 if (is_term_opt
&& num_normal
> 0)
10119 if (vim_regexec(regmatch
, str
, (colnr_T
)0)
10120 || (options
[opt_idx
].shortname
!= NULL
10121 && vim_regexec(regmatch
,
10122 (char_u
*)options
[opt_idx
].shortname
, (colnr_T
)0)))
10124 else if (is_term_opt
)
10129 name_buf
[3] = str
[2];
10130 name_buf
[4] = str
[3];
10133 if (vim_regexec(regmatch
, name_buf
, (colnr_T
)0))
10149 (*file
)[count
++] = vim_strsave(str
);
10153 * Check terminal key codes, these are not in the option table
10155 if (xp
->xp_context
!= EXPAND_BOOL_SETTINGS
&& num_normal
== 0)
10157 for (opt_idx
= 0; (str
= get_termcode(opt_idx
)) != NULL
; opt_idx
++)
10159 if (!isprint(str
[0]) || !isprint(str
[1]))
10164 name_buf
[2] = str
[0];
10165 name_buf
[3] = str
[1];
10169 if (vim_regexec(regmatch
, name_buf
, (colnr_T
)0))
10176 name_buf
[3] = str
[0];
10177 name_buf
[4] = str
[1];
10181 if (vim_regexec(regmatch
, name_buf
, (colnr_T
)0))
10189 (*file
)[count
++] = vim_strsave(name_buf
);
10194 * Check special key names.
10196 regmatch
->rm_ic
= TRUE
; /* ignore case here */
10197 for (opt_idx
= 0; (str
= get_key_name(opt_idx
)) != NULL
; opt_idx
++)
10200 STRCPY(name_buf
+ 1, str
);
10201 STRCAT(name_buf
, ">");
10203 if (vim_regexec(regmatch
, name_buf
, (colnr_T
)0))
10208 (*file
)[count
++] = vim_strsave(name_buf
);
10214 if (num_normal
> 0)
10215 *num_file
= num_normal
;
10216 else if (num_term
> 0)
10217 *num_file
= num_term
;
10220 *file
= (char_u
**)alloc((unsigned)(*num_file
* sizeof(char_u
*)));
10223 *file
= (char_u
**)"";
10232 ExpandOldSetting(num_file
, file
)
10236 char_u
*var
= NULL
; /* init for GCC */
10240 *file
= (char_u
**)alloc((unsigned)sizeof(char_u
*));
10245 * For a terminal key code expand_option_idx is < 0.
10247 if (expand_option_idx
< 0)
10249 var
= find_termcode(expand_option_name
+ 2);
10251 expand_option_idx
= findoption(expand_option_name
);
10254 if (expand_option_idx
>= 0)
10256 /* put string of option value in NameBuff */
10257 option_value2string(&options
[expand_option_idx
], expand_option_flags
);
10260 else if (var
== NULL
)
10261 var
= (char_u
*)"";
10263 /* A backslash is required before some characters. This is the reverse of
10264 * what happens in do_set(). */
10265 buf
= vim_strsave_escaped(var
, escape_chars
);
10274 #ifdef BACKSLASH_IN_FILENAME
10275 /* For MS-Windows et al. we don't double backslashes at the start and
10276 * before a file name character. */
10277 for (var
= buf
; *var
!= NUL
; mb_ptr_adv(var
))
10278 if (var
[0] == '\\' && var
[1] == '\\'
10279 && expand_option_idx
>= 0
10280 && (options
[expand_option_idx
].flags
& P_EXPAND
)
10281 && vim_isfilec(var
[2])
10282 && (var
[2] != '\\' || (var
== buf
&& var
[4] != '\\')))
10283 STRMOVE(var
, var
+ 1);
10293 * Get the value for the numeric or string option *opp in a nice format into
10294 * NameBuff[]. Must not be called with a hidden option!
10297 option_value2string(opp
, opt_flags
)
10298 struct vimoption
*opp
;
10299 int opt_flags
; /* OPT_GLOBAL and/or OPT_LOCAL */
10303 varp
= get_varp_scope(opp
, opt_flags
);
10305 if (opp
->flags
& P_NUM
)
10309 if (wc_use_keyname(varp
, &wc
))
10310 STRCPY(NameBuff
, get_special_key_name((int)wc
, 0));
10312 STRCPY(NameBuff
, transchar((int)wc
));
10314 sprintf((char *)NameBuff
, "%ld", *(long *)varp
);
10316 else /* P_STRING */
10318 varp
= *(char_u
**)(varp
);
10319 if (varp
== NULL
) /* just in case */
10322 /* don't show the actual value of 'key', only that it's set */
10323 else if (opp
->var
== (char_u
*)&p_key
&& *varp
)
10324 STRCPY(NameBuff
, "*****");
10326 else if (opp
->flags
& P_EXPAND
)
10327 home_replace(NULL
, varp
, NameBuff
, MAXPATHL
, FALSE
);
10328 /* Translate 'pastetoggle' into special key names */
10329 else if ((char_u
**)opp
->var
== &p_pt
)
10330 str2specialbuf(p_pt
, NameBuff
, MAXPATHL
);
10332 vim_strncpy(NameBuff
, varp
, MAXPATHL
- 1);
10337 * Return TRUE if "varp" points to 'wildchar' or 'wildcharm' and it can be
10338 * printed as a keyname.
10339 * "*wcp" is set to the value of the option if it's 'wildchar' or 'wildcharm'.
10342 wc_use_keyname(varp
, wcp
)
10346 if (((long *)varp
== &p_wc
) || ((long *)varp
== &p_wcm
))
10348 *wcp
= *(long *)varp
;
10349 if (IS_SPECIAL(*wcp
) || find_special_key_in_table((int)*wcp
) >= 0)
10355 #ifdef FEAT_LANGMAP
10357 * Any character has an equivalent 'langmap' character. This is used for
10358 * keyboards that have a special language mode that sends characters above
10359 * 128 (although other characters can be translated too). The "to" field is a
10360 * Vim command character. This avoids having to switch the keyboard back to
10361 * ASCII mode when leaving Insert mode.
10363 * langmap_mapchar[] maps any of 256 chars to an ASCII char used for Vim
10365 * When FEAT_MBYTE is defined langmap_mapga.ga_data is a sorted table of
10366 * langmap_entry_T. This does the same as langmap_mapchar[] for characters >=
10371 * With multi-byte support use growarray for 'langmap' chars >= 256
10379 static garray_T langmap_mapga
;
10380 static void langmap_set_entry
__ARGS((int from
, int to
));
10383 * Search for an entry in "langmap_mapga" for "from". If found set the "to"
10384 * field. If not found insert a new entry at the appropriate location.
10387 langmap_set_entry(from
, to
)
10391 langmap_entry_T
*entries
= (langmap_entry_T
*)(langmap_mapga
.ga_data
);
10393 int b
= langmap_mapga
.ga_len
;
10395 /* Do a binary search for an existing entry. */
10398 int i
= (a
+ b
) / 2;
10399 int d
= entries
[i
].from
- from
;
10403 entries
[i
].to
= to
;
10412 if (ga_grow(&langmap_mapga
, 1) != OK
)
10413 return; /* out of memory */
10415 /* insert new entry at position "a" */
10416 entries
= (langmap_entry_T
*)(langmap_mapga
.ga_data
) + a
;
10417 mch_memmove(entries
+ 1, entries
,
10418 (langmap_mapga
.ga_len
- a
) * sizeof(langmap_entry_T
));
10419 ++langmap_mapga
.ga_len
;
10420 entries
[0].from
= from
;
10421 entries
[0].to
= to
;
10425 * Apply 'langmap' to multi-byte character "c" and return the result.
10428 langmap_adjust_mb(c
)
10431 langmap_entry_T
*entries
= (langmap_entry_T
*)(langmap_mapga
.ga_data
);
10433 int b
= langmap_mapga
.ga_len
;
10437 int i
= (a
+ b
) / 2;
10438 int d
= entries
[i
].from
- c
;
10441 return entries
[i
].to
; /* found matching entry */
10447 return c
; /* no entry found, return "c" unmodified */
10456 for (i
= 0; i
< 256; i
++)
10457 langmap_mapchar
[i
] = i
; /* we init with a one-to-one map */
10459 ga_init2(&langmap_mapga
, sizeof(langmap_entry_T
), 8);
10464 * Called when langmap option is set; the language map can be
10465 * changed at any time!
10475 ga_clear(&langmap_mapga
); /* clear the previous map first */
10477 langmap_init(); /* back to one-to-one map */
10479 for (p
= p_langmap
; p
[0] != NUL
; )
10481 for (p2
= p
; p2
[0] != NUL
&& p2
[0] != ',' && p2
[0] != ';';
10484 if (p2
[0] == '\\' && p2
[1] != NUL
)
10488 ++p2
; /* abcd;ABCD form, p2 points to A */
10490 p2
= NULL
; /* aAbBcCdD form, p2 is NULL */
10493 if (p
[0] == '\\' && p
[1] != NUL
)
10496 from
= (*mb_ptr2char
)(p
);
10506 to
= (*mb_ptr2char
)(p
);
10516 to
= (*mb_ptr2char
)(p2
);
10523 EMSG2(_("E357: 'langmap': Matching character missing for %s"),
10530 langmap_set_entry(from
, to
);
10533 langmap_mapchar
[from
& 255] = to
;
10535 /* Advance to next pair */
10555 EMSG2(_("E358: 'langmap': Extra characters after semicolon: %s"), p
);
10569 * Return TRUE if format option 'x' is in effect.
10570 * Take care of no formatting when 'paste' is set.
10573 has_format_option(x
)
10578 return (vim_strchr(curbuf
->b_p_fo
, x
) != NULL
);
10582 * Return TRUE if "x" is present in 'shortmess' option, or
10583 * 'shortmess' contains 'a' and "x" is present in SHM_A.
10589 return ( vim_strchr(p_shm
, x
) != NULL
10590 || (vim_strchr(p_shm
, 'a') != NULL
10591 && vim_strchr((char_u
*)SHM_A
, x
) != NULL
));
10595 * paste_option_changed() - Called after p_paste was set or reset.
10598 paste_option_changed()
10600 static int old_p_paste
= FALSE
;
10601 static int save_sm
= 0;
10602 #ifdef FEAT_CMDL_INFO
10603 static int save_ru
= 0;
10605 #ifdef FEAT_RIGHTLEFT
10606 static int save_ri
= 0;
10607 static int save_hkmap
= 0;
10614 * Paste switched from off to on.
10615 * Save the current values, so they can be restored later.
10619 /* save options for each buffer */
10620 for (buf
= firstbuf
; buf
!= NULL
; buf
= buf
->b_next
)
10622 buf
->b_p_tw_nopaste
= buf
->b_p_tw
;
10623 buf
->b_p_wm_nopaste
= buf
->b_p_wm
;
10624 buf
->b_p_sts_nopaste
= buf
->b_p_sts
;
10625 buf
->b_p_ai_nopaste
= buf
->b_p_ai
;
10628 /* save global options */
10630 #ifdef FEAT_CMDL_INFO
10633 #ifdef FEAT_RIGHTLEFT
10635 save_hkmap
= p_hkmap
;
10637 /* save global values for local buffer options */
10638 p_tw_nopaste
= p_tw
;
10639 p_wm_nopaste
= p_wm
;
10640 p_sts_nopaste
= p_sts
;
10641 p_ai_nopaste
= p_ai
;
10645 * Always set the option values, also when 'paste' is set when it is
10648 /* set options for each buffer */
10649 for (buf
= firstbuf
; buf
!= NULL
; buf
= buf
->b_next
)
10651 buf
->b_p_tw
= 0; /* textwidth is 0 */
10652 buf
->b_p_wm
= 0; /* wrapmargin is 0 */
10653 buf
->b_p_sts
= 0; /* softtabstop is 0 */
10654 buf
->b_p_ai
= 0; /* no auto-indent */
10657 /* set global options */
10658 p_sm
= 0; /* no showmatch */
10659 #ifdef FEAT_CMDL_INFO
10660 # ifdef FEAT_WINDOWS
10662 status_redraw_all(); /* redraw to remove the ruler */
10664 p_ru
= 0; /* no ruler */
10666 #ifdef FEAT_RIGHTLEFT
10667 p_ri
= 0; /* no reverse insert */
10668 p_hkmap
= 0; /* no Hebrew keyboard */
10670 /* set global values for local buffer options */
10678 * Paste switched from on to off: Restore saved values.
10680 else if (old_p_paste
)
10682 /* restore options for each buffer */
10683 for (buf
= firstbuf
; buf
!= NULL
; buf
= buf
->b_next
)
10685 buf
->b_p_tw
= buf
->b_p_tw_nopaste
;
10686 buf
->b_p_wm
= buf
->b_p_wm_nopaste
;
10687 buf
->b_p_sts
= buf
->b_p_sts_nopaste
;
10688 buf
->b_p_ai
= buf
->b_p_ai_nopaste
;
10691 /* restore global options */
10693 #ifdef FEAT_CMDL_INFO
10694 # ifdef FEAT_WINDOWS
10695 if (p_ru
!= save_ru
)
10696 status_redraw_all(); /* redraw to draw the ruler */
10700 #ifdef FEAT_RIGHTLEFT
10702 p_hkmap
= save_hkmap
;
10704 /* set global values for local buffer options */
10705 p_tw
= p_tw_nopaste
;
10706 p_wm
= p_wm_nopaste
;
10707 p_sts
= p_sts_nopaste
;
10708 p_ai
= p_ai_nopaste
;
10711 old_p_paste
= p_paste
;
10715 * vimrc_found() - Called when a ".vimrc" or "VIMINIT" has been found.
10717 * Reset 'compatible' and set the values for options that didn't get set yet
10718 * to the Vim defaults.
10719 * Don't do this if the 'compatible' option has been set or reset before.
10720 * When "fname" is not NULL, use it to set $"envname" when it wasn't set yet.
10723 vimrc_found(fname
, envname
)
10728 int dofree
= FALSE
;
10731 if (!option_was_set((char_u
*)"cp"))
10734 for (opt_idx
= 0; !istermoption(&options
[opt_idx
]); opt_idx
++)
10735 if (!(options
[opt_idx
].flags
& (P_WAS_SET
|P_VI_DEF
)))
10736 set_option_default(opt_idx
, OPT_FREE
, FALSE
);
10742 p
= vim_getenv(envname
, &dofree
);
10745 /* Set $MYVIMRC to the first vimrc file found. */
10746 p
= FullName_save(fname
, FALSE
);
10749 vim_setenv(envname
, p
);
10759 * Set 'compatible' on or off. Called for "-C" and "-N" command line arg.
10762 change_compatible(on
)
10772 opt_idx
= findoption((char_u
*)"cp");
10774 options
[opt_idx
].flags
|= P_WAS_SET
;
10778 * Return TRUE when option "name" has been set.
10781 option_was_set(name
)
10786 idx
= findoption(name
);
10787 if (idx
< 0) /* unknown option */
10789 if (options
[idx
].flags
& P_WAS_SET
)
10795 * compatible_set() - Called when 'compatible' has been set or unset.
10797 * When 'compatible' set: Set all relevant options (those that have the P_VIM)
10798 * flag) to a Vi compatible value.
10799 * When 'compatible' is unset: Set all options that have a different default
10800 * for Vim (without the P_VI_DEF flag) to that default.
10807 for (opt_idx
= 0; !istermoption(&options
[opt_idx
]); opt_idx
++)
10808 if ( ((options
[opt_idx
].flags
& P_VIM
) && p_cp
)
10809 || (!(options
[opt_idx
].flags
& P_VI_DEF
) && !p_cp
))
10810 set_option_default(opt_idx
, OPT_FREE
, p_cp
);
10814 #ifdef FEAT_LINEBREAK
10816 # if defined(__BORLANDC__) && (__BORLANDC__ < 0x500)
10817 /* Borland C++ screws up loop optimisation here (negri) */
10818 #pragma option -O-l
10822 * fill_breakat_flags() -- called when 'breakat' changes value.
10825 fill_breakat_flags()
10830 for (i
= 0; i
< 256; i
++)
10831 breakat_flags
[i
] = FALSE
;
10833 if (p_breakat
!= NULL
)
10834 for (p
= p_breakat
; *p
; p
++)
10835 breakat_flags
[*p
] = TRUE
;
10838 # if defined(__BORLANDC__) && (__BORLANDC__ < 0x500)
10839 #pragma option -O.l
10845 * Check an option that can be a range of string values.
10847 * Return OK for correct value, FAIL otherwise.
10848 * Empty is always OK.
10851 check_opt_strings(val
, values
, list
)
10854 int list
; /* when TRUE: accept a list of values */
10856 return opt_strings_flags(val
, values
, NULL
, list
);
10860 * Handle an option that can be a range of string values.
10861 * Set a flag in "*flagp" for each string present.
10863 * Return OK for correct value, FAIL otherwise.
10864 * Empty is always OK.
10867 opt_strings_flags(val
, values
, flagp
, list
)
10868 char_u
*val
; /* new value */
10869 char **values
; /* array of valid string values */
10871 int list
; /* when TRUE: accept a list of values */
10875 unsigned new_flags
= 0;
10881 if (values
[i
] == NULL
) /* val not found in values[] */
10884 len
= (int)STRLEN(values
[i
]);
10885 if (STRNCMP(values
[i
], val
, len
) == 0
10886 && ((list
&& val
[len
] == ',') || val
[len
] == NUL
))
10888 val
+= len
+ (val
[len
] == ',');
10889 new_flags
|= (1 << i
);
10890 break; /* check next item in val list */
10895 *flagp
= new_flags
;
10901 * Read the 'wildmode' option, fill wim_flags[].
10906 char_u new_wim_flags
[4];
10911 for (i
= 0; i
< 4; ++i
)
10912 new_wim_flags
[i
] = 0;
10914 for (p
= p_wim
; *p
; ++p
)
10916 for (i
= 0; ASCII_ISALPHA(p
[i
]); ++i
)
10918 if (p
[i
] != NUL
&& p
[i
] != ',' && p
[i
] != ':')
10920 if (i
== 7 && STRNCMP(p
, "longest", 7) == 0)
10921 new_wim_flags
[idx
] |= WIM_LONGEST
;
10922 else if (i
== 4 && STRNCMP(p
, "full", 4) == 0)
10923 new_wim_flags
[idx
] |= WIM_FULL
;
10924 else if (i
== 4 && STRNCMP(p
, "list", 4) == 0)
10925 new_wim_flags
[idx
] |= WIM_LIST
;
10939 /* fill remaining entries with last flag */
10942 new_wim_flags
[idx
+ 1] = new_wim_flags
[idx
];
10946 /* only when there are no errors, wim_flags[] is changed */
10947 for (i
= 0; i
< 4; ++i
)
10948 wim_flags
[i
] = new_wim_flags
[i
];
10953 * Check if backspacing over something is allowed.
10957 int what
; /* BS_INDENT, BS_EOL or BS_START */
10961 case '2': return TRUE
;
10962 case '1': return (what
!= BS_START
);
10963 case '0': return FALSE
;
10965 return vim_strchr(p_bs
, what
) != NULL
;
10969 * Save the current values of 'fileformat' and 'fileencoding', so that we know
10970 * the file must be considered changed when the value is different.
10976 buf
->b_start_ffc
= *buf
->b_p_ff
;
10977 buf
->b_start_eol
= buf
->b_p_eol
;
10979 buf
->b_start_bomb
= buf
->b_p_bomb
;
10981 /* Only use free/alloc when necessary, they take time. */
10982 if (buf
->b_start_fenc
== NULL
10983 || STRCMP(buf
->b_start_fenc
, buf
->b_p_fenc
) != 0)
10985 vim_free(buf
->b_start_fenc
);
10986 buf
->b_start_fenc
= vim_strsave(buf
->b_p_fenc
);
10992 * Return TRUE if 'fileformat' and/or 'fileencoding' has a different value
10993 * from when editing started (save_file_ff() called).
10994 * Also when 'endofline' was changed and 'binary' is set, or when 'bomb' was
10995 * changed and 'binary' is not set.
10996 * Don't consider a new, empty buffer to be changed.
10999 file_ff_differs(buf
)
11002 /* In a buffer that was never loaded the options are not valid. */
11003 if (buf
->b_flags
& BF_NEVERLOADED
)
11005 if ((buf
->b_flags
& BF_NEW
)
11006 && buf
->b_ml
.ml_line_count
== 1
11007 && *ml_get_buf(buf
, (linenr_T
)1, FALSE
) == NUL
)
11009 if (buf
->b_start_ffc
!= *buf
->b_p_ff
)
11011 if (buf
->b_p_bin
&& buf
->b_start_eol
!= buf
->b_p_eol
)
11014 if (!buf
->b_p_bin
&& buf
->b_start_bomb
!= buf
->b_p_bomb
)
11016 if (buf
->b_start_fenc
== NULL
)
11017 return (*buf
->b_p_fenc
!= NUL
);
11018 return (STRCMP(buf
->b_start_fenc
, buf
->b_p_fenc
) != 0);
11025 * return OK if "p" is a valid fileformat name, FAIL otherwise.
11031 return check_opt_strings(p
, p_ff_values
, FALSE
);
11034 #ifdef FEAT_FULLSCREEN
11036 * Read the 'fuoptions' option, set fuoptions_flags and
11037 * fuoptions_bgcolor.
11040 check_fuoptions(p_fuoptions
, flags
, bgcolor
)
11041 char_u
*p_fuoptions
; /* fuoptions string */
11042 unsigned *flags
; /* fuoptions flags */
11043 int *bgcolor
; /* background highlight group id */
11045 unsigned new_fuoptions_flags
;
11046 int new_fuoptions_bgcolor
;
11048 char_u hg_term
; /* character terminating
11049 highlight group string in
11050 'background' option' */
11053 new_fuoptions_flags
= 0;
11054 new_fuoptions_bgcolor
= 0xFF000000;
11056 for (p
= p_fuoptions
; *p
; ++p
)
11058 for (i
= 0; ASCII_ISALPHA(p
[i
]); ++i
)
11060 if (p
[i
] != NUL
&& p
[i
] != ',' && p
[i
] != ':')
11062 if (i
== 10 && STRNCMP(p
, "background", 10) == 0)
11064 if (p
[i
] != ':') return FAIL
;
11066 if (p
[i
] == NUL
) return FAIL
;
11069 /* explicit color (#aarrggbb) */
11071 for (j
= i
; j
< i
+8 && vim_isxdigit(p
[j
]); ++j
)
11074 return FAIL
; /* less than 8 digits */
11075 if (p
[j
] != NUL
&& p
[j
] != ',')
11077 new_fuoptions_bgcolor
= 0;
11078 for (k
= 0; k
< 8; k
++)
11079 new_fuoptions_bgcolor
= new_fuoptions_bgcolor
* 16 +
11082 /* mark bgcolor as an explicit argb color */
11083 new_fuoptions_flags
&= ~FUOPT_BGCOLOR_HLGROUP
;
11087 /* highlight group name */
11088 for (j
= i
; ASCII_ISALPHA(p
[j
]); ++j
)
11090 if (p
[j
] != NUL
&& p
[j
] != ',')
11093 p
[j
] = NUL
; /* temporarily terminate string */
11094 new_fuoptions_bgcolor
= syn_name2id((char_u
*)(p
+i
));
11095 p
[j
] = hg_term
; /* restore string */
11096 if (! new_fuoptions_bgcolor
)
11099 /* mark bgcolor as highlight group id */
11100 new_fuoptions_flags
|= FUOPT_BGCOLOR_HLGROUP
;
11103 else if (i
== 7 && STRNCMP(p
, "maxhorz", 7) == 0)
11104 new_fuoptions_flags
|= FUOPT_MAXHORZ
;
11105 else if (i
== 7 && STRNCMP(p
, "maxvert", 7) == 0)
11106 new_fuoptions_flags
|= FUOPT_MAXVERT
;
11116 *flags
= new_fuoptions_flags
;
11117 *bgcolor
= new_fuoptions_bgcolor
;
11119 /* Let the GUI know, in case the background color has changed. */
11120 gui_mch_fuopt_update();