1 /* vi:set ts=8 sts=4 sw=4:
3 * VIM - Vi IMproved by Bram Moolenaar
5 * Do ":help uganda" in Vim to read copying and usage conditions.
6 * Do ":help credits" in Vim to see a list of people who contributed.
7 * See README.txt for an overview of the Vim source code.
11 * Code to handle user-settable options. This is all pretty much table-
12 * driven. Checklist for adding a new option:
13 * - Put it in the options array below (copy an existing entry).
14 * - For a global option: Add a variable for it in option.h.
15 * - For a buffer or window local option:
16 * - Add a PV_XX entry to the enum below.
17 * - Add a variable to the window or buffer struct in structs.h.
18 * - For a window option, add some code to copy_winopt().
19 * - For a buffer option, add some code to buf_copy_options().
20 * - For a buffer string option, add code to check_buf_options().
21 * - If it's a numeric option, add any necessary bounds checks to do_set().
22 * - If it's a list of flags, add some code in do_set(), search for WW_ALL.
23 * - When adding an option with expansion (P_EXPAND), but with a different
24 * default for Vi and Vim (no P_VI_DEF), add some code at VIMEXP.
25 * - Add documentation! One line in doc/help.txt, full description in
26 * options.txt, and any other related places.
27 * - Add an entry in runtime/optwin.vim.
28 * When making changes:
29 * - Adjust the help for the option in doc/option.txt.
30 * - When an entry has the P_VIM flag, or is lacking the P_VI_DEF flag, add a
31 * comment at the help for the 'compatible' option.
38 * The options that are local to a window or buffer have "indir" set to one of
39 * these values. Special values:
40 * PV_NONE: global option.
41 * PV_WIN is added: window-local option
42 * PV_BUF is added: buffer-local option
43 * PV_BOTH is added: global option which also has a local value.
45 #define PV_BOTH 0x1000
48 #define PV_MASK 0x0fff
49 #define OPT_WIN(x) (idopt_T)(PV_WIN + (int)(x))
50 #define OPT_BUF(x) (idopt_T)(PV_BUF + (int)(x))
51 #define OPT_BOTH(x) (idopt_T)(PV_BOTH + (int)(x))
54 * Definition of the PV_ values for buffer-local options.
55 * The BV_ values are defined in option.h.
57 #define PV_AI OPT_BUF(BV_AI)
58 #define PV_AR OPT_BOTH(OPT_BUF(BV_AR))
60 # define PV_BH OPT_BUF(BV_BH)
61 # define PV_BT OPT_BUF(BV_BT)
62 # define PV_EFM OPT_BOTH(OPT_BUF(BV_EFM))
63 # define PV_GP OPT_BOTH(OPT_BUF(BV_GP))
64 # define PV_MP OPT_BOTH(OPT_BUF(BV_MP))
66 #define PV_BIN OPT_BUF(BV_BIN)
67 #define PV_BL OPT_BUF(BV_BL)
69 # define PV_BOMB OPT_BUF(BV_BOMB)
71 #define PV_CI OPT_BUF(BV_CI)
73 # define PV_CIN OPT_BUF(BV_CIN)
74 # define PV_CINK OPT_BUF(BV_CINK)
75 # define PV_CINO OPT_BUF(BV_CINO)
77 #if defined(FEAT_SMARTINDENT) || defined(FEAT_CINDENT)
78 # define PV_CINW OPT_BUF(BV_CINW)
81 # define PV_CMS OPT_BUF(BV_CMS)
84 # define PV_COM OPT_BUF(BV_COM)
86 #ifdef FEAT_INS_EXPAND
87 # define PV_CPT OPT_BUF(BV_CPT)
88 # define PV_DICT OPT_BOTH(OPT_BUF(BV_DICT))
89 # define PV_TSR OPT_BOTH(OPT_BUF(BV_TSR))
91 #ifdef FEAT_COMPL_FUNC
92 # define PV_CFU OPT_BUF(BV_CFU)
95 # define PV_DEF OPT_BOTH(OPT_BUF(BV_DEF))
96 # define PV_INC OPT_BOTH(OPT_BUF(BV_INC))
98 #define PV_EOL OPT_BUF(BV_EOL)
99 #define PV_EP OPT_BOTH(OPT_BUF(BV_EP))
100 #define PV_ET OPT_BUF(BV_ET)
102 # define PV_FENC OPT_BUF(BV_FENC)
104 #if defined(FEAT_BEVAL) && defined(FEAT_EVAL)
105 # define PV_BEXPR OPT_BOTH(OPT_BUF(BV_BEXPR))
108 # define PV_FEX OPT_BUF(BV_FEX)
110 #define PV_FF OPT_BUF(BV_FF)
111 #define PV_FLP OPT_BUF(BV_FLP)
112 #define PV_FO OPT_BUF(BV_FO)
114 # define PV_FT OPT_BUF(BV_FT)
116 #define PV_IMI OPT_BUF(BV_IMI)
117 #define PV_IMS OPT_BUF(BV_IMS)
118 #if defined(FEAT_CINDENT) && defined(FEAT_EVAL)
119 # define PV_INDE OPT_BUF(BV_INDE)
120 # define PV_INDK OPT_BUF(BV_INDK)
122 #if defined(FEAT_FIND_ID) && defined(FEAT_EVAL)
123 # define PV_INEX OPT_BUF(BV_INEX)
125 #define PV_INF OPT_BUF(BV_INF)
126 #define PV_ISK OPT_BUF(BV_ISK)
128 # define PV_KEY OPT_BUF(BV_KEY)
131 # define PV_KMAP OPT_BUF(BV_KMAP)
133 #define PV_KP OPT_BOTH(OPT_BUF(BV_KP))
135 # define PV_LISP OPT_BUF(BV_LISP)
137 #define PV_MA OPT_BUF(BV_MA)
138 #define PV_ML OPT_BUF(BV_ML)
139 #define PV_MOD OPT_BUF(BV_MOD)
140 #define PV_MPS OPT_BUF(BV_MPS)
141 #define PV_NF OPT_BUF(BV_NF)
142 #ifdef FEAT_OSFILETYPE
143 # define PV_OFT OPT_BUF(BV_OFT)
145 #ifdef FEAT_COMPL_FUNC
146 # define PV_OFU OPT_BUF(BV_OFU)
148 #define PV_PATH OPT_BOTH(OPT_BUF(BV_PATH))
149 #define PV_PI OPT_BUF(BV_PI)
151 # define PV_QE OPT_BUF(BV_QE)
153 #define PV_RO OPT_BUF(BV_RO)
154 #ifdef FEAT_SMARTINDENT
155 # define PV_SI OPT_BUF(BV_SI)
158 # define PV_SN OPT_BUF(BV_SN)
161 # define PV_SMC OPT_BUF(BV_SMC)
162 # define PV_SYN OPT_BUF(BV_SYN)
165 # define PV_SPC OPT_BUF(BV_SPC)
166 # define PV_SPF OPT_BUF(BV_SPF)
167 # define PV_SPL OPT_BUF(BV_SPL)
169 #define PV_STS OPT_BUF(BV_STS)
170 #ifdef FEAT_SEARCHPATH
171 # define PV_SUA OPT_BUF(BV_SUA)
173 #define PV_SW OPT_BUF(BV_SW)
174 #define PV_SWF OPT_BUF(BV_SWF)
175 #define PV_TAGS OPT_BOTH(OPT_BUF(BV_TAGS))
176 #define PV_TS OPT_BUF(BV_TS)
177 #define PV_TW OPT_BUF(BV_TW)
178 #define PV_TX OPT_BUF(BV_TX)
179 #ifdef FEAT_PERSISTENT_UNDO
180 #define PV_UDF OPT_BUF(BV_UDF)
182 #define PV_WM OPT_BUF(BV_WM)
184 #define PV_VSTS OPT_BUF(BV_VSTS)
185 #define PV_VTS OPT_BUF(BV_VTS)
189 * Definition of the PV_ values for window-local options.
190 * The WV_ values are defined in option.h.
192 #define PV_LIST OPT_WIN(WV_LIST)
194 # define PV_ARAB OPT_WIN(WV_ARAB)
196 #ifdef FEAT_LINEBREAK
197 # define PV_BRI OPT_WIN(WV_BRI)
198 # define PV_BRIMIN OPT_WIN(WV_BRIMIN)
199 # define PV_BRISHIFT OPT_WIN(WV_BRISHIFT)
202 # define PV_DIFF OPT_WIN(WV_DIFF)
205 # define PV_FDC OPT_WIN(WV_FDC)
206 # define PV_FEN OPT_WIN(WV_FEN)
207 # define PV_FDI OPT_WIN(WV_FDI)
208 # define PV_FDL OPT_WIN(WV_FDL)
209 # define PV_FDM OPT_WIN(WV_FDM)
210 # define PV_FML OPT_WIN(WV_FML)
211 # define PV_FDN OPT_WIN(WV_FDN)
213 # define PV_FDE OPT_WIN(WV_FDE)
214 # define PV_FDT OPT_WIN(WV_FDT)
216 # define PV_FMR OPT_WIN(WV_FMR)
218 #ifdef FEAT_LINEBREAK
219 # define PV_LBR OPT_WIN(WV_LBR)
221 #define PV_NU OPT_WIN(WV_NU)
222 #define PV_RNU OPT_WIN(WV_RNU)
223 #ifdef FEAT_LINEBREAK
224 # define PV_NUW OPT_WIN(WV_NUW)
226 #if defined(FEAT_WINDOWS) && defined(FEAT_QUICKFIX)
227 # define PV_PVW OPT_WIN(WV_PVW)
229 #ifdef FEAT_RIGHTLEFT
230 # define PV_RL OPT_WIN(WV_RL)
231 # define PV_RLC OPT_WIN(WV_RLC)
233 #ifdef FEAT_SCROLLBIND
234 # define PV_SCBIND OPT_WIN(WV_SCBIND)
236 #define PV_SCROLL OPT_WIN(WV_SCROLL)
238 # define PV_SPELL OPT_WIN(WV_SPELL)
241 # define PV_CUC OPT_WIN(WV_CUC)
242 # define PV_CUL OPT_WIN(WV_CUL)
245 # define PV_STL OPT_BOTH(OPT_WIN(WV_STL))
248 # define PV_WFH OPT_WIN(WV_WFH)
250 #ifdef FEAT_VERTSPLIT
251 # define PV_WFW OPT_WIN(WV_WFW)
253 #define PV_WRAP OPT_WIN(WV_WRAP)
256 /* WV_ and BV_ values get typecasted to this for the "indir" field */
260 PV_MAXVAL
= 0xffff /* to avoid warnings for value out of range */
264 * Options local to a window have a value local to a buffer and global to all
265 * buffers. Indicate this by setting "var" to VAR_WIN.
267 #define VAR_WIN ((char_u *)-1)
270 * These are the global values for options which are also local to a buffer.
271 * Only to be used in option.c!
278 #if defined(FEAT_QUICKFIX)
286 static char_u
*p_cink
;
287 static char_u
*p_cino
;
289 #if defined(FEAT_SMARTINDENT) || defined(FEAT_CINDENT)
290 static char_u
*p_cinw
;
293 static char_u
*p_com
;
296 static char_u
*p_cms
;
298 #ifdef FEAT_INS_EXPAND
299 static char_u
*p_cpt
;
301 #ifdef FEAT_COMPL_FUNC
302 static char_u
*p_cfu
;
303 static char_u
*p_ofu
;
308 static char_u
*p_fenc
;
312 static char_u
*p_flp
;
316 static long p_iminsert
;
317 static long p_imsearch
;
318 #if defined(FEAT_FIND_ID) && defined(FEAT_EVAL)
319 static char_u
*p_inex
;
321 #if defined(FEAT_CINDENT) && defined(FEAT_EVAL)
322 static char_u
*p_inde
;
323 static char_u
*p_indk
;
325 #if defined(FEAT_EVAL)
326 static char_u
*p_fex
;
329 static char_u
*p_isk
;
331 static char_u
*p_key
;
339 static char_u
*p_mps
;
341 #ifdef FEAT_OSFILETYPE
342 static char_u
*p_oft
;
349 #ifdef FEAT_SMARTINDENT
356 #if defined(FEAT_SEARCHPATH)
357 static char_u
*p_sua
;
363 static char_u
*p_syn
;
366 static char_u
*p_spc
;
367 static char_u
*p_spf
;
368 static char_u
*p_spl
;
373 #ifdef FEAT_PERSISTENT_UNDO
378 static char_u
*p_vsts
;
379 static char_u
*p_vts
;
382 static char_u
*p_keymap
;
385 /* Saved values for when 'bin' is set. */
386 static int p_et_nobin
;
387 static int p_ml_nobin
;
388 static long p_tw_nobin
;
389 static long p_wm_nobin
;
391 /* Saved values for when 'paste' is set */
392 static long p_tw_nopaste
;
393 static long p_wm_nopaste
;
394 static long p_sts_nopaste
;
395 static int p_ai_nopaste
;
397 static char_u
*p_vsts_nopaste
;
402 char *fullname
; /* full option name */
403 char *shortname
; /* permissible abbreviation */
404 long_u flags
; /* see below */
405 char_u
*var
; /* global option: pointer to variable;
406 * window-local option: VAR_WIN;
407 * buffer-local option: global value */
408 idopt_T indir
; /* global option: PV_NONE;
409 * local option: indirect option index */
410 char_u
*def_val
[2]; /* default values for variable (vi and vim) */
412 scid_T scriptID
; /* script in which the option was last set */
413 # define SCRIPTID_INIT , 0
415 # define SCRIPTID_INIT
419 #define VI_DEFAULT 0 /* def_val[VI_DEFAULT] is Vi default value */
420 #define VIM_DEFAULT 1 /* def_val[VIM_DEFAULT] is Vim default value */
425 #define P_BOOL 0x01 /* the option is boolean */
426 #define P_NUM 0x02 /* the option is numeric */
427 #define P_STRING 0x04 /* the option is a string */
428 #define P_ALLOCED 0x08 /* the string option is in allocated memory,
429 must use free_string_option() when
430 assigning new value. Not set if default is
432 #define P_EXPAND 0x10 /* environment expansion. NOTE: P_EXPAND can
433 never be used for local or hidden options! */
434 #define P_NODEFAULT 0x40 /* don't set to default value */
435 #define P_DEF_ALLOCED 0x80 /* default value is in allocated memory, must
436 use vim_free() when assigning new value */
437 #define P_WAS_SET 0x100 /* option has been set/reset */
438 #define P_NO_MKRC 0x200 /* don't include in :mkvimrc output */
439 #define P_VI_DEF 0x400 /* Use Vi default for Vim */
440 #define P_VIM 0x800 /* Vim option, reset when 'cp' set */
442 /* when option changed, what to display: */
443 #define P_RSTAT 0x1000 /* redraw status lines */
444 #define P_RWIN 0x2000 /* redraw current window */
445 #define P_RBUF 0x4000 /* redraw current buffer */
446 #define P_RALL 0x6000 /* redraw all windows */
447 #define P_RCLR 0x7000 /* clear and redraw all */
449 #define P_COMMA 0x8000 /* comma separated list */
450 #define P_NODUP 0x10000L/* don't allow duplicate strings */
451 #define P_FLAGLIST 0x20000L/* list of single-char flags */
453 #define P_SECURE 0x40000L/* cannot change in modeline or secure mode */
454 #define P_GETTEXT 0x80000L/* expand default value with _() */
455 #define P_NOGLOB 0x100000L/* do not use local value for global vimrc */
456 #define P_NFNAME 0x200000L/* only normal file name chars allowed */
457 #define P_INSECURE 0x400000L/* option was set from a modeline */
458 #define P_PRI_MKRC 0x800000L/* priority for :mkvimrc (setting option has
461 #define ISK_LATIN1 (char_u *)"@,48-57,_,192-255"
463 /* 'isprint' for latin1 is also used for MS-Windows cp1252, where 0x80 is used
464 * for the currency sign. */
465 #if defined(MSDOS) || defined(MSWIN) || defined(OS2)
466 # define ISP_LATIN1 (char_u *)"@,~-255"
468 # define ISP_LATIN1 (char_u *)"@,161-255"
471 /* The 16 bit MS-DOS version is low on space, make the string as short as
472 * possible when compiling with few features. */
473 #if defined(FEAT_DIFF) || defined(FEAT_FOLDING) || defined(FEAT_SPELL) \
474 || defined(FEAT_VERTSPLIT) || defined(FEAT_CLIPBOARD) \
475 || defined(FEAT_INS_EXPAND) || defined(FEAT_SYN_HL)
476 # 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"
478 # 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"
482 * options[] is initialized here.
483 * The order of the options MUST be alphabetic for ":set all" and findoption().
484 * All option names MUST start with a lowercase letter (for findoption()).
485 * Exception: "t_" options are at the end.
486 * The options with a NULL variable are 'hidden': a set command for them is
487 * ignored and they are not printed.
489 static struct vimoption
495 {"aleph", "al", P_NUM
|P_VI_DEF
,
496 #ifdef FEAT_RIGHTLEFT
497 (char_u
*)&p_aleph
, PV_NONE
,
499 (char_u
*)NULL
, PV_NONE
,
502 #if (defined(MSDOS) || defined(WIN3264) || defined(OS2)) && !defined(FEAT_GUI_W32)
507 (char_u
*)0L} SCRIPTID_INIT
},
508 {"antialias", "anti", P_BOOL
|P_VI_DEF
|P_VIM
|P_RCLR
,
509 #if defined(FEAT_GUI) && defined(MACOS_X)
510 (char_u
*)&p_antialias
, PV_NONE
,
511 {(char_u
*)FALSE
, (char_u
*)FALSE
}
513 (char_u
*)NULL
, PV_NONE
,
514 {(char_u
*)FALSE
, (char_u
*)FALSE
}
517 {"arabic", "arab", P_BOOL
|P_VI_DEF
|P_VIM
,
519 (char_u
*)VAR_WIN
, PV_ARAB
,
521 (char_u
*)NULL
, PV_NONE
,
523 {(char_u
*)FALSE
, (char_u
*)0L} SCRIPTID_INIT
},
524 {"arabicshape", "arshape", P_BOOL
|P_VI_DEF
|P_VIM
|P_RCLR
,
526 (char_u
*)&p_arshape
, PV_NONE
,
528 (char_u
*)NULL
, PV_NONE
,
530 {(char_u
*)TRUE
, (char_u
*)0L} SCRIPTID_INIT
},
531 {"allowrevins", "ari", P_BOOL
|P_VI_DEF
|P_VIM
,
532 #ifdef FEAT_RIGHTLEFT
533 (char_u
*)&p_ari
, PV_NONE
,
535 (char_u
*)NULL
, PV_NONE
,
537 {(char_u
*)FALSE
, (char_u
*)0L} SCRIPTID_INIT
},
538 {"altkeymap", "akm", P_BOOL
|P_VI_DEF
,
540 (char_u
*)&p_altkeymap
, PV_NONE
,
542 (char_u
*)NULL
, PV_NONE
,
544 {(char_u
*)FALSE
, (char_u
*)0L} SCRIPTID_INIT
},
545 {"ambiwidth", "ambw", P_STRING
|P_VI_DEF
|P_RCLR
,
546 #if defined(FEAT_MBYTE)
547 (char_u
*)&p_ambw
, PV_NONE
,
548 {(char_u
*)"single", (char_u
*)0L}
550 (char_u
*)NULL
, PV_NONE
,
551 {(char_u
*)0L, (char_u
*)0L}
554 #ifdef FEAT_AUTOCHDIR
555 {"autochdir", "acd", P_BOOL
|P_VI_DEF
,
556 (char_u
*)&p_acd
, PV_NONE
,
557 {(char_u
*)FALSE
, (char_u
*)0L} SCRIPTID_INIT
},
559 {"autoindent", "ai", P_BOOL
|P_VI_DEF
,
560 (char_u
*)&p_ai
, PV_AI
,
561 {(char_u
*)FALSE
, (char_u
*)0L} SCRIPTID_INIT
},
562 {"autoprint", "ap", P_BOOL
|P_VI_DEF
,
563 (char_u
*)NULL
, PV_NONE
,
564 {(char_u
*)FALSE
, (char_u
*)0L} SCRIPTID_INIT
},
565 {"autoread", "ar", P_BOOL
|P_VI_DEF
,
566 (char_u
*)&p_ar
, PV_AR
,
567 {(char_u
*)FALSE
, (char_u
*)0L} SCRIPTID_INIT
},
568 {"autowrite", "aw", P_BOOL
|P_VI_DEF
,
569 (char_u
*)&p_aw
, PV_NONE
,
570 {(char_u
*)FALSE
, (char_u
*)0L} SCRIPTID_INIT
},
571 {"autowriteall","awa", P_BOOL
|P_VI_DEF
,
572 (char_u
*)&p_awa
, PV_NONE
,
573 {(char_u
*)FALSE
, (char_u
*)0L} SCRIPTID_INIT
},
574 {"background", "bg", P_STRING
|P_VI_DEF
|P_RCLR
,
575 (char_u
*)&p_bg
, PV_NONE
,
577 #if (defined(MSDOS) || defined(OS2) || defined(WIN3264)) && !defined(FEAT_GUI)
582 (char_u
*)0L} SCRIPTID_INIT
},
583 {"backspace", "bs", P_STRING
|P_VI_DEF
|P_VIM
|P_COMMA
|P_NODUP
,
584 (char_u
*)&p_bs
, PV_NONE
,
585 {(char_u
*)"", (char_u
*)0L} SCRIPTID_INIT
},
586 {"backup", "bk", P_BOOL
|P_VI_DEF
|P_VIM
,
587 (char_u
*)&p_bk
, PV_NONE
,
588 {(char_u
*)FALSE
, (char_u
*)0L} SCRIPTID_INIT
},
589 {"backupcopy", "bkc", P_STRING
|P_VIM
|P_COMMA
|P_NODUP
,
590 (char_u
*)&p_bkc
, PV_NONE
,
592 {(char_u
*)"yes", (char_u
*)"auto"}
594 {(char_u
*)"auto", (char_u
*)"auto"}
597 {"backupdir", "bdir", P_STRING
|P_EXPAND
|P_VI_DEF
|P_COMMA
|P_NODUP
|P_SECURE
,
598 (char_u
*)&p_bdir
, PV_NONE
,
599 {(char_u
*)DFLT_BDIR
, (char_u
*)0L} SCRIPTID_INIT
},
600 {"backupext", "bex", P_STRING
|P_VI_DEF
|P_NFNAME
,
601 (char_u
*)&p_bex
, PV_NONE
,
608 (char_u
*)0L} SCRIPTID_INIT
},
609 {"backupskip", "bsk", P_STRING
|P_VI_DEF
|P_COMMA
,
611 (char_u
*)&p_bsk
, PV_NONE
,
612 {(char_u
*)"", (char_u
*)0L}
614 (char_u
*)NULL
, PV_NONE
,
615 {(char_u
*)0L, (char_u
*)0L}
619 {"balloondelay","bdlay",P_NUM
|P_VI_DEF
,
620 (char_u
*)&p_bdlay
, PV_NONE
,
621 {(char_u
*)600L, (char_u
*)0L} SCRIPTID_INIT
},
622 {"ballooneval", "beval",P_BOOL
|P_VI_DEF
|P_NO_MKRC
,
623 (char_u
*)&p_beval
, PV_NONE
,
624 {(char_u
*)FALSE
, (char_u
*)0L} SCRIPTID_INIT
},
626 {"balloonexpr", "bexpr", P_STRING
|P_ALLOCED
|P_VI_DEF
|P_VIM
,
627 (char_u
*)&p_bexpr
, PV_BEXPR
,
628 {(char_u
*)"", (char_u
*)0L} SCRIPTID_INIT
},
631 {"beautify", "bf", P_BOOL
|P_VI_DEF
,
632 (char_u
*)NULL
, PV_NONE
,
633 {(char_u
*)FALSE
, (char_u
*)0L} SCRIPTID_INIT
},
634 {"binary", "bin", P_BOOL
|P_VI_DEF
|P_RSTAT
,
635 (char_u
*)&p_bin
, PV_BIN
,
636 {(char_u
*)FALSE
, (char_u
*)0L} SCRIPTID_INIT
},
637 {"bioskey", "biosk",P_BOOL
|P_VI_DEF
,
639 (char_u
*)&p_biosk
, PV_NONE
,
641 (char_u
*)NULL
, PV_NONE
,
643 {(char_u
*)TRUE
, (char_u
*)0L} SCRIPTID_INIT
},
644 {"bomb", NULL
, P_BOOL
|P_NO_MKRC
|P_VI_DEF
|P_RSTAT
,
646 (char_u
*)&p_bomb
, PV_BOMB
,
648 (char_u
*)NULL
, PV_NONE
,
650 {(char_u
*)FALSE
, (char_u
*)0L} SCRIPTID_INIT
},
651 {"breakat", "brk", P_STRING
|P_VI_DEF
|P_RALL
|P_FLAGLIST
,
652 #ifdef FEAT_LINEBREAK
653 (char_u
*)&p_breakat
, PV_NONE
,
654 {(char_u
*)" \t!@*-+;:,./?", (char_u
*)0L}
656 (char_u
*)NULL
, PV_NONE
,
657 {(char_u
*)0L, (char_u
*)0L}
660 {"breakindent", "bri", P_BOOL
|P_VI_DEF
|P_VIM
|P_RWIN
,
661 #ifdef FEAT_LINEBREAK
662 (char_u
*)VAR_WIN
, PV_BRI
,
664 (char_u
*)NULL
, PV_NONE
,
666 {(char_u
*)FALSE
, (char_u
*)0L} SCRIPTID_INIT
},
667 {"breakindentmin", "brimin", P_NUM
|P_VI_DEF
|P_VIM
|P_RWIN
,
668 #ifdef FEAT_LINEBREAK
669 (char_u
*)VAR_WIN
, PV_BRIMIN
,
671 (char_u
*)NULL
, PV_NONE
,
673 {(char_u
*)20L, (char_u
*)20L} SCRIPTID_INIT
},
674 {"breakindentshift", "brishift", P_NUM
|P_VI_DEF
|P_VIM
|P_RWIN
,
675 #ifdef FEAT_LINEBREAK
676 (char_u
*)VAR_WIN
, PV_BRISHIFT
,
678 (char_u
*)NULL
, PV_NONE
,
680 {(char_u
*)0L, (char_u
*)0L} SCRIPTID_INIT
},
681 {"browsedir", "bsdir",P_STRING
|P_VI_DEF
,
683 (char_u
*)&p_bsdir
, PV_NONE
,
684 {(char_u
*)"last", (char_u
*)0L}
686 (char_u
*)NULL
, PV_NONE
,
687 {(char_u
*)0L, (char_u
*)0L}
690 {"bufhidden", "bh", P_STRING
|P_ALLOCED
|P_VI_DEF
|P_NOGLOB
,
691 #if defined(FEAT_QUICKFIX)
692 (char_u
*)&p_bh
, PV_BH
,
693 {(char_u
*)"", (char_u
*)0L}
695 (char_u
*)NULL
, PV_NONE
,
696 {(char_u
*)0L, (char_u
*)0L}
699 {"buflisted", "bl", P_BOOL
|P_VI_DEF
|P_NOGLOB
,
700 (char_u
*)&p_bl
, PV_BL
,
701 {(char_u
*)1L, (char_u
*)0L}
703 {"buftype", "bt", P_STRING
|P_ALLOCED
|P_VI_DEF
|P_NOGLOB
,
704 #if defined(FEAT_QUICKFIX)
705 (char_u
*)&p_bt
, PV_BT
,
706 {(char_u
*)"", (char_u
*)0L}
708 (char_u
*)NULL
, PV_NONE
,
709 {(char_u
*)0L, (char_u
*)0L}
712 {"casemap", "cmp", P_STRING
|P_VI_DEF
|P_COMMA
|P_NODUP
,
714 (char_u
*)&p_cmp
, PV_NONE
,
715 {(char_u
*)"internal,keepascii", (char_u
*)0L}
717 (char_u
*)NULL
, PV_NONE
,
718 {(char_u
*)0L, (char_u
*)0L}
721 {"cdpath", "cd", P_STRING
|P_EXPAND
|P_VI_DEF
|P_COMMA
|P_NODUP
,
722 #ifdef FEAT_SEARCHPATH
723 (char_u
*)&p_cdpath
, PV_NONE
,
724 {(char_u
*)",,", (char_u
*)0L}
726 (char_u
*)NULL
, PV_NONE
,
727 {(char_u
*)0L, (char_u
*)0L}
730 {"cedit", NULL
, P_STRING
,
732 (char_u
*)&p_cedit
, PV_NONE
,
733 {(char_u
*)"", (char_u
*)CTRL_F_STR
}
735 (char_u
*)NULL
, PV_NONE
,
736 {(char_u
*)0L, (char_u
*)0L}
739 {"charconvert", "ccv", P_STRING
|P_VI_DEF
|P_SECURE
,
740 #if defined(FEAT_MBYTE) && defined(FEAT_EVAL)
741 (char_u
*)&p_ccv
, PV_NONE
,
742 {(char_u
*)"", (char_u
*)0L}
744 (char_u
*)NULL
, PV_NONE
,
745 {(char_u
*)0L, (char_u
*)0L}
748 {"cindent", "cin", P_BOOL
|P_VI_DEF
|P_VIM
,
750 (char_u
*)&p_cin
, PV_CIN
,
752 (char_u
*)NULL
, PV_NONE
,
754 {(char_u
*)FALSE
, (char_u
*)0L} SCRIPTID_INIT
},
755 {"cinkeys", "cink", P_STRING
|P_ALLOCED
|P_VI_DEF
|P_COMMA
|P_NODUP
,
757 (char_u
*)&p_cink
, PV_CINK
,
758 {(char_u
*)"0{,0},0),:,0#,!^F,o,O,e", (char_u
*)0L}
760 (char_u
*)NULL
, PV_NONE
,
761 {(char_u
*)0L, (char_u
*)0L}
764 {"cinoptions", "cino", P_STRING
|P_ALLOCED
|P_VI_DEF
|P_COMMA
|P_NODUP
,
766 (char_u
*)&p_cino
, PV_CINO
,
768 (char_u
*)NULL
, PV_NONE
,
770 {(char_u
*)"", (char_u
*)0L} SCRIPTID_INIT
},
771 {"cinwords", "cinw", P_STRING
|P_ALLOCED
|P_VI_DEF
|P_COMMA
|P_NODUP
,
772 #if defined(FEAT_SMARTINDENT) || defined(FEAT_CINDENT)
773 (char_u
*)&p_cinw
, PV_CINW
,
774 {(char_u
*)"if,else,while,do,for,switch",
777 (char_u
*)NULL
, PV_NONE
,
778 {(char_u
*)0L, (char_u
*)0L}
781 {"clipboard", "cb", P_STRING
|P_VI_DEF
|P_COMMA
|P_NODUP
,
782 #ifdef FEAT_CLIPBOARD
783 (char_u
*)&p_cb
, PV_NONE
,
784 # ifdef FEAT_XCLIPBOARD
785 {(char_u
*)"autoselect,exclude:cons\\|linux",
788 {(char_u
*)"", (char_u
*)0L}
791 (char_u
*)NULL
, PV_NONE
,
792 {(char_u
*)"", (char_u
*)0L}
795 {"cmdheight", "ch", P_NUM
|P_VI_DEF
|P_RALL
,
796 (char_u
*)&p_ch
, PV_NONE
,
797 {(char_u
*)1L, (char_u
*)0L} SCRIPTID_INIT
},
798 {"cmdwinheight", "cwh", P_NUM
|P_VI_DEF
,
800 (char_u
*)&p_cwh
, PV_NONE
,
802 (char_u
*)NULL
, PV_NONE
,
804 {(char_u
*)7L, (char_u
*)0L} SCRIPTID_INIT
},
805 {"columns", "co", P_NUM
|P_NODEFAULT
|P_NO_MKRC
|P_VI_DEF
|P_RCLR
,
806 (char_u
*)&Columns
, PV_NONE
,
807 {(char_u
*)80L, (char_u
*)0L} SCRIPTID_INIT
},
808 {"comments", "com", P_STRING
|P_ALLOCED
|P_VI_DEF
|P_COMMA
|P_NODUP
,
810 (char_u
*)&p_com
, PV_COM
,
811 {(char_u
*)"s1:/*,mb:*,ex:*/,://,b:#,:%,:XCOMM,n:>,fb:-",
814 (char_u
*)NULL
, PV_NONE
,
815 {(char_u
*)0L, (char_u
*)0L}
818 {"commentstring", "cms", P_STRING
|P_ALLOCED
|P_VI_DEF
,
820 (char_u
*)&p_cms
, PV_CMS
,
821 {(char_u
*)"/*%s*/", (char_u
*)0L}
823 (char_u
*)NULL
, PV_NONE
,
824 {(char_u
*)0L, (char_u
*)0L}
827 /* P_PRI_MKRC isn't needed here, optval_default()
828 * always returns TRUE for 'compatible' */
829 {"compatible", "cp", P_BOOL
|P_RALL
,
830 (char_u
*)&p_cp
, PV_NONE
,
831 {(char_u
*)TRUE
, (char_u
*)FALSE
} SCRIPTID_INIT
},
832 {"complete", "cpt", P_STRING
|P_ALLOCED
|P_VI_DEF
|P_COMMA
|P_NODUP
,
833 #ifdef FEAT_INS_EXPAND
834 (char_u
*)&p_cpt
, PV_CPT
,
835 {(char_u
*)".,w,b,u,t,i", (char_u
*)0L}
837 (char_u
*)NULL
, PV_NONE
,
838 {(char_u
*)0L, (char_u
*)0L}
841 {"completefunc", "cfu", P_STRING
|P_ALLOCED
|P_VI_DEF
|P_SECURE
,
842 #ifdef FEAT_COMPL_FUNC
843 (char_u
*)&p_cfu
, PV_CFU
,
844 {(char_u
*)"", (char_u
*)0L}
846 (char_u
*)NULL
, PV_NONE
,
847 {(char_u
*)0L, (char_u
*)0L}
850 {"completeopt", "cot", P_STRING
|P_VI_DEF
|P_COMMA
|P_NODUP
,
851 #ifdef FEAT_INS_EXPAND
852 (char_u
*)&p_cot
, PV_NONE
,
853 {(char_u
*)"menu,preview", (char_u
*)0L}
855 (char_u
*)NULL
, PV_NONE
,
856 {(char_u
*)0L, (char_u
*)0L}
859 {"confirm", "cf", P_BOOL
|P_VI_DEF
,
860 #if defined(FEAT_GUI_DIALOG) || defined(FEAT_CON_DIALOG)
861 (char_u
*)&p_confirm
, PV_NONE
,
863 (char_u
*)NULL
, PV_NONE
,
865 {(char_u
*)FALSE
, (char_u
*)0L} SCRIPTID_INIT
},
866 {"conskey", "consk",P_BOOL
|P_VI_DEF
,
868 (char_u
*)&p_consk
, PV_NONE
,
870 (char_u
*)NULL
, PV_NONE
,
872 {(char_u
*)FALSE
, (char_u
*)0L} SCRIPTID_INIT
},
873 {"copyindent", "ci", P_BOOL
|P_VI_DEF
|P_VIM
,
874 (char_u
*)&p_ci
, PV_CI
,
875 {(char_u
*)FALSE
, (char_u
*)0L} SCRIPTID_INIT
},
876 {"cpoptions", "cpo", P_STRING
|P_VIM
|P_RALL
|P_FLAGLIST
,
877 (char_u
*)&p_cpo
, PV_NONE
,
878 {(char_u
*)CPO_VI
, (char_u
*)CPO_VIM
}
880 {"cscopepathcomp", "cspc", P_NUM
|P_VI_DEF
|P_VIM
,
882 (char_u
*)&p_cspc
, PV_NONE
,
884 (char_u
*)NULL
, PV_NONE
,
886 {(char_u
*)0L, (char_u
*)0L} SCRIPTID_INIT
},
887 {"cscopeprg", "csprg", P_STRING
|P_EXPAND
|P_VI_DEF
|P_SECURE
,
889 (char_u
*)&p_csprg
, PV_NONE
,
890 {(char_u
*)"cscope", (char_u
*)0L}
892 (char_u
*)NULL
, PV_NONE
,
893 {(char_u
*)0L, (char_u
*)0L}
896 {"cscopequickfix", "csqf", P_STRING
|P_VI_DEF
|P_COMMA
|P_NODUP
,
897 #if defined(FEAT_CSCOPE) && defined(FEAT_QUICKFIX)
898 (char_u
*)&p_csqf
, PV_NONE
,
899 {(char_u
*)"", (char_u
*)0L}
901 (char_u
*)NULL
, PV_NONE
,
902 {(char_u
*)0L, (char_u
*)0L}
905 {"cscopetag", "cst", P_BOOL
|P_VI_DEF
|P_VIM
,
907 (char_u
*)&p_cst
, PV_NONE
,
909 (char_u
*)NULL
, PV_NONE
,
911 {(char_u
*)0L, (char_u
*)0L} SCRIPTID_INIT
},
912 {"cscopetagorder", "csto", P_NUM
|P_VI_DEF
|P_VIM
,
914 (char_u
*)&p_csto
, PV_NONE
,
916 (char_u
*)NULL
, PV_NONE
,
918 {(char_u
*)0L, (char_u
*)0L} SCRIPTID_INIT
},
919 {"cscopeverbose", "csverb", P_BOOL
|P_VI_DEF
|P_VIM
,
921 (char_u
*)&p_csverbose
, PV_NONE
,
923 (char_u
*)NULL
, PV_NONE
,
925 {(char_u
*)0L, (char_u
*)0L} SCRIPTID_INIT
},
926 {"cursorcolumn", "cuc", P_BOOL
|P_VI_DEF
|P_RWIN
,
928 (char_u
*)VAR_WIN
, PV_CUC
,
930 (char_u
*)NULL
, PV_NONE
,
932 {(char_u
*)FALSE
, (char_u
*)0L} SCRIPTID_INIT
},
933 {"cursorline", "cul", P_BOOL
|P_VI_DEF
|P_RWIN
,
935 (char_u
*)VAR_WIN
, PV_CUL
,
937 (char_u
*)NULL
, PV_NONE
,
939 {(char_u
*)FALSE
, (char_u
*)0L} SCRIPTID_INIT
},
940 {"debug", NULL
, P_STRING
|P_VI_DEF
,
941 (char_u
*)&p_debug
, PV_NONE
,
942 {(char_u
*)"", (char_u
*)0L} SCRIPTID_INIT
},
943 {"define", "def", P_STRING
|P_ALLOCED
|P_VI_DEF
,
945 (char_u
*)&p_def
, PV_DEF
,
946 {(char_u
*)"^\\s*#\\s*define", (char_u
*)0L}
948 (char_u
*)NULL
, PV_NONE
,
949 {(char_u
*)NULL
, (char_u
*)0L}
952 {"delcombine", "deco", P_BOOL
|P_VI_DEF
|P_VIM
,
954 (char_u
*)&p_deco
, PV_NONE
,
956 (char_u
*)NULL
, PV_NONE
,
958 {(char_u
*)FALSE
, (char_u
*)0L} SCRIPTID_INIT
},
959 {"dictionary", "dict", P_STRING
|P_EXPAND
|P_VI_DEF
|P_COMMA
|P_NODUP
,
960 #ifdef FEAT_INS_EXPAND
961 (char_u
*)&p_dict
, PV_DICT
,
963 (char_u
*)NULL
, PV_NONE
,
965 {(char_u
*)"", (char_u
*)0L} SCRIPTID_INIT
},
966 {"diff", NULL
, P_BOOL
|P_VI_DEF
|P_RWIN
|P_NOGLOB
,
968 (char_u
*)VAR_WIN
, PV_DIFF
,
970 (char_u
*)NULL
, PV_NONE
,
972 {(char_u
*)FALSE
, (char_u
*)0L} SCRIPTID_INIT
},
973 {"diffexpr", "dex", P_STRING
|P_VI_DEF
|P_SECURE
,
974 #if defined(FEAT_DIFF) && defined(FEAT_EVAL)
975 (char_u
*)&p_dex
, PV_NONE
,
976 {(char_u
*)"", (char_u
*)0L}
978 (char_u
*)NULL
, PV_NONE
,
979 {(char_u
*)0L, (char_u
*)0L}
982 {"diffopt", "dip", P_STRING
|P_ALLOCED
|P_VI_DEF
|P_RWIN
|P_COMMA
|P_NODUP
,
984 (char_u
*)&p_dip
, PV_NONE
,
985 {(char_u
*)"filler", (char_u
*)NULL
}
987 (char_u
*)NULL
, PV_NONE
,
988 {(char_u
*)"", (char_u
*)NULL
}
991 {"digraph", "dg", P_BOOL
|P_VI_DEF
|P_VIM
,
993 (char_u
*)&p_dg
, PV_NONE
,
995 (char_u
*)NULL
, PV_NONE
,
997 {(char_u
*)FALSE
, (char_u
*)0L} SCRIPTID_INIT
},
998 {"directory", "dir", P_STRING
|P_EXPAND
|P_VI_DEF
|P_COMMA
|P_NODUP
|P_SECURE
,
999 (char_u
*)&p_dir
, PV_NONE
,
1000 {(char_u
*)DFLT_DIR
, (char_u
*)0L} SCRIPTID_INIT
},
1001 {"display", "dy", P_STRING
|P_VI_DEF
|P_COMMA
|P_RALL
|P_NODUP
,
1002 (char_u
*)&p_dy
, PV_NONE
,
1003 {(char_u
*)"", (char_u
*)0L} SCRIPTID_INIT
},
1004 {"eadirection", "ead", P_STRING
|P_VI_DEF
,
1005 #ifdef FEAT_VERTSPLIT
1006 (char_u
*)&p_ead
, PV_NONE
,
1007 {(char_u
*)"both", (char_u
*)0L}
1009 (char_u
*)NULL
, PV_NONE
,
1010 {(char_u
*)NULL
, (char_u
*)0L}
1013 {"edcompatible","ed", P_BOOL
|P_VI_DEF
,
1014 (char_u
*)&p_ed
, PV_NONE
,
1015 {(char_u
*)FALSE
, (char_u
*)0L} SCRIPTID_INIT
},
1016 {"encoding", "enc", P_STRING
|P_VI_DEF
|P_RCLR
,
1018 (char_u
*)&p_enc
, PV_NONE
,
1019 {(char_u
*)ENC_DFLT
, (char_u
*)0L}
1021 (char_u
*)NULL
, PV_NONE
,
1022 {(char_u
*)0L, (char_u
*)0L}
1025 {"endofline", "eol", P_BOOL
|P_NO_MKRC
|P_VI_DEF
|P_RSTAT
,
1026 (char_u
*)&p_eol
, PV_EOL
,
1027 {(char_u
*)TRUE
, (char_u
*)0L} SCRIPTID_INIT
},
1028 {"equalalways", "ea", P_BOOL
|P_VI_DEF
|P_RALL
,
1029 (char_u
*)&p_ea
, PV_NONE
,
1030 {(char_u
*)TRUE
, (char_u
*)0L} SCRIPTID_INIT
},
1031 {"equalprg", "ep", P_STRING
|P_EXPAND
|P_VI_DEF
|P_SECURE
,
1032 (char_u
*)&p_ep
, PV_EP
,
1033 {(char_u
*)"", (char_u
*)0L} SCRIPTID_INIT
},
1034 {"errorbells", "eb", P_BOOL
|P_VI_DEF
,
1035 (char_u
*)&p_eb
, PV_NONE
,
1036 {(char_u
*)FALSE
, (char_u
*)0L} SCRIPTID_INIT
},
1037 {"errorfile", "ef", P_STRING
|P_EXPAND
|P_VI_DEF
|P_SECURE
,
1038 #ifdef FEAT_QUICKFIX
1039 (char_u
*)&p_ef
, PV_NONE
,
1040 {(char_u
*)DFLT_ERRORFILE
, (char_u
*)0L}
1042 (char_u
*)NULL
, PV_NONE
,
1043 {(char_u
*)NULL
, (char_u
*)0L}
1046 {"errorformat", "efm", P_STRING
|P_VI_DEF
|P_COMMA
|P_NODUP
,
1047 #ifdef FEAT_QUICKFIX
1048 (char_u
*)&p_efm
, PV_EFM
,
1049 {(char_u
*)DFLT_EFM
, (char_u
*)0L}
1051 (char_u
*)NULL
, PV_NONE
,
1052 {(char_u
*)NULL
, (char_u
*)0L}
1055 {"esckeys", "ek", P_BOOL
|P_VIM
,
1056 (char_u
*)&p_ek
, PV_NONE
,
1057 {(char_u
*)FALSE
, (char_u
*)TRUE
} SCRIPTID_INIT
},
1058 {"eventignore", "ei", P_STRING
|P_VI_DEF
|P_COMMA
|P_NODUP
,
1060 (char_u
*)&p_ei
, PV_NONE
,
1062 (char_u
*)NULL
, PV_NONE
,
1064 {(char_u
*)"", (char_u
*)0L} SCRIPTID_INIT
},
1065 {"expandtab", "et", P_BOOL
|P_VI_DEF
|P_VIM
,
1066 (char_u
*)&p_et
, PV_ET
,
1067 {(char_u
*)FALSE
, (char_u
*)0L} SCRIPTID_INIT
},
1068 {"exrc", "ex", P_BOOL
|P_VI_DEF
|P_SECURE
,
1069 (char_u
*)&p_exrc
, PV_NONE
,
1070 {(char_u
*)FALSE
, (char_u
*)0L} SCRIPTID_INIT
},
1071 {"fileencoding","fenc", P_STRING
|P_ALLOCED
|P_VI_DEF
|P_RSTAT
|P_RBUF
|P_NO_MKRC
,
1073 (char_u
*)&p_fenc
, PV_FENC
,
1074 {(char_u
*)"", (char_u
*)0L}
1076 (char_u
*)NULL
, PV_NONE
,
1077 {(char_u
*)0L, (char_u
*)0L}
1080 {"fileencodings","fencs", P_STRING
|P_VI_DEF
|P_COMMA
,
1082 (char_u
*)&p_fencs
, PV_NONE
,
1083 {(char_u
*)"ucs-bom", (char_u
*)0L}
1085 (char_u
*)NULL
, PV_NONE
,
1086 {(char_u
*)0L, (char_u
*)0L}
1089 {"fileformat", "ff", P_STRING
|P_ALLOCED
|P_VI_DEF
|P_RSTAT
|P_NO_MKRC
,
1090 (char_u
*)&p_ff
, PV_FF
,
1091 {(char_u
*)DFLT_FF
, (char_u
*)0L} SCRIPTID_INIT
},
1092 {"fileformats", "ffs", P_STRING
|P_VIM
|P_COMMA
|P_NODUP
,
1093 (char_u
*)&p_ffs
, PV_NONE
,
1094 {(char_u
*)DFLT_FFS_VI
, (char_u
*)DFLT_FFS_VIM
}
1096 {"filetype", "ft", P_STRING
|P_ALLOCED
|P_VI_DEF
|P_NOGLOB
|P_NFNAME
,
1098 (char_u
*)&p_ft
, PV_FT
,
1099 {(char_u
*)"", (char_u
*)0L}
1101 (char_u
*)NULL
, PV_NONE
,
1102 {(char_u
*)0L, (char_u
*)0L}
1105 {"fillchars", "fcs", P_STRING
|P_VI_DEF
|P_RALL
|P_COMMA
|P_NODUP
,
1106 #if defined(FEAT_WINDOWS) || defined(FEAT_FOLDING)
1107 (char_u
*)&p_fcs
, PV_NONE
,
1108 {(char_u
*)"vert:|,fold:-", (char_u
*)0L}
1110 (char_u
*)NULL
, PV_NONE
,
1111 {(char_u
*)"", (char_u
*)0L}
1114 {"fkmap", "fk", P_BOOL
|P_VI_DEF
,
1116 (char_u
*)&p_fkmap
, PV_NONE
,
1118 (char_u
*)NULL
, PV_NONE
,
1120 {(char_u
*)FALSE
, (char_u
*)0L} SCRIPTID_INIT
},
1121 {"flash", "fl", P_BOOL
|P_VI_DEF
,
1122 (char_u
*)NULL
, PV_NONE
,
1123 {(char_u
*)FALSE
, (char_u
*)0L} SCRIPTID_INIT
},
1125 {"foldclose", "fcl", P_STRING
|P_VI_DEF
|P_COMMA
|P_NODUP
|P_RWIN
,
1126 (char_u
*)&p_fcl
, PV_NONE
,
1127 {(char_u
*)"", (char_u
*)0L} SCRIPTID_INIT
},
1128 {"foldcolumn", "fdc", P_NUM
|P_VI_DEF
|P_RWIN
,
1129 (char_u
*)VAR_WIN
, PV_FDC
,
1130 {(char_u
*)FALSE
, (char_u
*)0L} SCRIPTID_INIT
},
1131 {"foldenable", "fen", P_BOOL
|P_VI_DEF
|P_RWIN
,
1132 (char_u
*)VAR_WIN
, PV_FEN
,
1133 {(char_u
*)TRUE
, (char_u
*)0L} SCRIPTID_INIT
},
1134 {"foldexpr", "fde", P_STRING
|P_ALLOCED
|P_VIM
|P_VI_DEF
|P_RWIN
,
1136 (char_u
*)VAR_WIN
, PV_FDE
,
1137 {(char_u
*)"0", (char_u
*)NULL
}
1139 (char_u
*)NULL
, PV_NONE
,
1140 {(char_u
*)NULL
, (char_u
*)0L}
1143 {"foldignore", "fdi", P_STRING
|P_ALLOCED
|P_VIM
|P_VI_DEF
|P_RWIN
,
1144 (char_u
*)VAR_WIN
, PV_FDI
,
1145 {(char_u
*)"#", (char_u
*)NULL
} SCRIPTID_INIT
},
1146 {"foldlevel", "fdl", P_NUM
|P_VI_DEF
|P_RWIN
,
1147 (char_u
*)VAR_WIN
, PV_FDL
,
1148 {(char_u
*)0L, (char_u
*)0L} SCRIPTID_INIT
},
1149 {"foldlevelstart","fdls", P_NUM
|P_VI_DEF
,
1150 (char_u
*)&p_fdls
, PV_NONE
,
1151 {(char_u
*)-1L, (char_u
*)0L} SCRIPTID_INIT
},
1152 {"foldmarker", "fmr", P_STRING
|P_ALLOCED
|P_VIM
|P_VI_DEF
|
1153 P_RWIN
|P_COMMA
|P_NODUP
,
1154 (char_u
*)VAR_WIN
, PV_FMR
,
1155 {(char_u
*)"{{{,}}}", (char_u
*)NULL
}
1157 {"foldmethod", "fdm", P_STRING
|P_ALLOCED
|P_VIM
|P_VI_DEF
|P_RWIN
,
1158 (char_u
*)VAR_WIN
, PV_FDM
,
1159 {(char_u
*)"manual", (char_u
*)NULL
} SCRIPTID_INIT
},
1160 {"foldminlines","fml", P_NUM
|P_VI_DEF
|P_RWIN
,
1161 (char_u
*)VAR_WIN
, PV_FML
,
1162 {(char_u
*)1L, (char_u
*)0L} SCRIPTID_INIT
},
1163 {"foldnestmax", "fdn", P_NUM
|P_VI_DEF
|P_RWIN
,
1164 (char_u
*)VAR_WIN
, PV_FDN
,
1165 {(char_u
*)20L, (char_u
*)0L} SCRIPTID_INIT
},
1166 {"foldopen", "fdo", P_STRING
|P_VI_DEF
|P_COMMA
|P_NODUP
,
1167 (char_u
*)&p_fdo
, PV_NONE
,
1168 {(char_u
*)"block,hor,mark,percent,quickfix,search,tag,undo",
1169 (char_u
*)0L} SCRIPTID_INIT
},
1170 {"foldtext", "fdt", P_STRING
|P_ALLOCED
|P_VIM
|P_VI_DEF
|P_RWIN
,
1172 (char_u
*)VAR_WIN
, PV_FDT
,
1173 {(char_u
*)"foldtext()", (char_u
*)NULL
}
1175 (char_u
*)NULL
, PV_NONE
,
1176 {(char_u
*)NULL
, (char_u
*)0L}
1180 {"formatexpr", "fex", P_STRING
|P_ALLOCED
|P_VI_DEF
|P_VIM
,
1182 (char_u
*)&p_fex
, PV_FEX
,
1183 {(char_u
*)"", (char_u
*)0L}
1185 (char_u
*)NULL
, PV_NONE
,
1186 {(char_u
*)0L, (char_u
*)0L}
1189 {"formatoptions","fo", P_STRING
|P_ALLOCED
|P_VIM
|P_FLAGLIST
,
1190 (char_u
*)&p_fo
, PV_FO
,
1191 {(char_u
*)DFLT_FO_VI
, (char_u
*)DFLT_FO_VIM
}
1193 {"formatlistpat","flp", P_STRING
|P_ALLOCED
|P_VI_DEF
,
1194 (char_u
*)&p_flp
, PV_FLP
,
1195 {(char_u
*)"^\\s*\\d\\+[\\]:.)}\\t ]\\s*",
1196 (char_u
*)0L} SCRIPTID_INIT
},
1197 {"formatprg", "fp", P_STRING
|P_EXPAND
|P_VI_DEF
|P_SECURE
,
1198 (char_u
*)&p_fp
, PV_NONE
,
1199 {(char_u
*)"", (char_u
*)0L} SCRIPTID_INIT
},
1200 {"fsync", "fs", P_BOOL
|P_SECURE
|P_VI_DEF
,
1202 (char_u
*)&p_fs
, PV_NONE
,
1203 {(char_u
*)TRUE
, (char_u
*)0L}
1205 (char_u
*)NULL
, PV_NONE
,
1206 {(char_u
*)FALSE
, (char_u
*)0L}
1209 {"gdefault", "gd", P_BOOL
|P_VI_DEF
|P_VIM
,
1210 (char_u
*)&p_gd
, PV_NONE
,
1211 {(char_u
*)FALSE
, (char_u
*)0L} SCRIPTID_INIT
},
1212 {"graphic", "gr", P_BOOL
|P_VI_DEF
,
1213 (char_u
*)NULL
, PV_NONE
,
1214 {(char_u
*)FALSE
, (char_u
*)0L} SCRIPTID_INIT
},
1215 {"grepformat", "gfm", P_STRING
|P_VI_DEF
|P_COMMA
|P_NODUP
,
1216 #ifdef FEAT_QUICKFIX
1217 (char_u
*)&p_gefm
, PV_NONE
,
1218 {(char_u
*)DFLT_GREPFORMAT
, (char_u
*)0L}
1220 (char_u
*)NULL
, PV_NONE
,
1221 {(char_u
*)NULL
, (char_u
*)0L}
1224 {"grepprg", "gp", P_STRING
|P_EXPAND
|P_VI_DEF
|P_SECURE
,
1225 #ifdef FEAT_QUICKFIX
1226 (char_u
*)&p_gp
, PV_GP
,
1229 /* may be changed to "grep -n" in os_win32.c */
1230 (char_u
*)"findstr /n",
1233 /* Add an extra file name so that grep will always
1234 * insert a file name in the match line. */
1235 (char_u
*)"grep -n $* /dev/null",
1238 (char_u
*)"SEARCH/NUMBERS ",
1240 (char_u
*)"grep -n ",
1246 (char_u
*)NULL
, PV_NONE
,
1247 {(char_u
*)NULL
, (char_u
*)0L}
1250 {"guicursor", "gcr", P_STRING
|P_VI_DEF
|P_COMMA
|P_NODUP
,
1252 (char_u
*)&p_guicursor
, PV_NONE
,
1255 (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",
1256 # else /* MSDOS or Win32 console */
1257 (char_u
*)"n-v-c:block,o:hor50,i-ci:hor15,r-cr:hor30,sm:block",
1261 (char_u
*)NULL
, PV_NONE
,
1262 {(char_u
*)NULL
, (char_u
*)0L}
1265 {"guifont", "gfn", P_STRING
|P_VI_DEF
|P_RCLR
|P_COMMA
|P_NODUP
,
1267 (char_u
*)&p_guifont
, PV_NONE
,
1268 {(char_u
*)"", (char_u
*)0L}
1270 (char_u
*)NULL
, PV_NONE
,
1271 {(char_u
*)NULL
, (char_u
*)0L}
1274 {"guifontset", "gfs", P_STRING
|P_VI_DEF
|P_RCLR
|P_COMMA
,
1275 #if defined(FEAT_GUI) && defined(FEAT_XFONTSET)
1276 (char_u
*)&p_guifontset
, PV_NONE
,
1277 {(char_u
*)"", (char_u
*)0L}
1279 (char_u
*)NULL
, PV_NONE
,
1280 {(char_u
*)NULL
, (char_u
*)0L}
1283 {"guifontwide", "gfw", P_STRING
|P_VI_DEF
|P_RCLR
|P_COMMA
|P_NODUP
,
1284 #if defined(FEAT_GUI) && defined(FEAT_MBYTE)
1285 (char_u
*)&p_guifontwide
, PV_NONE
,
1286 {(char_u
*)"", (char_u
*)0L}
1288 (char_u
*)NULL
, PV_NONE
,
1289 {(char_u
*)NULL
, (char_u
*)0L}
1292 {"guiheadroom", "ghr", P_NUM
|P_VI_DEF
,
1293 #if defined(FEAT_GUI_GTK) || defined(FEAT_GUI_X11)
1294 (char_u
*)&p_ghr
, PV_NONE
,
1296 (char_u
*)NULL
, PV_NONE
,
1298 {(char_u
*)50L, (char_u
*)0L} SCRIPTID_INIT
},
1299 {"guioptions", "go", P_STRING
|P_VI_DEF
|P_RALL
|P_FLAGLIST
,
1300 #if defined(FEAT_GUI)
1301 (char_u
*)&p_go
, PV_NONE
,
1302 # if defined(UNIX) && !defined(MACOS)
1303 {(char_u
*)"aegimrLtT", (char_u
*)0L}
1305 {(char_u
*)"egmrLtT", (char_u
*)0L}
1308 (char_u
*)NULL
, PV_NONE
,
1309 {(char_u
*)NULL
, (char_u
*)0L}
1312 {"guipty", NULL
, P_BOOL
|P_VI_DEF
,
1313 #if defined(FEAT_GUI)
1314 (char_u
*)&p_guipty
, PV_NONE
,
1316 (char_u
*)NULL
, PV_NONE
,
1318 {(char_u
*)TRUE
, (char_u
*)0L} SCRIPTID_INIT
},
1319 {"guitablabel", "gtl", P_STRING
|P_VI_DEF
|P_RWIN
,
1320 #if defined(FEAT_GUI_TABLINE)
1321 (char_u
*)&p_gtl
, PV_NONE
,
1322 {(char_u
*)"", (char_u
*)0L}
1324 (char_u
*)NULL
, PV_NONE
,
1325 {(char_u
*)NULL
, (char_u
*)0L}
1328 {"guitabtooltip", "gtt", P_STRING
|P_VI_DEF
|P_RWIN
,
1329 #if defined(FEAT_GUI_TABLINE)
1330 (char_u
*)&p_gtt
, PV_NONE
,
1331 {(char_u
*)"", (char_u
*)0L}
1333 (char_u
*)NULL
, PV_NONE
,
1334 {(char_u
*)NULL
, (char_u
*)0L}
1337 {"hardtabs", "ht", P_NUM
|P_VI_DEF
,
1338 (char_u
*)NULL
, PV_NONE
,
1339 {(char_u
*)0L, (char_u
*)0L} SCRIPTID_INIT
},
1340 {"helpfile", "hf", P_STRING
|P_EXPAND
|P_VI_DEF
|P_SECURE
,
1341 (char_u
*)&p_hf
, PV_NONE
,
1342 {(char_u
*)DFLT_HELPFILE
, (char_u
*)0L}
1344 {"helpheight", "hh", P_NUM
|P_VI_DEF
,
1346 (char_u
*)&p_hh
, PV_NONE
,
1348 (char_u
*)NULL
, PV_NONE
,
1350 {(char_u
*)20L, (char_u
*)0L} SCRIPTID_INIT
},
1351 {"helplang", "hlg", P_STRING
|P_VI_DEF
|P_COMMA
,
1352 #ifdef FEAT_MULTI_LANG
1353 (char_u
*)&p_hlg
, PV_NONE
,
1354 {(char_u
*)"", (char_u
*)0L}
1356 (char_u
*)NULL
, PV_NONE
,
1357 {(char_u
*)0L, (char_u
*)0L}
1360 {"hidden", "hid", P_BOOL
|P_VI_DEF
,
1361 (char_u
*)&p_hid
, PV_NONE
,
1362 {(char_u
*)FALSE
, (char_u
*)0L} SCRIPTID_INIT
},
1363 {"highlight", "hl", P_STRING
|P_VI_DEF
|P_RCLR
|P_COMMA
|P_NODUP
,
1364 (char_u
*)&p_hl
, PV_NONE
,
1365 {(char_u
*)HIGHLIGHT_INIT
, (char_u
*)0L}
1367 {"history", "hi", P_NUM
|P_VIM
,
1368 (char_u
*)&p_hi
, PV_NONE
,
1369 {(char_u
*)0L, (char_u
*)20L} SCRIPTID_INIT
},
1370 {"hkmap", "hk", P_BOOL
|P_VI_DEF
|P_VIM
,
1371 #ifdef FEAT_RIGHTLEFT
1372 (char_u
*)&p_hkmap
, PV_NONE
,
1374 (char_u
*)NULL
, PV_NONE
,
1376 {(char_u
*)FALSE
, (char_u
*)0L} SCRIPTID_INIT
},
1377 {"hkmapp", "hkp", P_BOOL
|P_VI_DEF
|P_VIM
,
1378 #ifdef FEAT_RIGHTLEFT
1379 (char_u
*)&p_hkmapp
, PV_NONE
,
1381 (char_u
*)NULL
, PV_NONE
,
1383 {(char_u
*)FALSE
, (char_u
*)0L} SCRIPTID_INIT
},
1384 {"hlsearch", "hls", P_BOOL
|P_VI_DEF
|P_VIM
|P_RALL
,
1385 (char_u
*)&p_hls
, PV_NONE
,
1386 {(char_u
*)FALSE
, (char_u
*)0L} SCRIPTID_INIT
},
1387 {"icon", NULL
, P_BOOL
|P_VI_DEF
,
1389 (char_u
*)&p_icon
, PV_NONE
,
1391 (char_u
*)NULL
, PV_NONE
,
1393 {(char_u
*)FALSE
, (char_u
*)0L} SCRIPTID_INIT
},
1394 {"iconstring", NULL
, P_STRING
|P_VI_DEF
,
1396 (char_u
*)&p_iconstring
, PV_NONE
,
1398 (char_u
*)NULL
, PV_NONE
,
1400 {(char_u
*)"", (char_u
*)0L} SCRIPTID_INIT
},
1401 {"ignorecase", "ic", P_BOOL
|P_VI_DEF
,
1402 (char_u
*)&p_ic
, PV_NONE
,
1403 {(char_u
*)FALSE
, (char_u
*)0L} SCRIPTID_INIT
},
1404 {"imactivatekey","imak",P_STRING
|P_VI_DEF
,
1405 #if defined(FEAT_XIM) && defined(FEAT_GUI_GTK)
1406 (char_u
*)&p_imak
, PV_NONE
,
1408 (char_u
*)NULL
, PV_NONE
,
1410 {(char_u
*)"", (char_u
*)0L} SCRIPTID_INIT
},
1411 {"imcmdline", "imc", P_BOOL
|P_VI_DEF
,
1412 #ifdef USE_IM_CONTROL
1413 (char_u
*)&p_imcmdline
, PV_NONE
,
1415 (char_u
*)NULL
, PV_NONE
,
1417 {(char_u
*)FALSE
, (char_u
*)0L} SCRIPTID_INIT
},
1418 {"imdisable", "imd", P_BOOL
|P_VI_DEF
,
1419 #ifdef USE_IM_CONTROL
1420 (char_u
*)&p_imdisable
, PV_NONE
,
1422 (char_u
*)NULL
, PV_NONE
,
1425 {(char_u
*)TRUE
, (char_u
*)0L}
1427 {(char_u
*)FALSE
, (char_u
*)0L}
1430 {"iminsert", "imi", P_NUM
|P_VI_DEF
,
1431 (char_u
*)&p_iminsert
, PV_IMI
,
1433 {(char_u
*)B_IMODE_IM
, (char_u
*)0L}
1435 {(char_u
*)B_IMODE_NONE
, (char_u
*)0L}
1438 {"imsearch", "ims", P_NUM
|P_VI_DEF
,
1439 (char_u
*)&p_imsearch
, PV_IMS
,
1441 {(char_u
*)B_IMODE_IM
, (char_u
*)0L}
1443 {(char_u
*)B_IMODE_NONE
, (char_u
*)0L}
1446 {"include", "inc", P_STRING
|P_ALLOCED
|P_VI_DEF
,
1448 (char_u
*)&p_inc
, PV_INC
,
1449 {(char_u
*)"^\\s*#\\s*include", (char_u
*)0L}
1451 (char_u
*)NULL
, PV_NONE
,
1452 {(char_u
*)0L, (char_u
*)0L}
1455 {"includeexpr", "inex", P_STRING
|P_ALLOCED
|P_VI_DEF
,
1456 #if defined(FEAT_FIND_ID) && defined(FEAT_EVAL)
1457 (char_u
*)&p_inex
, PV_INEX
,
1458 {(char_u
*)"", (char_u
*)0L}
1460 (char_u
*)NULL
, PV_NONE
,
1461 {(char_u
*)0L, (char_u
*)0L}
1464 {"incsearch", "is", P_BOOL
|P_VI_DEF
|P_VIM
,
1465 (char_u
*)&p_is
, PV_NONE
,
1466 {(char_u
*)FALSE
, (char_u
*)0L} SCRIPTID_INIT
},
1467 {"indentexpr", "inde", P_STRING
|P_ALLOCED
|P_VI_DEF
|P_VIM
,
1468 #if defined(FEAT_CINDENT) && defined(FEAT_EVAL)
1469 (char_u
*)&p_inde
, PV_INDE
,
1470 {(char_u
*)"", (char_u
*)0L}
1472 (char_u
*)NULL
, PV_NONE
,
1473 {(char_u
*)0L, (char_u
*)0L}
1476 {"indentkeys", "indk", P_STRING
|P_ALLOCED
|P_VI_DEF
|P_COMMA
|P_NODUP
,
1477 #if defined(FEAT_CINDENT) && defined(FEAT_EVAL)
1478 (char_u
*)&p_indk
, PV_INDK
,
1479 {(char_u
*)"0{,0},:,0#,!^F,o,O,e", (char_u
*)0L}
1481 (char_u
*)NULL
, PV_NONE
,
1482 {(char_u
*)0L, (char_u
*)0L}
1485 {"infercase", "inf", P_BOOL
|P_VI_DEF
,
1486 (char_u
*)&p_inf
, PV_INF
,
1487 {(char_u
*)FALSE
, (char_u
*)0L} SCRIPTID_INIT
},
1488 {"insertmode", "im", P_BOOL
|P_VI_DEF
|P_VIM
,
1489 (char_u
*)&p_im
, PV_NONE
,
1490 {(char_u
*)FALSE
, (char_u
*)0L} SCRIPTID_INIT
},
1491 {"isfname", "isf", P_STRING
|P_VI_DEF
|P_COMMA
|P_NODUP
,
1492 (char_u
*)&p_isf
, PV_NONE
,
1494 #ifdef BACKSLASH_IN_FILENAME
1495 /* Excluded are: & and ^ are special in cmd.exe
1496 * ( and ) are used in text separating fnames */
1497 (char_u
*)"@,48-57,/,\\,.,-,_,+,,,#,$,%,{,},[,],:,@-@,!,~,=",
1500 (char_u
*)"@,48-57,/,.,-,_,+,,,$,:",
1503 (char_u
*)"@,48-57,/,.,-,_,+,,,#,$,%,<,>,[,],:,;,~",
1504 # else /* UNIX et al. */
1506 (char_u
*)"@,240-249,/,.,-,_,+,,,#,$,%,~,=",
1508 (char_u
*)"@,48-57,/,.,-,_,+,,,#,$,%,~,=",
1513 (char_u
*)0L} SCRIPTID_INIT
},
1514 {"isident", "isi", P_STRING
|P_VI_DEF
|P_COMMA
|P_NODUP
,
1515 (char_u
*)&p_isi
, PV_NONE
,
1517 #if defined(MSDOS) || defined(MSWIN) || defined(OS2)
1518 (char_u
*)"@,48-57,_,128-167,224-235",
1521 /* TODO: EBCDIC Check this! @ == isalpha()*/
1522 (char_u
*)"@,240-249,_,66-73,81-89,98-105,"
1523 "112-120,128,140-142,156,158,172,"
1524 "174,186,191,203-207,219-225,235-239,"
1527 (char_u
*)"@,48-57,_,192-255",
1530 (char_u
*)0L} SCRIPTID_INIT
},
1531 {"iskeyword", "isk", P_STRING
|P_ALLOCED
|P_VIM
|P_COMMA
|P_NODUP
,
1532 (char_u
*)&p_isk
, PV_ISK
,
1535 (char_u
*)"@,240-249,_",
1536 /* TODO: EBCDIC Check this! @ == isalpha()*/
1537 (char_u
*)"@,240-249,_,66-73,81-89,98-105,"
1538 "112-120,128,140-142,156,158,172,"
1539 "174,186,191,203-207,219-225,235-239,"
1542 (char_u
*)"@,48-57,_",
1543 # if defined(MSDOS) || defined(MSWIN) || defined(OS2)
1544 (char_u
*)"@,48-57,_,128-167,224-235"
1550 {"isprint", "isp", P_STRING
|P_VI_DEF
|P_RALL
|P_COMMA
|P_NODUP
,
1551 (char_u
*)&p_isp
, PV_NONE
,
1553 #if defined(MSDOS) || defined(MSWIN) || defined(OS2) \
1554 || (defined(MACOS) && !defined(MACOS_X)) \
1556 (char_u
*)"@,~-255",
1559 /* all chars above 63 are printable */
1565 (char_u
*)0L} SCRIPTID_INIT
},
1566 {"joinspaces", "js", P_BOOL
|P_VI_DEF
|P_VIM
,
1567 (char_u
*)&p_js
, PV_NONE
,
1568 {(char_u
*)TRUE
, (char_u
*)0L} SCRIPTID_INIT
},
1569 {"key", NULL
, P_STRING
|P_ALLOCED
|P_VI_DEF
|P_NO_MKRC
,
1571 (char_u
*)&p_key
, PV_KEY
,
1572 {(char_u
*)"", (char_u
*)0L}
1574 (char_u
*)NULL
, PV_NONE
,
1575 {(char_u
*)0L, (char_u
*)0L}
1578 {"keymap", "kmp", P_STRING
|P_ALLOCED
|P_VI_DEF
|P_RBUF
|P_RSTAT
|P_NFNAME
|P_PRI_MKRC
,
1580 (char_u
*)&p_keymap
, PV_KMAP
,
1581 {(char_u
*)"", (char_u
*)0L}
1583 (char_u
*)NULL
, PV_NONE
,
1584 {(char_u
*)"", (char_u
*)0L}
1587 {"keymodel", "km", P_STRING
|P_VI_DEF
|P_COMMA
|P_NODUP
,
1589 (char_u
*)&p_km
, PV_NONE
,
1591 (char_u
*)NULL
, PV_NONE
,
1593 {(char_u
*)"", (char_u
*)0L} SCRIPTID_INIT
},
1594 {"keywordprg", "kp", P_STRING
|P_EXPAND
|P_VI_DEF
|P_SECURE
,
1595 (char_u
*)&p_kp
, PV_KP
,
1597 #if defined(MSDOS) || defined(MSWIN)
1614 (char_u
*)0L} SCRIPTID_INIT
},
1615 {"langmap", "lmap", P_STRING
|P_VI_DEF
|P_COMMA
|P_NODUP
,
1617 (char_u
*)&p_langmap
, PV_NONE
,
1618 {(char_u
*)"", /* unmatched } */
1620 (char_u
*)NULL
, PV_NONE
,
1623 (char_u
*)0L} SCRIPTID_INIT
},
1624 {"langmenu", "lm", P_STRING
|P_VI_DEF
|P_NFNAME
,
1625 #if defined(FEAT_MENU) && defined(FEAT_MULTI_LANG)
1626 (char_u
*)&p_lm
, PV_NONE
,
1628 (char_u
*)NULL
, PV_NONE
,
1630 {(char_u
*)"", (char_u
*)0L} SCRIPTID_INIT
},
1631 {"laststatus", "ls", P_NUM
|P_VI_DEF
|P_RALL
,
1633 (char_u
*)&p_ls
, PV_NONE
,
1635 (char_u
*)NULL
, PV_NONE
,
1637 {(char_u
*)1L, (char_u
*)0L} SCRIPTID_INIT
},
1638 {"lazyredraw", "lz", P_BOOL
|P_VI_DEF
,
1639 (char_u
*)&p_lz
, PV_NONE
,
1640 {(char_u
*)FALSE
, (char_u
*)0L} SCRIPTID_INIT
},
1641 {"linebreak", "lbr", P_BOOL
|P_VI_DEF
|P_RWIN
,
1642 #ifdef FEAT_LINEBREAK
1643 (char_u
*)VAR_WIN
, PV_LBR
,
1645 (char_u
*)NULL
, PV_NONE
,
1647 {(char_u
*)FALSE
, (char_u
*)0L} SCRIPTID_INIT
},
1648 {"lines", NULL
, P_NUM
|P_NODEFAULT
|P_NO_MKRC
|P_VI_DEF
|P_RCLR
,
1649 (char_u
*)&Rows
, PV_NONE
,
1651 #if defined(MSDOS) || defined(WIN3264) || defined(OS2)
1656 (char_u
*)0L} SCRIPTID_INIT
},
1657 {"linespace", "lsp", P_NUM
|P_VI_DEF
|P_RCLR
,
1659 (char_u
*)&p_linespace
, PV_NONE
,
1661 (char_u
*)NULL
, PV_NONE
,
1664 {(char_u
*)1L, (char_u
*)0L}
1666 {(char_u
*)0L, (char_u
*)0L}
1669 {"lisp", NULL
, P_BOOL
|P_VI_DEF
,
1671 (char_u
*)&p_lisp
, PV_LISP
,
1673 (char_u
*)NULL
, PV_NONE
,
1675 {(char_u
*)FALSE
, (char_u
*)0L} SCRIPTID_INIT
},
1676 {"lispwords", "lw", P_STRING
|P_VI_DEF
|P_COMMA
|P_NODUP
,
1678 (char_u
*)&p_lispwords
, PV_NONE
,
1679 {(char_u
*)LISPWORD_VALUE
, (char_u
*)0L}
1681 (char_u
*)NULL
, PV_NONE
,
1682 {(char_u
*)"", (char_u
*)0L}
1685 {"list", NULL
, P_BOOL
|P_VI_DEF
|P_RWIN
,
1686 (char_u
*)VAR_WIN
, PV_LIST
,
1687 {(char_u
*)FALSE
, (char_u
*)0L} SCRIPTID_INIT
},
1688 {"listchars", "lcs", P_STRING
|P_VI_DEF
|P_RALL
|P_COMMA
|P_NODUP
,
1689 (char_u
*)&p_lcs
, PV_NONE
,
1690 {(char_u
*)"eol:$", (char_u
*)0L} SCRIPTID_INIT
},
1691 {"loadplugins", "lpl", P_BOOL
|P_VI_DEF
,
1692 (char_u
*)&p_lpl
, PV_NONE
,
1693 {(char_u
*)TRUE
, (char_u
*)0L} SCRIPTID_INIT
},
1695 {"macatsui", NULL
, P_BOOL
|P_VI_DEF
|P_RCLR
,
1696 (char_u
*)&p_macatsui
, PV_NONE
,
1697 {(char_u
*)TRUE
, (char_u
*)0L} SCRIPTID_INIT
},
1699 {"magic", NULL
, P_BOOL
|P_VI_DEF
,
1700 (char_u
*)&p_magic
, PV_NONE
,
1701 {(char_u
*)TRUE
, (char_u
*)0L} SCRIPTID_INIT
},
1702 {"makeef", "mef", P_STRING
|P_EXPAND
|P_VI_DEF
|P_SECURE
,
1703 #ifdef FEAT_QUICKFIX
1704 (char_u
*)&p_mef
, PV_NONE
,
1705 {(char_u
*)"", (char_u
*)0L}
1707 (char_u
*)NULL
, PV_NONE
,
1708 {(char_u
*)NULL
, (char_u
*)0L}
1711 {"makeprg", "mp", P_STRING
|P_EXPAND
|P_VI_DEF
|P_SECURE
,
1712 #ifdef FEAT_QUICKFIX
1713 (char_u
*)&p_mp
, PV_MP
,
1715 {(char_u
*)"MMS", (char_u
*)0L}
1717 {(char_u
*)"make", (char_u
*)0L}
1720 (char_u
*)NULL
, PV_NONE
,
1721 {(char_u
*)NULL
, (char_u
*)0L}
1724 {"matchpairs", "mps", P_STRING
|P_ALLOCED
|P_VI_DEF
|P_COMMA
|P_NODUP
,
1725 (char_u
*)&p_mps
, PV_MPS
,
1726 {(char_u
*)"(:),{:},[:]", (char_u
*)0L}
1728 {"matchtime", "mat", P_NUM
|P_VI_DEF
,
1729 (char_u
*)&p_mat
, PV_NONE
,
1730 {(char_u
*)5L, (char_u
*)0L} SCRIPTID_INIT
},
1731 {"maxcombine", "mco", P_NUM
|P_VI_DEF
,
1733 (char_u
*)&p_mco
, PV_NONE
,
1735 (char_u
*)NULL
, PV_NONE
,
1737 {(char_u
*)2, (char_u
*)0L} SCRIPTID_INIT
},
1738 {"maxfuncdepth", "mfd", P_NUM
|P_VI_DEF
,
1740 (char_u
*)&p_mfd
, PV_NONE
,
1742 (char_u
*)NULL
, PV_NONE
,
1744 {(char_u
*)100L, (char_u
*)0L} SCRIPTID_INIT
},
1745 {"maxmapdepth", "mmd", P_NUM
|P_VI_DEF
,
1746 (char_u
*)&p_mmd
, PV_NONE
,
1747 {(char_u
*)1000L, (char_u
*)0L} SCRIPTID_INIT
},
1748 {"maxmem", "mm", P_NUM
|P_VI_DEF
,
1749 (char_u
*)&p_mm
, PV_NONE
,
1750 {(char_u
*)DFLT_MAXMEM
, (char_u
*)0L}
1752 {"maxmempattern","mmp", P_NUM
|P_VI_DEF
,
1753 (char_u
*)&p_mmp
, PV_NONE
,
1754 {(char_u
*)1000L, (char_u
*)0L} SCRIPTID_INIT
},
1755 {"maxmemtot", "mmt", P_NUM
|P_VI_DEF
,
1756 (char_u
*)&p_mmt
, PV_NONE
,
1757 {(char_u
*)DFLT_MAXMEMTOT
, (char_u
*)0L}
1759 {"menuitems", "mis", P_NUM
|P_VI_DEF
,
1761 (char_u
*)&p_mis
, PV_NONE
,
1763 (char_u
*)NULL
, PV_NONE
,
1765 {(char_u
*)25L, (char_u
*)0L} SCRIPTID_INIT
},
1766 {"mesg", NULL
, P_BOOL
|P_VI_DEF
,
1767 (char_u
*)NULL
, PV_NONE
,
1768 {(char_u
*)FALSE
, (char_u
*)0L} SCRIPTID_INIT
},
1769 {"mkspellmem", "msm", P_STRING
|P_VI_DEF
|P_EXPAND
|P_SECURE
,
1771 (char_u
*)&p_msm
, PV_NONE
,
1772 {(char_u
*)"460000,2000,500", (char_u
*)0L}
1774 (char_u
*)NULL
, PV_NONE
,
1775 {(char_u
*)0L, (char_u
*)0L}
1778 {"modeline", "ml", P_BOOL
|P_VIM
,
1779 (char_u
*)&p_ml
, PV_ML
,
1780 {(char_u
*)FALSE
, (char_u
*)TRUE
} SCRIPTID_INIT
},
1781 {"modelines", "mls", P_NUM
|P_VI_DEF
,
1782 (char_u
*)&p_mls
, PV_NONE
,
1783 {(char_u
*)5L, (char_u
*)0L} SCRIPTID_INIT
},
1784 {"modifiable", "ma", P_BOOL
|P_VI_DEF
|P_NOGLOB
,
1785 (char_u
*)&p_ma
, PV_MA
,
1786 {(char_u
*)TRUE
, (char_u
*)0L} SCRIPTID_INIT
},
1787 {"modified", "mod", P_BOOL
|P_NO_MKRC
|P_VI_DEF
|P_RSTAT
,
1788 (char_u
*)&p_mod
, PV_MOD
,
1789 {(char_u
*)FALSE
, (char_u
*)0L} SCRIPTID_INIT
},
1790 {"more", NULL
, P_BOOL
|P_VIM
,
1791 (char_u
*)&p_more
, PV_NONE
,
1792 {(char_u
*)FALSE
, (char_u
*)TRUE
} SCRIPTID_INIT
},
1793 {"mouse", NULL
, P_STRING
|P_VI_DEF
|P_FLAGLIST
,
1794 (char_u
*)&p_mouse
, PV_NONE
,
1796 #if defined(MSDOS) || defined(WIN3264)
1801 (char_u
*)0L} SCRIPTID_INIT
},
1802 {"mousefocus", "mousef", P_BOOL
|P_VI_DEF
,
1804 (char_u
*)&p_mousef
, PV_NONE
,
1806 (char_u
*)NULL
, PV_NONE
,
1808 {(char_u
*)FALSE
, (char_u
*)0L} SCRIPTID_INIT
},
1809 {"mousehide", "mh", P_BOOL
|P_VI_DEF
,
1811 (char_u
*)&p_mh
, PV_NONE
,
1813 (char_u
*)NULL
, PV_NONE
,
1815 {(char_u
*)TRUE
, (char_u
*)0L} SCRIPTID_INIT
},
1816 {"mousemodel", "mousem", P_STRING
|P_VI_DEF
,
1817 (char_u
*)&p_mousem
, PV_NONE
,
1819 #if defined(MSDOS) || defined(MSWIN)
1823 (char_u
*)"popup_setpos",
1828 (char_u
*)0L} SCRIPTID_INIT
},
1829 {"mouseshape", "mouses", P_STRING
|P_VI_DEF
|P_COMMA
|P_NODUP
,
1830 #ifdef FEAT_MOUSESHAPE
1831 (char_u
*)&p_mouseshape
, PV_NONE
,
1832 {(char_u
*)"i-r:beam,s:updown,sd:udsizing,vs:leftright,vd:lrsizing,m:no,ml:up-arrow,v:rightup-arrow", (char_u
*)0L}
1834 (char_u
*)NULL
, PV_NONE
,
1835 {(char_u
*)NULL
, (char_u
*)0L}
1838 {"mousetime", "mouset", P_NUM
|P_VI_DEF
,
1839 (char_u
*)&p_mouset
, PV_NONE
,
1840 {(char_u
*)500L, (char_u
*)0L} SCRIPTID_INIT
},
1841 {"mzquantum", "mzq", P_NUM
,
1842 #ifdef FEAT_MZSCHEME
1843 (char_u
*)&p_mzq
, PV_NONE
,
1845 (char_u
*)NULL
, PV_NONE
,
1847 {(char_u
*)100L, (char_u
*)100L} SCRIPTID_INIT
},
1848 {"novice", NULL
, P_BOOL
|P_VI_DEF
,
1849 (char_u
*)NULL
, PV_NONE
,
1850 {(char_u
*)FALSE
, (char_u
*)0L} SCRIPTID_INIT
},
1851 {"nrformats", "nf", P_STRING
|P_ALLOCED
|P_VI_DEF
|P_COMMA
|P_NODUP
,
1852 (char_u
*)&p_nf
, PV_NF
,
1853 {(char_u
*)"octal,hex", (char_u
*)0L}
1855 {"number", "nu", P_BOOL
|P_VI_DEF
|P_RWIN
,
1856 (char_u
*)VAR_WIN
, PV_NU
,
1857 {(char_u
*)FALSE
, (char_u
*)0L} SCRIPTID_INIT
},
1858 {"numberwidth", "nuw", P_NUM
|P_RWIN
|P_VIM
,
1859 #ifdef FEAT_LINEBREAK
1860 (char_u
*)VAR_WIN
, PV_NUW
,
1862 (char_u
*)NULL
, PV_NONE
,
1864 {(char_u
*)8L, (char_u
*)4L} SCRIPTID_INIT
},
1865 {"omnifunc", "ofu", P_STRING
|P_ALLOCED
|P_VI_DEF
|P_SECURE
,
1866 #ifdef FEAT_COMPL_FUNC
1867 (char_u
*)&p_ofu
, PV_OFU
,
1868 {(char_u
*)"", (char_u
*)0L}
1870 (char_u
*)NULL
, PV_NONE
,
1871 {(char_u
*)0L, (char_u
*)0L}
1874 {"open", NULL
, P_BOOL
|P_VI_DEF
,
1875 (char_u
*)NULL
, PV_NONE
,
1876 {(char_u
*)FALSE
, (char_u
*)0L} SCRIPTID_INIT
},
1877 {"opendevice", "odev", P_BOOL
|P_VI_DEF
,
1878 #if defined(MSDOS) || defined(MSWIN) || defined(OS2)
1879 (char_u
*)&p_odev
, PV_NONE
,
1881 (char_u
*)NULL
, PV_NONE
,
1883 {(char_u
*)FALSE
, (char_u
*)FALSE
}
1885 {"operatorfunc", "opfunc", P_STRING
|P_VI_DEF
|P_SECURE
,
1886 (char_u
*)&p_opfunc
, PV_NONE
,
1887 {(char_u
*)"", (char_u
*)0L} SCRIPTID_INIT
},
1888 {"optimize", "opt", P_BOOL
|P_VI_DEF
,
1889 (char_u
*)NULL
, PV_NONE
,
1890 {(char_u
*)FALSE
, (char_u
*)0L} SCRIPTID_INIT
},
1891 {"osfiletype", "oft", P_STRING
|P_ALLOCED
|P_VI_DEF
,
1892 #ifdef FEAT_OSFILETYPE
1893 (char_u
*)&p_oft
, PV_OFT
,
1894 {(char_u
*)DFLT_OFT
, (char_u
*)0L}
1896 (char_u
*)NULL
, PV_NONE
,
1897 {(char_u
*)0L, (char_u
*)0L}
1900 {"paragraphs", "para", P_STRING
|P_VI_DEF
,
1901 (char_u
*)&p_para
, PV_NONE
,
1902 {(char_u
*)"IPLPPPQPP TPHPLIPpLpItpplpipbp",
1903 (char_u
*)0L} SCRIPTID_INIT
},
1904 {"paste", NULL
, P_BOOL
|P_VI_DEF
|P_PRI_MKRC
,
1905 (char_u
*)&p_paste
, PV_NONE
,
1906 {(char_u
*)FALSE
, (char_u
*)0L} SCRIPTID_INIT
},
1907 {"pastetoggle", "pt", P_STRING
|P_VI_DEF
,
1908 (char_u
*)&p_pt
, PV_NONE
,
1909 {(char_u
*)"", (char_u
*)0L} SCRIPTID_INIT
},
1910 {"patchexpr", "pex", P_STRING
|P_VI_DEF
|P_SECURE
,
1911 #if defined(FEAT_DIFF) && defined(FEAT_EVAL)
1912 (char_u
*)&p_pex
, PV_NONE
,
1913 {(char_u
*)"", (char_u
*)0L}
1915 (char_u
*)NULL
, PV_NONE
,
1916 {(char_u
*)0L, (char_u
*)0L}
1919 {"patchmode", "pm", P_STRING
|P_VI_DEF
|P_NFNAME
,
1920 (char_u
*)&p_pm
, PV_NONE
,
1921 {(char_u
*)"", (char_u
*)0L} SCRIPTID_INIT
},
1922 {"path", "pa", P_STRING
|P_EXPAND
|P_VI_DEF
|P_COMMA
|P_NODUP
,
1923 (char_u
*)&p_path
, PV_PATH
,
1925 #if defined AMIGA || defined MSDOS || defined MSWIN
1928 # if defined(__EMX__)
1929 (char_u
*)".,/emx/include,,",
1930 # else /* Unix, probably */
1931 (char_u
*)".,/usr/include,,",
1934 (char_u
*)0L} SCRIPTID_INIT
},
1935 {"preserveindent", "pi", P_BOOL
|P_VI_DEF
|P_VIM
,
1936 (char_u
*)&p_pi
, PV_PI
,
1937 {(char_u
*)FALSE
, (char_u
*)0L} SCRIPTID_INIT
},
1938 {"previewheight", "pvh", P_NUM
|P_VI_DEF
,
1939 #if defined(FEAT_WINDOWS) && defined(FEAT_QUICKFIX)
1940 (char_u
*)&p_pvh
, PV_NONE
,
1942 (char_u
*)NULL
, PV_NONE
,
1944 {(char_u
*)12L, (char_u
*)0L} SCRIPTID_INIT
},
1945 {"previewwindow", "pvw", P_BOOL
|P_VI_DEF
|P_RSTAT
|P_NOGLOB
,
1946 #if defined(FEAT_WINDOWS) && defined(FEAT_QUICKFIX)
1947 (char_u
*)VAR_WIN
, PV_PVW
,
1949 (char_u
*)NULL
, PV_NONE
,
1951 {(char_u
*)FALSE
, (char_u
*)0L} SCRIPTID_INIT
},
1952 {"printdevice", "pdev", P_STRING
|P_VI_DEF
|P_SECURE
,
1954 (char_u
*)&p_pdev
, PV_NONE
,
1955 {(char_u
*)"", (char_u
*)0L}
1957 (char_u
*)NULL
, PV_NONE
,
1958 {(char_u
*)NULL
, (char_u
*)0L}
1961 {"printencoding", "penc", P_STRING
|P_VI_DEF
,
1962 #ifdef FEAT_POSTSCRIPT
1963 (char_u
*)&p_penc
, PV_NONE
,
1964 {(char_u
*)"", (char_u
*)0L}
1966 (char_u
*)NULL
, PV_NONE
,
1967 {(char_u
*)NULL
, (char_u
*)0L}
1970 {"printexpr", "pexpr", P_STRING
|P_VI_DEF
,
1971 #ifdef FEAT_POSTSCRIPT
1972 (char_u
*)&p_pexpr
, PV_NONE
,
1973 {(char_u
*)"", (char_u
*)0L}
1975 (char_u
*)NULL
, PV_NONE
,
1976 {(char_u
*)NULL
, (char_u
*)0L}
1979 {"printfont", "pfn", P_STRING
|P_VI_DEF
,
1981 (char_u
*)&p_pfn
, PV_NONE
,
1984 (char_u
*)"Courier_New:h10",
1986 (char_u
*)"courier",
1990 (char_u
*)NULL
, PV_NONE
,
1991 {(char_u
*)NULL
, (char_u
*)0L}
1994 {"printheader", "pheader", P_STRING
|P_VI_DEF
|P_GETTEXT
,
1996 (char_u
*)&p_header
, PV_NONE
,
1997 {(char_u
*)N_("%<%f%h%m%=Page %N"), (char_u
*)0L}
1999 (char_u
*)NULL
, PV_NONE
,
2000 {(char_u
*)NULL
, (char_u
*)0L}
2003 {"printmbcharset", "pmbcs", P_STRING
|P_VI_DEF
,
2004 #if defined(FEAT_POSTSCRIPT) && defined(FEAT_MBYTE)
2005 (char_u
*)&p_pmcs
, PV_NONE
,
2006 {(char_u
*)"", (char_u
*)0L}
2008 (char_u
*)NULL
, PV_NONE
,
2009 {(char_u
*)NULL
, (char_u
*)0L}
2012 {"printmbfont", "pmbfn", P_STRING
|P_VI_DEF
,
2013 #if defined(FEAT_POSTSCRIPT) && defined(FEAT_MBYTE)
2014 (char_u
*)&p_pmfn
, PV_NONE
,
2015 {(char_u
*)"", (char_u
*)0L}
2017 (char_u
*)NULL
, PV_NONE
,
2018 {(char_u
*)NULL
, (char_u
*)0L}
2021 {"printoptions", "popt", P_STRING
|P_VI_DEF
|P_COMMA
|P_NODUP
,
2023 (char_u
*)&p_popt
, PV_NONE
,
2024 {(char_u
*)"", (char_u
*)0L}
2026 (char_u
*)NULL
, PV_NONE
,
2027 {(char_u
*)NULL
, (char_u
*)0L}
2030 {"prompt", NULL
, P_BOOL
|P_VI_DEF
,
2031 (char_u
*)&p_prompt
, PV_NONE
,
2032 {(char_u
*)TRUE
, (char_u
*)0L} SCRIPTID_INIT
},
2033 {"pumheight", "ph", P_NUM
|P_VI_DEF
,
2034 #ifdef FEAT_INS_EXPAND
2035 (char_u
*)&p_ph
, PV_NONE
,
2037 (char_u
*)NULL
, PV_NONE
,
2039 {(char_u
*)0L, (char_u
*)0L} SCRIPTID_INIT
},
2040 {"quoteescape", "qe", P_STRING
|P_ALLOCED
|P_VI_DEF
,
2042 (char_u
*)&p_qe
, PV_QE
,
2043 {(char_u
*)"\\", (char_u
*)0L}
2045 (char_u
*)NULL
, PV_NONE
,
2046 {(char_u
*)NULL
, (char_u
*)0L}
2049 {"readonly", "ro", P_BOOL
|P_VI_DEF
|P_RSTAT
|P_NOGLOB
,
2050 (char_u
*)&p_ro
, PV_RO
,
2051 {(char_u
*)FALSE
, (char_u
*)0L} SCRIPTID_INIT
},
2052 {"redraw", NULL
, P_BOOL
|P_VI_DEF
,
2053 (char_u
*)NULL
, PV_NONE
,
2054 {(char_u
*)FALSE
, (char_u
*)0L} SCRIPTID_INIT
},
2055 {"redrawtime", "rdt", P_NUM
|P_VI_DEF
,
2057 (char_u
*)&p_rdt
, PV_NONE
,
2059 (char_u
*)NULL
, PV_NONE
,
2061 {(char_u
*)2000L, (char_u
*)0L} SCRIPTID_INIT
},
2062 {"relativenumber", "rnu", P_BOOL
|P_VI_DEF
|P_RWIN
,
2063 (char_u
*)VAR_WIN
, PV_RNU
,
2064 {(char_u
*)FALSE
, (char_u
*)0L} SCRIPTID_INIT
},
2065 {"remap", NULL
, P_BOOL
|P_VI_DEF
,
2066 (char_u
*)&p_remap
, PV_NONE
,
2067 {(char_u
*)TRUE
, (char_u
*)0L} SCRIPTID_INIT
},
2068 {"report", NULL
, P_NUM
|P_VI_DEF
,
2069 (char_u
*)&p_report
, PV_NONE
,
2070 {(char_u
*)2L, (char_u
*)0L} SCRIPTID_INIT
},
2071 {"restorescreen", "rs", P_BOOL
|P_VI_DEF
,
2073 (char_u
*)&p_rs
, PV_NONE
,
2075 (char_u
*)NULL
, PV_NONE
,
2077 {(char_u
*)TRUE
, (char_u
*)0L} SCRIPTID_INIT
},
2078 {"revins", "ri", P_BOOL
|P_VI_DEF
|P_VIM
,
2079 #ifdef FEAT_RIGHTLEFT
2080 (char_u
*)&p_ri
, PV_NONE
,
2082 (char_u
*)NULL
, PV_NONE
,
2084 {(char_u
*)FALSE
, (char_u
*)0L} SCRIPTID_INIT
},
2085 {"rightleft", "rl", P_BOOL
|P_VI_DEF
|P_RWIN
,
2086 #ifdef FEAT_RIGHTLEFT
2087 (char_u
*)VAR_WIN
, PV_RL
,
2089 (char_u
*)NULL
, PV_NONE
,
2091 {(char_u
*)FALSE
, (char_u
*)0L} SCRIPTID_INIT
},
2092 {"rightleftcmd", "rlc", P_STRING
|P_ALLOCED
|P_VI_DEF
|P_RWIN
,
2093 #ifdef FEAT_RIGHTLEFT
2094 (char_u
*)VAR_WIN
, PV_RLC
,
2095 {(char_u
*)"search", (char_u
*)NULL
}
2097 (char_u
*)NULL
, PV_NONE
,
2098 {(char_u
*)NULL
, (char_u
*)0L}
2101 {"ruler", "ru", P_BOOL
|P_VI_DEF
|P_VIM
|P_RSTAT
,
2102 #ifdef FEAT_CMDL_INFO
2103 (char_u
*)&p_ru
, PV_NONE
,
2105 (char_u
*)NULL
, PV_NONE
,
2107 {(char_u
*)FALSE
, (char_u
*)0L} SCRIPTID_INIT
},
2108 {"rulerformat", "ruf", P_STRING
|P_VI_DEF
|P_ALLOCED
|P_RSTAT
,
2110 (char_u
*)&p_ruf
, PV_NONE
,
2112 (char_u
*)NULL
, PV_NONE
,
2114 {(char_u
*)"", (char_u
*)0L} SCRIPTID_INIT
},
2115 {"runtimepath", "rtp", P_STRING
|P_VI_DEF
|P_EXPAND
|P_COMMA
|P_NODUP
|P_SECURE
,
2116 (char_u
*)&p_rtp
, PV_NONE
,
2117 {(char_u
*)DFLT_RUNTIMEPATH
, (char_u
*)0L}
2119 {"scroll", "scr", P_NUM
|P_NO_MKRC
|P_VI_DEF
,
2120 (char_u
*)VAR_WIN
, PV_SCROLL
,
2121 {(char_u
*)12L, (char_u
*)0L} SCRIPTID_INIT
},
2122 {"scrollbind", "scb", P_BOOL
|P_VI_DEF
,
2123 #ifdef FEAT_SCROLLBIND
2124 (char_u
*)VAR_WIN
, PV_SCBIND
,
2126 (char_u
*)NULL
, PV_NONE
,
2128 {(char_u
*)FALSE
, (char_u
*)0L} SCRIPTID_INIT
},
2129 {"scrolljump", "sj", P_NUM
|P_VI_DEF
|P_VIM
,
2130 (char_u
*)&p_sj
, PV_NONE
,
2131 {(char_u
*)1L, (char_u
*)0L} SCRIPTID_INIT
},
2132 {"scrolloff", "so", P_NUM
|P_VI_DEF
|P_VIM
|P_RALL
,
2133 (char_u
*)&p_so
, PV_NONE
,
2134 {(char_u
*)0L, (char_u
*)0L} SCRIPTID_INIT
},
2135 {"scrollopt", "sbo", P_STRING
|P_VI_DEF
|P_COMMA
|P_NODUP
,
2136 #ifdef FEAT_SCROLLBIND
2137 (char_u
*)&p_sbo
, PV_NONE
,
2138 {(char_u
*)"ver,jump", (char_u
*)0L}
2140 (char_u
*)NULL
, PV_NONE
,
2141 {(char_u
*)0L, (char_u
*)0L}
2144 {"sections", "sect", P_STRING
|P_VI_DEF
,
2145 (char_u
*)&p_sections
, PV_NONE
,
2146 {(char_u
*)"SHNHH HUnhsh", (char_u
*)0L}
2148 {"secure", NULL
, P_BOOL
|P_VI_DEF
|P_SECURE
,
2149 (char_u
*)&p_secure
, PV_NONE
,
2150 {(char_u
*)FALSE
, (char_u
*)0L} SCRIPTID_INIT
},
2151 {"selection", "sel", P_STRING
|P_VI_DEF
,
2153 (char_u
*)&p_sel
, PV_NONE
,
2155 (char_u
*)NULL
, PV_NONE
,
2157 {(char_u
*)"inclusive", (char_u
*)0L}
2159 {"selectmode", "slm", P_STRING
|P_VI_DEF
|P_COMMA
|P_NODUP
,
2161 (char_u
*)&p_slm
, PV_NONE
,
2163 (char_u
*)NULL
, PV_NONE
,
2165 {(char_u
*)"", (char_u
*)0L} SCRIPTID_INIT
},
2166 {"sessionoptions", "ssop", P_STRING
|P_VI_DEF
|P_COMMA
|P_NODUP
,
2168 (char_u
*)&p_ssop
, PV_NONE
,
2169 {(char_u
*)"blank,buffers,curdir,folds,help,options,tabpages,winsize",
2172 (char_u
*)NULL
, PV_NONE
,
2173 {(char_u
*)0L, (char_u
*)0L}
2176 {"shell", "sh", P_STRING
|P_EXPAND
|P_VI_DEF
|P_SECURE
,
2177 (char_u
*)&p_sh
, PV_NONE
,
2183 (char_u
*)"command",
2186 (char_u
*)"command.com",
2188 # if defined(WIN3264)
2189 (char_u
*)"", /* set in set_init_1() */
2192 (char_u
*)"cmd.exe",
2194 # if defined(ARCHIE)
2204 (char_u
*)0L} SCRIPTID_INIT
},
2205 {"shellcmdflag","shcf", P_STRING
|P_VI_DEF
|P_SECURE
,
2206 (char_u
*)&p_shcf
, PV_NONE
,
2208 #if defined(MSDOS) || defined(MSWIN)
2217 (char_u
*)0L} SCRIPTID_INIT
},
2218 {"shellpipe", "sp", P_STRING
|P_VI_DEF
|P_SECURE
,
2219 #ifdef FEAT_QUICKFIX
2220 (char_u
*)&p_sp
, PV_NONE
,
2222 #if defined(UNIX) || defined(OS2)
2233 (char_u
*)NULL
, PV_NONE
,
2234 {(char_u
*)0L, (char_u
*)0L}
2237 {"shellquote", "shq", P_STRING
|P_VI_DEF
|P_SECURE
,
2238 (char_u
*)&p_shq
, PV_NONE
,
2239 {(char_u
*)"", (char_u
*)0L} SCRIPTID_INIT
},
2240 {"shellredir", "srr", P_STRING
|P_VI_DEF
|P_SECURE
,
2241 (char_u
*)&p_srr
, PV_NONE
,
2242 {(char_u
*)">", (char_u
*)0L} SCRIPTID_INIT
},
2243 {"shellslash", "ssl", P_BOOL
|P_VI_DEF
,
2244 #ifdef BACKSLASH_IN_FILENAME
2245 (char_u
*)&p_ssl
, PV_NONE
,
2247 (char_u
*)NULL
, PV_NONE
,
2249 {(char_u
*)FALSE
, (char_u
*)0L} SCRIPTID_INIT
},
2250 {"shelltemp", "stmp", P_BOOL
,
2251 (char_u
*)&p_stmp
, PV_NONE
,
2252 {(char_u
*)FALSE
, (char_u
*)TRUE
} SCRIPTID_INIT
},
2253 {"shelltype", "st", P_NUM
|P_VI_DEF
,
2255 (char_u
*)&p_st
, PV_NONE
,
2257 (char_u
*)NULL
, PV_NONE
,
2259 {(char_u
*)0L, (char_u
*)0L} SCRIPTID_INIT
},
2260 {"shellxquote", "sxq", P_STRING
|P_VI_DEF
|P_SECURE
,
2261 (char_u
*)&p_sxq
, PV_NONE
,
2263 #if defined(UNIX) && defined(USE_SYSTEM) && !defined(__EMX__)
2268 (char_u
*)0L} SCRIPTID_INIT
},
2269 {"shiftround", "sr", P_BOOL
|P_VI_DEF
|P_VIM
,
2270 (char_u
*)&p_sr
, PV_NONE
,
2271 {(char_u
*)FALSE
, (char_u
*)0L} SCRIPTID_INIT
},
2272 {"shiftwidth", "sw", P_NUM
|P_VI_DEF
,
2273 (char_u
*)&p_sw
, PV_SW
,
2274 {(char_u
*)8L, (char_u
*)0L} SCRIPTID_INIT
},
2275 {"shortmess", "shm", P_STRING
|P_VIM
|P_FLAGLIST
,
2276 (char_u
*)&p_shm
, PV_NONE
,
2277 {(char_u
*)"", (char_u
*)"filnxtToO"}
2279 {"shortname", "sn", P_BOOL
|P_VI_DEF
,
2281 (char_u
*)NULL
, PV_NONE
,
2283 (char_u
*)&p_sn
, PV_SN
,
2285 {(char_u
*)FALSE
, (char_u
*)0L} SCRIPTID_INIT
},
2286 {"showbreak", "sbr", P_STRING
|P_VI_DEF
|P_RALL
,
2287 #ifdef FEAT_LINEBREAK
2288 (char_u
*)&p_sbr
, PV_NONE
,
2290 (char_u
*)NULL
, PV_NONE
,
2292 {(char_u
*)"", (char_u
*)0L} SCRIPTID_INIT
},
2293 {"showcmd", "sc", P_BOOL
|P_VIM
,
2294 #ifdef FEAT_CMDL_INFO
2295 (char_u
*)&p_sc
, PV_NONE
,
2297 (char_u
*)NULL
, PV_NONE
,
2306 {"showfulltag", "sft", P_BOOL
|P_VI_DEF
,
2307 (char_u
*)&p_sft
, PV_NONE
,
2308 {(char_u
*)FALSE
, (char_u
*)0L} SCRIPTID_INIT
},
2309 {"showmatch", "sm", P_BOOL
|P_VI_DEF
,
2310 (char_u
*)&p_sm
, PV_NONE
,
2311 {(char_u
*)FALSE
, (char_u
*)0L} SCRIPTID_INIT
},
2312 {"showmode", "smd", P_BOOL
|P_VIM
,
2313 (char_u
*)&p_smd
, PV_NONE
,
2314 {(char_u
*)FALSE
, (char_u
*)TRUE
} SCRIPTID_INIT
},
2315 {"showtabline", "stal", P_NUM
|P_VI_DEF
|P_RALL
,
2317 (char_u
*)&p_stal
, PV_NONE
,
2319 (char_u
*)NULL
, PV_NONE
,
2321 {(char_u
*)1L, (char_u
*)0L} SCRIPTID_INIT
},
2322 {"sidescroll", "ss", P_NUM
|P_VI_DEF
,
2323 (char_u
*)&p_ss
, PV_NONE
,
2324 {(char_u
*)0L, (char_u
*)0L} SCRIPTID_INIT
},
2325 {"sidescrolloff", "siso", P_NUM
|P_VI_DEF
|P_VIM
|P_RBUF
,
2326 (char_u
*)&p_siso
, PV_NONE
,
2327 {(char_u
*)0L, (char_u
*)0L} SCRIPTID_INIT
},
2328 {"slowopen", "slow", P_BOOL
|P_VI_DEF
,
2329 (char_u
*)NULL
, PV_NONE
,
2330 {(char_u
*)FALSE
, (char_u
*)0L} SCRIPTID_INIT
},
2331 {"smartcase", "scs", P_BOOL
|P_VI_DEF
|P_VIM
,
2332 (char_u
*)&p_scs
, PV_NONE
,
2333 {(char_u
*)FALSE
, (char_u
*)0L} SCRIPTID_INIT
},
2334 {"smartindent", "si", P_BOOL
|P_VI_DEF
|P_VIM
,
2335 #ifdef FEAT_SMARTINDENT
2336 (char_u
*)&p_si
, PV_SI
,
2338 (char_u
*)NULL
, PV_NONE
,
2340 {(char_u
*)FALSE
, (char_u
*)0L} SCRIPTID_INIT
},
2341 {"smarttab", "sta", P_BOOL
|P_VI_DEF
|P_VIM
,
2342 (char_u
*)&p_sta
, PV_NONE
,
2343 {(char_u
*)FALSE
, (char_u
*)0L} SCRIPTID_INIT
},
2344 {"softtabstop", "sts", P_NUM
|P_VI_DEF
|P_VIM
,
2345 (char_u
*)&p_sts
, PV_STS
,
2346 {(char_u
*)0L, (char_u
*)0L} SCRIPTID_INIT
},
2347 {"sourceany", NULL
, P_BOOL
|P_VI_DEF
,
2348 (char_u
*)NULL
, PV_NONE
,
2349 {(char_u
*)FALSE
, (char_u
*)0L} SCRIPTID_INIT
},
2350 {"spell", NULL
, P_BOOL
|P_VI_DEF
|P_RWIN
,
2352 (char_u
*)VAR_WIN
, PV_SPELL
,
2354 (char_u
*)NULL
, PV_NONE
,
2356 {(char_u
*)FALSE
, (char_u
*)0L} SCRIPTID_INIT
},
2357 {"spellcapcheck", "spc", P_STRING
|P_ALLOCED
|P_VI_DEF
|P_RBUF
,
2359 (char_u
*)&p_spc
, PV_SPC
,
2360 {(char_u
*)"[.?!]\\_[\\])'\" ]\\+", (char_u
*)0L}
2362 (char_u
*)NULL
, PV_NONE
,
2363 {(char_u
*)0L, (char_u
*)0L}
2366 {"spellfile", "spf", P_STRING
|P_EXPAND
|P_ALLOCED
|P_VI_DEF
|P_SECURE
|P_COMMA
,
2368 (char_u
*)&p_spf
, PV_SPF
,
2369 {(char_u
*)"", (char_u
*)0L}
2371 (char_u
*)NULL
, PV_NONE
,
2372 {(char_u
*)0L, (char_u
*)0L}
2375 {"spelllang", "spl", P_STRING
|P_ALLOCED
|P_VI_DEF
|P_COMMA
|P_RBUF
|P_EXPAND
,
2377 (char_u
*)&p_spl
, PV_SPL
,
2378 {(char_u
*)"en", (char_u
*)0L}
2380 (char_u
*)NULL
, PV_NONE
,
2381 {(char_u
*)0L, (char_u
*)0L}
2384 {"spellsuggest", "sps", P_STRING
|P_VI_DEF
|P_EXPAND
|P_SECURE
|P_COMMA
,
2386 (char_u
*)&p_sps
, PV_NONE
,
2387 {(char_u
*)"best", (char_u
*)0L}
2389 (char_u
*)NULL
, PV_NONE
,
2390 {(char_u
*)0L, (char_u
*)0L}
2393 {"splitbelow", "sb", P_BOOL
|P_VI_DEF
,
2395 (char_u
*)&p_sb
, PV_NONE
,
2397 (char_u
*)NULL
, PV_NONE
,
2399 {(char_u
*)FALSE
, (char_u
*)0L} SCRIPTID_INIT
},
2400 {"splitright", "spr", P_BOOL
|P_VI_DEF
,
2401 #ifdef FEAT_VERTSPLIT
2402 (char_u
*)&p_spr
, PV_NONE
,
2404 (char_u
*)NULL
, PV_NONE
,
2406 {(char_u
*)FALSE
, (char_u
*)0L} SCRIPTID_INIT
},
2407 {"startofline", "sol", P_BOOL
|P_VI_DEF
|P_VIM
,
2408 (char_u
*)&p_sol
, PV_NONE
,
2409 {(char_u
*)TRUE
, (char_u
*)0L} SCRIPTID_INIT
},
2410 {"statusline" ,"stl", P_STRING
|P_VI_DEF
|P_ALLOCED
|P_RSTAT
,
2412 (char_u
*)&p_stl
, PV_STL
,
2414 (char_u
*)NULL
, PV_NONE
,
2416 {(char_u
*)"", (char_u
*)0L} SCRIPTID_INIT
},
2417 {"suffixes", "su", P_STRING
|P_VI_DEF
|P_COMMA
|P_NODUP
,
2418 (char_u
*)&p_su
, PV_NONE
,
2419 {(char_u
*)".bak,~,.o,.h,.info,.swp,.obj",
2420 (char_u
*)0L} SCRIPTID_INIT
},
2421 {"suffixesadd", "sua", P_STRING
|P_VI_DEF
|P_ALLOCED
|P_COMMA
|P_NODUP
,
2422 #ifdef FEAT_SEARCHPATH
2423 (char_u
*)&p_sua
, PV_SUA
,
2424 {(char_u
*)"", (char_u
*)0L}
2426 (char_u
*)NULL
, PV_NONE
,
2427 {(char_u
*)0L, (char_u
*)0L}
2430 {"swapfile", "swf", P_BOOL
|P_VI_DEF
|P_RSTAT
,
2431 (char_u
*)&p_swf
, PV_SWF
,
2432 {(char_u
*)TRUE
, (char_u
*)0L} SCRIPTID_INIT
},
2433 {"swapsync", "sws", P_STRING
|P_VI_DEF
,
2434 (char_u
*)&p_sws
, PV_NONE
,
2435 {(char_u
*)"fsync", (char_u
*)0L} SCRIPTID_INIT
},
2436 {"switchbuf", "swb", P_STRING
|P_VI_DEF
|P_COMMA
|P_NODUP
,
2437 (char_u
*)&p_swb
, PV_NONE
,
2438 {(char_u
*)"", (char_u
*)0L} SCRIPTID_INIT
},
2439 {"synmaxcol", "smc", P_NUM
|P_VI_DEF
|P_RBUF
,
2441 (char_u
*)&p_smc
, PV_SMC
,
2442 {(char_u
*)3000L, (char_u
*)0L}
2444 (char_u
*)NULL
, PV_NONE
,
2445 {(char_u
*)0L, (char_u
*)0L}
2448 {"syntax", "syn", P_STRING
|P_ALLOCED
|P_VI_DEF
|P_NOGLOB
|P_NFNAME
,
2450 (char_u
*)&p_syn
, PV_SYN
,
2451 {(char_u
*)"", (char_u
*)0L}
2453 (char_u
*)NULL
, PV_NONE
,
2454 {(char_u
*)0L, (char_u
*)0L}
2457 {"tabline", "tal", P_STRING
|P_VI_DEF
|P_RALL
,
2459 (char_u
*)&p_tal
, PV_NONE
,
2461 (char_u
*)NULL
, PV_NONE
,
2463 {(char_u
*)"", (char_u
*)0L} SCRIPTID_INIT
},
2464 {"tabpagemax", "tpm", P_NUM
|P_VI_DEF
,
2466 (char_u
*)&p_tpm
, PV_NONE
,
2468 (char_u
*)NULL
, PV_NONE
,
2470 {(char_u
*)10L, (char_u
*)0L} SCRIPTID_INIT
},
2471 {"tabstop", "ts", P_NUM
|P_VI_DEF
|P_RBUF
,
2472 (char_u
*)&p_ts
, PV_TS
,
2473 {(char_u
*)8L, (char_u
*)0L} SCRIPTID_INIT
},
2474 {"tagbsearch", "tbs", P_BOOL
|P_VI_DEF
,
2475 (char_u
*)&p_tbs
, PV_NONE
,
2476 #ifdef VMS /* binary searching doesn't appear to work on VMS */
2477 {(char_u
*)0L, (char_u
*)0L}
2479 {(char_u
*)TRUE
, (char_u
*)0L}
2482 {"taglength", "tl", P_NUM
|P_VI_DEF
,
2483 (char_u
*)&p_tl
, PV_NONE
,
2484 {(char_u
*)0L, (char_u
*)0L} SCRIPTID_INIT
},
2485 {"tagrelative", "tr", P_BOOL
|P_VIM
,
2486 (char_u
*)&p_tr
, PV_NONE
,
2487 {(char_u
*)FALSE
, (char_u
*)TRUE
} SCRIPTID_INIT
},
2488 {"tags", "tag", P_STRING
|P_EXPAND
|P_VI_DEF
|P_COMMA
|P_NODUP
,
2489 (char_u
*)&p_tags
, PV_TAGS
,
2491 #if defined(FEAT_EMACS_TAGS) && !defined(CASE_INSENSITIVE_FILENAME)
2492 (char_u
*)"./tags,./TAGS,tags,TAGS",
2494 (char_u
*)"./tags,tags",
2496 (char_u
*)0L} SCRIPTID_INIT
},
2497 {"tagstack", "tgst", P_BOOL
|P_VI_DEF
,
2498 (char_u
*)&p_tgst
, PV_NONE
,
2499 {(char_u
*)TRUE
, (char_u
*)0L} SCRIPTID_INIT
},
2500 {"term", NULL
, P_STRING
|P_EXPAND
|P_NODEFAULT
|P_NO_MKRC
|P_VI_DEF
|P_RALL
,
2501 (char_u
*)&T_NAME
, PV_NONE
,
2502 {(char_u
*)"", (char_u
*)0L} SCRIPTID_INIT
},
2503 {"termbidi", "tbidi", P_BOOL
|P_VI_DEF
,
2505 (char_u
*)&p_tbidi
, PV_NONE
,
2507 (char_u
*)NULL
, PV_NONE
,
2509 {(char_u
*)FALSE
, (char_u
*)0L} SCRIPTID_INIT
},
2510 {"termencoding", "tenc", P_STRING
|P_VI_DEF
|P_RCLR
,
2512 (char_u
*)&p_tenc
, PV_NONE
,
2513 {(char_u
*)"", (char_u
*)0L}
2515 (char_u
*)NULL
, PV_NONE
,
2516 {(char_u
*)0L, (char_u
*)0L}
2519 {"terse", NULL
, P_BOOL
|P_VI_DEF
,
2520 (char_u
*)&p_terse
, PV_NONE
,
2521 {(char_u
*)FALSE
, (char_u
*)0L} SCRIPTID_INIT
},
2522 {"textauto", "ta", P_BOOL
|P_VIM
,
2523 (char_u
*)&p_ta
, PV_NONE
,
2524 {(char_u
*)DFLT_TEXTAUTO
, (char_u
*)TRUE
}
2526 {"textmode", "tx", P_BOOL
|P_VI_DEF
|P_NO_MKRC
,
2527 (char_u
*)&p_tx
, PV_TX
,
2534 (char_u
*)0L} SCRIPTID_INIT
},
2535 {"textwidth", "tw", P_NUM
|P_VI_DEF
|P_VIM
,
2536 (char_u
*)&p_tw
, PV_TW
,
2537 {(char_u
*)0L, (char_u
*)0L} SCRIPTID_INIT
},
2538 {"thesaurus", "tsr", P_STRING
|P_EXPAND
|P_VI_DEF
|P_COMMA
|P_NODUP
,
2539 #ifdef FEAT_INS_EXPAND
2540 (char_u
*)&p_tsr
, PV_TSR
,
2542 (char_u
*)NULL
, PV_NONE
,
2544 {(char_u
*)"", (char_u
*)0L} SCRIPTID_INIT
},
2545 {"tildeop", "top", P_BOOL
|P_VI_DEF
|P_VIM
,
2546 (char_u
*)&p_to
, PV_NONE
,
2547 {(char_u
*)FALSE
, (char_u
*)0L} SCRIPTID_INIT
},
2548 {"timeout", "to", P_BOOL
|P_VI_DEF
,
2549 (char_u
*)&p_timeout
, PV_NONE
,
2550 {(char_u
*)TRUE
, (char_u
*)0L} SCRIPTID_INIT
},
2551 {"timeoutlen", "tm", P_NUM
|P_VI_DEF
,
2552 (char_u
*)&p_tm
, PV_NONE
,
2553 {(char_u
*)1000L, (char_u
*)0L} SCRIPTID_INIT
},
2554 {"title", NULL
, P_BOOL
|P_VI_DEF
,
2556 (char_u
*)&p_title
, PV_NONE
,
2558 (char_u
*)NULL
, PV_NONE
,
2560 {(char_u
*)FALSE
, (char_u
*)0L} SCRIPTID_INIT
},
2561 {"titlelen", NULL
, P_NUM
|P_VI_DEF
,
2563 (char_u
*)&p_titlelen
, PV_NONE
,
2565 (char_u
*)NULL
, PV_NONE
,
2567 {(char_u
*)85L, (char_u
*)0L} SCRIPTID_INIT
},
2568 {"titleold", NULL
, P_STRING
|P_VI_DEF
|P_GETTEXT
|P_SECURE
|P_NO_MKRC
,
2570 (char_u
*)&p_titleold
, PV_NONE
,
2571 {(char_u
*)N_("Thanks for flying Vim"),
2574 (char_u
*)NULL
, PV_NONE
,
2575 {(char_u
*)0L, (char_u
*)0L}
2578 {"titlestring", NULL
, P_STRING
|P_VI_DEF
,
2580 (char_u
*)&p_titlestring
, PV_NONE
,
2582 (char_u
*)NULL
, PV_NONE
,
2584 {(char_u
*)"", (char_u
*)0L} SCRIPTID_INIT
},
2585 #if defined(FEAT_TOOLBAR) && !defined(FEAT_GUI_W32)
2586 {"toolbar", "tb", P_STRING
|P_COMMA
|P_VI_DEF
|P_NODUP
,
2587 (char_u
*)&p_toolbar
, PV_NONE
,
2588 {(char_u
*)"icons,tooltips", (char_u
*)0L}
2591 #if defined(FEAT_TOOLBAR) && defined(FEAT_GUI_GTK) && defined(HAVE_GTK2)
2592 {"toolbariconsize", "tbis", P_STRING
|P_VI_DEF
,
2593 (char_u
*)&p_tbis
, PV_NONE
,
2594 {(char_u
*)"small", (char_u
*)0L} SCRIPTID_INIT
},
2596 {"ttimeout", NULL
, P_BOOL
|P_VI_DEF
|P_VIM
,
2597 (char_u
*)&p_ttimeout
, PV_NONE
,
2598 {(char_u
*)FALSE
, (char_u
*)0L} SCRIPTID_INIT
},
2599 {"ttimeoutlen", "ttm", P_NUM
|P_VI_DEF
,
2600 (char_u
*)&p_ttm
, PV_NONE
,
2601 {(char_u
*)-1L, (char_u
*)0L} SCRIPTID_INIT
},
2602 {"ttybuiltin", "tbi", P_BOOL
|P_VI_DEF
,
2603 (char_u
*)&p_tbi
, PV_NONE
,
2604 {(char_u
*)TRUE
, (char_u
*)0L} SCRIPTID_INIT
},
2605 {"ttyfast", "tf", P_BOOL
|P_NO_MKRC
|P_VI_DEF
,
2606 (char_u
*)&p_tf
, PV_NONE
,
2607 {(char_u
*)FALSE
, (char_u
*)0L} SCRIPTID_INIT
},
2608 {"ttymouse", "ttym", P_STRING
|P_NODEFAULT
|P_NO_MKRC
|P_VI_DEF
,
2609 #if defined(FEAT_MOUSE) && (defined(UNIX) || defined(VMS))
2610 (char_u
*)&p_ttym
, PV_NONE
,
2612 (char_u
*)NULL
, PV_NONE
,
2614 {(char_u
*)"", (char_u
*)0L} SCRIPTID_INIT
},
2615 {"ttyscroll", "tsl", P_NUM
|P_VI_DEF
,
2616 (char_u
*)&p_ttyscroll
, PV_NONE
,
2617 {(char_u
*)999L, (char_u
*)0L} SCRIPTID_INIT
},
2618 {"ttytype", "tty", P_STRING
|P_EXPAND
|P_NODEFAULT
|P_NO_MKRC
|P_VI_DEF
|P_RALL
,
2619 (char_u
*)&T_NAME
, PV_NONE
,
2620 {(char_u
*)"", (char_u
*)0L} SCRIPTID_INIT
},
2621 #ifdef FEAT_PERSISTENT_UNDO
2622 {"undodir", "udir", P_STRING
|P_EXPAND
|P_COMMA
|P_NODUP
|P_SECURE
|P_VI_DEF
,
2623 (char_u
*)&p_udir
, PV_NONE
,
2624 {(char_u
*)DFLT_UDIR
, (char_u
*)0L}},
2625 {"undofile", "udf", P_BOOL
|P_VIM
,
2626 (char_u
*)&p_udf
, PV_UDF
,
2627 {(char_u
*)TRUE
, (char_u
*)0L}},
2629 {"undolevels", "ul", P_NUM
|P_VI_DEF
,
2630 (char_u
*)&p_ul
, PV_NONE
,
2632 #if defined(UNIX) || defined(WIN3264) || defined(OS2) || defined(VMS)
2637 (char_u
*)0L} SCRIPTID_INIT
},
2638 {"updatecount", "uc", P_NUM
|P_VI_DEF
,
2639 (char_u
*)&p_uc
, PV_NONE
,
2640 {(char_u
*)200L, (char_u
*)0L} SCRIPTID_INIT
},
2641 {"updatetime", "ut", P_NUM
|P_VI_DEF
,
2642 (char_u
*)&p_ut
, PV_NONE
,
2643 {(char_u
*)4000L, (char_u
*)0L} SCRIPTID_INIT
},
2645 {"varsofttabstop", "vsts", P_STRING
|P_VI_DEF
|P_VIM
|P_COMMA
,
2646 (char_u
*)&p_vsts
, PV_VSTS
,
2647 {(char_u
*)"", (char_u
*)0L}},
2648 {"vartabstop", "vts", P_STRING
|P_VI_DEF
|P_VIM
|P_RBUF
|P_COMMA
,
2649 (char_u
*)&p_vts
, PV_VTS
,
2650 {(char_u
*)"", (char_u
*)0L} SCRIPTID_INIT
},
2652 {"verbose", "vbs", P_NUM
|P_VI_DEF
,
2653 (char_u
*)&p_verbose
, PV_NONE
,
2654 {(char_u
*)0L, (char_u
*)0L} SCRIPTID_INIT
},
2655 {"verbosefile", "vfile", P_STRING
|P_EXPAND
|P_VI_DEF
|P_SECURE
,
2656 (char_u
*)&p_vfile
, PV_NONE
,
2657 {(char_u
*)"", (char_u
*)0L} SCRIPTID_INIT
},
2658 {"viewdir", "vdir", P_STRING
|P_EXPAND
|P_VI_DEF
|P_SECURE
,
2660 (char_u
*)&p_vdir
, PV_NONE
,
2661 {(char_u
*)DFLT_VDIR
, (char_u
*)0L}
2663 (char_u
*)NULL
, PV_NONE
,
2664 {(char_u
*)0L, (char_u
*)0L}
2667 {"viewoptions", "vop", P_STRING
|P_VI_DEF
|P_COMMA
|P_NODUP
,
2669 (char_u
*)&p_vop
, PV_NONE
,
2670 {(char_u
*)"folds,options,cursor", (char_u
*)0L}
2672 (char_u
*)NULL
, PV_NONE
,
2673 {(char_u
*)0L, (char_u
*)0L}
2676 {"viminfo", "vi", P_STRING
|P_COMMA
|P_NODUP
|P_SECURE
,
2678 (char_u
*)&p_viminfo
, PV_NONE
,
2679 #if defined(MSDOS) || defined(MSWIN) || defined(OS2)
2680 {(char_u
*)"", (char_u
*)"'100,<50,s10,h,rA:,rB:"}
2684 (char_u
*)"'100,<50,s10,h,rdf0:,rdf1:,rdf2:"}
2686 {(char_u
*)"", (char_u
*)"'100,<50,s10,h"}
2690 (char_u
*)NULL
, PV_NONE
,
2691 {(char_u
*)0L, (char_u
*)0L}
2694 {"virtualedit", "ve", P_STRING
|P_COMMA
|P_NODUP
|P_VI_DEF
|P_VIM
,
2695 #ifdef FEAT_VIRTUALEDIT
2696 (char_u
*)&p_ve
, PV_NONE
,
2697 {(char_u
*)"", (char_u
*)""}
2699 (char_u
*)NULL
, PV_NONE
,
2700 {(char_u
*)0L, (char_u
*)0L}
2703 {"visualbell", "vb", P_BOOL
|P_VI_DEF
,
2704 (char_u
*)&p_vb
, PV_NONE
,
2705 {(char_u
*)FALSE
, (char_u
*)0L} SCRIPTID_INIT
},
2706 {"w300", NULL
, P_NUM
|P_VI_DEF
,
2707 (char_u
*)NULL
, PV_NONE
,
2708 {(char_u
*)0L, (char_u
*)0L} SCRIPTID_INIT
},
2709 {"w1200", NULL
, P_NUM
|P_VI_DEF
,
2710 (char_u
*)NULL
, PV_NONE
,
2711 {(char_u
*)0L, (char_u
*)0L} SCRIPTID_INIT
},
2712 {"w9600", NULL
, P_NUM
|P_VI_DEF
,
2713 (char_u
*)NULL
, PV_NONE
,
2714 {(char_u
*)0L, (char_u
*)0L} SCRIPTID_INIT
},
2715 {"warn", NULL
, P_BOOL
|P_VI_DEF
,
2716 (char_u
*)&p_warn
, PV_NONE
,
2717 {(char_u
*)TRUE
, (char_u
*)0L} SCRIPTID_INIT
},
2718 {"weirdinvert", "wiv", P_BOOL
|P_VI_DEF
|P_RCLR
,
2719 (char_u
*)&p_wiv
, PV_NONE
,
2720 {(char_u
*)FALSE
, (char_u
*)0L} SCRIPTID_INIT
},
2721 {"whichwrap", "ww", P_STRING
|P_VIM
|P_COMMA
|P_FLAGLIST
,
2722 (char_u
*)&p_ww
, PV_NONE
,
2723 {(char_u
*)"", (char_u
*)"b,s"} SCRIPTID_INIT
},
2724 {"wildchar", "wc", P_NUM
|P_VIM
,
2725 (char_u
*)&p_wc
, PV_NONE
,
2726 {(char_u
*)(long)Ctrl_E
, (char_u
*)(long)TAB
}
2728 {"wildcharm", "wcm", P_NUM
|P_VI_DEF
,
2729 (char_u
*)&p_wcm
, PV_NONE
,
2730 {(char_u
*)0L, (char_u
*)0L} SCRIPTID_INIT
},
2731 {"wildignore", "wig", P_STRING
|P_VI_DEF
|P_COMMA
|P_NODUP
,
2733 (char_u
*)&p_wig
, PV_NONE
,
2735 (char_u
*)NULL
, PV_NONE
,
2737 {(char_u
*)"", (char_u
*)0L} SCRIPTID_INIT
},
2738 {"wildmenu", "wmnu", P_BOOL
|P_VI_DEF
,
2739 #ifdef FEAT_WILDMENU
2740 (char_u
*)&p_wmnu
, PV_NONE
,
2742 (char_u
*)NULL
, PV_NONE
,
2744 {(char_u
*)FALSE
, (char_u
*)0L} SCRIPTID_INIT
},
2745 {"wildmode", "wim", P_STRING
|P_VI_DEF
|P_COMMA
|P_NODUP
,
2746 (char_u
*)&p_wim
, PV_NONE
,
2747 {(char_u
*)"full", (char_u
*)0L} SCRIPTID_INIT
},
2748 {"wildoptions", "wop", P_STRING
|P_VI_DEF
,
2749 #ifdef FEAT_CMDL_COMPL
2750 (char_u
*)&p_wop
, PV_NONE
,
2751 {(char_u
*)"", (char_u
*)0L}
2753 (char_u
*)NULL
, PV_NONE
,
2754 {(char_u
*)NULL
, (char_u
*)0L}
2757 {"winaltkeys", "wak", P_STRING
|P_VI_DEF
,
2759 (char_u
*)&p_wak
, PV_NONE
,
2760 {(char_u
*)"menu", (char_u
*)0L}
2762 (char_u
*)NULL
, PV_NONE
,
2763 {(char_u
*)NULL
, (char_u
*)0L}
2766 {"window", "wi", P_NUM
|P_VI_DEF
,
2767 (char_u
*)&p_window
, PV_NONE
,
2768 {(char_u
*)0L, (char_u
*)0L} SCRIPTID_INIT
},
2769 {"winheight", "wh", P_NUM
|P_VI_DEF
,
2771 (char_u
*)&p_wh
, PV_NONE
,
2773 (char_u
*)NULL
, PV_NONE
,
2775 {(char_u
*)1L, (char_u
*)0L} SCRIPTID_INIT
},
2776 {"winfixheight", "wfh", P_BOOL
|P_VI_DEF
|P_RSTAT
,
2778 (char_u
*)VAR_WIN
, PV_WFH
,
2780 (char_u
*)NULL
, PV_NONE
,
2782 {(char_u
*)FALSE
, (char_u
*)0L} SCRIPTID_INIT
},
2783 {"winfixwidth", "wfw", P_BOOL
|P_VI_DEF
|P_RSTAT
,
2784 #ifdef FEAT_VERTSPLIT
2785 (char_u
*)VAR_WIN
, PV_WFW
,
2787 (char_u
*)NULL
, PV_NONE
,
2789 {(char_u
*)FALSE
, (char_u
*)0L} SCRIPTID_INIT
},
2790 {"winminheight", "wmh", P_NUM
|P_VI_DEF
,
2792 (char_u
*)&p_wmh
, PV_NONE
,
2794 (char_u
*)NULL
, PV_NONE
,
2796 {(char_u
*)1L, (char_u
*)0L} SCRIPTID_INIT
},
2797 {"winminwidth", "wmw", P_NUM
|P_VI_DEF
,
2798 #ifdef FEAT_VERTSPLIT
2799 (char_u
*)&p_wmw
, PV_NONE
,
2801 (char_u
*)NULL
, PV_NONE
,
2803 {(char_u
*)1L, (char_u
*)0L} SCRIPTID_INIT
},
2804 {"winwidth", "wiw", P_NUM
|P_VI_DEF
,
2805 #ifdef FEAT_VERTSPLIT
2806 (char_u
*)&p_wiw
, PV_NONE
,
2808 (char_u
*)NULL
, PV_NONE
,
2810 {(char_u
*)20L, (char_u
*)0L} SCRIPTID_INIT
},
2811 {"wrap", NULL
, P_BOOL
|P_VI_DEF
|P_RWIN
,
2812 (char_u
*)VAR_WIN
, PV_WRAP
,
2813 {(char_u
*)TRUE
, (char_u
*)0L} SCRIPTID_INIT
},
2814 {"wrapmargin", "wm", P_NUM
|P_VI_DEF
,
2815 (char_u
*)&p_wm
, PV_WM
,
2816 {(char_u
*)0L, (char_u
*)0L} SCRIPTID_INIT
},
2817 {"wrapscan", "ws", P_BOOL
|P_VI_DEF
,
2818 (char_u
*)&p_ws
, PV_NONE
,
2819 {(char_u
*)TRUE
, (char_u
*)0L} SCRIPTID_INIT
},
2820 {"write", NULL
, P_BOOL
|P_VI_DEF
,
2821 (char_u
*)&p_write
, PV_NONE
,
2822 {(char_u
*)TRUE
, (char_u
*)0L} SCRIPTID_INIT
},
2823 {"writeany", "wa", P_BOOL
|P_VI_DEF
,
2824 (char_u
*)&p_wa
, PV_NONE
,
2825 {(char_u
*)FALSE
, (char_u
*)0L} SCRIPTID_INIT
},
2826 {"writebackup", "wb", P_BOOL
|P_VI_DEF
|P_VIM
,
2827 (char_u
*)&p_wb
, PV_NONE
,
2829 #ifdef FEAT_WRITEBACKUP
2834 (char_u
*)0L} SCRIPTID_INIT
},
2835 {"writedelay", "wd", P_NUM
|P_VI_DEF
,
2836 (char_u
*)&p_wd
, PV_NONE
,
2837 {(char_u
*)0L, (char_u
*)0L} SCRIPTID_INIT
},
2839 /* terminal output codes */
2840 #define p_term(sss, vvv) {sss, NULL, P_STRING|P_VI_DEF|P_RALL|P_SECURE, \
2841 (char_u *)&vvv, PV_NONE, \
2842 {(char_u *)"", (char_u *)0L} SCRIPTID_INIT},
2844 p_term("t_AB", T_CAB
)
2845 p_term("t_AF", T_CAF
)
2846 p_term("t_AL", T_CAL
)
2847 p_term("t_al", T_AL
)
2848 p_term("t_bc", T_BC
)
2849 p_term("t_cd", T_CD
)
2850 p_term("t_ce", T_CE
)
2851 p_term("t_cl", T_CL
)
2852 p_term("t_cm", T_CM
)
2853 p_term("t_Co", T_CCO
)
2854 p_term("t_CS", T_CCS
)
2855 p_term("t_cs", T_CS
)
2856 #ifdef FEAT_VERTSPLIT
2857 p_term("t_CV", T_CSV
)
2859 p_term("t_ut", T_UT
)
2860 p_term("t_da", T_DA
)
2861 p_term("t_db", T_DB
)
2862 p_term("t_DL", T_CDL
)
2863 p_term("t_dl", T_DL
)
2864 p_term("t_fs", T_FS
)
2865 p_term("t_IE", T_CIE
)
2866 p_term("t_IS", T_CIS
)
2867 p_term("t_ke", T_KE
)
2868 p_term("t_ks", T_KS
)
2869 p_term("t_le", T_LE
)
2870 p_term("t_mb", T_MB
)
2871 p_term("t_md", T_MD
)
2872 p_term("t_me", T_ME
)
2873 p_term("t_mr", T_MR
)
2874 p_term("t_ms", T_MS
)
2875 p_term("t_nd", T_ND
)
2876 p_term("t_op", T_OP
)
2877 p_term("t_RI", T_CRI
)
2878 p_term("t_RV", T_CRV
)
2879 p_term("t_Sb", T_CSB
)
2880 p_term("t_Sf", T_CSF
)
2881 p_term("t_se", T_SE
)
2882 p_term("t_so", T_SO
)
2883 p_term("t_sr", T_SR
)
2884 p_term("t_ts", T_TS
)
2885 p_term("t_te", T_TE
)
2886 p_term("t_ti", T_TI
)
2887 p_term("t_ue", T_UE
)
2888 p_term("t_us", T_US
)
2889 p_term("t_vb", T_VB
)
2890 p_term("t_ve", T_VE
)
2891 p_term("t_vi", T_VI
)
2892 p_term("t_vs", T_VS
)
2893 p_term("t_WP", T_CWP
)
2894 p_term("t_WS", T_CWS
)
2895 p_term("t_SI", T_CSI
)
2896 p_term("t_EI", T_CEI
)
2897 p_term("t_xs", T_XS
)
2898 p_term("t_ZH", T_CZH
)
2899 p_term("t_ZR", T_CZR
)
2901 /* terminal key codes are not in here */
2904 {NULL
, NULL
, 0, NULL
, PV_NONE
, {NULL
, NULL
} SCRIPTID_INIT
}
2907 #define PARAM_COUNT (sizeof(options) / sizeof(struct vimoption))
2910 static char *(p_ambw_values
[]) = {"single", "double", NULL
};
2912 static char *(p_bg_values
[]) = {"light", "dark", NULL
};
2913 static char *(p_nf_values
[]) = {"octal", "hex", "alpha", NULL
};
2914 static char *(p_ff_values
[]) = {FF_UNIX
, FF_DOS
, FF_MAC
, NULL
};
2915 #ifdef FEAT_CMDL_COMPL
2916 static char *(p_wop_values
[]) = {"tagfile", NULL
};
2919 static char *(p_wak_values
[]) = {"yes", "menu", "no", NULL
};
2921 static char *(p_mousem_values
[]) = {"extend", "popup", "popup_setpos", "mac", NULL
};
2923 static char *(p_sel_values
[]) = {"inclusive", "exclusive", "old", NULL
};
2924 static char *(p_slm_values
[]) = {"mouse", "key", "cmd", NULL
};
2927 static char *(p_km_values
[]) = {"startsel", "stopsel", NULL
};
2930 static char *(p_bsdir_values
[]) = {"current", "last", "buffer", NULL
};
2932 #ifdef FEAT_SCROLLBIND
2933 static char *(p_scbopt_values
[]) = {"ver", "hor", "jump", NULL
};
2935 static char *(p_debug_values
[]) = {"msg", "throw", "beep", NULL
};
2936 #ifdef FEAT_VERTSPLIT
2937 static char *(p_ead_values
[]) = {"both", "ver", "hor", NULL
};
2939 #if defined(FEAT_QUICKFIX)
2940 # ifdef FEAT_AUTOCMD
2941 static char *(p_buftype_values
[]) = {"nofile", "nowrite", "quickfix", "help", "acwrite", NULL
};
2943 static char *(p_buftype_values
[]) = {"nofile", "nowrite", "quickfix", "help", NULL
};
2945 static char *(p_bufhidden_values
[]) = {"hide", "unload", "delete", "wipe", NULL
};
2947 static char *(p_bs_values
[]) = {"indent", "eol", "start", NULL
};
2949 static char *(p_fdm_values
[]) = {"manual", "expr", "marker", "indent", "syntax",
2954 static char *(p_fcl_values
[]) = {"all", NULL
};
2956 #ifdef FEAT_INS_EXPAND
2957 static char *(p_cot_values
[]) = {"menu", "menuone", "longest", "preview", NULL
};
2960 static void set_option_default
__ARGS((int, int opt_flags
, int compatible
));
2961 static void set_options_default
__ARGS((int opt_flags
));
2962 static char_u
*term_bg_default
__ARGS((void));
2963 static void did_set_option
__ARGS((int opt_idx
, int opt_flags
, int new_value
));
2964 static char_u
*illegal_char
__ARGS((char_u
*, int));
2965 static int string_to_key
__ARGS((char_u
*arg
));
2967 static char_u
*check_cedit
__ARGS((void));
2970 static void did_set_title
__ARGS((int icon
));
2972 static char_u
*option_expand
__ARGS((int opt_idx
, char_u
*val
));
2973 static void didset_options
__ARGS((void));
2974 static void check_string_option
__ARGS((char_u
**pp
));
2975 #if defined(FEAT_EVAL) || defined(PROTO)
2976 static long_u
*insecure_flag
__ARGS((int opt_idx
, int opt_flags
));
2978 # define insecure_flag(opt_idx, opt_flags) (&options[opt_idx].flags)
2980 static void set_string_option_global
__ARGS((int opt_idx
, char_u
**varp
));
2981 static void set_string_option
__ARGS((int opt_idx
, char_u
*value
, int opt_flags
));
2982 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
));
2983 static char_u
*set_chars_option
__ARGS((char_u
**varp
));
2984 #ifdef FEAT_CLIPBOARD
2985 static char_u
*check_clipboard_option
__ARGS((void));
2988 static char_u
*compile_cap_prog
__ARGS((buf_T
*buf
));
2991 static void set_option_scriptID_idx
__ARGS((int opt_idx
, int opt_flags
, int id
));
2993 static char_u
*set_bool_option
__ARGS((int opt_idx
, char_u
*varp
, int value
, int opt_flags
));
2994 static char_u
*set_num_option
__ARGS((int opt_idx
, char_u
*varp
, long value
, char_u
*errbuf
, size_t errbuflen
, int opt_flags
));
2995 static void check_redraw
__ARGS((long_u flags
));
2996 static int findoption
__ARGS((char_u
*));
2997 static int find_key_option
__ARGS((char_u
*));
2998 static void showoptions
__ARGS((int all
, int opt_flags
));
2999 static int optval_default
__ARGS((struct vimoption
*, char_u
*varp
));
3000 static void showoneopt
__ARGS((struct vimoption
*, int opt_flags
));
3001 static int put_setstring
__ARGS((FILE *fd
, char *cmd
, char *name
, char_u
**valuep
, int expand
));
3002 static int put_setnum
__ARGS((FILE *fd
, char *cmd
, char *name
, long *valuep
));
3003 static int put_setbool
__ARGS((FILE *fd
, char *cmd
, char *name
, int value
));
3004 static int istermoption
__ARGS((struct vimoption
*));
3005 static char_u
*get_varp_scope
__ARGS((struct vimoption
*p
, int opt_flags
));
3006 static char_u
*get_varp
__ARGS((struct vimoption
*));
3007 static void option_value2string
__ARGS((struct vimoption
*, int opt_flags
));
3008 static int wc_use_keyname
__ARGS((char_u
*varp
, long *wcp
));
3010 static void langmap_init
__ARGS((void));
3011 static void langmap_set
__ARGS((void));
3013 static void paste_option_changed
__ARGS((void));
3014 static void compatible_set
__ARGS((void));
3015 #ifdef FEAT_LINEBREAK
3016 static void fill_breakat_flags
__ARGS((void));
3018 static int opt_strings_flags
__ARGS((char_u
*val
, char **values
, unsigned *flagp
, int list
));
3019 static int check_opt_strings
__ARGS((char_u
*val
, char **values
, int));
3020 static int check_opt_wim
__ARGS((void));
3023 * Initialize the options, first part.
3025 * Called only once from main(), just after creating the first buffer.
3038 /* Be Vi compatible by default */
3041 /* Use POSIX compatibility when $VIM_POSIX is set. */
3042 if (mch_getenv((char_u
*)"VIM_POSIX") != NULL
)
3044 set_string_default("cpo", (char_u
*)CPO_ALL
);
3045 set_string_default("shm", (char_u
*)"A");
3049 * Find default value for 'shell' option.
3050 * Don't use it if it is empty.
3052 if (((p
= mch_getenv((char_u
*)"SHELL")) != NULL
&& *p
!= NUL
)
3053 #if defined(MSDOS) || defined(MSWIN) || defined(OS2)
3055 || ((p
= mch_getenv((char_u
*)"EMXSHELL")) != NULL
&& *p
!= NUL
)
3057 || ((p
= mch_getenv((char_u
*)"COMSPEC")) != NULL
&& *p
!= NUL
)
3059 || ((p
= default_shell()) != NULL
&& *p
!= NUL
)
3063 set_string_default("sh", p
);
3067 * Set the default for 'backupskip' to include environment variables for
3072 static char *(names
[4]) = {"", "TMPDIR", "TEMP", "TMP"};
3074 static char *(names
[3]) = {"TMPDIR", "TEMP", "TMP"};
3080 ga_init2(&ga
, 1, 100);
3081 for (n
= 0; n
< (long)(sizeof(names
) / sizeof(char *)); ++n
)
3085 if (*names
[n
] == NUL
)
3086 p
= (char_u
*)"/tmp";
3089 p
= vim_getenv((char_u
*)names
[n
], &mustfree
);
3090 if (p
!= NULL
&& *p
!= NUL
)
3092 /* First time count the NUL, otherwise count the ','. */
3093 len
= (int)STRLEN(p
) + 3;
3094 if (ga_grow(&ga
, len
) == OK
)
3097 STRCAT(ga
.ga_data
, ",");
3098 STRCAT(ga
.ga_data
, p
);
3099 add_pathsep(ga
.ga_data
);
3100 STRCAT(ga
.ga_data
, "*");
3107 if (ga
.ga_data
!= NULL
)
3109 set_string_default("bsk", ga
.ga_data
);
3110 vim_free(ga
.ga_data
);
3116 * 'maxmemtot' and 'maxmem' may have to be adjusted for available memory
3118 opt_idx
= findoption((char_u
*)"maxmemtot");
3121 #if !defined(HAVE_AVAIL_MEM) && !defined(HAVE_TOTAL_MEM)
3122 if (options
[opt_idx
].def_val
[VI_DEFAULT
] == (char_u
*)0L)
3125 #ifdef HAVE_AVAIL_MEM
3126 /* Use amount of memory available at this moment. */
3127 n
= (mch_avail_mem(FALSE
) >> 11);
3129 # ifdef HAVE_TOTAL_MEM
3130 /* Use amount of memory available to Vim. */
3131 n
= (mch_total_mem(FALSE
) >> 1);
3133 n
= (0x7fffffff >> 11);
3136 options
[opt_idx
].def_val
[VI_DEFAULT
] = (char_u
*)n
;
3137 opt_idx
= findoption((char_u
*)"maxmem");
3140 #if !defined(HAVE_AVAIL_MEM) && !defined(HAVE_TOTAL_MEM)
3141 if ((long)options
[opt_idx
].def_val
[VI_DEFAULT
] > n
3142 || (long)options
[opt_idx
].def_val
[VI_DEFAULT
] == 0L)
3144 options
[opt_idx
].def_val
[VI_DEFAULT
] = (char_u
*)n
;
3150 /* force 'shortname' for Win32s */
3151 if (gui_is_win32s())
3153 opt_idx
= findoption((char_u
*)"shortname");
3155 options
[opt_idx
].def_val
[VI_DEFAULT
] = (char_u
*)TRUE
;
3159 #ifdef FEAT_SEARCHPATH
3165 int mustfree
= FALSE
;
3167 /* Initialize the 'cdpath' option's default value. */
3168 cdpath
= vim_getenv((char_u
*)"CDPATH", &mustfree
);
3171 buf
= alloc((unsigned)((STRLEN(cdpath
) << 1) + 2));
3174 buf
[0] = ','; /* start with ",", current dir first */
3176 for (i
= 0; cdpath
[i
] != NUL
; ++i
)
3178 if (vim_ispathlistsep(cdpath
[i
]))
3182 if (cdpath
[i
] == ' ' || cdpath
[i
] == ',')
3184 buf
[j
++] = cdpath
[i
];
3188 opt_idx
= findoption((char_u
*)"cdpath");
3191 options
[opt_idx
].def_val
[VI_DEFAULT
] = buf
;
3192 options
[opt_idx
].flags
|= P_DEF_ALLOCED
;
3201 #if defined(FEAT_POSTSCRIPT) && (defined(MSWIN) || defined(OS2) || defined(VMS) || defined(EBCDIC) || defined(MAC) || defined(hpux))
3202 /* Set print encoding on platforms that don't default to latin1 */
3203 set_string_default("penc",
3204 # if defined(MSWIN) || defined(OS2)
3211 (char_u
*)"ebcdic-uk"
3214 (char_u
*)"mac-roman"
3216 (char_u
*)"hp-roman8"
3224 #ifdef FEAT_POSTSCRIPT
3225 /* 'printexpr' must be allocated to be able to evaluate it. */
3226 set_string_default("pexpr",
3227 # if defined(MSWIN) || defined(MSDOS) || defined(OS2)
3228 (char_u
*)"system('copy' . ' ' . v:fname_in . (&printdevice == '' ? ' LPT1:' : (' \"' . &printdevice . '\"'))) . delete(v:fname_in)"
3231 (char_u
*)"system('print/delete' . (&printdevice == '' ? '' : ' /queue=' . &printdevice) . ' ' . v:fname_in)"
3234 (char_u
*)"system('lpr' . (&printdevice == '' ? '' : ' -P' . &printdevice) . ' ' . v:fname_in) . delete(v:fname_in) + v:shell_error"
3241 * Set all the options (except the terminal options) to their default
3242 * value. Also set the global value for local options.
3244 set_options_default(0);
3247 if (found_reverse_arg
)
3248 set_option_value((char_u
*)"bg", 0L, (char_u
*)"dark", 0);
3251 curbuf
->b_p_initialized
= TRUE
;
3252 curbuf
->b_p_ar
= -1; /* no local 'autoread' value */
3253 check_buf_options(curbuf
);
3254 check_win_options(curwin
);
3257 /* Must be before option_expand(), because that one needs vim_isIDc() */
3261 /* Use the current chartab for the generic chartab. */
3262 init_spell_chartab();
3265 #ifdef FEAT_LINEBREAK
3267 * initialize the table for 'breakat'.
3269 fill_breakat_flags();
3273 * Expand environment variables and things like "~" for the defaults.
3274 * If option_expand() returns non-NULL the variable is expanded. This can
3275 * only happen for non-indirect options.
3276 * Also set the default to the expanded value, so ":set" does not list
3278 * Don't set the P_ALLOCED flag, because we don't want to free the
3281 for (opt_idx
= 0; !istermoption(&options
[opt_idx
]); opt_idx
++)
3283 if ((options
[opt_idx
].flags
& P_GETTEXT
)
3284 && options
[opt_idx
].var
!= NULL
)
3285 p
= (char_u
*)_(*(char **)options
[opt_idx
].var
);
3287 p
= option_expand(opt_idx
, NULL
);
3288 if (p
!= NULL
&& (p
= vim_strsave(p
)) != NULL
)
3290 *(char_u
**)options
[opt_idx
].var
= p
;
3292 * Defaults for all expanded options are currently the same for Vi
3293 * and Vim. When this changes, add some code here! Also need to
3294 * split P_DEF_ALLOCED in two.
3296 if (options
[opt_idx
].flags
& P_DEF_ALLOCED
)
3297 vim_free(options
[opt_idx
].def_val
[VI_DEFAULT
]);
3298 options
[opt_idx
].def_val
[VI_DEFAULT
] = p
;
3299 options
[opt_idx
].flags
|= P_DEF_ALLOCED
;
3303 /* Initialize the highlight_attr[] table. */
3304 highlight_changed();
3306 save_file_ff(curbuf
); /* Buffer is unchanged */
3308 /* Parse default for 'wildmode' */
3311 #if defined(FEAT_ARABIC)
3312 /* Detect use of mlterm.
3313 * Mlterm is a terminal emulator akin to xterm that has some special
3314 * abilities (bidi namely).
3315 * NOTE: mlterm's author is being asked to 'set' a variable
3316 * instead of an environment variable due to inheritance.
3318 if (mch_getenv((char_u
*)"MLTERM") != NULL
)
3319 set_option_value((char_u
*)"tbidi", 1L, NULL
, 0);
3322 #if defined(FEAT_WINDOWS) || defined(FEAT_FOLDING)
3323 /* Parse default for 'fillchars'. */
3324 (void)set_chars_option(&p_fcs
);
3327 #ifdef FEAT_CLIPBOARD
3328 /* Parse default for 'clipboard' */
3329 (void)check_clipboard_option();
3333 # if defined(WIN3264) && defined(FEAT_GETTEXT)
3335 * If $LANG isn't set, try to get a good value for it. This makes the
3336 * right language be used automatically. Don't do this for English.
3338 if (mch_getenv((char_u
*)"LANG") == NULL
)
3342 /* Could use LOCALE_SISO639LANGNAME, but it's not in Win95.
3343 * LOCALE_SABBREVLANGNAME gives us three letters, like "enu", we use
3344 * only the first two. */
3345 n
= GetLocaleInfo(LOCALE_USER_DEFAULT
, LOCALE_SABBREVLANGNAME
,
3347 if (n
>= 2 && STRNICMP(buf
, "en", 2) != 0)
3349 /* There are a few exceptions (probably more) */
3350 if (STRNICMP(buf
, "cht", 3) == 0 || STRNICMP(buf
, "zht", 3) == 0)
3351 STRCPY(buf
, "zh_TW");
3352 else if (STRNICMP(buf
, "chs", 3) == 0
3353 || STRNICMP(buf
, "zhc", 3) == 0)
3354 STRCPY(buf
, "zh_CN");
3355 else if (STRNICMP(buf
, "jp", 2) == 0)
3358 buf
[2] = NUL
; /* truncate to two-letter code */
3359 vim_setenv("LANG", buf
);
3363 # ifdef MACOS_CONVERT
3364 /* Moved to os_mac_conv.c to avoid dependency problems. */
3369 /* enc_locale() will try to find the encoding of the current locale. */
3375 /* Try setting 'encoding' and check if the value is valid.
3376 * If not, go back to the default "latin1". */
3379 if (STRCMP(p_enc
, "gb18030") == 0)
3381 /* We don't support "gb18030", but "cp936" is a good substitute
3382 * for practical purposes, thus use that. It's not an alias to
3383 * still support conversion between gb18030 and utf-8. */
3384 p_enc
= vim_strsave((char_u
*)"cp936");
3387 if (mb_init() == NULL
)
3389 opt_idx
= findoption((char_u
*)"encoding");
3392 options
[opt_idx
].def_val
[VI_DEFAULT
] = p_enc
;
3393 options
[opt_idx
].flags
|= P_DEF_ALLOCED
;
3396 #if defined(MSDOS) || defined(MSWIN) || defined(OS2) || defined(MACOS) \
3398 if (STRCMP(p_enc
, "latin1") == 0
3404 /* Adjust the default for 'isprint' and 'iskeyword' to match
3405 * latin1. Also set the defaults for when 'nocompatible' is
3407 set_string_option_direct((char_u
*)"isp", -1,
3408 ISP_LATIN1
, OPT_FREE
, SID_NONE
);
3409 set_string_option_direct((char_u
*)"isk", -1,
3410 ISK_LATIN1
, OPT_FREE
, SID_NONE
);
3411 opt_idx
= findoption((char_u
*)"isp");
3413 options
[opt_idx
].def_val
[VIM_DEFAULT
] = ISP_LATIN1
;
3414 opt_idx
= findoption((char_u
*)"isk");
3416 options
[opt_idx
].def_val
[VIM_DEFAULT
] = ISK_LATIN1
;
3417 (void)init_chartab();
3421 # if defined(WIN3264) && !defined(FEAT_GUI)
3422 /* Win32 console: When GetACP() returns a different value from
3423 * GetConsoleCP() set 'termencoding'. */
3424 if (GetACP() != GetConsoleCP())
3428 sprintf(buf
, "cp%ld", (long)GetConsoleCP());
3429 p_tenc
= vim_strsave((char_u
*)buf
);
3432 opt_idx
= findoption((char_u
*)"termencoding");
3435 options
[opt_idx
].def_val
[VI_DEFAULT
] = p_tenc
;
3436 options
[opt_idx
].flags
|= P_DEF_ALLOCED
;
3438 convert_setup(&input_conv
, p_tenc
, p_enc
);
3439 convert_setup(&output_conv
, p_enc
, p_tenc
);
3442 p_tenc
= empty_option
;
3445 # if defined(WIN3264) && defined(FEAT_MBYTE)
3446 /* $HOME may have characters in active code page. */
3458 #ifdef FEAT_MULTI_LANG
3459 /* Set the default for 'helplang'. */
3460 set_helplang_default(get_mess_lang());
3465 * Set an option to its default value.
3466 * This does not take care of side effects!
3469 set_option_default(opt_idx
, opt_flags
, compatible
)
3471 int opt_flags
; /* OPT_FREE, OPT_LOCAL and/or OPT_GLOBAL */
3472 int compatible
; /* use Vi default value */
3474 char_u
*varp
; /* pointer to variable for current option */
3475 int dvi
; /* index in def_val[] */
3478 int both
= (opt_flags
& (OPT_LOCAL
| OPT_GLOBAL
)) == 0;
3480 varp
= get_varp_scope(&(options
[opt_idx
]), both
? OPT_LOCAL
: opt_flags
);
3481 flags
= options
[opt_idx
].flags
;
3482 if (varp
!= NULL
) /* skip hidden option, nothing to do for it */
3484 dvi
= ((flags
& P_VI_DEF
) || compatible
) ? VI_DEFAULT
: VIM_DEFAULT
;
3485 if (flags
& P_STRING
)
3487 /* Use set_string_option_direct() for local options to handle
3488 * freeing and allocating the value. */
3489 if (options
[opt_idx
].indir
!= PV_NONE
)
3490 set_string_option_direct(NULL
, opt_idx
,
3491 options
[opt_idx
].def_val
[dvi
], opt_flags
, 0);
3494 if ((opt_flags
& OPT_FREE
) && (flags
& P_ALLOCED
))
3495 free_string_option(*(char_u
**)(varp
));
3496 *(char_u
**)varp
= options
[opt_idx
].def_val
[dvi
];
3497 options
[opt_idx
].flags
&= ~P_ALLOCED
;
3500 else if (flags
& P_NUM
)
3502 if (options
[opt_idx
].indir
== PV_SCROLL
)
3503 win_comp_scroll(curwin
);
3506 *(long *)varp
= (long)(long_i
)options
[opt_idx
].def_val
[dvi
];
3507 /* May also set global value for local option. */
3509 *(long *)get_varp_scope(&(options
[opt_idx
]), OPT_GLOBAL
) =
3515 /* the cast to long is required for Manx C, long_i is needed for
3517 *(int *)varp
= (int)(long)(long_i
)options
[opt_idx
].def_val
[dvi
];
3519 /* 'modeline' defaults to off for root */
3520 if (options
[opt_idx
].indir
== PV_ML
&& getuid() == ROOT_UID
)
3521 *(int *)varp
= FALSE
;
3523 /* May also set global value for local option. */
3525 *(int *)get_varp_scope(&(options
[opt_idx
]), OPT_GLOBAL
) =
3529 /* The default value is not insecure. */
3530 flagsp
= insecure_flag(opt_idx
, opt_flags
);
3531 *flagsp
= *flagsp
& ~P_INSECURE
;
3535 set_option_scriptID_idx(opt_idx
, opt_flags
, current_SID
);
3540 * Set all options (except terminal options) to their default value.
3543 set_options_default(opt_flags
)
3544 int opt_flags
; /* OPT_FREE, OPT_LOCAL and/or OPT_GLOBAL */
3552 for (i
= 0; !istermoption(&options
[i
]); i
++)
3553 if (!(options
[i
].flags
& P_NODEFAULT
))
3554 set_option_default(i
, opt_flags
, p_cp
);
3557 /* The 'scroll' option must be computed for all windows. */
3558 FOR_ALL_TAB_WINDOWS(tp
, wp
)
3559 win_comp_scroll(wp
);
3561 win_comp_scroll(curwin
);
3566 * Set the Vi-default value of a string option.
3567 * Used for 'sh', 'backupskip' and 'term'.
3570 set_string_default(name
, val
)
3577 p
= vim_strsave(val
);
3578 if (p
!= NULL
) /* we don't want a NULL */
3580 opt_idx
= findoption((char_u
*)name
);
3583 if (options
[opt_idx
].flags
& P_DEF_ALLOCED
)
3584 vim_free(options
[opt_idx
].def_val
[VI_DEFAULT
]);
3585 options
[opt_idx
].def_val
[VI_DEFAULT
] = p
;
3586 options
[opt_idx
].flags
|= P_DEF_ALLOCED
;
3592 * Set the Vi-default value of a number option.
3593 * Used for 'lines' and 'columns'.
3596 set_number_default(name
, val
)
3602 opt_idx
= findoption((char_u
*)name
);
3604 options
[opt_idx
].def_val
[VI_DEFAULT
] = (char_u
*)(long_i
)val
;
3607 #if defined(EXITFREE) || defined(PROTO)
3616 for (i
= 0; !istermoption(&options
[i
]); i
++)
3618 if (options
[i
].indir
== PV_NONE
)
3620 /* global option: free value and default value. */
3621 if (options
[i
].flags
& P_ALLOCED
&& options
[i
].var
!= NULL
)
3622 free_string_option(*(char_u
**)options
[i
].var
);
3623 if (options
[i
].flags
& P_DEF_ALLOCED
)
3624 free_string_option(options
[i
].def_val
[VI_DEFAULT
]);
3626 else if (options
[i
].var
!= VAR_WIN
3627 && (options
[i
].flags
& P_STRING
))
3628 /* buffer-local option: free global value */
3629 free_string_option(*(char_u
**)options
[i
].var
);
3636 * Initialize the options, part two: After getting Rows and Columns and
3645 * 'scroll' defaults to half the window height. Note that this default is
3646 * wrong when the window height changes.
3648 set_number_default("scroll", (long)((long_u
)Rows
>> 1));
3649 idx
= findoption((char_u
*)"scroll");
3650 if (idx
>= 0 && !(options
[idx
].flags
& P_WAS_SET
))
3651 set_option_default(idx
, OPT_LOCAL
, p_cp
);
3655 * 'window' is only for backwards compatibility with Vi.
3656 * Default is Rows - 1.
3658 if (!option_was_set((char_u
*)"window"))
3659 p_window
= Rows
- 1;
3660 set_number_default("window", Rows
- 1);
3662 /* For DOS console the default is always black. */
3663 #if !((defined(MSDOS) || defined(OS2) || defined(WIN3264)) && !defined(FEAT_GUI))
3665 * If 'background' wasn't set by the user, try guessing the value,
3666 * depending on the terminal name. Only need to check for terminals
3667 * with a dark background, that can handle color.
3669 idx
= findoption((char_u
*)"bg");
3670 if (idx
>= 0 && !(options
[idx
].flags
& P_WAS_SET
)
3671 && *term_bg_default() == 'd')
3673 set_string_option_direct(NULL
, idx
, (char_u
*)"dark", OPT_FREE
, 0);
3674 /* don't mark it as set, when starting the GUI it may be
3676 options
[idx
].flags
&= ~P_WAS_SET
;
3681 parse_shape_opt(SHAPE_CURSOR
); /* set cursor shapes from 'guicursor' */
3683 #ifdef FEAT_MOUSESHAPE
3684 parse_shape_opt(SHAPE_MOUSE
); /* set mouse shapes from 'mouseshape' */
3687 (void)parse_printoptions(); /* parse 'printoptions' default value */
3692 * Return "dark" or "light" depending on the kind of terminal.
3693 * This is just guessing! Recognized are:
3694 * "linux" Linux console
3695 * "screen.linux" Linux console with screen
3696 * "cygwin" Cygwin shell
3697 * "putty" Putty program
3698 * We also check the COLORFGBG environment variable, which is set by
3699 * rxvt and derivatives. This variable contains either two or three
3700 * values separated by semicolons; we want the last value in either
3701 * case. If this value is 0-6 or 8, our background is dark.
3706 #if defined(MSDOS) || defined(OS2) || defined(WIN3264)
3707 /* DOS console nearly always black */
3708 return (char_u
*)"dark";
3712 if (STRCMP(T_NAME
, "linux") == 0
3713 || STRCMP(T_NAME
, "screen.linux") == 0
3714 || STRCMP(T_NAME
, "cygwin") == 0
3715 || STRCMP(T_NAME
, "putty") == 0
3716 || ((p
= mch_getenv((char_u
*)"COLORFGBG")) != NULL
3717 && (p
= vim_strrchr(p
, ';')) != NULL
3718 && ((p
[1] >= '0' && p
[1] <= '6') || p
[1] == '8')
3720 return (char_u
*)"dark";
3721 return (char_u
*)"light";
3726 * Initialize the options, part three: After reading the .vimrc
3731 #if defined(UNIX) || defined(OS2) || defined(WIN3264)
3733 * Set 'shellpipe' and 'shellredir', depending on the 'shell' option.
3734 * This is done after other initializations, where 'shell' might have been
3735 * set, but only if they have not been set before.
3740 #ifdef FEAT_QUICKFIX
3745 idx_srr
= findoption((char_u
*)"srr");
3749 do_srr
= !(options
[idx_srr
].flags
& P_WAS_SET
);
3750 #ifdef FEAT_QUICKFIX
3751 idx_sp
= findoption((char_u
*)"sp");
3755 do_sp
= !(options
[idx_sp
].flags
& P_WAS_SET
);
3759 * Isolate the name of the shell:
3760 * - Skip beyond any path. E.g., "/usr/bin/csh -f" -> "csh -f".
3761 * - Remove any argument. E.g., "csh -f" -> "csh".
3764 p
= vim_strnsave(p
, (int)(skiptowhite(p
) - p
));
3768 * Default for p_sp is "| tee", for p_srr is ">".
3769 * For known shells it is changed here to include stderr.
3771 if ( fnamecmp(p
, "csh") == 0
3772 || fnamecmp(p
, "tcsh") == 0
3773 # if defined(OS2) || defined(WIN3264) /* also check with .exe extension */
3774 || fnamecmp(p
, "csh.exe") == 0
3775 || fnamecmp(p
, "tcsh.exe") == 0
3779 #if defined(FEAT_QUICKFIX)
3783 p_sp
= (char_u
*)">&";
3785 p_sp
= (char_u
*)"|& tee";
3787 options
[idx_sp
].def_val
[VI_DEFAULT
] = p_sp
;
3792 p_srr
= (char_u
*)">&";
3793 options
[idx_srr
].def_val
[VI_DEFAULT
] = p_srr
;
3797 # ifndef OS2 /* Always use bourne shell style redirection if we reach this */
3798 if ( fnamecmp(p
, "sh") == 0
3799 || fnamecmp(p
, "ksh") == 0
3800 || fnamecmp(p
, "zsh") == 0
3801 || fnamecmp(p
, "zsh-beta") == 0
3802 || fnamecmp(p
, "bash") == 0
3804 || fnamecmp(p
, "cmd") == 0
3805 || fnamecmp(p
, "sh.exe") == 0
3806 || fnamecmp(p
, "ksh.exe") == 0
3807 || fnamecmp(p
, "zsh.exe") == 0
3808 || fnamecmp(p
, "zsh-beta.exe") == 0
3809 || fnamecmp(p
, "bash.exe") == 0
3810 || fnamecmp(p
, "cmd.exe") == 0
3815 #if defined(FEAT_QUICKFIX)
3819 p_sp
= (char_u
*)">%s 2>&1";
3821 p_sp
= (char_u
*)"2>&1| tee";
3823 options
[idx_sp
].def_val
[VI_DEFAULT
] = p_sp
;
3828 p_srr
= (char_u
*)">%s 2>&1";
3829 options
[idx_srr
].def_val
[VI_DEFAULT
] = p_srr
;
3836 #if defined(MSDOS) || defined(WIN3264) || defined(OS2)
3838 * Set 'shellcmdflag and 'shellquote' depending on the 'shell' option.
3839 * This is done after other initializations, where 'shell' might have been
3840 * set, but only if they have not been set before. Default for p_shcf is
3841 * "/c", for p_shq is "". For "sh" like shells it is changed here to
3842 * "-c" and "\"", but not for DJGPP, because it starts the shell without
3843 * command.com. And for Win32 we need to set p_sxq instead.
3845 if (strstr((char *)gettail(p_sh
), "sh") != NULL
)
3849 idx3
= findoption((char_u
*)"shcf");
3850 if (idx3
>= 0 && !(options
[idx3
].flags
& P_WAS_SET
))
3852 p_shcf
= (char_u
*)"-c";
3853 options
[idx3
].def_val
[VI_DEFAULT
] = p_shcf
;
3858 /* Somehow Win32 requires the quotes around the redirection too */
3859 idx3
= findoption((char_u
*)"sxq");
3860 if (idx3
>= 0 && !(options
[idx3
].flags
& P_WAS_SET
))
3862 p_sxq
= (char_u
*)"\"";
3863 options
[idx3
].def_val
[VI_DEFAULT
] = p_sxq
;
3866 idx3
= findoption((char_u
*)"shq");
3867 if (idx3
>= 0 && !(options
[idx3
].flags
& P_WAS_SET
))
3869 p_shq
= (char_u
*)"\"";
3870 options
[idx3
].def_val
[VI_DEFAULT
] = p_shq
;
3878 set_title_defaults();
3882 #if defined(FEAT_MULTI_LANG) || defined(PROTO)
3884 * When 'helplang' is still at its default value, set it to "lang".
3885 * Only the first two characters of "lang" are used.
3888 set_helplang_default(lang
)
3893 if (lang
== NULL
|| STRLEN(lang
) < 2) /* safety check */
3895 idx
= findoption((char_u
*)"hlg");
3896 if (idx
>= 0 && !(options
[idx
].flags
& P_WAS_SET
))
3898 if (options
[idx
].flags
& P_ALLOCED
)
3899 free_string_option(p_hlg
);
3900 p_hlg
= vim_strsave(lang
);
3902 p_hlg
= empty_option
;
3905 /* zh_CN becomes "cn", zh_TW becomes "tw". */
3906 if (STRNICMP(p_hlg
, "zh_", 3) == 0 && STRLEN(p_hlg
) >= 5)
3908 p_hlg
[0] = TOLOWER_ASC(p_hlg
[3]);
3909 p_hlg
[1] = TOLOWER_ASC(p_hlg
[4]);
3913 options
[idx
].flags
|= P_ALLOCED
;
3919 static char_u
*gui_bg_default
__ARGS((void));
3924 if (gui_get_lightness(gui
.back_pixel
) < 127)
3925 return (char_u
*)"dark";
3926 return (char_u
*)"light";
3930 * Option initializations that can only be done after opening the GUI window.
3935 /* Set the 'background' option according to the lightness of the
3936 * background color, unless the user has set it already. */
3937 if (!option_was_set((char_u
*)"bg") && STRCMP(p_bg
, gui_bg_default()) != 0)
3939 set_option_value((char_u
*)"bg", 0L, gui_bg_default(), 0);
3940 highlight_changed();
3947 * 'title' and 'icon' only default to true if they have not been set or reset
3948 * in .vimrc and we can read the old value.
3949 * When 'title' and 'icon' have been reset in .vimrc, we won't even check if
3950 * they can be reset. This reduces startup time when using X on a remote
3954 set_title_defaults()
3960 * If GUI is (going to be) used, we can always set the window title and
3961 * icon name. Saves a bit of time, because the X11 display server does
3962 * not need to be contacted.
3964 idx1
= findoption((char_u
*)"title");
3965 if (idx1
>= 0 && !(options
[idx1
].flags
& P_WAS_SET
))
3968 if (gui
.starting
|| gui
.in_use
)
3972 val
= mch_can_restore_title();
3973 options
[idx1
].def_val
[VI_DEFAULT
] = (char_u
*)(long_i
)val
;
3976 idx1
= findoption((char_u
*)"icon");
3977 if (idx1
>= 0 && !(options
[idx1
].flags
& P_WAS_SET
))
3980 if (gui
.starting
|| gui
.in_use
)
3984 val
= mch_can_restore_icon();
3985 options
[idx1
].def_val
[VI_DEFAULT
] = (char_u
*)(long_i
)val
;
3992 * Parse 'arg' for option settings.
3994 * 'arg' may be IObuff, but only when no errors can be present and option
3995 * does not need to be expanded with option_expand().
3998 * OPT_GLOBAL for ":setglobal"
3999 * OPT_LOCAL for ":setlocal" and a modeline
4000 * OPT_MODELINE for a modeline
4001 * OPT_WINONLY to only set window-local options
4002 * OPT_NOWIN to skip setting window-local options
4004 * returns FAIL if an error is detected, OK otherwise
4007 do_set(arg
, opt_flags
)
4008 char_u
*arg
; /* option string (may be written to!) */
4015 int prefix
; /* 1: nothing, 0: "no", 2: "inv" in front of name */
4016 int nextchar
; /* next non-white char after option name */
4017 int afterchar
; /* character just after option name */
4022 long_u flags
; /* flags for current option */
4023 char_u
*varp
= NULL
; /* pointer to variable for current option */
4024 int did_show
= FALSE
; /* already showed one value */
4025 int adding
; /* "opt+=arg" */
4026 int prepending
; /* "opt^=arg" */
4027 int removing
; /* "opt-=arg" */
4033 showoptions(0, opt_flags
);
4038 while (*arg
!= NUL
) /* loop to process all options */
4041 startarg
= arg
; /* remember for error message */
4043 if (STRNCMP(arg
, "all", 3) == 0 && !isalpha(arg
[3])
4044 && !(opt_flags
& OPT_MODELINE
))
4047 * ":set all" show all options.
4048 * ":set all&" set all options to their default value.
4054 /* Only for :set command set global value of local options. */
4055 set_options_default(OPT_FREE
| opt_flags
);
4059 showoptions(1, opt_flags
);
4063 else if (STRNCMP(arg
, "termcap", 7) == 0 && !(opt_flags
& OPT_MODELINE
))
4065 showoptions(2, opt_flags
);
4073 if (STRNCMP(arg
, "no", 2) == 0 && STRNCMP(arg
, "novice", 6) != 0)
4078 else if (STRNCMP(arg
, "inv", 3) == 0)
4084 /* find end of name */
4090 /* look out for <t_>;> */
4091 if (arg
[1] == 't' && arg
[2] == '_' && arg
[3] && arg
[4])
4096 while (arg
[len
] != NUL
&& arg
[len
] != '>')
4099 if (arg
[len
] != '>')
4104 arg
[len
] = NUL
; /* put NUL after name */
4105 if (arg
[1] == 't' && arg
[2] == '_') /* could be term code */
4106 opt_idx
= findoption(arg
+ 1);
4107 arg
[len
++] = '>'; /* restore '>' */
4109 key
= find_key_option(arg
+ 1);
4115 * The two characters after "t_" may not be alphanumeric.
4117 if (arg
[0] == 't' && arg
[1] == '_' && arg
[2] && arg
[3])
4120 while (ASCII_ISALNUM(arg
[len
]) || arg
[len
] == '_')
4122 nextchar
= arg
[len
];
4123 arg
[len
] = NUL
; /* put NUL after name */
4124 opt_idx
= findoption(arg
);
4125 arg
[len
] = nextchar
; /* restore nextchar */
4127 key
= find_key_option(arg
);
4130 /* remember character after option name */
4131 afterchar
= arg
[len
];
4133 /* skip white space, allow ":set ai ?" */
4134 while (vim_iswhite(arg
[len
]))
4140 if (arg
[len
] != NUL
&& arg
[len
+ 1] == '=')
4142 if (arg
[len
] == '+')
4144 adding
= TRUE
; /* "+=" */
4147 else if (arg
[len
] == '^')
4149 prepending
= TRUE
; /* "^=" */
4152 else if (arg
[len
] == '-')
4154 removing
= TRUE
; /* "-=" */
4158 nextchar
= arg
[len
];
4160 if (opt_idx
== -1 && key
== 0) /* found a mismatch: skip */
4162 errmsg
= (char_u
*)N_("E518: Unknown option");
4168 if (options
[opt_idx
].var
== NULL
) /* hidden option: skip */
4170 /* Only give an error message when requesting the value of
4171 * a hidden option, ignore setting it. */
4172 if (vim_strchr((char_u
*)"=:!&<", nextchar
) == NULL
4173 && (!(options
[opt_idx
].flags
& P_BOOL
)
4174 || nextchar
== '?'))
4175 errmsg
= (char_u
*)N_("E519: Option not supported");
4179 flags
= options
[opt_idx
].flags
;
4180 varp
= get_varp_scope(&(options
[opt_idx
]), opt_flags
);
4187 key_name
[0] = KEY2TERMCAP0(key
);
4188 key_name
[1] = KEY2TERMCAP1(key
);
4192 key_name
[0] = KS_KEY
;
4193 key_name
[1] = (key
& 0xff);
4197 /* Skip all options that are not window-local (used when showing
4198 * an already loaded buffer in a window). */
4199 if ((opt_flags
& OPT_WINONLY
)
4200 && (opt_idx
< 0 || options
[opt_idx
].var
!= VAR_WIN
))
4203 /* Skip all options that are window-local (used for :vimgrep). */
4204 if ((opt_flags
& OPT_NOWIN
) && opt_idx
>= 0
4205 && options
[opt_idx
].var
== VAR_WIN
)
4208 /* Disallow changing some options from modelines. */
4209 if (opt_flags
& OPT_MODELINE
)
4211 if (flags
& P_SECURE
)
4213 errmsg
= (char_u
*)_("E520: Not allowed in a modeline");
4217 /* In diff mode some options are overruled. This avoids that
4218 * 'foldmethod' becomes "marker" instead of "diff" and that
4219 * "wrap" gets set. */
4220 if (curwin
->w_p_diff
4221 && (options
[opt_idx
].indir
== PV_FDM
4222 || options
[opt_idx
].indir
== PV_WRAP
))
4228 /* Disallow changing some options in the sandbox */
4229 if (sandbox
!= 0 && (flags
& P_SECURE
))
4231 errmsg
= (char_u
*)_(e_sandbox
);
4236 if (vim_strchr((char_u
*)"?=:!&<", nextchar
) != NULL
)
4240 if (nextchar
== '&' && arg
[1] == 'v' && arg
[2] == 'i')
4242 if (arg
[3] == 'm') /* "opt&vim": set to Vim default */
4247 else /* "opt&vi": set to Vi default */
4253 if (vim_strchr((char_u
*)"?!&<", nextchar
) != NULL
4254 && arg
[1] != NUL
&& !vim_iswhite(arg
[1]))
4256 errmsg
= e_trailing
;
4262 * allow '=' and ':' as MSDOS command.com allows only one
4263 * '=' character per "set" command line. grrr. (jw)
4267 && vim_strchr((char_u
*)"=:&<", nextchar
) == NULL
4268 && !(flags
& P_BOOL
)))
4274 msg_putchar('\n'); /* cursor below last one */
4277 gotocmdline(TRUE
); /* cursor at status line */
4278 did_show
= TRUE
; /* remember that we did a line */
4282 showoneopt(&options
[opt_idx
], opt_flags
);
4286 /* Mention where the option was last set. */
4287 if (varp
== options
[opt_idx
].var
)
4288 last_set_msg(options
[opt_idx
].scriptID
);
4289 else if ((int)options
[opt_idx
].indir
& PV_WIN
)
4290 last_set_msg(curwin
->w_p_scriptID
[
4291 (int)options
[opt_idx
].indir
& PV_MASK
]);
4292 else if ((int)options
[opt_idx
].indir
& PV_BUF
)
4293 last_set_msg(curbuf
->b_p_scriptID
[
4294 (int)options
[opt_idx
].indir
& PV_MASK
]);
4302 p
= find_termcode(key_name
);
4305 errmsg
= (char_u
*)N_("E518: Unknown option");
4309 (void)show_one_termcode(key_name
, p
, TRUE
);
4312 && nextchar
!= NUL
&& !vim_iswhite(afterchar
))
4313 errmsg
= e_trailing
;
4317 if (flags
& P_BOOL
) /* boolean */
4319 if (nextchar
== '=' || nextchar
== ':')
4326 * ":set opt!": invert
4327 * ":set opt&": reset to default value
4328 * ":set opt<": reset to global value
4330 if (nextchar
== '!')
4331 value
= *(int *)(varp
) ^ 1;
4332 else if (nextchar
== '&')
4333 value
= (int)(long)(long_i
)options
[opt_idx
].def_val
[
4334 ((flags
& P_VI_DEF
) || cp_val
)
4335 ? VI_DEFAULT
: VIM_DEFAULT
];
4336 else if (nextchar
== '<')
4338 /* For 'autoread' -1 means to use global value. */
4339 if ((int *)varp
== &curbuf
->b_p_ar
4340 && opt_flags
== OPT_LOCAL
)
4343 value
= *(int *)get_varp_scope(&(options
[opt_idx
]),
4349 * ":set invopt": invert
4350 * ":set opt" or ":set noopt": set or reset
4352 if (nextchar
!= NUL
&& !vim_iswhite(afterchar
))
4354 errmsg
= e_trailing
;
4357 if (prefix
== 2) /* inv */
4358 value
= *(int *)(varp
) ^ 1;
4363 errmsg
= set_bool_option(opt_idx
, varp
, (int)value
,
4366 else /* numeric or string */
4368 if (vim_strchr((char_u
*)"=:&<", nextchar
) == NULL
4375 if (flags
& P_NUM
) /* numeric */
4378 * Different ways to set a number option:
4379 * & set to default value
4380 * < set to global value
4381 * <xx> accept special key codes for 'wildchar'
4382 * c accept any non-digit for 'wildchar'
4387 if (nextchar
== '&')
4388 value
= (long)(long_i
)options
[opt_idx
].def_val
[
4389 ((flags
& P_VI_DEF
) || cp_val
)
4390 ? VI_DEFAULT
: VIM_DEFAULT
];
4391 else if (nextchar
== '<')
4392 value
= *(long *)get_varp_scope(&(options
[opt_idx
]),
4394 else if (((long *)varp
== &p_wc
4395 || (long *)varp
== &p_wcm
)
4398 || ((!arg
[1] || vim_iswhite(arg
[1]))
4399 && !VIM_ISDIGIT(*arg
))))
4401 value
= string_to_key(arg
);
4402 if (value
== 0 && (long *)varp
!= &p_wcm
)
4408 /* allow negative numbers (for 'undolevels') */
4409 else if (*arg
== '-' || VIM_ISDIGIT(*arg
))
4415 value
= strtol((char *)arg
, NULL
, 0);
4416 if (arg
[i
] == '0' && TOLOWER_ASC(arg
[i
+ 1]) == 'x')
4419 value
= atol((char *)arg
);
4421 while (VIM_ISDIGIT(arg
[i
]))
4423 if (arg
[i
] != NUL
&& !vim_iswhite(arg
[i
]))
4431 errmsg
= (char_u
*)N_("E521: Number required after =");
4436 value
= *(long *)varp
+ value
;
4438 value
= *(long *)varp
* value
;
4440 value
= *(long *)varp
- value
;
4441 errmsg
= set_num_option(opt_idx
, varp
, value
,
4442 errbuf
, sizeof(errbuf
), opt_flags
);
4444 else if (opt_idx
>= 0) /* string */
4446 char_u
*save_arg
= NULL
;
4448 char_u
*oldval
; /* previous value if *varp */
4454 int new_value_alloced
; /* new string option
4457 /* When using ":set opt=val" for a global option
4458 * with a local value the local value will be
4459 * reset, use the global value here. */
4460 if ((opt_flags
& (OPT_LOCAL
| OPT_GLOBAL
)) == 0
4461 && ((int)options
[opt_idx
].indir
& PV_BOTH
))
4462 varp
= options
[opt_idx
].var
;
4464 /* The old value is kept until we are sure that the
4465 * new value is valid. */
4466 oldval
= *(char_u
**)varp
;
4467 if (nextchar
== '&') /* set to default val */
4469 newval
= options
[opt_idx
].def_val
[
4470 ((flags
& P_VI_DEF
) || cp_val
)
4471 ? VI_DEFAULT
: VIM_DEFAULT
];
4472 if ((char_u
**)varp
== &p_bg
)
4474 /* guess the value of 'background' */
4477 newval
= gui_bg_default();
4480 newval
= term_bg_default();
4483 /* expand environment variables and ~ (since the
4484 * default value was already expanded, only
4485 * required when an environment variable was set
4488 newval
= empty_option
;
4491 s
= option_expand(opt_idx
, newval
);
4494 newval
= vim_strsave(s
);
4496 new_value_alloced
= TRUE
;
4498 else if (nextchar
== '<') /* set to global val */
4500 newval
= vim_strsave(*(char_u
**)get_varp_scope(
4501 &(options
[opt_idx
]), OPT_GLOBAL
));
4502 new_value_alloced
= TRUE
;
4506 ++arg
; /* jump to after the '=' or ':' */
4509 * Set 'keywordprg' to ":help" if an empty
4510 * value was passed to :set by the user.
4511 * Misuse errbuf[] for the resulting string.
4513 if (varp
== (char_u
*)&p_kp
4514 && (*arg
== NUL
|| *arg
== ' '))
4516 STRCPY(errbuf
, ":help");
4521 * Convert 'whichwrap' number to string, for
4522 * backwards compatibility with Vim 3.0.
4523 * Misuse errbuf[] for the resulting string.
4525 else if (varp
== (char_u
*)&p_ww
4526 && VIM_ISDIGIT(*arg
))
4529 i
= getdigits(&arg
);
4531 STRCAT(errbuf
, "b,");
4533 STRCAT(errbuf
, "s,");
4535 STRCAT(errbuf
, "h,l,");
4537 STRCAT(errbuf
, "<,>,");
4539 STRCAT(errbuf
, "[,],");
4540 if (*errbuf
!= NUL
) /* remove trailing , */
4541 errbuf
[STRLEN(errbuf
) - 1] = NUL
;
4546 * Remove '>' before 'dir' and 'bdir', for
4547 * backwards compatibility with version 3.0
4549 else if ( *arg
== '>'
4550 && (varp
== (char_u
*)&p_dir
4551 || varp
== (char_u
*)&p_bdir
))
4556 /* When setting the local value of a global
4557 * option, the old value may be the global value. */
4558 if (((int)options
[opt_idx
].indir
& PV_BOTH
)
4559 && (opt_flags
& OPT_LOCAL
))
4560 origval
= *(char_u
**)get_varp(
4566 * Copy the new string into allocated memory.
4567 * Can't use set_string_option_direct(), because
4568 * we need to remove the backslashes.
4570 /* get a bit too much */
4571 newlen
= (unsigned)STRLEN(arg
) + 1;
4572 if (adding
|| prepending
|| removing
)
4573 newlen
+= (unsigned)STRLEN(origval
) + 1;
4574 newval
= alloc(newlen
);
4575 if (newval
== NULL
) /* out of mem, don't change */
4580 * Copy the string, skip over escaped chars.
4581 * For MS-DOS and WIN32 backslashes before normal
4582 * file name characters are not removed, and keep
4583 * backslash at start, for "\\machine\path", but
4584 * do remove it for "\\\\machine\\path".
4585 * The reverse is found in ExpandOldSetting().
4587 while (*arg
&& !vim_iswhite(*arg
))
4589 if (*arg
== '\\' && arg
[1] != NUL
4590 #ifdef BACKSLASH_IN_FILENAME
4591 && !((flags
& P_EXPAND
)
4592 && vim_isfilec(arg
[1])
4595 && arg
[2] != '\\')))
4598 ++arg
; /* remove backslash */
4601 && (i
= (*mb_ptr2len
)(arg
)) > 1)
4603 /* copy multibyte char */
4604 mch_memmove(s
, arg
, (size_t)i
);
4615 * Expand environment variables and ~.
4616 * Don't do it when adding without inserting a
4619 if (!(adding
|| prepending
|| removing
)
4620 || (flags
& P_COMMA
))
4622 s
= option_expand(opt_idx
, newval
);
4626 newlen
= (unsigned)STRLEN(s
) + 1;
4627 if (adding
|| prepending
|| removing
)
4628 newlen
+= (unsigned)STRLEN(origval
) + 1;
4629 newval
= alloc(newlen
);
4636 /* locate newval[] in origval[] when removing it
4637 * and when adding to avoid duplicates */
4638 i
= 0; /* init for GCC */
4639 if (removing
|| (flags
& P_NODUP
))
4641 i
= (int)STRLEN(newval
);
4643 for (s
= origval
; *s
; ++s
)
4645 if ((!(flags
& P_COMMA
)
4647 || (s
[-1] == ',' && !(bs
& 1)))
4648 && STRNCMP(s
, newval
, i
) == 0
4649 && (!(flags
& P_COMMA
)
4653 /* Count backspaces. Only a comma with an
4654 * even number of backspaces before it is
4655 * recognized as a separator */
4656 if (s
> origval
&& s
[-1] == '\\')
4662 /* do not add if already there */
4663 if ((adding
|| prepending
) && *s
)
4667 STRCPY(newval
, origval
);
4671 /* concatenate the two strings; add a ',' if
4673 if (adding
|| prepending
)
4675 comma
= ((flags
& P_COMMA
) && *origval
!= NUL
4679 i
= (int)STRLEN(origval
);
4680 mch_memmove(newval
+ i
+ comma
, newval
,
4681 STRLEN(newval
) + 1);
4682 mch_memmove(newval
, origval
, (size_t)i
);
4686 i
= (int)STRLEN(newval
);
4687 STRMOVE(newval
+ i
+ comma
, origval
);
4693 /* Remove newval[] from origval[]. (Note: "i" has
4694 * been set above and is used here). */
4697 STRCPY(newval
, origval
);
4700 /* may need to remove a comma */
4701 if (flags
& P_COMMA
)
4705 /* include comma after string */
4711 /* include comma before string */
4716 STRMOVE(newval
+ (s
- origval
), s
+ i
);
4720 if (flags
& P_FLAGLIST
)
4722 /* Remove flags that appear twice. */
4723 for (s
= newval
; *s
; ++s
)
4724 if ((!(flags
& P_COMMA
) || *s
!= ',')
4725 && vim_strchr(s
+ 1, *s
) != NULL
)
4732 if (save_arg
!= NULL
) /* number for 'whichwrap' */
4734 new_value_alloced
= TRUE
;
4737 /* Set the new value. */
4738 *(char_u
**)(varp
) = newval
;
4740 /* Handle side effects, and set the global value for
4741 * ":set" on local options. */
4742 errmsg
= did_set_string_option(opt_idx
, (char_u
**)varp
,
4743 new_value_alloced
, oldval
, errbuf
, opt_flags
);
4745 /* If error detected, print the error message. */
4749 else /* key code option */
4753 if (nextchar
== '&')
4755 if (add_termcap_entry(key_name
, TRUE
) == FAIL
)
4756 errmsg
= (char_u
*)N_("E522: Not found in termcap");
4760 ++arg
; /* jump to after the '=' or ':' */
4761 for (p
= arg
; *p
&& !vim_iswhite(*p
); ++p
)
4762 if (*p
== '\\' && p
[1] != NUL
)
4766 add_termcode(key_name
, arg
, FALSE
);
4771 redraw_all_later(CLEAR
);
4776 did_set_option(opt_idx
, opt_flags
,
4777 !prepending
&& !adding
&& !removing
);
4782 * Advance to next argument.
4783 * - skip until a blank found, taking care of backslashes
4785 * - skip one "=val" argument (for hidden options ":set gfn =xx")
4787 for (i
= 0; i
< 2 ; ++i
)
4789 while (*arg
!= NUL
&& !vim_iswhite(*arg
))
4790 if (*arg
++ == '\\' && *arg
!= NUL
)
4792 arg
= skipwhite(arg
);
4800 vim_strncpy(IObuff
, (char_u
*)_(errmsg
), IOSIZE
- 1);
4801 i
= (int)STRLEN(IObuff
) + 2;
4802 if (i
+ (arg
- startarg
) < IOSIZE
)
4804 /* append the argument with the error */
4805 STRCAT(IObuff
, ": ");
4806 mch_memmove(IObuff
+ i
, startarg
, (arg
- startarg
));
4807 IObuff
[i
+ (arg
- startarg
)] = NUL
;
4809 /* make sure all characters are printable */
4810 trans_characters(IObuff
, IOSIZE
);
4812 ++no_wait_return
; /* wait_return done later */
4813 emsg(IObuff
); /* show error highlighted */
4819 arg
= skipwhite(arg
);
4823 if (silent_mode
&& did_show
)
4825 /* After displaying option values in silent mode. */
4826 silent_mode
= FALSE
;
4827 info_message
= TRUE
; /* use mch_msg(), not mch_errmsg() */
4829 cursor_on(); /* msg_start() switches it off */
4832 info_message
= FALSE
; /* use mch_msg(), not mch_errmsg() */
4839 * Call this when an option has been given a new value through a user command.
4840 * Sets the P_WAS_SET flag and takes care of the P_INSECURE flag.
4843 did_set_option(opt_idx
, opt_flags
, new_value
)
4845 int opt_flags
; /* possibly with OPT_MODELINE */
4846 int new_value
; /* value was replaced completely */
4850 options
[opt_idx
].flags
|= P_WAS_SET
;
4852 /* When an option is set in the sandbox, from a modeline or in secure mode
4853 * set the P_INSECURE flag. Otherwise, if a new value is stored reset the
4855 p
= insecure_flag(opt_idx
, opt_flags
);
4860 || (opt_flags
& OPT_MODELINE
))
4861 *p
= *p
| P_INSECURE
;
4863 *p
= *p
& ~P_INSECURE
;
4867 illegal_char(errbuf
, c
)
4872 return (char_u
*)"";
4873 sprintf((char *)errbuf
, _("E539: Illegal character <%s>"),
4874 (char *)transchar(c
));
4879 * Convert a key name or string into a key value.
4880 * Used for 'wildchar' and 'cedit' options.
4887 return find_key_option(arg
+ 1);
4889 return Ctrl_chr(arg
[1]);
4895 * Check value of 'cedit' and set cedit_key.
4896 * Returns NULL if value is OK, error message otherwise.
4903 if (*p_cedit
== NUL
)
4907 n
= string_to_key(p_cedit
);
4908 if (vim_isprintc(n
))
4918 * When changing 'title', 'titlestring', 'icon' or 'iconstring', call
4919 * maketitle() to create and display it.
4920 * When switching the title or icon off, call mch_restore_title() to get
4921 * the old value back.
4925 int icon
; /* Did set icon instead of title */
4927 if (starting
!= NO_SCREEN
4937 mch_restore_title(2);
4942 mch_restore_title(1);
4949 * set_options_bin - called when 'bin' changes value.
4952 set_options_bin(oldval
, newval
, opt_flags
)
4955 int opt_flags
; /* OPT_LOCAL and/or OPT_GLOBAL */
4958 * The option values that are changed when 'bin' changes are
4959 * copied when 'bin is set and restored when 'bin' is reset.
4963 if (!oldval
) /* switched on */
4965 if (!(opt_flags
& OPT_GLOBAL
))
4967 curbuf
->b_p_tw_nobin
= curbuf
->b_p_tw
;
4968 curbuf
->b_p_wm_nobin
= curbuf
->b_p_wm
;
4969 curbuf
->b_p_ml_nobin
= curbuf
->b_p_ml
;
4970 curbuf
->b_p_et_nobin
= curbuf
->b_p_et
;
4972 if (!(opt_flags
& OPT_LOCAL
))
4981 if (!(opt_flags
& OPT_GLOBAL
))
4983 curbuf
->b_p_tw
= 0; /* no automatic line wrap */
4984 curbuf
->b_p_wm
= 0; /* no automatic line wrap */
4985 curbuf
->b_p_ml
= 0; /* no modelines */
4986 curbuf
->b_p_et
= 0; /* no expandtab */
4988 if (!(opt_flags
& OPT_LOCAL
))
4994 p_bin
= TRUE
; /* needed when called for the "-b" argument */
4997 else if (oldval
) /* switched off */
4999 if (!(opt_flags
& OPT_GLOBAL
))
5001 curbuf
->b_p_tw
= curbuf
->b_p_tw_nobin
;
5002 curbuf
->b_p_wm
= curbuf
->b_p_wm_nobin
;
5003 curbuf
->b_p_ml
= curbuf
->b_p_ml_nobin
;
5004 curbuf
->b_p_et
= curbuf
->b_p_et_nobin
;
5006 if (!(opt_flags
& OPT_LOCAL
))
5018 * Find the parameter represented by the given character (eg ', :, ", or /),
5019 * and return its associated value in the 'viminfo' string.
5020 * Only works for number parameters, not for 'r' or 'n'.
5021 * If the parameter is not specified in the string or there is no following
5022 * number, return -1.
5025 get_viminfo_parameter(type
)
5030 p
= find_viminfo_parameter(type
);
5031 if (p
!= NULL
&& VIM_ISDIGIT(*p
))
5032 return atoi((char *)p
);
5037 * Find the parameter represented by the given character (eg ''', ':', '"', or
5038 * '/') in the 'viminfo' option and return a pointer to the string after it.
5039 * Return NULL if the parameter is not specified in the string.
5042 find_viminfo_parameter(type
)
5047 for (p
= p_viminfo
; *p
; ++p
)
5051 if (*p
== 'n') /* 'n' is always the last one */
5053 p
= vim_strchr(p
, ','); /* skip until next ',' */
5054 if (p
== NULL
) /* hit the end without finding parameter */
5062 * Expand environment variables for some string options.
5063 * These string options cannot be indirect!
5064 * If "val" is NULL expand the current value of the option.
5065 * Return pointer to NameBuff, or NULL when not expanded.
5068 option_expand(opt_idx
, val
)
5072 /* if option doesn't need expansion nothing to do */
5073 if (!(options
[opt_idx
].flags
& P_EXPAND
) || options
[opt_idx
].var
== NULL
)
5076 /* If val is longer than MAXPATHL no meaningful expansion can be done,
5077 * expand_env() would truncate the string. */
5078 if (val
!= NULL
&& STRLEN(val
) > MAXPATHL
)
5082 val
= *(char_u
**)options
[opt_idx
].var
;
5085 * Expanding this with NameBuff, expand_env() must not be passed IObuff.
5086 * Escape spaces when expanding 'tags', they are used to separate file
5088 * For 'spellsuggest' expand after "file:".
5090 expand_env_esc(val
, NameBuff
, MAXPATHL
,
5091 (char_u
**)options
[opt_idx
].var
== &p_tags
, FALSE
,
5093 (char_u
**)options
[opt_idx
].var
== &p_sps
? (char_u
*)"file:" :
5096 if (STRCMP(NameBuff
, val
) == 0) /* they are the same */
5103 * After setting various option values: recompute variables that depend on
5109 /* initialize the table for 'iskeyword' et.al. */
5110 (void)init_chartab();
5113 (void)opt_strings_flags(p_cmp
, p_cmp_values
, &cmp_flags
, TRUE
);
5115 (void)opt_strings_flags(p_bkc
, p_bkc_values
, &bkc_flags
, TRUE
);
5117 (void)opt_strings_flags(p_ssop
, p_ssop_values
, &ssop_flags
, TRUE
);
5118 (void)opt_strings_flags(p_vop
, p_ssop_values
, &vop_flags
, TRUE
);
5121 (void)opt_strings_flags(p_fdo
, p_fdo_values
, &fdo_flags
, TRUE
);
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 (void)opt_strings_flags(p_tbis
, p_tbis_values
, &tbis_flags
, FALSE
);
5143 (void)check_cedit();
5146 tabstop_set(curbuf
->b_p_vsts
, &curbuf
->b_p_vsts_ary
);
5147 tabstop_set(curbuf
->b_p_vts
, &curbuf
->b_p_vts_ary
);
5152 * Check for string options that are NULL (normally only termcap options).
5159 for (opt_idx
= 0; options
[opt_idx
].fullname
!= NULL
; opt_idx
++)
5160 if ((options
[opt_idx
].flags
& P_STRING
) && options
[opt_idx
].var
!= NULL
)
5161 check_string_option((char_u
**)get_varp(&(options
[opt_idx
])));
5165 * Check string options in a buffer for NULL value.
5168 check_buf_options(buf
)
5171 #if defined(FEAT_QUICKFIX)
5172 check_string_option(&buf
->b_p_bh
);
5173 check_string_option(&buf
->b_p_bt
);
5176 check_string_option(&buf
->b_p_fenc
);
5178 check_string_option(&buf
->b_p_ff
);
5180 check_string_option(&buf
->b_p_def
);
5181 check_string_option(&buf
->b_p_inc
);
5183 check_string_option(&buf
->b_p_inex
);
5186 #if defined(FEAT_CINDENT) && defined(FEAT_EVAL)
5187 check_string_option(&buf
->b_p_inde
);
5188 check_string_option(&buf
->b_p_indk
);
5190 #if defined(FEAT_BEVAL) && defined(FEAT_EVAL)
5191 check_string_option(&buf
->b_p_bexpr
);
5193 #if defined(FEAT_EVAL)
5194 check_string_option(&buf
->b_p_fex
);
5197 check_string_option(&buf
->b_p_key
);
5199 check_string_option(&buf
->b_p_kp
);
5200 check_string_option(&buf
->b_p_mps
);
5201 check_string_option(&buf
->b_p_fo
);
5202 check_string_option(&buf
->b_p_flp
);
5203 check_string_option(&buf
->b_p_isk
);
5204 #ifdef FEAT_COMMENTS
5205 check_string_option(&buf
->b_p_com
);
5208 check_string_option(&buf
->b_p_cms
);
5210 check_string_option(&buf
->b_p_nf
);
5212 check_string_option(&buf
->b_p_qe
);
5215 check_string_option(&buf
->b_p_syn
);
5218 check_string_option(&buf
->b_p_spc
);
5219 check_string_option(&buf
->b_p_spf
);
5220 check_string_option(&buf
->b_p_spl
);
5222 #ifdef FEAT_SEARCHPATH
5223 check_string_option(&buf
->b_p_sua
);
5226 check_string_option(&buf
->b_p_cink
);
5227 check_string_option(&buf
->b_p_cino
);
5230 check_string_option(&buf
->b_p_ft
);
5232 #ifdef FEAT_OSFILETYPE
5233 check_string_option(&buf
->b_p_oft
);
5235 #if defined(FEAT_SMARTINDENT) || defined(FEAT_CINDENT)
5236 check_string_option(&buf
->b_p_cinw
);
5238 #ifdef FEAT_INS_EXPAND
5239 check_string_option(&buf
->b_p_cpt
);
5241 #ifdef FEAT_COMPL_FUNC
5242 check_string_option(&buf
->b_p_cfu
);
5243 check_string_option(&buf
->b_p_ofu
);
5246 check_string_option(&buf
->b_p_keymap
);
5248 #ifdef FEAT_QUICKFIX
5249 check_string_option(&buf
->b_p_gp
);
5250 check_string_option(&buf
->b_p_mp
);
5251 check_string_option(&buf
->b_p_efm
);
5253 check_string_option(&buf
->b_p_ep
);
5254 check_string_option(&buf
->b_p_path
);
5255 check_string_option(&buf
->b_p_tags
);
5256 #ifdef FEAT_INS_EXPAND
5257 check_string_option(&buf
->b_p_dict
);
5258 check_string_option(&buf
->b_p_tsr
);
5261 check_string_option(&buf
->b_p_vsts
);
5262 check_string_option(&buf
->b_p_vts
);
5267 * Free the string allocated for an option.
5268 * Checks for the string being empty_option. This may happen if we're out of
5269 * memory, vim_strsave() returned NULL, which was replaced by empty_option by
5271 * Does NOT check for P_ALLOCED flag!
5274 free_string_option(p
)
5277 if (p
!= empty_option
)
5282 clear_string_option(pp
)
5285 if (*pp
!= empty_option
)
5291 check_string_option(pp
)
5299 * Mark a terminal option as allocated, found by a pointer into term_strings[].
5302 set_term_option_alloced(p
)
5307 for (opt_idx
= 1; options
[opt_idx
].fullname
!= NULL
; opt_idx
++)
5308 if (options
[opt_idx
].var
== (char_u
*)p
)
5310 options
[opt_idx
].flags
|= P_ALLOCED
;
5313 return; /* cannot happen: didn't find it! */
5316 #if defined(FEAT_EVAL) || defined(PROTO)
5318 * Return TRUE when option "opt" was set from a modeline or in secure mode.
5319 * Return FALSE when it wasn't.
5320 * Return -1 for an unknown option.
5323 was_set_insecurely(opt
, opt_flags
)
5327 int idx
= findoption(opt
);
5332 flagp
= insecure_flag(idx
, opt_flags
);
5333 return (*flagp
& P_INSECURE
) != 0;
5335 EMSG2(_(e_intern2
), "was_set_insecurely()");
5340 * Get a pointer to the flags used for the P_INSECURE flag of option
5341 * "opt_idx". For some local options a local flags field is used.
5344 insecure_flag(opt_idx
, opt_flags
)
5348 if (opt_flags
& OPT_LOCAL
)
5349 switch ((int)options
[opt_idx
].indir
)
5352 case PV_STL
: return &curwin
->w_p_stl_flags
;
5355 # ifdef FEAT_FOLDING
5356 case PV_FDE
: return &curwin
->w_p_fde_flags
;
5357 case PV_FDT
: return &curwin
->w_p_fdt_flags
;
5360 case PV_BEXPR
: return &curbuf
->b_p_bexpr_flags
;
5362 # if defined(FEAT_CINDENT)
5363 case PV_INDE
: return &curbuf
->b_p_inde_flags
;
5365 case PV_FEX
: return &curbuf
->b_p_fex_flags
;
5366 # ifdef FEAT_FIND_ID
5367 case PV_INEX
: return &curbuf
->b_p_inex_flags
;
5372 /* Nothing special, return global flags field. */
5373 return &options
[opt_idx
].flags
;
5378 static void redraw_titles
__ARGS((void));
5381 * Redraw the window title and/or tab page text later.
5383 static void redraw_titles()
5385 need_maketitle
= TRUE
;
5386 # ifdef FEAT_WINDOWS
5387 redraw_tabline
= TRUE
;
5393 * Set a string option to a new value (without checking the effect).
5394 * The string is copied into allocated memory.
5395 * if ("opt_idx" == -1) "name" is used, otherwise "opt_idx" is used.
5396 * When "set_sid" is zero set the scriptID to current_SID. When "set_sid" is
5397 * SID_NONE don't set the scriptID. Otherwise set the scriptID to "set_sid".
5400 set_string_option_direct(name
, opt_idx
, val
, opt_flags
, set_sid
)
5404 int opt_flags
; /* OPT_FREE, OPT_LOCAL and/or OPT_GLOBAL */
5409 int both
= (opt_flags
& (OPT_LOCAL
| OPT_GLOBAL
)) == 0;
5412 if (idx
== -1) /* use name */
5414 idx
= findoption(name
);
5415 if (idx
< 0) /* not found (should not happen) */
5417 EMSG2(_(e_intern2
), "set_string_option_direct()");
5422 if (options
[idx
].var
== NULL
) /* can't set hidden option */
5425 s
= vim_strsave(val
);
5428 varp
= (char_u
**)get_varp_scope(&(options
[idx
]),
5429 both
? OPT_LOCAL
: opt_flags
);
5430 if ((opt_flags
& OPT_FREE
) && (options
[idx
].flags
& P_ALLOCED
))
5431 free_string_option(*varp
);
5434 /* For buffer/window local option may also set the global value. */
5436 set_string_option_global(idx
, varp
);
5438 options
[idx
].flags
|= P_ALLOCED
;
5440 /* When setting both values of a global option with a local value,
5441 * make the local value empty, so that the global value is used. */
5442 if (((int)options
[idx
].indir
& PV_BOTH
) && both
)
5444 free_string_option(*varp
);
5445 *varp
= empty_option
;
5448 if (set_sid
!= SID_NONE
)
5449 set_option_scriptID_idx(idx
, opt_flags
,
5450 set_sid
== 0 ? current_SID
: set_sid
);
5456 * Set global value for string option when it's a local option.
5459 set_string_option_global(opt_idx
, varp
)
5460 int opt_idx
; /* option index */
5461 char_u
**varp
; /* pointer to option variable */
5465 /* the global value is always allocated */
5466 if (options
[opt_idx
].var
== VAR_WIN
)
5467 p
= (char_u
**)GLOBAL_WO(varp
);
5469 p
= (char_u
**)options
[opt_idx
].var
;
5470 if (options
[opt_idx
].indir
!= PV_NONE
5472 && (s
= vim_strsave(*varp
)) != NULL
)
5474 free_string_option(*p
);
5480 * Set a string option to a new value, and handle the effects.
5483 set_string_option(opt_idx
, value
, opt_flags
)
5486 int opt_flags
; /* OPT_LOCAL and/or OPT_GLOBAL */
5492 if (options
[opt_idx
].var
== NULL
) /* don't set hidden option */
5495 s
= vim_strsave(value
);
5498 varp
= (char_u
**)get_varp_scope(&(options
[opt_idx
]),
5499 (opt_flags
& (OPT_LOCAL
| OPT_GLOBAL
)) == 0
5500 ? (((int)options
[opt_idx
].indir
& PV_BOTH
)
5501 ? OPT_GLOBAL
: OPT_LOCAL
)
5505 if (did_set_string_option(opt_idx
, varp
, TRUE
, oldval
, NULL
,
5507 did_set_option(opt_idx
, opt_flags
, TRUE
);
5512 * Handle string options that need some action to perform when changed.
5513 * Returns NULL for success, or an error message for an error.
5516 did_set_string_option(opt_idx
, varp
, new_value_alloced
, oldval
, errbuf
,
5518 int opt_idx
; /* index in options[] table */
5519 char_u
**varp
; /* pointer to the option variable */
5520 int new_value_alloced
; /* new value was allocated */
5521 char_u
*oldval
; /* previous value of the option */
5522 char_u
*errbuf
; /* buffer for errors, or NULL */
5523 int opt_flags
; /* OPT_LOCAL and/or OPT_GLOBAL */
5525 char_u
*errmsg
= NULL
;
5527 int did_chartab
= FALSE
;
5529 long_u free_oldval
= (options
[opt_idx
].flags
& P_ALLOCED
);
5531 /* set when changing an option that only requires a redraw in the GUI */
5532 int redraw_gui_only
= FALSE
;
5535 /* Get the global option to compare with, otherwise we would have to check
5536 * two values for all local options. */
5537 gvarp
= (char_u
**)get_varp_scope(&(options
[opt_idx
]), OPT_GLOBAL
);
5539 /* Disallow changing some options from secure mode */
5544 ) && (options
[opt_idx
].flags
& P_SECURE
))
5549 /* Check for a "normal" file name in some options. Disallow a path
5550 * separator (slash and/or backslash), wildcards and characters that are
5551 * often illegal in a file name. */
5552 else if ((options
[opt_idx
].flags
& P_NFNAME
)
5553 && vim_strpbrk(*varp
, (char_u
*)"/\\*?[|<>") != NULL
)
5559 else if (varp
== &T_NAME
)
5561 if (T_NAME
[0] == NUL
)
5562 errmsg
= (char_u
*)N_("E529: Cannot set 'term' to empty string");
5565 errmsg
= (char_u
*)N_("E530: Cannot change term in GUI");
5566 else if (term_is_gui(T_NAME
))
5567 errmsg
= (char_u
*)N_("E531: Use \":gui\" to start the GUI");
5569 else if (set_termname(T_NAME
) == FAIL
)
5570 errmsg
= (char_u
*)N_("E522: Not found in termcap");
5572 /* Screen colors may have changed. */
5573 redraw_later_clear();
5577 else if (varp
== &p_bkc
)
5579 if (opt_strings_flags(p_bkc
, p_bkc_values
, &bkc_flags
, TRUE
) != OK
)
5581 if (((bkc_flags
& BKC_AUTO
) != 0)
5582 + ((bkc_flags
& BKC_YES
) != 0)
5583 + ((bkc_flags
& BKC_NO
) != 0) != 1)
5585 /* Must have exactly one of "auto", "yes" and "no". */
5586 (void)opt_strings_flags(oldval
, p_bkc_values
, &bkc_flags
, TRUE
);
5591 /* 'backupext' and 'patchmode' */
5592 else if (varp
== &p_bex
|| varp
== &p_pm
)
5594 if (STRCMP(*p_bex
== '.' ? p_bex
+ 1 : p_bex
,
5595 *p_pm
== '.' ? p_pm
+ 1 : p_pm
) == 0)
5596 errmsg
= (char_u
*)N_("E589: 'backupext' and 'patchmode' are equal");
5600 * 'isident', 'iskeyword', 'isprint or 'isfname' option: refill chartab[]
5601 * If the new option is invalid, use old value. 'lisp' option: refill
5602 * chartab[] for '-' char
5604 else if ( varp
== &p_isi
5605 || varp
== &(curbuf
->b_p_isk
)
5609 if (init_chartab() == FAIL
)
5611 did_chartab
= TRUE
; /* need to restore it below */
5612 errmsg
= e_invarg
; /* error in value */
5617 else if (varp
== &p_hf
)
5619 /* May compute new values for $VIM and $VIMRUNTIME */
5622 vim_setenv((char_u
*)"VIM", (char_u
*)"");
5625 if (didset_vimruntime
)
5627 vim_setenv((char_u
*)"VIMRUNTIME", (char_u
*)"");
5628 didset_vimruntime
= FALSE
;
5632 #ifdef FEAT_MULTI_LANG
5634 else if (varp
== &p_hlg
)
5636 /* Check for "", "ab", "ab,cd", etc. */
5637 for (s
= p_hlg
; *s
!= NUL
; s
+= 3)
5639 if (s
[1] == NUL
|| ((s
[2] != ',' || s
[3] == NUL
) && s
[2] != NUL
))
5651 else if (varp
== &p_hl
)
5653 if (highlight_changed() == FAIL
)
5654 errmsg
= e_invarg
; /* invalid flags */
5658 else if (gvarp
== &p_nf
)
5660 if (check_opt_strings(*varp
, p_nf_values
, TRUE
) != OK
)
5665 /* 'sessionoptions' */
5666 else if (varp
== &p_ssop
)
5668 if (opt_strings_flags(p_ssop
, p_ssop_values
, &ssop_flags
, TRUE
) != OK
)
5670 if ((ssop_flags
& SSOP_CURDIR
) && (ssop_flags
& SSOP_SESDIR
))
5672 /* Don't allow both "sesdir" and "curdir". */
5673 (void)opt_strings_flags(oldval
, p_ssop_values
, &ssop_flags
, TRUE
);
5678 else if (varp
== &p_vop
)
5680 if (opt_strings_flags(p_vop
, p_ssop_values
, &vop_flags
, TRUE
) != OK
)
5686 #ifdef FEAT_SCROLLBIND
5687 else if (varp
== &p_sbo
)
5689 if (check_opt_strings(p_sbo
, p_scbopt_values
, TRUE
) != OK
)
5696 else if (varp
== &p_ambw
)
5698 if (check_opt_strings(p_ambw
, p_ambw_values
, FALSE
) != OK
)
5704 else if (varp
== &p_bg
)
5706 if (check_opt_strings(p_bg
, p_bg_values
, FALSE
) == OK
)
5709 int dark
= (*p_bg
== 'd');
5712 init_highlight(FALSE
, FALSE
);
5715 if (dark
!= (*p_bg
== 'd')
5716 && get_var_value((char_u
*)"g:colors_name") != NULL
)
5718 /* The color scheme must have set 'background' back to another
5719 * value, that's not what we want here. Disable the color
5720 * scheme and set the colors again. */
5721 do_unlet((char_u
*)"g:colors_name", TRUE
);
5722 free_string_option(p_bg
);
5723 p_bg
= vim_strsave((char_u
*)(dark
? "dark" : "light"));
5724 check_string_option(&p_bg
);
5725 init_highlight(FALSE
, FALSE
);
5734 else if (varp
== &p_wim
)
5736 if (check_opt_wim() == FAIL
)
5740 #ifdef FEAT_CMDL_COMPL
5742 else if (varp
== &p_wop
)
5744 if (check_opt_strings(p_wop
, p_wop_values
, TRUE
) != OK
)
5751 else if (varp
== &p_wak
)
5754 || check_opt_strings(p_wak
, p_wak_values
, FALSE
) != OK
)
5757 # ifdef FEAT_GUI_MOTIF
5758 else if (gui
.in_use
)
5759 gui_motif_set_mnemonics(p_wak
[0] == 'y' || p_wak
[0] == 'm');
5761 # ifdef FEAT_GUI_GTK
5762 else if (gui
.in_use
)
5763 gui_gtk_set_mnemonics(p_wak
[0] == 'y' || p_wak
[0] == 'm');
5772 else if (varp
== &p_ei
)
5774 if (check_ei() == FAIL
)
5780 /* 'encoding' and 'fileencoding' */
5781 else if (varp
== &p_enc
|| gvarp
== &p_fenc
|| varp
== &p_tenc
)
5783 if (gvarp
== &p_fenc
)
5785 if (!curbuf
->b_p_ma
&& opt_flags
!= OPT_GLOBAL
)
5786 errmsg
= e_modifiable
;
5787 else if (vim_strchr(*varp
, ',') != NULL
)
5788 /* No comma allowed in 'fileencoding'; catches confusing it
5789 * with 'fileencodings'. */
5794 /* May show a "+" in the title now. */
5797 /* Add 'fileencoding' to the swap file. */
5798 ml_setflags(curbuf
);
5803 /* canonize the value, so that STRCMP() can be used on it */
5804 p
= enc_canonize(*varp
);
5819 # if defined(FEAT_GUI_GTK) && defined(HAVE_GTK2)
5820 if (errmsg
== NULL
&& varp
== &p_tenc
&& gui
.in_use
)
5822 /* GTK+ 2 uses only a single encoding, and that is UTF-8. */
5823 if (STRCMP(p_tenc
, "utf-8") != 0)
5824 errmsg
= (char_u
*)N_("E617: Cannot be changed in the GTK+ 2 GUI");
5831 /* When 'keymap' is used and 'encoding' changes, reload the keymap
5832 * (with another encoding). */
5833 if (varp
== &p_enc
&& *curbuf
->b_p_keymap
!= NUL
)
5834 (void)keymap_init();
5837 /* When 'termencoding' is not empty and 'encoding' changes or when
5838 * 'termencoding' changes, need to setup for keyboard input and
5839 * display output conversion. */
5840 if (((varp
== &p_enc
&& *p_tenc
!= NUL
) || varp
== &p_tenc
))
5842 convert_setup(&input_conv
, p_tenc
, p_enc
);
5843 convert_setup(&output_conv
, p_enc
, p_tenc
);
5846 # if defined(WIN3264) && defined(FEAT_MBYTE)
5847 /* $HOME may have characters in active code page. */
5855 #if defined(FEAT_POSTSCRIPT)
5856 else if (varp
== &p_penc
)
5858 /* Canonize printencoding if VIM standard one */
5859 p
= enc_canonize(p_penc
);
5867 /* Ensure lower case and '-' for '_' */
5868 for (s
= p_penc
; *s
!= NUL
; s
++)
5873 *s
= TOLOWER_ASC(*s
);
5879 #if defined(FEAT_XIM) && defined(FEAT_GUI_GTK)
5880 else if (varp
== &p_imak
)
5882 if (gui
.in_use
&& !im_xim_isvalid_imactivate())
5888 else if (varp
== &curbuf
->b_p_keymap
)
5890 /* load or unload key mapping tables */
5891 errmsg
= keymap_init();
5895 if (*curbuf
->b_p_keymap
!= NUL
)
5897 /* Installed a new keymap, switch on using it. */
5898 curbuf
->b_p_iminsert
= B_IMODE_LMAP
;
5899 if (curbuf
->b_p_imsearch
!= B_IMODE_USE_INSERT
)
5900 curbuf
->b_p_imsearch
= B_IMODE_LMAP
;
5904 /* Cleared the keymap, may reset 'iminsert' and 'imsearch'. */
5905 if (curbuf
->b_p_iminsert
== B_IMODE_LMAP
)
5906 curbuf
->b_p_iminsert
= B_IMODE_NONE
;
5907 if (curbuf
->b_p_imsearch
== B_IMODE_LMAP
)
5908 curbuf
->b_p_imsearch
= B_IMODE_USE_INSERT
;
5910 if ((opt_flags
& OPT_LOCAL
) == 0)
5912 set_iminsert_global();
5913 set_imsearch_global();
5915 # ifdef FEAT_WINDOWS
5916 status_redraw_curbuf();
5923 else if (gvarp
== &p_ff
)
5925 if (!curbuf
->b_p_ma
&& !(opt_flags
& OPT_GLOBAL
))
5926 errmsg
= e_modifiable
;
5927 else if (check_opt_strings(*varp
, p_ff_values
, FALSE
) != OK
)
5931 /* may also change 'textmode' */
5932 if (get_fileformat(curbuf
) == EOL_DOS
)
5933 curbuf
->b_p_tx
= TRUE
;
5935 curbuf
->b_p_tx
= FALSE
;
5939 /* update flag in swap file */
5940 ml_setflags(curbuf
);
5941 /* Redraw needed when switching to/from "mac": a CR in the text
5942 * will be displayed differently. */
5943 if (get_fileformat(curbuf
) == EOL_MAC
|| *oldval
== 'm')
5944 redraw_curbuf_later(NOT_VALID
);
5949 else if (varp
== &p_ffs
)
5951 if (check_opt_strings(p_ffs
, p_ff_values
, TRUE
) != OK
)
5955 /* also change 'textauto' */
5963 #if defined(FEAT_CRYPT) && defined(FEAT_CMDHIST)
5965 else if (gvarp
== &p_key
)
5967 /* Make sure the ":set" command doesn't show the new value in the
5969 remove_key_from_history();
5974 else if (gvarp
== &p_mps
)
5976 /* Check for "x:y,x:y" */
5977 for (p
= *varp
; *p
!= NUL
; p
+= 4)
5979 if (p
[1] != ':' || p
[2] == NUL
|| (p
[3] != NUL
&& p
[3] != ','))
5989 #ifdef FEAT_COMMENTS
5991 else if (gvarp
== &p_com
)
5993 for (s
= *varp
; *s
; )
5995 while (*s
&& *s
!= ':')
5997 if (vim_strchr((char_u
*)COM_ALL
, *s
) == NULL
5998 && !VIM_ISDIGIT(*s
) && *s
!= '-')
6000 errmsg
= illegal_char(errbuf
, *s
);
6006 errmsg
= (char_u
*)N_("E524: Missing colon");
6007 else if (*s
== ',' || *s
== NUL
)
6008 errmsg
= (char_u
*)N_("E525: Zero length string");
6011 while (*s
&& *s
!= ',')
6013 if (*s
== '\\' && s
[1] != NUL
)
6017 s
= skip_to_option_part(s
);
6023 else if (varp
== &p_lcs
)
6025 errmsg
= set_chars_option(varp
);
6028 #if defined(FEAT_WINDOWS) || defined(FEAT_FOLDING)
6030 else if (varp
== &p_fcs
)
6032 errmsg
= set_chars_option(varp
);
6038 else if (varp
== &p_cedit
)
6040 errmsg
= check_cedit();
6045 else if (varp
== &p_vfile
)
6048 if (*p_vfile
!= NUL
&& verbose_open() == FAIL
)
6054 else if (varp
== &p_viminfo
)
6056 for (s
= p_viminfo
; *s
;)
6058 /* Check it's a valid character */
6059 if (vim_strchr((char_u
*)"!\"%'/:<@cfhnrs", *s
) == NULL
)
6061 errmsg
= illegal_char(errbuf
, *s
);
6064 if (*s
== 'n') /* name is always last one */
6068 else if (*s
== 'r') /* skip until next ',' */
6070 while (*++s
&& *s
!= ',')
6075 /* optional number */
6076 while (vim_isdigit(*++s
))
6079 else if (*s
== '!' || *s
== 'h' || *s
== 'c')
6080 ++s
; /* no extra chars */
6081 else /* must have a number */
6083 while (vim_isdigit(*++s
))
6086 if (!VIM_ISDIGIT(*(s
- 1)))
6090 sprintf((char *)errbuf
,
6091 _("E526: Missing number after <%s>"),
6092 transchar_byte(*(s
- 1)));
6096 errmsg
= (char_u
*)"";
6105 errmsg
= (char_u
*)N_("E527: Missing comma");
6107 errmsg
= (char_u
*)"";
6111 if (*p_viminfo
&& errmsg
== NULL
&& get_viminfo_parameter('\'') < 0)
6112 errmsg
= (char_u
*)N_("E528: Must specify a ' value");
6114 #endif /* FEAT_VIMINFO */
6116 /* terminal options */
6117 else if (istermoption(&options
[opt_idx
]) && full_screen
)
6119 /* ":set t_Co=0" and ":set t_Co=1" do ":set t_Co=" */
6122 int colors
= atoi((char *)T_CCO
);
6124 /* Only reinitialize colors if t_Co value has really changed to
6125 * avoid expensive reload of colorscheme if t_Co is set to the
6126 * same value multiple times. */
6127 if (colors
!= t_colors
)
6132 if (new_value_alloced
)
6134 T_CCO
= empty_option
;
6136 /* We now have a different color setup, initialize it again. */
6137 init_highlight(TRUE
, FALSE
);
6144 redraw_later(CLEAR
);
6145 #if defined(MSDOS) || (defined(WIN3264) && !defined(FEAT_GUI_W32))
6146 /* Since t_me has been set, this probably means that the user
6147 * wants to use this as default colors. Need to reset default
6148 * background/foreground colors. */
6149 mch_set_normal_colors();
6154 #ifdef FEAT_LINEBREAK
6156 else if (varp
== &p_sbr
)
6158 for (s
= p_sbr
; *s
; )
6160 if (ptr2cells(s
) != 1)
6161 errmsg
= (char_u
*)N_("E595: contains unprintable or wide character");
6169 else if (varp
== &p_guifont
)
6174 # if defined(FEAT_GUI_GTK)
6176 * Put up a font dialog and let the user select a new value.
6177 * If this is cancelled go back to the old value but don't
6178 * give an error message.
6180 if (STRCMP(p
, "*") == 0)
6182 p
= gui_mch_font_dialog(oldval
);
6184 if (new_value_alloced
)
6185 free_string_option(p_guifont
);
6187 p_guifont
= (p
!= NULL
) ? p
: vim_strsave(oldval
);
6188 new_value_alloced
= TRUE
;
6191 if (p
!= NULL
&& gui_init_font(p_guifont
, FALSE
) != OK
)
6193 # if defined(FEAT_GUI_MSWIN) || defined(FEAT_GUI_PHOTON)
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');
6496 /* 'statusline' or 'rulerformat' */
6497 else if (gvarp
== &p_stl
|| varp
== &p_ruf
)
6501 if (varp
== &p_ruf
) /* reset ru_wid first */
6504 if (varp
== &p_ruf
&& *s
== '%')
6506 /* set ru_wid if 'ruf' starts with "%99(" */
6507 if (*++s
== '-') /* ignore a '-' */
6509 wid
= getdigits(&s
);
6510 if (wid
&& *s
== '(' && (errmsg
= check_stl_option(p_ruf
)) == NULL
)
6513 errmsg
= check_stl_option(p_ruf
);
6515 /* check 'statusline' only if it doesn't start with "%!" */
6516 else if (varp
== &p_ruf
|| s
[0] != '%' || s
[1] != '!')
6517 errmsg
= check_stl_option(s
);
6518 if (varp
== &p_ruf
&& errmsg
== NULL
)
6523 #ifdef FEAT_INS_EXPAND
6524 /* check if it is a valid value for 'complete' -- Acevedo */
6525 else if (gvarp
== &p_cpt
)
6527 for (s
= *varp
; *s
;)
6529 while(*s
== ',' || *s
== ' ')
6533 if (vim_strchr((char_u
*)".wbuksid]tU", *s
) == NULL
)
6535 errmsg
= illegal_char(errbuf
, *s
);
6538 if (*++s
!= NUL
&& *s
!= ',' && *s
!= ' ')
6540 if (s
[-1] == 'k' || s
[-1] == 's')
6542 /* skip optional filename after 'k' and 's' */
6543 while (*s
&& *s
!= ',' && *s
!= ' ')
6554 sprintf((char *)errbuf
,
6555 _("E535: Illegal character after <%c>"),
6560 errmsg
= (char_u
*)"";
6568 else if (varp
== &p_cot
)
6570 if (check_opt_strings(p_cot
, p_cot_values
, TRUE
) != OK
)
6573 #endif /* FEAT_INS_EXPAND */
6576 #if defined(FEAT_TOOLBAR) && !defined(FEAT_GUI_W32)
6577 else if (varp
== &p_toolbar
)
6579 if (opt_strings_flags(p_toolbar
, p_toolbar_values
,
6580 &toolbar_flags
, TRUE
) != OK
)
6585 gui_mch_show_toolbar((toolbar_flags
&
6586 (TOOLBAR_TEXT
| TOOLBAR_ICONS
)) != 0);
6591 #if defined(FEAT_TOOLBAR) && defined(FEAT_GUI_GTK) && defined(HAVE_GTK2)
6592 /* 'toolbariconsize': GTK+ 2 only */
6593 else if (varp
== &p_tbis
)
6595 if (opt_strings_flags(p_tbis
, p_tbis_values
, &tbis_flags
, FALSE
) != OK
)
6600 gui_mch_show_toolbar((toolbar_flags
&
6601 (TOOLBAR_TEXT
| TOOLBAR_ICONS
)) != 0);
6606 /* 'pastetoggle': translate key codes like in a mapping */
6607 else if (varp
== &p_pt
)
6611 (void)replace_termcodes(p_pt
, &p
, TRUE
, TRUE
, FALSE
);
6614 if (new_value_alloced
)
6615 free_string_option(p_pt
);
6617 new_value_alloced
= TRUE
;
6623 else if (varp
== &p_bs
)
6625 if (VIM_ISDIGIT(*p_bs
))
6627 if (*p_bs
>'2' || p_bs
[1] != NUL
)
6630 else if (check_opt_strings(p_bs
, p_bs_values
, TRUE
) != OK
)
6636 else if (varp
== &p_cmp
)
6638 if (opt_strings_flags(p_cmp
, p_cmp_values
, &cmp_flags
, TRUE
) != OK
)
6645 else if (varp
== &p_dip
)
6647 if (diffopt_changed() == FAIL
)
6654 else if (gvarp
== &curwin
->w_allbuf_opt
.wo_fdm
)
6656 if (check_opt_strings(*varp
, p_fdm_values
, FALSE
) != OK
6657 || *curwin
->w_p_fdm
== NUL
)
6660 foldUpdateAll(curwin
);
6664 else if (varp
== &curwin
->w_p_fde
)
6666 if (foldmethodIsExpr(curwin
))
6667 foldUpdateAll(curwin
);
6671 else if (gvarp
== &curwin
->w_allbuf_opt
.wo_fmr
)
6673 p
= vim_strchr(*varp
, ',');
6675 errmsg
= (char_u
*)N_("E536: comma required");
6676 else if (p
== *varp
|| p
[1] == NUL
)
6678 else if (foldmethodIsMarker(curwin
))
6679 foldUpdateAll(curwin
);
6681 /* 'commentstring' */
6682 else if (gvarp
== &p_cms
)
6684 if (**varp
!= NUL
&& strstr((char *)*varp
, "%s") == NULL
)
6685 errmsg
= (char_u
*)N_("E537: 'commentstring' must be empty or contain %s");
6688 else if (varp
== &p_fdo
)
6690 if (opt_strings_flags(p_fdo
, p_fdo_values
, &fdo_flags
, TRUE
) != OK
)
6694 else if (varp
== &p_fcl
)
6696 if (check_opt_strings(p_fcl
, p_fcl_values
, TRUE
) != OK
)
6700 else if (gvarp
== &curwin
->w_allbuf_opt
.wo_fdi
)
6702 if (foldmethodIsIndent(curwin
))
6703 foldUpdateAll(curwin
);
6707 #ifdef FEAT_VIRTUALEDIT
6709 else if (varp
== &p_ve
)
6711 if (opt_strings_flags(p_ve
, p_ve_values
, &ve_flags
, TRUE
) != OK
)
6713 else if (STRCMP(p_ve
, oldval
) != 0)
6715 /* Recompute cursor position in case the new 've' setting
6716 * changes something. */
6718 coladvance(curwin
->w_virtcol
);
6723 #if defined(FEAT_CSCOPE) && defined(FEAT_QUICKFIX)
6724 else if (varp
== &p_csqf
)
6731 if (vim_strchr((char_u
*)CSQF_CMDS
, *p
) == NULL
6733 || vim_strchr((char_u
*)CSQF_FLAGS
, p
[1]) == NULL
6734 || (p
[2] != NUL
&& p
[2] != ','))
6739 else if (p
[2] == NUL
)
6749 /* 'varsofttabstop' */
6750 else if (varp
== &(curbuf
->b_p_vsts
))
6754 if (!(*varp
)[0] || ((*varp
)[0] == '0' && !(*varp
)[1]))
6756 if (curbuf
->b_p_vsts_ary
)
6758 vim_free(curbuf
->b_p_vsts_ary
);
6759 curbuf
->b_p_vsts_ary
= 0;
6764 for (cp
= *varp
; *cp
; ++cp
)
6766 if (vim_isdigit(*cp
))
6768 if (*cp
== ',' && cp
> *varp
&& *(cp
-1) != ',')
6775 int *oldarray
= curbuf
->b_p_vsts_ary
;
6776 if (tabstop_set(*varp
, &(curbuf
->b_p_vsts_ary
)))
6788 else if (varp
== &(curbuf
->b_p_vts
))
6792 if (!(*varp
)[0] || ((*varp
)[0] == '0' && !(*varp
)[1]))
6794 if (curbuf
->b_p_vts_ary
)
6796 vim_free(curbuf
->b_p_vts_ary
);
6797 curbuf
->b_p_vts_ary
= 0;
6802 for (cp
= *varp
; *cp
; ++cp
)
6804 if (vim_isdigit(*cp
))
6806 if (*cp
== ',' && cp
> *varp
&& *(cp
-1) != ',')
6813 int *oldarray
= curbuf
->b_p_vts_ary
;
6814 if (tabstop_set(*varp
, &(curbuf
->b_p_vts_ary
)))
6819 if (foldmethodIsIndent(curwin
))
6820 foldUpdateAll(curwin
);
6821 #endif /* FEAT_FOLDING */
6830 /* Options that are a list of flags. */
6835 p
= (char_u
*)WW_ALL
;
6837 p
= (char_u
*)SHM_ALL
;
6838 else if (varp
== &(p_cpo
))
6839 p
= (char_u
*)CPO_ALL
;
6840 else if (varp
== &(curbuf
->b_p_fo
))
6841 p
= (char_u
*)FO_ALL
;
6842 else if (varp
== &p_mouse
)
6845 p
= (char_u
*)MOUSE_ALL
;
6847 if (*p_mouse
!= NUL
)
6848 errmsg
= (char_u
*)N_("E538: No mouse support");
6851 #if defined(FEAT_GUI)
6852 else if (varp
== &p_go
)
6853 p
= (char_u
*)GO_ALL
;
6857 for (s
= *varp
; *s
; ++s
)
6858 if (vim_strchr(p
, *s
) == NULL
)
6860 errmsg
= illegal_char(errbuf
, *s
);
6867 * If error detected, restore the previous value.
6871 if (new_value_alloced
)
6872 free_string_option(*varp
);
6875 * When resetting some values, need to act on it.
6878 (void)init_chartab();
6880 (void)highlight_changed();
6885 /* Remember where the option was set. */
6886 set_option_scriptID_idx(opt_idx
, opt_flags
, current_SID
);
6889 * Free string options that are in allocated memory.
6890 * Use "free_oldval", because recursiveness may change the flags under
6891 * our fingers (esp. init_highlight()).
6894 free_string_option(oldval
);
6895 if (new_value_alloced
)
6896 options
[opt_idx
].flags
|= P_ALLOCED
;
6898 options
[opt_idx
].flags
&= ~P_ALLOCED
;
6900 if ((opt_flags
& (OPT_LOCAL
| OPT_GLOBAL
)) == 0
6901 && ((int)options
[opt_idx
].indir
& PV_BOTH
))
6903 /* global option with local value set to use global value; free
6904 * the local value and make it empty */
6905 p
= get_varp_scope(&(options
[opt_idx
]), OPT_LOCAL
);
6906 free_string_option(*(char_u
**)p
);
6907 *(char_u
**)p
= empty_option
;
6910 /* May set global value for local option. */
6911 else if (!(opt_flags
& OPT_LOCAL
) && opt_flags
!= OPT_GLOBAL
)
6912 set_string_option_global(opt_idx
, varp
);
6916 * Trigger the autocommand only after setting the flags.
6919 /* When 'syntax' is set, load the syntax of that name */
6920 if (varp
== &(curbuf
->b_p_syn
))
6922 apply_autocmds(EVENT_SYNTAX
, curbuf
->b_p_syn
,
6923 curbuf
->b_fname
, TRUE
, curbuf
);
6926 else if (varp
== &(curbuf
->b_p_ft
))
6928 /* 'filetype' is set, trigger the FileType autocommand */
6929 did_filetype
= TRUE
;
6930 apply_autocmds(EVENT_FILETYPE
, curbuf
->b_p_ft
,
6931 curbuf
->b_fname
, TRUE
, curbuf
);
6935 if (varp
== &(curbuf
->b_p_spl
))
6940 * Source the spell/LANG.vim in 'runtimepath'.
6941 * They could set 'spellcapcheck' depending on the language.
6942 * Use the first name in 'spelllang' up to '_region' or
6945 for (p
= curbuf
->b_p_spl
; *p
!= NUL
; ++p
)
6946 if (vim_strchr((char_u
*)"_.,", *p
) != NULL
)
6948 vim_snprintf((char *)fname
, 200, "spell/%.*s.vim",
6949 (int)(p
- curbuf
->b_p_spl
), curbuf
->b_p_spl
);
6950 source_runtime(fname
, TRUE
);
6956 if (varp
== &p_mouse
)
6958 # ifdef FEAT_MOUSE_TTY
6959 if (*p_mouse
== NUL
)
6960 mch_setmouse(FALSE
); /* switch mouse off */
6963 setmouse(); /* in case 'mouse' changed */
6967 if (curwin
->w_curswant
!= MAXCOL
)
6968 curwin
->w_set_curswant
= TRUE
; /* in case 'showbreak' changed */
6970 /* check redraw when it's not a GUI option or the GUI is active. */
6971 if (!redraw_gui_only
|| gui
.in_use
)
6973 check_redraw(options
[opt_idx
].flags
);
6979 * Handle setting 'listchars' or 'fillchars'.
6980 * Returns error message, NULL if it's OK.
6983 set_chars_option(varp
)
6986 int round
, i
, len
, entries
;
6994 #if defined(FEAT_WINDOWS) || defined(FEAT_FOLDING)
6995 static struct charstab filltab
[] =
6998 {&fill_stlnc
, "stlnc"},
6999 {&fill_vert
, "vert"},
7000 {&fill_fold
, "fold"},
7001 {&fill_diff
, "diff"},
7004 static struct charstab lcstab
[] =
7007 {&lcs_ext
, "extends"},
7008 {&lcs_nbsp
, "nbsp"},
7009 {&lcs_prec
, "precedes"},
7011 {&lcs_trail
, "trail"},
7013 struct charstab
*tab
;
7015 #if defined(FEAT_WINDOWS) || defined(FEAT_FOLDING)
7020 entries
= sizeof(lcstab
) / sizeof(struct charstab
);
7022 #if defined(FEAT_WINDOWS) || defined(FEAT_FOLDING)
7026 entries
= sizeof(filltab
) / sizeof(struct charstab
);
7030 /* first round: check for valid value, second round: assign values */
7031 for (round
= 0; round
<= 1; ++round
)
7035 /* After checking that the value is valid: set defaults: space for
7036 * 'fillchars', NUL for 'listchars' */
7037 for (i
= 0; i
< entries
; ++i
)
7038 *(tab
[i
].cp
) = (varp
== &p_lcs
? NUL
: ' ');
7041 #if defined(FEAT_WINDOWS) || defined(FEAT_FOLDING)
7049 for (i
= 0; i
< entries
; ++i
)
7051 len
= (int)STRLEN(tab
[i
].name
);
7052 if (STRNCMP(p
, tab
[i
].name
, len
) == 0
7054 && p
[len
+ 1] != NUL
)
7058 c1
= mb_ptr2char_adv(&s
);
7059 if (mb_char2cells(c1
) > 1)
7064 if (tab
[i
].cp
== &lcs_tab2
)
7069 c2
= mb_ptr2char_adv(&s
);
7070 if (mb_char2cells(c2
) > 1)
7076 if (*s
== ',' || *s
== NUL
)
7080 if (tab
[i
].cp
== &lcs_tab2
)
7102 return NULL
; /* no error */
7107 * Check validity of options with the 'statusline' format.
7108 * Return error message or NULL.
7116 static char_u errbuf
[80];
7118 while (*s
&& itemcnt
< STL_MAX_ITEM
)
7120 /* Check for valid keys after % sequences */
7121 while (*s
&& *s
!= '%')
7126 if (*s
!= '%' && *s
!= ')')
7128 if (*s
== '%' || *s
== STL_TRUNCMARK
|| *s
== STL_MIDDLEMARK
)
7136 if (--groupdepth
< 0)
7142 while (VIM_ISDIGIT(*s
))
7144 if (*s
== STL_USER_HL
)
7149 while (*s
&& VIM_ISDIGIT(*s
))
7157 if (vim_strchr(STL_ALL
, *s
) == NULL
)
7159 return illegal_char(errbuf
, *s
);
7164 while (*s
!= '}' && *s
)
7167 return (char_u
*)N_("E540: Unclosed expression sequence");
7170 if (itemcnt
>= STL_MAX_ITEM
)
7171 return (char_u
*)N_("E541: too many items");
7172 if (groupdepth
!= 0)
7173 return (char_u
*)N_("E542: unbalanced groups");
7178 #ifdef FEAT_CLIPBOARD
7180 * Extract the items in the 'clipboard' option and set global values.
7183 check_clipboard_option()
7185 int new_unnamed
= FALSE
;
7186 int new_autoselect
= FALSE
;
7187 int new_autoselectml
= FALSE
;
7188 int new_html
= FALSE
;
7189 regprog_T
*new_exclude_prog
= NULL
;
7190 char_u
*errmsg
= NULL
;
7193 for (p
= p_cb
; *p
!= NUL
; )
7195 if (STRNCMP(p
, "unnamed", 7) == 0 && (p
[7] == ',' || p
[7] == NUL
))
7200 else if (STRNCMP(p
, "autoselect", 10) == 0
7201 && (p
[10] == ',' || p
[10] == NUL
))
7203 new_autoselect
= TRUE
;
7206 else if (STRNCMP(p
, "autoselectml", 12) == 0
7207 && (p
[12] == ',' || p
[12] == NUL
))
7209 new_autoselectml
= TRUE
;
7212 else if (STRNCMP(p
, "html", 4) == 0 && (p
[4] == ',' || p
[4] == NUL
))
7217 else if (STRNCMP(p
, "exclude:", 8) == 0 && new_exclude_prog
== NULL
)
7220 new_exclude_prog
= vim_regcomp(p
, RE_MAGIC
);
7221 if (new_exclude_prog
== NULL
)
7235 clip_unnamed
= new_unnamed
;
7236 clip_autoselect
= new_autoselect
;
7237 clip_autoselectml
= new_autoselectml
;
7238 clip_html
= new_html
;
7239 vim_free(clip_exclude_prog
);
7240 clip_exclude_prog
= new_exclude_prog
;
7243 vim_free(new_exclude_prog
);
7251 * Set curbuf->b_cap_prog to the regexp program for 'spellcapcheck'.
7252 * Return error message when failed, NULL when OK.
7255 compile_cap_prog(buf
)
7258 regprog_T
*rp
= buf
->b_cap_prog
;
7261 if (*buf
->b_p_spc
== NUL
)
7262 buf
->b_cap_prog
= NULL
;
7265 /* Prepend a ^ so that we only match at one column */
7266 re
= concat_str((char_u
*)"^", buf
->b_p_spc
);
7269 buf
->b_cap_prog
= vim_regcomp(re
, RE_MAGIC
);
7270 if (buf
->b_cap_prog
== NULL
)
7272 buf
->b_cap_prog
= rp
; /* restore the previous program */
7284 #if defined(FEAT_EVAL) || defined(PROTO)
7286 * Set the scriptID for an option, taking care of setting the buffer- or
7287 * window-local value.
7290 set_option_scriptID_idx(opt_idx
, opt_flags
, id
)
7295 int both
= (opt_flags
& (OPT_LOCAL
| OPT_GLOBAL
)) == 0;
7296 int indir
= (int)options
[opt_idx
].indir
;
7298 /* Remember where the option was set. For local options need to do that
7299 * in the buffer or window structure. */
7300 if (both
|| (opt_flags
& OPT_GLOBAL
) || (indir
& (PV_BUF
|PV_WIN
)) == 0)
7301 options
[opt_idx
].scriptID
= id
;
7302 if (both
|| (opt_flags
& OPT_LOCAL
))
7305 curbuf
->b_p_scriptID
[indir
& PV_MASK
] = id
;
7306 else if (indir
& PV_WIN
)
7307 curwin
->w_p_scriptID
[indir
& PV_MASK
] = id
;
7313 * Set the value of a boolean option, and take care of side effects.
7314 * Returns NULL for success, or an error message for an error.
7317 set_bool_option(opt_idx
, varp
, value
, opt_flags
)
7318 int opt_idx
; /* index in options[] table */
7319 char_u
*varp
; /* pointer to the option variable */
7320 int value
; /* new value */
7321 int opt_flags
; /* OPT_LOCAL and/or OPT_GLOBAL */
7323 int old_value
= *(int *)varp
;
7325 /* Disallow changing some options from secure mode */
7330 ) && (options
[opt_idx
].flags
& P_SECURE
))
7333 *(int *)varp
= value
; /* set the new value */
7335 /* Remember where the option was set. */
7336 set_option_scriptID_idx(opt_idx
, opt_flags
, current_SID
);
7340 need_mouse_correct
= TRUE
;
7343 /* May set global value for local option. */
7344 if ((opt_flags
& (OPT_LOCAL
| OPT_GLOBAL
)) == 0)
7345 *(int *)get_varp_scope(&(options
[opt_idx
]), OPT_GLOBAL
) = value
;
7348 * Handle side effects of changing a bool option.
7352 if ((int *)varp
== &p_cp
)
7357 /* 'list', 'number' */
7358 else if ((int *)varp
== &curwin
->w_p_list
7359 || (int *)varp
== &curwin
->w_p_nu
)
7361 if (curwin
->w_curswant
!= MAXCOL
)
7362 curwin
->w_set_curswant
= TRUE
;
7365 else if ((int *)varp
== &curbuf
->b_p_ro
)
7367 /* when 'readonly' is reset globally, also reset readonlymode */
7368 if (!curbuf
->b_p_ro
&& (opt_flags
& OPT_LOCAL
) == 0)
7369 readonlymode
= FALSE
;
7371 /* when 'readonly' is set may give W10 again */
7373 curbuf
->b_did_warn
= FALSE
;
7381 /* when 'modifiable' is changed, redraw the window title */
7382 else if ((int *)varp
== &curbuf
->b_p_ma
)
7386 /* when 'endofline' is changed, redraw the window title */
7387 else if ((int *)varp
== &curbuf
->b_p_eol
)
7392 /* when 'bomb' is changed, redraw the window title and tab page text */
7393 else if ((int *)varp
== &curbuf
->b_p_bomb
)
7400 /* when 'bin' is set also set some other options */
7401 else if ((int *)varp
== &curbuf
->b_p_bin
)
7403 set_options_bin(old_value
, curbuf
->b_p_bin
, opt_flags
);
7410 /* when 'buflisted' changes, trigger autocommands */
7411 else if ((int *)varp
== &curbuf
->b_p_bl
&& old_value
!= curbuf
->b_p_bl
)
7413 apply_autocmds(curbuf
->b_p_bl
? EVENT_BUFADD
: EVENT_BUFDELETE
,
7414 NULL
, NULL
, TRUE
, curbuf
);
7418 /* when 'swf' is set, create swapfile, when reset remove swapfile */
7419 else if ((int *)varp
== &curbuf
->b_p_swf
)
7421 if (curbuf
->b_p_swf
&& p_uc
)
7422 ml_open_file(curbuf
); /* create the swap file */
7424 /* no need to reset curbuf->b_may_swap, ml_open_file() will check
7426 mf_close_file(curbuf
, TRUE
); /* remove the swap file */
7429 /* when 'terse' is set change 'shortmess' */
7430 else if ((int *)varp
== &p_terse
)
7434 p
= vim_strchr(p_shm
, SHM_SEARCH
);
7436 /* insert 's' in p_shm */
7437 if (p_terse
&& p
== NULL
)
7439 STRCPY(IObuff
, p_shm
);
7440 STRCAT(IObuff
, "s");
7441 set_string_option_direct((char_u
*)"shm", -1, IObuff
, OPT_FREE
, 0);
7443 /* remove 's' from p_shm */
7444 else if (!p_terse
&& p
!= NULL
)
7448 /* when 'paste' is set or reset also change other options */
7449 else if ((int *)varp
== &p_paste
)
7451 paste_option_changed();
7454 /* when 'insertmode' is set from an autocommand need to do work here */
7455 else if ((int *)varp
== &p_im
)
7459 if ((State
& INSERT
) == 0)
7460 need_start_insertmode
= TRUE
;
7461 stop_insert_mode
= FALSE
;
7465 need_start_insertmode
= FALSE
;
7466 stop_insert_mode
= TRUE
;
7467 if (restart_edit
!= 0 && mode_displayed
)
7468 clear_cmdline
= TRUE
; /* remove "(insert)" */
7473 /* when 'ignorecase' is set or reset and 'hlsearch' is set, redraw */
7474 else if ((int *)varp
== &p_ic
&& p_hls
)
7476 redraw_all_later(SOME_VALID
);
7479 #ifdef FEAT_SEARCH_EXTRA
7480 /* when 'hlsearch' is set or reset: reset no_hlsearch */
7481 else if ((int *)varp
== &p_hls
)
7483 no_hlsearch
= FALSE
;
7487 #ifdef FEAT_SCROLLBIND
7488 /* when 'scrollbind' is set: snapshot the current position to avoid a jump
7489 * at the end of normal_cmd() */
7490 else if ((int *)varp
== &curwin
->w_p_scb
)
7492 if (curwin
->w_p_scb
)
7493 do_check_scrollbind(FALSE
);
7497 #if defined(FEAT_WINDOWS) && defined(FEAT_QUICKFIX)
7498 /* There can be only one window with 'previewwindow' set. */
7499 else if ((int *)varp
== &curwin
->w_p_pvw
)
7501 if (curwin
->w_p_pvw
)
7505 for (win
= firstwin
; win
!= NULL
; win
= win
->w_next
)
7506 if (win
->w_p_pvw
&& win
!= curwin
)
7508 curwin
->w_p_pvw
= FALSE
;
7509 return (char_u
*)N_("E590: A preview window already exists");
7515 /* when 'textmode' is set or reset also change 'fileformat' */
7516 else if ((int *)varp
== &curbuf
->b_p_tx
)
7518 set_fileformat(curbuf
->b_p_tx
? EOL_DOS
: EOL_UNIX
, opt_flags
);
7521 /* when 'textauto' is set or reset also change 'fileformats' */
7522 else if ((int *)varp
== &p_ta
)
7523 set_string_option_direct((char_u
*)"ffs", -1,
7524 p_ta
? (char_u
*)DFLT_FFS_VIM
: (char_u
*)"",
7525 OPT_FREE
| opt_flags
, 0);
7528 * When 'lisp' option changes include/exclude '-' in
7529 * keyword characters.
7532 else if (varp
== (char_u
*)&(curbuf
->b_p_lisp
))
7534 (void)buf_init_chartab(curbuf
, FALSE
); /* ignore errors */
7539 /* when 'title' changed, may need to change the title; same for 'icon' */
7540 else if ((int *)varp
== &p_title
)
7542 did_set_title(FALSE
);
7545 else if ((int *)varp
== &p_icon
)
7547 did_set_title(TRUE
);
7551 else if ((int *)varp
== &curbuf
->b_changed
)
7554 save_file_ff(curbuf
); /* Buffer is unchanged */
7559 modified_was_set
= value
;
7563 #ifdef BACKSLASH_IN_FILENAME
7564 else if ((int *)varp
== &p_ssl
)
7579 /* need to adjust the file name arguments and buffer names. */
7580 buflist_slash_adjust();
7581 alist_slash_adjust();
7583 scriptnames_slash_adjust();
7588 /* If 'wrap' is set, set w_leftcol to zero. */
7589 else if ((int *)varp
== &curwin
->w_p_wrap
)
7591 if (curwin
->w_p_wrap
)
7592 curwin
->w_leftcol
= 0;
7593 if (curwin
->w_curswant
!= MAXCOL
)
7594 curwin
->w_set_curswant
= TRUE
;
7597 /* If 'number' is set, reset 'relativenumber'. */
7598 else if ((int *)varp
== &curwin
->w_p_nu
)
7601 curwin
->w_p_rnu
= FALSE
;
7603 /* If 'relativenumber' is set, reset 'number'. */
7604 else if ((int *)varp
== &curwin
->w_p_rnu
)
7606 if (curwin
->w_p_rnu
)
7607 curwin
->w_p_nu
= FALSE
;
7611 else if ((int *)varp
== &p_ea
)
7613 if (p_ea
&& !old_value
)
7614 win_equal(curwin
, FALSE
, 0);
7618 else if ((int *)varp
== &p_wiv
)
7621 * When 'weirdinvert' changed, set/reset 't_xs'.
7622 * Then set 'weirdinvert' according to value of 't_xs'.
7624 if (p_wiv
&& !old_value
)
7625 T_XS
= (char_u
*)"y";
7626 else if (!p_wiv
&& old_value
)
7627 T_XS
= empty_option
;
7628 p_wiv
= (*T_XS
!= NUL
);
7632 else if ((int *)varp
== &p_beval
)
7634 if (p_beval
== TRUE
)
7635 gui_mch_enable_beval_area(balloonEval
);
7637 gui_mch_disable_beval_area(balloonEval
);
7641 #ifdef FEAT_AUTOCHDIR
7642 else if ((int *)varp
== &p_acd
)
7644 /* Change directories when the 'acd' option is set now. */
7651 else if ((int *)varp
== &curwin
->w_p_diff
)
7653 /* May add or remove the buffer from the list of diff buffers. */
7654 diff_buf_adjust(curwin
);
7655 # ifdef FEAT_FOLDING
7656 if (foldmethodIsDiff(curwin
))
7657 foldUpdateAll(curwin
);
7662 #ifdef USE_IM_CONTROL
7664 else if ((int *)varp
== &p_imdisable
)
7666 /* Only de-activate it here, it will be enabled when changing mode. */
7668 im_set_active(FALSE
);
7674 else if ((int *)varp
== &curwin
->w_p_spell
)
7676 if (curwin
->w_p_spell
)
7678 char_u
*errmsg
= did_set_spelllang(curbuf
);
7687 else if ((int *)varp
== &p_altkeymap
)
7689 if (old_value
!= p_altkeymap
)
7701 (void)init_chartab();
7706 * In case some second language keymapping options have changed, check
7707 * and correct the setting in a consistent way.
7711 * If hkmap or fkmap are set, reset Arabic keymapping.
7713 if ((p_hkmap
|| p_fkmap
) && p_altkeymap
)
7715 p_altkeymap
= p_fkmap
;
7717 curwin
->w_p_arab
= FALSE
;
7719 (void)init_chartab();
7723 * If hkmap set, reset Farsi keymapping.
7725 if (p_hkmap
&& p_altkeymap
)
7730 curwin
->w_p_arab
= FALSE
;
7732 (void)init_chartab();
7736 * If fkmap set, reset Hebrew keymapping.
7738 if (p_fkmap
&& !p_altkeymap
)
7743 curwin
->w_p_arab
= FALSE
;
7745 (void)init_chartab();
7750 if ((int *)varp
== &curwin
->w_p_arab
)
7752 if (curwin
->w_p_arab
)
7755 * 'arabic' is set, handle various sub-settings.
7759 /* set rightleft mode */
7760 if (!curwin
->w_p_rl
)
7762 curwin
->w_p_rl
= TRUE
;
7763 changed_window_setting();
7766 /* Enable Arabic shaping (major part of what Arabic requires) */
7770 redraw_later_clear();
7774 /* Arabic requires a utf-8 encoding, inform the user if its not
7776 if (STRCMP(p_enc
, "utf-8") != 0)
7778 static char *w_arabic
= N_("W17: Arabic requires UTF-8, do ':set encoding=utf-8'");
7780 msg_source(hl_attr(HLF_W
));
7781 MSG_ATTR(_(w_arabic
), hl_attr(HLF_W
));
7783 set_vim_var_string(VV_WARNINGMSG
, (char_u
*)_(w_arabic
), -1);
7788 /* set 'delcombine' */
7793 /* Force-set the necessary keymap for arabic */
7794 set_option_value((char_u
*)"keymap", 0L, (char_u
*)"arabic",
7801 (void)init_chartab();
7807 * 'arabic' is reset, handle various sub-settings.
7811 /* reset rightleft mode */
7814 curwin
->w_p_rl
= FALSE
;
7815 changed_window_setting();
7818 /* 'arabicshape' isn't reset, it is a global option and
7819 * another window may still need it "on". */
7822 /* 'delcombine' isn't reset, it is a global option and another
7823 * window may still want it "on". */
7826 /* Revert to the default keymap */
7827 curbuf
->b_p_iminsert
= B_IMODE_NONE
;
7828 curbuf
->b_p_imsearch
= B_IMODE_USE_INSERT
;
7831 if (curwin
->w_curswant
!= MAXCOL
)
7832 curwin
->w_set_curswant
= TRUE
;
7835 else if ((int *)varp
== &p_arshape
)
7837 if (curwin
->w_curswant
!= MAXCOL
)
7838 curwin
->w_set_curswant
= TRUE
;
7842 #ifdef FEAT_LINEBREAK
7843 if ((int *)varp
== &curwin
->w_p_lbr
)
7845 if (curwin
->w_curswant
!= MAXCOL
)
7846 curwin
->w_set_curswant
= TRUE
;
7850 #ifdef FEAT_RIGHTLEFT
7851 if ((int *)varp
== &curwin
->w_p_rl
)
7853 if (curwin
->w_curswant
!= MAXCOL
)
7854 curwin
->w_set_curswant
= TRUE
;
7859 * End of handling side effects for bool options.
7862 options
[opt_idx
].flags
|= P_WAS_SET
;
7864 comp_col(); /* in case 'ruler' or 'showcmd' changed */
7866 check_redraw(options
[opt_idx
].flags
);
7872 * Set the value of a number option, and take care of side effects.
7873 * Returns NULL for success, or an error message for an error.
7876 set_num_option(opt_idx
, varp
, value
, errbuf
, errbuflen
, opt_flags
)
7877 int opt_idx
; /* index in options[] table */
7878 char_u
*varp
; /* pointer to the option variable */
7879 long value
; /* new value */
7880 char_u
*errbuf
; /* buffer for error messages */
7881 size_t errbuflen
; /* length of "errbuf" */
7882 int opt_flags
; /* OPT_LOCAL, OPT_GLOBAL and
7885 char_u
*errmsg
= NULL
;
7886 long old_value
= *(long *)varp
;
7887 long old_Rows
= Rows
; /* remember old Rows */
7888 long old_Columns
= Columns
; /* remember old Columns */
7889 long *pp
= (long *)varp
;
7891 /* Disallow changing some options from secure mode. */
7896 ) && (options
[opt_idx
].flags
& P_SECURE
))
7901 /* Remember where the option was set. */
7902 set_option_scriptID_idx(opt_idx
, opt_flags
, current_SID
);
7905 need_mouse_correct
= TRUE
;
7908 if (curbuf
->b_p_sw
<= 0)
7910 errmsg
= e_positive
;
7912 /* Use the first 'vartabstop' value, or 'tabstop' if vts isn't in use. */
7913 curbuf
->b_p_sw
= tabstop_count(curbuf
->b_p_vts_ary
) > 0
7914 ? tabstop_first(curbuf
->b_p_vts_ary
)
7917 curbuf
->b_p_sw
= curbuf
->b_p_ts
;
7922 * Number options that need some action when changed
7925 if (pp
== &p_wh
|| pp
== &p_hh
)
7929 errmsg
= e_positive
;
7934 errmsg
= e_winheight
;
7939 errmsg
= e_positive
;
7943 /* Change window height NOW */
7944 if (lastwin
!= firstwin
)
7946 if (pp
== &p_wh
&& curwin
->w_height
< p_wh
)
7947 win_setheight((int)p_wh
);
7948 if (pp
== &p_hh
&& curbuf
->b_help
&& curwin
->w_height
< p_hh
)
7949 win_setheight((int)p_hh
);
7953 /* 'winminheight' */
7954 else if (pp
== &p_wmh
)
7958 errmsg
= e_positive
;
7963 errmsg
= e_winheight
;
7969 # ifdef FEAT_VERTSPLIT
7970 else if (pp
== &p_wiw
)
7974 errmsg
= e_positive
;
7979 errmsg
= e_winwidth
;
7983 /* Change window width NOW */
7984 if (lastwin
!= firstwin
&& curwin
->w_width
< p_wiw
)
7985 win_setwidth((int)p_wiw
);
7989 else if (pp
== &p_wmw
)
7993 errmsg
= e_positive
;
7998 errmsg
= e_winwidth
;
8008 /* (re)set last window status line */
8009 else if (pp
== &p_ls
)
8014 /* (re)set tab page line */
8015 else if (pp
== &p_stal
)
8017 shell_new_rows(); /* recompute window positions and heights */
8022 else if (pp
== &p_linespace
)
8024 /* Recompute gui.char_height and resize the Vim window to keep the
8025 * same number of lines. */
8026 if (gui
.in_use
&& gui_mch_adjust_charheight() == OK
)
8027 gui_set_shellsize(FALSE
, FALSE
, RESIZE_VERT
);
8033 else if (pp
== &curwin
->w_p_fdl
)
8035 if (curwin
->w_p_fdl
< 0)
8036 curwin
->w_p_fdl
= 0;
8040 /* 'foldminlines' */
8041 else if (pp
== &curwin
->w_p_fml
)
8043 foldUpdateAll(curwin
);
8047 else if (pp
== &curwin
->w_p_fdn
)
8049 if (foldmethodIsSyntax(curwin
) || foldmethodIsIndent(curwin
))
8050 foldUpdateAll(curwin
);
8054 else if (pp
== &curwin
->w_p_fdc
)
8056 if (curwin
->w_p_fdc
< 0)
8058 errmsg
= e_positive
;
8059 curwin
->w_p_fdc
= 0;
8061 else if (curwin
->w_p_fdc
> 12)
8064 curwin
->w_p_fdc
= 12;
8068 /* 'shiftwidth' or 'tabstop' */
8069 else if (pp
== &curbuf
->b_p_sw
|| pp
== &curbuf
->b_p_ts
)
8071 if (foldmethodIsIndent(curwin
))
8072 foldUpdateAll(curwin
);
8074 #endif /* FEAT_FOLDING */
8078 else if (pp
== &p_mco
)
8080 if (p_mco
> MAX_MCO
)
8084 screenclear(); /* will re-allocate the screen */
8088 else if (pp
== &curbuf
->b_p_iminsert
)
8090 if (curbuf
->b_p_iminsert
< 0 || curbuf
->b_p_iminsert
> B_IMODE_LAST
)
8093 curbuf
->b_p_iminsert
= B_IMODE_NONE
;
8095 p_iminsert
= curbuf
->b_p_iminsert
;
8096 if (termcap_active
) /* don't do this in the alternate screen */
8098 #if defined(FEAT_WINDOWS) && defined(FEAT_KEYMAP)
8099 /* Show/unshow value of 'keymap' in status lines. */
8100 status_redraw_curbuf();
8104 else if (pp
== &p_window
)
8108 else if (p_window
>= Rows
)
8109 p_window
= Rows
- 1;
8112 else if (pp
== &curbuf
->b_p_imsearch
)
8114 if (curbuf
->b_p_imsearch
< -1 || curbuf
->b_p_imsearch
> B_IMODE_LAST
)
8117 curbuf
->b_p_imsearch
= B_IMODE_NONE
;
8119 p_imsearch
= curbuf
->b_p_imsearch
;
8123 /* if 'titlelen' has changed, redraw the title */
8124 else if (pp
== &p_titlelen
)
8128 errmsg
= e_positive
;
8131 if (starting
!= NO_SCREEN
&& old_value
!= p_titlelen
)
8132 need_maketitle
= TRUE
;
8136 /* if p_ch changed value, change the command line height */
8137 else if (pp
== &p_ch
)
8141 errmsg
= e_positive
;
8144 if (p_ch
> Rows
- min_rows() + 1)
8145 p_ch
= Rows
- min_rows() + 1;
8147 /* Only compute the new window layout when startup has been
8148 * completed. Otherwise the frame sizes may be wrong. */
8149 if (p_ch
!= old_value
&& full_screen
8157 /* when 'updatecount' changes from zero to non-zero, open swap files */
8158 else if (pp
== &p_uc
)
8162 errmsg
= e_positive
;
8165 if (p_uc
&& !old_value
)
8168 #ifdef MZSCHEME_GUI_THREADS
8169 else if (pp
== &p_mzq
)
8170 mzvim_reset_timer();
8173 /* sync undo before 'undolevels' changes */
8174 else if (pp
== &p_ul
)
8176 /* use the old value, otherwise u_sync() may not work properly */
8182 #ifdef FEAT_LINEBREAK
8183 /* 'numberwidth' must be positive */
8184 else if (pp
== &curwin
->w_p_nuw
)
8186 if (curwin
->w_p_nuw
< 1)
8188 errmsg
= e_positive
;
8189 curwin
->w_p_nuw
= 1;
8191 if (curwin
->w_p_nuw
> 10)
8194 curwin
->w_p_nuw
= 10;
8196 curwin
->w_nrwidth_line_count
= 0;
8199 /* 'breakindentmin' must be positive */
8200 else if (pp
== &curwin
->w_p_brimin
)
8202 if (curwin
->w_p_brimin
< 1)
8204 errmsg
= e_positive
;
8205 curwin
->w_p_brimin
= 1;
8211 * Check the bounds for numeric options here
8213 if (Rows
< min_rows() && full_screen
)
8217 vim_snprintf((char *)errbuf
, errbuflen
,
8218 _("E593: Need at least %d lines"), min_rows());
8223 if (Columns
< MIN_COLUMNS
&& full_screen
)
8227 vim_snprintf((char *)errbuf
, errbuflen
,
8228 _("E594: Need at least %d columns"), MIN_COLUMNS
);
8231 Columns
= MIN_COLUMNS
;
8233 /* Limit the values to avoid an overflow in Rows * Columns. */
8234 if (Columns
> 10000)
8240 /* avoid a crash by checking for a too large value of 'columns' */
8241 if (old_Columns
!= Columns
&& full_screen
&& term_console
)
8242 mch_check_columns();
8246 * If the screen (shell) height has been changed, assume it is the
8247 * physical screenheight.
8249 if (old_Rows
!= Rows
|| old_Columns
!= Columns
)
8251 /* Changing the screen size is not allowed while updating the screen. */
8252 if (updating_screen
)
8254 else if (full_screen
8259 set_shellsize((int)Columns
, (int)Rows
, TRUE
);
8262 /* Postpone the resizing; check the size and cmdline position for
8265 if (cmdline_row
> Rows
- p_ch
&& Rows
> p_ch
)
8266 cmdline_row
= Rows
- p_ch
;
8268 if (p_window
>= Rows
|| !option_was_set((char_u
*)"window"))
8269 p_window
= Rows
- 1;
8272 if (curbuf
->b_p_sts
< 0)
8274 errmsg
= e_positive
;
8275 curbuf
->b_p_sts
= 0;
8277 if (curbuf
->b_p_ts
<= 0)
8279 errmsg
= e_positive
;
8282 if (curbuf
->b_p_tw
< 0)
8284 errmsg
= e_positive
;
8289 errmsg
= e_positive
;
8292 if ((curwin
->w_p_scr
<= 0
8293 || (curwin
->w_p_scr
> curwin
->w_height
8294 && curwin
->w_height
> 0))
8297 if (pp
== &(curwin
->w_p_scr
))
8299 if (curwin
->w_p_scr
!= 0)
8301 win_comp_scroll(curwin
);
8303 /* If 'scroll' became invalid because of a side effect silently adjust
8305 else if (curwin
->w_p_scr
<= 0)
8306 curwin
->w_p_scr
= 1;
8307 else /* curwin->w_p_scr > curwin->w_height */
8308 curwin
->w_p_scr
= curwin
->w_height
;
8312 errmsg
= e_positive
;
8317 errmsg
= e_positive
;
8320 if ((p_sj
< -100 || p_sj
>= Rows
) && full_screen
)
8322 if (Rows
!= old_Rows
) /* Rows changed, just adjust p_sj */
8330 if (p_so
< 0 && full_screen
)
8335 if (p_siso
< 0 && full_screen
)
8337 errmsg
= e_positive
;
8343 errmsg
= e_positive
;
8349 errmsg
= e_positive
;
8354 errmsg
= e_positive
;
8358 /* May set global value for local option. */
8359 if ((opt_flags
& (OPT_LOCAL
| OPT_GLOBAL
)) == 0)
8360 *(long *)get_varp_scope(&(options
[opt_idx
]), OPT_GLOBAL
) = *pp
;
8362 options
[opt_idx
].flags
|= P_WAS_SET
;
8364 comp_col(); /* in case 'columns' or 'ls' changed */
8365 if (curwin
->w_curswant
!= MAXCOL
)
8366 curwin
->w_set_curswant
= TRUE
; /* in case 'tabstop' changed */
8367 check_redraw(options
[opt_idx
].flags
);
8373 * Called after an option changed: check if something needs to be redrawn.
8379 /* Careful: P_RCLR and P_RALL are a combination of other P_ flags */
8380 int clear
= (flags
& P_RCLR
) == P_RCLR
;
8381 int all
= ((flags
& P_RALL
) == P_RALL
|| clear
);
8384 if ((flags
& P_RSTAT
) || all
) /* mark all status lines dirty */
8385 status_redraw_all();
8388 if ((flags
& P_RBUF
) || (flags
& P_RWIN
) || all
)
8389 changed_window_setting();
8391 redraw_curbuf_later(NOT_VALID
);
8393 redraw_all_later(CLEAR
);
8395 redraw_all_later(NOT_VALID
);
8399 * Find index for option 'arg'.
8400 * Return -1 if not found.
8408 static short quick_tab
[27] = {0, 0}; /* quick access table */
8412 * For first call: Initialize the quick-access table.
8413 * It contains the index for the first option that starts with a certain
8414 * letter. There are 26 letters, plus the first "t_" option.
8416 if (quick_tab
[1] == 0)
8418 p
= options
[0].fullname
;
8419 for (opt_idx
= 1; (s
= options
[opt_idx
].fullname
) != NULL
; opt_idx
++)
8423 if (s
[0] == 't' && s
[1] == '_')
8424 quick_tab
[26] = opt_idx
;
8426 quick_tab
[CharOrdLow(s
[0])] = opt_idx
;
8433 * Check for name starting with an illegal character.
8436 if (!islower(arg
[0]))
8438 if (arg
[0] < 'a' || arg
[0] > 'z')
8442 is_term_opt
= (arg
[0] == 't' && arg
[1] == '_');
8444 opt_idx
= quick_tab
[26];
8446 opt_idx
= quick_tab
[CharOrdLow(arg
[0])];
8447 for ( ; (s
= options
[opt_idx
].fullname
) != NULL
; opt_idx
++)
8449 if (STRCMP(arg
, s
) == 0) /* match full name */
8452 if (s
== NULL
&& !is_term_opt
)
8454 opt_idx
= quick_tab
[CharOrdLow(arg
[0])];
8455 for ( ; options
[opt_idx
].fullname
!= NULL
; opt_idx
++)
8457 s
= options
[opt_idx
].shortname
;
8458 if (s
!= NULL
&& STRCMP(arg
, s
) == 0) /* match short name */
8468 #if defined(FEAT_EVAL) || defined(FEAT_TCL) || defined(FEAT_MZSCHEME)
8470 * Get the value for an option.
8473 * Number or Toggle option: 1, *numval gets value.
8474 * String option: 0, *stringval gets allocated string.
8475 * Hidden Number or Toggle option: -1.
8476 * hidden String option: -2.
8477 * unknown option: -3.
8480 get_option_value(name
, numval
, stringval
, opt_flags
)
8483 char_u
**stringval
; /* NULL when only checking existance */
8489 opt_idx
= findoption(name
);
8490 if (opt_idx
< 0) /* unknown option */
8493 varp
= get_varp_scope(&(options
[opt_idx
]), opt_flags
);
8495 if (options
[opt_idx
].flags
& P_STRING
)
8497 if (varp
== NULL
) /* hidden option */
8499 if (stringval
!= NULL
)
8502 /* never return the value of the crypt key */
8503 if ((char_u
**)varp
== &curbuf
->b_p_key
8504 && **(char_u
**)(varp
) != NUL
)
8505 *stringval
= vim_strsave((char_u
*)"*****");
8508 *stringval
= vim_strsave(*(char_u
**)(varp
));
8513 if (varp
== NULL
) /* hidden option */
8515 if (options
[opt_idx
].flags
& P_NUM
)
8516 *numval
= *(long *)varp
;
8519 /* Special case: 'modified' is b_changed, but we also want to consider
8520 * it set when 'ff' or 'fenc' changed. */
8521 if ((int *)varp
== &curbuf
->b_changed
)
8522 *numval
= curbufIsChanged();
8524 *numval
= *(int *)varp
;
8531 * Set the value of option "name".
8532 * Use "string" for string options, use "number" for other options.
8535 set_option_value(name
, number
, string
, opt_flags
)
8539 int opt_flags
; /* OPT_LOCAL or 0 (both) */
8545 opt_idx
= findoption(name
);
8547 EMSG2(_("E355: Unknown option: %s"), name
);
8550 flags
= options
[opt_idx
].flags
;
8552 /* Disallow changing some options in the sandbox */
8553 if (sandbox
> 0 && (flags
& P_SECURE
))
8559 if (flags
& P_STRING
)
8560 set_string_option(opt_idx
, string
, opt_flags
);
8563 varp
= get_varp_scope(&(options
[opt_idx
]), opt_flags
);
8564 if (varp
!= NULL
) /* hidden option is not changed */
8566 if (number
== 0 && string
!= NULL
)
8570 /* Either we are given a string or we are setting option
8572 for (idx
= 0; string
[idx
] == '0'; ++idx
)
8574 if (string
[idx
] != NUL
|| idx
== 0)
8576 /* There's another character after zeros or the string
8577 * is empty. In both cases, we are trying to set a
8578 * num option using a string. */
8579 EMSG3(_("E521: Number required: &%s = '%s'"),
8581 return; /* do nothing as we hit an error */
8586 (void)set_num_option(opt_idx
, varp
, number
,
8587 NULL
, 0, opt_flags
);
8589 (void)set_bool_option(opt_idx
, varp
, (int)number
,
8597 * Get the terminal code for a terminal option.
8598 * Returns NULL when not found.
8601 get_term_code(tname
)
8607 if (tname
[0] != 't' || tname
[1] != '_' ||
8608 tname
[2] == NUL
|| tname
[3] == NUL
)
8610 if ((opt_idx
= findoption(tname
)) >= 0)
8612 varp
= get_varp(&(options
[opt_idx
]));
8614 varp
= *(char_u
**)(varp
);
8617 return find_termcode(tname
+ 2);
8621 get_highlight_default()
8625 i
= findoption((char_u
*)"hl");
8627 return options
[i
].def_val
[VI_DEFAULT
];
8628 return (char_u
*)NULL
;
8631 #if defined(FEAT_MBYTE) || defined(PROTO)
8633 get_encoding_default()
8637 i
= findoption((char_u
*)"enc");
8639 return options
[i
].def_val
[VI_DEFAULT
];
8640 return (char_u
*)NULL
;
8645 * Translate a string like "t_xx", "<t_xx>" or "<S-Tab>" to a key number.
8648 find_key_option(arg
)
8655 * Don't use get_special_key_code() for t_xx, we don't want it to call
8656 * add_termcap_entry().
8658 if (arg
[0] == 't' && arg
[1] == '_' && arg
[2] && arg
[3])
8659 key
= TERMCAP2KEY(arg
[2], arg
[3]);
8662 --arg
; /* put arg at the '<' */
8664 key
= find_special_key(&arg
, &modifiers
, TRUE
, TRUE
);
8665 if (modifiers
) /* can't handle modifiers here */
8672 * if 'all' == 0: show changed options
8673 * if 'all' == 1: show all normal options
8674 * if 'all' == 2: show all terminal options
8677 showoptions(all
, opt_flags
)
8679 int opt_flags
; /* OPT_LOCAL and/or OPT_GLOBAL */
8681 struct vimoption
*p
;
8685 struct vimoption
**items
;
8696 items
= (struct vimoption
**)alloc((unsigned)(sizeof(struct vimoption
*) *
8701 /* Highlight title */
8703 MSG_PUTS_TITLE(_("\n--- Terminal codes ---"));
8704 else if (opt_flags
& OPT_GLOBAL
)
8705 MSG_PUTS_TITLE(_("\n--- Global option values ---"));
8706 else if (opt_flags
& OPT_LOCAL
)
8707 MSG_PUTS_TITLE(_("\n--- Local option values ---"));
8709 MSG_PUTS_TITLE(_("\n--- Options ---"));
8712 * do the loop two times:
8713 * 1. display the short items
8714 * 2. display the long items (only strings and numbers)
8716 for (run
= 1; run
<= 2 && !got_int
; ++run
)
8719 * collect the items in items[]
8722 for (p
= &options
[0]; p
->fullname
!= NULL
; p
++)
8725 isterm
= istermoption(p
);
8728 if (p
->indir
!= PV_NONE
&& !isterm
)
8729 varp
= get_varp_scope(p
, opt_flags
);
8734 && ((all
== 2 && isterm
)
8735 || (all
== 1 && !isterm
)
8736 || (all
== 0 && !optval_default(p
, varp
))))
8738 if (p
->flags
& P_BOOL
)
8739 len
= 1; /* a toggle option fits always */
8742 option_value2string(p
, opt_flags
);
8743 len
= (int)STRLEN(p
->fullname
) + vim_strsize(NameBuff
) + 1;
8745 if ((len
<= INC
- GAP
&& run
== 1) ||
8746 (len
> INC
- GAP
&& run
== 2))
8747 items
[item_count
++] = p
;
8756 cols
= (Columns
+ GAP
- 3) / INC
;
8759 rows
= (item_count
+ cols
- 1) / cols
;
8763 for (row
= 0; row
< rows
&& !got_int
; ++row
)
8765 msg_putchar('\n'); /* go to next line */
8766 if (got_int
) /* 'q' typed in more */
8769 for (i
= row
; i
< item_count
; i
+= rows
)
8771 msg_col
= col
; /* make columns */
8772 showoneopt(items
[i
], opt_flags
);
8783 * Return TRUE if option "p" has its default value.
8786 optval_default(p
, varp
)
8787 struct vimoption
*p
;
8793 return TRUE
; /* hidden option is always at default */
8794 dvi
= ((p
->flags
& P_VI_DEF
) || p_cp
) ? VI_DEFAULT
: VIM_DEFAULT
;
8795 if (p
->flags
& P_NUM
)
8796 return (*(long *)varp
== (long)(long_i
)p
->def_val
[dvi
]);
8797 if (p
->flags
& P_BOOL
)
8798 /* the cast to long is required for Manx C, long_i is
8799 * needed for MSVC */
8800 return (*(int *)varp
== (int)(long)(long_i
)p
->def_val
[dvi
]);
8802 return (STRCMP(*(char_u
**)varp
, p
->def_val
[dvi
]) == 0);
8806 * showoneopt: show the value of one option
8807 * must not be called with a hidden option!
8810 showoneopt(p
, opt_flags
)
8811 struct vimoption
*p
;
8812 int opt_flags
; /* OPT_LOCAL or OPT_GLOBAL */
8815 int save_silent
= silent_mode
;
8817 silent_mode
= FALSE
;
8818 info_message
= TRUE
; /* use mch_msg(), not mch_errmsg() */
8820 varp
= get_varp_scope(p
, opt_flags
);
8822 /* for 'modified' we also need to check if 'ff' or 'fenc' changed. */
8823 if ((p
->flags
& P_BOOL
) && ((int *)varp
== &curbuf
->b_changed
8824 ? !curbufIsChanged() : !*(int *)varp
))
8826 else if ((p
->flags
& P_BOOL
) && *(int *)varp
< 0)
8830 MSG_PUTS(p
->fullname
);
8831 if (!(p
->flags
& P_BOOL
))
8834 /* put value string in NameBuff */
8835 option_value2string(p
, opt_flags
);
8836 msg_outtrans(NameBuff
);
8839 silent_mode
= save_silent
;
8840 info_message
= FALSE
;
8844 * Write modified options as ":set" commands to a file.
8846 * There are three values for "opt_flags":
8847 * OPT_GLOBAL: Write global option values and fresh values of
8848 * buffer-local options (used for start of a session
8850 * OPT_GLOBAL + OPT_LOCAL: Idem, add fresh values of window-local options for
8851 * curwin (used for a vimrc file).
8852 * OPT_LOCAL: Write buffer-local option values for curbuf, fresh
8853 * and local values for window-local options of
8854 * curwin. Local values are also written when at the
8855 * default value, because a modeline or autocommand
8856 * may have set them when doing ":edit file" and the
8857 * user has set them back at the default or fresh
8859 * When "local_only" is TRUE, don't write fresh
8860 * values, only local values (for ":mkview").
8861 * (fresh value = value used for a new buffer or window for a local option).
8863 * Return FAIL on error, OK otherwise.
8866 makeset(fd
, opt_flags
, local_only
)
8871 struct vimoption
*p
;
8872 char_u
*varp
; /* currently used value */
8873 char_u
*varp_fresh
; /* local value */
8874 char_u
*varp_local
= NULL
; /* fresh value */
8880 * The options that don't have a default (terminal name, columns, lines)
8881 * are never written. Terminal options are also not written.
8882 * Do the loop over "options[]" twice: once for options with the
8883 * P_PRI_MKRC flag and once without.
8885 for (pri
= 1; pri
>= 0; --pri
)
8887 for (p
= &options
[0]; !istermoption(p
); p
++)
8888 if (!(p
->flags
& P_NO_MKRC
)
8890 && ((pri
== 1) == ((p
->flags
& P_PRI_MKRC
) != 0)))
8892 /* skip global option when only doing locals */
8893 if (p
->indir
== PV_NONE
&& !(opt_flags
& OPT_GLOBAL
))
8896 /* Do not store options like 'bufhidden' and 'syntax' in a vimrc
8897 * file, they are always buffer-specific. */
8898 if ((opt_flags
& OPT_GLOBAL
) && (p
->flags
& P_NOGLOB
))
8901 /* Global values are only written when not at the default value. */
8902 varp
= get_varp_scope(p
, opt_flags
);
8903 if ((opt_flags
& OPT_GLOBAL
) && optval_default(p
, varp
))
8907 if (p
->indir
!= PV_NONE
)
8909 if (p
->var
== VAR_WIN
)
8911 /* skip window-local option when only doing globals */
8912 if (!(opt_flags
& OPT_LOCAL
))
8914 /* When fresh value of window-local option is not at the
8915 * default, need to write it too. */
8916 if (!(opt_flags
& OPT_GLOBAL
) && !local_only
)
8918 varp_fresh
= get_varp_scope(p
, OPT_GLOBAL
);
8919 if (!optval_default(p
, varp_fresh
))
8929 /* Round 1: fresh value for window-local options.
8930 * Round 2: other values */
8931 for ( ; round
<= 2; varp
= varp_local
, ++round
)
8933 if (round
== 1 || (opt_flags
& OPT_GLOBAL
))
8938 if (p
->flags
& P_BOOL
)
8940 if (put_setbool(fd
, cmd
, p
->fullname
, *(int *)varp
) == FAIL
)
8943 else if (p
->flags
& P_NUM
)
8945 if (put_setnum(fd
, cmd
, p
->fullname
, (long *)varp
) == FAIL
)
8950 #if defined(FEAT_SYN_HL) || defined(FEAT_AUTOCMD)
8951 int do_endif
= FALSE
;
8953 /* Don't set 'syntax' and 'filetype' again if the value is
8954 * already right, avoids reloading the syntax file. */
8956 # if defined(FEAT_SYN_HL)
8958 # if defined(FEAT_AUTOCMD)
8962 # if defined(FEAT_AUTOCMD)
8967 if (fprintf(fd
, "if &%s != '%s'", p
->fullname
,
8968 *(char_u
**)(varp
)) < 0
8974 if (put_setstring(fd
, cmd
, p
->fullname
, (char_u
**)varp
,
8975 (p
->flags
& P_EXPAND
) != 0) == FAIL
)
8977 #if defined(FEAT_SYN_HL) || defined(FEAT_AUTOCMD)
8980 if (put_line(fd
, "endif") == FAIL
)
8991 #if defined(FEAT_FOLDING) || defined(PROTO)
8993 * Generate set commands for the local fold options only. Used when
8994 * 'sessionoptions' or 'viewoptions' contains "folds" but not "options".
9000 if (put_setstring(fd
, "setlocal", "fdm", &curwin
->w_p_fdm
, FALSE
) == FAIL
9002 || put_setstring(fd
, "setlocal", "fde", &curwin
->w_p_fde
, FALSE
)
9005 || put_setstring(fd
, "setlocal", "fmr", &curwin
->w_p_fmr
, FALSE
)
9007 || put_setstring(fd
, "setlocal", "fdi", &curwin
->w_p_fdi
, FALSE
)
9009 || put_setnum(fd
, "setlocal", "fdl", &curwin
->w_p_fdl
) == FAIL
9010 || put_setnum(fd
, "setlocal", "fml", &curwin
->w_p_fml
) == FAIL
9011 || put_setnum(fd
, "setlocal", "fdn", &curwin
->w_p_fdn
) == FAIL
9012 || put_setbool(fd
, "setlocal", "fen", curwin
->w_p_fen
) == FAIL
9021 put_setstring(fd
, cmd
, name
, valuep
, expand
)
9029 char_u buf
[MAXPATHL
];
9031 if (fprintf(fd
, "%s %s=", cmd
, name
) < 0)
9033 if (*valuep
!= NULL
)
9035 /* Output 'pastetoggle' as key names. For other
9036 * options some characters have to be escaped with
9037 * CTRL-V or backslash */
9038 if (valuep
== &p_pt
)
9042 if (put_escstr(fd
, str2special(&s
, FALSE
), 2) == FAIL
)
9047 home_replace(NULL
, *valuep
, buf
, MAXPATHL
, FALSE
);
9048 if (put_escstr(fd
, buf
, 2) == FAIL
)
9051 else if (put_escstr(fd
, *valuep
, 2) == FAIL
)
9054 if (put_eol(fd
) < 0)
9060 put_setnum(fd
, cmd
, name
, valuep
)
9068 if (fprintf(fd
, "%s %s=", cmd
, name
) < 0)
9070 if (wc_use_keyname((char_u
*)valuep
, &wc
))
9072 /* print 'wildchar' and 'wildcharm' as a key name */
9073 if (fputs((char *)get_special_key_name((int)wc
, 0), fd
) < 0)
9076 else if (fprintf(fd
, "%ld", *valuep
) < 0)
9078 if (put_eol(fd
) < 0)
9084 put_setbool(fd
, cmd
, name
, value
)
9090 if (value
< 0) /* global/local option using global value */
9092 if (fprintf(fd
, "%s %s%s", cmd
, value
? "" : "no", name
) < 0
9099 * Clear all the terminal options.
9100 * If the option has been allocated, free the memory.
9101 * Terminal options are never hidden or indirect.
9107 * Reset a few things before clearing the old options. This may cause
9108 * outputting a few things that the terminal doesn't understand, but the
9109 * screen will be cleared later, so this is OK.
9111 #ifdef FEAT_MOUSE_TTY
9112 mch_setmouse(FALSE
); /* switch mouse off */
9115 mch_restore_title(3); /* restore window titles */
9117 #if defined(FEAT_XCLIPBOARD) && defined(FEAT_GUI)
9118 /* When starting the GUI close the display opened for the clipboard.
9119 * After restoring the title, because that will need the display. */
9125 * Check if this is allowed now.
9127 if (can_end_termcap_mode(FALSE
) == TRUE
)
9129 stoptermcap(); /* stop termcap mode */
9137 struct vimoption
*p
;
9139 for (p
= &options
[0]; p
->fullname
!= NULL
; p
++)
9140 if (istermoption(p
))
9142 if (p
->flags
& P_ALLOCED
)
9143 free_string_option(*(char_u
**)(p
->var
));
9144 if (p
->flags
& P_DEF_ALLOCED
)
9145 free_string_option(p
->def_val
[VI_DEFAULT
]);
9146 *(char_u
**)(p
->var
) = empty_option
;
9147 p
->def_val
[VI_DEFAULT
] = empty_option
;
9148 p
->flags
&= ~(P_ALLOCED
|P_DEF_ALLOCED
);
9154 * Free the string for one term option, if it was allocated.
9155 * Set the string to empty_option and clear allocated flag.
9156 * "var" points to the option value.
9159 free_one_termoption(var
)
9162 struct vimoption
*p
;
9164 for (p
= &options
[0]; p
->fullname
!= NULL
; p
++)
9167 if (p
->flags
& P_ALLOCED
)
9168 free_string_option(*(char_u
**)(p
->var
));
9169 *(char_u
**)(p
->var
) = empty_option
;
9170 p
->flags
&= ~P_ALLOCED
;
9176 * Set the terminal option defaults to the current value.
9177 * Used after setting the terminal name.
9182 struct vimoption
*p
;
9184 for (p
= &options
[0]; p
->fullname
!= NULL
; p
++)
9186 if (istermoption(p
) && p
->def_val
[VI_DEFAULT
] != *(char_u
**)(p
->var
))
9188 if (p
->flags
& P_DEF_ALLOCED
)
9190 free_string_option(p
->def_val
[VI_DEFAULT
]);
9191 p
->flags
&= ~P_DEF_ALLOCED
;
9193 p
->def_val
[VI_DEFAULT
] = *(char_u
**)(p
->var
);
9194 if (p
->flags
& P_ALLOCED
)
9196 p
->flags
|= P_DEF_ALLOCED
;
9197 p
->flags
&= ~P_ALLOCED
; /* don't free the value now */
9204 * return TRUE if 'p' starts with 't_'
9208 struct vimoption
*p
;
9210 return (p
->fullname
[0] == 't' && p
->fullname
[1] == '_');
9214 * Compute columns for ruler and shown command. 'sc_col' is also used to
9215 * decide what the maximum length of a message on the status line can be.
9216 * If there is a status line for the last window, 'sc_col' is independent
9220 #define COL_RULER 17 /* columns needed by standard ruler */
9225 #if defined(FEAT_CMDL_INFO) && defined(FEAT_WINDOWS)
9226 int last_has_status
= (p_ls
== 2 || (p_ls
== 1 && firstwin
!= lastwin
));
9233 ru_col
= (ru_wid
? ru_wid
: COL_RULER
) + 1;
9235 ru_col
= COL_RULER
+ 1;
9237 /* no last status line, adjust sc_col */
9238 if (!last_has_status
)
9243 sc_col
+= SHOWCMD_COLS
;
9244 if (!p_ru
|| last_has_status
) /* no need for separating space */
9247 sc_col
= Columns
- sc_col
;
9248 ru_col
= Columns
- ru_col
;
9249 if (sc_col
<= 0) /* screen too narrow, will become a mess */
9260 * Get pointer to option variable, depending on local or global scope.
9263 get_varp_scope(p
, opt_flags
)
9264 struct vimoption
*p
;
9267 if ((opt_flags
& OPT_GLOBAL
) && p
->indir
!= PV_NONE
)
9269 if (p
->var
== VAR_WIN
)
9270 return (char_u
*)GLOBAL_WO(get_varp(p
));
9273 if ((opt_flags
& OPT_LOCAL
) && ((int)p
->indir
& PV_BOTH
))
9275 switch ((int)p
->indir
)
9277 #ifdef FEAT_QUICKFIX
9278 case PV_EFM
: return (char_u
*)&(curbuf
->b_p_efm
);
9279 case PV_GP
: return (char_u
*)&(curbuf
->b_p_gp
);
9280 case PV_MP
: return (char_u
*)&(curbuf
->b_p_mp
);
9282 case PV_EP
: return (char_u
*)&(curbuf
->b_p_ep
);
9283 case PV_KP
: return (char_u
*)&(curbuf
->b_p_kp
);
9284 case PV_PATH
: return (char_u
*)&(curbuf
->b_p_path
);
9285 case PV_AR
: return (char_u
*)&(curbuf
->b_p_ar
);
9286 case PV_TAGS
: return (char_u
*)&(curbuf
->b_p_tags
);
9288 case PV_DEF
: return (char_u
*)&(curbuf
->b_p_def
);
9289 case PV_INC
: return (char_u
*)&(curbuf
->b_p_inc
);
9291 #ifdef FEAT_INS_EXPAND
9292 case PV_DICT
: return (char_u
*)&(curbuf
->b_p_dict
);
9293 case PV_TSR
: return (char_u
*)&(curbuf
->b_p_tsr
);
9295 #if defined(FEAT_BEVAL) && defined(FEAT_EVAL)
9296 case PV_BEXPR
: return (char_u
*)&(curbuf
->b_p_bexpr
);
9299 case PV_STL
: return (char_u
*)&(curwin
->w_p_stl
);
9302 return NULL
; /* "cannot happen" */
9308 * Get pointer to option variable.
9312 struct vimoption
*p
;
9314 /* hidden option, always return NULL */
9318 switch ((int)p
->indir
)
9320 case PV_NONE
: return p
->var
;
9322 /* global option with local value: use local value if it's been set */
9323 case PV_EP
: return *curbuf
->b_p_ep
!= NUL
9324 ? (char_u
*)&curbuf
->b_p_ep
: p
->var
;
9325 case PV_KP
: return *curbuf
->b_p_kp
!= NUL
9326 ? (char_u
*)&curbuf
->b_p_kp
: p
->var
;
9327 case PV_PATH
: return *curbuf
->b_p_path
!= NUL
9328 ? (char_u
*)&(curbuf
->b_p_path
) : p
->var
;
9329 case PV_AR
: return curbuf
->b_p_ar
>= 0
9330 ? (char_u
*)&(curbuf
->b_p_ar
) : p
->var
;
9331 case PV_TAGS
: return *curbuf
->b_p_tags
!= NUL
9332 ? (char_u
*)&(curbuf
->b_p_tags
) : p
->var
;
9334 case PV_DEF
: return *curbuf
->b_p_def
!= NUL
9335 ? (char_u
*)&(curbuf
->b_p_def
) : p
->var
;
9336 case PV_INC
: return *curbuf
->b_p_inc
!= NUL
9337 ? (char_u
*)&(curbuf
->b_p_inc
) : p
->var
;
9339 #ifdef FEAT_INS_EXPAND
9340 case PV_DICT
: return *curbuf
->b_p_dict
!= NUL
9341 ? (char_u
*)&(curbuf
->b_p_dict
) : p
->var
;
9342 case PV_TSR
: return *curbuf
->b_p_tsr
!= NUL
9343 ? (char_u
*)&(curbuf
->b_p_tsr
) : p
->var
;
9345 #ifdef FEAT_QUICKFIX
9346 case PV_EFM
: return *curbuf
->b_p_efm
!= NUL
9347 ? (char_u
*)&(curbuf
->b_p_efm
) : p
->var
;
9348 case PV_GP
: return *curbuf
->b_p_gp
!= NUL
9349 ? (char_u
*)&(curbuf
->b_p_gp
) : p
->var
;
9350 case PV_MP
: return *curbuf
->b_p_mp
!= NUL
9351 ? (char_u
*)&(curbuf
->b_p_mp
) : p
->var
;
9353 #if defined(FEAT_BEVAL) && defined(FEAT_EVAL)
9354 case PV_BEXPR
: return *curbuf
->b_p_bexpr
!= NUL
9355 ? (char_u
*)&(curbuf
->b_p_bexpr
) : p
->var
;
9358 case PV_STL
: return *curwin
->w_p_stl
!= NUL
9359 ? (char_u
*)&(curwin
->w_p_stl
) : p
->var
;
9363 case PV_ARAB
: return (char_u
*)&(curwin
->w_p_arab
);
9365 case PV_LIST
: return (char_u
*)&(curwin
->w_p_list
);
9367 case PV_SPELL
: return (char_u
*)&(curwin
->w_p_spell
);
9370 case PV_CUC
: return (char_u
*)&(curwin
->w_p_cuc
);
9371 case PV_CUL
: return (char_u
*)&(curwin
->w_p_cul
);
9374 case PV_DIFF
: return (char_u
*)&(curwin
->w_p_diff
);
9377 case PV_FDC
: return (char_u
*)&(curwin
->w_p_fdc
);
9378 case PV_FEN
: return (char_u
*)&(curwin
->w_p_fen
);
9379 case PV_FDI
: return (char_u
*)&(curwin
->w_p_fdi
);
9380 case PV_FDL
: return (char_u
*)&(curwin
->w_p_fdl
);
9381 case PV_FDM
: return (char_u
*)&(curwin
->w_p_fdm
);
9382 case PV_FML
: return (char_u
*)&(curwin
->w_p_fml
);
9383 case PV_FDN
: return (char_u
*)&(curwin
->w_p_fdn
);
9385 case PV_FDE
: return (char_u
*)&(curwin
->w_p_fde
);
9386 case PV_FDT
: return (char_u
*)&(curwin
->w_p_fdt
);
9388 case PV_FMR
: return (char_u
*)&(curwin
->w_p_fmr
);
9390 case PV_NU
: return (char_u
*)&(curwin
->w_p_nu
);
9391 case PV_RNU
: return (char_u
*)&(curwin
->w_p_rnu
);
9392 #ifdef FEAT_LINEBREAK
9393 case PV_NUW
: return (char_u
*)&(curwin
->w_p_nuw
);
9396 case PV_WFH
: return (char_u
*)&(curwin
->w_p_wfh
);
9398 #ifdef FEAT_VERTSPLIT
9399 case PV_WFW
: return (char_u
*)&(curwin
->w_p_wfw
);
9401 #if defined(FEAT_WINDOWS) && defined(FEAT_QUICKFIX)
9402 case PV_PVW
: return (char_u
*)&(curwin
->w_p_pvw
);
9404 #ifdef FEAT_RIGHTLEFT
9405 case PV_RL
: return (char_u
*)&(curwin
->w_p_rl
);
9406 case PV_RLC
: return (char_u
*)&(curwin
->w_p_rlc
);
9408 case PV_SCROLL
: return (char_u
*)&(curwin
->w_p_scr
);
9409 case PV_WRAP
: return (char_u
*)&(curwin
->w_p_wrap
);
9410 #ifdef FEAT_LINEBREAK
9411 case PV_LBR
: return (char_u
*)&(curwin
->w_p_lbr
);
9412 case PV_BRI
: return (char_u
*)&(curwin
->w_p_bri
);
9413 case PV_BRIMIN
: return (char_u
*)&(curwin
->w_p_brimin
);
9414 case PV_BRISHIFT
: return (char_u
*)&(curwin
->w_p_brishift
);
9416 #ifdef FEAT_SCROLLBIND
9417 case PV_SCBIND
: return (char_u
*)&(curwin
->w_p_scb
);
9420 case PV_AI
: return (char_u
*)&(curbuf
->b_p_ai
);
9421 case PV_BIN
: return (char_u
*)&(curbuf
->b_p_bin
);
9423 case PV_BOMB
: return (char_u
*)&(curbuf
->b_p_bomb
);
9425 #if defined(FEAT_QUICKFIX)
9426 case PV_BH
: return (char_u
*)&(curbuf
->b_p_bh
);
9427 case PV_BT
: return (char_u
*)&(curbuf
->b_p_bt
);
9429 case PV_BL
: return (char_u
*)&(curbuf
->b_p_bl
);
9430 case PV_CI
: return (char_u
*)&(curbuf
->b_p_ci
);
9432 case PV_CIN
: return (char_u
*)&(curbuf
->b_p_cin
);
9433 case PV_CINK
: return (char_u
*)&(curbuf
->b_p_cink
);
9434 case PV_CINO
: return (char_u
*)&(curbuf
->b_p_cino
);
9436 #if defined(FEAT_SMARTINDENT) || defined(FEAT_CINDENT)
9437 case PV_CINW
: return (char_u
*)&(curbuf
->b_p_cinw
);
9439 #ifdef FEAT_COMMENTS
9440 case PV_COM
: return (char_u
*)&(curbuf
->b_p_com
);
9443 case PV_CMS
: return (char_u
*)&(curbuf
->b_p_cms
);
9445 #ifdef FEAT_INS_EXPAND
9446 case PV_CPT
: return (char_u
*)&(curbuf
->b_p_cpt
);
9448 #ifdef FEAT_COMPL_FUNC
9449 case PV_CFU
: return (char_u
*)&(curbuf
->b_p_cfu
);
9450 case PV_OFU
: return (char_u
*)&(curbuf
->b_p_ofu
);
9452 case PV_EOL
: return (char_u
*)&(curbuf
->b_p_eol
);
9453 case PV_ET
: return (char_u
*)&(curbuf
->b_p_et
);
9455 case PV_FENC
: return (char_u
*)&(curbuf
->b_p_fenc
);
9457 case PV_FF
: return (char_u
*)&(curbuf
->b_p_ff
);
9459 case PV_FT
: return (char_u
*)&(curbuf
->b_p_ft
);
9461 case PV_FO
: return (char_u
*)&(curbuf
->b_p_fo
);
9462 case PV_FLP
: return (char_u
*)&(curbuf
->b_p_flp
);
9463 case PV_IMI
: return (char_u
*)&(curbuf
->b_p_iminsert
);
9464 case PV_IMS
: return (char_u
*)&(curbuf
->b_p_imsearch
);
9465 case PV_INF
: return (char_u
*)&(curbuf
->b_p_inf
);
9466 case PV_ISK
: return (char_u
*)&(curbuf
->b_p_isk
);
9469 case PV_INEX
: return (char_u
*)&(curbuf
->b_p_inex
);
9472 #if defined(FEAT_CINDENT) && defined(FEAT_EVAL)
9473 case PV_INDE
: return (char_u
*)&(curbuf
->b_p_inde
);
9474 case PV_INDK
: return (char_u
*)&(curbuf
->b_p_indk
);
9477 case PV_FEX
: return (char_u
*)&(curbuf
->b_p_fex
);
9480 case PV_KEY
: return (char_u
*)&(curbuf
->b_p_key
);
9483 case PV_LISP
: return (char_u
*)&(curbuf
->b_p_lisp
);
9485 case PV_ML
: return (char_u
*)&(curbuf
->b_p_ml
);
9486 case PV_MPS
: return (char_u
*)&(curbuf
->b_p_mps
);
9487 case PV_MA
: return (char_u
*)&(curbuf
->b_p_ma
);
9488 case PV_MOD
: return (char_u
*)&(curbuf
->b_changed
);
9489 case PV_NF
: return (char_u
*)&(curbuf
->b_p_nf
);
9490 #ifdef FEAT_OSFILETYPE
9491 case PV_OFT
: return (char_u
*)&(curbuf
->b_p_oft
);
9493 case PV_PI
: return (char_u
*)&(curbuf
->b_p_pi
);
9495 case PV_QE
: return (char_u
*)&(curbuf
->b_p_qe
);
9497 case PV_RO
: return (char_u
*)&(curbuf
->b_p_ro
);
9498 #ifdef FEAT_SMARTINDENT
9499 case PV_SI
: return (char_u
*)&(curbuf
->b_p_si
);
9502 case PV_SN
: return (char_u
*)&(curbuf
->b_p_sn
);
9504 case PV_STS
: return (char_u
*)&(curbuf
->b_p_sts
);
9505 #ifdef FEAT_SEARCHPATH
9506 case PV_SUA
: return (char_u
*)&(curbuf
->b_p_sua
);
9508 case PV_SWF
: return (char_u
*)&(curbuf
->b_p_swf
);
9510 case PV_SMC
: return (char_u
*)&(curbuf
->b_p_smc
);
9511 case PV_SYN
: return (char_u
*)&(curbuf
->b_p_syn
);
9514 case PV_SPC
: return (char_u
*)&(curbuf
->b_p_spc
);
9515 case PV_SPF
: return (char_u
*)&(curbuf
->b_p_spf
);
9516 case PV_SPL
: return (char_u
*)&(curbuf
->b_p_spl
);
9518 case PV_SW
: return (char_u
*)&(curbuf
->b_p_sw
);
9519 case PV_TS
: return (char_u
*)&(curbuf
->b_p_ts
);
9520 case PV_TW
: return (char_u
*)&(curbuf
->b_p_tw
);
9521 case PV_TX
: return (char_u
*)&(curbuf
->b_p_tx
);
9522 #ifdef FEAT_PERSISTENT_UNDO
9523 case PV_UDF
: return (char_u
*)&(curbuf
->b_p_udf
);
9525 case PV_WM
: return (char_u
*)&(curbuf
->b_p_wm
);
9527 case PV_KMAP
: return (char_u
*)&(curbuf
->b_p_keymap
);
9530 case PV_VSTS
: return (char_u
*)&(curbuf
->b_p_vsts
);
9531 case PV_VTS
: return (char_u
*)&(curbuf
->b_p_vts
);
9533 default: EMSG(_("E356: get_varp ERROR"));
9535 /* always return a valid pointer to avoid a crash! */
9536 return (char_u
*)&(curbuf
->b_p_wm
);
9540 * Get the value of 'equalprg', either the buffer-local one or the global one.
9545 if (*curbuf
->b_p_ep
== NUL
)
9547 return curbuf
->b_p_ep
;
9550 #if defined(FEAT_WINDOWS) || defined(PROTO)
9552 * Copy options from one window to another.
9553 * Used when splitting a window.
9556 win_copy_options(wp_from
, wp_to
)
9560 copy_winopt(&wp_from
->w_onebuf_opt
, &wp_to
->w_onebuf_opt
);
9561 copy_winopt(&wp_from
->w_allbuf_opt
, &wp_to
->w_allbuf_opt
);
9562 # ifdef FEAT_RIGHTLEFT
9564 /* Is this right? */
9565 wp_to
->w_farsi
= wp_from
->w_farsi
;
9572 * Copy the options from one winopt_T to another.
9573 * Doesn't free the old option values in "to", use clear_winopt() for that.
9574 * The 'scroll' option is not copied, because it depends on the window height.
9575 * The 'previewwindow' option is reset, there can be only one preview window.
9578 copy_winopt(from
, to
)
9583 to
->wo_arab
= from
->wo_arab
;
9585 to
->wo_list
= from
->wo_list
;
9586 to
->wo_nu
= from
->wo_nu
;
9587 to
->wo_rnu
= from
->wo_rnu
;
9588 #ifdef FEAT_LINEBREAK
9589 to
->wo_nuw
= from
->wo_nuw
;
9591 #ifdef FEAT_RIGHTLEFT
9592 to
->wo_rl
= from
->wo_rl
;
9593 to
->wo_rlc
= vim_strsave(from
->wo_rlc
);
9596 to
->wo_stl
= vim_strsave(from
->wo_stl
);
9598 to
->wo_wrap
= from
->wo_wrap
;
9599 #ifdef FEAT_LINEBREAK
9600 to
->wo_lbr
= from
->wo_lbr
;
9601 to
->wo_bri
= from
->wo_bri
;
9602 to
->wo_brimin
= from
->wo_brimin
;
9604 #ifdef FEAT_SCROLLBIND
9605 to
->wo_scb
= from
->wo_scb
;
9608 to
->wo_spell
= from
->wo_spell
;
9611 to
->wo_cuc
= from
->wo_cuc
;
9612 to
->wo_cul
= from
->wo_cul
;
9615 to
->wo_diff
= from
->wo_diff
;
9618 to
->wo_fdc
= from
->wo_fdc
;
9619 to
->wo_fen
= from
->wo_fen
;
9620 to
->wo_fdi
= vim_strsave(from
->wo_fdi
);
9621 to
->wo_fml
= from
->wo_fml
;
9622 to
->wo_fdl
= from
->wo_fdl
;
9623 to
->wo_fdm
= vim_strsave(from
->wo_fdm
);
9624 to
->wo_fdn
= from
->wo_fdn
;
9626 to
->wo_fde
= vim_strsave(from
->wo_fde
);
9627 to
->wo_fdt
= vim_strsave(from
->wo_fdt
);
9629 to
->wo_fmr
= vim_strsave(from
->wo_fmr
);
9631 check_winopt(to
); /* don't want NULL pointers */
9635 * Check string options in a window for a NULL value.
9638 check_win_options(win
)
9641 check_winopt(&win
->w_onebuf_opt
);
9642 check_winopt(&win
->w_allbuf_opt
);
9646 * Check for NULL pointers in a winopt_T and replace them with empty_option.
9650 winopt_T
*wop UNUSED
;
9653 check_string_option(&wop
->wo_fdi
);
9654 check_string_option(&wop
->wo_fdm
);
9656 check_string_option(&wop
->wo_fde
);
9657 check_string_option(&wop
->wo_fdt
);
9659 check_string_option(&wop
->wo_fmr
);
9661 #ifdef FEAT_RIGHTLEFT
9662 check_string_option(&wop
->wo_rlc
);
9665 check_string_option(&wop
->wo_stl
);
9670 * Free the allocated memory inside a winopt_T.
9674 winopt_T
*wop UNUSED
;
9677 clear_string_option(&wop
->wo_fdi
);
9678 clear_string_option(&wop
->wo_fdm
);
9680 clear_string_option(&wop
->wo_fde
);
9681 clear_string_option(&wop
->wo_fdt
);
9683 clear_string_option(&wop
->wo_fmr
);
9685 #ifdef FEAT_RIGHTLEFT
9686 clear_string_option(&wop
->wo_rlc
);
9689 clear_string_option(&wop
->wo_stl
);
9694 * Copy global option values to local options for one buffer.
9695 * Used when creating a new buffer and sometimes when entering a buffer.
9697 * BCO_ENTER We will enter the buf buffer.
9698 * BCO_ALWAYS Always copy the options, but only set b_p_initialized when
9700 * BCO_NOHELP Don't copy the values to a help buffer.
9703 buf_copy_options(buf
, flags
)
9707 int should_copy
= TRUE
;
9708 char_u
*save_p_isk
= NULL
; /* init for GCC */
9710 int did_isk
= FALSE
;
9713 * Don't do anything of the buffer is invalid.
9715 if (buf
== NULL
|| !buf_valid(buf
))
9719 * Skip this when the option defaults have not been set yet. Happens when
9720 * main() allocates the first buffer.
9725 * Always copy when entering and 'cpo' contains 'S'.
9726 * Don't copy when already initialized.
9727 * Don't copy when 'cpo' contains 's' and not entering.
9728 * 'S' BCO_ENTER initialized 's' should_copy
9730 * yes no yes X FALSE
9736 if ((vim_strchr(p_cpo
, CPO_BUFOPTGLOB
) == NULL
|| !(flags
& BCO_ENTER
))
9737 && (buf
->b_p_initialized
9738 || (!(flags
& BCO_ENTER
)
9739 && vim_strchr(p_cpo
, CPO_BUFOPT
) != NULL
)))
9740 should_copy
= FALSE
;
9742 if (should_copy
|| (flags
& BCO_ALWAYS
))
9744 /* Don't copy the options specific to a help buffer when
9745 * BCO_NOHELP is given or the options were initialized already
9746 * (jumping back to a help file with CTRL-T or CTRL-O) */
9747 dont_do_help
= ((flags
& BCO_NOHELP
) && buf
->b_help
)
9748 || buf
->b_p_initialized
;
9749 if (dont_do_help
) /* don't free b_p_isk */
9751 save_p_isk
= buf
->b_p_isk
;
9752 buf
->b_p_isk
= NULL
;
9755 * Always free the allocated strings.
9756 * If not already initialized, set 'readonly' and copy 'fileformat'.
9758 if (!buf
->b_p_initialized
)
9760 free_buf_options(buf
, TRUE
);
9761 buf
->b_p_ro
= FALSE
; /* don't copy readonly */
9764 buf
->b_p_fenc
= vim_strsave(p_fenc
);
9766 buf
->b_p_ff
= vim_strsave(p_ff
);
9767 #if defined(FEAT_QUICKFIX)
9768 buf
->b_p_bh
= empty_option
;
9769 buf
->b_p_bt
= empty_option
;
9773 free_buf_options(buf
, FALSE
);
9776 buf
->b_p_ai_nopaste
= p_ai_nopaste
;
9779 buf
->b_p_tw_nopaste
= p_tw_nopaste
;
9780 buf
->b_p_tw_nobin
= p_tw_nobin
;
9782 buf
->b_p_wm_nopaste
= p_wm_nopaste
;
9783 buf
->b_p_wm_nobin
= p_wm_nobin
;
9784 buf
->b_p_bin
= p_bin
;
9786 buf
->b_p_bomb
= p_bomb
;
9789 buf
->b_p_et_nobin
= p_et_nobin
;
9791 buf
->b_p_ml_nobin
= p_ml_nobin
;
9792 buf
->b_p_inf
= p_inf
;
9793 buf
->b_p_swf
= p_swf
;
9794 #ifdef FEAT_INS_EXPAND
9795 buf
->b_p_cpt
= vim_strsave(p_cpt
);
9797 #ifdef FEAT_COMPL_FUNC
9798 buf
->b_p_cfu
= vim_strsave(p_cfu
);
9799 buf
->b_p_ofu
= vim_strsave(p_ofu
);
9801 buf
->b_p_sts
= p_sts
;
9802 buf
->b_p_sts_nopaste
= p_sts_nopaste
;
9804 buf
->b_p_vsts
= vim_strsave(p_vsts
);
9805 if (p_vsts
&& p_vsts
!= empty_option
)
9806 tabstop_set(p_vsts
, &buf
->b_p_vsts_ary
);
9808 buf
->b_p_vsts_ary
= 0;
9809 buf
->b_p_vsts_nopaste
= p_vsts_nopaste
9810 ? vim_strsave(p_vsts_nopaste
) : NULL
;
9815 #ifdef FEAT_COMMENTS
9816 buf
->b_p_com
= vim_strsave(p_com
);
9819 buf
->b_p_cms
= vim_strsave(p_cms
);
9821 buf
->b_p_fo
= vim_strsave(p_fo
);
9822 buf
->b_p_flp
= vim_strsave(p_flp
);
9823 buf
->b_p_nf
= vim_strsave(p_nf
);
9824 buf
->b_p_mps
= vim_strsave(p_mps
);
9825 #ifdef FEAT_SMARTINDENT
9830 buf
->b_p_cin
= p_cin
;
9831 buf
->b_p_cink
= vim_strsave(p_cink
);
9832 buf
->b_p_cino
= vim_strsave(p_cino
);
9835 /* Don't copy 'filetype', it must be detected */
9836 buf
->b_p_ft
= empty_option
;
9838 #ifdef FEAT_OSFILETYPE
9839 buf
->b_p_oft
= vim_strsave(p_oft
);
9842 #if defined(FEAT_SMARTINDENT) || defined(FEAT_CINDENT)
9843 buf
->b_p_cinw
= vim_strsave(p_cinw
);
9846 buf
->b_p_lisp
= p_lisp
;
9849 /* Don't copy 'syntax', it must be set */
9850 buf
->b_p_syn
= empty_option
;
9851 buf
->b_p_smc
= p_smc
;
9854 buf
->b_p_spc
= vim_strsave(p_spc
);
9855 (void)compile_cap_prog(buf
);
9856 buf
->b_p_spf
= vim_strsave(p_spf
);
9857 buf
->b_p_spl
= vim_strsave(p_spl
);
9859 #if defined(FEAT_CINDENT) && defined(FEAT_EVAL)
9860 buf
->b_p_inde
= vim_strsave(p_inde
);
9861 buf
->b_p_indk
= vim_strsave(p_indk
);
9863 #if defined(FEAT_EVAL)
9864 buf
->b_p_fex
= vim_strsave(p_fex
);
9867 buf
->b_p_key
= vim_strsave(p_key
);
9869 #ifdef FEAT_SEARCHPATH
9870 buf
->b_p_sua
= vim_strsave(p_sua
);
9873 buf
->b_p_keymap
= vim_strsave(p_keymap
);
9874 buf
->b_kmap_state
|= KEYMAP_INIT
;
9876 /* This isn't really an option, but copying the langmap and IME
9877 * state from the current buffer is better than resetting it. */
9878 buf
->b_p_iminsert
= p_iminsert
;
9879 buf
->b_p_imsearch
= p_imsearch
;
9881 /* options that are normally global but also have a local value
9882 * are not copied, start using the global value */
9884 #ifdef FEAT_QUICKFIX
9885 buf
->b_p_gp
= empty_option
;
9886 buf
->b_p_mp
= empty_option
;
9887 buf
->b_p_efm
= empty_option
;
9889 buf
->b_p_ep
= empty_option
;
9890 buf
->b_p_kp
= empty_option
;
9891 buf
->b_p_path
= empty_option
;
9892 buf
->b_p_tags
= empty_option
;
9894 buf
->b_p_def
= empty_option
;
9895 buf
->b_p_inc
= empty_option
;
9897 buf
->b_p_inex
= vim_strsave(p_inex
);
9900 #ifdef FEAT_INS_EXPAND
9901 buf
->b_p_dict
= empty_option
;
9902 buf
->b_p_tsr
= empty_option
;
9905 buf
->b_p_qe
= vim_strsave(p_qe
);
9907 #if defined(FEAT_BEVAL) && defined(FEAT_EVAL)
9908 buf
->b_p_bexpr
= empty_option
;
9910 #ifdef FEAT_PERSISTENT_UNDO
9911 buf
->b_p_udf
= p_udf
;
9915 * Don't copy the options set by ex_help(), use the saved values,
9916 * when going from a help buffer to a non-help buffer.
9917 * Don't touch these at all when BCO_NOHELP is used and going from
9918 * or to a help buffer.
9922 buf
->b_p_isk
= save_p_isk
;
9924 if (p_vts
&& p_vts
!= empty_option
&& !buf
->b_p_vts_ary
)
9925 tabstop_set(p_vts
, &buf
->b_p_vts_ary
);
9927 buf
->b_p_vts_ary
= 0;
9932 buf
->b_p_isk
= vim_strsave(p_isk
);
9936 buf
->b_p_vts
= vim_strsave(p_vts
);
9937 if (p_vts
&& p_vts
!= empty_option
&& !buf
->b_p_vts_ary
)
9938 tabstop_set(p_vts
, &buf
->b_p_vts_ary
);
9940 buf
->b_p_vts_ary
= 0;
9942 buf
->b_help
= FALSE
;
9943 #ifdef FEAT_QUICKFIX
9944 if (buf
->b_p_bt
[0] == 'h')
9945 clear_string_option(&buf
->b_p_bt
);
9952 * When the options should be copied (ignoring BCO_ALWAYS), set the
9953 * flag that indicates that the options have been initialized.
9956 buf
->b_p_initialized
= TRUE
;
9959 check_buf_options(buf
); /* make sure we don't have NULLs */
9961 (void)buf_init_chartab(buf
, FALSE
);
9965 * Reset the 'modifiable' option and its default value.
9972 curbuf
->b_p_ma
= FALSE
;
9974 opt_idx
= findoption((char_u
*)"ma");
9976 options
[opt_idx
].def_val
[VI_DEFAULT
] = FALSE
;
9980 * Set the global value for 'iminsert' to the local value.
9983 set_iminsert_global()
9985 p_iminsert
= curbuf
->b_p_iminsert
;
9989 * Set the global value for 'imsearch' to the local value.
9992 set_imsearch_global()
9994 p_imsearch
= curbuf
->b_p_imsearch
;
9997 #if defined(FEAT_CMDL_COMPL) || defined(PROTO)
9998 static int expand_option_idx
= -1;
9999 static char_u expand_option_name
[5] = {'t', '_', NUL
, NUL
, NUL
};
10000 static int expand_option_flags
= 0;
10003 set_context_in_set_cmd(xp
, arg
, opt_flags
)
10006 int opt_flags
; /* OPT_GLOBAL and/or OPT_LOCAL */
10009 long_u flags
= 0; /* init for GCC */
10010 int opt_idx
= 0; /* init for GCC */
10013 int is_term_option
= FALSE
;
10016 expand_option_flags
= opt_flags
;
10018 xp
->xp_context
= EXPAND_SETTINGS
;
10021 xp
->xp_pattern
= arg
;
10024 p
= arg
+ STRLEN(arg
) - 1;
10025 if (*p
== ' ' && *(p
- 1) != '\\')
10027 xp
->xp_pattern
= p
+ 1;
10033 /* count number of backslashes before ' ' or ',' */
10034 if (*p
== ' ' || *p
== ',')
10036 while (s
> arg
&& *(s
- 1) == '\\')
10039 /* break at a space with an even number of backslashes */
10040 if (*p
== ' ' && ((p
- s
) & 1) == 0)
10047 if (STRNCMP(p
, "no", 2) == 0 && STRNCMP(p
, "novice", 6) != 0)
10049 xp
->xp_context
= EXPAND_BOOL_SETTINGS
;
10052 if (STRNCMP(p
, "inv", 3) == 0)
10054 xp
->xp_context
= EXPAND_BOOL_SETTINGS
;
10057 xp
->xp_pattern
= arg
= p
;
10061 if (*p
++ == NUL
) /* expand terminal option name */
10063 key
= get_special_key_code(arg
+ 1);
10064 if (key
== 0) /* unknown name */
10066 xp
->xp_context
= EXPAND_NOTHING
;
10070 is_term_option
= TRUE
;
10071 expand_option_name
[2] = KEY2TERMCAP0(key
);
10072 expand_option_name
[3] = KEY2TERMCAP1(key
);
10076 if (p
[0] == 't' && p
[1] == '_')
10082 return; /* expand option name */
10084 is_term_option
= TRUE
;
10085 expand_option_name
[2] = p
[-2];
10086 expand_option_name
[3] = p
[-1];
10090 /* Allow * wildcard */
10091 while (ASCII_ISALNUM(*p
) || *p
== '_' || *p
== '*')
10097 opt_idx
= findoption(arg
);
10099 if (opt_idx
== -1 || options
[opt_idx
].var
== NULL
)
10101 xp
->xp_context
= EXPAND_NOTHING
;
10104 flags
= options
[opt_idx
].flags
;
10105 if (flags
& P_BOOL
)
10107 xp
->xp_context
= EXPAND_NOTHING
;
10112 /* handle "-=" and "+=" */
10113 if ((nextchar
== '-' || nextchar
== '+' || nextchar
== '^') && p
[1] == '=')
10118 if ((nextchar
!= '=' && nextchar
!= ':')
10119 || xp
->xp_context
== EXPAND_BOOL_SETTINGS
)
10121 xp
->xp_context
= EXPAND_UNSUCCESSFUL
;
10124 if (xp
->xp_context
!= EXPAND_BOOL_SETTINGS
&& p
[1] == NUL
)
10126 xp
->xp_context
= EXPAND_OLD_SETTING
;
10127 if (is_term_option
)
10128 expand_option_idx
= -1;
10130 expand_option_idx
= opt_idx
;
10131 xp
->xp_pattern
= p
+ 1;
10134 xp
->xp_context
= EXPAND_NOTHING
;
10135 if (is_term_option
|| (flags
& P_NUM
))
10138 xp
->xp_pattern
= p
+ 1;
10140 if (flags
& P_EXPAND
)
10142 p
= options
[opt_idx
].var
;
10143 if (p
== (char_u
*)&p_bdir
10144 || p
== (char_u
*)&p_dir
10145 || p
== (char_u
*)&p_path
10146 || p
== (char_u
*)&p_rtp
10147 #ifdef FEAT_SEARCHPATH
10148 || p
== (char_u
*)&p_cdpath
10150 #ifdef FEAT_SESSION
10151 || p
== (char_u
*)&p_vdir
10155 xp
->xp_context
= EXPAND_DIRECTORIES
;
10156 if (p
== (char_u
*)&p_path
10157 #ifdef FEAT_SEARCHPATH
10158 || p
== (char_u
*)&p_cdpath
10161 xp
->xp_backslash
= XP_BS_THREE
;
10163 xp
->xp_backslash
= XP_BS_ONE
;
10167 xp
->xp_context
= EXPAND_FILES
;
10168 /* for 'tags' need three backslashes for a space */
10169 if (p
== (char_u
*)&p_tags
)
10170 xp
->xp_backslash
= XP_BS_THREE
;
10172 xp
->xp_backslash
= XP_BS_ONE
;
10176 /* For an option that is a list of file names, find the start of the
10177 * last file name. */
10178 for (p
= arg
+ STRLEN(arg
) - 1; p
> xp
->xp_pattern
; --p
)
10180 /* count number of backslashes before ' ' or ',' */
10181 if (*p
== ' ' || *p
== ',')
10184 while (s
> xp
->xp_pattern
&& *(s
- 1) == '\\')
10186 if ((*p
== ' ' && (xp
->xp_backslash
== XP_BS_THREE
&& (p
- s
) < 3))
10187 || (*p
== ',' && (flags
& P_COMMA
) && ((p
- s
) & 1) == 0))
10189 xp
->xp_pattern
= p
+ 1;
10195 /* for 'spellsuggest' start at "file:" */
10196 if (options
[opt_idx
].var
== (char_u
*)&p_sps
10197 && STRNCMP(p
, "file:", 5) == 0)
10199 xp
->xp_pattern
= p
+ 5;
10209 ExpandSettings(xp
, regmatch
, num_file
, file
)
10211 regmatch_T
*regmatch
;
10215 int num_normal
= 0; /* Nr of matching non-term-code settings */
10216 int num_term
= 0; /* Nr of matching terminal code settings */
10223 char_u name_buf
[MAX_KEY_NAME_LEN
];
10224 static char *(names
[]) = {"all", "termcap"};
10225 int ic
= regmatch
->rm_ic
; /* remember the ignore-case flag */
10227 /* do this loop twice:
10228 * loop == 0: count the number of matching options
10229 * loop == 1: copy the matching options into allocated memory
10231 for (loop
= 0; loop
<= 1; ++loop
)
10233 regmatch
->rm_ic
= ic
;
10234 if (xp
->xp_context
!= EXPAND_BOOL_SETTINGS
)
10236 for (match
= 0; match
< (int)(sizeof(names
) / sizeof(char *));
10238 if (vim_regexec(regmatch
, (char_u
*)names
[match
], (colnr_T
)0))
10243 (*file
)[count
++] = vim_strsave((char_u
*)names
[match
]);
10246 for (opt_idx
= 0; (str
= (char_u
*)options
[opt_idx
].fullname
) != NULL
;
10249 if (options
[opt_idx
].var
== NULL
)
10251 if (xp
->xp_context
== EXPAND_BOOL_SETTINGS
10252 && !(options
[opt_idx
].flags
& P_BOOL
))
10254 is_term_opt
= istermoption(&options
[opt_idx
]);
10255 if (is_term_opt
&& num_normal
> 0)
10258 if (vim_regexec(regmatch
, str
, (colnr_T
)0)
10259 || (options
[opt_idx
].shortname
!= NULL
10260 && vim_regexec(regmatch
,
10261 (char_u
*)options
[opt_idx
].shortname
, (colnr_T
)0)))
10263 else if (is_term_opt
)
10268 name_buf
[3] = str
[2];
10269 name_buf
[4] = str
[3];
10272 if (vim_regexec(regmatch
, name_buf
, (colnr_T
)0))
10288 (*file
)[count
++] = vim_strsave(str
);
10292 * Check terminal key codes, these are not in the option table
10294 if (xp
->xp_context
!= EXPAND_BOOL_SETTINGS
&& num_normal
== 0)
10296 for (opt_idx
= 0; (str
= get_termcode(opt_idx
)) != NULL
; opt_idx
++)
10298 if (!isprint(str
[0]) || !isprint(str
[1]))
10303 name_buf
[2] = str
[0];
10304 name_buf
[3] = str
[1];
10308 if (vim_regexec(regmatch
, name_buf
, (colnr_T
)0))
10315 name_buf
[3] = str
[0];
10316 name_buf
[4] = str
[1];
10320 if (vim_regexec(regmatch
, name_buf
, (colnr_T
)0))
10328 (*file
)[count
++] = vim_strsave(name_buf
);
10333 * Check special key names.
10335 regmatch
->rm_ic
= TRUE
; /* ignore case here */
10336 for (opt_idx
= 0; (str
= get_key_name(opt_idx
)) != NULL
; opt_idx
++)
10339 STRCPY(name_buf
+ 1, str
);
10340 STRCAT(name_buf
, ">");
10342 if (vim_regexec(regmatch
, name_buf
, (colnr_T
)0))
10347 (*file
)[count
++] = vim_strsave(name_buf
);
10353 if (num_normal
> 0)
10354 *num_file
= num_normal
;
10355 else if (num_term
> 0)
10356 *num_file
= num_term
;
10359 *file
= (char_u
**)alloc((unsigned)(*num_file
* sizeof(char_u
*)));
10362 *file
= (char_u
**)"";
10371 ExpandOldSetting(num_file
, file
)
10375 char_u
*var
= NULL
; /* init for GCC */
10379 *file
= (char_u
**)alloc((unsigned)sizeof(char_u
*));
10384 * For a terminal key code expand_option_idx is < 0.
10386 if (expand_option_idx
< 0)
10388 var
= find_termcode(expand_option_name
+ 2);
10390 expand_option_idx
= findoption(expand_option_name
);
10393 if (expand_option_idx
>= 0)
10395 /* put string of option value in NameBuff */
10396 option_value2string(&options
[expand_option_idx
], expand_option_flags
);
10399 else if (var
== NULL
)
10400 var
= (char_u
*)"";
10402 /* A backslash is required before some characters. This is the reverse of
10403 * what happens in do_set(). */
10404 buf
= vim_strsave_escaped(var
, escape_chars
);
10413 #ifdef BACKSLASH_IN_FILENAME
10414 /* For MS-Windows et al. we don't double backslashes at the start and
10415 * before a file name character. */
10416 for (var
= buf
; *var
!= NUL
; mb_ptr_adv(var
))
10417 if (var
[0] == '\\' && var
[1] == '\\'
10418 && expand_option_idx
>= 0
10419 && (options
[expand_option_idx
].flags
& P_EXPAND
)
10420 && vim_isfilec(var
[2])
10421 && (var
[2] != '\\' || (var
== buf
&& var
[4] != '\\')))
10422 STRMOVE(var
, var
+ 1);
10432 * Get the value for the numeric or string option *opp in a nice format into
10433 * NameBuff[]. Must not be called with a hidden option!
10436 option_value2string(opp
, opt_flags
)
10437 struct vimoption
*opp
;
10438 int opt_flags
; /* OPT_GLOBAL and/or OPT_LOCAL */
10442 varp
= get_varp_scope(opp
, opt_flags
);
10444 if (opp
->flags
& P_NUM
)
10448 if (wc_use_keyname(varp
, &wc
))
10449 STRCPY(NameBuff
, get_special_key_name((int)wc
, 0));
10451 STRCPY(NameBuff
, transchar((int)wc
));
10453 sprintf((char *)NameBuff
, "%ld", *(long *)varp
);
10455 else /* P_STRING */
10457 varp
= *(char_u
**)(varp
);
10458 if (varp
== NULL
) /* just in case */
10461 /* don't show the actual value of 'key', only that it's set */
10462 else if (opp
->var
== (char_u
*)&p_key
&& *varp
)
10463 STRCPY(NameBuff
, "*****");
10465 else if (opp
->flags
& P_EXPAND
)
10466 home_replace(NULL
, varp
, NameBuff
, MAXPATHL
, FALSE
);
10467 /* Translate 'pastetoggle' into special key names */
10468 else if ((char_u
**)opp
->var
== &p_pt
)
10469 str2specialbuf(p_pt
, NameBuff
, MAXPATHL
);
10471 vim_strncpy(NameBuff
, varp
, MAXPATHL
- 1);
10476 * Return TRUE if "varp" points to 'wildchar' or 'wildcharm' and it can be
10477 * printed as a keyname.
10478 * "*wcp" is set to the value of the option if it's 'wildchar' or 'wildcharm'.
10481 wc_use_keyname(varp
, wcp
)
10485 if (((long *)varp
== &p_wc
) || ((long *)varp
== &p_wcm
))
10487 *wcp
= *(long *)varp
;
10488 if (IS_SPECIAL(*wcp
) || find_special_key_in_table((int)*wcp
) >= 0)
10494 #ifdef FEAT_LANGMAP
10496 * Any character has an equivalent 'langmap' character. This is used for
10497 * keyboards that have a special language mode that sends characters above
10498 * 128 (although other characters can be translated too). The "to" field is a
10499 * Vim command character. This avoids having to switch the keyboard back to
10500 * ASCII mode when leaving Insert mode.
10502 * langmap_mapchar[] maps any of 256 chars to an ASCII char used for Vim
10504 * When FEAT_MBYTE is defined langmap_mapga.ga_data is a sorted table of
10505 * langmap_entry_T. This does the same as langmap_mapchar[] for characters >=
10510 * With multi-byte support use growarray for 'langmap' chars >= 256
10518 static garray_T langmap_mapga
;
10519 static void langmap_set_entry
__ARGS((int from
, int to
));
10522 * Search for an entry in "langmap_mapga" for "from". If found set the "to"
10523 * field. If not found insert a new entry at the appropriate location.
10526 langmap_set_entry(from
, to
)
10530 langmap_entry_T
*entries
= (langmap_entry_T
*)(langmap_mapga
.ga_data
);
10532 int b
= langmap_mapga
.ga_len
;
10534 /* Do a binary search for an existing entry. */
10537 int i
= (a
+ b
) / 2;
10538 int d
= entries
[i
].from
- from
;
10542 entries
[i
].to
= to
;
10551 if (ga_grow(&langmap_mapga
, 1) != OK
)
10552 return; /* out of memory */
10554 /* insert new entry at position "a" */
10555 entries
= (langmap_entry_T
*)(langmap_mapga
.ga_data
) + a
;
10556 mch_memmove(entries
+ 1, entries
,
10557 (langmap_mapga
.ga_len
- a
) * sizeof(langmap_entry_T
));
10558 ++langmap_mapga
.ga_len
;
10559 entries
[0].from
= from
;
10560 entries
[0].to
= to
;
10564 * Apply 'langmap' to multi-byte character "c" and return the result.
10567 langmap_adjust_mb(c
)
10570 langmap_entry_T
*entries
= (langmap_entry_T
*)(langmap_mapga
.ga_data
);
10572 int b
= langmap_mapga
.ga_len
;
10576 int i
= (a
+ b
) / 2;
10577 int d
= entries
[i
].from
- c
;
10580 return entries
[i
].to
; /* found matching entry */
10586 return c
; /* no entry found, return "c" unmodified */
10595 for (i
= 0; i
< 256; i
++)
10596 langmap_mapchar
[i
] = i
; /* we init with a one-to-one map */
10598 ga_init2(&langmap_mapga
, sizeof(langmap_entry_T
), 8);
10603 * Called when langmap option is set; the language map can be
10604 * changed at any time!
10614 ga_clear(&langmap_mapga
); /* clear the previous map first */
10616 langmap_init(); /* back to one-to-one map */
10618 for (p
= p_langmap
; p
[0] != NUL
; )
10620 for (p2
= p
; p2
[0] != NUL
&& p2
[0] != ',' && p2
[0] != ';';
10623 if (p2
[0] == '\\' && p2
[1] != NUL
)
10627 ++p2
; /* abcd;ABCD form, p2 points to A */
10629 p2
= NULL
; /* aAbBcCdD form, p2 is NULL */
10632 if (p
[0] == '\\' && p
[1] != NUL
)
10635 from
= (*mb_ptr2char
)(p
);
10645 to
= (*mb_ptr2char
)(p
);
10655 to
= (*mb_ptr2char
)(p2
);
10662 EMSG2(_("E357: 'langmap': Matching character missing for %s"),
10669 langmap_set_entry(from
, to
);
10672 langmap_mapchar
[from
& 255] = to
;
10674 /* Advance to next pair */
10694 EMSG2(_("E358: 'langmap': Extra characters after semicolon: %s"), p
);
10708 * Return TRUE if format option 'x' is in effect.
10709 * Take care of no formatting when 'paste' is set.
10712 has_format_option(x
)
10717 return (vim_strchr(curbuf
->b_p_fo
, x
) != NULL
);
10721 * Return TRUE if "x" is present in 'shortmess' option, or
10722 * 'shortmess' contains 'a' and "x" is present in SHM_A.
10728 return ( vim_strchr(p_shm
, x
) != NULL
10729 || (vim_strchr(p_shm
, 'a') != NULL
10730 && vim_strchr((char_u
*)SHM_A
, x
) != NULL
));
10734 * paste_option_changed() - Called after p_paste was set or reset.
10737 paste_option_changed()
10739 static int old_p_paste
= FALSE
;
10740 static int save_sm
= 0;
10741 #ifdef FEAT_CMDL_INFO
10742 static int save_ru
= 0;
10744 #ifdef FEAT_RIGHTLEFT
10745 static int save_ri
= 0;
10746 static int save_hkmap
= 0;
10753 * Paste switched from off to on.
10754 * Save the current values, so they can be restored later.
10758 /* save options for each buffer */
10759 for (buf
= firstbuf
; buf
!= NULL
; buf
= buf
->b_next
)
10761 buf
->b_p_tw_nopaste
= buf
->b_p_tw
;
10762 buf
->b_p_wm_nopaste
= buf
->b_p_wm
;
10763 buf
->b_p_sts_nopaste
= buf
->b_p_sts
;
10764 buf
->b_p_ai_nopaste
= buf
->b_p_ai
;
10765 #ifdef FEAT_VARTABS
10766 if (buf
->b_p_vsts_nopaste
)
10767 vim_free(buf
->b_p_vsts_nopaste
);
10768 buf
->b_p_vsts_nopaste
= buf
->b_p_vsts
&& buf
->b_p_vsts
!= empty_option
10769 ? vim_strsave(buf
->b_p_vsts
) : NULL
;
10773 /* save global options */
10775 #ifdef FEAT_CMDL_INFO
10778 #ifdef FEAT_RIGHTLEFT
10780 save_hkmap
= p_hkmap
;
10782 /* save global values for local buffer options */
10783 p_tw_nopaste
= p_tw
;
10784 p_wm_nopaste
= p_wm
;
10785 p_sts_nopaste
= p_sts
;
10786 p_ai_nopaste
= p_ai
;
10787 #ifdef FEAT_VARTABS
10788 if (p_vsts_nopaste
)
10789 vim_free(p_vsts_nopaste
);
10790 p_vsts_nopaste
= p_vsts
&& p_vsts
!= empty_option
? vim_strsave(p_vsts
) : NULL
;
10795 * Always set the option values, also when 'paste' is set when it is
10798 /* set options for each buffer */
10799 for (buf
= firstbuf
; buf
!= NULL
; buf
= buf
->b_next
)
10801 buf
->b_p_tw
= 0; /* textwidth is 0 */
10802 buf
->b_p_wm
= 0; /* wrapmargin is 0 */
10803 buf
->b_p_sts
= 0; /* softtabstop is 0 */
10804 buf
->b_p_ai
= 0; /* no auto-indent */
10805 #ifdef FEAT_VARTABS
10807 free_string_option(buf
->b_p_vsts
);
10808 buf
->b_p_vsts
= empty_option
;
10809 if (buf
->b_p_vsts_ary
)
10810 vim_free(buf
->b_p_vsts_ary
);
10811 buf
->b_p_vsts_ary
= 0;
10815 /* set global options */
10816 p_sm
= 0; /* no showmatch */
10817 #ifdef FEAT_CMDL_INFO
10818 # ifdef FEAT_WINDOWS
10820 status_redraw_all(); /* redraw to remove the ruler */
10822 p_ru
= 0; /* no ruler */
10824 #ifdef FEAT_RIGHTLEFT
10825 p_ri
= 0; /* no reverse insert */
10826 p_hkmap
= 0; /* no Hebrew keyboard */
10828 /* set global values for local buffer options */
10833 #ifdef FEAT_VARTABS
10835 free_string_option(p_vsts
);
10836 p_vsts
= empty_option
;
10841 * Paste switched from on to off: Restore saved values.
10843 else if (old_p_paste
)
10845 /* restore options for each buffer */
10846 for (buf
= firstbuf
; buf
!= NULL
; buf
= buf
->b_next
)
10848 buf
->b_p_tw
= buf
->b_p_tw_nopaste
;
10849 buf
->b_p_wm
= buf
->b_p_wm_nopaste
;
10850 buf
->b_p_sts
= buf
->b_p_sts_nopaste
;
10851 buf
->b_p_ai
= buf
->b_p_ai_nopaste
;
10852 #ifdef FEAT_VARTABS
10854 free_string_option(buf
->b_p_vsts
);
10855 buf
->b_p_vsts
= buf
->b_p_vsts_nopaste
10856 ? vim_strsave(buf
->b_p_vsts_nopaste
) : empty_option
;
10857 if (buf
->b_p_vsts_ary
)
10858 vim_free(buf
->b_p_vsts_ary
);
10859 if (buf
->b_p_vsts
&& buf
->b_p_vsts
!= empty_option
)
10860 tabstop_set(buf
->b_p_vsts
, &buf
->b_p_vsts_ary
);
10862 buf
->b_p_vsts_ary
= 0;
10866 /* restore global options */
10868 #ifdef FEAT_CMDL_INFO
10869 # ifdef FEAT_WINDOWS
10870 if (p_ru
!= save_ru
)
10871 status_redraw_all(); /* redraw to draw the ruler */
10875 #ifdef FEAT_RIGHTLEFT
10877 p_hkmap
= save_hkmap
;
10879 /* set global values for local buffer options */
10880 p_tw
= p_tw_nopaste
;
10881 p_wm
= p_wm_nopaste
;
10882 p_sts
= p_sts_nopaste
;
10883 p_ai
= p_ai_nopaste
;
10884 #ifdef FEAT_VARTABS
10886 free_string_option(p_vsts
);
10887 p_vsts
= p_vsts_nopaste
? vim_strsave(p_vsts_nopaste
) : empty_option
;
10891 old_p_paste
= p_paste
;
10895 * vimrc_found() - Called when a ".vimrc" or "VIMINIT" has been found.
10897 * Reset 'compatible' and set the values for options that didn't get set yet
10898 * to the Vim defaults.
10899 * Don't do this if the 'compatible' option has been set or reset before.
10900 * When "fname" is not NULL, use it to set $"envname" when it wasn't set yet.
10903 vimrc_found(fname
, envname
)
10908 int dofree
= FALSE
;
10911 if (!option_was_set((char_u
*)"cp"))
10914 for (opt_idx
= 0; !istermoption(&options
[opt_idx
]); opt_idx
++)
10915 if (!(options
[opt_idx
].flags
& (P_WAS_SET
|P_VI_DEF
)))
10916 set_option_default(opt_idx
, OPT_FREE
, FALSE
);
10922 p
= vim_getenv(envname
, &dofree
);
10925 /* Set $MYVIMRC to the first vimrc file found. */
10926 p
= FullName_save(fname
, FALSE
);
10929 vim_setenv(envname
, p
);
10939 * Set 'compatible' on or off. Called for "-C" and "-N" command line arg.
10942 change_compatible(on
)
10952 opt_idx
= findoption((char_u
*)"cp");
10954 options
[opt_idx
].flags
|= P_WAS_SET
;
10958 * Return TRUE when option "name" has been set.
10961 option_was_set(name
)
10966 idx
= findoption(name
);
10967 if (idx
< 0) /* unknown option */
10969 if (options
[idx
].flags
& P_WAS_SET
)
10975 * compatible_set() - Called when 'compatible' has been set or unset.
10977 * When 'compatible' set: Set all relevant options (those that have the P_VIM)
10978 * flag) to a Vi compatible value.
10979 * When 'compatible' is unset: Set all options that have a different default
10980 * for Vim (without the P_VI_DEF flag) to that default.
10987 for (opt_idx
= 0; !istermoption(&options
[opt_idx
]); opt_idx
++)
10988 if ( ((options
[opt_idx
].flags
& P_VIM
) && p_cp
)
10989 || (!(options
[opt_idx
].flags
& P_VI_DEF
) && !p_cp
))
10990 set_option_default(opt_idx
, OPT_FREE
, p_cp
);
10994 #ifdef FEAT_LINEBREAK
10996 # if defined(__BORLANDC__) && (__BORLANDC__ < 0x500)
10997 /* Borland C++ screws up loop optimisation here (negri) */
10998 #pragma option -O-l
11002 * fill_breakat_flags() -- called when 'breakat' changes value.
11005 fill_breakat_flags()
11010 for (i
= 0; i
< 256; i
++)
11011 breakat_flags
[i
] = FALSE
;
11013 if (p_breakat
!= NULL
)
11014 for (p
= p_breakat
; *p
; p
++)
11015 breakat_flags
[*p
] = TRUE
;
11018 # if defined(__BORLANDC__) && (__BORLANDC__ < 0x500)
11019 #pragma option -O.l
11025 * Check an option that can be a range of string values.
11027 * Return OK for correct value, FAIL otherwise.
11028 * Empty is always OK.
11031 check_opt_strings(val
, values
, list
)
11034 int list
; /* when TRUE: accept a list of values */
11036 return opt_strings_flags(val
, values
, NULL
, list
);
11040 * Handle an option that can be a range of string values.
11041 * Set a flag in "*flagp" for each string present.
11043 * Return OK for correct value, FAIL otherwise.
11044 * Empty is always OK.
11047 opt_strings_flags(val
, values
, flagp
, list
)
11048 char_u
*val
; /* new value */
11049 char **values
; /* array of valid string values */
11051 int list
; /* when TRUE: accept a list of values */
11055 unsigned new_flags
= 0;
11061 if (values
[i
] == NULL
) /* val not found in values[] */
11064 len
= (int)STRLEN(values
[i
]);
11065 if (STRNCMP(values
[i
], val
, len
) == 0
11066 && ((list
&& val
[len
] == ',') || val
[len
] == NUL
))
11068 val
+= len
+ (val
[len
] == ',');
11069 new_flags
|= (1 << i
);
11070 break; /* check next item in val list */
11075 *flagp
= new_flags
;
11081 * Read the 'wildmode' option, fill wim_flags[].
11086 char_u new_wim_flags
[4];
11091 for (i
= 0; i
< 4; ++i
)
11092 new_wim_flags
[i
] = 0;
11094 for (p
= p_wim
; *p
; ++p
)
11096 for (i
= 0; ASCII_ISALPHA(p
[i
]); ++i
)
11098 if (p
[i
] != NUL
&& p
[i
] != ',' && p
[i
] != ':')
11100 if (i
== 7 && STRNCMP(p
, "longest", 7) == 0)
11101 new_wim_flags
[idx
] |= WIM_LONGEST
;
11102 else if (i
== 4 && STRNCMP(p
, "full", 4) == 0)
11103 new_wim_flags
[idx
] |= WIM_FULL
;
11104 else if (i
== 4 && STRNCMP(p
, "list", 4) == 0)
11105 new_wim_flags
[idx
] |= WIM_LIST
;
11119 /* fill remaining entries with last flag */
11122 new_wim_flags
[idx
+ 1] = new_wim_flags
[idx
];
11126 /* only when there are no errors, wim_flags[] is changed */
11127 for (i
= 0; i
< 4; ++i
)
11128 wim_flags
[i
] = new_wim_flags
[i
];
11133 * Check if backspacing over something is allowed.
11137 int what
; /* BS_INDENT, BS_EOL or BS_START */
11141 case '2': return TRUE
;
11142 case '1': return (what
!= BS_START
);
11143 case '0': return FALSE
;
11145 return vim_strchr(p_bs
, what
) != NULL
;
11149 * Save the current values of 'fileformat' and 'fileencoding', so that we know
11150 * the file must be considered changed when the value is different.
11156 buf
->b_start_ffc
= *buf
->b_p_ff
;
11157 buf
->b_start_eol
= buf
->b_p_eol
;
11159 buf
->b_start_bomb
= buf
->b_p_bomb
;
11161 /* Only use free/alloc when necessary, they take time. */
11162 if (buf
->b_start_fenc
== NULL
11163 || STRCMP(buf
->b_start_fenc
, buf
->b_p_fenc
) != 0)
11165 vim_free(buf
->b_start_fenc
);
11166 buf
->b_start_fenc
= vim_strsave(buf
->b_p_fenc
);
11172 * Return TRUE if 'fileformat' and/or 'fileencoding' has a different value
11173 * from when editing started (save_file_ff() called).
11174 * Also when 'endofline' was changed and 'binary' is set, or when 'bomb' was
11175 * changed and 'binary' is not set.
11176 * Don't consider a new, empty buffer to be changed.
11179 file_ff_differs(buf
)
11182 /* In a buffer that was never loaded the options are not valid. */
11183 if (buf
->b_flags
& BF_NEVERLOADED
)
11185 if ((buf
->b_flags
& BF_NEW
)
11186 && buf
->b_ml
.ml_line_count
== 1
11187 && *ml_get_buf(buf
, (linenr_T
)1, FALSE
) == NUL
)
11189 if (buf
->b_start_ffc
!= *buf
->b_p_ff
)
11191 if (buf
->b_p_bin
&& buf
->b_start_eol
!= buf
->b_p_eol
)
11194 if (!buf
->b_p_bin
&& buf
->b_start_bomb
!= buf
->b_p_bomb
)
11196 if (buf
->b_start_fenc
== NULL
)
11197 return (*buf
->b_p_fenc
!= NUL
);
11198 return (STRCMP(buf
->b_start_fenc
, buf
->b_p_fenc
) != 0);
11205 * return OK if "p" is a valid fileformat name, FAIL otherwise.
11211 return check_opt_strings(p
, p_ff_values
, FALSE
);
11214 #ifdef FEAT_VARTABS
11217 * Set the integer values corresponding to the string setting of 'vartabstop'.
11220 tabstop_set(var
, array
)
11228 if ((!var
[0] || (var
[0] == '0' && !var
[1])))
11234 for (cp
= var
; *cp
; ++cp
)
11236 if (cp
== var
|| *(cp
- 1) == ',')
11237 if (atoi((char *)cp
) <= 0)
11240 if (VIM_ISDIGIT(*cp
))
11242 if (*cp
== ',' && cp
> var
&& *(cp
- 1) != ',')
11250 *array
= (int *) alloc((unsigned) ((valcount
+ 1) * sizeof(int)));
11251 (*array
)[0] = valcount
;
11254 for (cp
= var
; *cp
;)
11256 (*array
)[t
++] = atoi((char *)cp
);
11257 while (*cp
&& *cp
!= ',')
11267 * Calculate the number of screen spaces a tab will occupy.
11268 * If vts is set then the tab widths are taken from that array,
11269 * otherwise the value of ts is used.
11272 tabstop_padding(col
, ts
, vts
)
11278 colnr_T tabcol
= 0;
11284 if (vts
== 0 || vts
[0] == 0)
11285 return ts
- (col
% ts
);
11289 for (t
= 1; t
<= tabcount
; ++t
)
11294 padding
= (int)(tabcol
- col
);
11299 padding
= vts
[tabcount
] - (int)((col
- tabcol
) % vts
[tabcount
]);
11305 * Find the size of the tab that covers a particular column.
11308 tabstop_at(col
, ts
, vts
)
11314 colnr_T tabcol
= 0;
11318 if (vts
== 0 || vts
[0] == 0)
11322 for (t
= 1; t
<= tabcount
; ++t
)
11332 tab_size
= vts
[tabcount
];
11338 * Find the column on which a tab starts.
11341 tabstop_start(col
, ts
, vts
)
11347 colnr_T tabcol
= 0;
11350 if (vts
== 0 || vts
[0] == 0)
11351 return (col
/ ts
) * ts
;
11354 for (t
= 1; t
<= tabcount
; ++t
)
11358 return tabcol
- vts
[t
];
11361 int excess
= tabcol
% vts
[tabcount
];
11362 return excess
+ ((col
- excess
) / vts
[tabcount
]) * vts
[tabcount
];
11366 * Find the number of tabs and spaces necessary to get from one column
11370 tabstop_fromto(start_col
, end_col
, ts
, vts
, ntabs
, nspcs
)
11378 int spaces
= end_col
- start_col
;
11379 colnr_T tabcol
= 0;
11384 if (vts
== 0 || vts
[0] == 0)
11387 int initspc
= ts
- (start_col
% ts
);
11388 if (spaces
>= initspc
)
11393 tabs
+= spaces
/ ts
;
11394 spaces
-= (spaces
/ ts
) * ts
;
11401 /* Find the padding needed to reach the next tabstop. */
11403 for (t
= 1; t
<= tabcount
; ++t
)
11406 if (tabcol
> start_col
)
11408 padding
= (int)(tabcol
- start_col
);
11413 padding
= vts
[tabcount
] - (int)((start_col
- tabcol
) % vts
[tabcount
]);
11415 /* If the space needed is less than the padding no tabs can be used. */
11416 if (spaces
< padding
)
11426 /* At least one tab has been used. See if any more will fit. */
11427 while (spaces
!= 0 && ++t
<= tabcount
)
11430 if (spaces
< padding
)
11439 *ntabs
+= spaces
/ vts
[tabcount
];
11440 *nspcs
= spaces
% vts
[tabcount
];
11444 * See if two tabstop arrays contain the same values.
11447 tabstop_eq(ts1
, ts2
)
11453 if ((ts1
== 0 && ts2
) || (ts1
&& ts2
== 0))
11457 if (ts1
[0] != ts2
[0])
11460 for (t
= 1; t
<= ts1
[0]; ++t
)
11461 if (ts1
[t
] != ts2
[t
])
11468 * Copy a tabstop array, allocating space for the new array.
11471 tabstop_copy(oldts
)
11480 newts
= (int *) alloc((unsigned) ((oldts
[0] + 1) * sizeof(int)));
11481 for (t
= 0; t
<= oldts
[0]; ++t
)
11482 newts
[t
] = oldts
[t
];
11488 * Return a count of the number of tabstops.
11494 return ts
? ts
[0] : 0;
11498 * Return the first tabstop, or 8 if there are no tabstops defined.
11504 return ts
? ts
[1] : 8;