7
|
1 /* vi:set ts=8 sts=4 sw=4:
|
|
2 *
|
|
3 * VIM - Vi IMproved by Bram Moolenaar
|
|
4 *
|
|
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.
|
|
8 */
|
|
9
|
|
10 /*
|
|
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.
|
|
32 */
|
|
33
|
|
34 #define IN_OPTION_C
|
|
35 #include "vim.h"
|
|
36
|
|
37 /*
|
|
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_BOTH is added: global option which also has a local value.
|
|
42 */
|
|
43 #define PV_BOTH 0x1000
|
|
44 #define OPT_BOTH(x) (idopt_T)(PV_BOTH + (int)(x))
|
|
45
|
|
46 typedef enum
|
|
47 {
|
|
48 PV_NONE = 0
|
|
49 , PV_AI
|
|
50 , PV_AR
|
|
51 , PV_ARAB
|
|
52 , PV_BH
|
|
53 , PV_BIN
|
|
54 , PV_BL
|
|
55 , PV_BOMB
|
|
56 , PV_BT
|
|
57 , PV_CI
|
|
58 , PV_CIN
|
|
59 , PV_CINK
|
|
60 , PV_CINO
|
|
61 , PV_CINW
|
|
62 , PV_CMS
|
|
63 , PV_COM
|
|
64 , PV_CPT
|
12
|
65 , PV_CFU
|
7
|
66 , PV_DEF
|
|
67 , PV_DICT
|
|
68 , PV_DIFF
|
|
69 , PV_EFM
|
|
70 , PV_EOL
|
|
71 , PV_EP
|
|
72 , PV_ET
|
|
73 , PV_FDC
|
|
74 , PV_FDE
|
|
75 , PV_FDI
|
|
76 , PV_FDL
|
|
77 , PV_FDM
|
|
78 , PV_FDN
|
|
79 , PV_FDT
|
|
80 , PV_FEN
|
|
81 , PV_FENC
|
667
|
82 , PV_FEX
|
7
|
83 , PV_FF
|
|
84 , PV_FML
|
|
85 , PV_FMR
|
41
|
86 , PV_FLP
|
7
|
87 , PV_FO
|
|
88 , PV_FT
|
|
89 , PV_GP
|
|
90 , PV_IMI
|
|
91 , PV_IMS
|
|
92 , PV_INC
|
|
93 , PV_INDE
|
|
94 , PV_INDK
|
|
95 , PV_INEX
|
|
96 , PV_INF
|
|
97 , PV_ISK
|
|
98 , PV_KEY
|
|
99 , PV_KMAP
|
|
100 , PV_KP
|
|
101 , PV_LBR
|
|
102 , PV_LISP
|
|
103 , PV_LIST
|
|
104 , PV_MA
|
|
105 , PV_ML
|
|
106 , PV_MOD
|
|
107 , PV_MP
|
|
108 , PV_MPS
|
|
109 , PV_NF
|
|
110 , PV_NU
|
13
|
111 , PV_NUW
|
7
|
112 , PV_OFT
|
502
|
113 , PV_OFU
|
7
|
114 , PV_PATH
|
|
115 , PV_PI
|
|
116 , PV_PVW
|
12
|
117 , PV_QE
|
7
|
118 , PV_RL
|
|
119 , PV_RLC
|
|
120 , PV_RO
|
|
121 , PV_SCBIND
|
|
122 , PV_SCROLL
|
|
123 , PV_SI
|
221
|
124 , PV_SN
|
|
125 , PV_SPELL
|
386
|
126 , PV_SPC
|
314
|
127 , PV_SPF
|
221
|
128 , PV_SPL
|
40
|
129 , PV_STL
|
7
|
130 , PV_STS
|
|
131 , PV_SUA
|
|
132 , PV_SW
|
|
133 , PV_SWF
|
410
|
134 , PV_SMC
|
7
|
135 , PV_SYN
|
|
136 , PV_TAGS
|
|
137 , PV_TS
|
|
138 , PV_TSR
|
|
139 , PV_TW
|
|
140 , PV_TX
|
|
141 , PV_WFH
|
|
142 , PV_WM
|
|
143 , PV_WRAP
|
|
144 } idopt_T;
|
|
145
|
|
146 /*
|
|
147 * Options local to a window have a value local to a buffer and global to all
|
|
148 * buffers. Indicate this by setting "var" to VAR_WIN.
|
|
149 */
|
|
150 #define VAR_WIN ((char_u *)-1)
|
|
151
|
|
152 /*
|
|
153 * These the global values for options which are also local to a buffer.
|
|
154 * Only to be used in option.c!
|
|
155 */
|
|
156 static int p_ai;
|
|
157 static int p_bin;
|
|
158 #ifdef FEAT_MBYTE
|
|
159 static int p_bomb;
|
|
160 #endif
|
|
161 #if defined(FEAT_QUICKFIX)
|
|
162 static char_u *p_bh;
|
|
163 static char_u *p_bt;
|
|
164 #endif
|
|
165 static int p_bl;
|
|
166 static int p_ci;
|
|
167 #ifdef FEAT_CINDENT
|
|
168 static int p_cin;
|
|
169 static char_u *p_cink;
|
|
170 static char_u *p_cino;
|
|
171 #endif
|
|
172 #if defined(FEAT_SMARTINDENT) || defined(FEAT_CINDENT)
|
|
173 static char_u *p_cinw;
|
|
174 #endif
|
|
175 #ifdef FEAT_COMMENTS
|
|
176 static char_u *p_com;
|
|
177 #endif
|
|
178 #ifdef FEAT_FOLDING
|
|
179 static char_u *p_cms;
|
|
180 #endif
|
|
181 #ifdef FEAT_INS_EXPAND
|
|
182 static char_u *p_cpt;
|
|
183 #endif
|
12
|
184 #ifdef FEAT_COMPL_FUNC
|
|
185 static char_u *p_cfu;
|
502
|
186 static char_u *p_ofu;
|
12
|
187 #endif
|
7
|
188 static int p_eol;
|
|
189 static int p_et;
|
|
190 #ifdef FEAT_MBYTE
|
|
191 static char_u *p_fenc;
|
|
192 #endif
|
|
193 static char_u *p_ff;
|
|
194 static char_u *p_fo;
|
41
|
195 static char_u *p_flp;
|
7
|
196 #ifdef FEAT_AUTOCMD
|
|
197 static char_u *p_ft;
|
|
198 #endif
|
|
199 static long p_iminsert;
|
|
200 static long p_imsearch;
|
|
201 #if defined(FEAT_FIND_ID) && defined(FEAT_EVAL)
|
|
202 static char_u *p_inex;
|
|
203 #endif
|
|
204 #if defined(FEAT_CINDENT) && defined(FEAT_EVAL)
|
|
205 static char_u *p_inde;
|
|
206 static char_u *p_indk;
|
|
207 #endif
|
667
|
208 #if defined(FEAT_EVAL)
|
|
209 static char_u *p_fex;
|
|
210 #endif
|
7
|
211 static int p_inf;
|
|
212 static char_u *p_isk;
|
|
213 #ifdef FEAT_CRYPT
|
|
214 static char_u *p_key;
|
|
215 #endif
|
|
216 #ifdef FEAT_LISP
|
|
217 static int p_lisp;
|
|
218 #endif
|
|
219 static int p_ml;
|
|
220 static int p_ma;
|
|
221 static int p_mod;
|
|
222 static char_u *p_mps;
|
|
223 static char_u *p_nf;
|
|
224 #ifdef FEAT_OSFILETYPE
|
|
225 static char_u *p_oft;
|
|
226 #endif
|
|
227 static int p_pi;
|
12
|
228 #ifdef FEAT_TEXTOBJ
|
|
229 static char_u *p_qe;
|
|
230 #endif
|
7
|
231 static int p_ro;
|
|
232 #ifdef FEAT_SMARTINDENT
|
|
233 static int p_si;
|
|
234 #endif
|
|
235 #ifndef SHORT_FNAME
|
|
236 static int p_sn;
|
|
237 #endif
|
|
238 static long p_sts;
|
|
239 #if defined(FEAT_SEARCHPATH)
|
|
240 static char_u *p_sua;
|
|
241 #endif
|
|
242 static long p_sw;
|
|
243 static int p_swf;
|
|
244 #ifdef FEAT_SYN_HL
|
410
|
245 static long p_smc;
|
7
|
246 static char_u *p_syn;
|
386
|
247 static char_u *p_spc;
|
314
|
248 static char_u *p_spf;
|
221
|
249 static char_u *p_spl;
|
7
|
250 #endif
|
|
251 static long p_ts;
|
|
252 static long p_tw;
|
|
253 static int p_tx;
|
|
254 static long p_wm;
|
|
255 #ifdef FEAT_KEYMAP
|
|
256 static char_u *p_keymap;
|
|
257 #endif
|
|
258
|
|
259 /* Saved values for when 'bin' is set. */
|
|
260 static int p_et_nobin;
|
|
261 static int p_ml_nobin;
|
|
262 static long p_tw_nobin;
|
|
263 static long p_wm_nobin;
|
|
264
|
|
265 /* Saved values for when 'paste' is set */
|
|
266 static long p_tw_nopaste;
|
|
267 static long p_wm_nopaste;
|
|
268 static long p_sts_nopaste;
|
|
269 static int p_ai_nopaste;
|
|
270
|
|
271 struct vimoption
|
|
272 {
|
|
273 char *fullname; /* full option name */
|
|
274 char *shortname; /* permissible abbreviation */
|
|
275 long_u flags; /* see below */
|
|
276 char_u *var; /* global option: pointer to variable;
|
|
277 * window-local option: VAR_WIN;
|
|
278 * buffer-local option: global value */
|
|
279 idopt_T indir; /* global option: PV_NONE;
|
|
280 * local option: indirect option index */
|
|
281 char_u *def_val[2]; /* default values for variable (vi and vim) */
|
|
282 #ifdef FEAT_EVAL
|
|
283 scid_T scriptID; /* script in which the option was last set */
|
|
284 #endif
|
|
285 };
|
|
286
|
|
287 #define VI_DEFAULT 0 /* def_val[VI_DEFAULT] is Vi default value */
|
|
288 #define VIM_DEFAULT 1 /* def_val[VIM_DEFAULT] is Vim default value */
|
|
289
|
|
290 /*
|
|
291 * Flags
|
|
292 */
|
|
293 #define P_BOOL 0x01 /* the option is boolean */
|
|
294 #define P_NUM 0x02 /* the option is numeric */
|
|
295 #define P_STRING 0x04 /* the option is a string */
|
|
296 #define P_ALLOCED 0x08 /* the string option is in allocated memory,
|
|
297 must use vim_free() when assigning new
|
|
298 value. Not set if default is the same. */
|
|
299 #define P_EXPAND 0x10 /* environment expansion. NOTE: P_EXPAND can
|
|
300 never be used for local or hidden options! */
|
|
301 #define P_NODEFAULT 0x40 /* don't set to default value */
|
|
302 #define P_DEF_ALLOCED 0x80 /* default value is in allocated memory, must
|
|
303 use vim_free() when assigning new value */
|
|
304 #define P_WAS_SET 0x100 /* option has been set/reset */
|
|
305 #define P_NO_MKRC 0x200 /* don't include in :mkvimrc output */
|
|
306 #define P_VI_DEF 0x400 /* Use Vi default for Vim */
|
|
307 #define P_VIM 0x800 /* Vim option, reset when 'cp' set */
|
|
308
|
|
309 /* when option changed, what to display: */
|
|
310 #define P_RSTAT 0x1000 /* redraw status lines */
|
|
311 #define P_RWIN 0x2000 /* redraw current window */
|
|
312 #define P_RBUF 0x4000 /* redraw current buffer */
|
|
313 #define P_RALL 0x6000 /* redraw all windows */
|
|
314 #define P_RCLR 0x7000 /* clear and redraw all */
|
|
315
|
|
316 #define P_COMMA 0x8000 /* comma separated list */
|
|
317 #define P_NODUP 0x10000L/* don't allow duplicate strings */
|
|
318 #define P_FLAGLIST 0x20000L/* list of single-char flags */
|
|
319
|
|
320 #define P_SECURE 0x40000L/* cannot change in modeline or secure mode */
|
|
321 #define P_GETTEXT 0x80000L/* expand default value with _() */
|
|
322 #define P_NOGLOB 0x100000L/* do not use local value for global vimrc */
|
36
|
323 #define P_NFNAME 0x200000L/* only normal file name chars allowed */
|
634
|
324 #define P_INSECURE 0x400000L/* option was set from a modeline */
|
7
|
325
|
|
326 /*
|
|
327 * options[] is initialized here.
|
|
328 * The order of the options MUST be alphabetic for ":set all" and findoption().
|
|
329 * All option names MUST start with a lowercase letter (for findoption()).
|
|
330 * Exception: "t_" options are at the end.
|
|
331 * The options with a NULL variable are 'hidden': a set command for them is
|
|
332 * ignored and they are not printed.
|
|
333 */
|
|
334 static struct vimoption
|
|
335 #ifdef FEAT_GUI_W16
|
|
336 _far
|
|
337 #endif
|
|
338 options[] =
|
|
339 {
|
|
340 {"aleph", "al", P_NUM|P_VI_DEF,
|
|
341 #ifdef FEAT_RIGHTLEFT
|
|
342 (char_u *)&p_aleph, PV_NONE,
|
|
343 #else
|
|
344 (char_u *)NULL, PV_NONE,
|
|
345 #endif
|
|
346 {
|
|
347 #if (defined(MSDOS) || defined(WIN3264) || defined(OS2)) && !defined(FEAT_GUI_W32)
|
|
348 (char_u *)128L,
|
|
349 #else
|
|
350 (char_u *)224L,
|
|
351 #endif
|
|
352 (char_u *)0L}},
|
|
353 {"antialias", "anti", P_BOOL|P_VI_DEF|P_VIM|P_RCLR,
|
|
354 #if defined(FEAT_GUI) && defined(MACOS_X)
|
|
355 (char_u *)&p_antialias, PV_NONE,
|
|
356 {(char_u *)FALSE, (char_u *)FALSE}
|
|
357 #else
|
|
358 (char_u *)NULL, PV_NONE,
|
|
359 {(char_u *)FALSE, (char_u *)FALSE}
|
|
360 #endif
|
|
361 },
|
|
362 {"arabic", "arab", P_BOOL|P_VI_DEF|P_VIM,
|
|
363 #ifdef FEAT_ARABIC
|
|
364 (char_u *)VAR_WIN, PV_ARAB,
|
|
365 #else
|
|
366 (char_u *)NULL, PV_NONE,
|
|
367 #endif
|
|
368 {(char_u *)FALSE, (char_u *)0L}},
|
|
369 {"arabicshape", "arshape", P_BOOL|P_VI_DEF|P_VIM|P_RCLR,
|
|
370 #ifdef FEAT_ARABIC
|
|
371 (char_u *)&p_arshape, PV_NONE,
|
|
372 #else
|
|
373 (char_u *)NULL, PV_NONE,
|
|
374 #endif
|
|
375 {(char_u *)TRUE, (char_u *)0L}},
|
|
376 {"allowrevins", "ari", P_BOOL|P_VI_DEF|P_VIM,
|
|
377 #ifdef FEAT_RIGHTLEFT
|
|
378 (char_u *)&p_ari, PV_NONE,
|
|
379 #else
|
|
380 (char_u *)NULL, PV_NONE,
|
|
381 #endif
|
|
382 {(char_u *)FALSE, (char_u *)0L}},
|
|
383 {"altkeymap", "akm", P_BOOL|P_VI_DEF,
|
|
384 #ifdef FEAT_FKMAP
|
|
385 (char_u *)&p_altkeymap, PV_NONE,
|
|
386 #else
|
|
387 (char_u *)NULL, PV_NONE,
|
|
388 #endif
|
|
389 {(char_u *)FALSE, (char_u *)0L}},
|
|
390 {"ambiwidth", "ambw", P_STRING|P_VI_DEF|P_RCLR,
|
|
391 #if defined(FEAT_MBYTE)
|
|
392 (char_u *)&p_ambw, PV_NONE,
|
|
393 {(char_u *)"single", (char_u *)0L}
|
|
394 #else
|
|
395 (char_u *)NULL, PV_NONE,
|
|
396 {(char_u *)0L, (char_u *)0L}
|
|
397 #endif
|
|
398 },
|
|
399 #if defined(FEAT_NETBEANS_INTG) || defined(FEAT_SUN_WORKSHOP)
|
|
400 {"autochdir", "acd", P_BOOL|P_VI_DEF,
|
|
401 (char_u *)&p_acd, PV_NONE,
|
|
402 {(char_u *)FALSE, (char_u *)0L}},
|
|
403 #endif
|
|
404 {"autoindent", "ai", P_BOOL|P_VI_DEF,
|
|
405 (char_u *)&p_ai, PV_AI,
|
|
406 {(char_u *)FALSE, (char_u *)0L}},
|
|
407 {"autoprint", "ap", P_BOOL|P_VI_DEF,
|
|
408 (char_u *)NULL, PV_NONE,
|
|
409 {(char_u *)FALSE, (char_u *)0L}},
|
|
410 {"autoread", "ar", P_BOOL|P_VI_DEF,
|
|
411 (char_u *)&p_ar, OPT_BOTH(PV_AR),
|
|
412 {(char_u *)FALSE, (char_u *)0L}},
|
|
413 {"autowrite", "aw", P_BOOL|P_VI_DEF,
|
|
414 (char_u *)&p_aw, PV_NONE,
|
|
415 {(char_u *)FALSE, (char_u *)0L}},
|
|
416 {"autowriteall","awa", P_BOOL|P_VI_DEF,
|
|
417 (char_u *)&p_awa, PV_NONE,
|
|
418 {(char_u *)FALSE, (char_u *)0L}},
|
|
419 {"background", "bg", P_STRING|P_VI_DEF|P_RCLR,
|
|
420 (char_u *)&p_bg, PV_NONE,
|
|
421 {
|
|
422 #if (defined(MSDOS) || defined(OS2) || defined(WIN3264)) && !defined(FEAT_GUI)
|
|
423 (char_u *)"dark",
|
|
424 #else
|
|
425 (char_u *)"light",
|
|
426 #endif
|
|
427 (char_u *)0L}},
|
|
428 {"backspace", "bs", P_STRING|P_VI_DEF|P_VIM|P_COMMA|P_NODUP,
|
|
429 (char_u *)&p_bs, PV_NONE,
|
|
430 {(char_u *)"", (char_u *)0L}},
|
|
431 {"backup", "bk", P_BOOL|P_VI_DEF|P_VIM,
|
|
432 (char_u *)&p_bk, PV_NONE,
|
|
433 {(char_u *)FALSE, (char_u *)0L}},
|
|
434 {"backupcopy", "bkc", P_STRING|P_VIM|P_COMMA|P_NODUP,
|
|
435 (char_u *)&p_bkc, PV_NONE,
|
|
436 #ifdef UNIX
|
|
437 {(char_u *)"yes", (char_u *)"auto"}
|
|
438 #else
|
|
439 {(char_u *)"auto", (char_u *)"auto"}
|
|
440 #endif
|
|
441 },
|
|
442 {"backupdir", "bdir", P_STRING|P_EXPAND|P_VI_DEF|P_COMMA|P_NODUP|P_SECURE,
|
|
443 (char_u *)&p_bdir, PV_NONE,
|
|
444 {(char_u *)DFLT_BDIR, (char_u *)0L}},
|
36
|
445 {"backupext", "bex", P_STRING|P_VI_DEF|P_NFNAME,
|
7
|
446 (char_u *)&p_bex, PV_NONE,
|
|
447 {
|
|
448 #ifdef VMS
|
|
449 (char_u *)"_",
|
|
450 #else
|
|
451 (char_u *)"~",
|
|
452 #endif
|
|
453 (char_u *)0L}},
|
|
454 {"backupskip", "bsk", P_STRING|P_VI_DEF|P_COMMA,
|
|
455 #ifdef FEAT_WILDIGN
|
|
456 (char_u *)&p_bsk, PV_NONE,
|
|
457 {(char_u *)"", (char_u *)0L}
|
|
458 #else
|
|
459 (char_u *)NULL, PV_NONE,
|
|
460 {(char_u *)0L, (char_u *)0L}
|
|
461 #endif
|
|
462 },
|
|
463 #ifdef FEAT_BEVAL
|
|
464 {"balloondelay","bdlay",P_NUM|P_VI_DEF,
|
|
465 (char_u *)&p_bdlay, PV_NONE,
|
|
466 {(char_u *)600L, (char_u *)0L}},
|
|
467 {"ballooneval", "beval",P_BOOL|P_VI_DEF|P_NO_MKRC,
|
|
468 (char_u *)&p_beval, PV_NONE,
|
190
|
469 {(char_u *)FALSE, (char_u *)0L}},
|
|
470 # ifdef FEAT_EVAL
|
|
471 {"balloonexpr", "bexpr", P_STRING|P_ALLOCED|P_VI_DEF|P_VIM,
|
|
472 (char_u *)&p_bexpr, PV_NONE,
|
|
473 {(char_u *)"", (char_u *)0L}},
|
|
474 # endif
|
7
|
475 #endif
|
|
476 {"beautify", "bf", P_BOOL|P_VI_DEF,
|
|
477 (char_u *)NULL, PV_NONE,
|
|
478 {(char_u *)FALSE, (char_u *)0L}},
|
|
479 {"binary", "bin", P_BOOL|P_VI_DEF|P_RSTAT,
|
|
480 (char_u *)&p_bin, PV_BIN,
|
|
481 {(char_u *)FALSE, (char_u *)0L}},
|
|
482 {"bioskey", "biosk",P_BOOL|P_VI_DEF,
|
|
483 #ifdef MSDOS
|
|
484 (char_u *)&p_biosk, PV_NONE,
|
|
485 #else
|
|
486 (char_u *)NULL, PV_NONE,
|
|
487 #endif
|
|
488 {(char_u *)TRUE, (char_u *)0L}},
|
|
489 {"bomb", NULL, P_BOOL|P_NO_MKRC|P_VI_DEF|P_RSTAT,
|
|
490 #ifdef FEAT_MBYTE
|
|
491 (char_u *)&p_bomb, PV_BOMB,
|
|
492 #else
|
|
493 (char_u *)NULL, PV_NONE,
|
|
494 #endif
|
|
495 {(char_u *)FALSE, (char_u *)0L}},
|
|
496 {"breakat", "brk", P_STRING|P_VI_DEF|P_RALL|P_FLAGLIST,
|
|
497 #ifdef FEAT_LINEBREAK
|
|
498 (char_u *)&p_breakat, PV_NONE,
|
|
499 {(char_u *)" \t!@*-+;:,./?", (char_u *)0L}
|
|
500 #else
|
|
501 (char_u *)NULL, PV_NONE,
|
|
502 {(char_u *)0L, (char_u *)0L}
|
|
503 #endif
|
|
504 },
|
|
505 {"browsedir", "bsdir",P_STRING|P_VI_DEF,
|
|
506 #ifdef FEAT_BROWSE
|
|
507 (char_u *)&p_bsdir, PV_NONE,
|
|
508 {(char_u *)"last", (char_u *)0L}
|
|
509 #else
|
|
510 (char_u *)NULL, PV_NONE,
|
|
511 {(char_u *)0L, (char_u *)0L}
|
|
512 #endif
|
|
513 },
|
|
514 {"bufhidden", "bh", P_STRING|P_ALLOCED|P_VI_DEF|P_NOGLOB,
|
|
515 #if defined(FEAT_QUICKFIX)
|
|
516 (char_u *)&p_bh, PV_BH,
|
|
517 {(char_u *)"", (char_u *)0L}
|
|
518 #else
|
|
519 (char_u *)NULL, PV_NONE,
|
|
520 {(char_u *)0L, (char_u *)0L}
|
|
521 #endif
|
|
522 },
|
|
523 {"buflisted", "bl", P_BOOL|P_VI_DEF|P_NOGLOB,
|
|
524 (char_u *)&p_bl, PV_BL,
|
|
525 {(char_u *)1L, (char_u *)0L}
|
|
526 },
|
|
527 {"buftype", "bt", P_STRING|P_ALLOCED|P_VI_DEF|P_NOGLOB,
|
|
528 #if defined(FEAT_QUICKFIX)
|
|
529 (char_u *)&p_bt, PV_BT,
|
|
530 {(char_u *)"", (char_u *)0L}
|
|
531 #else
|
|
532 (char_u *)NULL, PV_NONE,
|
|
533 {(char_u *)0L, (char_u *)0L}
|
|
534 #endif
|
|
535 },
|
|
536 {"casemap", "cmp", P_STRING|P_VI_DEF|P_COMMA|P_NODUP,
|
|
537 (char_u *)&p_cmp, PV_NONE,
|
|
538 {(char_u *)"internal,keepascii", (char_u *)0L}
|
|
539 },
|
|
540 {"cdpath", "cd", P_STRING|P_EXPAND|P_VI_DEF|P_COMMA|P_NODUP,
|
|
541 #ifdef FEAT_SEARCHPATH
|
|
542 (char_u *)&p_cdpath, PV_NONE,
|
|
543 {(char_u *)",,", (char_u *)0L}
|
|
544 #else
|
|
545 (char_u *)NULL, PV_NONE,
|
|
546 {(char_u *)0L, (char_u *)0L}
|
|
547 #endif
|
|
548 },
|
|
549 {"cedit", NULL, P_STRING,
|
|
550 #ifdef FEAT_CMDWIN
|
|
551 (char_u *)&p_cedit, PV_NONE,
|
|
552 {(char_u *)"", (char_u *)CTRL_F_STR}
|
|
553 #else
|
|
554 (char_u *)NULL, PV_NONE,
|
|
555 {(char_u *)0L, (char_u *)0L}
|
|
556 #endif
|
|
557 },
|
|
558 {"charconvert", "ccv", P_STRING|P_VI_DEF|P_SECURE,
|
|
559 #if defined(FEAT_MBYTE) && defined(FEAT_EVAL)
|
|
560 (char_u *)&p_ccv, PV_NONE,
|
|
561 {(char_u *)"", (char_u *)0L}
|
|
562 #else
|
|
563 (char_u *)NULL, PV_NONE,
|
|
564 {(char_u *)0L, (char_u *)0L}
|
|
565 #endif
|
|
566 },
|
|
567 {"cindent", "cin", P_BOOL|P_VI_DEF|P_VIM,
|
|
568 #ifdef FEAT_CINDENT
|
|
569 (char_u *)&p_cin, PV_CIN,
|
|
570 #else
|
|
571 (char_u *)NULL, PV_NONE,
|
|
572 #endif
|
|
573 {(char_u *)FALSE, (char_u *)0L}},
|
|
574 {"cinkeys", "cink", P_STRING|P_ALLOCED|P_VI_DEF|P_COMMA|P_NODUP,
|
|
575 #ifdef FEAT_CINDENT
|
|
576 (char_u *)&p_cink, PV_CINK,
|
|
577 {(char_u *)"0{,0},0),:,0#,!^F,o,O,e", (char_u *)0L}
|
|
578 #else
|
|
579 (char_u *)NULL, PV_NONE,
|
|
580 {(char_u *)0L, (char_u *)0L}
|
|
581 #endif
|
|
582 },
|
|
583 {"cinoptions", "cino", P_STRING|P_ALLOCED|P_VI_DEF|P_COMMA|P_NODUP,
|
|
584 #ifdef FEAT_CINDENT
|
|
585 (char_u *)&p_cino, PV_CINO,
|
|
586 #else
|
|
587 (char_u *)NULL, PV_NONE,
|
|
588 #endif
|
|
589 {(char_u *)"", (char_u *)0L}},
|
|
590 {"cinwords", "cinw", P_STRING|P_ALLOCED|P_VI_DEF|P_COMMA|P_NODUP,
|
|
591 #if defined(FEAT_SMARTINDENT) || defined(FEAT_CINDENT)
|
|
592 (char_u *)&p_cinw, PV_CINW,
|
|
593 {(char_u *)"if,else,while,do,for,switch",
|
|
594 (char_u *)0L}
|
|
595 #else
|
|
596 (char_u *)NULL, PV_NONE,
|
|
597 {(char_u *)0L, (char_u *)0L}
|
|
598 #endif
|
|
599 },
|
|
600 {"clipboard", "cb", P_STRING|P_VI_DEF|P_COMMA|P_NODUP,
|
|
601 #ifdef FEAT_CLIPBOARD
|
|
602 (char_u *)&p_cb, PV_NONE,
|
|
603 # ifdef FEAT_XCLIPBOARD
|
|
604 {(char_u *)"autoselect,exclude:cons\\|linux",
|
|
605 (char_u *)0L}
|
|
606 # else
|
|
607 {(char_u *)"", (char_u *)0L}
|
|
608 # endif
|
|
609 #else
|
|
610 (char_u *)NULL, PV_NONE,
|
|
611 {(char_u *)"", (char_u *)0L}
|
|
612 #endif
|
|
613 },
|
|
614 {"cmdheight", "ch", P_NUM|P_VI_DEF|P_RALL,
|
|
615 (char_u *)&p_ch, PV_NONE,
|
|
616 {(char_u *)1L, (char_u *)0L}},
|
|
617 {"cmdwinheight", "cwh", P_NUM|P_VI_DEF,
|
|
618 #ifdef FEAT_CMDWIN
|
|
619 (char_u *)&p_cwh, PV_NONE,
|
|
620 #else
|
|
621 (char_u *)NULL, PV_NONE,
|
|
622 #endif
|
|
623 {(char_u *)7L, (char_u *)0L}},
|
|
624 {"columns", "co", P_NUM|P_NODEFAULT|P_NO_MKRC|P_VI_DEF|P_RCLR,
|
|
625 (char_u *)&Columns, PV_NONE,
|
|
626 {(char_u *)80L, (char_u *)0L}},
|
|
627 {"comments", "com", P_STRING|P_ALLOCED|P_VI_DEF|P_COMMA|P_NODUP,
|
|
628 #ifdef FEAT_COMMENTS
|
|
629 (char_u *)&p_com, PV_COM,
|
|
630 {(char_u *)"s1:/*,mb:*,ex:*/,://,b:#,:%,:XCOMM,n:>,fb:-",
|
|
631 (char_u *)0L}
|
|
632 #else
|
|
633 (char_u *)NULL, PV_NONE,
|
|
634 {(char_u *)0L, (char_u *)0L}
|
|
635 #endif
|
|
636 },
|
|
637 {"commentstring", "cms", P_STRING|P_ALLOCED|P_VI_DEF,
|
|
638 #ifdef FEAT_FOLDING
|
|
639 (char_u *)&p_cms, PV_CMS,
|
|
640 {(char_u *)"/*%s*/", (char_u *)0L}
|
|
641 #else
|
|
642 (char_u *)NULL, PV_NONE,
|
|
643 {(char_u *)0L, (char_u *)0L}
|
|
644 #endif
|
|
645 },
|
|
646 {"compatible", "cp", P_BOOL|P_RALL,
|
|
647 (char_u *)&p_cp, PV_NONE,
|
|
648 {(char_u *)TRUE, (char_u *)FALSE}},
|
|
649 {"complete", "cpt", P_STRING|P_ALLOCED|P_VI_DEF|P_COMMA|P_NODUP,
|
|
650 #ifdef FEAT_INS_EXPAND
|
|
651 (char_u *)&p_cpt, PV_CPT,
|
|
652 {(char_u *)".,w,b,u,t,i", (char_u *)0L}
|
|
653 #else
|
|
654 (char_u *)NULL, PV_NONE,
|
|
655 {(char_u *)0L, (char_u *)0L}
|
|
656 #endif
|
|
657 },
|
12
|
658 {"completefunc", "cfu", P_STRING|P_ALLOCED|P_VI_DEF|P_SECURE,
|
|
659 #ifdef FEAT_COMPL_FUNC
|
|
660 (char_u *)&p_cfu, PV_CFU,
|
|
661 {(char_u *)"", (char_u *)0L}
|
|
662 #else
|
|
663 (char_u *)NULL, PV_NONE,
|
|
664 {(char_u *)0L, (char_u *)0L}
|
|
665 #endif
|
|
666 },
|
540
|
667 {"completeopt", "cot", P_STRING|P_VI_DEF|P_COMMA|P_NODUP,
|
|
668 #ifdef FEAT_INS_EXPAND
|
|
669 (char_u *)&p_cot, PV_NONE,
|
|
670 {(char_u *)"menu", (char_u *)0L}
|
|
671 #else
|
|
672 (char_u *)NULL, PV_NONE,
|
|
673 {(char_u *)0L, (char_u *)0L}
|
|
674 #endif
|
|
675 },
|
7
|
676 {"confirm", "cf", P_BOOL|P_VI_DEF,
|
|
677 #if defined(FEAT_GUI_DIALOG) || defined(FEAT_CON_DIALOG)
|
|
678 (char_u *)&p_confirm, PV_NONE,
|
|
679 #else
|
|
680 (char_u *)NULL, PV_NONE,
|
|
681 #endif
|
|
682 {(char_u *)FALSE, (char_u *)0L}},
|
|
683 {"conskey", "consk",P_BOOL|P_VI_DEF,
|
|
684 #ifdef MSDOS
|
|
685 (char_u *)&p_consk, PV_NONE,
|
|
686 #else
|
|
687 (char_u *)NULL, PV_NONE,
|
|
688 #endif
|
|
689 {(char_u *)FALSE, (char_u *)0L}},
|
|
690 {"copyindent", "ci", P_BOOL|P_VI_DEF|P_VIM,
|
|
691 (char_u *)&p_ci, PV_CI,
|
|
692 {(char_u *)FALSE, (char_u *)0L}},
|
|
693 {"cpoptions", "cpo", P_STRING|P_VIM|P_RALL|P_FLAGLIST,
|
|
694 (char_u *)&p_cpo, PV_NONE,
|
164
|
695 {(char_u *)CPO_VI, (char_u *)CPO_VIM}},
|
7
|
696 {"cscopepathcomp", "cspc", P_NUM|P_VI_DEF|P_VIM,
|
|
697 #ifdef FEAT_CSCOPE
|
|
698 (char_u *)&p_cspc, PV_NONE,
|
|
699 #else
|
|
700 (char_u *)NULL, PV_NONE,
|
|
701 #endif
|
|
702 {(char_u *)0L, (char_u *)0L}},
|
|
703 {"cscopeprg", "csprg", P_STRING|P_EXPAND|P_VI_DEF|P_SECURE,
|
|
704 #ifdef FEAT_CSCOPE
|
|
705 (char_u *)&p_csprg, PV_NONE,
|
|
706 {(char_u *)"cscope", (char_u *)0L}
|
|
707 #else
|
|
708 (char_u *)NULL, PV_NONE,
|
|
709 {(char_u *)0L, (char_u *)0L}
|
|
710 #endif
|
|
711 },
|
|
712 {"cscopequickfix", "csqf", P_STRING|P_VI_DEF|P_COMMA|P_NODUP,
|
|
713 #if defined(FEAT_CSCOPE) && defined(FEAT_QUICKFIX)
|
|
714 (char_u *)&p_csqf, PV_NONE,
|
|
715 {(char_u *)"", (char_u *)0L}
|
|
716 #else
|
|
717 (char_u *)NULL, PV_NONE,
|
|
718 {(char_u *)0L, (char_u *)0L}
|
|
719 #endif
|
|
720 },
|
|
721 {"cscopetag", "cst", P_BOOL|P_VI_DEF|P_VIM,
|
|
722 #ifdef FEAT_CSCOPE
|
|
723 (char_u *)&p_cst, PV_NONE,
|
|
724 #else
|
|
725 (char_u *)NULL, PV_NONE,
|
|
726 #endif
|
|
727 {(char_u *)0L, (char_u *)0L}},
|
|
728 {"cscopetagorder", "csto", P_NUM|P_VI_DEF|P_VIM,
|
|
729 #ifdef FEAT_CSCOPE
|
|
730 (char_u *)&p_csto, PV_NONE,
|
|
731 #else
|
|
732 (char_u *)NULL, PV_NONE,
|
|
733 #endif
|
|
734 {(char_u *)0L, (char_u *)0L}},
|
|
735 {"cscopeverbose", "csverb", P_BOOL|P_VI_DEF|P_VIM,
|
|
736 #ifdef FEAT_CSCOPE
|
|
737 (char_u *)&p_csverbose, PV_NONE,
|
|
738 #else
|
|
739 (char_u *)NULL, PV_NONE,
|
|
740 #endif
|
|
741 {(char_u *)0L, (char_u *)0L}},
|
|
742 {"debug", NULL, P_STRING|P_VI_DEF,
|
|
743 (char_u *)&p_debug, PV_NONE,
|
|
744 {(char_u *)"", (char_u *)0L}},
|
|
745 {"define", "def", P_STRING|P_ALLOCED|P_VI_DEF,
|
|
746 #ifdef FEAT_FIND_ID
|
|
747 (char_u *)&p_def, OPT_BOTH(PV_DEF),
|
22
|
748 {(char_u *)"^\\s*#\\s*define", (char_u *)0L}
|
7
|
749 #else
|
|
750 (char_u *)NULL, PV_NONE,
|
|
751 {(char_u *)NULL, (char_u *)0L}
|
|
752 #endif
|
|
753 },
|
|
754 {"delcombine", "deco", P_BOOL|P_VI_DEF|P_VIM,
|
|
755 #ifdef FEAT_MBYTE
|
|
756 (char_u *)&p_deco, PV_NONE,
|
|
757 #else
|
|
758 (char_u *)NULL, PV_NONE,
|
|
759 #endif
|
|
760 {(char_u *)FALSE, (char_u *)0L}
|
|
761 },
|
|
762 {"dictionary", "dict", P_STRING|P_EXPAND|P_VI_DEF|P_COMMA|P_NODUP,
|
|
763 #ifdef FEAT_INS_EXPAND
|
|
764 (char_u *)&p_dict, OPT_BOTH(PV_DICT),
|
|
765 #else
|
|
766 (char_u *)NULL, PV_NONE,
|
|
767 #endif
|
|
768 {(char_u *)"", (char_u *)0L}},
|
|
769 {"diff", NULL, P_BOOL|P_VI_DEF|P_RWIN|P_NOGLOB,
|
|
770 #ifdef FEAT_DIFF
|
|
771 (char_u *)VAR_WIN, PV_DIFF,
|
|
772 #else
|
|
773 (char_u *)NULL, PV_NONE,
|
|
774 #endif
|
|
775 {(char_u *)FALSE, (char_u *)0L}},
|
|
776 {"diffexpr", "dex", P_STRING|P_VI_DEF|P_SECURE,
|
|
777 #if defined(FEAT_DIFF) && defined(FEAT_EVAL)
|
|
778 (char_u *)&p_dex, PV_NONE,
|
|
779 {(char_u *)"", (char_u *)0L}
|
|
780 #else
|
|
781 (char_u *)NULL, PV_NONE,
|
|
782 {(char_u *)0L, (char_u *)0L}
|
|
783 #endif
|
|
784 },
|
|
785 {"diffopt", "dip", P_STRING|P_ALLOCED|P_VI_DEF|P_RWIN|P_COMMA|P_NODUP,
|
|
786 #ifdef FEAT_DIFF
|
|
787 (char_u *)&p_dip, PV_NONE,
|
|
788 {(char_u *)"filler", (char_u *)NULL}
|
|
789 #else
|
|
790 (char_u *)NULL, PV_NONE,
|
|
791 {(char_u *)"", (char_u *)NULL}
|
|
792 #endif
|
|
793 },
|
|
794 {"digraph", "dg", P_BOOL|P_VI_DEF|P_VIM,
|
|
795 #ifdef FEAT_DIGRAPHS
|
|
796 (char_u *)&p_dg, PV_NONE,
|
|
797 #else
|
|
798 (char_u *)NULL, PV_NONE,
|
|
799 #endif
|
|
800 {(char_u *)FALSE, (char_u *)0L}},
|
|
801 {"directory", "dir", P_STRING|P_EXPAND|P_VI_DEF|P_COMMA|P_NODUP|P_SECURE,
|
|
802 (char_u *)&p_dir, PV_NONE,
|
|
803 {(char_u *)DFLT_DIR, (char_u *)0L}},
|
|
804 {"display", "dy", P_STRING|P_VI_DEF|P_COMMA|P_RALL|P_NODUP,
|
|
805 (char_u *)&p_dy, PV_NONE,
|
|
806 {(char_u *)"", (char_u *)0L}},
|
|
807 {"eadirection", "ead", P_STRING|P_VI_DEF,
|
|
808 #ifdef FEAT_VERTSPLIT
|
|
809 (char_u *)&p_ead, PV_NONE,
|
|
810 {(char_u *)"both", (char_u *)0L}
|
|
811 #else
|
|
812 (char_u *)NULL, PV_NONE,
|
|
813 {(char_u *)NULL, (char_u *)0L}
|
|
814 #endif
|
|
815 },
|
|
816 {"edcompatible","ed", P_BOOL|P_VI_DEF,
|
|
817 (char_u *)&p_ed, PV_NONE,
|
|
818 {(char_u *)FALSE, (char_u *)0L}},
|
|
819 {"encoding", "enc", P_STRING|P_VI_DEF|P_RCLR,
|
|
820 #ifdef FEAT_MBYTE
|
|
821 (char_u *)&p_enc, PV_NONE,
|
|
822 {(char_u *)ENC_DFLT, (char_u *)0L}
|
|
823 #else
|
|
824 (char_u *)NULL, PV_NONE,
|
|
825 {(char_u *)0L, (char_u *)0L}
|
|
826 #endif
|
|
827 },
|
|
828 {"endofline", "eol", P_BOOL|P_NO_MKRC|P_VI_DEF|P_RSTAT,
|
|
829 (char_u *)&p_eol, PV_EOL,
|
|
830 {(char_u *)TRUE, (char_u *)0L}},
|
|
831 {"equalalways", "ea", P_BOOL|P_VI_DEF|P_RALL,
|
|
832 (char_u *)&p_ea, PV_NONE,
|
|
833 {(char_u *)TRUE, (char_u *)0L}},
|
|
834 {"equalprg", "ep", P_STRING|P_EXPAND|P_VI_DEF|P_SECURE,
|
|
835 (char_u *)&p_ep, OPT_BOTH(PV_EP),
|
|
836 {(char_u *)"", (char_u *)0L}},
|
|
837 {"errorbells", "eb", P_BOOL|P_VI_DEF,
|
|
838 (char_u *)&p_eb, PV_NONE,
|
|
839 {(char_u *)FALSE, (char_u *)0L}},
|
|
840 {"errorfile", "ef", P_STRING|P_EXPAND|P_VI_DEF|P_SECURE,
|
|
841 #ifdef FEAT_QUICKFIX
|
|
842 (char_u *)&p_ef, PV_NONE,
|
|
843 {(char_u *)DFLT_ERRORFILE, (char_u *)0L}
|
|
844 #else
|
|
845 (char_u *)NULL, PV_NONE,
|
|
846 {(char_u *)NULL, (char_u *)0L}
|
|
847 #endif
|
|
848 },
|
|
849 {"errorformat", "efm", P_STRING|P_VI_DEF|P_COMMA|P_NODUP,
|
|
850 #ifdef FEAT_QUICKFIX
|
|
851 (char_u *)&p_efm, OPT_BOTH(PV_EFM),
|
|
852 {(char_u *)DFLT_EFM, (char_u *)0L},
|
|
853 #else
|
|
854 (char_u *)NULL, PV_NONE,
|
|
855 {(char_u *)NULL, (char_u *)0L}
|
|
856 #endif
|
|
857 },
|
|
858 {"esckeys", "ek", P_BOOL|P_VIM,
|
|
859 (char_u *)&p_ek, PV_NONE,
|
|
860 {(char_u *)FALSE, (char_u *)TRUE}},
|
|
861 {"eventignore", "ei", P_STRING|P_VI_DEF|P_COMMA|P_NODUP,
|
|
862 #ifdef FEAT_AUTOCMD
|
|
863 (char_u *)&p_ei, PV_NONE,
|
|
864 #else
|
|
865 (char_u *)NULL, PV_NONE,
|
|
866 #endif
|
|
867 {(char_u *)"", (char_u *)0L}},
|
|
868 {"expandtab", "et", P_BOOL|P_VI_DEF|P_VIM,
|
|
869 (char_u *)&p_et, PV_ET,
|
|
870 {(char_u *)FALSE, (char_u *)0L}},
|
|
871 {"exrc", "ex", P_BOOL|P_VI_DEF|P_SECURE,
|
|
872 (char_u *)&p_exrc, PV_NONE,
|
|
873 {(char_u *)FALSE, (char_u *)0L}},
|
|
874 {"fileencoding","fenc", P_STRING|P_ALLOCED|P_VI_DEF|P_RSTAT|P_RBUF|P_NO_MKRC,
|
|
875 #ifdef FEAT_MBYTE
|
|
876 (char_u *)&p_fenc, PV_FENC,
|
|
877 {(char_u *)"", (char_u *)0L}
|
|
878 #else
|
|
879 (char_u *)NULL, PV_NONE,
|
|
880 {(char_u *)0L, (char_u *)0L}
|
|
881 #endif
|
|
882 },
|
|
883 {"fileencodings","fencs", P_STRING|P_VI_DEF|P_COMMA,
|
|
884 #ifdef FEAT_MBYTE
|
|
885 (char_u *)&p_fencs, PV_NONE,
|
|
886 {(char_u *)"ucs-bom", (char_u *)0L}
|
|
887 #else
|
|
888 (char_u *)NULL, PV_NONE,
|
|
889 {(char_u *)0L, (char_u *)0L}
|
|
890 #endif
|
|
891 },
|
|
892 {"fileformat", "ff", P_STRING|P_ALLOCED|P_VI_DEF|P_RSTAT|P_NO_MKRC,
|
|
893 (char_u *)&p_ff, PV_FF,
|
|
894 {(char_u *)DFLT_FF, (char_u *)0L}},
|
|
895 {"fileformats", "ffs", P_STRING|P_VIM|P_COMMA|P_NODUP,
|
|
896 (char_u *)&p_ffs, PV_NONE,
|
|
897 {(char_u *)DFLT_FFS_VI, (char_u *)DFLT_FFS_VIM}},
|
36
|
898 {"filetype", "ft", P_STRING|P_ALLOCED|P_VI_DEF|P_NOGLOB|P_NFNAME,
|
7
|
899 #ifdef FEAT_AUTOCMD
|
|
900 (char_u *)&p_ft, PV_FT,
|
|
901 {(char_u *)"", (char_u *)0L}
|
|
902 #else
|
|
903 (char_u *)NULL, PV_NONE,
|
|
904 {(char_u *)0L, (char_u *)0L}
|
|
905 #endif
|
|
906 },
|
|
907 {"fillchars", "fcs", P_STRING|P_VI_DEF|P_RALL|P_COMMA|P_NODUP,
|
|
908 #if defined(FEAT_WINDOWS) || defined(FEAT_FOLDING)
|
|
909 (char_u *)&p_fcs, PV_NONE,
|
|
910 {(char_u *)"vert:|,fold:-", (char_u *)0L}
|
|
911 #else
|
|
912 (char_u *)NULL, PV_NONE,
|
|
913 {(char_u *)"", (char_u *)0L}
|
|
914 #endif
|
|
915 },
|
|
916 {"fkmap", "fk", P_BOOL|P_VI_DEF,
|
|
917 #ifdef FEAT_FKMAP
|
|
918 (char_u *)&p_fkmap, PV_NONE,
|
|
919 #else
|
|
920 (char_u *)NULL, PV_NONE,
|
|
921 #endif
|
|
922 {(char_u *)FALSE, (char_u *)0L}},
|
|
923 {"flash", "fl", P_BOOL|P_VI_DEF,
|
|
924 (char_u *)NULL, PV_NONE,
|
|
925 {(char_u *)FALSE, (char_u *)0L}},
|
|
926 #ifdef FEAT_FOLDING
|
|
927 {"foldclose", "fcl", P_STRING|P_VI_DEF|P_COMMA|P_NODUP|P_RWIN,
|
|
928 (char_u *)&p_fcl, PV_NONE,
|
|
929 {(char_u *)"", (char_u *)0L}},
|
|
930 {"foldcolumn", "fdc", P_NUM|P_VI_DEF|P_RWIN,
|
|
931 (char_u *)VAR_WIN, PV_FDC,
|
|
932 {(char_u *)FALSE, (char_u *)0L}},
|
|
933 {"foldenable", "fen", P_BOOL|P_VI_DEF|P_RWIN,
|
|
934 (char_u *)VAR_WIN, PV_FEN,
|
|
935 {(char_u *)TRUE, (char_u *)0L}},
|
|
936 {"foldexpr", "fde", P_STRING|P_ALLOCED|P_VIM|P_VI_DEF|P_RWIN,
|
|
937 # ifdef FEAT_EVAL
|
|
938 (char_u *)VAR_WIN, PV_FDE,
|
|
939 {(char_u *)"0", (char_u *)NULL}
|
|
940 # else
|
|
941 (char_u *)NULL, PV_NONE,
|
|
942 {(char_u *)NULL, (char_u *)0L}
|
|
943 # endif
|
|
944 },
|
|
945 {"foldignore", "fdi", P_STRING|P_ALLOCED|P_VIM|P_VI_DEF|P_RWIN,
|
|
946 (char_u *)VAR_WIN, PV_FDI,
|
|
947 {(char_u *)"#", (char_u *)NULL}},
|
|
948 {"foldlevel", "fdl", P_NUM|P_VI_DEF|P_RWIN,
|
|
949 (char_u *)VAR_WIN, PV_FDL,
|
|
950 {(char_u *)0L, (char_u *)0L}},
|
|
951 {"foldlevelstart","fdls", P_NUM|P_VI_DEF,
|
|
952 (char_u *)&p_fdls, PV_NONE,
|
|
953 {(char_u *)-1L, (char_u *)0L}},
|
|
954 {"foldmarker", "fmr", P_STRING|P_ALLOCED|P_VIM|P_VI_DEF|
|
|
955 P_RWIN|P_COMMA|P_NODUP,
|
|
956 (char_u *)VAR_WIN, PV_FMR,
|
|
957 {(char_u *)"{{{,}}}", (char_u *)NULL}},
|
|
958 {"foldmethod", "fdm", P_STRING|P_ALLOCED|P_VIM|P_VI_DEF|P_RWIN,
|
|
959 (char_u *)VAR_WIN, PV_FDM,
|
|
960 {(char_u *)"manual", (char_u *)NULL}},
|
|
961 {"foldminlines","fml", P_NUM|P_VI_DEF|P_RWIN,
|
|
962 (char_u *)VAR_WIN, PV_FML,
|
|
963 {(char_u *)1L, (char_u *)0L}},
|
|
964 {"foldnestmax", "fdn", P_NUM|P_VI_DEF|P_RWIN,
|
|
965 (char_u *)VAR_WIN, PV_FDN,
|
|
966 {(char_u *)20L, (char_u *)0L}},
|
|
967 {"foldopen", "fdo", P_STRING|P_VI_DEF|P_COMMA|P_NODUP,
|
|
968 (char_u *)&p_fdo, PV_NONE,
|
|
969 {(char_u *)"block,hor,mark,percent,quickfix,search,tag,undo",
|
|
970 (char_u *)0L}},
|
|
971 {"foldtext", "fdt", P_STRING|P_ALLOCED|P_VIM|P_VI_DEF|P_RWIN,
|
|
972 # ifdef FEAT_EVAL
|
|
973 (char_u *)VAR_WIN, PV_FDT,
|
|
974 {(char_u *)"foldtext()", (char_u *)NULL}
|
29
|
975 # else
|
7
|
976 (char_u *)NULL, PV_NONE,
|
|
977 {(char_u *)NULL, (char_u *)0L}
|
29
|
978 # endif
|
7
|
979 },
|
|
980 #endif
|
667
|
981 {"formatexpr", "fex", P_STRING|P_ALLOCED|P_VI_DEF|P_VIM,
|
|
982 #if defined(FEAT_EVAL)
|
|
983 (char_u *)&p_fex, PV_FEX,
|
|
984 {(char_u *)"", (char_u *)0L}
|
|
985 #else
|
|
986 (char_u *)NULL, PV_NONE,
|
|
987 {(char_u *)0L, (char_u *)0L}
|
|
988 #endif
|
|
989 },
|
7
|
990 {"formatoptions","fo", P_STRING|P_ALLOCED|P_VIM|P_FLAGLIST,
|
|
991 (char_u *)&p_fo, PV_FO,
|
|
992 {(char_u *)DFLT_FO_VI, (char_u *)DFLT_FO_VIM}},
|
41
|
993 {"formatlistpat","flp", P_STRING|P_ALLOCED|P_VI_DEF,
|
|
994 (char_u *)&p_flp, PV_FLP,
|
|
995 {(char_u *)"^\\s*\\d\\+[\\]:.)}\\t ]\\s*", (char_u *)0L}},
|
7
|
996 {"formatprg", "fp", P_STRING|P_EXPAND|P_VI_DEF|P_SECURE,
|
|
997 (char_u *)&p_fp, PV_NONE,
|
|
998 {(char_u *)"", (char_u *)0L}},
|
36
|
999 {"fsync", "fs", P_BOOL|P_SECURE|P_VI_DEF,
|
|
1000 #ifdef HAVE_FSYNC
|
|
1001 (char_u *)&p_fs, PV_NONE,
|
|
1002 {(char_u *)TRUE, (char_u *)0L}
|
|
1003 #else
|
|
1004 (char_u *)NULL, PV_NONE,
|
|
1005 {(char_u *)FALSE, (char_u *)0L}
|
|
1006 #endif
|
|
1007 },
|
7
|
1008 {"gdefault", "gd", P_BOOL|P_VI_DEF|P_VIM,
|
|
1009 (char_u *)&p_gd, PV_NONE,
|
|
1010 {(char_u *)FALSE, (char_u *)0L}},
|
|
1011 {"graphic", "gr", P_BOOL|P_VI_DEF,
|
|
1012 (char_u *)NULL, PV_NONE,
|
|
1013 {(char_u *)FALSE, (char_u *)0L}},
|
|
1014 {"grepformat", "gfm", P_STRING|P_VI_DEF|P_COMMA|P_NODUP,
|
|
1015 #ifdef FEAT_QUICKFIX
|
|
1016 (char_u *)&p_gefm, PV_NONE,
|
|
1017 {(char_u *)DFLT_GREPFORMAT, (char_u *)0L},
|
|
1018 #else
|
|
1019 (char_u *)NULL, PV_NONE,
|
|
1020 {(char_u *)NULL, (char_u *)0L}
|
|
1021 #endif
|
|
1022 },
|
|
1023 {"grepprg", "gp", P_STRING|P_EXPAND|P_VI_DEF|P_SECURE,
|
|
1024 #ifdef FEAT_QUICKFIX
|
|
1025 (char_u *)&p_gp, OPT_BOTH(PV_GP),
|
|
1026 {
|
|
1027 # ifdef WIN3264
|
|
1028 /* may be changed to "grep -n" in os_win32.c */
|
|
1029 (char_u *)"findstr /n",
|
|
1030 # else
|
|
1031 # ifdef UNIX
|
|
1032 /* Add an extra file name so that grep will always
|
|
1033 * insert a file name in the match line. */
|
|
1034 (char_u *)"grep -n $* /dev/null",
|
|
1035 # else
|
|
1036 # ifdef VMS
|
|
1037 (char_u *)"SEARCH/NUMBERS ",
|
|
1038 # else
|
|
1039 (char_u *)"grep -n ",
|
|
1040 #endif
|
|
1041 #endif
|
|
1042 # endif
|
|
1043 (char_u *)0L},
|
|
1044 #else
|
|
1045 (char_u *)NULL, PV_NONE,
|
|
1046 {(char_u *)NULL, (char_u *)0L}
|
|
1047 #endif
|
|
1048 },
|
|
1049 {"guicursor", "gcr", P_STRING|P_VI_DEF|P_COMMA|P_NODUP,
|
|
1050 #ifdef CURSOR_SHAPE
|
|
1051 (char_u *)&p_guicursor, PV_NONE,
|
|
1052 {
|
|
1053 # ifdef FEAT_GUI
|
|
1054 (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",
|
|
1055 # else /* MSDOS or Win32 console */
|
|
1056 (char_u *)"n-v-c:block,o:hor50,i-ci:hor15,r-cr:hor30,sm:block",
|
|
1057 # endif
|
|
1058 (char_u *)0L}
|
|
1059 #else
|
|
1060 (char_u *)NULL, PV_NONE,
|
|
1061 {(char_u *)NULL, (char_u *)0L}
|
|
1062 #endif
|
|
1063 },
|
|
1064 {"guifont", "gfn", P_STRING|P_VI_DEF|P_RCLR|P_COMMA|P_NODUP,
|
|
1065 #ifdef FEAT_GUI
|
|
1066 (char_u *)&p_guifont, PV_NONE,
|
|
1067 {(char_u *)"", (char_u *)0L}
|
|
1068 #else
|
|
1069 (char_u *)NULL, PV_NONE,
|
|
1070 {(char_u *)NULL, (char_u *)0L}
|
|
1071 #endif
|
|
1072 },
|
|
1073 {"guifontset", "gfs", P_STRING|P_VI_DEF|P_RCLR|P_COMMA,
|
|
1074 #if defined(FEAT_GUI) && defined(FEAT_XFONTSET)
|
|
1075 (char_u *)&p_guifontset, PV_NONE,
|
|
1076 {(char_u *)"", (char_u *)0L}
|
|
1077 #else
|
|
1078 (char_u *)NULL, PV_NONE,
|
|
1079 {(char_u *)NULL, (char_u *)0L}
|
|
1080 #endif
|
|
1081 },
|
|
1082 {"guifontwide", "gfw", P_STRING|P_VI_DEF|P_RCLR|P_COMMA|P_NODUP,
|
|
1083 #if defined(FEAT_GUI) && defined(FEAT_MBYTE)
|
|
1084 (char_u *)&p_guifontwide, PV_NONE,
|
|
1085 {(char_u *)"", (char_u *)0L}
|
|
1086 #else
|
|
1087 (char_u *)NULL, PV_NONE,
|
|
1088 {(char_u *)NULL, (char_u *)0L}
|
|
1089 #endif
|
|
1090 },
|
|
1091 {"guiheadroom", "ghr", P_NUM|P_VI_DEF,
|
574
|
1092 #if defined(FEAT_GUI_GTK) || defined(FEAT_GUI_X11)
|
7
|
1093 (char_u *)&p_ghr, PV_NONE,
|
|
1094 #else
|
|
1095 (char_u *)NULL, PV_NONE,
|
|
1096 #endif
|
|
1097 {(char_u *)50L, (char_u *)0L}},
|
|
1098 {"guioptions", "go", P_STRING|P_VI_DEF|P_RALL|P_FLAGLIST,
|
574
|
1099 #if defined(FEAT_GUI)
|
7
|
1100 (char_u *)&p_go, PV_NONE,
|
|
1101 # if defined(UNIX) && !defined(MACOS)
|
|
1102 {(char_u *)"agimrLtT", (char_u *)0L}
|
|
1103 # else
|
|
1104 {(char_u *)"gmrLtT", (char_u *)0L}
|
|
1105 # endif
|
|
1106 #else
|
|
1107 (char_u *)NULL, PV_NONE,
|
|
1108 {(char_u *)NULL, (char_u *)0L}
|
|
1109 #endif
|
|
1110 },
|
|
1111 {"guipty", NULL, P_BOOL|P_VI_DEF,
|
|
1112 #if defined(FEAT_GUI)
|
|
1113 (char_u *)&p_guipty, PV_NONE,
|
|
1114 #else
|
|
1115 (char_u *)NULL, PV_NONE,
|
|
1116 #endif
|
|
1117 {(char_u *)TRUE, (char_u *)0L}},
|
|
1118 {"hardtabs", "ht", P_NUM|P_VI_DEF,
|
|
1119 (char_u *)NULL, PV_NONE,
|
|
1120 {(char_u *)0L, (char_u *)0L}},
|
|
1121 {"helpfile", "hf", P_STRING|P_EXPAND|P_VI_DEF|P_SECURE,
|
|
1122 (char_u *)&p_hf, PV_NONE,
|
|
1123 {(char_u *)DFLT_HELPFILE, (char_u *)0L}},
|
|
1124 {"helpheight", "hh", P_NUM|P_VI_DEF,
|
|
1125 #ifdef FEAT_WINDOWS
|
|
1126 (char_u *)&p_hh, PV_NONE,
|
|
1127 #else
|
|
1128 (char_u *)NULL, PV_NONE,
|
|
1129 #endif
|
|
1130 {(char_u *)20L, (char_u *)0L}},
|
|
1131 {"helplang", "hlg", P_STRING|P_VI_DEF|P_COMMA,
|
|
1132 #ifdef FEAT_MULTI_LANG
|
|
1133 (char_u *)&p_hlg, PV_NONE,
|
|
1134 {(char_u *)"", (char_u *)0L}
|
|
1135 #else
|
|
1136 (char_u *)NULL, PV_NONE,
|
|
1137 {(char_u *)0L, (char_u *)0L}
|
|
1138 #endif
|
|
1139 },
|
|
1140 {"hidden", "hid", P_BOOL|P_VI_DEF,
|
|
1141 (char_u *)&p_hid, PV_NONE,
|
|
1142 {(char_u *)FALSE, (char_u *)0L}},
|
|
1143 {"highlight", "hl", P_STRING|P_VI_DEF|P_RCLR|P_COMMA|P_NODUP,
|
|
1144 (char_u *)&p_hl, PV_NONE,
|
677
|
1145 {(char_u *)"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",
|
7
|
1146 (char_u *)0L}},
|
|
1147 {"history", "hi", P_NUM|P_VIM,
|
|
1148 (char_u *)&p_hi, PV_NONE,
|
|
1149 {(char_u *)0L, (char_u *)20L}},
|
|
1150 {"hkmap", "hk", P_BOOL|P_VI_DEF|P_VIM,
|
|
1151 #ifdef FEAT_RIGHTLEFT
|
|
1152 (char_u *)&p_hkmap, PV_NONE,
|
|
1153 #else
|
|
1154 (char_u *)NULL, PV_NONE,
|
|
1155 #endif
|
|
1156 {(char_u *)FALSE, (char_u *)0L}},
|
|
1157 {"hkmapp", "hkp", P_BOOL|P_VI_DEF|P_VIM,
|
|
1158 #ifdef FEAT_RIGHTLEFT
|
|
1159 (char_u *)&p_hkmapp, PV_NONE,
|
|
1160 #else
|
|
1161 (char_u *)NULL, PV_NONE,
|
|
1162 #endif
|
|
1163 {(char_u *)FALSE, (char_u *)0L}},
|
|
1164 {"hlsearch", "hls", P_BOOL|P_VI_DEF|P_VIM|P_RALL,
|
|
1165 (char_u *)&p_hls, PV_NONE,
|
|
1166 {(char_u *)FALSE, (char_u *)0L}},
|
|
1167 {"icon", NULL, P_BOOL|P_VI_DEF,
|
|
1168 #ifdef FEAT_TITLE
|
|
1169 (char_u *)&p_icon, PV_NONE,
|
|
1170 #else
|
|
1171 (char_u *)NULL, PV_NONE,
|
|
1172 #endif
|
|
1173 {(char_u *)FALSE, (char_u *)0L}},
|
|
1174 {"iconstring", NULL, P_STRING|P_VI_DEF,
|
|
1175 #ifdef FEAT_TITLE
|
|
1176 (char_u *)&p_iconstring, PV_NONE,
|
|
1177 #else
|
|
1178 (char_u *)NULL, PV_NONE,
|
|
1179 #endif
|
|
1180 {(char_u *)"", (char_u *)0L}},
|
|
1181 {"ignorecase", "ic", P_BOOL|P_VI_DEF,
|
|
1182 (char_u *)&p_ic, PV_NONE,
|
|
1183 {(char_u *)FALSE, (char_u *)0L}},
|
|
1184 {"imactivatekey","imak",P_STRING|P_VI_DEF,
|
574
|
1185 #if defined(FEAT_XIM) && defined(FEAT_GUI_GTK)
|
7
|
1186 (char_u *)&p_imak, PV_NONE,
|
|
1187 #else
|
|
1188 (char_u *)NULL, PV_NONE,
|
|
1189 #endif
|
|
1190 {(char_u *)"", (char_u *)0L}},
|
|
1191 {"imcmdline", "imc", P_BOOL|P_VI_DEF,
|
|
1192 #ifdef USE_IM_CONTROL
|
|
1193 (char_u *)&p_imcmdline, PV_NONE,
|
|
1194 #else
|
|
1195 (char_u *)NULL, PV_NONE,
|
|
1196 #endif
|
|
1197 {(char_u *)FALSE, (char_u *)0L}},
|
|
1198 {"imdisable", "imd", P_BOOL|P_VI_DEF,
|
|
1199 #ifdef USE_IM_CONTROL
|
|
1200 (char_u *)&p_imdisable, PV_NONE,
|
|
1201 #else
|
|
1202 (char_u *)NULL, PV_NONE,
|
|
1203 #endif
|
|
1204 #ifdef __sgi
|
|
1205 {(char_u *)TRUE, (char_u *)0L}
|
|
1206 #else
|
|
1207 {(char_u *)FALSE, (char_u *)0L}
|
|
1208 #endif
|
|
1209 },
|
|
1210 {"iminsert", "imi", P_NUM|P_VI_DEF,
|
|
1211 (char_u *)&p_iminsert, PV_IMI,
|
|
1212 #ifdef B_IMODE_IM
|
|
1213 {(char_u *)B_IMODE_IM, (char_u *)0L}
|
|
1214 #else
|
|
1215 {(char_u *)B_IMODE_NONE, (char_u *)0L}
|
|
1216 #endif
|
|
1217 },
|
|
1218 {"imsearch", "ims", P_NUM|P_VI_DEF,
|
|
1219 (char_u *)&p_imsearch, PV_IMS,
|
|
1220 #ifdef B_IMODE_IM
|
|
1221 {(char_u *)B_IMODE_IM, (char_u *)0L}
|
|
1222 #else
|
|
1223 {(char_u *)B_IMODE_NONE, (char_u *)0L}
|
|
1224 #endif
|
|
1225 },
|
|
1226 {"include", "inc", P_STRING|P_ALLOCED|P_VI_DEF,
|
|
1227 #ifdef FEAT_FIND_ID
|
|
1228 (char_u *)&p_inc, OPT_BOTH(PV_INC),
|
|
1229 {(char_u *)"^\\s*#\\s*include", (char_u *)0L}
|
|
1230 #else
|
|
1231 (char_u *)NULL, PV_NONE,
|
|
1232 {(char_u *)0L, (char_u *)0L}
|
|
1233 #endif
|
|
1234 },
|
|
1235 {"includeexpr", "inex", P_STRING|P_ALLOCED|P_VI_DEF,
|
|
1236 #if defined(FEAT_FIND_ID) && defined(FEAT_EVAL)
|
|
1237 (char_u *)&p_inex, PV_INEX,
|
|
1238 {(char_u *)"", (char_u *)0L}
|
|
1239 #else
|
|
1240 (char_u *)NULL, PV_NONE,
|
|
1241 {(char_u *)0L, (char_u *)0L}
|
|
1242 #endif
|
|
1243 },
|
|
1244 {"incsearch", "is", P_BOOL|P_VI_DEF|P_VIM,
|
|
1245 (char_u *)&p_is, PV_NONE,
|
|
1246 {(char_u *)FALSE, (char_u *)0L}},
|
|
1247 {"indentexpr", "inde", P_STRING|P_ALLOCED|P_VI_DEF|P_VIM,
|
|
1248 #if defined(FEAT_CINDENT) && defined(FEAT_EVAL)
|
|
1249 (char_u *)&p_inde, PV_INDE,
|
|
1250 {(char_u *)"", (char_u *)0L}
|
|
1251 #else
|
|
1252 (char_u *)NULL, PV_NONE,
|
|
1253 {(char_u *)0L, (char_u *)0L}
|
|
1254 #endif
|
|
1255 },
|
|
1256 {"indentkeys", "indk", P_STRING|P_ALLOCED|P_VI_DEF|P_COMMA|P_NODUP,
|
|
1257 #if defined(FEAT_CINDENT) && defined(FEAT_EVAL)
|
|
1258 (char_u *)&p_indk, PV_INDK,
|
|
1259 {(char_u *)"0{,0},:,0#,!^F,o,O,e", (char_u *)0L}
|
|
1260 #else
|
|
1261 (char_u *)NULL, PV_NONE,
|
|
1262 {(char_u *)0L, (char_u *)0L}
|
|
1263 #endif
|
|
1264 },
|
|
1265 {"infercase", "inf", P_BOOL|P_VI_DEF,
|
|
1266 (char_u *)&p_inf, PV_INF,
|
|
1267 {(char_u *)FALSE, (char_u *)0L}},
|
|
1268 {"insertmode", "im", P_BOOL|P_VI_DEF|P_VIM,
|
|
1269 (char_u *)&p_im, PV_NONE,
|
|
1270 {(char_u *)FALSE, (char_u *)0L}},
|
|
1271 {"isfname", "isf", P_STRING|P_VI_DEF|P_COMMA|P_NODUP,
|
|
1272 (char_u *)&p_isf, PV_NONE,
|
|
1273 {
|
|
1274 #ifdef BACKSLASH_IN_FILENAME
|
|
1275 /* Excluded are: & and ^ are special in cmd.exe
|
|
1276 * ( and ) are used in text separating fnames */
|
|
1277 (char_u *)"@,48-57,/,\\,.,-,_,+,,,#,$,%,{,},[,],:,@-@,!,~,=",
|
|
1278 #else
|
|
1279 # ifdef AMIGA
|
|
1280 (char_u *)"@,48-57,/,.,-,_,+,,,$,:",
|
|
1281 # else
|
|
1282 # ifdef VMS
|
|
1283 (char_u *)"@,48-57,/,.,-,_,+,,,#,$,%,<,>,[,],:,;,~",
|
|
1284 # else /* UNIX et al. */
|
|
1285 # ifdef EBCDIC
|
|
1286 (char_u *)"@,240-249,/,.,-,_,+,,,#,$,%,~,=",
|
|
1287 # else
|
|
1288 (char_u *)"@,48-57,/,.,-,_,+,,,#,$,%,~,=",
|
|
1289 # endif
|
|
1290 # endif
|
|
1291 # endif
|
|
1292 #endif
|
|
1293 (char_u *)0L}},
|
|
1294 {"isident", "isi", P_STRING|P_VI_DEF|P_COMMA|P_NODUP,
|
|
1295 (char_u *)&p_isi, PV_NONE,
|
|
1296 {
|
|
1297 #if defined(MSDOS) || defined(MSWIN) || defined(OS2)
|
|
1298 (char_u *)"@,48-57,_,128-167,224-235",
|
|
1299 #else
|
|
1300 # ifdef EBCDIC
|
|
1301 /* TODO: EBCDIC Check this! @ == isalpha()*/
|
|
1302 (char_u *)"@,240-249,_,66-73,81-89,98-105,"
|
|
1303 "112-120,128,140-142,156,158,172,"
|
|
1304 "174,186,191,203-207,219-225,235-239,"
|
|
1305 "251-254",
|
|
1306 # else
|
|
1307 (char_u *)"@,48-57,_,192-255",
|
|
1308 # endif
|
|
1309 #endif
|
|
1310 (char_u *)0L}},
|
|
1311 {"iskeyword", "isk", P_STRING|P_ALLOCED|P_VIM|P_COMMA|P_NODUP,
|
|
1312 (char_u *)&p_isk, PV_ISK,
|
|
1313 {
|
|
1314 #ifdef EBCDIC
|
|
1315 (char_u *)"@,240-249,_",
|
|
1316 /* TODO: EBCDIC Check this! @ == isalpha()*/
|
|
1317 (char_u *)"@,240-249,_,66-73,81-89,98-105,"
|
|
1318 "112-120,128,140-142,156,158,172,"
|
|
1319 "174,186,191,203-207,219-225,235-239,"
|
|
1320 "251-254",
|
|
1321 #else
|
|
1322 (char_u *)"@,48-57,_",
|
|
1323 # if defined(MSDOS) || defined(MSWIN) || defined(OS2)
|
|
1324 (char_u *)"@,48-57,_,128-167,224-235"
|
|
1325 # else
|
|
1326 (char_u *)"@,48-57,_,192-255"
|
|
1327 # endif
|
|
1328 #endif
|
|
1329 }},
|
|
1330 {"isprint", "isp", P_STRING|P_VI_DEF|P_RALL|P_COMMA|P_NODUP,
|
|
1331 (char_u *)&p_isp, PV_NONE,
|
|
1332 {
|
36
|
1333 #if defined(MSDOS) || defined(MSWIN) || defined(OS2) \
|
|
1334 || (defined(MACOS) && !defined(MACOS_X)) \
|
7
|
1335 || defined(VMS)
|
|
1336 (char_u *)"@,~-255",
|
|
1337 #else
|
|
1338 # ifdef EBCDIC
|
|
1339 /* all chars above 63 are printable */
|
|
1340 (char_u *)"63-255",
|
|
1341 # else
|
|
1342 (char_u *)"@,161-255",
|
|
1343 # endif
|
|
1344 #endif
|
|
1345 (char_u *)0L}},
|
|
1346 {"joinspaces", "js", P_BOOL|P_VI_DEF|P_VIM,
|
|
1347 (char_u *)&p_js, PV_NONE,
|
|
1348 {(char_u *)TRUE, (char_u *)0L}},
|
|
1349 {"key", NULL, P_STRING|P_ALLOCED|P_VI_DEF|P_NO_MKRC,
|
|
1350 #ifdef FEAT_CRYPT
|
|
1351 (char_u *)&p_key, PV_KEY,
|
|
1352 {(char_u *)"", (char_u *)0L}
|
|
1353 #else
|
|
1354 (char_u *)NULL, PV_NONE,
|
|
1355 {(char_u *)0L, (char_u *)0L}
|
|
1356 #endif
|
|
1357 },
|
36
|
1358 {"keymap", "kmp", P_STRING|P_ALLOCED|P_VI_DEF|P_RBUF|P_RSTAT|P_NFNAME,
|
7
|
1359 #ifdef FEAT_KEYMAP
|
|
1360 (char_u *)&p_keymap, PV_KMAP,
|
|
1361 {(char_u *)"", (char_u *)0L}
|
|
1362 #else
|
|
1363 (char_u *)NULL, PV_NONE,
|
|
1364 {(char_u *)"", (char_u *)0L}
|
|
1365 #endif
|
|
1366 },
|
|
1367 {"keymodel", "km", P_STRING|P_VI_DEF|P_COMMA|P_NODUP,
|
|
1368 #ifdef FEAT_VISUAL
|
|
1369 (char_u *)&p_km, PV_NONE,
|
|
1370 #else
|
|
1371 (char_u *)NULL, PV_NONE,
|
|
1372 #endif
|
|
1373 {(char_u *)"", (char_u *)0L}},
|
|
1374 {"keywordprg", "kp", P_STRING|P_EXPAND|P_VI_DEF|P_SECURE,
|
|
1375 (char_u *)&p_kp, OPT_BOTH(PV_KP),
|
|
1376 {
|
|
1377 #if defined(MSDOS) || defined(MSWIN)
|
|
1378 (char_u *)":help",
|
|
1379 #else
|
|
1380 #ifdef VMS
|
|
1381 (char_u *)"help",
|
|
1382 #else
|
|
1383 # if defined(OS2)
|
|
1384 (char_u *)"view /",
|
|
1385 # else
|
|
1386 # ifdef USEMAN_S
|
|
1387 (char_u *)"man -s",
|
|
1388 # else
|
|
1389 (char_u *)"man",
|
|
1390 # endif
|
|
1391 # endif
|
|
1392 #endif
|
|
1393 #endif
|
|
1394 (char_u *)0L}},
|
|
1395 {"langmap", "lmap", P_STRING|P_VI_DEF|P_COMMA|P_NODUP,
|
|
1396 #ifdef FEAT_LANGMAP
|
|
1397 (char_u *)&p_langmap, PV_NONE,
|
|
1398 {(char_u *)"", /* unmatched } */
|
|
1399 #else
|
|
1400 (char_u *)NULL, PV_NONE,
|
|
1401 {(char_u *)NULL,
|
|
1402 #endif
|
|
1403 (char_u *)0L}},
|
36
|
1404 {"langmenu", "lm", P_STRING|P_VI_DEF|P_NFNAME,
|
7
|
1405 #if defined(FEAT_MENU) && defined(FEAT_MULTI_LANG)
|
|
1406 (char_u *)&p_lm, PV_NONE,
|
|
1407 #else
|
|
1408 (char_u *)NULL, PV_NONE,
|
|
1409 #endif
|
|
1410 {(char_u *)"", (char_u *)0L}},
|
|
1411 {"laststatus", "ls", P_NUM|P_VI_DEF|P_RALL,
|
|
1412 #ifdef FEAT_WINDOWS
|
|
1413 (char_u *)&p_ls, PV_NONE,
|
|
1414 #else
|
|
1415 (char_u *)NULL, PV_NONE,
|
|
1416 #endif
|
|
1417 {(char_u *)1L, (char_u *)0L}},
|
|
1418 {"lazyredraw", "lz", P_BOOL|P_VI_DEF,
|
|
1419 (char_u *)&p_lz, PV_NONE,
|
|
1420 {(char_u *)FALSE, (char_u *)0L}},
|
|
1421 {"linebreak", "lbr", P_BOOL|P_VI_DEF|P_RWIN,
|
|
1422 #ifdef FEAT_LINEBREAK
|
|
1423 (char_u *)VAR_WIN, PV_LBR,
|
|
1424 #else
|
|
1425 (char_u *)NULL, PV_NONE,
|
|
1426 #endif
|
|
1427 {(char_u *)FALSE, (char_u *)0L}},
|
|
1428 {"lines", NULL, P_NUM|P_NODEFAULT|P_NO_MKRC|P_VI_DEF|P_RCLR,
|
|
1429 (char_u *)&Rows, PV_NONE,
|
|
1430 {
|
|
1431 #if defined(MSDOS) || defined(WIN3264) || defined(OS2)
|
|
1432 (char_u *)25L,
|
|
1433 #else
|
|
1434 (char_u *)24L,
|
|
1435 #endif
|
|
1436 (char_u *)0L}},
|
|
1437 {"linespace", "lsp", P_NUM|P_VI_DEF|P_RCLR,
|
|
1438 #ifdef FEAT_GUI
|
|
1439 (char_u *)&p_linespace, PV_NONE,
|
|
1440 #else
|
|
1441 (char_u *)NULL, PV_NONE,
|
|
1442 #endif
|
|
1443 #ifdef FEAT_GUI_W32
|
|
1444 {(char_u *)1L, (char_u *)0L}
|
|
1445 #else
|
|
1446 {(char_u *)0L, (char_u *)0L}
|
|
1447 #endif
|
|
1448 },
|
|
1449 {"lisp", NULL, P_BOOL|P_VI_DEF,
|
|
1450 #ifdef FEAT_LISP
|
|
1451 (char_u *)&p_lisp, PV_LISP,
|
|
1452 #else
|
|
1453 (char_u *)NULL, PV_NONE,
|
|
1454 #endif
|
|
1455 {(char_u *)FALSE, (char_u *)0L}},
|
|
1456 {"lispwords", "lw", P_STRING|P_VI_DEF|P_COMMA|P_NODUP,
|
|
1457 #ifdef FEAT_LISP
|
|
1458 (char_u *)&p_lispwords, PV_NONE,
|
|
1459 {(char_u *)LISPWORD_VALUE, (char_u *)0L}
|
|
1460 #else
|
|
1461 (char_u *)NULL, PV_NONE,
|
|
1462 {(char_u *)"", (char_u *)0L}
|
|
1463 #endif
|
|
1464 },
|
|
1465 {"list", NULL, P_BOOL|P_VI_DEF|P_RWIN,
|
|
1466 (char_u *)VAR_WIN, PV_LIST,
|
|
1467 {(char_u *)FALSE, (char_u *)0L}},
|
|
1468 {"listchars", "lcs", P_STRING|P_VI_DEF|P_RALL|P_COMMA|P_NODUP,
|
|
1469 (char_u *)&p_lcs, PV_NONE,
|
|
1470 {(char_u *)"eol:$", (char_u *)0L}},
|
|
1471 {"loadplugins", "lpl", P_BOOL|P_VI_DEF,
|
|
1472 (char_u *)&p_lpl, PV_NONE,
|
|
1473 {(char_u *)TRUE, (char_u *)0L}},
|
|
1474 {"magic", NULL, P_BOOL|P_VI_DEF,
|
|
1475 (char_u *)&p_magic, PV_NONE,
|
|
1476 {(char_u *)TRUE, (char_u *)0L}},
|
634
|
1477 {"makeef", "mef", P_STRING|P_EXPAND|P_VI_DEF|P_SECURE,
|
7
|
1478 #ifdef FEAT_QUICKFIX
|
|
1479 (char_u *)&p_mef, PV_NONE,
|
|
1480 {(char_u *)"", (char_u *)0L}
|
|
1481 #else
|
|
1482 (char_u *)NULL, PV_NONE,
|
|
1483 {(char_u *)NULL, (char_u *)0L}
|
|
1484 #endif
|
|
1485 },
|
|
1486 {"makeprg", "mp", P_STRING|P_EXPAND|P_VI_DEF|P_SECURE,
|
|
1487 #ifdef FEAT_QUICKFIX
|
|
1488 (char_u *)&p_mp, OPT_BOTH(PV_MP),
|
|
1489 # ifdef VMS
|
|
1490 {(char_u *)"MMS", (char_u *)0L}
|
|
1491 # else
|
|
1492 {(char_u *)"make", (char_u *)0L}
|
|
1493 # endif
|
|
1494 #else
|
|
1495 (char_u *)NULL, PV_NONE,
|
|
1496 {(char_u *)NULL, (char_u *)0L}
|
|
1497 #endif
|
|
1498 },
|
|
1499 {"matchpairs", "mps", P_STRING|P_ALLOCED|P_VI_DEF|P_COMMA|P_NODUP,
|
|
1500 (char_u *)&p_mps, PV_MPS,
|
|
1501 {(char_u *)"(:),{:},[:]", (char_u *)0L}},
|
|
1502 {"matchtime", "mat", P_NUM|P_VI_DEF,
|
|
1503 (char_u *)&p_mat, PV_NONE,
|
|
1504 {(char_u *)5L, (char_u *)0L}},
|
|
1505 {"maxfuncdepth", "mfd", P_NUM|P_VI_DEF,
|
|
1506 #ifdef FEAT_EVAL
|
|
1507 (char_u *)&p_mfd, PV_NONE,
|
|
1508 #else
|
|
1509 (char_u *)NULL, PV_NONE,
|
|
1510 #endif
|
|
1511 {(char_u *)100L, (char_u *)0L}},
|
|
1512 {"maxmapdepth", "mmd", P_NUM|P_VI_DEF,
|
|
1513 (char_u *)&p_mmd, PV_NONE,
|
|
1514 {(char_u *)1000L, (char_u *)0L}},
|
|
1515 {"maxmem", "mm", P_NUM|P_VI_DEF,
|
|
1516 (char_u *)&p_mm, PV_NONE,
|
|
1517 {(char_u *)DFLT_MAXMEM, (char_u *)0L}},
|
190
|
1518 {"maxmempattern","mmp", P_NUM|P_VI_DEF,
|
|
1519 (char_u *)&p_mmp, PV_NONE,
|
|
1520 {(char_u *)1000L, (char_u *)0L}},
|
7
|
1521 {"maxmemtot", "mmt", P_NUM|P_VI_DEF,
|
|
1522 (char_u *)&p_mmt, PV_NONE,
|
|
1523 {(char_u *)DFLT_MAXMEMTOT, (char_u *)0L}},
|
|
1524 {"menuitems", "mis", P_NUM|P_VI_DEF,
|
|
1525 #ifdef FEAT_MENU
|
|
1526 (char_u *)&p_mis, PV_NONE,
|
|
1527 #else
|
|
1528 (char_u *)NULL, PV_NONE,
|
|
1529 #endif
|
|
1530 {(char_u *)25L, (char_u *)0L}},
|
|
1531 {"mesg", NULL, P_BOOL|P_VI_DEF,
|
|
1532 (char_u *)NULL, PV_NONE,
|
|
1533 {(char_u *)FALSE, (char_u *)0L}},
|
484
|
1534 {"mkspellmem", "msm", P_STRING|P_VI_DEF|P_EXPAND|P_SECURE,
|
|
1535 #ifdef FEAT_SYN_HL
|
|
1536 (char_u *)&p_msm, PV_NONE,
|
|
1537 {(char_u *)"460000,2000,500", (char_u *)0L}
|
|
1538 #else
|
|
1539 (char_u *)NULL, PV_NONE,
|
|
1540 {(char_u *)0L, (char_u *)0L}
|
|
1541 #endif
|
|
1542 },
|
7
|
1543 {"modeline", "ml", P_BOOL|P_VIM,
|
|
1544 (char_u *)&p_ml, PV_ML,
|
|
1545 {(char_u *)FALSE, (char_u *)TRUE}},
|
|
1546 {"modelines", "mls", P_NUM|P_VI_DEF,
|
|
1547 (char_u *)&p_mls, PV_NONE,
|
|
1548 {(char_u *)5L, (char_u *)0L}},
|
|
1549 {"modifiable", "ma", P_BOOL|P_VI_DEF|P_NOGLOB,
|
|
1550 (char_u *)&p_ma, PV_MA,
|
|
1551 {(char_u *)TRUE, (char_u *)0L}},
|
|
1552 {"modified", "mod", P_BOOL|P_NO_MKRC|P_VI_DEF|P_RSTAT,
|
|
1553 (char_u *)&p_mod, PV_MOD,
|
|
1554 {(char_u *)FALSE, (char_u *)0L}},
|
|
1555 {"more", NULL, P_BOOL|P_VIM,
|
|
1556 (char_u *)&p_more, PV_NONE,
|
|
1557 {(char_u *)FALSE, (char_u *)TRUE}},
|
|
1558 {"mouse", NULL, P_STRING|P_VI_DEF|P_FLAGLIST,
|
|
1559 (char_u *)&p_mouse, PV_NONE,
|
|
1560 {
|
|
1561 #if defined(MSDOS) || defined(WIN3264)
|
|
1562 (char_u *)"a",
|
|
1563 #else
|
|
1564 (char_u *)"",
|
|
1565 #endif
|
|
1566 (char_u *)0L}},
|
|
1567 {"mousefocus", "mousef", P_BOOL|P_VI_DEF,
|
|
1568 #ifdef FEAT_GUI
|
|
1569 (char_u *)&p_mousef, PV_NONE,
|
|
1570 #else
|
|
1571 (char_u *)NULL, PV_NONE,
|
|
1572 #endif
|
|
1573 {(char_u *)FALSE, (char_u *)0L}},
|
|
1574 {"mousehide", "mh", P_BOOL|P_VI_DEF,
|
|
1575 #ifdef FEAT_GUI
|
|
1576 (char_u *)&p_mh, PV_NONE,
|
|
1577 #else
|
|
1578 (char_u *)NULL, PV_NONE,
|
|
1579 #endif
|
|
1580 {(char_u *)TRUE, (char_u *)0L}},
|
|
1581 {"mousemodel", "mousem", P_STRING|P_VI_DEF,
|
|
1582 (char_u *)&p_mousem, PV_NONE,
|
|
1583 {
|
|
1584 #if defined(MSDOS) || defined(MSWIN)
|
|
1585 (char_u *)"popup",
|
|
1586 #else
|
|
1587 # if defined(MACOS)
|
|
1588 (char_u *)"popup_setpos",
|
|
1589 # else
|
|
1590 (char_u *)"extend",
|
|
1591 # endif
|
|
1592 #endif
|
|
1593 (char_u *)0L}},
|
|
1594 {"mouseshape", "mouses", P_STRING|P_VI_DEF|P_COMMA|P_NODUP,
|
|
1595 #ifdef FEAT_MOUSESHAPE
|
|
1596 (char_u *)&p_mouseshape, PV_NONE,
|
|
1597 {(char_u *)"i-r:beam,s:updown,sd:udsizing,vs:leftright,vd:lrsizing,m:no,ml:up-arrow,v:rightup-arrow", (char_u *)0L}
|
|
1598 #else
|
|
1599 (char_u *)NULL, PV_NONE,
|
|
1600 {(char_u *)NULL, (char_u *)0L}
|
|
1601 #endif
|
|
1602 },
|
|
1603 {"mousetime", "mouset", P_NUM|P_VI_DEF,
|
|
1604 (char_u *)&p_mouset, PV_NONE,
|
|
1605 {(char_u *)500L, (char_u *)0L}},
|
14
|
1606 {"mzquantum", "mzq", P_NUM,
|
|
1607 #ifdef FEAT_MZSCHEME
|
|
1608 (char_u *)&p_mzq, PV_NONE,
|
|
1609 #else
|
|
1610 (char_u *)NULL, PV_NONE,
|
|
1611 #endif
|
|
1612 {(char_u *)100L, (char_u *)100L}},
|
7
|
1613 {"novice", NULL, P_BOOL|P_VI_DEF,
|
|
1614 (char_u *)NULL, PV_NONE,
|
|
1615 {(char_u *)FALSE, (char_u *)0L}},
|
|
1616 {"nrformats", "nf", P_STRING|P_ALLOCED|P_VI_DEF|P_COMMA|P_NODUP,
|
|
1617 (char_u *)&p_nf, PV_NF,
|
|
1618 {(char_u *)"octal,hex", (char_u *)0L}},
|
|
1619 {"number", "nu", P_BOOL|P_VI_DEF|P_RWIN,
|
|
1620 (char_u *)VAR_WIN, PV_NU,
|
|
1621 {(char_u *)FALSE, (char_u *)0L}},
|
13
|
1622 {"numberwidth", "nuw", P_NUM|P_RWIN|P_VIM,
|
|
1623 #ifdef FEAT_LINEBREAK
|
|
1624 (char_u *)VAR_WIN, PV_NUW,
|
|
1625 #else
|
|
1626 (char_u *)NULL, PV_NONE,
|
|
1627 #endif
|
|
1628 {(char_u *)8L, (char_u *)4L}},
|
523
|
1629 {"omnifunc", "ofu", P_STRING|P_ALLOCED|P_VI_DEF|P_SECURE,
|
502
|
1630 #ifdef FEAT_COMPL_FUNC
|
|
1631 (char_u *)&p_ofu, PV_OFU,
|
|
1632 {(char_u *)"", (char_u *)0L}
|
|
1633 #else
|
|
1634 (char_u *)NULL, PV_NONE,
|
|
1635 {(char_u *)0L, (char_u *)0L}
|
|
1636 #endif
|
|
1637 },
|
7
|
1638 {"open", NULL, P_BOOL|P_VI_DEF,
|
|
1639 (char_u *)NULL, PV_NONE,
|
|
1640 {(char_u *)FALSE, (char_u *)0L}},
|
593
|
1641 {"operatorfunc", "opfunc", P_STRING|P_VI_DEF|P_SECURE,
|
|
1642 (char_u *)&p_opfunc, PV_NONE,
|
|
1643 {(char_u *)"", (char_u *)0L} },
|
7
|
1644 {"optimize", "opt", P_BOOL|P_VI_DEF,
|
|
1645 (char_u *)NULL, PV_NONE,
|
|
1646 {(char_u *)FALSE, (char_u *)0L}},
|
|
1647 {"osfiletype", "oft", P_STRING|P_ALLOCED|P_VI_DEF,
|
|
1648 #ifdef FEAT_OSFILETYPE
|
|
1649 (char_u *)&p_oft, PV_OFT,
|
|
1650 {(char_u *)DFLT_OFT, (char_u *)0L}
|
|
1651 #else
|
|
1652 (char_u *)NULL, PV_NONE,
|
|
1653 {(char_u *)0L, (char_u *)0L}
|
|
1654 #endif
|
|
1655 },
|
|
1656 {"paragraphs", "para", P_STRING|P_VI_DEF,
|
|
1657 (char_u *)&p_para, PV_NONE,
|
|
1658 {(char_u *)"IPLPPPQPP LIpplpipbp", (char_u *)0L}},
|
|
1659 {"paste", NULL, P_BOOL|P_VI_DEF,
|
|
1660 (char_u *)&p_paste, PV_NONE,
|
|
1661 {(char_u *)FALSE, (char_u *)0L}},
|
|
1662 {"pastetoggle", "pt", P_STRING|P_VI_DEF,
|
|
1663 (char_u *)&p_pt, PV_NONE,
|
|
1664 {(char_u *)"", (char_u *)0L}},
|
|
1665 {"patchexpr", "pex", P_STRING|P_VI_DEF|P_SECURE,
|
|
1666 #if defined(FEAT_DIFF) && defined(FEAT_EVAL)
|
|
1667 (char_u *)&p_pex, PV_NONE,
|
|
1668 {(char_u *)"", (char_u *)0L}
|
|
1669 #else
|
|
1670 (char_u *)NULL, PV_NONE,
|
|
1671 {(char_u *)0L, (char_u *)0L}
|
|
1672 #endif
|
|
1673 },
|
36
|
1674 {"patchmode", "pm", P_STRING|P_VI_DEF|P_NFNAME,
|
7
|
1675 (char_u *)&p_pm, PV_NONE,
|
|
1676 {(char_u *)"", (char_u *)0L}},
|
|
1677 {"path", "pa", P_STRING|P_EXPAND|P_VI_DEF|P_COMMA|P_NODUP,
|
|
1678 (char_u *)&p_path, OPT_BOTH(PV_PATH),
|
|
1679 {
|
|
1680 #if defined AMIGA || defined MSDOS || defined MSWIN
|
|
1681 (char_u *)".,,",
|
|
1682 #else
|
|
1683 # if defined(__EMX__)
|
|
1684 (char_u *)".,/emx/include,,",
|
|
1685 # else /* Unix, probably */
|
|
1686 (char_u *)".,/usr/include,,",
|
|
1687 # endif
|
|
1688 #endif
|
|
1689 (char_u *)0L}},
|
|
1690 {"preserveindent", "pi", P_BOOL|P_VI_DEF|P_VIM,
|
|
1691 (char_u *)&p_pi, PV_PI,
|
|
1692 {(char_u *)FALSE, (char_u *)0L}},
|
13
|
1693 {"previewheight", "pvh", P_NUM|P_VI_DEF,
|
7
|
1694 #if defined(FEAT_WINDOWS) && defined(FEAT_QUICKFIX)
|
|
1695 (char_u *)&p_pvh, PV_NONE,
|
|
1696 #else
|
|
1697 (char_u *)NULL, PV_NONE,
|
|
1698 #endif
|
|
1699 {(char_u *)12L, (char_u *)0L}},
|
|
1700 {"previewwindow", "pvw", P_BOOL|P_VI_DEF|P_RSTAT|P_NOGLOB,
|
|
1701 #if defined(FEAT_WINDOWS) && defined(FEAT_QUICKFIX)
|
|
1702 (char_u *)VAR_WIN, PV_PVW,
|
|
1703 #else
|
|
1704 (char_u *)NULL, PV_NONE,
|
|
1705 #endif
|
|
1706 {(char_u *)FALSE, (char_u *)0L}},
|
36
|
1707 {"printdevice", "pdev", P_STRING|P_VI_DEF|P_SECURE,
|
7
|
1708 #ifdef FEAT_PRINTER
|
|
1709 (char_u *)&p_pdev, PV_NONE,
|
|
1710 {(char_u *)"", (char_u *)0L}
|
|
1711 #else
|
|
1712 (char_u *)NULL, PV_NONE,
|
|
1713 {(char_u *)NULL, (char_u *)0L}
|
|
1714 #endif
|
|
1715 },
|
|
1716 {"printencoding", "penc", P_STRING|P_VI_DEF,
|
|
1717 #ifdef FEAT_POSTSCRIPT
|
|
1718 (char_u *)&p_penc, PV_NONE,
|
|
1719 {(char_u *)"", (char_u *)0L}
|
|
1720 #else
|
|
1721 (char_u *)NULL, PV_NONE,
|
|
1722 {(char_u *)NULL, (char_u *)0L}
|
|
1723 #endif
|
|
1724 },
|
|
1725 {"printexpr", "pexpr", P_STRING|P_VI_DEF,
|
|
1726 #ifdef FEAT_POSTSCRIPT
|
|
1727 (char_u *)&p_pexpr, PV_NONE,
|
|
1728 {(char_u *)"", (char_u *)0L}
|
|
1729 #else
|
|
1730 (char_u *)NULL, PV_NONE,
|
|
1731 {(char_u *)NULL, (char_u *)0L}
|
|
1732 #endif
|
|
1733 },
|
|
1734 {"printfont", "pfn", P_STRING|P_VI_DEF,
|
|
1735 #ifdef FEAT_PRINTER
|
|
1736 (char_u *)&p_pfn, PV_NONE,
|
|
1737 {
|
|
1738 # ifdef MSWIN
|
|
1739 (char_u *)"Courier_New:h10",
|
|
1740 # else
|
|
1741 (char_u *)"courier",
|
|
1742 # endif
|
|
1743 (char_u *)0L}
|
|
1744 #else
|
|
1745 (char_u *)NULL, PV_NONE,
|
|
1746 {(char_u *)NULL, (char_u *)0L}
|
|
1747 #endif
|
|
1748 },
|
|
1749 {"printheader", "pheader", P_STRING|P_VI_DEF|P_GETTEXT,
|
|
1750 #ifdef FEAT_PRINTER
|
|
1751 (char_u *)&p_header, PV_NONE,
|
|
1752 {(char_u *)N_("%<%f%h%m%=Page %N"), (char_u *)0L}
|
|
1753 #else
|
|
1754 (char_u *)NULL, PV_NONE,
|
|
1755 {(char_u *)NULL, (char_u *)0L}
|
|
1756 #endif
|
|
1757 },
|
15
|
1758 {"printmbcharset", "pmbcs", P_STRING|P_VI_DEF,
|
|
1759 #if defined(FEAT_POSTSCRIPT) && defined(FEAT_MBYTE)
|
|
1760 (char_u *)&p_pmcs, PV_NONE,
|
|
1761 {(char_u *)"", (char_u *)0L}
|
|
1762 #else
|
|
1763 (char_u *)NULL, PV_NONE,
|
|
1764 {(char_u *)NULL, (char_u *)0L}
|
|
1765 #endif
|
|
1766 },
|
|
1767 {"printmbfont", "pmbfn", P_STRING|P_VI_DEF,
|
|
1768 #if defined(FEAT_POSTSCRIPT) && defined(FEAT_MBYTE)
|
|
1769 (char_u *)&p_pmfn, PV_NONE,
|
|
1770 {(char_u *)"", (char_u *)0L}
|
|
1771 #else
|
|
1772 (char_u *)NULL, PV_NONE,
|
|
1773 {(char_u *)NULL, (char_u *)0L}
|
|
1774 #endif
|
|
1775 },
|
7
|
1776 {"printoptions", "popt", P_STRING|P_VI_DEF|P_COMMA|P_NODUP,
|
|
1777 #ifdef FEAT_PRINTER
|
|
1778 (char_u *)&p_popt, PV_NONE,
|
|
1779 {(char_u *)"", (char_u *)0L}
|
|
1780 #else
|
|
1781 (char_u *)NULL, PV_NONE,
|
|
1782 {(char_u *)NULL, (char_u *)0L}
|
|
1783 #endif
|
|
1784 },
|
|
1785 {"prompt", NULL, P_BOOL|P_VI_DEF,
|
168
|
1786 (char_u *)&p_prompt, PV_NONE,
|
|
1787 {(char_u *)TRUE, (char_u *)0L}},
|
12
|
1788 {"quoteescape", "qe", P_STRING|P_ALLOCED|P_VI_DEF,
|
|
1789 #ifdef FEAT_TEXTOBJ
|
|
1790 (char_u *)&p_qe, PV_QE,
|
|
1791 {(char_u *)"\\", (char_u *)0L}
|
|
1792 #else
|
|
1793 (char_u *)NULL, PV_NONE,
|
|
1794 {(char_u *)NULL, (char_u *)0L}
|
|
1795 #endif
|
|
1796 },
|
7
|
1797 {"readonly", "ro", P_BOOL|P_VI_DEF|P_RSTAT|P_NOGLOB,
|
|
1798 (char_u *)&p_ro, PV_RO,
|
|
1799 {(char_u *)FALSE, (char_u *)0L}},
|
|
1800 {"redraw", NULL, P_BOOL|P_VI_DEF,
|
|
1801 (char_u *)NULL, PV_NONE,
|
|
1802 {(char_u *)FALSE, (char_u *)0L}},
|
|
1803 {"remap", NULL, P_BOOL|P_VI_DEF,
|
|
1804 (char_u *)&p_remap, PV_NONE,
|
|
1805 {(char_u *)TRUE, (char_u *)0L}},
|
|
1806 {"report", NULL, P_NUM|P_VI_DEF,
|
|
1807 (char_u *)&p_report, PV_NONE,
|
|
1808 {(char_u *)2L, (char_u *)0L}},
|
|
1809 {"restorescreen", "rs", P_BOOL|P_VI_DEF,
|
|
1810 #ifdef WIN3264
|
|
1811 (char_u *)&p_rs, PV_NONE,
|
|
1812 #else
|
|
1813 (char_u *)NULL, PV_NONE,
|
|
1814 #endif
|
|
1815 {(char_u *)TRUE, (char_u *)0L}},
|
|
1816 {"revins", "ri", P_BOOL|P_VI_DEF|P_VIM,
|
|
1817 #ifdef FEAT_RIGHTLEFT
|
|
1818 (char_u *)&p_ri, PV_NONE,
|
|
1819 #else
|
|
1820 (char_u *)NULL, PV_NONE,
|
|
1821 #endif
|
|
1822 {(char_u *)FALSE, (char_u *)0L}},
|
|
1823 {"rightleft", "rl", P_BOOL|P_VI_DEF|P_RWIN,
|
|
1824 #ifdef FEAT_RIGHTLEFT
|
|
1825 (char_u *)VAR_WIN, PV_RL,
|
|
1826 #else
|
|
1827 (char_u *)NULL, PV_NONE,
|
|
1828 #endif
|
|
1829 {(char_u *)FALSE, (char_u *)0L}},
|
|
1830 {"rightleftcmd", "rlc", P_STRING|P_ALLOCED|P_VI_DEF|P_RWIN,
|
|
1831 #ifdef FEAT_RIGHTLEFT
|
|
1832 (char_u *)VAR_WIN, PV_RLC,
|
|
1833 {(char_u *)"search", (char_u *)NULL}
|
|
1834 #else
|
|
1835 (char_u *)NULL, PV_NONE,
|
|
1836 {(char_u *)NULL, (char_u *)0L}
|
|
1837 #endif
|
|
1838 },
|
|
1839 {"ruler", "ru", P_BOOL|P_VI_DEF|P_VIM|P_RSTAT,
|
|
1840 #ifdef FEAT_CMDL_INFO
|
|
1841 (char_u *)&p_ru, PV_NONE,
|
|
1842 #else
|
|
1843 (char_u *)NULL, PV_NONE,
|
|
1844 #endif
|
|
1845 {(char_u *)FALSE, (char_u *)0L}},
|
|
1846 {"rulerformat", "ruf", P_STRING|P_VI_DEF|P_ALLOCED|P_RSTAT,
|
|
1847 #ifdef FEAT_STL_OPT
|
|
1848 (char_u *)&p_ruf, PV_NONE,
|
|
1849 #else
|
|
1850 (char_u *)NULL, PV_NONE,
|
|
1851 #endif
|
|
1852 {(char_u *)"", (char_u *)0L}},
|
|
1853 {"runtimepath", "rtp", P_STRING|P_VI_DEF|P_EXPAND|P_COMMA|P_NODUP|P_SECURE,
|
|
1854 (char_u *)&p_rtp, PV_NONE,
|
|
1855 {(char_u *)DFLT_RUNTIMEPATH, (char_u *)0L}},
|
|
1856 {"scroll", "scr", P_NUM|P_NO_MKRC|P_VI_DEF,
|
|
1857 (char_u *)VAR_WIN, PV_SCROLL,
|
|
1858 {(char_u *)12L, (char_u *)0L}},
|
|
1859 {"scrollbind", "scb", P_BOOL|P_VI_DEF,
|
|
1860 #ifdef FEAT_SCROLLBIND
|
|
1861 (char_u *)VAR_WIN, PV_SCBIND,
|
|
1862 #else
|
|
1863 (char_u *)NULL, PV_NONE,
|
|
1864 #endif
|
|
1865 {(char_u *)FALSE, (char_u *)0L}},
|
|
1866 {"scrolljump", "sj", P_NUM|P_VI_DEF|P_VIM,
|
|
1867 (char_u *)&p_sj, PV_NONE,
|
|
1868 {(char_u *)1L, (char_u *)0L}},
|
|
1869 {"scrolloff", "so", P_NUM|P_VI_DEF|P_VIM|P_RALL,
|
|
1870 (char_u *)&p_so, PV_NONE,
|
|
1871 {(char_u *)0L, (char_u *)0L}},
|
|
1872 {"scrollopt", "sbo", P_STRING|P_VI_DEF|P_COMMA|P_NODUP,
|
|
1873 #ifdef FEAT_SCROLLBIND
|
|
1874 (char_u *)&p_sbo, PV_NONE,
|
|
1875 {(char_u *)"ver,jump", (char_u *)0L}
|
|
1876 #else
|
|
1877 (char_u *)NULL, PV_NONE,
|
|
1878 {(char_u *)0L, (char_u *)0L}
|
|
1879 #endif
|
|
1880 },
|
|
1881 {"sections", "sect", P_STRING|P_VI_DEF,
|
|
1882 (char_u *)&p_sections, PV_NONE,
|
|
1883 {(char_u *)"SHNHH HUnhsh", (char_u *)0L}},
|
|
1884 {"secure", NULL, P_BOOL|P_VI_DEF|P_SECURE,
|
|
1885 (char_u *)&p_secure, PV_NONE,
|
|
1886 {(char_u *)FALSE, (char_u *)0L}},
|
|
1887 {"selection", "sel", P_STRING|P_VI_DEF,
|
|
1888 #ifdef FEAT_VISUAL
|
|
1889 (char_u *)&p_sel, PV_NONE,
|
|
1890 #else
|
|
1891 (char_u *)NULL, PV_NONE,
|
|
1892 #endif
|
|
1893 {(char_u *)"inclusive", (char_u *)0L}},
|
|
1894 {"selectmode", "slm", P_STRING|P_VI_DEF|P_COMMA|P_NODUP,
|
|
1895 #ifdef FEAT_VISUAL
|
|
1896 (char_u *)&p_slm, PV_NONE,
|
|
1897 #else
|
|
1898 (char_u *)NULL, PV_NONE,
|
|
1899 #endif
|
|
1900 {(char_u *)"", (char_u *)0L}},
|
|
1901 {"sessionoptions", "ssop", P_STRING|P_VI_DEF|P_COMMA|P_NODUP,
|
|
1902 #ifdef FEAT_SESSION
|
|
1903 (char_u *)&p_ssop, PV_NONE,
|
|
1904 {(char_u *)"blank,buffers,curdir,folds,help,options,winsize",
|
|
1905 (char_u *)0L}
|
|
1906 #else
|
|
1907 (char_u *)NULL, PV_NONE,
|
|
1908 {(char_u *)0L, (char_u *)0L}
|
|
1909 #endif
|
|
1910 },
|
|
1911 {"shell", "sh", P_STRING|P_EXPAND|P_VI_DEF|P_SECURE,
|
|
1912 (char_u *)&p_sh, PV_NONE,
|
|
1913 {
|
|
1914 #ifdef VMS
|
|
1915 (char_u *)"-",
|
|
1916 #else
|
|
1917 # if defined(MSDOS)
|
|
1918 (char_u *)"command",
|
|
1919 # else
|
|
1920 # if defined(WIN16)
|
|
1921 (char_u *)"command.com",
|
|
1922 # else
|
|
1923 # if defined(WIN3264)
|
|
1924 (char_u *)"", /* set in set_init_1() */
|
|
1925 # else
|
|
1926 # if defined(OS2)
|
|
1927 (char_u *)"cmd.exe",
|
|
1928 # else
|
|
1929 # if defined(ARCHIE)
|
|
1930 (char_u *)"gos",
|
|
1931 # else
|
|
1932 (char_u *)"sh",
|
|
1933 # endif
|
|
1934 # endif
|
|
1935 # endif
|
|
1936 # endif
|
|
1937 # endif
|
|
1938 #endif /* VMS */
|
|
1939 (char_u *)0L}},
|
|
1940 {"shellcmdflag","shcf", P_STRING|P_VI_DEF|P_SECURE,
|
|
1941 (char_u *)&p_shcf, PV_NONE,
|
|
1942 {
|
|
1943 #if defined(MSDOS) || defined(MSWIN)
|
|
1944 (char_u *)"/c",
|
|
1945 #else
|
|
1946 # if defined(OS2)
|
|
1947 (char_u *)"/c",
|
|
1948 # else
|
|
1949 (char_u *)"-c",
|
|
1950 # endif
|
|
1951 #endif
|
|
1952 (char_u *)0L}},
|
|
1953 {"shellpipe", "sp", P_STRING|P_VI_DEF|P_SECURE,
|
|
1954 #ifdef FEAT_QUICKFIX
|
|
1955 (char_u *)&p_sp, PV_NONE,
|
|
1956 {
|
|
1957 #if defined(UNIX) || defined(OS2)
|
|
1958 # ifdef ARCHIE
|
|
1959 (char_u *)"2>",
|
|
1960 # else
|
|
1961 (char_u *)"| tee",
|
|
1962 # endif
|
|
1963 #else
|
|
1964 (char_u *)">",
|
|
1965 #endif
|
|
1966 (char_u *)0L}
|
|
1967 #else
|
|
1968 (char_u *)NULL, PV_NONE,
|
|
1969 {(char_u *)0L, (char_u *)0L}
|
|
1970 #endif
|
|
1971 },
|
|
1972 {"shellquote", "shq", P_STRING|P_VI_DEF|P_SECURE,
|
|
1973 (char_u *)&p_shq, PV_NONE,
|
|
1974 {(char_u *)"", (char_u *)0L}},
|
|
1975 {"shellredir", "srr", P_STRING|P_VI_DEF|P_SECURE,
|
|
1976 (char_u *)&p_srr, PV_NONE,
|
|
1977 {(char_u *)">", (char_u *)0L}},
|
|
1978 {"shellslash", "ssl", P_BOOL|P_VI_DEF,
|
|
1979 #ifdef BACKSLASH_IN_FILENAME
|
|
1980 (char_u *)&p_ssl, PV_NONE,
|
|
1981 #else
|
|
1982 (char_u *)NULL, PV_NONE,
|
|
1983 #endif
|
|
1984 {(char_u *)FALSE, (char_u *)0L}},
|
168
|
1985 {"shelltemp", "stmp", P_BOOL,
|
|
1986 (char_u *)&p_stmp, PV_NONE,
|
|
1987 {(char_u *)FALSE, (char_u *)TRUE}},
|
7
|
1988 {"shelltype", "st", P_NUM|P_VI_DEF,
|
|
1989 #ifdef AMIGA
|
|
1990 (char_u *)&p_st, PV_NONE,
|
|
1991 #else
|
|
1992 (char_u *)NULL, PV_NONE,
|
|
1993 #endif
|
|
1994 {(char_u *)0L, (char_u *)0L}},
|
|
1995 {"shellxquote", "sxq", P_STRING|P_VI_DEF|P_SECURE,
|
|
1996 (char_u *)&p_sxq, PV_NONE,
|
|
1997 {
|
|
1998 #if defined(UNIX) && defined(USE_SYSTEM) && !defined(__EMX__)
|
|
1999 (char_u *)"\"",
|
|
2000 #else
|
|
2001 (char_u *)"",
|
|
2002 #endif
|
|
2003 (char_u *)0L}},
|
|
2004 {"shiftround", "sr", P_BOOL|P_VI_DEF|P_VIM,
|
|
2005 (char_u *)&p_sr, PV_NONE,
|
|
2006 {(char_u *)FALSE, (char_u *)0L}},
|
|
2007 {"shiftwidth", "sw", P_NUM|P_VI_DEF,
|
|
2008 (char_u *)&p_sw, PV_SW,
|
|
2009 {(char_u *)8L, (char_u *)0L}},
|
|
2010 {"shortmess", "shm", P_STRING|P_VIM|P_FLAGLIST,
|
|
2011 (char_u *)&p_shm, PV_NONE,
|
|
2012 {(char_u *)"", (char_u *)"filnxtToO"}},
|
|
2013 {"shortname", "sn", P_BOOL|P_VI_DEF,
|
|
2014 #ifdef SHORT_FNAME
|
|
2015 (char_u *)NULL, PV_NONE,
|
|
2016 #else
|
|
2017 (char_u *)&p_sn, PV_SN,
|
|
2018 #endif
|
|
2019 {(char_u *)FALSE, (char_u *)0L}},
|
|
2020 {"showbreak", "sbr", P_STRING|P_VI_DEF|P_RALL,
|
|
2021 #ifdef FEAT_LINEBREAK
|
|
2022 (char_u *)&p_sbr, PV_NONE,
|
|
2023 #else
|
|
2024 (char_u *)NULL, PV_NONE,
|
|
2025 #endif
|
|
2026 {(char_u *)"", (char_u *)0L}},
|
|
2027 {"showcmd", "sc", P_BOOL|P_VIM,
|
|
2028 #ifdef FEAT_CMDL_INFO
|
|
2029 (char_u *)&p_sc, PV_NONE,
|
|
2030 #else
|
|
2031 (char_u *)NULL, PV_NONE,
|
|
2032 #endif
|
|
2033 {(char_u *)FALSE,
|
|
2034 #ifdef UNIX
|
|
2035 (char_u *)FALSE
|
|
2036 #else
|
|
2037 (char_u *)TRUE
|
|
2038 #endif
|
|
2039 }},
|
|
2040 {"showfulltag", "sft", P_BOOL|P_VI_DEF,
|
|
2041 (char_u *)&p_sft, PV_NONE,
|
|
2042 {(char_u *)FALSE, (char_u *)0L}},
|
|
2043 {"showmatch", "sm", P_BOOL|P_VI_DEF,
|
|
2044 (char_u *)&p_sm, PV_NONE,
|
|
2045 {(char_u *)FALSE, (char_u *)0L}},
|
|
2046 {"showmode", "smd", P_BOOL|P_VIM,
|
|
2047 (char_u *)&p_smd, PV_NONE,
|
|
2048 {(char_u *)FALSE, (char_u *)TRUE}},
|
677
|
2049 {"showtabline", "stal", P_NUM|P_VI_DEF|P_RALL,
|
|
2050 #ifdef FEAT_WINDOWS
|
|
2051 (char_u *)&p_stal, PV_NONE,
|
|
2052 #else
|
|
2053 (char_u *)NULL, PV_NONE,
|
|
2054 #endif
|
|
2055 {(char_u *)1L, (char_u *)0L}},
|
7
|
2056 {"sidescroll", "ss", P_NUM|P_VI_DEF,
|
|
2057 (char_u *)&p_ss, PV_NONE,
|
|
2058 {(char_u *)0L, (char_u *)0L}},
|
|
2059 {"sidescrolloff", "siso", P_NUM|P_VI_DEF|P_VIM|P_RBUF,
|
|
2060 (char_u *)&p_siso, PV_NONE,
|
|
2061 {(char_u *)0L, (char_u *)0L}},
|
|
2062 {"slowopen", "slow", P_BOOL|P_VI_DEF,
|
|
2063 (char_u *)NULL, PV_NONE,
|
|
2064 {(char_u *)FALSE, (char_u *)0L}},
|
|
2065 {"smartcase", "scs", P_BOOL|P_VI_DEF|P_VIM,
|
|
2066 (char_u *)&p_scs, PV_NONE,
|
|
2067 {(char_u *)FALSE, (char_u *)0L}},
|
|
2068 {"smartindent", "si", P_BOOL|P_VI_DEF|P_VIM,
|
|
2069 #ifdef FEAT_SMARTINDENT
|
|
2070 (char_u *)&p_si, PV_SI,
|
|
2071 #else
|
|
2072 (char_u *)NULL, PV_NONE,
|
|
2073 #endif
|
|
2074 {(char_u *)FALSE, (char_u *)0L}},
|
|
2075 {"smarttab", "sta", P_BOOL|P_VI_DEF|P_VIM,
|
|
2076 (char_u *)&p_sta, PV_NONE,
|
|
2077 {(char_u *)FALSE, (char_u *)0L}},
|
|
2078 {"softtabstop", "sts", P_NUM|P_VI_DEF|P_VIM,
|
|
2079 (char_u *)&p_sts, PV_STS,
|
|
2080 {(char_u *)0L, (char_u *)0L}},
|
|
2081 {"sourceany", NULL, P_BOOL|P_VI_DEF,
|
|
2082 (char_u *)NULL, PV_NONE,
|
|
2083 {(char_u *)FALSE, (char_u *)0L}},
|
221
|
2084 {"spell", NULL, P_BOOL|P_VI_DEF|P_RWIN,
|
|
2085 #ifdef FEAT_SYN_HL
|
|
2086 (char_u *)VAR_WIN, PV_SPELL,
|
|
2087 #else
|
|
2088 (char_u *)NULL, PV_NONE,
|
|
2089 #endif
|
|
2090 {(char_u *)FALSE, (char_u *)0L}},
|
477
|
2091 {"spellcapcheck", "spc", P_STRING|P_ALLOCED|P_VI_DEF|P_RBUF,
|
386
|
2092 #ifdef FEAT_SYN_HL
|
|
2093 (char_u *)&p_spc, PV_SPC,
|
389
|
2094 {(char_u *)"[.?!]\\_[\\])'\" ]\\+", (char_u *)0L}
|
386
|
2095 #else
|
|
2096 (char_u *)NULL, PV_NONE,
|
|
2097 {(char_u *)0L, (char_u *)0L}
|
|
2098 #endif
|
|
2099 },
|
|
2100 {"spellfile", "spf", P_STRING|P_EXPAND|P_ALLOCED|P_VI_DEF|P_SECURE|P_COMMA,
|
314
|
2101 #ifdef FEAT_SYN_HL
|
|
2102 (char_u *)&p_spf, PV_SPF,
|
|
2103 {(char_u *)"", (char_u *)0L}
|
|
2104 #else
|
|
2105 (char_u *)NULL, PV_NONE,
|
|
2106 {(char_u *)0L, (char_u *)0L}
|
|
2107 #endif
|
|
2108 },
|
374
|
2109 {"spelllang", "spl", P_STRING|P_ALLOCED|P_VI_DEF|P_COMMA|P_RBUF|P_EXPAND,
|
221
|
2110 #ifdef FEAT_SYN_HL
|
|
2111 (char_u *)&p_spl, PV_SPL,
|
314
|
2112 {(char_u *)"en", (char_u *)0L}
|
221
|
2113 #else
|
|
2114 (char_u *)NULL, PV_NONE,
|
|
2115 {(char_u *)0L, (char_u *)0L}
|
|
2116 #endif
|
|
2117 },
|
374
|
2118 {"spellsuggest", "sps", P_STRING|P_VI_DEF|P_EXPAND|P_SECURE,
|
344
|
2119 #ifdef FEAT_SYN_HL
|
|
2120 (char_u *)&p_sps, PV_NONE,
|
|
2121 {(char_u *)"best", (char_u *)0L}
|
|
2122 #else
|
|
2123 (char_u *)NULL, PV_NONE,
|
|
2124 {(char_u *)0L, (char_u *)0L}
|
|
2125 #endif
|
|
2126 },
|
7
|
2127 {"splitbelow", "sb", P_BOOL|P_VI_DEF,
|
|
2128 #ifdef FEAT_WINDOWS
|
|
2129 (char_u *)&p_sb, PV_NONE,
|
|
2130 #else
|
|
2131 (char_u *)NULL, PV_NONE,
|
|
2132 #endif
|
|
2133 {(char_u *)FALSE, (char_u *)0L}},
|
|
2134 {"splitright", "spr", P_BOOL|P_VI_DEF,
|
|
2135 #ifdef FEAT_VERTSPLIT
|
|
2136 (char_u *)&p_spr, PV_NONE,
|
|
2137 #else
|
|
2138 (char_u *)NULL, PV_NONE,
|
|
2139 #endif
|
|
2140 {(char_u *)FALSE, (char_u *)0L}},
|
|
2141 {"startofline", "sol", P_BOOL|P_VI_DEF|P_VIM,
|
|
2142 (char_u *)&p_sol, PV_NONE,
|
|
2143 {(char_u *)TRUE, (char_u *)0L}},
|
|
2144 {"statusline" ,"stl", P_STRING|P_VI_DEF|P_ALLOCED|P_RSTAT,
|
|
2145 #ifdef FEAT_STL_OPT
|
40
|
2146 (char_u *)&p_stl, OPT_BOTH(PV_STL),
|
7
|
2147 #else
|
|
2148 (char_u *)NULL, PV_NONE,
|
|
2149 #endif
|
|
2150 {(char_u *)"", (char_u *)0L}},
|
|
2151 {"suffixes", "su", P_STRING|P_VI_DEF|P_COMMA|P_NODUP,
|
|
2152 (char_u *)&p_su, PV_NONE,
|
|
2153 {(char_u *)".bak,~,.o,.h,.info,.swp,.obj",
|
|
2154 (char_u *)0L}},
|
|
2155 {"suffixesadd", "sua", P_STRING|P_VI_DEF|P_ALLOCED|P_COMMA|P_NODUP,
|
|
2156 #if defined(FEAT_SEARCHPATH)
|
|
2157 (char_u *)&p_sua, PV_SUA,
|
|
2158 {(char_u *)"", (char_u *)0L}
|
|
2159 #else
|
|
2160 (char_u *)NULL, PV_NONE,
|
|
2161 {(char_u *)0L, (char_u *)0L}
|
|
2162 #endif
|
|
2163 },
|
|
2164 {"swapfile", "swf", P_BOOL|P_VI_DEF|P_RSTAT,
|
|
2165 (char_u *)&p_swf, PV_SWF,
|
|
2166 {(char_u *)TRUE, (char_u *)0L}},
|
|
2167 {"swapsync", "sws", P_STRING|P_VI_DEF,
|
|
2168 (char_u *)&p_sws, PV_NONE,
|
|
2169 {(char_u *)"fsync", (char_u *)0L}},
|
|
2170 {"switchbuf", "swb", P_STRING|P_VI_DEF|P_COMMA|P_NODUP,
|
|
2171 (char_u *)&p_swb, PV_NONE,
|
|
2172 {(char_u *)"", (char_u *)0L}},
|
410
|
2173 {"synmaxcol", "smc", P_NUM|P_VI_DEF|P_RBUF,
|
|
2174 #ifdef FEAT_SYN_HL
|
|
2175 (char_u *)&p_smc, PV_SMC,
|
|
2176 {(char_u *)3000L, (char_u *)0L}
|
|
2177 #else
|
|
2178 (char_u *)NULL, PV_NONE,
|
|
2179 {(char_u *)0L, (char_u *)0L}
|
|
2180 #endif
|
|
2181 },
|
36
|
2182 {"syntax", "syn", P_STRING|P_ALLOCED|P_VI_DEF|P_NOGLOB|P_NFNAME,
|
7
|
2183 #ifdef FEAT_SYN_HL
|
|
2184 (char_u *)&p_syn, PV_SYN,
|
|
2185 {(char_u *)"", (char_u *)0L}
|
|
2186 #else
|
|
2187 (char_u *)NULL, PV_NONE,
|
|
2188 {(char_u *)0L, (char_u *)0L}
|
|
2189 #endif
|
|
2190 },
|
677
|
2191 {"tabline", "tal", P_STRING|P_VI_DEF|P_RALL,
|
|
2192 #ifdef FEAT_STL_OPT
|
670
|
2193 (char_u *)&p_tal, PV_NONE,
|
|
2194 #else
|
|
2195 (char_u *)NULL, PV_NONE,
|
|
2196 #endif
|
677
|
2197 {(char_u *)"", (char_u *)0L}},
|
7
|
2198 {"tabstop", "ts", P_NUM|P_VI_DEF|P_RBUF,
|
|
2199 (char_u *)&p_ts, PV_TS,
|
|
2200 {(char_u *)8L, (char_u *)0L}},
|
|
2201 {"tagbsearch", "tbs", P_BOOL|P_VI_DEF,
|
|
2202 (char_u *)&p_tbs, PV_NONE,
|
|
2203 #ifdef VMS /* binary searching doesn't appear to work on VMS */
|
|
2204 {(char_u *)0L, (char_u *)0L}
|
|
2205 #else
|
|
2206 {(char_u *)TRUE, (char_u *)0L}
|
|
2207 #endif
|
|
2208 },
|
|
2209 {"taglength", "tl", P_NUM|P_VI_DEF,
|
|
2210 (char_u *)&p_tl, PV_NONE,
|
|
2211 {(char_u *)0L, (char_u *)0L}},
|
|
2212 {"tagrelative", "tr", P_BOOL|P_VIM,
|
|
2213 (char_u *)&p_tr, PV_NONE,
|
|
2214 {(char_u *)FALSE, (char_u *)TRUE}},
|
|
2215 {"tags", "tag", P_STRING|P_EXPAND|P_VI_DEF|P_COMMA|P_NODUP,
|
|
2216 (char_u *)&p_tags, OPT_BOTH(PV_TAGS),
|
|
2217 {
|
|
2218 #if defined(FEAT_EMACS_TAGS) && !defined(CASE_INSENSITIVE_FILENAME)
|
|
2219 (char_u *)"./tags,./TAGS,tags,TAGS",
|
|
2220 #else
|
|
2221 (char_u *)"./tags,tags",
|
|
2222 #endif
|
|
2223 (char_u *)0L}},
|
|
2224 {"tagstack", "tgst", P_BOOL|P_VI_DEF,
|
|
2225 (char_u *)&p_tgst, PV_NONE,
|
|
2226 {(char_u *)TRUE, (char_u *)0L}},
|
|
2227 {"term", NULL, P_STRING|P_EXPAND|P_NODEFAULT|P_NO_MKRC|P_VI_DEF|P_RALL,
|
|
2228 (char_u *)&T_NAME, PV_NONE,
|
|
2229 {(char_u *)"", (char_u *)0L}},
|
|
2230 {"termbidi", "tbidi", P_BOOL|P_VI_DEF,
|
|
2231 #ifdef FEAT_ARABIC
|
|
2232 (char_u *)&p_tbidi, PV_NONE,
|
|
2233 #else
|
|
2234 (char_u *)NULL, PV_NONE,
|
|
2235 #endif
|
|
2236 {(char_u *)FALSE, (char_u *)0L}},
|
|
2237 {"termencoding", "tenc", P_STRING|P_VI_DEF|P_RCLR,
|
|
2238 #ifdef FEAT_MBYTE
|
|
2239 (char_u *)&p_tenc, PV_NONE,
|
|
2240 {(char_u *)"", (char_u *)0L}
|
|
2241 #else
|
|
2242 (char_u *)NULL, PV_NONE,
|
|
2243 {(char_u *)0L, (char_u *)0L}
|
|
2244 #endif
|
|
2245 },
|
|
2246 {"terse", NULL, P_BOOL|P_VI_DEF,
|
|
2247 (char_u *)&p_terse, PV_NONE,
|
|
2248 {(char_u *)FALSE, (char_u *)0L}},
|
|
2249 {"textauto", "ta", P_BOOL|P_VIM,
|
|
2250 (char_u *)&p_ta, PV_NONE,
|
|
2251 {(char_u *)DFLT_TEXTAUTO, (char_u *)TRUE}},
|
|
2252 {"textmode", "tx", P_BOOL|P_VI_DEF|P_NO_MKRC,
|
|
2253 (char_u *)&p_tx, PV_TX,
|
|
2254 {
|
|
2255 #ifdef USE_CRNL
|
|
2256 (char_u *)TRUE,
|
|
2257 #else
|
|
2258 (char_u *)FALSE,
|
|
2259 #endif
|
|
2260 (char_u *)0L}},
|
|
2261 {"textwidth", "tw", P_NUM|P_VI_DEF|P_VIM,
|
|
2262 (char_u *)&p_tw, PV_TW,
|
|
2263 {(char_u *)0L, (char_u *)0L}},
|
|
2264 {"thesaurus", "tsr", P_STRING|P_EXPAND|P_VI_DEF|P_COMMA|P_NODUP,
|
|
2265 #ifdef FEAT_INS_EXPAND
|
|
2266 (char_u *)&p_tsr, OPT_BOTH(PV_TSR),
|
|
2267 #else
|
|
2268 (char_u *)NULL, PV_NONE,
|
|
2269 #endif
|
|
2270 {(char_u *)"", (char_u *)0L}},
|
|
2271 {"tildeop", "top", P_BOOL|P_VI_DEF|P_VIM,
|
|
2272 (char_u *)&p_to, PV_NONE,
|
|
2273 {(char_u *)FALSE, (char_u *)0L}},
|
|
2274 {"timeout", "to", P_BOOL|P_VI_DEF,
|
|
2275 (char_u *)&p_timeout, PV_NONE,
|
|
2276 {(char_u *)TRUE, (char_u *)0L}},
|
|
2277 {"timeoutlen", "tm", P_NUM|P_VI_DEF,
|
|
2278 (char_u *)&p_tm, PV_NONE,
|
|
2279 {(char_u *)1000L, (char_u *)0L}},
|
|
2280 {"title", NULL, P_BOOL|P_VI_DEF,
|
|
2281 #ifdef FEAT_TITLE
|
|
2282 (char_u *)&p_title, PV_NONE,
|
|
2283 #else
|
|
2284 (char_u *)NULL, PV_NONE,
|
|
2285 #endif
|
|
2286 {(char_u *)FALSE, (char_u *)0L}},
|
|
2287 {"titlelen", NULL, P_NUM|P_VI_DEF,
|
|
2288 #ifdef FEAT_TITLE
|
|
2289 (char_u *)&p_titlelen, PV_NONE,
|
|
2290 #else
|
|
2291 (char_u *)NULL, PV_NONE,
|
|
2292 #endif
|
|
2293 {(char_u *)85L, (char_u *)0L}},
|
667
|
2294 {"titleold", NULL, P_STRING|P_VI_DEF|P_GETTEXT|P_SECURE|P_NO_MKRC,
|
7
|
2295 #ifdef FEAT_TITLE
|
|
2296 (char_u *)&p_titleold, PV_NONE,
|
|
2297 {(char_u *)N_("Thanks for flying Vim"),
|
|
2298 (char_u *)0L}
|
|
2299 #else
|
|
2300 (char_u *)NULL, PV_NONE,
|
|
2301 {(char_u *)0L, (char_u *)0L}
|
|
2302 #endif
|
|
2303 },
|
|
2304 {"titlestring", NULL, P_STRING|P_VI_DEF,
|
|
2305 #ifdef FEAT_TITLE
|
|
2306 (char_u *)&p_titlestring, PV_NONE,
|
|
2307 #else
|
|
2308 (char_u *)NULL, PV_NONE,
|
|
2309 #endif
|
|
2310 {(char_u *)"", (char_u *)0L}},
|
|
2311 #if defined(FEAT_TOOLBAR) && !defined(FEAT_GUI_W32)
|
|
2312 {"toolbar", "tb", P_STRING|P_COMMA|P_VI_DEF|P_NODUP,
|
|
2313 (char_u *)&p_toolbar, PV_NONE,
|
|
2314 {(char_u *)"icons,tooltips", (char_u *)0L}},
|
|
2315 #endif
|
|
2316 #if defined(FEAT_TOOLBAR) && defined(FEAT_GUI_GTK) && defined(HAVE_GTK2)
|
|
2317 {"toolbariconsize", "tbis", P_STRING|P_VI_DEF,
|
|
2318 (char_u *)&p_tbis, PV_NONE,
|
|
2319 {(char_u *)"small", (char_u *)0L}},
|
|
2320 #endif
|
|
2321 {"ttimeout", NULL, P_BOOL|P_VI_DEF|P_VIM,
|
|
2322 (char_u *)&p_ttimeout, PV_NONE,
|
|
2323 {(char_u *)FALSE, (char_u *)0L}},
|
|
2324 {"ttimeoutlen", "ttm", P_NUM|P_VI_DEF,
|
|
2325 (char_u *)&p_ttm, PV_NONE,
|
|
2326 {(char_u *)-1L, (char_u *)0L}},
|
|
2327 {"ttybuiltin", "tbi", P_BOOL|P_VI_DEF,
|
|
2328 (char_u *)&p_tbi, PV_NONE,
|
|
2329 {(char_u *)TRUE, (char_u *)0L}},
|
|
2330 {"ttyfast", "tf", P_BOOL|P_NO_MKRC|P_VI_DEF,
|
|
2331 (char_u *)&p_tf, PV_NONE,
|
|
2332 {(char_u *)FALSE, (char_u *)0L}},
|
|
2333 {"ttymouse", "ttym", P_STRING|P_NODEFAULT|P_NO_MKRC|P_VI_DEF,
|
|
2334 #if defined(FEAT_MOUSE) && (defined(UNIX) || defined(VMS))
|
|
2335 (char_u *)&p_ttym, PV_NONE,
|
|
2336 #else
|
|
2337 (char_u *)NULL, PV_NONE,
|
|
2338 #endif
|
|
2339 {(char_u *)"", (char_u *)0L}},
|
|
2340 {"ttyscroll", "tsl", P_NUM|P_VI_DEF,
|
|
2341 (char_u *)&p_ttyscroll, PV_NONE,
|
|
2342 {(char_u *)999L, (char_u *)0L}},
|
|
2343 {"ttytype", "tty", P_STRING|P_EXPAND|P_NODEFAULT|P_NO_MKRC|P_VI_DEF|P_RALL,
|
|
2344 (char_u *)&T_NAME, PV_NONE,
|
|
2345 {(char_u *)"", (char_u *)0L}},
|
|
2346 {"undolevels", "ul", P_NUM|P_VI_DEF,
|
|
2347 (char_u *)&p_ul, PV_NONE,
|
|
2348 {
|
|
2349 #if defined(UNIX) || defined(WIN3264) || defined(OS2) || defined(VMS)
|
|
2350 (char_u *)1000L,
|
|
2351 #else
|
|
2352 (char_u *)100L,
|
|
2353 #endif
|
|
2354 (char_u *)0L}},
|
|
2355 {"updatecount", "uc", P_NUM|P_VI_DEF,
|
|
2356 (char_u *)&p_uc, PV_NONE,
|
|
2357 {(char_u *)200L, (char_u *)0L}},
|
|
2358 {"updatetime", "ut", P_NUM|P_VI_DEF,
|
|
2359 (char_u *)&p_ut, PV_NONE,
|
|
2360 {(char_u *)4000L, (char_u *)0L}},
|
|
2361 {"verbose", "vbs", P_NUM|P_VI_DEF,
|
|
2362 (char_u *)&p_verbose, PV_NONE,
|
|
2363 {(char_u *)0L, (char_u *)0L}},
|
294
|
2364 {"verbosefile", "vfile", P_STRING|P_EXPAND|P_VI_DEF|P_SECURE,
|
|
2365 (char_u *)&p_vfile, PV_NONE,
|
|
2366 {(char_u *)"", (char_u *)0L}},
|
7
|
2367 {"viewdir", "vdir", P_STRING|P_EXPAND|P_VI_DEF|P_SECURE,
|
|
2368 #ifdef FEAT_SESSION
|
|
2369 (char_u *)&p_vdir, PV_NONE,
|
|
2370 {(char_u *)DFLT_VDIR, (char_u *)0L}
|
|
2371 #else
|
|
2372 (char_u *)NULL, PV_NONE,
|
|
2373 {(char_u *)0L, (char_u *)0L}
|
|
2374 #endif
|
|
2375 },
|
|
2376 {"viewoptions", "vop", P_STRING|P_VI_DEF|P_COMMA|P_NODUP,
|
|
2377 #ifdef FEAT_SESSION
|
|
2378 (char_u *)&p_vop, PV_NONE,
|
|
2379 {(char_u *)"folds,options,cursor", (char_u *)0L}
|
|
2380 #else
|
|
2381 (char_u *)NULL, PV_NONE,
|
|
2382 {(char_u *)0L, (char_u *)0L}
|
|
2383 #endif
|
|
2384 },
|
|
2385 {"viminfo", "vi", P_STRING|P_COMMA|P_NODUP|P_SECURE,
|
|
2386 #ifdef FEAT_VIMINFO
|
|
2387 (char_u *)&p_viminfo, PV_NONE,
|
|
2388 #if defined(MSDOS) || defined(MSWIN) || defined(OS2)
|
|
2389 {(char_u *)"", (char_u *)"'20,<50,s10,h,rA:,rB:"}
|
|
2390 #else
|
|
2391 # ifdef AMIGA
|
|
2392 {(char_u *)"",
|
|
2393 (char_u *)"'20,<50,s10,h,rdf0:,rdf1:,rdf2:"}
|
|
2394 # else
|
|
2395 {(char_u *)"", (char_u *)"'20,<50,s10,h"}
|
|
2396 # endif
|
|
2397 #endif
|
|
2398 #else
|
|
2399 (char_u *)NULL, PV_NONE,
|
|
2400 {(char_u *)0L, (char_u *)0L}
|
|
2401 #endif
|
|
2402 },
|
|
2403 {"virtualedit", "ve", P_STRING|P_COMMA|P_NODUP|P_VI_DEF|P_VIM,
|
|
2404 #ifdef FEAT_VIRTUALEDIT
|
|
2405 (char_u *)&p_ve, PV_NONE,
|
|
2406 {(char_u *)"", (char_u *)""}
|
|
2407 #else
|
|
2408 (char_u *)NULL, PV_NONE,
|
|
2409 {(char_u *)0L, (char_u *)0L}
|
|
2410 #endif
|
|
2411 },
|
|
2412 {"visualbell", "vb", P_BOOL|P_VI_DEF,
|
|
2413 (char_u *)&p_vb, PV_NONE,
|
|
2414 {(char_u *)FALSE, (char_u *)0L}},
|
|
2415 {"w300", NULL, P_NUM|P_VI_DEF,
|
|
2416 (char_u *)NULL, PV_NONE,
|
|
2417 {(char_u *)0L, (char_u *)0L}},
|
|
2418 {"w1200", NULL, P_NUM|P_VI_DEF,
|
|
2419 (char_u *)NULL, PV_NONE,
|
|
2420 {(char_u *)0L, (char_u *)0L}},
|
|
2421 {"w9600", NULL, P_NUM|P_VI_DEF,
|
|
2422 (char_u *)NULL, PV_NONE,
|
|
2423 {(char_u *)0L, (char_u *)0L}},
|
|
2424 {"warn", NULL, P_BOOL|P_VI_DEF,
|
|
2425 (char_u *)&p_warn, PV_NONE,
|
|
2426 {(char_u *)TRUE, (char_u *)0L}},
|
|
2427 {"weirdinvert", "wiv", P_BOOL|P_VI_DEF|P_RCLR,
|
|
2428 (char_u *)&p_wiv, PV_NONE,
|
|
2429 {(char_u *)FALSE, (char_u *)0L}},
|
|
2430 {"whichwrap", "ww", P_STRING|P_VIM|P_COMMA|P_FLAGLIST,
|
|
2431 (char_u *)&p_ww, PV_NONE,
|
|
2432 {(char_u *)"", (char_u *)"b,s"}},
|
|
2433 {"wildchar", "wc", P_NUM|P_VIM,
|
|
2434 (char_u *)&p_wc, PV_NONE,
|
|
2435 {(char_u *)(long)Ctrl_E, (char_u *)(long)TAB}},
|
|
2436 {"wildcharm", "wcm", P_NUM|P_VI_DEF,
|
|
2437 (char_u *)&p_wcm, PV_NONE,
|
|
2438 {(char_u *)0L, (char_u *)0L}},
|
|
2439 {"wildignore", "wig", P_STRING|P_VI_DEF|P_COMMA|P_NODUP,
|
|
2440 #ifdef FEAT_WILDIGN
|
|
2441 (char_u *)&p_wig, PV_NONE,
|
|
2442 #else
|
|
2443 (char_u *)NULL, PV_NONE,
|
|
2444 #endif
|
|
2445 {(char_u *)"", (char_u *)0L}},
|
|
2446 {"wildmenu", "wmnu", P_BOOL|P_VI_DEF,
|
|
2447 #ifdef FEAT_WILDMENU
|
|
2448 (char_u *)&p_wmnu, PV_NONE,
|
|
2449 #else
|
|
2450 (char_u *)NULL, PV_NONE,
|
|
2451 #endif
|
|
2452 {(char_u *)FALSE, (char_u *)0L}},
|
|
2453 {"wildmode", "wim", P_STRING|P_VI_DEF|P_COMMA|P_NODUP,
|
|
2454 (char_u *)&p_wim, PV_NONE,
|
|
2455 {(char_u *)"full", (char_u *)0L}},
|
40
|
2456 {"wildoptions", "wop", P_STRING|P_VI_DEF,
|
|
2457 #ifdef FEAT_CMDL_COMPL
|
|
2458 (char_u *)&p_wop, PV_NONE,
|
|
2459 {(char_u *)"", (char_u *)0L}
|
|
2460 #else
|
|
2461 (char_u *)NULL, PV_NONE,
|
|
2462 {(char_u *)NULL, (char_u *)0L}
|
|
2463 #endif
|
|
2464 },
|
7
|
2465 {"winaltkeys", "wak", P_STRING|P_VI_DEF,
|
|
2466 #ifdef FEAT_WAK
|
|
2467 (char_u *)&p_wak, PV_NONE,
|
|
2468 {(char_u *)"menu", (char_u *)0L}
|
|
2469 #else
|
|
2470 (char_u *)NULL, PV_NONE,
|
|
2471 {(char_u *)NULL, (char_u *)0L}
|
|
2472 #endif
|
|
2473 },
|
|
2474 {"window", "wi", P_NUM|P_VI_DEF,
|
164
|
2475 (char_u *)&p_window, PV_NONE,
|
7
|
2476 {(char_u *)0L, (char_u *)0L}},
|
|
2477 {"winheight", "wh", P_NUM|P_VI_DEF,
|
|
2478 #ifdef FEAT_WINDOWS
|
|
2479 (char_u *)&p_wh, PV_NONE,
|
|
2480 #else
|
|
2481 (char_u *)NULL, PV_NONE,
|
|
2482 #endif
|
|
2483 {(char_u *)1L, (char_u *)0L}},
|
|
2484 {"winfixheight", "wfh", P_BOOL|P_VI_DEF|P_RSTAT,
|
|
2485 #if defined(FEAT_WINDOWS)
|
|
2486 (char_u *)VAR_WIN, PV_WFH,
|
|
2487 #else
|
|
2488 (char_u *)NULL, PV_NONE,
|
|
2489 #endif
|
|
2490 {(char_u *)FALSE, (char_u *)0L}},
|
|
2491 {"winminheight", "wmh", P_NUM|P_VI_DEF,
|
|
2492 #ifdef FEAT_WINDOWS
|
|
2493 (char_u *)&p_wmh, PV_NONE,
|
|
2494 #else
|
|
2495 (char_u *)NULL, PV_NONE,
|
|
2496 #endif
|
|
2497 {(char_u *)1L, (char_u *)0L}},
|
|
2498 {"winminwidth", "wmw", P_NUM|P_VI_DEF,
|
|
2499 #ifdef FEAT_VERTSPLIT
|
|
2500 (char_u *)&p_wmw, PV_NONE,
|
|
2501 #else
|
|
2502 (char_u *)NULL, PV_NONE,
|
|
2503 #endif
|
|
2504 {(char_u *)1L, (char_u *)0L}},
|
|
2505 {"winwidth", "wiw", P_NUM|P_VI_DEF,
|
|
2506 #ifdef FEAT_VERTSPLIT
|
|
2507 (char_u *)&p_wiw, PV_NONE,
|
|
2508 #else
|
|
2509 (char_u *)NULL, PV_NONE,
|
|
2510 #endif
|
|
2511 {(char_u *)20L, (char_u *)0L}},
|
|
2512 {"wrap", NULL, P_BOOL|P_VI_DEF|P_RWIN,
|
|
2513 (char_u *)VAR_WIN, PV_WRAP,
|
|
2514 {(char_u *)TRUE, (char_u *)0L}},
|
|
2515 {"wrapmargin", "wm", P_NUM|P_VI_DEF,
|
|
2516 (char_u *)&p_wm, PV_WM,
|
|
2517 {(char_u *)0L, (char_u *)0L}},
|
|
2518 {"wrapscan", "ws", P_BOOL|P_VI_DEF,
|
|
2519 (char_u *)&p_ws, PV_NONE,
|
|
2520 {(char_u *)TRUE, (char_u *)0L}},
|
|
2521 {"write", NULL, P_BOOL|P_VI_DEF,
|
|
2522 (char_u *)&p_write, PV_NONE,
|
|
2523 {(char_u *)TRUE, (char_u *)0L}},
|
|
2524 {"writeany", "wa", P_BOOL|P_VI_DEF,
|
|
2525 (char_u *)&p_wa, PV_NONE,
|
|
2526 {(char_u *)FALSE, (char_u *)0L}},
|
|
2527 {"writebackup", "wb", P_BOOL|P_VI_DEF|P_VIM,
|
|
2528 (char_u *)&p_wb, PV_NONE,
|
|
2529 {
|
|
2530 #ifdef FEAT_WRITEBACKUP
|
|
2531 (char_u *)TRUE,
|
|
2532 #else
|
|
2533 (char_u *)FALSE,
|
|
2534 #endif
|
|
2535 (char_u *)0L}},
|
|
2536 {"writedelay", "wd", P_NUM|P_VI_DEF,
|
|
2537 (char_u *)&p_wd, PV_NONE,
|
|
2538 {(char_u *)0L, (char_u *)0L}},
|
|
2539
|
|
2540 /* terminal output codes */
|
36
|
2541 #define p_term(sss, vvv) {sss, NULL, P_STRING|P_VI_DEF|P_RALL|P_SECURE, \
|
7
|
2542 (char_u *)&vvv, PV_NONE, \
|
|
2543 {(char_u *)"", (char_u *)0L}},
|
|
2544
|
|
2545 p_term("t_AB", T_CAB)
|
|
2546 p_term("t_AF", T_CAF)
|
|
2547 p_term("t_AL", T_CAL)
|
|
2548 p_term("t_al", T_AL)
|
|
2549 p_term("t_bc", T_BC)
|
|
2550 p_term("t_cd", T_CD)
|
|
2551 p_term("t_ce", T_CE)
|
|
2552 p_term("t_cl", T_CL)
|
|
2553 p_term("t_cm", T_CM)
|
|
2554 p_term("t_Co", T_CCO)
|
|
2555 p_term("t_CS", T_CCS)
|
|
2556 p_term("t_cs", T_CS)
|
|
2557 #ifdef FEAT_VERTSPLIT
|
|
2558 p_term("t_CV", T_CSV)
|
|
2559 #endif
|
|
2560 p_term("t_ut", T_UT)
|
|
2561 p_term("t_da", T_DA)
|
|
2562 p_term("t_db", T_DB)
|
|
2563 p_term("t_DL", T_CDL)
|
|
2564 p_term("t_dl", T_DL)
|
|
2565 p_term("t_fs", T_FS)
|
|
2566 p_term("t_IE", T_CIE)
|
|
2567 p_term("t_IS", T_CIS)
|
|
2568 p_term("t_ke", T_KE)
|
|
2569 p_term("t_ks", T_KS)
|
|
2570 p_term("t_le", T_LE)
|
|
2571 p_term("t_mb", T_MB)
|
|
2572 p_term("t_md", T_MD)
|
|
2573 p_term("t_me", T_ME)
|
|
2574 p_term("t_mr", T_MR)
|
|
2575 p_term("t_ms", T_MS)
|
|
2576 p_term("t_nd", T_ND)
|
|
2577 p_term("t_op", T_OP)
|
|
2578 p_term("t_RI", T_CRI)
|
|
2579 p_term("t_RV", T_CRV)
|
|
2580 p_term("t_Sb", T_CSB)
|
|
2581 p_term("t_Sf", T_CSF)
|
|
2582 p_term("t_se", T_SE)
|
|
2583 p_term("t_so", T_SO)
|
|
2584 p_term("t_sr", T_SR)
|
|
2585 p_term("t_ts", T_TS)
|
|
2586 p_term("t_te", T_TE)
|
|
2587 p_term("t_ti", T_TI)
|
|
2588 p_term("t_ue", T_UE)
|
|
2589 p_term("t_us", T_US)
|
|
2590 p_term("t_vb", T_VB)
|
|
2591 p_term("t_ve", T_VE)
|
|
2592 p_term("t_vi", T_VI)
|
|
2593 p_term("t_vs", T_VS)
|
|
2594 p_term("t_WP", T_CWP)
|
|
2595 p_term("t_WS", T_CWS)
|
36
|
2596 p_term("t_SI", T_CSI)
|
|
2597 p_term("t_EI", T_CEI)
|
7
|
2598 p_term("t_xs", T_XS)
|
|
2599 p_term("t_ZH", T_CZH)
|
|
2600 p_term("t_ZR", T_CZR)
|
|
2601
|
|
2602 /* terminal key codes are not in here */
|
|
2603
|
|
2604 {NULL, NULL, 0, NULL, PV_NONE, {NULL, NULL}} /* end marker */
|
|
2605 };
|
|
2606
|
|
2607 #define PARAM_COUNT (sizeof(options) / sizeof(struct vimoption))
|
|
2608
|
|
2609 #ifdef FEAT_MBYTE
|
|
2610 static char *(p_ambw_values[]) = {"single", "double", NULL};
|
|
2611 #endif
|
|
2612 static char *(p_bg_values[]) = {"light", "dark", NULL};
|
|
2613 static char *(p_nf_values[]) = {"octal", "hex", "alpha", NULL};
|
|
2614 static char *(p_ff_values[]) = {FF_UNIX, FF_DOS, FF_MAC, NULL};
|
40
|
2615 #ifdef FEAT_CMDL_COMPL
|
|
2616 static char *(p_wop_values[]) = {"tagfile", NULL};
|
|
2617 #endif
|
7
|
2618 #ifdef FEAT_WAK
|
|
2619 static char *(p_wak_values[]) = {"yes", "menu", "no", NULL};
|
|
2620 #endif
|
|
2621 static char *(p_mousem_values[]) = {"extend", "popup", "popup_setpos", "mac", NULL};
|
|
2622 #ifdef FEAT_VISUAL
|
|
2623 static char *(p_sel_values[]) = {"inclusive", "exclusive", "old", NULL};
|
|
2624 static char *(p_slm_values[]) = {"mouse", "key", "cmd", NULL};
|
|
2625 #endif
|
|
2626 #ifdef FEAT_VISUAL
|
|
2627 static char *(p_km_values[]) = {"startsel", "stopsel", NULL};
|
|
2628 #endif
|
|
2629 #ifdef FEAT_BROWSE
|
|
2630 static char *(p_bsdir_values[]) = {"current", "last", "buffer", NULL};
|
|
2631 #endif
|
|
2632 #ifdef FEAT_SCROLLBIND
|
|
2633 static char *(p_scbopt_values[]) = {"ver", "hor", "jump", NULL};
|
|
2634 #endif
|
|
2635 static char *(p_swb_values[]) = {"useopen", "split", NULL};
|
168
|
2636 static char *(p_debug_values[]) = {"msg", "beep", NULL};
|
7
|
2637 #ifdef FEAT_VERTSPLIT
|
|
2638 static char *(p_ead_values[]) = {"both", "ver", "hor", NULL};
|
|
2639 #endif
|
|
2640 #if defined(FEAT_QUICKFIX)
|
17
|
2641 # ifdef FEAT_AUTOCMD
|
|
2642 static char *(p_buftype_values[]) = {"nofile", "nowrite", "quickfix", "help", "acwrite", NULL};
|
|
2643 # else
|
7
|
2644 static char *(p_buftype_values[]) = {"nofile", "nowrite", "quickfix", "help", NULL};
|
17
|
2645 # endif
|
7
|
2646 static char *(p_bufhidden_values[]) = {"hide", "unload", "delete", "wipe", NULL};
|
|
2647 #endif
|
|
2648 static char *(p_bs_values[]) = {"indent", "eol", "start", NULL};
|
|
2649 #ifdef FEAT_FOLDING
|
|
2650 static char *(p_fdm_values[]) = {"manual", "expr", "marker", "indent", "syntax",
|
540
|
2651 # ifdef FEAT_DIFF
|
7
|
2652 "diff",
|
540
|
2653 # endif
|
7
|
2654 NULL};
|
|
2655 static char *(p_fcl_values[]) = {"all", NULL};
|
|
2656 #endif
|
540
|
2657 #ifdef FEAT_INS_EXPAND
|
665
|
2658 static char *(p_cot_values[]) = {"menu", "longest", NULL};
|
540
|
2659 #endif
|
7
|
2660
|
|
2661 static void set_option_default __ARGS((int, int opt_flags, int compatible));
|
|
2662 static void set_options_default __ARGS((int opt_flags));
|
671
|
2663 static char_u *term_bg_default __ARGS((void));
|
634
|
2664 static void did_set_option __ARGS((int opt_idx, int opt_flags, int new_value));
|
7
|
2665 static char_u *illegal_char __ARGS((char_u *, int));
|
|
2666 static int string_to_key __ARGS((char_u *arg));
|
|
2667 #ifdef FEAT_CMDWIN
|
|
2668 static char_u *check_cedit __ARGS((void));
|
|
2669 #endif
|
|
2670 #ifdef FEAT_TITLE
|
|
2671 static void did_set_title __ARGS((int icon));
|
|
2672 #endif
|
|
2673 static char_u *option_expand __ARGS((int opt_idx, char_u *val));
|
|
2674 static void didset_options __ARGS((void));
|
|
2675 static void check_string_option __ARGS((char_u **pp));
|
|
2676 static void set_string_option_global __ARGS((int opt_idx, char_u **varp));
|
|
2677 static void set_string_option __ARGS((int opt_idx, char_u *value, int opt_flags));
|
|
2678 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));
|
|
2679 static char_u *set_chars_option __ARGS((char_u **varp));
|
|
2680 #ifdef FEAT_CLIPBOARD
|
|
2681 static char_u *check_clipboard_option __ARGS((void));
|
|
2682 #endif
|
386
|
2683 #ifdef FEAT_SYN_HL
|
389
|
2684 static char_u *compile_cap_prog __ARGS((buf_T *buf));
|
386
|
2685 #endif
|
7
|
2686 static char_u *set_bool_option __ARGS((int opt_idx, char_u *varp, int value, int opt_flags));
|
274
|
2687 static char_u *set_num_option __ARGS((int opt_idx, char_u *varp, long value, char_u *errbuf, size_t errbuflen, int opt_flags));
|
7
|
2688 static void check_redraw __ARGS((long_u flags));
|
|
2689 static int findoption __ARGS((char_u *));
|
|
2690 static int find_key_option __ARGS((char_u *));
|
|
2691 static void showoptions __ARGS((int all, int opt_flags));
|
|
2692 static int optval_default __ARGS((struct vimoption *, char_u *varp));
|
|
2693 static void showoneopt __ARGS((struct vimoption *, int opt_flags));
|
|
2694 static int put_setstring __ARGS((FILE *fd, char *cmd, char *name, char_u **valuep, int expand));
|
|
2695 static int put_setnum __ARGS((FILE *fd, char *cmd, char *name, long *valuep));
|
|
2696 static int put_setbool __ARGS((FILE *fd, char *cmd, char *name, int value));
|
|
2697 static int istermoption __ARGS((struct vimoption *));
|
|
2698 static char_u *get_varp_scope __ARGS((struct vimoption *p, int opt_flags));
|
|
2699 static char_u *get_varp __ARGS((struct vimoption *));
|
|
2700 static void option_value2string __ARGS((struct vimoption *, int opt_flags));
|
|
2701 static int wc_use_keyname __ARGS((char_u *varp, long *wcp));
|
|
2702 #ifdef FEAT_LANGMAP
|
|
2703 static void langmap_init __ARGS((void));
|
|
2704 static void langmap_set __ARGS((void));
|
|
2705 #endif
|
|
2706 static void paste_option_changed __ARGS((void));
|
|
2707 static void compatible_set __ARGS((void));
|
|
2708 #ifdef FEAT_LINEBREAK
|
|
2709 static void fill_breakat_flags __ARGS((void));
|
|
2710 #endif
|
|
2711 static int opt_strings_flags __ARGS((char_u *val, char **values, unsigned *flagp, int list));
|
|
2712 static int check_opt_strings __ARGS((char_u *val, char **values, int));
|
|
2713 static int check_opt_wim __ARGS((void));
|
|
2714
|
|
2715 /*
|
|
2716 * Initialize the options, first part.
|
|
2717 *
|
|
2718 * Called only once from main(), just after creating the first buffer.
|
|
2719 */
|
|
2720 void
|
|
2721 set_init_1()
|
|
2722 {
|
|
2723 char_u *p;
|
|
2724 int opt_idx;
|
|
2725 long n;
|
|
2726
|
|
2727 #ifdef FEAT_LANGMAP
|
|
2728 langmap_init();
|
|
2729 #endif
|
|
2730
|
|
2731 /* Be Vi compatible by default */
|
|
2732 p_cp = TRUE;
|
|
2733
|
164
|
2734 /* Use POSIX compatibility when $VIM_POSIX is set. */
|
|
2735 if (mch_getenv((char_u *)"VIM_POSIX") != NULL)
|
168
|
2736 {
|
164
|
2737 set_string_default("cpo", (char_u *)CPO_ALL);
|
168
|
2738 set_string_default("shm", (char_u *)"A");
|
|
2739 }
|
164
|
2740
|
7
|
2741 /*
|
|
2742 * Find default value for 'shell' option.
|
161
|
2743 * Don't use it if it is empty.
|
7
|
2744 */
|
161
|
2745 if (((p = mch_getenv((char_u *)"SHELL")) != NULL && *p != NUL)
|
7
|
2746 #if defined(MSDOS) || defined(MSWIN) || defined(OS2)
|
|
2747 # ifdef __EMX__
|
161
|
2748 || ((p = mch_getenv((char_u *)"EMXSHELL")) != NULL && *p != NUL)
|
7
|
2749 # endif
|
161
|
2750 || ((p = mch_getenv((char_u *)"COMSPEC")) != NULL && *p != NUL)
|
7
|
2751 # ifdef WIN3264
|
161
|
2752 || ((p = default_shell()) != NULL && *p != NUL)
|
7
|
2753 # endif
|
|
2754 #endif
|
161
|
2755 )
|
7
|
2756 set_string_default("sh", p);
|
|
2757
|
|
2758 #ifdef FEAT_WILDIGN
|
|
2759 /*
|
|
2760 * Set the default for 'backupskip' to include environment variables for
|
|
2761 * temp files.
|
|
2762 */
|
|
2763 {
|
|
2764 # ifdef UNIX
|
|
2765 static char *(names[4]) = {"", "TMPDIR", "TEMP", "TMP"};
|
|
2766 # else
|
|
2767 static char *(names[3]) = {"TMPDIR", "TEMP", "TMP"};
|
|
2768 # endif
|
170
|
2769 int len;
|
|
2770 garray_T ga;
|
|
2771 int mustfree;
|
7
|
2772
|
|
2773 ga_init2(&ga, 1, 100);
|
|
2774 for (n = 0; n < (long)(sizeof(names) / sizeof(char *)); ++n)
|
|
2775 {
|
170
|
2776 mustfree = FALSE;
|
7
|
2777 # ifdef UNIX
|
|
2778 if (*names[n] == NUL)
|
|
2779 p = (char_u *)"/tmp";
|
|
2780 else
|
|
2781 # endif
|
170
|
2782 p = vim_getenv((char_u *)names[n], &mustfree);
|
7
|
2783 if (p != NULL && *p != NUL)
|
|
2784 {
|
|
2785 /* First time count the NUL, otherwise count the ','. */
|
|
2786 len = STRLEN(p) + 3;
|
|
2787 if (ga_grow(&ga, len) == OK)
|
|
2788 {
|
|
2789 if (ga.ga_len > 0)
|
|
2790 STRCAT(ga.ga_data, ",");
|
|
2791 STRCAT(ga.ga_data, p);
|
|
2792 add_pathsep(ga.ga_data);
|
|
2793 STRCAT(ga.ga_data, "*");
|
|
2794 ga.ga_len += len;
|
|
2795 }
|
|
2796 }
|
170
|
2797 if (mustfree)
|
|
2798 vim_free(p);
|
7
|
2799 }
|
|
2800 if (ga.ga_data != NULL)
|
|
2801 {
|
|
2802 set_string_default("bsk", ga.ga_data);
|
|
2803 vim_free(ga.ga_data);
|
|
2804 }
|
|
2805 }
|
|
2806 #endif
|
|
2807
|
|
2808 /*
|
|
2809 * 'maxmemtot' and 'maxmem' may have to be adjusted for available memory
|
|
2810 */
|
|
2811 opt_idx = findoption((char_u *)"maxmemtot");
|
|
2812 #if !defined(HAVE_AVAIL_MEM) && !defined(HAVE_TOTAL_MEM)
|
|
2813 if (options[opt_idx].def_val[VI_DEFAULT] == (char_u *)0L)
|
|
2814 #endif
|
|
2815 {
|
|
2816 #ifdef HAVE_AVAIL_MEM
|
|
2817 /* Use amount of memory available at this moment. */
|
|
2818 n = (mch_avail_mem(FALSE) >> 11);
|
|
2819 #else
|
|
2820 # ifdef HAVE_TOTAL_MEM
|
|
2821 /* Use amount of memory available to Vim. */
|
|
2822 n = (mch_total_mem(FALSE) >> 11);
|
|
2823 # else
|
|
2824 n = (0x7fffffff >> 11);
|
|
2825 # endif
|
|
2826 #endif
|
|
2827 options[opt_idx].def_val[VI_DEFAULT] = (char_u *)n;
|
|
2828 opt_idx = findoption((char_u *)"maxmem");
|
|
2829 #if !defined(HAVE_AVAIL_MEM) && !defined(HAVE_TOTAL_MEM)
|
|
2830 if ((long)options[opt_idx].def_val[VI_DEFAULT] > n
|
|
2831 || (long)options[opt_idx].def_val[VI_DEFAULT] == 0L)
|
|
2832 #endif
|
|
2833 options[opt_idx].def_val[VI_DEFAULT] = (char_u *)n;
|
|
2834 }
|
|
2835
|
|
2836 #ifdef FEAT_GUI_W32
|
|
2837 /* force 'shortname' for Win32s */
|
|
2838 if (gui_is_win32s())
|
|
2839 options[findoption((char_u *)"shortname")].def_val[VI_DEFAULT] =
|
|
2840 (char_u *)TRUE;
|
|
2841 #endif
|
|
2842
|
|
2843 #ifdef FEAT_SEARCHPATH
|
|
2844 {
|
|
2845 char_u *cdpath;
|
|
2846 char_u *buf;
|
|
2847 int i;
|
|
2848 int j;
|
170
|
2849 int mustfree = FALSE;
|
7
|
2850
|
|
2851 /* Initialize the 'cdpath' option's default value. */
|
170
|
2852 cdpath = vim_getenv((char_u *)"CDPATH", &mustfree);
|
7
|
2853 if (cdpath != NULL)
|
|
2854 {
|
|
2855 buf = alloc((unsigned)((STRLEN(cdpath) << 1) + 2));
|
|
2856 if (buf != NULL)
|
|
2857 {
|
|
2858 buf[0] = ','; /* start with ",", current dir first */
|
|
2859 j = 1;
|
|
2860 for (i = 0; cdpath[i] != NUL; ++i)
|
|
2861 {
|
|
2862 if (vim_ispathlistsep(cdpath[i]))
|
|
2863 buf[j++] = ',';
|
|
2864 else
|
|
2865 {
|
|
2866 if (cdpath[i] == ' ' || cdpath[i] == ',')
|
|
2867 buf[j++] = '\\';
|
|
2868 buf[j++] = cdpath[i];
|
|
2869 }
|
|
2870 }
|
|
2871 buf[j] = NUL;
|
|
2872 opt_idx = findoption((char_u *)"cdpath");
|
|
2873 options[opt_idx].def_val[VI_DEFAULT] = buf;
|
|
2874 options[opt_idx].flags |= P_DEF_ALLOCED;
|
|
2875 }
|
170
|
2876 if (mustfree)
|
|
2877 vim_free(cdpath);
|
7
|
2878 }
|
|
2879 }
|
|
2880 #endif
|
|
2881
|
|
2882 #if defined(FEAT_POSTSCRIPT) && (defined(MSWIN) || defined(OS2) || defined(VMS) || defined(EBCDIC) || defined(MAC) || defined(hpux))
|
|
2883 /* Set print encoding on platforms that don't default to latin1 */
|
|
2884 set_string_default("penc",
|
|
2885 # if defined(MSWIN) || defined(OS2)
|
|
2886 (char_u *)"cp1252"
|
|
2887 # else
|
|
2888 # ifdef VMS
|
|
2889 (char_u *)"dec-mcs"
|
|
2890 # else
|
|
2891 # ifdef EBCDIC
|
|
2892 (char_u *)"ebcdic-uk"
|
|
2893 # else
|
|
2894 # ifdef MAC
|
|
2895 (char_u *)"mac-roman"
|
|
2896 # else /* HPUX */
|
|
2897 (char_u *)"hp-roman8"
|
|
2898 # endif
|
|
2899 # endif
|
|
2900 # endif
|
|
2901 # endif
|
|
2902 );
|
|
2903 #endif
|
|
2904
|
|
2905 #ifdef FEAT_POSTSCRIPT
|
|
2906 /* 'printexpr' must be allocated to be able to evaluate it. */
|
|
2907 set_string_default("pexpr",
|
8
|
2908 # if defined(MSWIN) || defined(MSDOS) || defined(OS2)
|
|
2909 (char_u *)"system('copy' . ' ' . v:fname_in . (&printdevice == '' ? ' LPT1:' : (' \"' . &printdevice . '\"'))) . delete(v:fname_in)"
|
7
|
2910 # else
|
|
2911 # ifdef VMS
|
|
2912 (char_u *)"system('print/delete' . (&printdevice == '' ? '' : ' /queue=' . &printdevice) . ' ' . v:fname_in)"
|
|
2913
|
|
2914 # else
|
|
2915 (char_u *)"system('lpr' . (&printdevice == '' ? '' : ' -P' . &printdevice) . ' ' . v:fname_in) . delete(v:fname_in) + v:shell_error"
|
|
2916 # endif
|
|
2917 # endif
|
|
2918 );
|
|
2919 #endif
|
|
2920
|
|
2921 /*
|
|
2922 * Set all the options (except the terminal options) to their default
|
|
2923 * value. Also set the global value for local options.
|
|
2924 */
|
|
2925 set_options_default(0);
|
|
2926
|
|
2927 #ifdef FEAT_GUI
|
|
2928 if (found_reverse_arg)
|
|
2929 set_option_value((char_u *)"bg", 0L, (char_u *)"dark", 0);
|
|
2930 #endif
|
|
2931
|
|
2932 curbuf->b_p_initialized = TRUE;
|
|
2933 curbuf->b_p_ar = -1; /* no local 'autoread' value */
|
|
2934 check_buf_options(curbuf);
|
|
2935 check_win_options(curwin);
|
|
2936 check_options();
|
|
2937
|
|
2938 /* Must be before option_expand(), because that one needs vim_isIDc() */
|
|
2939 didset_options();
|
|
2940
|
227
|
2941 #ifdef FEAT_SYN_HL
|
|
2942 /* Use the current chartab for the generic chartab. */
|
|
2943 init_spell_chartab();
|
|
2944 #endif
|
|
2945
|
7
|
2946 #ifdef FEAT_LINEBREAK
|
|
2947 /*
|
|
2948 * initialize the table for 'breakat'.
|
|
2949 */
|
|
2950 fill_breakat_flags();
|
|
2951 #endif
|
|
2952
|
|
2953 /*
|
|
2954 * Expand environment variables and things like "~" for the defaults.
|
|
2955 * If option_expand() returns non-NULL the variable is expanded. This can
|
|
2956 * only happen for non-indirect options.
|
|
2957 * Also set the default to the expanded value, so ":set" does not list
|
|
2958 * them.
|
|
2959 * Don't set the P_ALLOCED flag, because we don't want to free the
|
|
2960 * default.
|
|
2961 */
|
|
2962 for (opt_idx = 0; !istermoption(&options[opt_idx]); opt_idx++)
|
|
2963 {
|
|
2964 if ((options[opt_idx].flags & P_GETTEXT)
|
|
2965 && options[opt_idx].var != NULL)
|
|
2966 p = (char_u *)_(*(char **)options[opt_idx].var);
|
|
2967 else
|
|
2968 p = option_expand(opt_idx, NULL);
|
|
2969 if (p != NULL && (p = vim_strsave(p)) != NULL)
|
|
2970 {
|
|
2971 *(char_u **)options[opt_idx].var = p;
|
|
2972 /* VIMEXP
|
|
2973 * Defaults for all expanded options are currently the same for Vi
|
|
2974 * and Vim. When this changes, add some code here! Also need to
|
|
2975 * split P_DEF_ALLOCED in two.
|
|
2976 */
|
|
2977 if (options[opt_idx].flags & P_DEF_ALLOCED)
|
|
2978 vim_free(options[opt_idx].def_val[VI_DEFAULT]);
|
|
2979 options[opt_idx].def_val[VI_DEFAULT] = p;
|
|
2980 options[opt_idx].flags |= P_DEF_ALLOCED;
|
|
2981 }
|
|
2982 }
|
|
2983
|
|
2984 /* Initialize the highlight_attr[] table. */
|
|
2985 highlight_changed();
|
|
2986
|
|
2987 save_file_ff(curbuf); /* Buffer is unchanged */
|
|
2988
|
|
2989 /* Parse default for 'wildmode' */
|
|
2990 check_opt_wim();
|
|
2991
|
|
2992 #if defined(FEAT_ARABIC)
|
|
2993 /* Detect use of mlterm.
|
|
2994 * Mlterm is a terminal emulator akin to xterm that has some special
|
|
2995 * abilities (bidi namely).
|
|
2996 * NOTE: mlterm's author is being asked to 'set' a variable
|
|
2997 * instead of an environment variable due to inheritance.
|
|
2998 */
|
|
2999 if (mch_getenv((char_u *)"MLTERM") != NULL)
|
|
3000 set_option_value((char_u *)"tbidi", 1L, NULL, 0);
|
|
3001 #endif
|
|
3002
|
|
3003 #if defined(FEAT_WINDOWS) || defined(FEAT_FOLDING)
|
|
3004 /* Parse default for 'fillchars'. */
|
|
3005 (void)set_chars_option(&p_fcs);
|
|
3006 #endif
|
|
3007
|
|
3008 #ifdef FEAT_CLIPBOARD
|
|
3009 /* Parse default for 'clipboard' */
|
|
3010 (void)check_clipboard_option();
|
|
3011 #endif
|
|
3012
|
|
3013 #ifdef FEAT_MBYTE
|
|
3014 # if defined(WIN3264) && defined(FEAT_GETTEXT)
|
|
3015 /*
|
|
3016 * If $LANG isn't set, try to get a good value for it. This makes the
|
|
3017 * right language be used automatically. Don't do this for English.
|
|
3018 */
|
|
3019 if (mch_getenv((char_u *)"LANG") == NULL)
|
|
3020 {
|
|
3021 char buf[20];
|
|
3022
|
|
3023 /* Could use LOCALE_SISO639LANGNAME, but it's not in Win95.
|
|
3024 * LOCALE_SABBREVLANGNAME gives us three letters, like "enu", we use
|
|
3025 * only the first two. */
|
|
3026 n = GetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_SABBREVLANGNAME,
|
|
3027 (LPTSTR)buf, 20);
|
|
3028 if (n >= 2 && STRNICMP(buf, "en", 2) != 0)
|
|
3029 {
|
|
3030 /* There are a few exceptions (probably more) */
|
|
3031 if (STRNICMP(buf, "cht", 3) == 0 || STRNICMP(buf, "zht", 3) == 0)
|
|
3032 STRCPY(buf, "zh_TW");
|
|
3033 else if (STRNICMP(buf, "chs", 3) == 0
|
|
3034 || STRNICMP(buf, "zhc", 3) == 0)
|
|
3035 STRCPY(buf, "zh_CN");
|
|
3036 else if (STRNICMP(buf, "jp", 2) == 0)
|
|
3037 STRCPY(buf, "ja");
|
|
3038 else
|
|
3039 buf[2] = NUL; /* truncate to two-letter code */
|
|
3040 vim_setenv("LANG", buf);
|
|
3041 }
|
|
3042 }
|
168
|
3043 # else
|
|
3044 # ifdef MACOS
|
|
3045 if (mch_getenv((char_u *)"LANG") == NULL)
|
|
3046 {
|
|
3047 char buf[20];
|
|
3048 if (LocaleRefGetPartString(NULL,
|
|
3049 kLocaleLanguageMask | kLocaleLanguageVariantMask |
|
|
3050 kLocaleRegionMask | kLocaleRegionVariantMask,
|
|
3051 sizeof buf, buf) == noErr && *buf)
|
|
3052 {
|
501
|
3053 vim_setenv((char_u *)"LANG", (char_u *)buf);
|
168
|
3054 # ifdef HAVE_LOCALE_H
|
|
3055 setlocale(LC_ALL, "");
|
|
3056 # endif
|
|
3057 }
|
|
3058 }
|
|
3059 # endif
|
7
|
3060 # endif
|
|
3061
|
|
3062 /* enc_locale() will try to find the encoding of the current locale. */
|
|
3063 p = enc_locale();
|
|
3064 if (p != NULL)
|
|
3065 {
|
|
3066 char_u *save_enc;
|
|
3067
|
|
3068 /* Try setting 'encoding' and check if the value is valid.
|
|
3069 * If not, go back to the default "latin1". */
|
|
3070 save_enc = p_enc;
|
|
3071 p_enc = p;
|
|
3072 if (mb_init() == NULL)
|
|
3073 {
|
|
3074 opt_idx = findoption((char_u *)"encoding");
|
|
3075 options[opt_idx].def_val[VI_DEFAULT] = p_enc;
|
|
3076 options[opt_idx].flags |= P_DEF_ALLOCED;
|
|
3077
|
24
|
3078 #if defined(MSDOS) || defined(MSWIN) || defined(OS2) || defined(MACOS) \
|
|
3079 || defined(VMS)
|
|
3080 if (STRCMP(p_enc, "latin1") == 0
|
|
3081 # ifdef FEAT_MBYTE
|
|
3082 || enc_utf8
|
|
3083 # endif
|
|
3084 )
|
|
3085 {
|
|
3086 /* Adjust the default for 'isprint' to match latin1. */
|
|
3087 set_string_option_direct((char_u *)"isp", -1,
|
|
3088 (char_u *)"@,161-255", OPT_FREE);
|
|
3089 (void)init_chartab();
|
|
3090 }
|
|
3091 #endif
|
|
3092
|
7
|
3093 # if defined(WIN3264) && !defined(FEAT_GUI)
|
|
3094 /* Win32 console: When GetACP() returns a different value from
|
|
3095 * GetConsoleCP() set 'termencoding'. */
|
|
3096 if (GetACP() != GetConsoleCP())
|
|
3097 {
|
|
3098 char buf[50];
|
|
3099
|
|
3100 sprintf(buf, "cp%ld", (long)GetConsoleCP());
|
|
3101 p_tenc = vim_strsave((char_u *)buf);
|
|
3102 if (p_tenc != NULL)
|
|
3103 {
|
|
3104 opt_idx = findoption((char_u *)"termencoding");
|
|
3105 options[opt_idx].def_val[VI_DEFAULT] = p_tenc;
|
|
3106 options[opt_idx].flags |= P_DEF_ALLOCED;
|
|
3107 convert_setup(&input_conv, p_tenc, p_enc);
|
|
3108 convert_setup(&output_conv, p_enc, p_tenc);
|
|
3109 }
|
|
3110 else
|
|
3111 p_tenc = empty_option;
|
|
3112 }
|
|
3113 # endif
|
170
|
3114 # if defined(WIN3264) && defined(FEAT_MBYTE)
|
|
3115 /* $HOME may have characters in active code page. */
|
|
3116 init_homedir();
|
|
3117 # endif
|
7
|
3118 }
|
|
3119 else
|
|
3120 {
|
|
3121 vim_free(p_enc);
|
|
3122 p_enc = save_enc;
|
|
3123 }
|
|
3124 }
|
|
3125 #endif
|
|
3126
|
|
3127 #ifdef FEAT_MULTI_LANG
|
|
3128 /* Set the default for 'helplang'. */
|
|
3129 set_helplang_default(get_mess_lang());
|
|
3130 #endif
|
|
3131 }
|
|
3132
|
|
3133 /*
|
|
3134 * Set an option to its default value.
|
|
3135 * This does not take care of side effects!
|
|
3136 */
|
|
3137 static void
|
|
3138 set_option_default(opt_idx, opt_flags, compatible)
|
|
3139 int opt_idx;
|
|
3140 int opt_flags; /* OPT_FREE, OPT_LOCAL and/or OPT_GLOBAL */
|
|
3141 int compatible; /* use Vi default value */
|
|
3142 {
|
|
3143 char_u *varp; /* pointer to variable for current option */
|
|
3144 int dvi; /* index in def_val[] */
|
|
3145 long_u flags;
|
|
3146 int both = (opt_flags & (OPT_LOCAL | OPT_GLOBAL)) == 0;
|
|
3147
|
|
3148 varp = get_varp_scope(&(options[opt_idx]), both ? OPT_LOCAL : opt_flags);
|
|
3149 flags = options[opt_idx].flags;
|
320
|
3150 if (varp != NULL) /* skip hidden option, nothing to do for it */
|
7
|
3151 {
|
|
3152 dvi = ((flags & P_VI_DEF) || compatible) ? VI_DEFAULT : VIM_DEFAULT;
|
|
3153 if (flags & P_STRING)
|
|
3154 {
|
|
3155 /* Use set_string_option_direct() for local options to handle
|
|
3156 * freeing and allocating the value. */
|
|
3157 if (options[opt_idx].indir != PV_NONE)
|
|
3158 set_string_option_direct(NULL, opt_idx,
|
|
3159 options[opt_idx].def_val[dvi], opt_flags);
|
|
3160 else
|
|
3161 {
|
|
3162 if ((opt_flags & OPT_FREE) && (flags & P_ALLOCED))
|
|
3163 free_string_option(*(char_u **)(varp));
|
|
3164 *(char_u **)varp = options[opt_idx].def_val[dvi];
|
|
3165 options[opt_idx].flags &= ~P_ALLOCED;
|
|
3166 }
|
|
3167 }
|
|
3168 else if (flags & P_NUM)
|
|
3169 {
|
|
3170 if (varp == (char_u *)PV_SCROLL)
|
|
3171 win_comp_scroll(curwin);
|
|
3172 else
|
|
3173 {
|
|
3174 *(long *)varp = (long)options[opt_idx].def_val[dvi];
|
|
3175 /* May also set global value for local option. */
|
|
3176 if (both)
|
|
3177 *(long *)get_varp_scope(&(options[opt_idx]), OPT_GLOBAL) =
|
|
3178 *(long *)varp;
|
|
3179 }
|
|
3180 }
|
|
3181 else /* P_BOOL */
|
|
3182 {
|
|
3183 /* the cast to long is required for Manx C */
|
|
3184 *(int *)varp = (int)(long)options[opt_idx].def_val[dvi];
|
|
3185 /* May also set global value for local option. */
|
|
3186 if (both)
|
|
3187 *(int *)get_varp_scope(&(options[opt_idx]), OPT_GLOBAL) =
|
|
3188 *(int *)varp;
|
|
3189 }
|
634
|
3190
|
677
|
3191 /* The default value is not insecure. But if there are local values
|
|
3192 * we can't be sure. */
|
|
3193 if (options[opt_idx].indir == PV_NONE)
|
|
3194 options[opt_idx].flags &= ~P_INSECURE;
|
7
|
3195 }
|
|
3196
|
|
3197 #ifdef FEAT_EVAL
|
|
3198 /* Remember where the option was set. */
|
|
3199 options[opt_idx].scriptID = current_SID;
|
|
3200 #endif
|
|
3201 }
|
|
3202
|
|
3203 /*
|
|
3204 * Set all options (except terminal options) to their default value.
|
|
3205 */
|
|
3206 static void
|
|
3207 set_options_default(opt_flags)
|
|
3208 int opt_flags; /* OPT_FREE, OPT_LOCAL and/or OPT_GLOBAL */
|
|
3209 {
|
|
3210 int i;
|
|
3211 #ifdef FEAT_WINDOWS
|
|
3212 win_T *wp;
|
671
|
3213 tabpage_T *tp;
|
7
|
3214 #endif
|
|
3215
|
|
3216 for (i = 0; !istermoption(&options[i]); i++)
|
|
3217 if (!(options[i].flags & P_NODEFAULT))
|
|
3218 set_option_default(i, opt_flags, p_cp);
|
|
3219
|
|
3220 #ifdef FEAT_WINDOWS
|
|
3221 /* The 'scroll' option must be computed for all windows. */
|
671
|
3222 FOR_ALL_TAB_WINDOWS(tp, wp)
|
7
|
3223 win_comp_scroll(wp);
|
|
3224 #else
|
|
3225 win_comp_scroll(curwin);
|
|
3226 #endif
|
|
3227 }
|
|
3228
|
|
3229 /*
|
|
3230 * Set the Vi-default value of a string option.
|
|
3231 * Used for 'sh', 'backupskip' and 'term'.
|
|
3232 */
|
|
3233 void
|
|
3234 set_string_default(name, val)
|
|
3235 char *name;
|
|
3236 char_u *val;
|
|
3237 {
|
|
3238 char_u *p;
|
|
3239 int opt_idx;
|
|
3240
|
|
3241 p = vim_strsave(val);
|
|
3242 if (p != NULL) /* we don't want a NULL */
|
|
3243 {
|
|
3244 opt_idx = findoption((char_u *)name);
|
|
3245 if (options[opt_idx].flags & P_DEF_ALLOCED)
|
|
3246 vim_free(options[opt_idx].def_val[VI_DEFAULT]);
|
|
3247 options[opt_idx].def_val[VI_DEFAULT] = p;
|
|
3248 options[opt_idx].flags |= P_DEF_ALLOCED;
|
|
3249 }
|
|
3250 }
|
|
3251
|
|
3252 /*
|
|
3253 * Set the Vi-default value of a number option.
|
|
3254 * Used for 'lines' and 'columns'.
|
|
3255 */
|
|
3256 void
|
|
3257 set_number_default(name, val)
|
|
3258 char *name;
|
|
3259 long val;
|
|
3260 {
|
|
3261 options[findoption((char_u *)name)].def_val[VI_DEFAULT] = (char_u *)val;
|
|
3262 }
|
|
3263
|
359
|
3264 #if defined(EXITFREE) || defined(PROTO)
|
|
3265 /*
|
|
3266 * Free all options.
|
|
3267 */
|
|
3268 void
|
|
3269 free_all_options()
|
|
3270 {
|
|
3271 int i;
|
|
3272
|
|
3273 for (i = 0; !istermoption(&options[i]); i++)
|
|
3274 {
|
|
3275 if (options[i].indir == PV_NONE)
|
|
3276 {
|
|
3277 /* global option: free value and default value. */
|
|
3278 if (options[i].flags & P_ALLOCED && options[i].var != NULL)
|
|
3279 free_string_option(*(char_u **)options[i].var);
|
|
3280 if (options[i].flags & P_DEF_ALLOCED)
|
|
3281 free_string_option(options[i].def_val[VI_DEFAULT]);
|
|
3282 }
|
|
3283 else if (options[i].var != VAR_WIN
|
|
3284 && (options[i].flags & P_STRING))
|
|
3285 /* buffer-local option: free global value */
|
|
3286 free_string_option(*(char_u **)options[i].var);
|
|
3287 }
|
|
3288 }
|
|
3289 #endif
|
|
3290
|
|
3291
|
7
|
3292 /*
|
|
3293 * Initialize the options, part two: After getting Rows and Columns and
|
|
3294 * setting 'term'.
|
|
3295 */
|
|
3296 void
|
|
3297 set_init_2()
|
|
3298 {
|
164
|
3299 int idx;
|
|
3300
|
7
|
3301 /*
|
|
3302 * 'scroll' defaults to half the window height. Note that this default is
|
|
3303 * wrong when the window height changes.
|
|
3304 */
|
164
|
3305 set_number_default("scroll", (long_u)Rows >> 1);
|
168
|
3306 idx = findoption((char_u *)"scroll");
|
|
3307 if (!(options[idx].flags & P_WAS_SET))
|
|
3308 set_option_default(idx, OPT_LOCAL, p_cp);
|
7
|
3309 comp_col();
|
|
3310
|
164
|
3311 /*
|
|
3312 * 'window' is only for backwards compatibility with Vi.
|
|
3313 * Default is Rows - 1.
|
|
3314 */
|
|
3315 idx = findoption((char_u *)"wi");
|
|
3316 if (!(options[idx].flags & P_WAS_SET))
|
|
3317 p_window = Rows - 1;
|
|
3318 set_number_default("window", Rows - 1);
|
|
3319
|
671
|
3320 /* For DOS console the default is always black. */
|
7
|
3321 #if !((defined(MSDOS) || defined(OS2) || defined(WIN3264)) && !defined(FEAT_GUI))
|
671
|
3322 /*
|
|
3323 * If 'background' wasn't set by the user, try guessing the value,
|
|
3324 * depending on the terminal name. Only need to check for terminals
|
|
3325 * with a dark background, that can handle color.
|
|
3326 */
|
|
3327 idx = findoption((char_u *)"bg");
|
|
3328 if (!(options[idx].flags & P_WAS_SET) && *term_bg_default() == 'd')
|
|
3329 {
|
|
3330 set_string_option_direct(NULL, idx, (char_u *)"dark", OPT_FREE);
|
|
3331 /* don't mark it as set, when starting the GUI it may be
|
|
3332 * changed again */
|
|
3333 options[idx].flags &= ~P_WAS_SET;
|
7
|
3334 }
|
|
3335 #endif
|
440
|
3336
|
|
3337 #ifdef CURSOR_SHAPE
|
|
3338 parse_shape_opt(SHAPE_CURSOR); /* set cursor shapes from 'guicursor' */
|
|
3339 #endif
|
|
3340 #ifdef FEAT_MOUSESHAPE
|
|
3341 parse_shape_opt(SHAPE_MOUSE); /* set mouse shapes from 'mouseshape' */
|
|
3342 #endif
|
|
3343 #ifdef FEAT_PRINTER
|
|
3344 (void)parse_printoptions(); /* parse 'printoptions' default value */
|
|
3345 #endif
|
7
|
3346 }
|
|
3347
|
|
3348 /*
|
671
|
3349 * Return "dark" or "light" depending on the kind of terminal.
|
|
3350 * This is just guessing! Recognized are:
|
|
3351 * "linux" Linux console
|
|
3352 * "screen.linux" Linux console with screen
|
|
3353 * "cygwin" Cygwin shell
|
|
3354 * "putty" Putty program
|
|
3355 * We also check the COLORFGBG environment variable, which is set by
|
|
3356 * rxvt and derivatives. This variable contains either two or three
|
|
3357 * values separated by semicolons; we want the last value in either
|
|
3358 * case. If this value is 0-6 or 8, our background is dark.
|
|
3359 */
|
|
3360 static char_u *
|
|
3361 term_bg_default()
|
|
3362 {
|
|
3363 #if defined(MSDOS) || defined(OS2) || defined(WIN3264)
|
|
3364 /* DOS console nearly always black */
|
|
3365 return (char_u *)"dark";
|
|
3366 #else
|
677
|
3367 char_u *p;
|
|
3368
|
671
|
3369 if (STRCMP(T_NAME, "linux") == 0
|
|
3370 || STRCMP(T_NAME, "screen.linux") == 0
|
|
3371 || STRCMP(T_NAME, "cygwin") == 0
|
|
3372 || STRCMP(T_NAME, "putty") == 0
|
|
3373 || ((p = mch_getenv((char_u *)"COLORFGBG")) != NULL
|
|
3374 && (p = vim_strrchr(p, ';')) != NULL
|
|
3375 && ((p[1] >= '0' && p[1] <= '6') || p[1] == '8')
|
|
3376 && p[2] == NUL))
|
|
3377 return (char_u *)"dark";
|
|
3378 return (char_u *)"light";
|
|
3379 #endif
|
|
3380 }
|
|
3381
|
|
3382 /*
|
7
|
3383 * Initialize the options, part three: After reading the .vimrc
|
|
3384 */
|
|
3385 void
|
|
3386 set_init_3()
|
|
3387 {
|
|
3388 #if defined(UNIX) || defined(OS2) || defined(WIN3264)
|
|
3389 /*
|
|
3390 * Set 'shellpipe' and 'shellredir', depending on the 'shell' option.
|
|
3391 * This is done after other initializations, where 'shell' might have been
|
|
3392 * set, but only if they have not been set before.
|
|
3393 */
|
|
3394 char_u *p;
|
|
3395 int idx_srr;
|
|
3396 int do_srr;
|
|
3397 #ifdef FEAT_QUICKFIX
|
|
3398 int idx_sp;
|
|
3399 int do_sp;
|
|
3400 #endif
|
|
3401
|
|
3402 idx_srr = findoption((char_u *)"srr");
|
|
3403 do_srr = !(options[idx_srr].flags & P_WAS_SET);
|
|
3404 #ifdef FEAT_QUICKFIX
|
|
3405 idx_sp = findoption((char_u *)"sp");
|
|
3406 do_sp = !(options[idx_sp].flags & P_WAS_SET);
|
|
3407 #endif
|
|
3408
|
|
3409 /*
|
|
3410 * Isolate the name of the shell:
|
|
3411 * - Skip beyond any path. E.g., "/usr/bin/csh -f" -> "csh -f".
|
|
3412 * - Remove any argument. E.g., "csh -f" -> "csh".
|
|
3413 */
|
|
3414 p = gettail(p_sh);
|
|
3415 p = vim_strnsave(p, (int)(skiptowhite(p) - p));
|
|
3416 if (p != NULL)
|
|
3417 {
|
|
3418 /*
|
|
3419 * Default for p_sp is "| tee", for p_srr is ">".
|
|
3420 * For known shells it is changed here to include stderr.
|
|
3421 */
|
|
3422 if ( fnamecmp(p, "csh") == 0
|
|
3423 || fnamecmp(p, "tcsh") == 0
|
|
3424 # if defined(OS2) || defined(WIN3264) /* also check with .exe extension */
|
|
3425 || fnamecmp(p, "csh.exe") == 0
|
|
3426 || fnamecmp(p, "tcsh.exe") == 0
|
|
3427 # endif
|
|
3428 )
|
|
3429 {
|
|
3430 #if defined(FEAT_QUICKFIX)
|
|
3431 if (do_sp)
|
|
3432 {
|
|
3433 # ifdef WIN3264
|
|
3434 p_sp = (char_u *)">&";
|
|
3435 # else
|
|
3436 p_sp = (char_u *)"|& tee";
|
|
3437 # endif
|
|
3438 options[idx_sp].def_val[VI_DEFAULT] = p_sp;
|
|
3439 }
|
|
3440 #endif
|
|
3441 if (do_srr)
|
|
3442 {
|
|
3443 p_srr = (char_u *)">&";
|
|
3444 options[idx_srr].def_val[VI_DEFAULT] = p_srr;
|
|
3445 }
|
|
3446 }
|
|
3447 else
|
|
3448 # ifndef OS2 /* Always use bourne shell style redirection if we reach this */
|
|
3449 if ( fnamecmp(p, "sh") == 0
|
|
3450 || fnamecmp(p, "ksh") == 0
|
|
3451 || fnamecmp(p, "zsh") == 0
|
|
3452 || fnamecmp(p, "bash") == 0
|
|
3453 # ifdef WIN3264
|
|
3454 || fnamecmp(p, "cmd") == 0
|
|
3455 || fnamecmp(p, "sh.exe") == 0
|
|
3456 || fnamecmp(p, "ksh.exe") == 0
|
|
3457 || fnamecmp(p, "zsh.exe") == 0
|
|
3458 || fnamecmp(p, "bash.exe") == 0
|
|
3459 || fnamecmp(p, "cmd.exe") == 0
|
|
3460 # endif
|
|
3461 )
|
|
3462 # endif
|
|
3463 {
|
|
3464 #if defined(FEAT_QUICKFIX)
|
|
3465 if (do_sp)
|
|
3466 {
|
|
3467 # ifdef WIN3264
|
|
3468 p_sp = (char_u *)">%s 2>&1";
|
|
3469 # else
|
|
3470 p_sp = (char_u *)"2>&1| tee";
|
|
3471 # endif
|
|
3472 options[idx_sp].def_val[VI_DEFAULT] = p_sp;
|
|
3473 }
|
|
3474 #endif
|
|
3475 if (do_srr)
|
|
3476 {
|
|
3477 p_srr = (char_u *)">%s 2>&1";
|
|
3478 options[idx_srr].def_val[VI_DEFAULT] = p_srr;
|
|
3479 }
|
|
3480 }
|
|
3481 vim_free(p);
|
|
3482 }
|
|
3483 #endif
|
|
3484
|
|
3485 #if defined(MSDOS) || defined(WIN3264) || defined(OS2)
|
|
3486 /*
|
|
3487 * Set 'shellcmdflag and 'shellquote' depending on the 'shell' option.
|
|
3488 * This is done after other initializations, where 'shell' might have been
|
|
3489 * set, but only if they have not been set before. Default for p_shcf is
|
|
3490 * "/c", for p_shq is "". For "sh" like shells it is changed here to
|
|
3491 * "-c" and "\"", but not for DJGPP, because it starts the shell without
|
|
3492 * command.com. And for Win32 we need to set p_sxq instead.
|
|
3493 */
|
10
|
3494 if (strstr((char *)gettail(p_sh), "sh") != NULL)
|
7
|
3495 {
|
|
3496 int idx3;
|
|
3497
|
|
3498 idx3 = findoption((char_u *)"shcf");
|
|
3499 if (!(options[idx3].flags & P_WAS_SET))
|
|
3500 {
|
|
3501 p_shcf = (char_u *)"-c";
|
|
3502 options[idx3].def_val[VI_DEFAULT] = p_shcf;
|
|
3503 }
|
|
3504
|
|
3505 # ifndef DJGPP
|
|
3506 # ifdef WIN3264
|
|
3507 /* Somehow Win32 requires the quotes around the redirection too */
|
|
3508 idx3 = findoption((char_u *)"sxq");
|
|
3509 if (!(options[idx3].flags & P_WAS_SET))
|
|
3510 {
|
|
3511 p_sxq = (char_u *)"\"";
|
|
3512 options[idx3].def_val[VI_DEFAULT] = p_sxq;
|
|
3513 }
|
|
3514 # else
|
|
3515 idx3 = findoption((char_u *)"shq");
|
|
3516 if (!(options[idx3].flags & P_WAS_SET))
|
|
3517 {
|
|
3518 p_shq = (char_u *)"\"";
|
|
3519 options[idx3].def_val[VI_DEFAULT] = p_shq;
|
|
3520 }
|
|
3521 # endif
|
|
3522 # endif
|
|
3523 }
|
|
3524 #endif
|
|
3525
|
|
3526 #ifdef FEAT_TITLE
|
|
3527 set_title_defaults();
|
|
3528 #endif
|
|
3529 }
|
|
3530
|
|
3531 #if defined(FEAT_MULTI_LANG) || defined(PROTO)
|
|
3532 /*
|
|
3533 * When 'helplang' is still at its default value, set it to "lang".
|
|
3534 * Only the first two characters of "lang" are used.
|
|
3535 */
|
|
3536 void
|
|
3537 set_helplang_default(lang)
|
|
3538 char_u *lang;
|
|
3539 {
|
|
3540 int idx;
|
|
3541
|
|
3542 if (lang == NULL || STRLEN(lang) < 2) /* safety check */
|
|
3543 return;
|
|
3544 idx = findoption((char_u *)"hlg");
|
|
3545 if (!(options[idx].flags & P_WAS_SET))
|
|
3546 {
|
|
3547 if (options[idx].flags & P_ALLOCED)
|
|
3548 free_string_option(p_hlg);
|
|
3549 p_hlg = vim_strsave(lang);
|
|
3550 if (p_hlg == NULL)
|
|
3551 p_hlg = empty_option;
|
|
3552 else
|
18
|
3553 {
|
|
3554 /* zh_CN becomes "cn", zh_TW becomes "tw". */
|
|
3555 if (STRNICMP(p_hlg, "zh_", 3) == 0 && STRLEN(p_hlg) >= 5)
|
|
3556 {
|
|
3557 p_hlg[0] = TOLOWER_ASC(p_hlg[3]);
|
|
3558 p_hlg[1] = TOLOWER_ASC(p_hlg[4]);
|
|
3559 }
|
7
|
3560 p_hlg[2] = NUL;
|
18
|
3561 }
|
7
|
3562 options[idx].flags |= P_ALLOCED;
|
|
3563 }
|
|
3564 }
|
|
3565 #endif
|
|
3566
|
|
3567 #ifdef FEAT_GUI
|
|
3568 static char_u *gui_bg_default __ARGS((void));
|
|
3569
|
|
3570 static char_u *
|
|
3571 gui_bg_default()
|
|
3572 {
|
|
3573 if (gui_get_lightness(gui.back_pixel) < 127)
|
|
3574 return (char_u *)"dark";
|
|
3575 return (char_u *)"light";
|
|
3576 }
|
|
3577
|
|
3578 /*
|
|
3579 * Option initializations that can only be done after opening the GUI window.
|
|
3580 */
|
|
3581 void
|
|
3582 init_gui_options()
|
|
3583 {
|
|
3584 /* Set the 'background' option according to the lightness of the
|
|
3585 * background color, unless the user has set it already. */
|
|
3586 if (!option_was_set((char_u *)"bg") && STRCMP(p_bg, gui_bg_default()) != 0)
|
|
3587 {
|
|
3588 set_option_value((char_u *)"bg", 0L, gui_bg_default(), 0);
|
|
3589 highlight_changed();
|
|
3590 }
|
|
3591 }
|
|
3592 #endif
|
|
3593
|
|
3594 #ifdef FEAT_TITLE
|
|
3595 /*
|
|
3596 * 'title' and 'icon' only default to true if they have not been set or reset
|
|
3597 * in .vimrc and we can read the old value.
|
|
3598 * When 'title' and 'icon' have been reset in .vimrc, we won't even check if
|
|
3599 * they can be reset. This reduces startup time when using X on a remote
|
|
3600 * machine.
|
|
3601 */
|
|
3602 void
|
|
3603 set_title_defaults()
|
|
3604 {
|
|
3605 int idx1;
|
|
3606 long val;
|
|
3607
|
|
3608 /*
|
|
3609 * If GUI is (going to be) used, we can always set the window title and
|
|
3610 * icon name. Saves a bit of time, because the X11 display server does
|
|
3611 * not need to be contacted.
|
|
3612 */
|
|
3613 idx1 = findoption((char_u *)"title");
|
|
3614 if (!(options[idx1].flags & P_WAS_SET))
|
|
3615 {
|
|
3616 #ifdef FEAT_GUI
|
|
3617 if (gui.starting || gui.in_use)
|
|
3618 val = TRUE;
|
|
3619 else
|
|
3620 #endif
|
|
3621 val = mch_can_restore_title();
|
|
3622 options[idx1].def_val[VI_DEFAULT] = (char_u *)val;
|
|
3623 p_title = val;
|
|
3624 }
|
|
3625 idx1 = findoption((char_u *)"icon");
|
|
3626 if (!(options[idx1].flags & P_WAS_SET))
|
|
3627 {
|
|
3628 #ifdef FEAT_GUI
|
|
3629 if (gui.starting || gui.in_use)
|
|
3630 val = TRUE;
|
|
3631 else
|
|
3632 #endif
|
|
3633 val = mch_can_restore_icon();
|
|
3634 options[idx1].def_val[VI_DEFAULT] = (char_u *)val;
|
|
3635 p_icon = val;
|
|
3636 }
|
|
3637 }
|
|
3638 #endif
|
|
3639
|
|
3640 /*
|
|
3641 * Parse 'arg' for option settings.
|
|
3642 *
|
|
3643 * 'arg' may be IObuff, but only when no errors can be present and option
|
|
3644 * does not need to be expanded with option_expand().
|
|
3645 * "opt_flags":
|
|
3646 * 0 for ":set"
|
|
3647 * OPT_GLOBAL for ":setglobal"
|
|
3648 * OPT_LOCAL for ":setlocal" and a modeline
|
|
3649 * OPT_MODELINE for a modeline
|
|
3650 *
|
|
3651 * returns FAIL if an error is detected, OK otherwise
|
|
3652 */
|
|
3653 int
|
|
3654 do_set(arg, opt_flags)
|
|
3655 char_u *arg; /* option string (may be written to!) */
|
|
3656 int opt_flags;
|
|
3657 {
|
|
3658 int opt_idx;
|
|
3659 char_u *errmsg;
|
|
3660 char_u errbuf[80];
|
|
3661 char_u *startarg;
|
|
3662 int prefix; /* 1: nothing, 0: "no", 2: "inv" in front of name */
|
|
3663 int nextchar; /* next non-white char after option name */
|
|
3664 int afterchar; /* character just after option name */
|
|
3665 int len;
|
|
3666 int i;
|
|
3667 long value;
|
|
3668 int key;
|
|
3669 long_u flags; /* flags for current option */
|
|
3670 char_u *varp = NULL; /* pointer to variable for current option */
|
|
3671 int did_show = FALSE; /* already showed one value */
|
|
3672 int adding; /* "opt+=arg" */
|
|
3673 int prepending; /* "opt^=arg" */
|
|
3674 int removing; /* "opt-=arg" */
|
|
3675 int cp_val = 0;
|
|
3676 char_u key_name[2];
|
|
3677
|
|
3678 if (*arg == NUL)
|
|
3679 {
|
|
3680 showoptions(0, opt_flags);
|
168
|
3681 did_show = TRUE;
|
|
3682 goto theend;
|
7
|
3683 }
|
|
3684
|
|
3685 while (*arg != NUL) /* loop to process all options */
|
|
3686 {
|
|
3687 errmsg = NULL;
|
|
3688 startarg = arg; /* remember for error message */
|
|
3689
|
36
|
3690 if (STRNCMP(arg, "all", 3) == 0 && !isalpha(arg[3])
|
|
3691 && !(opt_flags & OPT_MODELINE))
|
7
|
3692 {
|
|
3693 /*
|
|
3694 * ":set all" show all options.
|
|
3695 * ":set all&" set all options to their default value.
|
|
3696 */
|
|
3697 arg += 3;
|
|
3698 if (*arg == '&')
|
|
3699 {
|
|
3700 ++arg;
|
|
3701 /* Only for :set command set global value of local options. */
|
|
3702 set_options_default(OPT_FREE | opt_flags);
|
|
3703 }
|
|
3704 else
|
168
|
3705 {
|
7
|
3706 showoptions(1, opt_flags);
|
168
|
3707 did_show = TRUE;
|
|
3708 }
|
7
|
3709 }
|
36
|
3710 else if (STRNCMP(arg, "termcap", 7) == 0 && !(opt_flags & OPT_MODELINE))
|
7
|
3711 {
|
|
3712 showoptions(2, opt_flags);
|
|
3713 show_termcodes();
|
168
|
3714 did_show = TRUE;
|
7
|
3715 arg += 7;
|
|
3716 }
|
|
3717 else
|
|
3718 {
|
|
3719 prefix = 1;
|
|
3720 if (STRNCMP(arg, "no", 2) == 0)
|
|
3721 {
|
|
3722 prefix = 0;
|
|
3723 arg += 2;
|
|
3724 }
|
|
3725 else if (STRNCMP(arg, "inv", 3) == 0)
|
|
3726 {
|
|
3727 prefix = 2;
|
|
3728 arg += 3;
|
|
3729 }
|
|
3730
|
|
3731 /* find end of name */
|
|
3732 key = 0;
|
|
3733 if (*arg == '<')
|
|
3734 {
|
|
3735 nextchar = 0;
|
|
3736 opt_idx = -1;
|
|
3737 /* look out for <t_>;> */
|
|
3738 if (arg[1] == 't' && arg[2] == '_' && arg[3] && arg[4])
|
|
3739 len = 5;
|
|
3740 else
|
|
3741 {
|
|
3742 len = 1;
|
|
3743 while (arg[len] != NUL && arg[len] != '>')
|
|
3744 ++len;
|
|
3745 }
|
|
3746 if (arg[len] != '>')
|
|
3747 {
|
|
3748 errmsg = e_invarg;
|
|
3749 goto skip;
|
|
3750 }
|
|
3751 arg[len] = NUL; /* put NUL after name */
|
|
3752 if (arg[1] == 't' && arg[2] == '_') /* could be term code */
|
|
3753 opt_idx = findoption(arg + 1);
|
|
3754 arg[len++] = '>'; /* restore '>' */
|
|
3755 if (opt_idx == -1)
|
|
3756 key = find_key_option(arg + 1);
|
|
3757 }
|
|
3758 else
|
|
3759 {
|
|
3760 len = 0;
|
|
3761 /*
|
|
3762 * The two characters after "t_" may not be alphanumeric.
|
|
3763 */
|
|
3764 if (arg[0] == 't' && arg[1] == '_' && arg[2] && arg[3])
|
|
3765 len = 4;
|
|
3766 else
|
|
3767 while (ASCII_ISALNUM(arg[len]) || arg[len] == '_')
|
|
3768 ++len;
|
|
3769 nextchar = arg[len];
|
|
3770 arg[len] = NUL; /* put NUL after name */
|
|
3771 opt_idx = findoption(arg);
|
|
3772 arg[len] = nextchar; /* restore nextchar */
|
|
3773 if (opt_idx == -1)
|
|
3774 key = find_key_option(arg);
|
|
3775 }
|
|
3776
|
|
3777 /* remember character after option name */
|
|
3778 afterchar = arg[len];
|
|
3779
|
|
3780 /* skip white space, allow ":set ai ?" */
|
|
3781 while (vim_iswhite(arg[len]))
|
|
3782 ++len;
|
|
3783
|
|
3784 adding = FALSE;
|
|
3785 prepending = FALSE;
|
|
3786 removing = FALSE;
|
|
3787 if (arg[len] != NUL && arg[len + 1] == '=')
|
|
3788 {
|
|
3789 if (arg[len] == '+')
|
|
3790 {
|
|
3791 adding = TRUE; /* "+=" */
|
|
3792 ++len;
|
|
3793 }
|
|
3794 else if (arg[len] == '^')
|
|
3795 {
|
|
3796 prepending = TRUE; /* "^=" */
|
|
3797 ++len;
|
|
3798 }
|
|
3799 else if (arg[len] == '-')
|
|
3800 {
|
|
3801 removing = TRUE; /* "-=" */
|
|
3802 ++len;
|
|
3803 }
|
|
3804 }
|
|
3805 nextchar = arg[len];
|
|
3806
|
|
3807 if (opt_idx == -1 && key == 0) /* found a mismatch: skip */
|
|
3808 {
|
|
3809 errmsg = (char_u *)N_("E518: Unknown option");
|
|
3810 goto skip;
|
|
3811 }
|
|
3812
|
|
3813 if (opt_idx >= 0)
|
|
3814 {
|
|
3815 if (options[opt_idx].var == NULL) /* hidden option: skip */
|
|
3816 {
|
|
3817 /* Only give an error message when requesting the value of
|
|
3818 * a hidden option, ignore setting it. */
|
|
3819 if (vim_strchr((char_u *)"=:!&<", nextchar) == NULL
|
|
3820 && (!(options[opt_idx].flags & P_BOOL)
|
|
3821 || nextchar == '?'))
|
|
3822 errmsg = (char_u *)N_("E519: Option not supported");
|
|
3823 goto skip;
|
|
3824 }
|
|
3825
|
|
3826 flags = options[opt_idx].flags;
|
|
3827 varp = get_varp_scope(&(options[opt_idx]), opt_flags);
|
|
3828 }
|
|
3829 else
|
|
3830 {
|
|
3831 flags = P_STRING;
|
|
3832 if (key < 0)
|
|
3833 {
|
|
3834 key_name[0] = KEY2TERMCAP0(key);
|
|
3835 key_name[1] = KEY2TERMCAP1(key);
|
|
3836 }
|
|
3837 else
|
|
3838 {
|
|
3839 key_name[0] = KS_KEY;
|
|
3840 key_name[1] = (key & 0xff);
|
|
3841 }
|
|
3842 }
|
|
3843
|
634
|
3844 /* Skip all options that are not window-local (used when showing
|
|
3845 * an already loaded buffer in a window). */
|
|
3846 if ((opt_flags & OPT_WINONLY)
|
|
3847 && (opt_idx < 0 || options[opt_idx].var != VAR_WIN))
|
|
3848 goto skip;
|
|
3849
|
7
|
3850 /* Disallow changing some options from modelines */
|
|
3851 if ((opt_flags & OPT_MODELINE) && (flags & P_SECURE))
|
|
3852 {
|
|
3853 errmsg = (char_u *)_("E520: Not allowed in a modeline");
|
|
3854 goto skip;
|
|
3855 }
|
|
3856
|
|
3857 #ifdef HAVE_SANDBOX
|
|
3858 /* Disallow changing some options in the sandbox */
|
634
|
3859 if (sandbox != 0 && (flags & P_SECURE))
|
7
|
3860 {
|
|
3861 errmsg = (char_u *)_(e_sandbox);
|
|
3862 goto skip;
|
|
3863 }
|
|
3864 #endif
|
|
3865
|
|
3866 if (vim_strchr((char_u *)"?=:!&<", nextchar) != NULL)
|
|
3867 {
|
|
3868 arg += len;
|
|
3869 cp_val = p_cp;
|
|
3870 if (nextchar == '&' && arg[1] == 'v' && arg[2] == 'i')
|
|
3871 {
|
|
3872 if (arg[3] == 'm') /* "opt&vim": set to Vim default */
|
|
3873 {
|
|
3874 cp_val = FALSE;
|
|
3875 arg += 3;
|
|
3876 }
|
|
3877 else /* "opt&vi": set to Vi default */
|
|
3878 {
|
|
3879 cp_val = TRUE;
|
|
3880 arg += 2;
|
|
3881 }
|
|
3882 }
|
|
3883 if (vim_strchr((char_u *)"?!&<", nextchar) != NULL
|
|
3884 && arg[1] != NUL && !vim_iswhite(arg[1]))
|
|
3885 {
|
|
3886 errmsg = e_trailing;
|
|
3887 goto skip;
|
|
3888 }
|
|
3889 }
|
|
3890
|
|
3891 /*
|
|
3892 * allow '=' and ':' as MSDOS command.com allows only one
|
|
3893 * '=' character per "set" command line. grrr. (jw)
|
|
3894 */
|
|
3895 if (nextchar == '?'
|
|
3896 || (prefix == 1
|
|
3897 && vim_strchr((char_u *)"=:&<", nextchar) == NULL
|
|
3898 && !(flags & P_BOOL)))
|
|
3899 {
|
|
3900 /*
|
|
3901 * print value
|
|
3902 */
|
|
3903 if (did_show)
|
|
3904 msg_putchar('\n'); /* cursor below last one */
|
|
3905 else
|
|
3906 {
|
|
3907 gotocmdline(TRUE); /* cursor at status line */
|
|
3908 did_show = TRUE; /* remember that we did a line */
|
|
3909 }
|
|
3910 if (opt_idx >= 0)
|
|
3911 {
|
|
3912 showoneopt(&options[opt_idx], opt_flags);
|
|
3913 #ifdef FEAT_EVAL
|
|
3914 if (p_verbose > 0)
|
448
|
3915 last_set_msg(options[opt_idx].scriptID);
|
7
|
3916 #endif
|
|
3917 }
|
|
3918 else
|
|
3919 {
|
|
3920 char_u *p;
|
|
3921
|
|
3922 p = find_termcode(key_name);
|
|
3923 if (p == NULL)
|
|
3924 {
|
|
3925 errmsg = (char_u *)N_("E518: Unknown option");
|
|
3926 goto skip;
|
|
3927 }
|
|
3928 else
|
|
3929 (void)show_one_termcode(key_name, p, TRUE);
|
|
3930 }
|
|
3931 if (nextchar != '?'
|
|
3932 && nextchar != NUL && !vim_iswhite(afterchar))
|
|
3933 errmsg = e_trailing;
|
|
3934 }
|
|
3935 else
|
|
3936 {
|
|
3937 if (flags & P_BOOL) /* boolean */
|
|
3938 {
|
|
3939 if (nextchar == '=' || nextchar == ':')
|
|
3940 {
|
|
3941 errmsg = e_invarg;
|
|
3942 goto skip;
|
|
3943 }
|
|
3944
|
|
3945 /*
|
|
3946 * ":set opt!": invert
|
|
3947 * ":set opt&": reset to default value
|
|
3948 * ":set opt<": reset to global value
|
|
3949 */
|
|
3950 if (nextchar == '!')
|
|
3951 value = *(int *)(varp) ^ 1;
|
|
3952 else if (nextchar == '&')
|
|
3953 value = (int)(long)options[opt_idx].def_val[
|
|
3954 ((flags & P_VI_DEF) || cp_val)
|
|
3955 ? VI_DEFAULT : VIM_DEFAULT];
|
|
3956 else if (nextchar == '<')
|
|
3957 {
|
|
3958 /* For 'autoread' -1 means to use global value. */
|
|
3959 if ((int *)varp == &curbuf->b_p_ar
|
|
3960 && opt_flags == OPT_LOCAL)
|
|
3961 value = -1;
|
|
3962 else
|
|
3963 value = *(int *)get_varp_scope(&(options[opt_idx]),
|
|
3964 OPT_GLOBAL);
|
|
3965 }
|
|
3966 else
|
|
3967 {
|
|
3968 /*
|
|
3969 * ":set invopt": invert
|
|
3970 * ":set opt" or ":set noopt": set or reset
|
|
3971 */
|
|
3972 if (nextchar != NUL && !vim_iswhite(afterchar))
|
|
3973 {
|
|
3974 errmsg = e_trailing;
|
|
3975 goto skip;
|
|
3976 }
|
|
3977 if (prefix == 2) /* inv */
|
|
3978 value = *(int *)(varp) ^ 1;
|
|
3979 else
|
|
3980 value = prefix;
|
|
3981 }
|
|
3982
|
|
3983 errmsg = set_bool_option(opt_idx, varp, (int)value,
|
|
3984 opt_flags);
|
|
3985 }
|
|
3986 else /* numeric or string */
|
|
3987 {
|
|
3988 if (vim_strchr((char_u *)"=:&<", nextchar) == NULL
|
|
3989 || prefix != 1)
|
|
3990 {
|
|
3991 errmsg = e_invarg;
|
|
3992 goto skip;
|
|
3993 }
|
|
3994
|
|
3995 if (flags & P_NUM) /* numeric */
|
|
3996 {
|
|
3997 /*
|
|
3998 * Different ways to set a number option:
|
|
3999 * & set to default value
|
|
4000 * < set to global value
|
|
4001 * <xx> accept special key codes for 'wildchar'
|
|
4002 * c accept any non-digit for 'wildchar'
|
|
4003 * [-]0-9 set number
|
|
4004 * other error
|
|
4005 */
|
|
4006 ++arg;
|
|
4007 if (nextchar == '&')
|
|
4008 value = (long)options[opt_idx].def_val[
|
|
4009 ((flags & P_VI_DEF) || cp_val)
|
|
4010 ? VI_DEFAULT : VIM_DEFAULT];
|
|
4011 else if (nextchar == '<')
|
|
4012 value = *(long *)get_varp_scope(&(options[opt_idx]),
|
|
4013 OPT_GLOBAL);
|
|
4014 else if (((long *)varp == &p_wc
|
|
4015 || (long *)varp == &p_wcm)
|
|
4016 && (*arg == '<'
|
|
4017 || *arg == '^'
|
|
4018 || ((!arg[1] || vim_iswhite(arg[1]))
|
|
4019 && !VIM_ISDIGIT(*arg))))
|
|
4020 {
|
|
4021 value = string_to_key(arg);
|
|
4022 if (value == 0 && (long *)varp != &p_wcm)
|
|
4023 {
|
|
4024 errmsg = e_invarg;
|
|
4025 goto skip;
|
|
4026 }
|
|
4027 }
|
|
4028 /* allow negative numbers (for 'undolevels') */
|
|
4029 else if (*arg == '-' || VIM_ISDIGIT(*arg))
|
|
4030 {
|
|
4031 i = 0;
|
|
4032 if (*arg == '-')
|
|
4033 i = 1;
|
|
4034 #ifdef HAVE_STRTOL
|
|
4035 value = strtol((char *)arg, NULL, 0);
|
|
4036 if (arg[i] == '0' && TOLOWER_ASC(arg[i + 1]) == 'x')
|
|
4037 i += 2;
|
|
4038 #else
|
|
4039 value = atol((char *)arg);
|
|
4040 #endif
|
|
4041 while (VIM_ISDIGIT(arg[i]))
|
|
4042 ++i;
|
|
4043 if (arg[i] != NUL && !vim_iswhite(arg[i]))
|
|
4044 {
|
|
4045 errmsg = e_invarg;
|
|
4046 goto skip;
|
|
4047 }
|
|
4048 }
|
|
4049 else
|
|
4050 {
|
|
4051 errmsg = (char_u *)N_("E521: Number required after =");
|
|
4052 goto skip;
|
|
4053 }
|
|
4054
|
|
4055 if (adding)
|
|
4056 value = *(long *)varp + value;
|
|
4057 if (prepending)
|
|
4058 value = *(long *)varp * value;
|
|
4059 if (removing)
|
|
4060 value = *(long *)varp - value;
|
|
4061 errmsg = set_num_option(opt_idx, varp, value,
|
274
|
4062 errbuf, sizeof(errbuf), opt_flags);
|
7
|
4063 }
|
|
4064 else if (opt_idx >= 0) /* string */
|
|
4065 {
|
|
4066 char_u *save_arg = NULL;
|
|
4067 char_u *s = NULL;
|
|
4068 char_u *oldval; /* previous value if *varp */
|
|
4069 char_u *newval;
|
|
4070 char_u *origval;
|
|
4071 unsigned newlen;
|
|
4072 int comma;
|
|
4073 int bs;
|
|
4074 int new_value_alloced; /* new string option
|
|
4075 was allocated */
|
|
4076
|
|
4077 /* When using ":set opt=val" for a global option
|
|
4078 * with a local value the local value will be
|
|
4079 * reset, use the global value here. */
|
|
4080 if ((opt_flags & (OPT_LOCAL | OPT_GLOBAL)) == 0
|
|
4081 && (int)options[opt_idx].indir >= PV_BOTH)
|
|
4082 varp = options[opt_idx].var;
|
|
4083
|
|
4084 /* The old value is kept until we are sure that the
|
|
4085 * new value is valid. */
|
|
4086 oldval = *(char_u **)varp;
|
|
4087 if (nextchar == '&') /* set to default val */
|
|
4088 {
|
|
4089 newval = options[opt_idx].def_val[
|
|
4090 ((flags & P_VI_DEF) || cp_val)
|
|
4091 ? VI_DEFAULT : VIM_DEFAULT];
|
|
4092 if ((char_u **)varp == &p_bg)
|
|
4093 {
|
|
4094 /* guess the value of 'background' */
|
|
4095 #ifdef FEAT_GUI
|
|
4096 if (gui.in_use)
|
|
4097 newval = gui_bg_default();
|
|
4098 else
|
|
4099 #endif
|
671
|
4100 newval = term_bg_default();
|
7
|
4101 }
|
|
4102
|
|
4103 /* expand environment variables and ~ (since the
|
|
4104 * default value was already expanded, only
|
|
4105 * required when an environment variable was set
|
|
4106 * later */
|
|
4107 if (newval == NULL)
|
|
4108 newval = empty_option;
|
|
4109 else
|
|
4110 {
|
|
4111 s = option_expand(opt_idx, newval);
|
|
4112 if (s == NULL)
|
|
4113 s = newval;
|
|
4114 newval = vim_strsave(s);
|
|
4115 }
|
|
4116 new_value_alloced = TRUE;
|
|
4117 }
|
|
4118 else if (nextchar == '<') /* set to global val */
|
|
4119 {
|
|
4120 newval = vim_strsave(*(char_u **)get_varp_scope(
|
|
4121 &(options[opt_idx]), OPT_GLOBAL));
|
|
4122 new_value_alloced = TRUE;
|
|
4123 }
|
|
4124 else
|
|
4125 {
|
|
4126 ++arg; /* jump to after the '=' or ':' */
|
|
4127
|
|
4128 /*
|
|
4129 * Set 'keywordprg' to ":help" if an empty
|
|
4130 * value was passed to :set by the user.
|
|
4131 * Misuse errbuf[] for the resulting string.
|
|
4132 */
|
|
4133 if (varp == (char_u *)&p_kp
|
|
4134 && (*arg == NUL || *arg == ' '))
|
|
4135 {
|
|
4136 STRCPY(errbuf, ":help");
|
|
4137 save_arg = arg;
|
|
4138 arg = errbuf;
|
|
4139 }
|
|
4140 /*
|
|
4141 * Convert 'whichwrap' number to string, for
|
|
4142 * backwards compatibility with Vim 3.0.
|
|
4143 * Misuse errbuf[] for the resulting string.
|
|
4144 */
|
|
4145 else if (varp == (char_u *)&p_ww
|
|
4146 && VIM_ISDIGIT(*arg))
|
|
4147 {
|
|
4148 *errbuf = NUL;
|
|
4149 i = getdigits(&arg);
|
|
4150 if (i & 1)
|
|
4151 STRCAT(errbuf, "b,");
|
|
4152 if (i & 2)
|
|
4153 STRCAT(errbuf, "s,");
|
|
4154 if (i & 4)
|
|
4155 STRCAT(errbuf, "h,l,");
|
|
4156 if (i & 8)
|
|
4157 STRCAT(errbuf, "<,>,");
|
|
4158 if (i & 16)
|
|
4159 STRCAT(errbuf, "[,],");
|
|
4160 if (*errbuf != NUL) /* remove trailing , */
|
|
4161 errbuf[STRLEN(errbuf) - 1] = NUL;
|
|
4162 save_arg = arg;
|
|
4163 arg = errbuf;
|
|
4164 }
|
|
4165 /*
|
|
4166 * Remove '>' before 'dir' and 'bdir', for
|
|
4167 * backwards compatibility with version 3.0
|
|
4168 */
|
|
4169 else if ( *arg == '>'
|
|
4170 && (varp == (char_u *)&p_dir
|
|
4171 || varp == (char_u *)&p_bdir))
|
|
4172 {
|
|
4173 ++arg;
|
|
4174 }
|
|
4175
|
|
4176 /* When setting the local value of a global
|
|
4177 * option, the old value may be the global value. */
|
|
4178 if ((int)options[opt_idx].indir >= PV_BOTH
|
|
4179 && (opt_flags & OPT_LOCAL))
|
|
4180 origval = *(char_u **)get_varp(
|
|
4181 &options[opt_idx]);
|
|
4182 else
|
|
4183 origval = oldval;
|
|
4184
|
|
4185 /*
|
|
4186 * Copy the new string into allocated memory.
|
|
4187 * Can't use set_string_option_direct(), because
|
|
4188 * we need to remove the backslashes.
|
|
4189 */
|
|
4190 /* get a bit too much */
|
|
4191 newlen = (unsigned)STRLEN(arg) + 1;
|
|
4192 if (adding || prepending || removing)
|
|
4193 newlen += (unsigned)STRLEN(origval) + 1;
|
|
4194 newval = alloc(newlen);
|
|
4195 if (newval == NULL) /* out of mem, don't change */
|
|
4196 break;
|
|
4197 s = newval;
|
|
4198
|
|
4199 /*
|
|
4200 * Copy the string, skip over escaped chars.
|
|
4201 * For MS-DOS and WIN32 backslashes before normal
|
|
4202 * file name characters are not removed, and keep
|
|
4203 * backslash at start, for "\\machine\path", but
|
|
4204 * do remove it for "\\\\machine\\path".
|
|
4205 * The reverse is found in ExpandOldSetting().
|
|
4206 */
|
|
4207 while (*arg && !vim_iswhite(*arg))
|
|
4208 {
|
|
4209 if (*arg == '\\' && arg[1] != NUL
|
|
4210 #ifdef BACKSLASH_IN_FILENAME
|
|
4211 && !((flags & P_EXPAND)
|
|
4212 && vim_isfilec(arg[1])
|
|
4213 && (arg[1] != '\\'
|
|
4214 || (s == newval
|
|
4215 && arg[2] != '\\')))
|
|
4216 #endif
|
|
4217 )
|
|
4218 ++arg; /* remove backslash */
|
|
4219 #ifdef FEAT_MBYTE
|
|
4220 if (has_mbyte
|
474
|
4221 && (i = (*mb_ptr2len)(arg)) > 1)
|
7
|
4222 {
|
|
4223 /* copy multibyte char */
|
|
4224 mch_memmove(s, arg, (size_t)i);
|
|
4225 arg += i;
|
|
4226 s += i;
|
|
4227 }
|
|
4228 else
|
|
4229 #endif
|
|
4230 *s++ = *arg++;
|
|
4231 }
|
|
4232 *s = NUL;
|
|
4233
|
|
4234 /*
|
|
4235 * Expand environment variables and ~.
|
|
4236 * Don't do it when adding without inserting a
|
|
4237 * comma.
|
|
4238 */
|
|
4239 if (!(adding || prepending || removing)
|
|
4240 || (flags & P_COMMA))
|
|
4241 {
|
|
4242 s = option_expand(opt_idx, newval);
|
|
4243 if (s != NULL)
|
|
4244 {
|
|
4245 vim_free(newval);
|
|
4246 newlen = (unsigned)STRLEN(s) + 1;
|
|
4247 if (adding || prepending || removing)
|
|
4248 newlen += (unsigned)STRLEN(origval) + 1;
|
|
4249 newval = alloc(newlen);
|
|
4250 if (newval == NULL)
|
|
4251 break;
|
|
4252 STRCPY(newval, s);
|
|
4253 }
|
|
4254 }
|
|
4255
|
|
4256 /* locate newval[] in origval[] when removing it
|
|
4257 * and when adding to avoid duplicates */
|
|
4258 i = 0; /* init for GCC */
|
|
4259 if (removing || (flags & P_NODUP))
|
|
4260 {
|
|
4261 i = (int)STRLEN(newval);
|
|
4262 bs = 0;
|
|
4263 for (s = origval; *s; ++s)
|
|
4264 {
|
|
4265 if ((!(flags & P_COMMA)
|
|
4266 || s == origval
|
|
4267 || (s[-1] == ',' && !(bs & 1)))
|
|
4268 && STRNCMP(s, newval, i) == 0
|
|
4269 && (!(flags & P_COMMA)
|
|
4270 || s[i] == ','
|
|
4271 || s[i] == NUL))
|
|
4272 break;
|
|
4273 /* Count backspaces. Only a comma with an
|
|
4274 * even number of backspaces before it is
|
|
4275 * recognized as a separator */
|
|
4276 if (s > origval && s[-1] == '\\')
|
|
4277 ++bs;
|
|
4278 else
|
|
4279 bs = 0;
|
|
4280 }
|
|
4281
|
|
4282 /* do not add if already there */
|
|
4283 if ((adding || prepending) && *s)
|
|
4284 {
|
|
4285 prepending = FALSE;
|
|
4286 adding = FALSE;
|
|
4287 STRCPY(newval, origval);
|
|
4288 }
|
|
4289 }
|
|
4290
|
|
4291 /* concatenate the two strings; add a ',' if
|
|
4292 * needed */
|
|
4293 if (adding || prepending)
|
|
4294 {
|
|
4295 comma = ((flags & P_COMMA) && *origval != NUL
|
|
4296 && *newval != NUL);
|
|
4297 if (adding)
|
|
4298 {
|
|
4299 i = (int)STRLEN(origval);
|
|
4300 mch_memmove(newval + i + comma, newval,
|
|
4301 STRLEN(newval) + 1);
|
|
4302 mch_memmove(newval, origval, (size_t)i);
|
|
4303 }
|
|
4304 else
|
|
4305 {
|
|
4306 i = (int)STRLEN(newval);
|
|
4307 mch_memmove(newval + i + comma, origval,
|
|
4308 STRLEN(origval) + 1);
|
|
4309 }
|
|
4310 if (comma)
|
|
4311 newval[i] = ',';
|
|
4312 }
|
|
4313
|
|
4314 /* Remove newval[] from origval[]. (Note: "i" has
|
|
4315 * been set above and is used here). */
|
|
4316 if (removing)
|
|
4317 {
|
|
4318 STRCPY(newval, origval);
|
|
4319 if (*s)
|
|
4320 {
|
|
4321 /* may need to remove a comma */
|
|
4322 if (flags & P_COMMA)
|
|
4323 {
|
|
4324 if (s == origval)
|
|
4325 {
|
|
4326 /* include comma after string */
|
|
4327 if (s[i] == ',')
|
|
4328 ++i;
|
|
4329 }
|
|
4330 else
|
|
4331 {
|
|
4332 /* include comma before string */
|
|
4333 --s;
|
|
4334 ++i;
|
|
4335 }
|
|
4336 }
|
|
4337 mch_memmove(newval + (s - origval), s + i,
|
|
4338 STRLEN(s + i) + 1);
|
|
4339 }
|
|
4340 }
|
|
4341
|
|
4342 if (flags & P_FLAGLIST)
|
|
4343 {
|
|
4344 /* Remove flags that appear twice. */
|
|
4345 for (s = newval; *s; ++s)
|
|
4346 if ((!(flags & P_COMMA) || *s != ',')
|
|
4347 && vim_strchr(s + 1, *s) != NULL)
|
|
4348 {
|
|
4349 STRCPY(s, s + 1);
|
|
4350 --s;
|
|
4351 }
|
|
4352 }
|
|
4353
|
|
4354 if (save_arg != NULL) /* number for 'whichwrap' */
|
|
4355 arg = save_arg;
|
|
4356 new_value_alloced = TRUE;
|
|
4357 }
|
|
4358
|
|
4359 /* Set the new value. */
|
|
4360 *(char_u **)(varp) = newval;
|
|
4361
|
|
4362 /* Handle side effects, and set the global value for
|
|
4363 * ":set" on local options. */
|
|
4364 errmsg = did_set_string_option(opt_idx, (char_u **)varp,
|
|
4365 new_value_alloced, oldval, errbuf, opt_flags);
|
|
4366
|
|
4367 /* If error detected, print the error message. */
|
|
4368 if (errmsg != NULL)
|
|
4369 goto skip;
|
|
4370 }
|
|
4371 else /* key code option */
|
|
4372 {
|
|
4373 char_u *p;
|
|
4374
|
|
4375 if (nextchar == '&')
|
|
4376 {
|
|
4377 if (add_termcap_entry(key_name, TRUE) == FAIL)
|
|
4378 errmsg = (char_u *)N_("E522: Not found in termcap");
|
|
4379 }
|
|
4380 else
|
|
4381 {
|
|
4382 ++arg; /* jump to after the '=' or ':' */
|
|
4383 for (p = arg; *p && !vim_iswhite(*p); ++p)
|
|
4384 if (*p == '\\' && p[1] != NUL)
|
|
4385 ++p;
|
|
4386 nextchar = *p;
|
|
4387 *p = NUL;
|
|
4388 add_termcode(key_name, arg, FALSE);
|
|
4389 *p = nextchar;
|
|
4390 }
|
|
4391 if (full_screen)
|
|
4392 ttest(FALSE);
|
|
4393 redraw_all_later(CLEAR);
|
|
4394 }
|
|
4395 }
|
634
|
4396
|
7
|
4397 if (opt_idx >= 0)
|
634
|
4398 did_set_option(opt_idx, opt_flags,
|
|
4399 !prepending && !adding && !removing);
|
7
|
4400 }
|
|
4401
|
|
4402 skip:
|
|
4403 /*
|
|
4404 * Advance to next argument.
|
|
4405 * - skip until a blank found, taking care of backslashes
|
|
4406 * - skip blanks
|
|
4407 * - skip one "=val" argument (for hidden options ":set gfn =xx")
|
|
4408 */
|
|
4409 for (i = 0; i < 2 ; ++i)
|
|
4410 {
|
|
4411 while (*arg != NUL && !vim_iswhite(*arg))
|
|
4412 if (*arg++ == '\\' && *arg != NUL)
|
|
4413 ++arg;
|
|
4414 arg = skipwhite(arg);
|
|
4415 if (*arg != '=')
|
|
4416 break;
|
|
4417 }
|
|
4418 }
|
|
4419
|
|
4420 if (errmsg != NULL)
|
|
4421 {
|
419
|
4422 vim_strncpy(IObuff, (char_u *)_(errmsg), IOSIZE - 1);
|
7
|
4423 i = STRLEN(IObuff) + 2;
|
|
4424 if (i + (arg - startarg) < IOSIZE)
|
|
4425 {
|
|
4426 /* append the argument with the error */
|
|
4427 STRCAT(IObuff, ": ");
|
|
4428 mch_memmove(IObuff + i, startarg, (arg - startarg));
|
|
4429 IObuff[i + (arg - startarg)] = NUL;
|
|
4430 }
|
|
4431 /* make sure all characters are printable */
|
|
4432 trans_characters(IObuff, IOSIZE);
|
|
4433
|
|
4434 ++no_wait_return; /* wait_return done later */
|
|
4435 emsg(IObuff); /* show error highlighted */
|
|
4436 --no_wait_return;
|
|
4437
|
|
4438 return FAIL;
|
|
4439 }
|
|
4440
|
|
4441 arg = skipwhite(arg);
|
|
4442 }
|
|
4443
|
168
|
4444 theend:
|
|
4445 if (silent_mode && did_show)
|
|
4446 {
|
|
4447 /* After displaying option values in silent mode. */
|
|
4448 silent_mode = FALSE;
|
|
4449 info_message = TRUE; /* use mch_msg(), not mch_errmsg() */
|
|
4450 msg_putchar('\n');
|
|
4451 cursor_on(); /* msg_start() switches it off */
|
|
4452 out_flush();
|
|
4453 silent_mode = TRUE;
|
|
4454 info_message = FALSE; /* use mch_msg(), not mch_errmsg() */
|
|
4455 }
|
|
4456
|
7
|
4457 return OK;
|
|
4458 }
|
|
4459
|
634
|
4460 /*
|
|
4461 * Call this when an option has been given a new value through a user command.
|
|
4462 * Sets the P_WAS_SET flag and takes care of the P_INSECURE flag.
|
|
4463 */
|
|
4464 static void
|
|
4465 did_set_option(opt_idx, opt_flags, new_value)
|
|
4466 int opt_idx;
|
|
4467 int opt_flags; /* possibly with OPT_MODELINE */
|
|
4468 int new_value; /* value was replaced completely */
|
|
4469 {
|
|
4470 options[opt_idx].flags |= P_WAS_SET;
|
|
4471
|
|
4472 /* When an option is set in the sandbox, from a modeline or in secure mode
|
|
4473 * set the P_INSECURE flag. Otherwise, if a new value is stored reset the
|
677
|
4474 * flag. But not when there are local values. */
|
634
|
4475 if (secure
|
|
4476 #ifdef HAVE_SANDBOX
|
|
4477 || sandbox != 0
|
|
4478 #endif
|
|
4479 || (opt_flags & OPT_MODELINE))
|
|
4480 options[opt_idx].flags |= P_INSECURE;
|
677
|
4481 else if (new_value && options[opt_idx].indir == PV_NONE)
|
634
|
4482 options[opt_idx].flags &= ~P_INSECURE;
|
|
4483 }
|
|
4484
|
7
|
4485 static char_u *
|
|
4486 illegal_char(errbuf, c)
|
|
4487 char_u *errbuf;
|
|
4488 int c;
|
|
4489 {
|
|
4490 if (errbuf == NULL)
|
|
4491 return (char_u *)"";
|
|
4492 sprintf((char *)errbuf, _("E539: Illegal character <%s>"),
|
274
|
4493 (char *)transchar(c));
|
7
|
4494 return errbuf;
|
|
4495 }
|
|
4496
|
|
4497 /*
|
|
4498 * Convert a key name or string into a key value.
|
|
4499 * Used for 'wildchar' and 'cedit' options.
|
|
4500 */
|
|
4501 static int
|
|
4502 string_to_key(arg)
|
|
4503 char_u *arg;
|
|
4504 {
|
|
4505 if (*arg == '<')
|
|
4506 return find_key_option(arg + 1);
|
|
4507 if (*arg == '^')
|
|
4508 return Ctrl_chr(arg[1]);
|
|
4509 return *arg;
|
|
4510 }
|
|
4511
|
|
4512 #ifdef FEAT_CMDWIN
|
|
4513 /*
|
|
4514 * Check value of 'cedit' and set cedit_key.
|
|
4515 * Returns NULL if value is OK, error message otherwise.
|
|
4516 */
|
|
4517 static char_u *
|
|
4518 check_cedit()
|
|
4519 {
|
|
4520 int n;
|
|
4521
|
|
4522 if (*p_cedit == NUL)
|
|
4523 cedit_key = -1;
|
|
4524 else
|
|
4525 {
|
|
4526 n = string_to_key(p_cedit);
|
|
4527 if (vim_isprintc(n))
|
|
4528 return e_invarg;
|
|
4529 cedit_key = n;
|
|
4530 }
|
|
4531 return NULL;
|
|
4532 }
|
|
4533 #endif
|
|
4534
|
|
4535 #ifdef FEAT_TITLE
|
|
4536 /*
|
|
4537 * When changing 'title', 'titlestring', 'icon' or 'iconstring', call
|
|
4538 * maketitle() to create and display it.
|
|
4539 * When switching the title or icon off, call mch_restore_title() to get
|
|
4540 * the old value back.
|
|
4541 */
|
|
4542 static void
|
|
4543 did_set_title(icon)
|
|
4544 int icon; /* Did set icon instead of title */
|
|
4545 {
|
|
4546 if (starting != NO_SCREEN
|
|
4547 #ifdef FEAT_GUI
|
|
4548 && !gui.starting
|
|
4549 #endif
|
|
4550 )
|
|
4551 {
|
|
4552 maketitle();
|
|
4553 if (icon)
|
|
4554 {
|
|
4555 if (!p_icon)
|
|
4556 mch_restore_title(2);
|
|
4557 }
|
|
4558 else
|
|
4559 {
|
|
4560 if (!p_title)
|
|
4561 mch_restore_title(1);
|
|
4562 }
|
|
4563 }
|
|
4564 }
|
|
4565 #endif
|
|
4566
|
|
4567 /*
|
|
4568 * set_options_bin - called when 'bin' changes value.
|
|
4569 */
|
|
4570 void
|
|
4571 set_options_bin(oldval, newval, opt_flags)
|
|
4572 int oldval;
|
|
4573 int newval;
|
|
4574 int opt_flags; /* OPT_LOCAL and/or OPT_GLOBAL */
|
|
4575 {
|
|
4576 /*
|
|
4577 * The option values that are changed when 'bin' changes are
|
|
4578 * copied when 'bin is set and restored when 'bin' is reset.
|
|
4579 */
|
|
4580 if (newval)
|
|
4581 {
|
|
4582 if (!oldval) /* switched on */
|
|
4583 {
|
|
4584 if (!(opt_flags & OPT_GLOBAL))
|
|
4585 {
|
|
4586 curbuf->b_p_tw_nobin = curbuf->b_p_tw;
|
|
4587 curbuf->b_p_wm_nobin = curbuf->b_p_wm;
|
|
4588 curbuf->b_p_ml_nobin = curbuf->b_p_ml;
|
|
4589 curbuf->b_p_et_nobin = curbuf->b_p_et;
|
|
4590 }
|
|
4591 if (!(opt_flags & OPT_LOCAL))
|
|
4592 {
|
|
4593 p_tw_nobin = p_tw;
|
|
4594 p_wm_nobin = p_wm;
|
|
4595 p_ml_nobin = p_ml;
|
|
4596 p_et_nobin = p_et;
|
|
4597 }
|
|
4598 }
|
|
4599
|
|
4600 if (!(opt_flags & OPT_GLOBAL))
|
|
4601 {
|
|
4602 curbuf->b_p_tw = 0; /* no automatic line wrap */
|
|
4603 curbuf->b_p_wm = 0; /* no automatic line wrap */
|
|
4604 curbuf->b_p_ml = 0; /* no modelines */
|
|
4605 curbuf->b_p_et = 0; /* no expandtab */
|
|
4606 }
|
|
4607 if (!(opt_flags & OPT_LOCAL))
|
|
4608 {
|
|
4609 p_tw = 0;
|
|
4610 p_wm = 0;
|
|
4611 p_ml = FALSE;
|
|
4612 p_et = FALSE;
|
|
4613 p_bin = TRUE; /* needed when called for the "-b" argument */
|
|
4614 }
|
|
4615 }
|
|
4616 else if (oldval) /* switched off */
|
|
4617 {
|
|
4618 if (!(opt_flags & OPT_GLOBAL))
|
|
4619 {
|
|
4620 curbuf->b_p_tw = curbuf->b_p_tw_nobin;
|
|
4621 curbuf->b_p_wm = curbuf->b_p_wm_nobin;
|
|
4622 curbuf->b_p_ml = curbuf->b_p_ml_nobin;
|
|
4623 curbuf->b_p_et = curbuf->b_p_et_nobin;
|
|
4624 }
|
|
4625 if (!(opt_flags & OPT_LOCAL))
|
|
4626 {
|
|
4627 p_tw = p_tw_nobin;
|
|
4628 p_wm = p_wm_nobin;
|
|
4629 p_ml = p_ml_nobin;
|
|
4630 p_et = p_et_nobin;
|
|
4631 }
|
|
4632 }
|
|
4633 }
|
|
4634
|
|
4635 #ifdef FEAT_VIMINFO
|
|
4636 /*
|
|
4637 * Find the parameter represented by the given character (eg ', :, ", or /),
|
|
4638 * and return its associated value in the 'viminfo' string.
|
|
4639 * Only works for number parameters, not for 'r' or 'n'.
|
23
|
4640 * If the parameter is not specified in the string or there is no following
|
|
4641 * number, return -1.
|
7
|
4642 */
|
|
4643 int
|
|
4644 get_viminfo_parameter(type)
|
|
4645 int type;
|
|
4646 {
|
|
4647 char_u *p;
|
|
4648
|
|
4649 p = find_viminfo_parameter(type);
|
|
4650 if (p != NULL && VIM_ISDIGIT(*p))
|
|
4651 return atoi((char *)p);
|
|
4652 return -1;
|
|
4653 }
|
|
4654
|
|
4655 /*
|
|
4656 * Find the parameter represented by the given character (eg ''', ':', '"', or
|
|
4657 * '/') in the 'viminfo' option and return a pointer to the string after it.
|
|
4658 * Return NULL if the parameter is not specified in the string.
|
|
4659 */
|
|
4660 char_u *
|
|
4661 find_viminfo_parameter(type)
|
|
4662 int type;
|
|
4663 {
|
|
4664 char_u *p;
|
|
4665
|
|
4666 for (p = p_viminfo; *p; ++p)
|
|
4667 {
|
|
4668 if (*p == type)
|
|
4669 return p + 1;
|
|
4670 if (*p == 'n') /* 'n' is always the last one */
|
|
4671 break;
|
|
4672 p = vim_strchr(p, ','); /* skip until next ',' */
|
|
4673 if (p == NULL) /* hit the end without finding parameter */
|
|
4674 break;
|
|
4675 }
|
|
4676 return NULL;
|
|
4677 }
|
|
4678 #endif
|
|
4679
|
|
4680 /*
|
|
4681 * Expand environment variables for some string options.
|
|
4682 * These string options cannot be indirect!
|
|
4683 * If "val" is NULL expand the current value of the option.
|
|
4684 * Return pointer to NameBuff, or NULL when not expanded.
|
|
4685 */
|
|
4686 static char_u *
|
|
4687 option_expand(opt_idx, val)
|
|
4688 int opt_idx;
|
|
4689 char_u *val;
|
|
4690 {
|
|
4691 /* if option doesn't need expansion nothing to do */
|
|
4692 if (!(options[opt_idx].flags & P_EXPAND) || options[opt_idx].var == NULL)
|
|
4693 return NULL;
|
|
4694
|
|
4695 /* If val is longer than MAXPATHL no meaningful expansion can be done,
|
|
4696 * expand_env() would truncate the string. */
|
|
4697 if (val != NULL && STRLEN(val) > MAXPATHL)
|
|
4698 return NULL;
|
|
4699
|
|
4700 if (val == NULL)
|
|
4701 val = *(char_u **)options[opt_idx].var;
|
|
4702
|
|
4703 /*
|
|
4704 * Expanding this with NameBuff, expand_env() must not be passed IObuff.
|
|
4705 * Escape spaces when expanding 'tags', they are used to separate file
|
|
4706 * names.
|
374
|
4707 * For 'spellsuggest' expand after "file:".
|
7
|
4708 */
|
|
4709 expand_env_esc(val, NameBuff, MAXPATHL,
|
374
|
4710 (char_u **)options[opt_idx].var == &p_tags,
|
|
4711 #ifdef FEAT_SYN_HL
|
|
4712 (char_u **)options[opt_idx].var == &p_sps ? (char_u *)"file:" :
|
|
4713 #endif
|
|
4714 NULL);
|
7
|
4715 if (STRCMP(NameBuff, val) == 0) /* they are the same */
|
|
4716 return NULL;
|
|
4717
|
|
4718 return NameBuff;
|
|
4719 }
|
|
4720
|
|
4721 /*
|
|
4722 * After setting various option values: recompute variables that depend on
|
|
4723 * option values.
|
|
4724 */
|
|
4725 static void
|
|
4726 didset_options()
|
|
4727 {
|
|
4728 /* initialize the table for 'iskeyword' et.al. */
|
|
4729 (void)init_chartab();
|
|
4730
|
|
4731 (void)opt_strings_flags(p_cmp, p_cmp_values, &cmp_flags, TRUE);
|
|
4732 (void)opt_strings_flags(p_bkc, p_bkc_values, &bkc_flags, TRUE);
|
|
4733 #ifdef FEAT_SESSION
|
|
4734 (void)opt_strings_flags(p_ssop, p_ssop_values, &ssop_flags, TRUE);
|
|
4735 (void)opt_strings_flags(p_vop, p_ssop_values, &vop_flags, TRUE);
|
|
4736 #endif
|
|
4737 #ifdef FEAT_FOLDING
|
|
4738 (void)opt_strings_flags(p_fdo, p_fdo_values, &fdo_flags, TRUE);
|
|
4739 #endif
|
|
4740 (void)opt_strings_flags(p_dy, p_dy_values, &dy_flags, TRUE);
|
|
4741 #ifdef FEAT_VIRTUALEDIT
|
|
4742 (void)opt_strings_flags(p_ve, p_ve_values, &ve_flags, TRUE);
|
|
4743 #endif
|
|
4744 #if defined(FEAT_MOUSE) && (defined(UNIX) || defined(VMS))
|
|
4745 (void)opt_strings_flags(p_ttym, p_ttym_values, &ttym_flags, FALSE);
|
|
4746 #endif
|
344
|
4747 #ifdef FEAT_SYN_HL
|
484
|
4748 (void)spell_check_msm();
|
374
|
4749 (void)spell_check_sps();
|
389
|
4750 (void)compile_cap_prog(curbuf);
|
344
|
4751 #endif
|
7
|
4752 #if defined(FEAT_TOOLBAR) && !defined(FEAT_GUI_W32)
|
|
4753 (void)opt_strings_flags(p_toolbar, p_toolbar_values, &toolbar_flags, TRUE);
|
|
4754 #endif
|
|
4755 #if defined(FEAT_TOOLBAR) && defined(FEAT_GUI_GTK) && defined(HAVE_GTK2)
|
|
4756 (void)opt_strings_flags(p_tbis, p_tbis_values, &tbis_flags, FALSE);
|
|
4757 #endif
|
|
4758 #ifdef FEAT_CMDWIN
|
|
4759 /* set cedit_key */
|
|
4760 (void)check_cedit();
|
|
4761 #endif
|
|
4762 }
|
|
4763
|
|
4764 /*
|
|
4765 * Check for string options that are NULL (normally only termcap options).
|
|
4766 */
|
|
4767 void
|
|
4768 check_options()
|
|
4769 {
|
|
4770 int opt_idx;
|
|
4771
|
|
4772 for (opt_idx = 0; options[opt_idx].fullname != NULL; opt_idx++)
|
|
4773 if ((options[opt_idx].flags & P_STRING) && options[opt_idx].var != NULL)
|
|
4774 check_string_option((char_u **)get_varp(&(options[opt_idx])));
|
|
4775 }
|
|
4776
|
|
4777 /*
|
|
4778 * Check string options in a buffer for NULL value.
|
|
4779 */
|
|
4780 void
|
|
4781 check_buf_options(buf)
|
|
4782 buf_T *buf;
|
|
4783 {
|
|
4784 #if defined(FEAT_QUICKFIX)
|
|
4785 check_string_option(&buf->b_p_bh);
|
|
4786 check_string_option(&buf->b_p_bt);
|
|
4787 #endif
|
|
4788 #ifdef FEAT_MBYTE
|
|
4789 check_string_option(&buf->b_p_fenc);
|
|
4790 #endif
|
|
4791 check_string_option(&buf->b_p_ff);
|
|
4792 #ifdef FEAT_FIND_ID
|
|
4793 check_string_option(&buf->b_p_def);
|
|
4794 check_string_option(&buf->b_p_inc);
|
|
4795 # ifdef FEAT_EVAL
|
|
4796 check_string_option(&buf->b_p_inex);
|
|
4797 # endif
|
|
4798 #endif
|
|
4799 #if defined(FEAT_CINDENT) && defined(FEAT_EVAL)
|
|
4800 check_string_option(&buf->b_p_inde);
|
|
4801 check_string_option(&buf->b_p_indk);
|
|
4802 #endif
|
667
|
4803 #if defined(FEAT_EVAL)
|
|
4804 check_string_option(&buf->b_p_fex);
|
|
4805 #endif
|
7
|
4806 #ifdef FEAT_CRYPT
|
|
4807 check_string_option(&buf->b_p_key);
|
|
4808 #endif
|
|
4809 check_string_option(&buf->b_p_kp);
|
|
4810 check_string_option(&buf->b_p_mps);
|
|
4811 check_string_option(&buf->b_p_fo);
|
41
|
4812 check_string_option(&buf->b_p_flp);
|
7
|
4813 check_string_option(&buf->b_p_isk);
|
|
4814 #ifdef FEAT_COMMENTS
|
|
4815 check_string_option(&buf->b_p_com);
|
|
4816 #endif
|
|
4817 #ifdef FEAT_FOLDING
|
|
4818 check_string_option(&buf->b_p_cms);
|
|
4819 #endif
|
|
4820 check_string_option(&buf->b_p_nf);
|
12
|
4821 #ifdef FEAT_TEXTOBJ
|
|
4822 check_string_option(&buf->b_p_qe);
|
|
4823 #endif
|
7
|
4824 #ifdef FEAT_SYN_HL
|
|
4825 check_string_option(&buf->b_p_syn);
|
386
|
4826 check_string_option(&buf->b_p_spc);
|
314
|
4827 check_string_option(&buf->b_p_spf);
|
221
|
4828 check_string_option(&buf->b_p_spl);
|
7
|
4829 #endif
|
|
4830 #ifdef FEAT_SEARCHPATH
|
|
4831 check_string_option(&buf->b_p_sua);
|
|
4832 #endif
|
|
4833 #ifdef FEAT_CINDENT
|
|
4834 check_string_option(&buf->b_p_cink);
|
|
4835 check_string_option(&buf->b_p_cino);
|
|
4836 #endif
|
|
4837 #ifdef FEAT_AUTOCMD
|
|
4838 check_string_option(&buf->b_p_ft);
|
|
4839 #endif
|
|
4840 #ifdef FEAT_OSFILETYPE
|
|
4841 check_string_option(&buf->b_p_oft);
|
|
4842 #endif
|
|
4843 #if defined(FEAT_SMARTINDENT) || defined(FEAT_CINDENT)
|
|
4844 check_string_option(&buf->b_p_cinw);
|
|
4845 #endif
|
|
4846 #ifdef FEAT_INS_EXPAND
|
|
4847 check_string_option(&buf->b_p_cpt);
|
|
4848 #endif
|
12
|
4849 #ifdef FEAT_COMPL_FUNC
|
|
4850 check_string_option(&buf->b_p_cfu);
|
502
|
4851 check_string_option(&buf->b_p_ofu);
|
12
|
4852 #endif
|
7
|
4853 #ifdef FEAT_KEYMAP
|
|
4854 check_string_option(&buf->b_p_keymap);
|
|
4855 #endif
|
|
4856 #ifdef FEAT_QUICKFIX
|
|
4857 check_string_option(&buf->b_p_gp);
|
|
4858 check_string_option(&buf->b_p_mp);
|
|
4859 check_string_option(&buf->b_p_efm);
|
|
4860 #endif
|
|
4861 check_string_option(&buf->b_p_ep);
|
|
4862 check_string_option(&buf->b_p_path);
|
|
4863 check_string_option(&buf->b_p_tags);
|
|
4864 #ifdef FEAT_INS_EXPAND
|
|
4865 check_string_option(&buf->b_p_dict);
|
|
4866 check_string_option(&buf->b_p_tsr);
|
|
4867 #endif
|
|
4868 }
|
|
4869
|
|
4870 /*
|
|
4871 * Free the string allocated for an option.
|
|
4872 * Checks for the string being empty_option. This may happen if we're out of
|
|
4873 * memory, vim_strsave() returned NULL, which was replaced by empty_option by
|
|
4874 * check_options().
|
|
4875 * Does NOT check for P_ALLOCED flag!
|
|
4876 */
|
|
4877 void
|
|
4878 free_string_option(p)
|
|
4879 char_u *p;
|
|
4880 {
|
|
4881 if (p != empty_option)
|
|
4882 vim_free(p);
|
|
4883 }
|
|
4884
|
|
4885 void
|
|
4886 clear_string_option(pp)
|
|
4887 char_u **pp;
|
|
4888 {
|
|
4889 if (*pp != empty_option)
|
|
4890 vim_free(*pp);
|
|
4891 *pp = empty_option;
|
|
4892 }
|
|
4893
|
|
4894 static void
|
|
4895 check_string_option(pp)
|
|
4896 char_u **pp;
|
|
4897 {
|
|
4898 if (*pp == NULL)
|
|
4899 *pp = empty_option;
|
|
4900 }
|
|
4901
|
|
4902 /*
|
|
4903 * Mark a terminal option as allocated, found by a pointer into term_strings[].
|
|
4904 */
|
|
4905 void
|
|
4906 set_term_option_alloced(p)
|
|
4907 char_u **p;
|
|
4908 {
|
|
4909 int opt_idx;
|
|
4910
|
|
4911 for (opt_idx = 1; options[opt_idx].fullname != NULL; opt_idx++)
|
|
4912 if (options[opt_idx].var == (char_u *)p)
|
|
4913 {
|
|
4914 options[opt_idx].flags |= P_ALLOCED;
|
|
4915 return;
|
|
4916 }
|
|
4917 return; /* cannot happen: didn't find it! */
|
|
4918 }
|
|
4919
|
634
|
4920 #if defined(FEAT_EVAL) || defined(PROTO)
|
|
4921 /*
|
|
4922 * Return TRUE when option "opt" was set from a modeline or in secure mode.
|
|
4923 * Return FALSE when it wasn't.
|
|
4924 * Return -1 for an unknown option.
|
|
4925 */
|
|
4926 int
|
|
4927 was_set_insecurely(opt)
|
|
4928 char_u *opt;
|
|
4929 {
|
|
4930 int idx = findoption(opt);
|
|
4931
|
|
4932 if (idx >= 0)
|
|
4933 return (options[idx].flags & P_INSECURE) != 0;
|
|
4934 EMSG2(_(e_intern2), "was_set_insecurely()");
|
|
4935 return -1;
|
|
4936 }
|
|
4937 #endif
|
|
4938
|
7
|
4939 /*
|
|
4940 * Set a string option to a new value (without checking the effect).
|
|
4941 * The string is copied into allocated memory.
|
|
4942 * if ("opt_idx" == -1) "name" is used, otherwise "opt_idx" is used.
|
|
4943 */
|
|
4944 void
|
|
4945 set_string_option_direct(name, opt_idx, val, opt_flags)
|
|
4946 char_u *name;
|
|
4947 int opt_idx;
|
|
4948 char_u *val;
|
|
4949 int opt_flags; /* OPT_FREE, OPT_LOCAL and/or OPT_GLOBAL */
|
|
4950 {
|
|
4951 char_u *s;
|
|
4952 char_u **varp;
|
|
4953 int both = (opt_flags & (OPT_LOCAL | OPT_GLOBAL)) == 0;
|
|
4954
|
|
4955 if (opt_idx == -1) /* use name */
|
|
4956 {
|
|
4957 opt_idx = findoption(name);
|
|
4958 if (opt_idx == -1) /* not found (should not happen) */
|
|
4959 return;
|
|
4960 }
|
|
4961
|
|
4962 if (options[opt_idx].var == NULL) /* can't set hidden option */
|
|
4963 return;
|
|
4964
|
|
4965 s = vim_strsave(val);
|
|
4966 if (s != NULL)
|
|
4967 {
|
|
4968 varp = (char_u **)get_varp_scope(&(options[opt_idx]),
|
|
4969 both ? OPT_LOCAL : opt_flags);
|
|
4970 if ((opt_flags & OPT_FREE) && (options[opt_idx].flags & P_ALLOCED))
|
|
4971 free_string_option(*varp);
|
|
4972 *varp = s;
|
|
4973
|
|
4974 /* For buffer/window local option may also set the global value. */
|
|
4975 if (both)
|
|
4976 set_string_option_global(opt_idx, varp);
|
|
4977
|
|
4978 options[opt_idx].flags |= P_ALLOCED;
|
|
4979
|
|
4980 /* When setting both values of a global option with a local value,
|
|
4981 * make the local value empty, so that the global value is used. */
|
|
4982 if ((int)options[opt_idx].indir >= PV_BOTH && both)
|
|
4983 {
|
|
4984 free_string_option(*varp);
|
|
4985 *varp = empty_option;
|
|
4986 }
|
|
4987 }
|
|
4988 }
|
|
4989
|
|
4990 /*
|
|
4991 * Set global value for string option when it's a local option.
|
|
4992 */
|
|
4993 static void
|
|
4994 set_string_option_global(opt_idx, varp)
|
|
4995 int opt_idx; /* option index */
|
|
4996 char_u **varp; /* pointer to option variable */
|
|
4997 {
|
|
4998 char_u **p, *s;
|
|
4999
|
|
5000 /* the global value is always allocated */
|
|
5001 if (options[opt_idx].var == VAR_WIN)
|
|
5002 p = (char_u **)GLOBAL_WO(varp);
|
|
5003 else
|
|
5004 p = (char_u **)options[opt_idx].var;
|
|
5005 if (options[opt_idx].indir != PV_NONE
|
|
5006 && p != varp
|
|
5007 && (s = vim_strsave(*varp)) != NULL)
|
|
5008 {
|
|
5009 free_string_option(*p);
|
|
5010 *p = s;
|
|
5011 }
|
|
5012 }
|
|
5013
|
|
5014 /*
|
|
5015 * Set a string option to a new value, and handle the effects.
|
|
5016 */
|
|
5017 static void
|
|
5018 set_string_option(opt_idx, value, opt_flags)
|
|
5019 int opt_idx;
|
|
5020 char_u *value;
|
|
5021 int opt_flags; /* OPT_LOCAL and/or OPT_GLOBAL */
|
|
5022 {
|
|
5023 char_u *s;
|
|
5024 char_u **varp;
|
|
5025 char_u *oldval;
|
|
5026
|
|
5027 if (options[opt_idx].var == NULL) /* don't set hidden option */
|
|
5028 return;
|
|
5029
|
|
5030 s = vim_strsave(value);
|
|
5031 if (s != NULL)
|
|
5032 {
|
|
5033 varp = (char_u **)get_varp_scope(&(options[opt_idx]),
|
|
5034 (opt_flags & (OPT_LOCAL | OPT_GLOBAL)) == 0
|
|
5035 ? ((int)options[opt_idx].indir >= PV_BOTH
|
|
5036 ? OPT_GLOBAL : OPT_LOCAL)
|
|
5037 : opt_flags);
|
|
5038 oldval = *varp;
|
|
5039 *varp = s;
|
634
|
5040 if (did_set_string_option(opt_idx, varp, TRUE, oldval, NULL,
|
|
5041 opt_flags) == NULL)
|
|
5042 did_set_option(opt_idx, opt_flags, TRUE);
|
7
|
5043 }
|
|
5044 }
|
|
5045
|
|
5046 /*
|
|
5047 * Handle string options that need some action to perform when changed.
|
|
5048 * Returns NULL for success, or an error message for an error.
|
|
5049 */
|
|
5050 static char_u *
|
|
5051 did_set_string_option(opt_idx, varp, new_value_alloced, oldval, errbuf,
|
|
5052 opt_flags)
|
|
5053 int opt_idx; /* index in options[] table */
|
|
5054 char_u **varp; /* pointer to the option variable */
|
|
5055 int new_value_alloced; /* new value was allocated */
|
|
5056 char_u *oldval; /* previous value of the option */
|
|
5057 char_u *errbuf; /* buffer for errors, or NULL */
|
|
5058 int opt_flags; /* OPT_LOCAL and/or OPT_GLOBAL */
|
|
5059 {
|
|
5060 char_u *errmsg = NULL;
|
|
5061 char_u *s, *p;
|
|
5062 int did_chartab = FALSE;
|
|
5063 char_u **gvarp;
|
24
|
5064 int free_oldval = (options[opt_idx].flags & P_ALLOCED);
|
7
|
5065
|
|
5066 /* Get the global option to compare with, otherwise we would have to check
|
|
5067 * two values for all local options. */
|
|
5068 gvarp = (char_u **)get_varp_scope(&(options[opt_idx]), OPT_GLOBAL);
|
|
5069
|
|
5070 /* Disallow changing some options from secure mode */
|
|
5071 if ((secure
|
|
5072 #ifdef HAVE_SANDBOX
|
|
5073 || sandbox != 0
|
|
5074 #endif
|
|
5075 ) && (options[opt_idx].flags & P_SECURE))
|
|
5076 {
|
|
5077 errmsg = e_secure;
|
|
5078 }
|
|
5079
|
36
|
5080 /* Check for a "normal" file name in some options. Disallow a path
|
|
5081 * separator (slash and/or backslash), wildcards and characters that are
|
|
5082 * often illegal in a file name. */
|
|
5083 else if ((options[opt_idx].flags & P_NFNAME)
|
39
|
5084 && vim_strpbrk(*varp, (char_u *)"/\\*?[|<>") != NULL)
|
36
|
5085 {
|
|
5086 errmsg = e_invarg;
|
|
5087 }
|
|
5088
|
7
|
5089 /* 'term' */
|
|
5090 else if (varp == &T_NAME)
|
|
5091 {
|
|
5092 if (T_NAME[0] == NUL)
|
|
5093 errmsg = (char_u *)N_("E529: Cannot set 'term' to empty string");
|
|
5094 #ifdef FEAT_GUI
|
|
5095 if (gui.in_use)
|
|
5096 errmsg = (char_u *)N_("E530: Cannot change term in GUI");
|
|
5097 else if (term_is_gui(T_NAME))
|
|
5098 errmsg = (char_u *)N_("E531: Use \":gui\" to start the GUI");
|
|
5099 #endif
|
|
5100 else if (set_termname(T_NAME) == FAIL)
|
|
5101 errmsg = (char_u *)N_("E522: Not found in termcap");
|
|
5102 else
|
|
5103 /* Screen colors may have changed. */
|
|
5104 redraw_later_clear();
|
|
5105 }
|
|
5106
|
|
5107 /* 'backupcopy' */
|
|
5108 else if (varp == &p_bkc)
|
|
5109 {
|
|
5110 if (opt_strings_flags(p_bkc, p_bkc_values, &bkc_flags, TRUE) != OK)
|
|
5111 errmsg = e_invarg;
|
|
5112 if (((bkc_flags & BKC_AUTO) != 0)
|
|
5113 + ((bkc_flags & BKC_YES) != 0)
|
|
5114 + ((bkc_flags & BKC_NO) != 0) != 1)
|
|
5115 {
|
|
5116 /* Must have exactly one of "auto", "yes" and "no". */
|
|
5117 (void)opt_strings_flags(oldval, p_bkc_values, &bkc_flags, TRUE);
|
|
5118 errmsg = e_invarg;
|
|
5119 }
|
|
5120 }
|
|
5121
|
|
5122 /* 'backupext' and 'patchmode' */
|
|
5123 else if (varp == &p_bex || varp == &p_pm)
|
|
5124 {
|
|
5125 if (STRCMP(*p_bex == '.' ? p_bex + 1 : p_bex,
|
|
5126 *p_pm == '.' ? p_pm + 1 : p_pm) == 0)
|
|
5127 errmsg = (char_u *)N_("E589: 'backupext' and 'patchmode' are equal");
|
|
5128 }
|
|
5129
|
|
5130 /*
|
|
5131 * 'isident', 'iskeyword', 'isprint or 'isfname' option: refill chartab[]
|
|
5132 * If the new option is invalid, use old value. 'lisp' option: refill
|
|
5133 * chartab[] for '-' char
|
|
5134 */
|
|
5135 else if ( varp == &p_isi
|
|
5136 || varp == &(curbuf->b_p_isk)
|
|
5137 || varp == &p_isp
|
|
5138 || varp == &p_isf)
|
|
5139 {
|
|
5140 if (init_chartab() == FAIL)
|
|
5141 {
|
|
5142 did_chartab = TRUE; /* need to restore it below */
|
|
5143 errmsg = e_invarg; /* error in value */
|
|
5144 }
|
|
5145 }
|
|
5146
|
|
5147 /* 'helpfile' */
|
|
5148 else if (varp == &p_hf)
|
|
5149 {
|
|
5150 /* May compute new values for $VIM and $VIMRUNTIME */
|
|
5151 if (didset_vim)
|
|
5152 {
|
|
5153 vim_setenv((char_u *)"VIM", (char_u *)"");
|
|
5154 didset_vim = FALSE;
|
|
5155 }
|
|
5156 if (didset_vimruntime)
|
|
5157 {
|
|
5158 vim_setenv((char_u *)"VIMRUNTIME", (char_u *)"");
|
|
5159 didset_vimruntime = FALSE;
|
|
5160 }
|
|
5161 }
|
|
5162
|
|
5163 #ifdef FEAT_MULTI_LANG
|
|
5164 /* 'helplang' */
|
|
5165 else if (varp == &p_hlg)
|
|
5166 {
|
|
5167 /* Check for "", "ab", "ab,cd", etc. */
|
|
5168 for (s = p_hlg; *s != NUL; s += 3)
|
|
5169 {
|
|
5170 if (s[1] == NUL || ((s[2] != ',' || s[3] == NUL) && s[2] != NUL))
|
|
5171 {
|
|
5172 errmsg = e_invarg;
|
|
5173 break;
|
|
5174 }
|
|
5175 if (s[2] == NUL)
|
|
5176 break;
|
|
5177 }
|
|
5178 }
|
|
5179 #endif
|
|
5180
|
|
5181 /* 'highlight' */
|
|
5182 else if (varp == &p_hl)
|
|
5183 {
|
|
5184 if (highlight_changed() == FAIL)
|
|
5185 errmsg = e_invarg; /* invalid flags */
|
|
5186 }
|
|
5187
|
|
5188 /* 'nrformats' */
|
|
5189 else if (gvarp == &p_nf)
|
|
5190 {
|
|
5191 if (check_opt_strings(*varp, p_nf_values, TRUE) != OK)
|
|
5192 errmsg = e_invarg;
|
|
5193 }
|
|
5194
|
|
5195 #ifdef FEAT_SESSION
|
|
5196 /* 'sessionoptions' */
|
|
5197 else if (varp == &p_ssop)
|
|
5198 {
|
|
5199 if (opt_strings_flags(p_ssop, p_ssop_values, &ssop_flags, TRUE) != OK)
|
|
5200 errmsg = e_invarg;
|
|
5201 if ((ssop_flags & SSOP_CURDIR) && (ssop_flags & SSOP_SESDIR))
|
|
5202 {
|
|
5203 /* Don't allow both "sesdir" and "curdir". */
|
|
5204 (void)opt_strings_flags(oldval, p_ssop_values, &ssop_flags, TRUE);
|
|
5205 errmsg = e_invarg;
|
|
5206 }
|
|
5207 }
|
|
5208 /* 'viewoptions' */
|
|
5209 else if (varp == &p_vop)
|
|
5210 {
|
|
5211 if (opt_strings_flags(p_vop, p_ssop_values, &vop_flags, TRUE) != OK)
|
|
5212 errmsg = e_invarg;
|
|
5213 }
|
|
5214 #endif
|
|
5215
|
|
5216 /* 'scrollopt' */
|
|
5217 #ifdef FEAT_SCROLLBIND
|
|
5218 else if (varp == &p_sbo)
|
|
5219 {
|
|
5220 if (check_opt_strings(p_sbo, p_scbopt_values, TRUE) != OK)
|
|
5221 errmsg = e_invarg;
|
|
5222 }
|
|
5223 #endif
|
|
5224
|
|
5225 /* 'ambiwidth' */
|
|
5226 #ifdef FEAT_MBYTE
|
|
5227 else if (varp == &p_ambw)
|
|
5228 {
|
|
5229 if (check_opt_strings(p_ambw, p_ambw_values, FALSE) != OK)
|
|
5230 errmsg = e_invarg;
|
|
5231 }
|
|
5232 #endif
|
|
5233
|
|
5234 /* 'background' */
|
|
5235 else if (varp == &p_bg)
|
|
5236 {
|
|
5237 if (check_opt_strings(p_bg, p_bg_values, FALSE) == OK)
|
|
5238 {
|
|
5239 #ifdef FEAT_EVAL
|
|
5240 int dark = (*p_bg == 'd');
|
|
5241 #endif
|
|
5242
|
|
5243 init_highlight(FALSE, FALSE);
|
|
5244
|
|
5245 #ifdef FEAT_EVAL
|
|
5246 if (dark != (*p_bg == 'd')
|
|
5247 && get_var_value((char_u *)"g:colors_name") != NULL)
|
|
5248 {
|
|
5249 /* The color scheme must have set 'background' back to another
|
|
5250 * value, that's not what we want here. Disable the color
|
|
5251 * scheme and set the colors again. */
|
148
|
5252 do_unlet((char_u *)"g:colors_name", TRUE);
|
7
|
5253 free_string_option(p_bg);
|
|
5254 p_bg = vim_strsave((char_u *)(dark ? "dark" : "light"));
|
|
5255 check_string_option(&p_bg);
|
|
5256 init_highlight(FALSE, FALSE);
|
|
5257 }
|
|
5258 #endif
|
|
5259 }
|
|
5260 else
|
|
5261 errmsg = e_invarg;
|
|
5262 }
|
|
5263
|
|
5264 /* 'wildmode' */
|
|
5265 else if (varp == &p_wim)
|
|
5266 {
|
|
5267 if (check_opt_wim() == FAIL)
|
|
5268 errmsg = e_invarg;
|
|
5269 }
|
|
5270
|
40
|
5271 #ifdef FEAT_CMDL_COMPL
|
|
5272 /* 'wildoptions' */
|
|
5273 else if (varp == &p_wop)
|
|
5274 {
|
|
5275 if (check_opt_strings(p_wop, p_wop_values, TRUE) != OK)
|
|
5276 errmsg = e_invarg;
|
|
5277 }
|
|
5278 #endif
|
|
5279
|
7
|
5280 #ifdef FEAT_WAK
|
|
5281 /* 'winaltkeys' */
|
|
5282 else if (varp == &p_wak)
|
|
5283 {
|
|
5284 if (*p_wak == NUL
|
|
5285 || check_opt_strings(p_wak, p_wak_values, FALSE) != OK)
|
|
5286 errmsg = e_invarg;
|
|
5287 # ifdef FEAT_MENU
|
|
5288 # ifdef FEAT_GUI_MOTIF
|
|
5289 else if (gui.in_use)
|
|
5290 gui_motif_set_mnemonics(p_wak[0] == 'y' || p_wak[0] == 'm');
|
|
5291 # else
|
|
5292 # ifdef FEAT_GUI_GTK
|
|
5293 else if (gui.in_use)
|
|
5294 gui_gtk_set_mnemonics(p_wak[0] == 'y' || p_wak[0] == 'm');
|
|
5295 # endif
|
|
5296 # endif
|
|
5297 # endif
|
|
5298 }
|
|
5299 #endif
|
|
5300
|
|
5301 #ifdef FEAT_AUTOCMD
|
|
5302 /* 'eventignore' */
|
|
5303 else if (varp == &p_ei)
|
|
5304 {
|
|
5305 if (check_ei() == FAIL)
|
|
5306 errmsg = e_invarg;
|
|
5307 }
|
|
5308 #endif
|
|
5309
|
|
5310 #ifdef FEAT_MBYTE
|
|
5311 /* 'encoding' and 'fileencoding' */
|
|
5312 else if (varp == &p_enc || gvarp == &p_fenc || varp == &p_tenc)
|
|
5313 {
|
|
5314 if (gvarp == &p_fenc)
|
|
5315 {
|
|
5316 if (!curbuf->b_p_ma)
|
|
5317 errmsg = e_modifiable;
|
|
5318 else if (vim_strchr(*varp, ',') != NULL)
|
|
5319 /* No comma allowed in 'fileencoding'; catches confusing it
|
|
5320 * with 'fileencodings'. */
|
|
5321 errmsg = e_invarg;
|
39
|
5322 else
|
|
5323 {
|
7
|
5324 # ifdef FEAT_TITLE
|
|
5325 /* May show a "+" in the title now. */
|
|
5326 need_maketitle = TRUE;
|
|
5327 # endif
|
39
|
5328 /* Add 'fileencoding' to the swap file. */
|
|
5329 ml_setflags(curbuf);
|
|
5330 }
|
7
|
5331 }
|
|
5332 if (errmsg == NULL)
|
|
5333 {
|
|
5334 /* canonize the value, so that STRCMP() can be used on it */
|
|
5335 p = enc_canonize(*varp);
|
|
5336 if (p != NULL)
|
|
5337 {
|
|
5338 vim_free(*varp);
|
|
5339 *varp = p;
|
|
5340 }
|
|
5341 if (varp == &p_enc)
|
|
5342 {
|
|
5343 errmsg = mb_init();
|
|
5344 # ifdef FEAT_TITLE
|
|
5345 need_maketitle = TRUE;
|
|
5346 # endif
|
|
5347 }
|
|
5348 }
|
|
5349
|
|
5350 # if defined(FEAT_GUI_GTK) && defined(HAVE_GTK2)
|
|
5351 if (errmsg == NULL && varp == &p_tenc && gui.in_use)
|
|
5352 {
|
|
5353 /* GTK+ 2 uses only a single encoding, and that is UTF-8. */
|
|
5354 if (STRCMP(p_tenc, "utf-8") != 0)
|
|
5355 errmsg = (char_u *)N_("E617: Cannot be changed in the GTK+ 2 GUI");
|
|
5356 }
|
|
5357 # endif
|
|
5358
|
|
5359 if (errmsg == NULL)
|
|
5360 {
|
|
5361 # ifdef FEAT_KEYMAP
|
|
5362 /* When 'keymap' is used and 'encoding' changes, reload the keymap
|
|
5363 * (with another encoding). */
|
|
5364 if (varp == &p_enc && *curbuf->b_p_keymap != NUL)
|
|
5365 (void)keymap_init();
|
|
5366 # endif
|
|
5367
|
|
5368 /* When 'termencoding' is not empty and 'encoding' changes or when
|
|
5369 * 'termencoding' changes, need to setup for keyboard input and
|
|
5370 * display output conversion. */
|
|
5371 if (((varp == &p_enc && *p_tenc != NUL) || varp == &p_tenc))
|
|
5372 {
|
|
5373 convert_setup(&input_conv, p_tenc, p_enc);
|
|
5374 convert_setup(&output_conv, p_enc, p_tenc);
|
|
5375 }
|
170
|
5376
|
|
5377 # if defined(WIN3264) && defined(FEAT_MBYTE)
|
|
5378 /* $HOME may have characters in active code page. */
|
|
5379 if (varp == &p_enc)
|
|
5380 init_homedir();
|
|
5381 # endif
|
7
|
5382 }
|
|
5383 }
|
|
5384 #endif
|
|
5385
|
|
5386 #if defined(FEAT_POSTSCRIPT)
|
|
5387 else if (varp == &p_penc)
|
|
5388 {
|
|
5389 /* Canonize printencoding if VIM standard one */
|
|
5390 p = enc_canonize(p_penc);
|
|
5391 if (p != NULL)
|
|
5392 {
|
|
5393 vim_free(p_penc);
|
|
5394 p_penc = p;
|
|
5395 }
|
|
5396 else
|
|
5397 {
|
|
5398 /* Ensure lower case and '-' for '_' */
|
|
5399 for (s = p_penc; *s != NUL; s++)
|
|
5400 {
|
|
5401 if (*s == '_')
|
|
5402 *s = '-';
|
|
5403 else
|
|
5404 *s = TOLOWER_ASC(*s);
|
|
5405 }
|
|
5406 }
|
|
5407 }
|
|
5408 #endif
|
|
5409
|
574
|
5410 #if defined(FEAT_XIM) && defined(FEAT_GUI_GTK)
|
7
|
5411 else if (varp == &p_imak)
|
|
5412 {
|
|
5413 if (gui.in_use && !im_xim_isvalid_imactivate())
|
|
5414 errmsg = e_invarg;
|
|
5415 }
|
|
5416 #endif
|
|
5417
|
|
5418 #ifdef FEAT_KEYMAP
|
|
5419 else if (varp == &curbuf->b_p_keymap)
|
|
5420 {
|
|
5421 /* load or unload key mapping tables */
|
|
5422 errmsg = keymap_init();
|
|
5423
|
|
5424 /* When successfully installed a new keymap switch on using it. */
|
|
5425 if (*curbuf->b_p_keymap != NUL && errmsg == NULL)
|
|
5426 {
|
|
5427 curbuf->b_p_iminsert = B_IMODE_LMAP;
|
|
5428 if (curbuf->b_p_imsearch != B_IMODE_USE_INSERT)
|
|
5429 curbuf->b_p_imsearch = B_IMODE_LMAP;
|
|
5430 set_iminsert_global();
|
|
5431 set_imsearch_global();
|
|
5432 # ifdef FEAT_WINDOWS
|
|
5433 status_redraw_curbuf();
|
|
5434 # endif
|
|
5435 }
|
|
5436 }
|
|
5437 #endif
|
|
5438
|
|
5439 /* 'fileformat' */
|
|
5440 else if (gvarp == &p_ff)
|
|
5441 {
|
|
5442 if (!curbuf->b_p_ma && !(opt_flags & OPT_GLOBAL))
|
|
5443 errmsg = e_modifiable;
|
|
5444 else if (check_opt_strings(*varp, p_ff_values, FALSE) != OK)
|
|
5445 errmsg = e_invarg;
|
|
5446 else
|
|
5447 {
|
|
5448 /* may also change 'textmode' */
|
|
5449 if (get_fileformat(curbuf) == EOL_DOS)
|
|
5450 curbuf->b_p_tx = TRUE;
|
|
5451 else
|
|
5452 curbuf->b_p_tx = FALSE;
|
|
5453 #ifdef FEAT_TITLE
|
|
5454 need_maketitle = TRUE;
|
|
5455 #endif
|
39
|
5456 /* update flag in swap file */
|
|
5457 ml_setflags(curbuf);
|
7
|
5458 }
|
|
5459 }
|
|
5460
|
|
5461 /* 'fileformats' */
|
|
5462 else if (varp == &p_ffs)
|
|
5463 {
|
|
5464 if (check_opt_strings(p_ffs, p_ff_values, TRUE) != OK)
|
|
5465 errmsg = e_invarg;
|
|
5466 else
|
|
5467 {
|
|
5468 /* also change 'textauto' */
|
|
5469 if (*p_ffs == NUL)
|
|
5470 p_ta = FALSE;
|
|
5471 else
|
|
5472 p_ta = TRUE;
|
|
5473 }
|
|
5474 }
|
|
5475
|
|
5476 #if defined(FEAT_CRYPT) && defined(FEAT_CMDHIST)
|
|
5477 /* 'cryptkey' */
|
|
5478 else if (gvarp == &p_key)
|
|
5479 {
|
|
5480 /* Make sure the ":set" command doesn't show the new value in the
|
|
5481 * history. */
|
|
5482 remove_key_from_history();
|
|
5483 }
|
|
5484 #endif
|
|
5485
|
|
5486 /* 'matchpairs' */
|
|
5487 else if (gvarp == &p_mps)
|
|
5488 {
|
|
5489 /* Check for "x:y,x:y" */
|
|
5490 for (p = *varp; *p != NUL; p += 4)
|
|
5491 {
|
|
5492 if (p[1] != ':' || p[2] == NUL || (p[3] != NUL && p[3] != ','))
|
|
5493 {
|
|
5494 errmsg = e_invarg;
|
|
5495 break;
|
|
5496 }
|
|
5497 if (p[3] == NUL)
|
|
5498 break;
|
|
5499 }
|
|
5500 }
|
|
5501
|
|
5502 #ifdef FEAT_COMMENTS
|
|
5503 /* 'comments' */
|
|
5504 else if (gvarp == &p_com)
|
|
5505 {
|
|
5506 for (s = *varp; *s; )
|
|
5507 {
|
|
5508 while (*s && *s != ':')
|
|
5509 {
|
|
5510 if (vim_strchr((char_u *)COM_ALL, *s) == NULL
|
|
5511 && !VIM_ISDIGIT(*s) && *s != '-')
|
|
5512 {
|
|
5513 errmsg = illegal_char(errbuf, *s);
|
|
5514 break;
|
|
5515 }
|
|
5516 ++s;
|
|
5517 }
|
|
5518 if (*s++ == NUL)
|
|
5519 errmsg = (char_u *)N_("E524: Missing colon");
|
|
5520 else if (*s == ',' || *s == NUL)
|
|
5521 errmsg = (char_u *)N_("E525: Zero length string");
|
|
5522 if (errmsg != NULL)
|
|
5523 break;
|
|
5524 while (*s && *s != ',')
|
|
5525 {
|
|
5526 if (*s == '\\' && s[1] != NUL)
|
|
5527 ++s;
|
|
5528 ++s;
|
|
5529 }
|
|
5530 s = skip_to_option_part(s);
|
|
5531 }
|
|
5532 }
|
|
5533 #endif
|
|
5534
|
|
5535 /* 'listchars' */
|
|
5536 else if (varp == &p_lcs)
|
|
5537 {
|
|
5538 errmsg = set_chars_option(varp);
|
|
5539 }
|
|
5540
|
|
5541 #if defined(FEAT_WINDOWS) || defined(FEAT_FOLDING)
|
|
5542 /* 'fillchars' */
|
|
5543 else if (varp == &p_fcs)
|
|
5544 {
|
|
5545 errmsg = set_chars_option(varp);
|
|
5546 }
|
|
5547 #endif
|
|
5548
|
|
5549 #ifdef FEAT_CMDWIN
|
|
5550 /* 'cedit' */
|
|
5551 else if (varp == &p_cedit)
|
|
5552 {
|
|
5553 errmsg = check_cedit();
|
|
5554 }
|
|
5555 #endif
|
|
5556
|
294
|
5557 /* 'verbosefile' */
|
|
5558 else if (varp == &p_vfile)
|
|
5559 {
|
|
5560 verbose_stop();
|
|
5561 if (*p_vfile != NUL && verbose_open() == FAIL)
|
|
5562 errmsg = e_invarg;
|
|
5563 }
|
|
5564
|
7
|
5565 #ifdef FEAT_VIMINFO
|
|
5566 /* 'viminfo' */
|
|
5567 else if (varp == &p_viminfo)
|
|
5568 {
|
|
5569 for (s = p_viminfo; *s;)
|
|
5570 {
|
|
5571 /* Check it's a valid character */
|
|
5572 if (vim_strchr((char_u *)"!\"%'/:<@cfhnrs", *s) == NULL)
|
|
5573 {
|
|
5574 errmsg = illegal_char(errbuf, *s);
|
|
5575 break;
|
|
5576 }
|
|
5577 if (*s == 'n') /* name is always last one */
|
|
5578 {
|
|
5579 break;
|
|
5580 }
|
|
5581 else if (*s == 'r') /* skip until next ',' */
|
|
5582 {
|
|
5583 while (*++s && *s != ',')
|
|
5584 ;
|
|
5585 }
|
23
|
5586 else if (*s == '%')
|
|
5587 {
|
|
5588 /* optional number */
|
|
5589 while (vim_isdigit(*++s))
|
|
5590 ;
|
|
5591 }
|
|
5592 else if (*s == '!' || *s == 'h' || *s == 'c')
|
7
|
5593 ++s; /* no extra chars */
|
|
5594 else /* must have a number */
|
|
5595 {
|
|
5596 while (vim_isdigit(*++s))
|
|
5597 ;
|
|
5598
|
|
5599 if (!VIM_ISDIGIT(*(s - 1)))
|
|
5600 {
|
|
5601 if (errbuf != NULL)
|
|
5602 {
|
133
|
5603 sprintf((char *)errbuf,
|
|
5604 _("E526: Missing number after <%s>"),
|
7
|
5605 transchar_byte(*(s - 1)));
|
|
5606 errmsg = errbuf;
|
|
5607 }
|
|
5608 else
|
|
5609 errmsg = (char_u *)"";
|
|
5610 break;
|
|
5611 }
|
|
5612 }
|
|
5613 if (*s == ',')
|
|
5614 ++s;
|
|
5615 else if (*s)
|
|
5616 {
|
|
5617 if (errbuf != NULL)
|
|
5618 errmsg = (char_u *)N_("E527: Missing comma");
|
|
5619 else
|
|
5620 errmsg = (char_u *)"";
|
|
5621 break;
|
|
5622 }
|
|
5623 }
|
|
5624 if (*p_viminfo && errmsg == NULL && get_viminfo_parameter('\'') < 0)
|
|
5625 errmsg = (char_u *)N_("E528: Must specify a ' value");
|
|
5626 }
|
|
5627 #endif /* FEAT_VIMINFO */
|
|
5628
|
|
5629 /* terminal options */
|
|
5630 else if (istermoption(&options[opt_idx]) && full_screen)
|
|
5631 {
|
|
5632 /* ":set t_Co=0" and ":set t_Co=1" do ":set t_Co=" */
|
|
5633 if (varp == &T_CCO)
|
|
5634 {
|
|
5635 t_colors = atoi((char *)T_CCO);
|
|
5636 if (t_colors <= 1)
|
|
5637 {
|
|
5638 if (new_value_alloced)
|
|
5639 vim_free(T_CCO);
|
|
5640 T_CCO = empty_option;
|
|
5641 }
|
|
5642 /* We now have a different color setup, initialize it again. */
|
|
5643 init_highlight(TRUE, FALSE);
|
|
5644 }
|
|
5645 ttest(FALSE);
|
|
5646 if (varp == &T_ME)
|
|
5647 {
|
|
5648 out_str(T_ME);
|
|
5649 redraw_later(CLEAR);
|
|
5650 #if defined(MSDOS) || (defined(WIN3264) && !defined(FEAT_GUI_W32))
|
|
5651 /* Since t_me has been set, this probably means that the user
|
|
5652 * wants to use this as default colors. Need to reset default
|
|
5653 * background/foreground colors. */
|
|
5654 mch_set_normal_colors();
|
|
5655 #endif
|
|
5656 }
|
|
5657 }
|
|
5658
|
|
5659 #ifdef FEAT_LINEBREAK
|
|
5660 /* 'showbreak' */
|
|
5661 else if (varp == &p_sbr)
|
|
5662 {
|
|
5663 for (s = p_sbr; *s; )
|
|
5664 {
|
|
5665 if (ptr2cells(s) != 1)
|
|
5666 errmsg = (char_u *)N_("E595: contains unprintable or wide character");
|
39
|
5667 mb_ptr_adv(s);
|
7
|
5668 }
|
|
5669 }
|
|
5670 #endif
|
|
5671
|
|
5672 #ifdef FEAT_GUI
|
|
5673 /* 'guifont' */
|
|
5674 else if (varp == &p_guifont)
|
|
5675 {
|
|
5676 if (gui.in_use)
|
|
5677 {
|
|
5678 p = p_guifont;
|
574
|
5679 # if defined(FEAT_GUI_GTK)
|
7
|
5680 /*
|
|
5681 * Put up a font dialog and let the user select a new value.
|
|
5682 * If this is cancelled go back to the old value but don't
|
|
5683 * give an error message.
|
|
5684 */
|
|
5685 if (STRCMP(p, "*") == 0)
|
|
5686 {
|
|
5687 p = gui_mch_font_dialog(oldval);
|
|
5688
|
|
5689 if (new_value_alloced)
|
|
5690 free_string_option(p_guifont);
|
|
5691
|
|
5692 p_guifont = (p != NULL) ? p : vim_strsave(oldval);
|
|
5693 new_value_alloced = TRUE;
|
|
5694 }
|
|
5695 # endif
|
|
5696 if (p != NULL && gui_init_font(p_guifont, FALSE) != OK)
|
|
5697 {
|
|
5698 # if defined(FEAT_GUI_MSWIN) || defined(FEAT_GUI_PHOTON)
|
|
5699 if (STRCMP(p_guifont, "*") == 0)
|
|
5700 {
|
|
5701 /* Dialog was cancelled: Keep the old value without giving
|
|
5702 * an error message. */
|
|
5703 if (new_value_alloced)
|
|
5704 free_string_option(p_guifont);
|
|
5705 p_guifont = vim_strsave(oldval);
|
|
5706 new_value_alloced = TRUE;
|
|
5707 }
|
|
5708 else
|
|
5709 # endif
|
|
5710 errmsg = (char_u *)N_("E596: Invalid font(s)");
|
|
5711 }
|
|
5712 }
|
|
5713 }
|
|
5714 # ifdef FEAT_XFONTSET
|
|
5715 else if (varp == &p_guifontset)
|
|
5716 {
|
|
5717 if (STRCMP(p_guifontset, "*") == 0)
|
|
5718 errmsg = (char_u *)N_("E597: can't select fontset");
|
|
5719 else if (gui.in_use && gui_init_font(p_guifontset, TRUE) != OK)
|
|
5720 errmsg = (char_u *)N_("E598: Invalid fontset");
|
|
5721 }
|
|
5722 # endif
|
|
5723 # ifdef FEAT_MBYTE
|
|
5724 else if (varp == &p_guifontwide)
|
|
5725 {
|
|
5726 if (STRCMP(p_guifontwide, "*") == 0)
|
|
5727 errmsg = (char_u *)N_("E533: can't select wide font");
|
|
5728 else if (gui_get_wide_font() == FAIL)
|
|
5729 errmsg = (char_u *)N_("E534: Invalid wide font");
|
|
5730 }
|
|
5731 # endif
|
|
5732 #endif
|
|
5733
|
|
5734 #ifdef CURSOR_SHAPE
|
|
5735 /* 'guicursor' */
|
|
5736 else if (varp == &p_guicursor)
|
|
5737 errmsg = parse_shape_opt(SHAPE_CURSOR);
|
|
5738 #endif
|
|
5739
|
|
5740 #ifdef FEAT_MOUSESHAPE
|
|
5741 /* 'mouseshape' */
|
|
5742 else if (varp == &p_mouseshape)
|
|
5743 {
|
|
5744 errmsg = parse_shape_opt(SHAPE_MOUSE);
|
|
5745 update_mouseshape(-1);
|
|
5746 }
|
|
5747 #endif
|
|
5748
|
|
5749 #ifdef FEAT_PRINTER
|
|
5750 else if (varp == &p_popt)
|
440
|
5751 errmsg = parse_printoptions();
|
16
|
5752 # if defined(FEAT_MBYTE) && defined(FEAT_POSTSCRIPT)
|
15
|
5753 else if (varp == &p_pmfn)
|
440
|
5754 errmsg = parse_printmbfont();
|
15
|
5755 # endif
|
7
|
5756 #endif
|
|
5757
|
|
5758 #ifdef FEAT_LANGMAP
|
|
5759 /* 'langmap' */
|
|
5760 else if (varp == &p_langmap)
|
|
5761 langmap_set();
|
|
5762 #endif
|
|
5763
|
|
5764 #ifdef FEAT_LINEBREAK
|
|
5765 /* 'breakat' */
|
|
5766 else if (varp == &p_breakat)
|
|
5767 fill_breakat_flags();
|
|
5768 #endif
|
|
5769
|
|
5770 #ifdef FEAT_TITLE
|
|
5771 /* 'titlestring' and 'iconstring' */
|
|
5772 else if (varp == &p_titlestring || varp == &p_iconstring)
|
|
5773 {
|
|
5774 # ifdef FEAT_STL_OPT
|
|
5775 int flagval = (varp == &p_titlestring) ? STL_IN_TITLE : STL_IN_ICON;
|
|
5776
|
|
5777 /* NULL => statusline syntax */
|
|
5778 if (vim_strchr(*varp, '%') && check_stl_option(*varp) == NULL)
|
|
5779 stl_syntax |= flagval;
|
|
5780 else
|
|
5781 stl_syntax &= ~flagval;
|
|
5782 # endif
|
|
5783 did_set_title(varp == &p_iconstring);
|
|
5784
|
|
5785 }
|
|
5786 #endif
|
|
5787
|
|
5788 #ifdef FEAT_GUI
|
|
5789 /* 'guioptions' */
|
|
5790 else if (varp == &p_go)
|
|
5791 gui_init_which_components(oldval);
|
|
5792 #endif
|
|
5793
|
|
5794 #if defined(FEAT_MOUSE_TTY) && (defined(UNIX) || defined(VMS))
|
|
5795 /* 'ttymouse' */
|
|
5796 else if (varp == &p_ttym)
|
|
5797 {
|
190
|
5798 /* Switch the mouse off before changing the escape sequences used for
|
|
5799 * that. */
|
|
5800 mch_setmouse(FALSE);
|
7
|
5801 if (opt_strings_flags(p_ttym, p_ttym_values, &ttym_flags, FALSE) != OK)
|
|
5802 errmsg = e_invarg;
|
|
5803 else
|
|
5804 check_mouse_termcode();
|
227
|
5805 if (termcap_active)
|
|
5806 setmouse(); /* may switch it on again */
|
7
|
5807 }
|
|
5808 #endif
|
|
5809
|
|
5810 #ifdef FEAT_VISUAL
|
|
5811 /* 'selection' */
|
|
5812 else if (varp == &p_sel)
|
|
5813 {
|
|
5814 if (*p_sel == NUL
|
|
5815 || check_opt_strings(p_sel, p_sel_values, FALSE) != OK)
|
|
5816 errmsg = e_invarg;
|
|
5817 }
|
|
5818
|
|
5819 /* 'selectmode' */
|
|
5820 else if (varp == &p_slm)
|
|
5821 {
|
|
5822 if (check_opt_strings(p_slm, p_slm_values, TRUE) != OK)
|
|
5823 errmsg = e_invarg;
|
|
5824 }
|
|
5825 #endif
|
|
5826
|
|
5827 #ifdef FEAT_BROWSE
|
|
5828 /* 'browsedir' */
|
|
5829 else if (varp == &p_bsdir)
|
|
5830 {
|
|
5831 if (check_opt_strings(p_bsdir, p_bsdir_values, FALSE) != OK
|
|
5832 && !mch_isdir(p_bsdir))
|
|
5833 errmsg = e_invarg;
|
|
5834 }
|
|
5835 #endif
|
|
5836
|
|
5837 #ifdef FEAT_VISUAL
|
|
5838 /* 'keymodel' */
|
|
5839 else if (varp == &p_km)
|
|
5840 {
|
|
5841 if (check_opt_strings(p_km, p_km_values, TRUE) != OK)
|
|
5842 errmsg = e_invarg;
|
|
5843 else
|
|
5844 {
|
|
5845 km_stopsel = (vim_strchr(p_km, 'o') != NULL);
|
|
5846 km_startsel = (vim_strchr(p_km, 'a') != NULL);
|
|
5847 }
|
|
5848 }
|
|
5849 #endif
|
|
5850
|
|
5851 /* 'mousemodel' */
|
|
5852 else if (varp == &p_mousem)
|
|
5853 {
|
|
5854 if (check_opt_strings(p_mousem, p_mousem_values, FALSE) != OK)
|
|
5855 errmsg = e_invarg;
|
|
5856 #if defined(FEAT_GUI_MOTIF) && defined(FEAT_MENU) && (XmVersion <= 1002)
|
|
5857 else if (*p_mousem != *oldval)
|
|
5858 /* Changed from "extend" to "popup" or "popup_setpos" or vv: need
|
|
5859 * to create or delete the popup menus. */
|
|
5860 gui_motif_update_mousemodel(root_menu);
|
|
5861 #endif
|
|
5862 }
|
|
5863
|
|
5864 /* 'switchbuf' */
|
|
5865 else if (varp == &p_swb)
|
|
5866 {
|
|
5867 if (check_opt_strings(p_swb, p_swb_values, TRUE) != OK)
|
|
5868 errmsg = e_invarg;
|
|
5869 }
|
|
5870
|
|
5871 /* 'debug' */
|
|
5872 else if (varp == &p_debug)
|
|
5873 {
|
|
5874 if (check_opt_strings(p_debug, p_debug_values, FALSE) != OK)
|
|
5875 errmsg = e_invarg;
|
|
5876 }
|
|
5877
|
|
5878 /* 'display' */
|
|
5879 else if (varp == &p_dy)
|
|
5880 {
|
|
5881 if (opt_strings_flags(p_dy, p_dy_values, &dy_flags, TRUE) != OK)
|
|
5882 errmsg = e_invarg;
|
|
5883 else
|
|
5884 (void)init_chartab();
|
|
5885
|
|
5886 }
|
|
5887
|
|
5888 #ifdef FEAT_VERTSPLIT
|
|
5889 /* 'eadirection' */
|
|
5890 else if (varp == &p_ead)
|
|
5891 {
|
|
5892 if (check_opt_strings(p_ead, p_ead_values, FALSE) != OK)
|
|
5893 errmsg = e_invarg;
|
|
5894 }
|
|
5895 #endif
|
|
5896
|
|
5897 #ifdef FEAT_CLIPBOARD
|
|
5898 /* 'clipboard' */
|
|
5899 else if (varp == &p_cb)
|
|
5900 errmsg = check_clipboard_option();
|
|
5901 #endif
|
|
5902
|
221
|
5903 #ifdef FEAT_SYN_HL
|
323
|
5904 /* When 'spelllang' or 'spellfile' is set and there is a window for this
|
|
5905 * buffer in which 'spell' is set load the wordlists. */
|
|
5906 else if (varp == &(curbuf->b_p_spl) || varp == &(curbuf->b_p_spf))
|
221
|
5907 {
|
258
|
5908 win_T *wp;
|
323
|
5909 int l;
|
|
5910
|
|
5911 if (varp == &(curbuf->b_p_spf))
|
|
5912 {
|
|
5913 l = STRLEN(curbuf->b_p_spf);
|
|
5914 if (l > 0 && (l < 4 || STRCMP(curbuf->b_p_spf + l - 4,
|
|
5915 ".add") != 0))
|
|
5916 errmsg = e_invarg;
|
|
5917 }
|
|
5918
|
|
5919 if (errmsg == NULL)
|
|
5920 {
|
|
5921 FOR_ALL_WINDOWS(wp)
|
|
5922 if (wp->w_buffer == curbuf && wp->w_p_spell)
|
|
5923 {
|
|
5924 errmsg = did_set_spelllang(curbuf);
|
258
|
5925 # ifdef FEAT_WINDOWS
|
323
|
5926 break;
|
258
|
5927 # endif
|
323
|
5928 }
|
|
5929 }
|
221
|
5930 }
|
386
|
5931 /* When 'spellcapcheck' is set compile the regexp program. */
|
|
5932 else if (varp == &(curbuf->b_p_spc))
|
|
5933 {
|
389
|
5934 errmsg = compile_cap_prog(curbuf);
|
386
|
5935 }
|
344
|
5936 /* 'spellsuggest' */
|
|
5937 else if (varp == &p_sps)
|
|
5938 {
|
374
|
5939 if (spell_check_sps() != OK)
|
344
|
5940 errmsg = e_invarg;
|
|
5941 }
|
484
|
5942 /* 'mkspellmem' */
|
|
5943 else if (varp == &p_msm)
|
|
5944 {
|
|
5945 if (spell_check_msm() != OK)
|
|
5946 errmsg = e_invarg;
|
|
5947 }
|
221
|
5948 #endif
|
|
5949
|
7
|
5950 #ifdef FEAT_QUICKFIX
|
|
5951 /* When 'bufhidden' is set, check for valid value. */
|
|
5952 else if (gvarp == &p_bh)
|
|
5953 {
|
|
5954 if (check_opt_strings(curbuf->b_p_bh, p_bufhidden_values, FALSE) != OK)
|
|
5955 errmsg = e_invarg;
|
|
5956 }
|
|
5957
|
|
5958 /* When 'buftype' is set, check for valid value. */
|
|
5959 else if (gvarp == &p_bt)
|
|
5960 {
|
|
5961 if (check_opt_strings(curbuf->b_p_bt, p_buftype_values, FALSE) != OK)
|
|
5962 errmsg = e_invarg;
|
|
5963 else
|
|
5964 {
|
|
5965 # ifdef FEAT_WINDOWS
|
|
5966 if (curwin->w_status_height)
|
|
5967 {
|
|
5968 curwin->w_redr_status = TRUE;
|
|
5969 redraw_later(VALID);
|
|
5970 }
|
|
5971 # endif
|
|
5972 curbuf->b_help = (curbuf->b_p_bt[0] == 'h');
|
|
5973 }
|
|
5974 }
|
|
5975 #endif
|
|
5976
|
|
5977 #ifdef FEAT_STL_OPT
|
|
5978 /* 'statusline' or 'rulerformat' */
|
40
|
5979 else if (gvarp == &p_stl || varp == &p_ruf)
|
7
|
5980 {
|
|
5981 int wid;
|
|
5982
|
|
5983 if (varp == &p_ruf) /* reset ru_wid first */
|
|
5984 ru_wid = 0;
|
|
5985 s = *varp;
|
|
5986 if (varp == &p_ruf && *s == '%')
|
|
5987 {
|
|
5988 /* set ru_wid if 'ruf' starts with "%99(" */
|
|
5989 if (*++s == '-') /* ignore a '-' */
|
|
5990 s++;
|
|
5991 wid = getdigits(&s);
|
|
5992 if (wid && *s == '(' && (errmsg = check_stl_option(p_ruf)) == NULL)
|
|
5993 ru_wid = wid;
|
|
5994 else
|
|
5995 errmsg = check_stl_option(p_ruf);
|
|
5996 }
|
|
5997 else
|
|
5998 errmsg = check_stl_option(s);
|
40
|
5999 if (varp == &p_ruf && errmsg == NULL)
|
7
|
6000 comp_col();
|
|
6001 }
|
|
6002 #endif
|
|
6003
|
|
6004 #ifdef FEAT_INS_EXPAND
|
|
6005 /* check if it is a valid value for 'complete' -- Acevedo */
|
|
6006 else if (gvarp == &p_cpt)
|
|
6007 {
|
|
6008 for (s = *varp; *s;)
|
|
6009 {
|
|
6010 while(*s == ',' || *s == ' ')
|
|
6011 s++;
|
|
6012 if (!*s)
|
|
6013 break;
|
|
6014 if (vim_strchr((char_u *)".wbuksid]tU", *s) == NULL)
|
|
6015 {
|
|
6016 errmsg = illegal_char(errbuf, *s);
|
|
6017 break;
|
|
6018 }
|
|
6019 if (*++s != NUL && *s != ',' && *s != ' ')
|
|
6020 {
|
|
6021 if (s[-1] == 'k' || s[-1] == 's')
|
|
6022 {
|
|
6023 /* skip optional filename after 'k' and 's' */
|
|
6024 while (*s && *s != ',' && *s != ' ')
|
|
6025 {
|
|
6026 if (*s == '\\')
|
|
6027 ++s;
|
|
6028 ++s;
|
|
6029 }
|
|
6030 }
|
|
6031 else
|
|
6032 {
|
|
6033 if (errbuf != NULL)
|
|
6034 {
|
|
6035 sprintf((char *)errbuf,
|
|
6036 _("E535: Illegal character after <%c>"),
|
|
6037 *--s);
|
|
6038 errmsg = errbuf;
|
|
6039 }
|
|
6040 else
|
|
6041 errmsg = (char_u *)"";
|
|
6042 break;
|
|
6043 }
|
|
6044 }
|
|
6045 }
|
|
6046 }
|
540
|
6047
|
|
6048 /* 'completeopt' */
|
|
6049 else if (varp == &p_cot)
|
|
6050 {
|
|
6051 if (check_opt_strings(p_cot, p_cot_values, TRUE) != OK)
|
|
6052 errmsg = e_invarg;
|
|
6053 }
|
7
|
6054 #endif /* FEAT_INS_EXPAND */
|
|
6055
|
|
6056
|
|
6057 #if defined(FEAT_TOOLBAR) && !defined(FEAT_GUI_W32)
|
|
6058 else if (varp == &p_toolbar)
|
|
6059 {
|
|
6060 if (opt_strings_flags(p_toolbar, p_toolbar_values,
|
|
6061 &toolbar_flags, TRUE) != OK)
|
|
6062 errmsg = e_invarg;
|
|
6063 else
|
|
6064 {
|
|
6065 out_flush();
|
|
6066 gui_mch_show_toolbar((toolbar_flags &
|
|
6067 (TOOLBAR_TEXT | TOOLBAR_ICONS)) != 0);
|
|
6068 }
|
|
6069 }
|
|
6070 #endif
|
|
6071
|
|
6072 #if defined(FEAT_TOOLBAR) && defined(FEAT_GUI_GTK) && defined(HAVE_GTK2)
|
|
6073 /* 'toolbariconsize': GTK+ 2 only */
|
|
6074 else if (varp == &p_tbis)
|
|
6075 {
|
|
6076 if (opt_strings_flags(p_tbis, p_tbis_values, &tbis_flags, FALSE) != OK)
|
|
6077 errmsg = e_invarg;
|
|
6078 else
|
|
6079 {
|
|
6080 out_flush();
|
|
6081 gui_mch_show_toolbar((toolbar_flags &
|
|
6082 (TOOLBAR_TEXT | TOOLBAR_ICONS)) != 0);
|
|
6083 }
|
|
6084 }
|
|
6085 #endif
|
|
6086
|
|
6087 /* 'pastetoggle': translate key codes like in a mapping */
|
|
6088 else if (varp == &p_pt)
|
|
6089 {
|
|
6090 if (*p_pt)
|
|
6091 {
|
|
6092 (void)replace_termcodes(p_pt, &p, TRUE, TRUE);
|
|
6093 if (p != NULL)
|
|
6094 {
|
|
6095 if (new_value_alloced)
|
|
6096 free_string_option(p_pt);
|
|
6097 p_pt = p;
|
|
6098 new_value_alloced = TRUE;
|
|
6099 }
|
|
6100 }
|
|
6101 }
|
|
6102
|
|
6103 /* 'backspace' */
|
|
6104 else if (varp == &p_bs)
|
|
6105 {
|
|
6106 if (VIM_ISDIGIT(*p_bs))
|
|
6107 {
|
|
6108 if (*p_bs >'2' || p_bs[1] != NUL)
|
|
6109 errmsg = e_invarg;
|
|
6110 }
|
|
6111 else if (check_opt_strings(p_bs, p_bs_values, TRUE) != OK)
|
|
6112 errmsg = e_invarg;
|
|
6113 }
|
|
6114
|
|
6115 /* 'casemap' */
|
|
6116 else if (varp == &p_cmp)
|
|
6117 {
|
|
6118 if (opt_strings_flags(p_cmp, p_cmp_values, &cmp_flags, TRUE) != OK)
|
|
6119 errmsg = e_invarg;
|
|
6120 }
|
|
6121
|
|
6122 #ifdef FEAT_DIFF
|
|
6123 /* 'diffopt' */
|
|
6124 else if (varp == &p_dip)
|
|
6125 {
|
|
6126 if (diffopt_changed() == FAIL)
|
|
6127 errmsg = e_invarg;
|
|
6128 }
|
|
6129 #endif
|
|
6130
|
|
6131 #ifdef FEAT_FOLDING
|
|
6132 /* 'foldmethod' */
|
|
6133 else if (gvarp == &curwin->w_allbuf_opt.wo_fdm)
|
|
6134 {
|
|
6135 if (check_opt_strings(*varp, p_fdm_values, FALSE) != OK
|
|
6136 || *curwin->w_p_fdm == NUL)
|
|
6137 errmsg = e_invarg;
|
|
6138 else
|
|
6139 foldUpdateAll(curwin);
|
|
6140 }
|
|
6141 # ifdef FEAT_EVAL
|
|
6142 /* 'foldexpr' */
|
|
6143 else if (varp == &curwin->w_p_fde)
|
|
6144 {
|
|
6145 if (foldmethodIsExpr(curwin))
|
|
6146 foldUpdateAll(curwin);
|
|
6147 }
|
|
6148 # endif
|
|
6149 /* 'foldmarker' */
|
|
6150 else if (gvarp == &curwin->w_allbuf_opt.wo_fmr)
|
|
6151 {
|
|
6152 p = vim_strchr(*varp, ',');
|
|
6153 if (p == NULL)
|
|
6154 errmsg = (char_u *)N_("E536: comma required");
|
|
6155 else if (p == *varp || p[1] == NUL)
|
|
6156 errmsg = e_invarg;
|
|
6157 else if (foldmethodIsMarker(curwin))
|
|
6158 foldUpdateAll(curwin);
|
|
6159 }
|
|
6160 /* 'commentstring' */
|
|
6161 else if (gvarp == &p_cms)
|
|
6162 {
|
|
6163 if (**varp != NUL && strstr((char *)*varp, "%s") == NULL)
|
|
6164 errmsg = (char_u *)N_("E537: 'commentstring' must be empty or contain %s");
|
|
6165 }
|
|
6166 /* 'foldopen' */
|
|
6167 else if (varp == &p_fdo)
|
|
6168 {
|
|
6169 if (opt_strings_flags(p_fdo, p_fdo_values, &fdo_flags, TRUE) != OK)
|
|
6170 errmsg = e_invarg;
|
|
6171 }
|
|
6172 /* 'foldclose' */
|
|
6173 else if (varp == &p_fcl)
|
|
6174 {
|
|
6175 if (check_opt_strings(p_fcl, p_fcl_values, TRUE) != OK)
|
|
6176 errmsg = e_invarg;
|
|
6177 }
|
|
6178 #endif
|
|
6179
|
|
6180 #ifdef FEAT_VIRTUALEDIT
|
|
6181 /* 'virtualedit' */
|
|
6182 else if (varp == &p_ve)
|
|
6183 {
|
|
6184 if (opt_strings_flags(p_ve, p_ve_values, &ve_flags, TRUE) != OK)
|
|
6185 errmsg = e_invarg;
|
|
6186 else if (STRCMP(p_ve, oldval) != 0)
|
|
6187 {
|
|
6188 /* Recompute cursor position in case the new 've' setting
|
|
6189 * changes something. */
|
|
6190 validate_virtcol();
|
|
6191 coladvance(curwin->w_virtcol);
|
|
6192 }
|
|
6193 }
|
|
6194 #endif
|
|
6195
|
|
6196 #if defined(FEAT_CSCOPE) && defined(FEAT_QUICKFIX)
|
|
6197 else if (varp == &p_csqf)
|
|
6198 {
|
|
6199 if (p_csqf != NULL)
|
|
6200 {
|
|
6201 p = p_csqf;
|
|
6202 while (*p != NUL)
|
|
6203 {
|
|
6204 if (vim_strchr((char_u *)CSQF_CMDS, *p) == NULL
|
|
6205 || p[1] == NUL
|
|
6206 || vim_strchr((char_u *)CSQF_FLAGS, p[1]) == NULL
|
|
6207 || (p[2] != NUL && p[2] != ','))
|
|
6208 {
|
|
6209 errmsg = e_invarg;
|
|
6210 break;
|
|
6211 }
|
|
6212 else if (p[2] == NUL)
|
|
6213 break;
|
|
6214 else
|
|
6215 p += 3;
|
|
6216 }
|
|
6217 }
|
|
6218 }
|
|
6219 #endif
|
|
6220
|
|
6221 /* Options that are a list of flags. */
|
|
6222 else
|
|
6223 {
|
|
6224 p = NULL;
|
|
6225 if (varp == &p_ww)
|
|
6226 p = (char_u *)WW_ALL;
|
|
6227 if (varp == &p_shm)
|
|
6228 p = (char_u *)SHM_ALL;
|
|
6229 else if (varp == &(p_cpo))
|
|
6230 p = (char_u *)CPO_ALL;
|
|
6231 else if (varp == &(curbuf->b_p_fo))
|
|
6232 p = (char_u *)FO_ALL;
|
|
6233 else if (varp == &p_mouse)
|
|
6234 {
|
|
6235 #ifdef FEAT_MOUSE
|
|
6236 p = (char_u *)MOUSE_ALL;
|
|
6237 #else
|
|
6238 if (*p_mouse != NUL)
|
|
6239 errmsg = (char_u *)N_("E538: No mouse support");
|
|
6240 #endif
|
|
6241 }
|
|
6242 #if defined(FEAT_GUI)
|
|
6243 else if (varp == &p_go)
|
|
6244 p = (char_u *)GO_ALL;
|
|
6245 #endif
|
|
6246 if (p != NULL)
|
|
6247 {
|
|
6248 for (s = *varp; *s; ++s)
|
|
6249 if (vim_strchr(p, *s) == NULL)
|
|
6250 {
|
|
6251 errmsg = illegal_char(errbuf, *s);
|
|
6252 break;
|
|
6253 }
|
|
6254 }
|
|
6255 }
|
|
6256
|
|
6257 /*
|
|
6258 * If error detected, restore the previous value.
|
|
6259 */
|
|
6260 if (errmsg != NULL)
|
|
6261 {
|
|
6262 if (new_value_alloced)
|
|
6263 free_string_option(*varp);
|
|
6264 *varp = oldval;
|
|
6265 /*
|
|
6266 * When resetting some values, need to act on it.
|
|
6267 */
|
|
6268 if (did_chartab)
|
|
6269 (void)init_chartab();
|
|
6270 if (varp == &p_hl)
|
|
6271 (void)highlight_changed();
|
|
6272 }
|
|
6273 else
|
|
6274 {
|
|
6275 #ifdef FEAT_EVAL
|
|
6276 /* Remember where the option was set. */
|
|
6277 options[opt_idx].scriptID = current_SID;
|
|
6278 #endif
|
|
6279 /*
|
|
6280 * Free string options that are in allocated memory.
|
24
|
6281 * Use "free_oldval", because recursiveness may change the flags under
|
|
6282 * our fingers (esp. init_highlight()).
|
7
|
6283 */
|
24
|
6284 if (free_oldval)
|
7
|
6285 free_string_option(oldval);
|
|
6286 if (new_value_alloced)
|
|
6287 options[opt_idx].flags |= P_ALLOCED;
|
|
6288 else
|
|
6289 options[opt_idx].flags &= ~P_ALLOCED;
|
|
6290
|
|
6291 if ((opt_flags & (OPT_LOCAL | OPT_GLOBAL)) == 0
|
|
6292 && (int)options[opt_idx].indir >= PV_BOTH)
|
|
6293 {
|
|
6294 /* global option with local value set to use global value; free
|
|
6295 * the local value and make it empty */
|
|
6296 p = get_varp_scope(&(options[opt_idx]), OPT_LOCAL);
|
|
6297 free_string_option(*(char_u **)p);
|
|
6298 *(char_u **)p = empty_option;
|
|
6299 }
|
|
6300
|
|
6301 /* May set global value for local option. */
|
|
6302 else if (!(opt_flags & OPT_LOCAL) && opt_flags != OPT_GLOBAL)
|
|
6303 set_string_option_global(opt_idx, varp);
|
480
|
6304
|
|
6305 #ifdef FEAT_AUTOCMD
|
|
6306 /*
|
|
6307 * Trigger the autocommand only after setting the flags.
|
|
6308 */
|
|
6309 # ifdef FEAT_SYN_HL
|
|
6310 /* When 'syntax' is set, load the syntax of that name */
|
|
6311 if (varp == &(curbuf->b_p_syn))
|
|
6312 {
|
|
6313 apply_autocmds(EVENT_SYNTAX, curbuf->b_p_syn,
|
|
6314 curbuf->b_fname, TRUE, curbuf);
|
|
6315 }
|
|
6316 # endif
|
|
6317 else if (varp == &(curbuf->b_p_ft))
|
|
6318 {
|
|
6319 /* 'filetype' is set, trigger the FileType autocommand */
|
|
6320 did_filetype = TRUE;
|
|
6321 apply_autocmds(EVENT_FILETYPE, curbuf->b_p_ft,
|
|
6322 curbuf->b_fname, TRUE, curbuf);
|
|
6323 }
|
|
6324 #endif
|
|
6325 #ifdef FEAT_SYN_HL
|
|
6326 if (varp == &(curbuf->b_p_spl))
|
|
6327 {
|
|
6328 char_u fname[200];
|
|
6329
|
|
6330 /*
|
|
6331 * Source the spell/LANG.vim in 'runtimepath'.
|
|
6332 * They could set 'spellcapcheck' depending on the language.
|
|
6333 * Use the first name in 'spelllang' up to '_region' or
|
|
6334 * '.encoding'.
|
|
6335 */
|
|
6336 for (p = curbuf->b_p_spl; *p != NUL; ++p)
|
|
6337 if (vim_strchr((char_u *)"_.,", *p) != NULL)
|
|
6338 break;
|
|
6339 vim_snprintf((char *)fname, 200, "spell/%.*s.vim",
|
|
6340 (int)(p - curbuf->b_p_spl), curbuf->b_p_spl);
|
|
6341 source_runtime(fname, TRUE);
|
|
6342 }
|
|
6343 #endif
|
7
|
6344 }
|
|
6345
|
|
6346 #ifdef FEAT_MOUSE
|
|
6347 if (varp == &p_mouse)
|
|
6348 {
|
|
6349 # ifdef FEAT_MOUSE_TTY
|
|
6350 if (*p_mouse == NUL)
|
|
6351 mch_setmouse(FALSE); /* switch mouse off */
|
|
6352 else
|
|
6353 # endif
|
|
6354 setmouse(); /* in case 'mouse' changed */
|
|
6355 }
|
|
6356 #endif
|
|
6357
|
|
6358 if (curwin->w_curswant != MAXCOL)
|
|
6359 curwin->w_set_curswant = TRUE; /* in case 'showbreak' changed */
|
|
6360 check_redraw(options[opt_idx].flags);
|
|
6361
|
|
6362 return errmsg;
|
|
6363 }
|
|
6364
|
|
6365 /*
|
|
6366 * Handle setting 'listchars' or 'fillchars'.
|
|
6367 * Returns error message, NULL if it's OK.
|
|
6368 */
|
|
6369 static char_u *
|
|
6370 set_chars_option(varp)
|
|
6371 char_u **varp;
|
|
6372 {
|
|
6373 int round, i, len, entries;
|
|
6374 char_u *p, *s;
|
|
6375 int c1, c2 = 0;
|
|
6376 struct charstab
|
|
6377 {
|
|
6378 int *cp;
|
|
6379 char *name;
|
|
6380 };
|
|
6381 #if defined(FEAT_WINDOWS) || defined(FEAT_FOLDING)
|
|
6382 static struct charstab filltab[] =
|
|
6383 {
|
|
6384 {&fill_stl, "stl"},
|
|
6385 {&fill_stlnc, "stlnc"},
|
|
6386 {&fill_vert, "vert"},
|
|
6387 {&fill_fold, "fold"},
|
|
6388 {&fill_diff, "diff"},
|
|
6389 };
|
|
6390 #endif
|
|
6391 static struct charstab lcstab[] =
|
|
6392 {
|
|
6393 {&lcs_eol, "eol"},
|
|
6394 {&lcs_ext, "extends"},
|
12
|
6395 {&lcs_nbsp, "nbsp"},
|
7
|
6396 {&lcs_prec, "precedes"},
|
|
6397 {&lcs_tab2, "tab"},
|
|
6398 {&lcs_trail, "trail"},
|
|
6399 };
|
|
6400 struct charstab *tab;
|
|
6401
|
|
6402 #if defined(FEAT_WINDOWS) || defined(FEAT_FOLDING)
|
|
6403 if (varp == &p_lcs)
|
|
6404 #endif
|
|
6405 {
|
|
6406 tab = lcstab;
|
|
6407 entries = sizeof(lcstab) / sizeof(struct charstab);
|
|
6408 }
|
|
6409 #if defined(FEAT_WINDOWS) || defined(FEAT_FOLDING)
|
|
6410 else
|
|
6411 {
|
|
6412 tab = filltab;
|
|
6413 entries = sizeof(filltab) / sizeof(struct charstab);
|
|
6414 }
|
|
6415 #endif
|
|
6416
|
|
6417 /* first round: check for valid value, second round: assign values */
|
|
6418 for (round = 0; round <= 1; ++round)
|
|
6419 {
|
|
6420 if (round)
|
|
6421 {
|
|
6422 /* After checking that the value is valid: set defaults: space for
|
|
6423 * 'fillchars', NUL for 'listchars' */
|
|
6424 for (i = 0; i < entries; ++i)
|
|
6425 *(tab[i].cp) = (varp == &p_lcs ? NUL : ' ');
|
|
6426 if (varp == &p_lcs)
|
|
6427 lcs_tab1 = NUL;
|
|
6428 #if defined(FEAT_WINDOWS) || defined(FEAT_FOLDING)
|
|
6429 else
|
|
6430 fill_diff = '-';
|
|
6431 #endif
|
|
6432 }
|
|
6433 p = *varp;
|
|
6434 while (*p)
|
|
6435 {
|
|
6436 for (i = 0; i < entries; ++i)
|
|
6437 {
|
|
6438 len = (int)STRLEN(tab[i].name);
|
|
6439 if (STRNCMP(p, tab[i].name, len) == 0
|
|
6440 && p[len] == ':'
|
|
6441 && p[len + 1] != NUL)
|
|
6442 {
|
|
6443 s = p + len + 1;
|
|
6444 #ifdef FEAT_MBYTE
|
|
6445 c1 = mb_ptr2char_adv(&s);
|
|
6446 #else
|
|
6447 c1 = *s++;
|
|
6448 #endif
|
|
6449 if (tab[i].cp == &lcs_tab2)
|
|
6450 {
|
|
6451 if (*s == NUL)
|
|
6452 continue;
|
|
6453 #ifdef FEAT_MBYTE
|
|
6454 c2 = mb_ptr2char_adv(&s);
|
|
6455 #else
|
|
6456 c2 = *s++;
|
|
6457 #endif
|
|
6458 }
|
|
6459 if (*s == ',' || *s == NUL)
|
|
6460 {
|
|
6461 if (round)
|
|
6462 {
|
|
6463 if (tab[i].cp == &lcs_tab2)
|
|
6464 {
|
|
6465 lcs_tab1 = c1;
|
|
6466 lcs_tab2 = c2;
|
|
6467 }
|
|
6468 else
|
|
6469 *(tab[i].cp) = c1;
|
|
6470
|
|
6471 }
|
|
6472 p = s;
|
|
6473 break;
|
|
6474 }
|
|
6475 }
|
|
6476 }
|
|
6477
|
|
6478 if (i == entries)
|
|
6479 return e_invarg;
|
|
6480 if (*p == ',')
|
|
6481 ++p;
|
|
6482 }
|
|
6483 }
|
|
6484
|
|
6485 return NULL; /* no error */
|
|
6486 }
|
|
6487
|
|
6488 #ifdef FEAT_STL_OPT
|
|
6489 /*
|
|
6490 * Check validity of options with the 'statusline' format.
|
|
6491 * Return error message or NULL.
|
|
6492 */
|
|
6493 char_u *
|
|
6494 check_stl_option(s)
|
|
6495 char_u *s;
|
|
6496 {
|
|
6497 int itemcnt = 0;
|
|
6498 int groupdepth = 0;
|
|
6499 static char_u errbuf[80];
|
|
6500
|
|
6501 while (*s && itemcnt < STL_MAX_ITEM)
|
|
6502 {
|
|
6503 /* Check for valid keys after % sequences */
|
|
6504 while (*s && *s != '%')
|
|
6505 s++;
|
|
6506 if (!*s)
|
|
6507 break;
|
|
6508 s++;
|
|
6509 if (*s != '%' && *s != ')')
|
|
6510 ++itemcnt;
|
|
6511 if (*s == '%' || *s == STL_TRUNCMARK || *s == STL_MIDDLEMARK)
|
|
6512 {
|
|
6513 s++;
|
|
6514 continue;
|
|
6515 }
|
|
6516 if (*s == ')')
|
|
6517 {
|
|
6518 s++;
|
|
6519 if (--groupdepth < 0)
|
|
6520 break;
|
|
6521 continue;
|
|
6522 }
|
|
6523 if (*s == '-')
|
|
6524 s++;
|
|
6525 while (VIM_ISDIGIT(*s))
|
|
6526 s++;
|
|
6527 if (*s == STL_HIGHLIGHT)
|
|
6528 continue;
|
|
6529 if (*s == '.')
|
|
6530 {
|
|
6531 s++;
|
|
6532 while (*s && VIM_ISDIGIT(*s))
|
|
6533 s++;
|
|
6534 }
|
|
6535 if (*s == '(')
|
|
6536 {
|
|
6537 groupdepth++;
|
|
6538 continue;
|
|
6539 }
|
|
6540 if (vim_strchr(STL_ALL, *s) == NULL)
|
|
6541 {
|
|
6542 return illegal_char(errbuf, *s);
|
|
6543 }
|
|
6544 if (*s == '{')
|
|
6545 {
|
|
6546 s++;
|
|
6547 while (*s != '}' && *s)
|
|
6548 s++;
|
|
6549 if (*s != '}')
|
|
6550 return (char_u *)N_("E540: Unclosed expression sequence");
|
|
6551 }
|
|
6552 }
|
|
6553 if (itemcnt >= STL_MAX_ITEM)
|
|
6554 return (char_u *)N_("E541: too many items");
|
|
6555 if (groupdepth != 0)
|
|
6556 return (char_u *)N_("E542: unbalanced groups");
|
|
6557 return NULL;
|
|
6558 }
|
|
6559 #endif
|
|
6560
|
|
6561 #ifdef FEAT_CLIPBOARD
|
|
6562 /*
|
|
6563 * Extract the items in the 'clipboard' option and set global values.
|
|
6564 */
|
|
6565 static char_u *
|
|
6566 check_clipboard_option()
|
|
6567 {
|
|
6568 int new_unnamed = FALSE;
|
|
6569 int new_autoselect = FALSE;
|
|
6570 int new_autoselectml = FALSE;
|
|
6571 regprog_T *new_exclude_prog = NULL;
|
|
6572 char_u *errmsg = NULL;
|
|
6573 char_u *p;
|
|
6574
|
|
6575 for (p = p_cb; *p != NUL; )
|
|
6576 {
|
|
6577 if (STRNCMP(p, "unnamed", 7) == 0 && (p[7] == ',' || p[7] == NUL))
|
|
6578 {
|
|
6579 new_unnamed = TRUE;
|
|
6580 p += 7;
|
|
6581 }
|
|
6582 else if (STRNCMP(p, "autoselect", 10) == 0
|
|
6583 && (p[10] == ',' || p[10] == NUL))
|
|
6584 {
|
|
6585 new_autoselect = TRUE;
|
|
6586 p += 10;
|
|
6587 }
|
|
6588 else if (STRNCMP(p, "autoselectml", 12) == 0
|
|
6589 && (p[12] == ',' || p[12] == NUL))
|
|
6590 {
|
|
6591 new_autoselectml = TRUE;
|
|
6592 p += 12;
|
|
6593 }
|
|
6594 else if (STRNCMP(p, "exclude:", 8) == 0 && new_exclude_prog == NULL)
|
|
6595 {
|
|
6596 p += 8;
|
|
6597 new_exclude_prog = vim_regcomp(p, RE_MAGIC);
|
|
6598 if (new_exclude_prog == NULL)
|
|
6599 errmsg = e_invarg;
|
|
6600 break;
|
|
6601 }
|
|
6602 else
|
|
6603 {
|
|
6604 errmsg = e_invarg;
|
|
6605 break;
|
|
6606 }
|
|
6607 if (*p == ',')
|
|
6608 ++p;
|
|
6609 }
|
|
6610 if (errmsg == NULL)
|
|
6611 {
|
|
6612 clip_unnamed = new_unnamed;
|
|
6613 clip_autoselect = new_autoselect;
|
|
6614 clip_autoselectml = new_autoselectml;
|
|
6615 vim_free(clip_exclude_prog);
|
|
6616 clip_exclude_prog = new_exclude_prog;
|
|
6617 }
|
|
6618 else
|
|
6619 vim_free(new_exclude_prog);
|
|
6620
|
|
6621 return errmsg;
|
|
6622 }
|
|
6623 #endif
|
|
6624
|
386
|
6625 #ifdef FEAT_SYN_HL
|
|
6626 /*
|
|
6627 * Set curbuf->b_cap_prog to the regexp program for 'spellcapcheck'.
|
|
6628 * Return error message when failed, NULL when OK.
|
|
6629 */
|
|
6630 static char_u *
|
389
|
6631 compile_cap_prog(buf)
|
|
6632 buf_T *buf;
|
386
|
6633 {
|
389
|
6634 regprog_T *rp = buf->b_cap_prog;
|
582
|
6635 char_u *re;
|
389
|
6636
|
|
6637 if (*buf->b_p_spc == NUL)
|
|
6638 buf->b_cap_prog = NULL;
|
582
|
6639 else
|
|
6640 {
|
|
6641 /* Prepend a ^ so that we only match at one column */
|
|
6642 re = concat_str((char_u *)"^", buf->b_p_spc);
|
|
6643 if (re != NULL)
|
|
6644 {
|
|
6645 buf->b_cap_prog = vim_regcomp(re, RE_MAGIC);
|
|
6646 if (buf->b_cap_prog == NULL)
|
|
6647 {
|
|
6648 buf->b_cap_prog = rp; /* restore the previous program */
|
|
6649 return e_invarg;
|
|
6650 }
|
|
6651 vim_free(re);
|
|
6652 }
|
386
|
6653 }
|
|
6654
|
|
6655 vim_free(rp);
|
|
6656 return NULL;
|
|
6657 }
|
|
6658 #endif
|
|
6659
|
7
|
6660 /*
|
|
6661 * Set the value of a boolean option, and take care of side effects.
|
|
6662 * Returns NULL for success, or an error message for an error.
|
|
6663 */
|
|
6664 static char_u *
|
|
6665 set_bool_option(opt_idx, varp, value, opt_flags)
|
|
6666 int opt_idx; /* index in options[] table */
|
|
6667 char_u *varp; /* pointer to the option variable */
|
|
6668 int value; /* new value */
|
|
6669 int opt_flags; /* OPT_LOCAL and/or OPT_GLOBAL */
|
|
6670 {
|
|
6671 int old_value = *(int *)varp;
|
|
6672
|
|
6673 /* Disallow changing some options from secure mode */
|
|
6674 if ((secure
|
|
6675 #ifdef HAVE_SANDBOX
|
|
6676 || sandbox != 0
|
|
6677 #endif
|
|
6678 ) && (options[opt_idx].flags & P_SECURE))
|
|
6679 return e_secure;
|
|
6680
|
|
6681 *(int *)varp = value; /* set the new value */
|
|
6682 #ifdef FEAT_EVAL
|
|
6683 /* Remember where the option was set. */
|
|
6684 options[opt_idx].scriptID = current_SID;
|
|
6685 #endif
|
|
6686
|
634
|
6687 #ifdef FEAT_GUI
|
|
6688 need_mouse_correct = TRUE;
|
|
6689 #endif
|
|
6690
|
7
|
6691 /* May set global value for local option. */
|
|
6692 if ((opt_flags & (OPT_LOCAL | OPT_GLOBAL)) == 0)
|
|
6693 *(int *)get_varp_scope(&(options[opt_idx]), OPT_GLOBAL) = value;
|
|
6694
|
|
6695 /*
|
|
6696 * Handle side effects of changing a bool option.
|
|
6697 */
|
|
6698
|
|
6699 /* 'compatible' */
|
|
6700 if ((int *)varp == &p_cp)
|
|
6701 {
|
|
6702 compatible_set();
|
|
6703 }
|
|
6704
|
|
6705 else if ((int *)varp == &curbuf->b_p_ro)
|
|
6706 {
|
548
|
6707 /* when 'readonly' is reset globally, also reset readonlymode */
|
7
|
6708 if (!curbuf->b_p_ro && (opt_flags & OPT_LOCAL) == 0)
|
|
6709 readonlymode = FALSE;
|
548
|
6710
|
|
6711 /* when 'readonly' is set may give W10 again */
|
|
6712 if (curbuf->b_p_ro)
|
|
6713 curbuf->b_did_warn = FALSE;
|
|
6714
|
7
|
6715 #ifdef FEAT_TITLE
|
|
6716 need_maketitle = TRUE;
|
|
6717 #endif
|
|
6718 }
|
|
6719
|
|
6720 #ifdef FEAT_TITLE
|
|
6721 /* when 'modifiable' is changed, redraw the window title */
|
|
6722 else if ((int *)varp == &curbuf->b_p_ma)
|
|
6723 need_maketitle = TRUE;
|
|
6724 /* when 'endofline' is changed, redraw the window title */
|
|
6725 else if ((int *)varp == &curbuf->b_p_eol)
|
|
6726 need_maketitle = TRUE;
|
|
6727 #endif
|
|
6728
|
|
6729 /* when 'bin' is set also set some other options */
|
|
6730 else if ((int *)varp == &curbuf->b_p_bin)
|
|
6731 {
|
|
6732 set_options_bin(old_value, curbuf->b_p_bin, opt_flags);
|
|
6733 #ifdef FEAT_TITLE
|
|
6734 need_maketitle = TRUE;
|
|
6735 #endif
|
|
6736 }
|
|
6737
|
|
6738 #ifdef FEAT_AUTOCMD
|
|
6739 /* when 'buflisted' changes, trigger autocommands */
|
|
6740 else if ((int *)varp == &curbuf->b_p_bl && old_value != curbuf->b_p_bl)
|
|
6741 {
|
|
6742 apply_autocmds(curbuf->b_p_bl ? EVENT_BUFADD : EVENT_BUFDELETE,
|
|
6743 NULL, NULL, TRUE, curbuf);
|
|
6744 }
|
|
6745 #endif
|
|
6746
|
|
6747 /* when 'swf' is set, create swapfile, when reset remove swapfile */
|
|
6748 else if ((int *)varp == &curbuf->b_p_swf)
|
|
6749 {
|
|
6750 if (curbuf->b_p_swf && p_uc)
|
|
6751 ml_open_file(curbuf); /* create the swap file */
|
|
6752 else
|
|
6753 mf_close_file(curbuf, TRUE); /* remove the swap file */
|
|
6754 }
|
|
6755
|
|
6756 /* when 'terse' is set change 'shortmess' */
|
|
6757 else if ((int *)varp == &p_terse)
|
|
6758 {
|
|
6759 char_u *p;
|
|
6760
|
|
6761 p = vim_strchr(p_shm, SHM_SEARCH);
|
|
6762
|
|
6763 /* insert 's' in p_shm */
|
|
6764 if (p_terse && p == NULL)
|
|
6765 {
|
|
6766 STRCPY(IObuff, p_shm);
|
|
6767 STRCAT(IObuff, "s");
|
|
6768 set_string_option_direct((char_u *)"shm", -1, IObuff, OPT_FREE);
|
|
6769 }
|
|
6770 /* remove 's' from p_shm */
|
|
6771 else if (!p_terse && p != NULL)
|
|
6772 mch_memmove(p, p + 1, STRLEN(p));
|
|
6773 }
|
|
6774
|
|
6775 /* when 'paste' is set or reset also change other options */
|
|
6776 else if ((int *)varp == &p_paste)
|
|
6777 {
|
|
6778 paste_option_changed();
|
|
6779 }
|
|
6780
|
|
6781 /* when 'insertmode' is set from an autocommand need to do work here */
|
|
6782 else if ((int *)varp == &p_im)
|
|
6783 {
|
|
6784 if (p_im)
|
|
6785 {
|
|
6786 if ((State & INSERT) == 0)
|
|
6787 need_start_insertmode = TRUE;
|
|
6788 stop_insert_mode = FALSE;
|
|
6789 }
|
|
6790 else
|
|
6791 {
|
|
6792 need_start_insertmode = FALSE;
|
|
6793 stop_insert_mode = TRUE;
|
644
|
6794 if (restart_edit != 0 && mode_displayed)
|
7
|
6795 clear_cmdline = TRUE; /* remove "(insert)" */
|
|
6796 restart_edit = 0;
|
|
6797 }
|
|
6798 }
|
|
6799
|
|
6800 /* when 'ignorecase' is set or reset and 'hlsearch' is set, redraw */
|
|
6801 else if ((int *)varp == &p_ic && p_hls)
|
|
6802 {
|
|
6803 redraw_all_later(NOT_VALID);
|
|
6804 }
|
|
6805
|
|
6806 #ifdef FEAT_SEARCH_EXTRA
|
|
6807 /* when 'hlsearch' is set or reset: reset no_hlsearch */
|
|
6808 else if ((int *)varp == &p_hls)
|
|
6809 {
|
|
6810 no_hlsearch = FALSE;
|
|
6811 }
|
|
6812 #endif
|
|
6813
|
|
6814 #ifdef FEAT_SCROLLBIND
|
|
6815 /* when 'scrollbind' is set: snapshot the current position to avoid a jump
|
|
6816 * at the end of normal_cmd() */
|
|
6817 else if ((int *)varp == &curwin->w_p_scb)
|
|
6818 {
|
|
6819 if (curwin->w_p_scb)
|
|
6820 do_check_scrollbind(FALSE);
|
|
6821 }
|
|
6822 #endif
|
|
6823
|
|
6824 #if defined(FEAT_WINDOWS) && defined(FEAT_QUICKFIX)
|
|
6825 /* There can be only one window with 'previewwindow' set. */
|
|
6826 else if ((int *)varp == &curwin->w_p_pvw)
|
|
6827 {
|
|
6828 if (curwin->w_p_pvw)
|
|
6829 {
|
|
6830 win_T *win;
|
|
6831
|
|
6832 for (win = firstwin; win != NULL; win = win->w_next)
|
|
6833 if (win->w_p_pvw && win != curwin)
|
|
6834 {
|
|
6835 curwin->w_p_pvw = FALSE;
|
|
6836 return (char_u *)N_("E590: A preview window already exists");
|
|
6837 }
|
|
6838 }
|
|
6839 }
|
|
6840 #endif
|
|
6841
|
|
6842 /* when 'textmode' is set or reset also change 'fileformat' */
|
|
6843 else if ((int *)varp == &curbuf->b_p_tx)
|
|
6844 {
|
|
6845 set_fileformat(curbuf->b_p_tx ? EOL_DOS : EOL_UNIX, opt_flags);
|
|
6846 }
|
|
6847
|
|
6848 /* when 'textauto' is set or reset also change 'fileformats' */
|
|
6849 else if ((int *)varp == &p_ta)
|
|
6850 {
|
|
6851 set_string_option_direct((char_u *)"ffs", -1,
|
|
6852 p_ta ? (char_u *)DFLT_FFS_VIM : (char_u *)"",
|
|
6853 OPT_FREE | opt_flags);
|
|
6854 }
|
|
6855
|
|
6856 /*
|
|
6857 * When 'lisp' option changes include/exclude '-' in
|
|
6858 * keyword characters.
|
|
6859 */
|
|
6860 #ifdef FEAT_LISP
|
|
6861 else if (varp == (char_u *)&(curbuf->b_p_lisp))
|
|
6862 {
|
|
6863 (void)buf_init_chartab(curbuf, FALSE); /* ignore errors */
|
|
6864 }
|
|
6865 #endif
|
|
6866
|
|
6867 #ifdef FEAT_TITLE
|
|
6868 /* when 'title' changed, may need to change the title; same for 'icon' */
|
|
6869 else if ((int *)varp == &p_title)
|
|
6870 {
|
|
6871 did_set_title(FALSE);
|
|
6872 }
|
|
6873
|
|
6874 else if ((int *)varp == &p_icon)
|
|
6875 {
|
|
6876 did_set_title(TRUE);
|
|
6877 }
|
|
6878 #endif
|
|
6879
|
|
6880 else if ((int *)varp == &curbuf->b_changed)
|
|
6881 {
|
|
6882 if (!value)
|
|
6883 save_file_ff(curbuf); /* Buffer is unchanged */
|
|
6884 #ifdef FEAT_TITLE
|
|
6885 need_maketitle = TRUE;
|
|
6886 #endif
|
|
6887 #ifdef FEAT_AUTOCMD
|
|
6888 modified_was_set = value;
|
|
6889 #endif
|
|
6890 }
|
|
6891
|
|
6892 #ifdef BACKSLASH_IN_FILENAME
|
|
6893 else if ((int *)varp == &p_ssl)
|
|
6894 {
|
|
6895 if (p_ssl)
|
|
6896 {
|
|
6897 psepc = '/';
|
|
6898 psepcN = '\\';
|
|
6899 pseps[0] = '/';
|
|
6900 }
|
|
6901 else
|
|
6902 {
|
|
6903 psepc = '\\';
|
|
6904 psepcN = '/';
|
|
6905 pseps[0] = '\\';
|
|
6906 }
|
|
6907
|
|
6908 /* need to adjust the file name arguments and buffer names. */
|
|
6909 buflist_slash_adjust();
|
|
6910 alist_slash_adjust();
|
|
6911 # ifdef FEAT_EVAL
|
|
6912 scriptnames_slash_adjust();
|
|
6913 # endif
|
|
6914 }
|
|
6915 #endif
|
|
6916
|
|
6917 /* If 'wrap' is set, set w_leftcol to zero. */
|
|
6918 else if ((int *)varp == &curwin->w_p_wrap)
|
|
6919 {
|
|
6920 if (curwin->w_p_wrap)
|
|
6921 curwin->w_leftcol = 0;
|
|
6922 }
|
|
6923
|
|
6924 #ifdef FEAT_WINDOWS
|
|
6925 else if ((int *)varp == &p_ea)
|
|
6926 {
|
|
6927 if (p_ea && !old_value)
|
|
6928 win_equal(curwin, FALSE, 0);
|
|
6929 }
|
|
6930 #endif
|
|
6931
|
|
6932 else if ((int *)varp == &p_wiv)
|
|
6933 {
|
|
6934 /*
|
|
6935 * When 'weirdinvert' changed, set/reset 't_xs'.
|
|
6936 * Then set 'weirdinvert' according to value of 't_xs'.
|
|
6937 */
|
|
6938 if (p_wiv && !old_value)
|
|
6939 T_XS = (char_u *)"y";
|
|
6940 else if (!p_wiv && old_value)
|
|
6941 T_XS = empty_option;
|
|
6942 p_wiv = (*T_XS != NUL);
|
|
6943 }
|
|
6944
|
190
|
6945 #ifdef FEAT_BEVAL
|
7
|
6946 else if ((int *)varp == &p_beval)
|
|
6947 {
|
|
6948 if (p_beval == TRUE)
|
|
6949 gui_mch_enable_beval_area(balloonEval);
|
|
6950 else
|
|
6951 gui_mch_disable_beval_area(balloonEval);
|
|
6952 }
|
|
6953
|
190
|
6954 # if defined(FEAT_NETBEANS_INTG) || defined(FEAT_SUN_WORKSHOP)
|
7
|
6955 else if ((int *)varp == &p_acd)
|
|
6956 {
|
|
6957 if (p_acd && curbuf->b_ffname != NULL
|
|
6958 && vim_chdirfile(curbuf->b_ffname) == OK)
|
|
6959 shorten_fnames(TRUE);
|
|
6960 }
|
190
|
6961 # endif
|
7
|
6962 #endif
|
|
6963
|
|
6964 #ifdef FEAT_DIFF
|
|
6965 /* 'diff' */
|
|
6966 else if ((int *)varp == &curwin->w_p_diff)
|
|
6967 {
|
16
|
6968 /* May add or remove the buffer from the list of diff buffers. */
|
|
6969 diff_buf_adjust(curwin);
|
|
6970 # ifdef FEAT_FOLDING
|
7
|
6971 if (foldmethodIsDiff(curwin))
|
|
6972 foldUpdateAll(curwin);
|
16
|
6973 # endif
|
7
|
6974 }
|
|
6975 #endif
|
|
6976
|
|
6977 #ifdef USE_IM_CONTROL
|
|
6978 /* 'imdisable' */
|
|
6979 else if ((int *)varp == &p_imdisable)
|
|
6980 {
|
|
6981 /* Only de-activate it here, it will be enabled when changing mode. */
|
|
6982 if (p_imdisable)
|
|
6983 im_set_active(FALSE);
|
|
6984 }
|
|
6985 #endif
|
|
6986
|
258
|
6987 #ifdef FEAT_SYN_HL
|
|
6988 /* 'spell' */
|
|
6989 else if ((int *)varp == &curwin->w_p_spell)
|
|
6990 {
|
|
6991 if (curwin->w_p_spell)
|
|
6992 {
|
|
6993 char_u *errmsg = did_set_spelllang(curbuf);
|
320
|
6994
|
258
|
6995 if (errmsg != NULL)
|
|
6996 EMSG(_(errmsg));
|
|
6997 }
|
|
6998 }
|
|
6999 #endif
|
|
7000
|
7
|
7001 #ifdef FEAT_FKMAP
|
|
7002 else if ((int *)varp == &p_altkeymap)
|
|
7003 {
|
|
7004 if (old_value != p_altkeymap)
|
|
7005 {
|
|
7006 if (!p_altkeymap)
|
|
7007 {
|
|
7008 p_hkmap = p_fkmap;
|
|
7009 p_fkmap = 0;
|
|
7010 }
|
|
7011 else
|
|
7012 {
|
|
7013 p_fkmap = p_hkmap;
|
|
7014 p_hkmap = 0;
|
|
7015 }
|
|
7016 (void)init_chartab();
|
|
7017 }
|
|
7018 }
|
|
7019
|
|
7020 /*
|
|
7021 * In case some second language keymapping options have changed, check
|
|
7022 * and correct the setting in a consistent way.
|
|
7023 */
|
|
7024
|
|
7025 /*
|
|
7026 * If hkmap or fkmap are set, reset Arabic keymapping.
|
|
7027 */
|
|
7028 if ((p_hkmap || p_fkmap) && p_altkeymap)
|
|
7029 {
|
|
7030 p_altkeymap = p_fkmap;
|
|
7031 # ifdef FEAT_ARABIC
|
|
7032 curwin->w_p_arab = FALSE;
|
|
7033 # endif
|
|
7034 (void)init_chartab();
|
|
7035 }
|
|
7036
|
|
7037 /*
|
|
7038 * If hkmap set, reset Farsi keymapping.
|
|
7039 */
|
|
7040 if (p_hkmap && p_altkeymap)
|
|
7041 {
|
|
7042 p_altkeymap = 0;
|
|
7043 p_fkmap = 0;
|
|
7044 # ifdef FEAT_ARABIC
|
|
7045 curwin->w_p_arab = FALSE;
|
|
7046 # endif
|
|
7047 (void)init_chartab();
|
|
7048 }
|
|
7049
|
|
7050 /*
|
|
7051 * If fkmap set, reset Hebrew keymapping.
|
|
7052 */
|
|
7053 if (p_fkmap && !p_altkeymap)
|
|
7054 {
|
|
7055 p_altkeymap = 1;
|
|
7056 p_hkmap = 0;
|
|
7057 # ifdef FEAT_ARABIC
|
|
7058 curwin->w_p_arab = FALSE;
|
|
7059 # endif
|
|
7060 (void)init_chartab();
|
|
7061 }
|
|
7062 #endif
|
|
7063
|
|
7064 #ifdef FEAT_ARABIC
|
|
7065 if ((int *)varp == &curwin->w_p_arab)
|
|
7066 {
|
|
7067 if (curwin->w_p_arab)
|
|
7068 {
|
|
7069 /*
|
|
7070 * 'arabic' is set, handle various sub-settings.
|
|
7071 */
|
|
7072 if (!p_tbidi)
|
|
7073 {
|
|
7074 /* set rightleft mode */
|
|
7075 if (!curwin->w_p_rl)
|
|
7076 {
|
|
7077 curwin->w_p_rl = TRUE;
|
|
7078 changed_window_setting();
|
|
7079 }
|
|
7080
|
|
7081 /* Enable Arabic shaping (major part of what Arabic requires) */
|
|
7082 if (!p_arshape)
|
|
7083 {
|
|
7084 p_arshape = TRUE;
|
|
7085 redraw_later_clear();
|
|
7086 }
|
|
7087 }
|
|
7088
|
|
7089 /* Arabic requires a utf-8 encoding, inform the user if its not
|
|
7090 * set. */
|
|
7091 if (STRCMP(p_enc, "utf-8") != 0)
|
16
|
7092 {
|
|
7093 msg_source(hl_attr(HLF_W));
|
7
|
7094 MSG_ATTR(_("W17: Arabic requires UTF-8, do ':set encoding=utf-8'"),
|
|
7095 hl_attr(HLF_W));
|
16
|
7096 }
|
7
|
7097
|
|
7098 # ifdef FEAT_MBYTE
|
|
7099 /* set 'delcombine' */
|
|
7100 p_deco = TRUE;
|
|
7101 # endif
|
|
7102
|
|
7103 # ifdef FEAT_KEYMAP
|
|
7104 /* Force-set the necessary keymap for arabic */
|
|
7105 set_option_value((char_u *)"keymap", 0L, (char_u *)"arabic",
|
|
7106 OPT_LOCAL);
|
|
7107 # endif
|
|
7108 # ifdef FEAT_FKMAP
|
|
7109 p_altkeymap = 0;
|
|
7110 p_hkmap = 0;
|
|
7111 p_fkmap = 0;
|
|
7112 (void)init_chartab();
|
|
7113 # endif
|
|
7114 }
|
|
7115 else
|
|
7116 {
|
|
7117 /*
|
|
7118 * 'arabic' is reset, handle various sub-settings.
|
|
7119 */
|
|
7120 if (!p_tbidi)
|
|
7121 {
|
|
7122 /* reset rightleft mode */
|
|
7123 if (curwin->w_p_rl)
|
|
7124 {
|
|
7125 curwin->w_p_rl = FALSE;
|
|
7126 changed_window_setting();
|
|
7127 }
|
|
7128
|
|
7129 /* 'arabicshape' isn't reset, it is a global option and
|
|
7130 * another window may still need it "on". */
|
|
7131 }
|
|
7132
|
|
7133 /* 'delcombine' isn't reset, it is a global option and another
|
|
7134 * window may still want it "on". */
|
|
7135
|
|
7136 # ifdef FEAT_KEYMAP
|
|
7137 /* Revert to the default keymap */
|
|
7138 curbuf->b_p_iminsert = B_IMODE_NONE;
|
|
7139 curbuf->b_p_imsearch = B_IMODE_USE_INSERT;
|
|
7140 # endif
|
|
7141 }
|
|
7142 }
|
|
7143 #endif
|
|
7144
|
|
7145 /*
|
|
7146 * End of handling side effects for bool options.
|
|
7147 */
|
|
7148
|
|
7149 options[opt_idx].flags |= P_WAS_SET;
|
|
7150
|
|
7151 comp_col(); /* in case 'ruler' or 'showcmd' changed */
|
|
7152 if (curwin->w_curswant != MAXCOL)
|
|
7153 curwin->w_set_curswant = TRUE; /* in case 'list' changed */
|
|
7154 check_redraw(options[opt_idx].flags);
|
|
7155
|
|
7156 return NULL;
|
|
7157 }
|
|
7158
|
|
7159 /*
|
|
7160 * Set the value of a number option, and take care of side effects.
|
|
7161 * Returns NULL for success, or an error message for an error.
|
|
7162 */
|
|
7163 static char_u *
|
274
|
7164 set_num_option(opt_idx, varp, value, errbuf, errbuflen, opt_flags)
|
7
|
7165 int opt_idx; /* index in options[] table */
|
|
7166 char_u *varp; /* pointer to the option variable */
|
|
7167 long value; /* new value */
|
|
7168 char_u *errbuf; /* buffer for error messages */
|
274
|
7169 size_t errbuflen; /* length of "errbuf" */
|
7
|
7170 int opt_flags; /* OPT_LOCAL, OPT_GLOBAL and
|
|
7171 OPT_MODELINE */
|
|
7172 {
|
|
7173 char_u *errmsg = NULL;
|
|
7174 long old_value = *(long *)varp;
|
|
7175 long old_Rows = Rows; /* remember old Rows */
|
|
7176 long old_Columns = Columns; /* remember old Columns */
|
|
7177 long *pp = (long *)varp;
|
|
7178
|
634
|
7179 /* Disallow changing some options from secure mode. */
|
|
7180 if ((secure
|
|
7181 #ifdef HAVE_SANDBOX
|
|
7182 || sandbox != 0
|
|
7183 #endif
|
|
7184 ) && (options[opt_idx].flags & P_SECURE))
|
|
7185 return e_secure;
|
7
|
7186
|
|
7187 *pp = value;
|
|
7188 #ifdef FEAT_EVAL
|
|
7189 /* Remember where the option was set. */
|
|
7190 options[opt_idx].scriptID = current_SID;
|
|
7191 #endif
|
634
|
7192 #ifdef FEAT_GUI
|
|
7193 need_mouse_correct = TRUE;
|
|
7194 #endif
|
7
|
7195
|
|
7196 if (curbuf->b_p_sw <= 0)
|
|
7197 {
|
|
7198 errmsg = e_positive;
|
|
7199 curbuf->b_p_sw = curbuf->b_p_ts;
|
|
7200 }
|
|
7201
|
|
7202 /*
|
|
7203 * Number options that need some action when changed
|
|
7204 */
|
|
7205 #ifdef FEAT_WINDOWS
|
|
7206 if (pp == &p_wh || pp == &p_hh)
|
|
7207 {
|
|
7208 if (p_wh < 1)
|
|
7209 {
|
|
7210 errmsg = e_positive;
|
|
7211 p_wh = 1;
|
|
7212 }
|
|
7213 if (p_wmh > p_wh)
|
|
7214 {
|
|
7215 errmsg = e_winheight;
|
|
7216 p_wh = p_wmh;
|
|
7217 }
|
|
7218 if (p_hh < 0)
|
|
7219 {
|
|
7220 errmsg = e_positive;
|
|
7221 p_hh = 0;
|
|
7222 }
|
|
7223
|
|
7224 /* Change window height NOW */
|
|
7225 if (lastwin != firstwin)
|
|
7226 {
|
|
7227 if (pp == &p_wh && curwin->w_height < p_wh)
|
|
7228 win_setheight((int)p_wh);
|
|
7229 if (pp == &p_hh && curbuf->b_help && curwin->w_height < p_hh)
|
|
7230 win_setheight((int)p_hh);
|
|
7231 }
|
|
7232 }
|
|
7233
|
|
7234 /* 'winminheight' */
|
|
7235 else if (pp == &p_wmh)
|
|
7236 {
|
|
7237 if (p_wmh < 0)
|
|
7238 {
|
|
7239 errmsg = e_positive;
|
|
7240 p_wmh = 0;
|
|
7241 }
|
|
7242 if (p_wmh > p_wh)
|
|
7243 {
|
|
7244 errmsg = e_winheight;
|
|
7245 p_wmh = p_wh;
|
|
7246 }
|
|
7247 win_setminheight();
|
|
7248 }
|
|
7249
|
|
7250 # ifdef FEAT_VERTSPLIT
|
13
|
7251 else if (pp == &p_wiw)
|
7
|
7252 {
|
|
7253 if (p_wiw < 1)
|
|
7254 {
|
|
7255 errmsg = e_positive;
|
|
7256 p_wiw = 1;
|
|
7257 }
|
|
7258 if (p_wmw > p_wiw)
|
|
7259 {
|
|
7260 errmsg = e_winwidth;
|
|
7261 p_wiw = p_wmw;
|
|
7262 }
|
|
7263
|
|
7264 /* Change window width NOW */
|
|
7265 if (lastwin != firstwin && curwin->w_width < p_wiw)
|
|
7266 win_setwidth((int)p_wiw);
|
|
7267 }
|
|
7268
|
|
7269 /* 'winminwidth' */
|
|
7270 else if (pp == &p_wmw)
|
|
7271 {
|
|
7272 if (p_wmw < 0)
|
|
7273 {
|
|
7274 errmsg = e_positive;
|
|
7275 p_wmw = 0;
|
|
7276 }
|
|
7277 if (p_wmw > p_wiw)
|
|
7278 {
|
|
7279 errmsg = e_winwidth;
|
|
7280 p_wmw = p_wiw;
|
|
7281 }
|
|
7282 win_setminheight();
|
|
7283 }
|
|
7284 # endif
|
|
7285
|
|
7286 #endif
|
|
7287
|
|
7288 #ifdef FEAT_WINDOWS
|
|
7289 /* (re)set last window status line */
|
|
7290 else if (pp == &p_ls)
|
|
7291 {
|
|
7292 last_status(FALSE);
|
|
7293 }
|
670
|
7294
|
|
7295 /* (re)set tab page line */
|
677
|
7296 else if (pp == &p_stal)
|
670
|
7297 {
|
|
7298 shell_new_rows(); /* recompute window positions and heights */
|
|
7299 }
|
7
|
7300 #endif
|
|
7301
|
|
7302 #ifdef FEAT_GUI
|
|
7303 else if (pp == &p_linespace)
|
|
7304 {
|
444
|
7305 /* Recompute gui.char_height and resize the Vim window to keep the
|
|
7306 * same number of lines. */
|
|
7307 if (gui.in_use && gui_mch_adjust_charheight() == OK)
|
7
|
7308 gui_set_shellsize(FALSE, FALSE);
|
|
7309 }
|
|
7310 #endif
|
|
7311
|
|
7312 #ifdef FEAT_FOLDING
|
|
7313 /* 'foldlevel' */
|
|
7314 else if (pp == &curwin->w_p_fdl)
|
|
7315 {
|
|
7316 if (curwin->w_p_fdl < 0)
|
|
7317 curwin->w_p_fdl = 0;
|
|
7318 newFoldLevel();
|
|
7319 }
|
|
7320
|
|
7321 /* 'foldminlevel' */
|
|
7322 else if (pp == &curwin->w_p_fml)
|
|
7323 {
|
|
7324 foldUpdateAll(curwin);
|
|
7325 }
|
|
7326
|
|
7327 /* 'foldnestmax' */
|
|
7328 else if (pp == &curwin->w_p_fdn)
|
|
7329 {
|
|
7330 if (foldmethodIsSyntax(curwin) || foldmethodIsIndent(curwin))
|
|
7331 foldUpdateAll(curwin);
|
|
7332 }
|
|
7333
|
|
7334 /* 'foldcolumn' */
|
|
7335 else if (pp == &curwin->w_p_fdc)
|
|
7336 {
|
|
7337 if (curwin->w_p_fdc < 0)
|
|
7338 {
|
|
7339 errmsg = e_positive;
|
|
7340 curwin->w_p_fdc = 0;
|
|
7341 }
|
|
7342 else if (curwin->w_p_fdc > 12)
|
|
7343 {
|
|
7344 errmsg = e_invarg;
|
|
7345 curwin->w_p_fdc = 12;
|
|
7346 }
|
|
7347 }
|
|
7348
|
|
7349 /* 'shiftwidth' or 'tabstop' */
|
|
7350 else if (pp == &curbuf->b_p_sw || pp == &curbuf->b_p_ts)
|
|
7351 {
|
|
7352 if (foldmethodIsIndent(curwin))
|
|
7353 foldUpdateAll(curwin);
|
|
7354 }
|
|
7355 #endif /* FEAT_FOLDING */
|
|
7356
|
|
7357 else if (pp == &curbuf->b_p_iminsert)
|
|
7358 {
|
|
7359 if (curbuf->b_p_iminsert < 0 || curbuf->b_p_iminsert > B_IMODE_LAST)
|
|
7360 {
|
|
7361 errmsg = e_invarg;
|
|
7362 curbuf->b_p_iminsert = B_IMODE_NONE;
|
|
7363 }
|
|
7364 p_iminsert = curbuf->b_p_iminsert;
|
|
7365 if (termcap_active) /* don't do this in the alternate screen */
|
|
7366 showmode();
|
|
7367 #if defined(FEAT_WINDOWS) && defined(FEAT_KEYMAP)
|
|
7368 /* Show/unshow value of 'keymap' in status lines. */
|
|
7369 status_redraw_curbuf();
|
|
7370 #endif
|
|
7371 }
|
|
7372
|
164
|
7373 else if (pp == &p_window)
|
|
7374 {
|
|
7375 if (p_window < 1)
|
|
7376 p_window = 1;
|
|
7377 else if (p_window >= Rows)
|
|
7378 p_window = Rows - 1;
|
|
7379 }
|
|
7380
|
7
|
7381 else if (pp == &curbuf->b_p_imsearch)
|
|
7382 {
|
|
7383 if (curbuf->b_p_imsearch < -1 || curbuf->b_p_imsearch > B_IMODE_LAST)
|
|
7384 {
|
|
7385 errmsg = e_invarg;
|
|
7386 curbuf->b_p_imsearch = B_IMODE_NONE;
|
|
7387 }
|
|
7388 p_imsearch = curbuf->b_p_imsearch;
|
|
7389 }
|
|
7390
|
|
7391 #ifdef FEAT_TITLE
|
|
7392 /* if 'titlelen' has changed, redraw the title */
|
|
7393 else if (pp == &p_titlelen)
|
|
7394 {
|
|
7395 if (p_titlelen < 0)
|
|
7396 {
|
|
7397 errmsg = e_positive;
|
|
7398 p_titlelen = 85;
|
|
7399 }
|
|
7400 if (starting != NO_SCREEN && old_value != p_titlelen)
|
|
7401 need_maketitle = TRUE;
|
|
7402 }
|
|
7403 #endif
|
|
7404
|
|
7405 /* if p_ch changed value, change the command line height */
|
|
7406 else if (pp == &p_ch)
|
|
7407 {
|
|
7408 if (p_ch < 1)
|
|
7409 {
|
|
7410 errmsg = e_positive;
|
|
7411 p_ch = 1;
|
|
7412 }
|
|
7413
|
|
7414 /* Only compute the new window layout when startup has been
|
|
7415 * completed. Otherwise the frame sizes may be wrong. */
|
|
7416 if (p_ch != old_value && full_screen
|
|
7417 #ifdef FEAT_GUI
|
|
7418 && !gui.starting
|
|
7419 #endif
|
|
7420 )
|
|
7421 command_height(old_value);
|
|
7422 }
|
|
7423
|
|
7424 /* when 'updatecount' changes from zero to non-zero, open swap files */
|
|
7425 else if (pp == &p_uc)
|
|
7426 {
|
|
7427 if (p_uc < 0)
|
|
7428 {
|
|
7429 errmsg = e_positive;
|
|
7430 p_uc = 100;
|
|
7431 }
|
|
7432 if (p_uc && !old_value)
|
|
7433 ml_open_files();
|
|
7434 }
|
16
|
7435 #ifdef MZSCHEME_GUI_THREADS
|
14
|
7436 else if (pp == &p_mzq)
|
|
7437 mzvim_reset_timer();
|
|
7438 #endif
|
7
|
7439
|
|
7440 /* sync undo before 'undolevels' changes */
|
|
7441 else if (pp == &p_ul)
|
|
7442 {
|
|
7443 /* use the old value, otherwise u_sync() may not work properly */
|
|
7444 p_ul = old_value;
|
|
7445 u_sync();
|
|
7446 p_ul = value;
|
|
7447 }
|
|
7448
|
13
|
7449 #ifdef FEAT_LINEBREAK
|
|
7450 /* 'numberwidth' must be positive */
|
|
7451 else if (pp == &curwin->w_p_nuw)
|
|
7452 {
|
|
7453 if (curwin->w_p_nuw < 1)
|
|
7454 {
|
|
7455 errmsg = e_positive;
|
|
7456 curwin->w_p_nuw = 1;
|
|
7457 }
|
|
7458 if (curwin->w_p_nuw > 10)
|
|
7459 {
|
|
7460 errmsg = e_invarg;
|
|
7461 curwin->w_p_nuw = 10;
|
|
7462 }
|
|
7463 curwin->w_nrwidth_line_count = 0;
|
|
7464 }
|
|
7465 #endif
|
|
7466
|
7
|
7467 /*
|
|
7468 * Check the bounds for numeric options here
|
|
7469 */
|
|
7470 if (Rows < min_rows() && full_screen)
|
|
7471 {
|
|
7472 if (errbuf != NULL)
|
|
7473 {
|
274
|
7474 vim_snprintf((char *)errbuf, errbuflen,
|
|
7475 _("E593: Need at least %d lines"), min_rows());
|
7
|
7476 errmsg = errbuf;
|
|
7477 }
|
|
7478 Rows = min_rows();
|
|
7479 }
|
|
7480 if (Columns < MIN_COLUMNS && full_screen)
|
|
7481 {
|
|
7482 if (errbuf != NULL)
|
|
7483 {
|
274
|
7484 vim_snprintf((char *)errbuf, errbuflen,
|
|
7485 _("E594: Need at least %d columns"), MIN_COLUMNS);
|
7
|
7486 errmsg = errbuf;
|
|
7487 }
|
|
7488 Columns = MIN_COLUMNS;
|
|
7489 }
|
534
|
7490 /* Limit the values to avoid an overflow in Rows * Columns. */
|
|
7491 if (Columns > 10000)
|
|
7492 Columns = 10000;
|
|
7493 if (Rows > 1000)
|
|
7494 Rows = 1000;
|
7
|
7495
|
|
7496 #ifdef DJGPP
|
|
7497 /* avoid a crash by checking for a too large value of 'columns' */
|
|
7498 if (old_Columns != Columns && full_screen && term_console)
|
|
7499 mch_check_columns();
|
|
7500 #endif
|
|
7501
|
|
7502 /*
|
|
7503 * If the screen (shell) height has been changed, assume it is the
|
|
7504 * physical screenheight.
|
|
7505 */
|
|
7506 if (old_Rows != Rows || old_Columns != Columns)
|
|
7507 {
|
|
7508 /* Changing the screen size is not allowed while updating the screen. */
|
|
7509 if (updating_screen)
|
|
7510 *pp = old_value;
|
|
7511 else if (full_screen
|
|
7512 #ifdef FEAT_GUI
|
|
7513 && !gui.starting
|
|
7514 #endif
|
|
7515 )
|
|
7516 set_shellsize((int)Columns, (int)Rows, TRUE);
|
|
7517 else
|
|
7518 {
|
|
7519 /* Postpone the resizing; check the size and cmdline position for
|
|
7520 * messages. */
|
|
7521 check_shellsize();
|
|
7522 if (cmdline_row > Rows - p_ch && Rows > p_ch)
|
|
7523 cmdline_row = Rows - p_ch;
|
|
7524 }
|
164
|
7525 if (p_window >= Rows)
|
|
7526 p_window = Rows - 1;
|
7
|
7527 }
|
|
7528
|
|
7529 if (curbuf->b_p_sts < 0)
|
|
7530 {
|
|
7531 errmsg = e_positive;
|
|
7532 curbuf->b_p_sts = 0;
|
|
7533 }
|
|
7534 if (curbuf->b_p_ts <= 0)
|
|
7535 {
|
|
7536 errmsg = e_positive;
|
|
7537 curbuf->b_p_ts = 8;
|
|
7538 }
|
|
7539 if (curbuf->b_p_tw < 0)
|
|
7540 {
|
|
7541 errmsg = e_positive;
|
|
7542 curbuf->b_p_tw = 0;
|
|
7543 }
|
|
7544 if (p_tm < 0)
|
|
7545 {
|
|
7546 errmsg = e_positive;
|
|
7547 p_tm = 0;
|
|
7548 }
|
|
7549 if ((curwin->w_p_scr <= 0
|
|
7550 || (curwin->w_p_scr > curwin->w_height
|
|
7551 && curwin->w_height > 0))
|
|
7552 && full_screen)
|
|
7553 {
|
|
7554 if (pp == &(curwin->w_p_scr))
|
|
7555 {
|
|
7556 if (curwin->w_p_scr != 0)
|
|
7557 errmsg = e_scroll;
|
|
7558 win_comp_scroll(curwin);
|
|
7559 }
|
|
7560 /* If 'scroll' became invalid because of a side effect silently adjust
|
|
7561 * it. */
|
|
7562 else if (curwin->w_p_scr <= 0)
|
|
7563 curwin->w_p_scr = 1;
|
|
7564 else /* curwin->w_p_scr > curwin->w_height */
|
|
7565 curwin->w_p_scr = curwin->w_height;
|
|
7566 }
|
|
7567 if (p_report < 0)
|
|
7568 {
|
|
7569 errmsg = e_positive;
|
|
7570 p_report = 1;
|
|
7571 }
|
532
|
7572 if ((p_sj < -100 || p_sj >= Rows) && full_screen)
|
7
|
7573 {
|
|
7574 if (Rows != old_Rows) /* Rows changed, just adjust p_sj */
|
|
7575 p_sj = Rows / 2;
|
|
7576 else
|
|
7577 {
|
|
7578 errmsg = e_scroll;
|
|
7579 p_sj = 1;
|
|
7580 }
|
|
7581 }
|
|
7582 if (p_so < 0 && full_screen)
|
|
7583 {
|
|
7584 errmsg = e_scroll;
|
|
7585 p_so = 0;
|
|
7586 }
|
|
7587 if (p_siso < 0 && full_screen)
|
|
7588 {
|
|
7589 errmsg = e_positive;
|
|
7590 p_siso = 0;
|
|
7591 }
|
|
7592 #ifdef FEAT_CMDWIN
|
|
7593 if (p_cwh < 1)
|
|
7594 {
|
|
7595 errmsg = e_positive;
|
|
7596 p_cwh = 1;
|
|
7597 }
|
|
7598 #endif
|
|
7599 if (p_ut < 0)
|
|
7600 {
|
|
7601 errmsg = e_positive;
|
|
7602 p_ut = 2000;
|
|
7603 }
|
|
7604 if (p_ss < 0)
|
|
7605 {
|
|
7606 errmsg = e_positive;
|
|
7607 p_ss = 0;
|
|
7608 }
|
|
7609
|
|
7610 /* May set global value for local option. */
|
|
7611 if ((opt_flags & (OPT_LOCAL | OPT_GLOBAL)) == 0)
|
|
7612 *(long *)get_varp_scope(&(options[opt_idx]), OPT_GLOBAL) = *pp;
|
|
7613
|
|
7614 options[opt_idx].flags |= P_WAS_SET;
|
|
7615
|
|
7616 comp_col(); /* in case 'columns' or 'ls' changed */
|
|
7617 if (curwin->w_curswant != MAXCOL)
|
|
7618 curwin->w_set_curswant = TRUE; /* in case 'tabstop' changed */
|
|
7619 check_redraw(options[opt_idx].flags);
|
|
7620
|
|
7621 return errmsg;
|
|
7622 }
|
|
7623
|
|
7624 /*
|
|
7625 * Called after an option changed: check if something needs to be redrawn.
|
|
7626 */
|
|
7627 static void
|
|
7628 check_redraw(flags)
|
|
7629 long_u flags;
|
|
7630 {
|
|
7631 /* Careful: P_RCLR and P_RALL are a combination of other P_ flags */
|
|
7632 int clear = (flags & P_RCLR) == P_RCLR;
|
|
7633 int all = ((flags & P_RALL) == P_RALL || clear);
|
|
7634
|
|
7635 #ifdef FEAT_WINDOWS
|
|
7636 if ((flags & P_RSTAT) || all) /* mark all status lines dirty */
|
|
7637 status_redraw_all();
|
|
7638 #endif
|
|
7639
|
|
7640 if ((flags & P_RBUF) || (flags & P_RWIN) || all)
|
|
7641 changed_window_setting();
|
|
7642 if (flags & P_RBUF)
|
|
7643 redraw_curbuf_later(NOT_VALID);
|
|
7644 if (clear)
|
|
7645 redraw_all_later(CLEAR);
|
|
7646 else if (all)
|
|
7647 redraw_all_later(NOT_VALID);
|
|
7648 }
|
|
7649
|
|
7650 /*
|
|
7651 * Find index for option 'arg'.
|
|
7652 * Return -1 if not found.
|
|
7653 */
|
|
7654 static int
|
|
7655 findoption(arg)
|
|
7656 char_u *arg;
|
|
7657 {
|
|
7658 int opt_idx;
|
|
7659 char *s, *p;
|
|
7660 static short quick_tab[27] = {0, 0}; /* quick access table */
|
|
7661 int is_term_opt;
|
|
7662
|
|
7663 /*
|
|
7664 * For first call: Initialize the quick-access table.
|
|
7665 * It contains the index for the first option that starts with a certain
|
|
7666 * letter. There are 26 letters, plus the first "t_" option.
|
|
7667 */
|
|
7668 if (quick_tab[1] == 0)
|
|
7669 {
|
|
7670 p = options[0].fullname;
|
|
7671 for (opt_idx = 1; (s = options[opt_idx].fullname) != NULL; opt_idx++)
|
|
7672 {
|
|
7673 if (s[0] != p[0])
|
|
7674 {
|
|
7675 if (s[0] == 't' && s[1] == '_')
|
|
7676 quick_tab[26] = opt_idx;
|
|
7677 else
|
|
7678 quick_tab[CharOrdLow(s[0])] = opt_idx;
|
|
7679 }
|
|
7680 p = s;
|
|
7681 }
|
|
7682 }
|
|
7683
|
|
7684 /*
|
|
7685 * Check for name starting with an illegal character.
|
|
7686 */
|
|
7687 #ifdef EBCDIC
|
|
7688 if (!islower(arg[0]))
|
|
7689 #else
|
|
7690 if (arg[0] < 'a' || arg[0] > 'z')
|
|
7691 #endif
|
|
7692 return -1;
|
|
7693
|
|
7694 is_term_opt = (arg[0] == 't' && arg[1] == '_');
|
|
7695 if (is_term_opt)
|
|
7696 opt_idx = quick_tab[26];
|
|
7697 else
|
|
7698 opt_idx = quick_tab[CharOrdLow(arg[0])];
|
|
7699 for ( ; (s = options[opt_idx].fullname) != NULL; opt_idx++)
|
|
7700 {
|
|
7701 if (STRCMP(arg, s) == 0) /* match full name */
|
|
7702 break;
|
|
7703 }
|
|
7704 if (s == NULL && !is_term_opt)
|
|
7705 {
|
|
7706 opt_idx = quick_tab[CharOrdLow(arg[0])];
|
|
7707 for ( ; options[opt_idx].fullname != NULL; opt_idx++)
|
|
7708 {
|
|
7709 s = options[opt_idx].shortname;
|
|
7710 if (s != NULL && STRCMP(arg, s) == 0) /* match short name */
|
|
7711 break;
|
|
7712 s = NULL;
|
|
7713 }
|
|
7714 }
|
|
7715 if (s == NULL)
|
|
7716 opt_idx = -1;
|
|
7717 return opt_idx;
|
|
7718 }
|
|
7719
|
14
|
7720 #if defined(FEAT_EVAL) || defined(FEAT_TCL) || defined(FEAT_MZSCHEME)
|
7
|
7721 /*
|
|
7722 * Get the value for an option.
|
|
7723 *
|
|
7724 * Returns:
|
|
7725 * Number or Toggle option: 1, *numval gets value.
|
|
7726 * String option: 0, *stringval gets allocated string.
|
|
7727 * Hidden Number or Toggle option: -1.
|
|
7728 * hidden String option: -2.
|
|
7729 * unknown option: -3.
|
|
7730 */
|
|
7731 int
|
|
7732 get_option_value(name, numval, stringval, opt_flags)
|
|
7733 char_u *name;
|
|
7734 long *numval;
|
|
7735 char_u **stringval; /* NULL when only checking existance */
|
|
7736 int opt_flags;
|
|
7737 {
|
|
7738 int opt_idx;
|
|
7739 char_u *varp;
|
|
7740
|
|
7741 opt_idx = findoption(name);
|
|
7742 if (opt_idx < 0) /* unknown option */
|
|
7743 return -3;
|
|
7744
|
|
7745 varp = get_varp_scope(&(options[opt_idx]), opt_flags);
|
|
7746
|
|
7747 if (options[opt_idx].flags & P_STRING)
|
|
7748 {
|
|
7749 if (varp == NULL) /* hidden option */
|
|
7750 return -2;
|
|
7751 if (stringval != NULL)
|
|
7752 {
|
|
7753 #ifdef FEAT_CRYPT
|
|
7754 /* never return the value of the crypt key */
|
|
7755 if ((char_u **)varp == &curbuf->b_p_key)
|
|
7756 *stringval = vim_strsave((char_u *)"*****");
|
|
7757 else
|
|
7758 #endif
|
|
7759 *stringval = vim_strsave(*(char_u **)(varp));
|
|
7760 }
|
|
7761 return 0;
|
|
7762 }
|
|
7763
|
|
7764 if (varp == NULL) /* hidden option */
|
|
7765 return -1;
|
|
7766 if (options[opt_idx].flags & P_NUM)
|
|
7767 *numval = *(long *)varp;
|
|
7768 else
|
|
7769 {
|
|
7770 /* Special case: 'modified' is b_changed, but we also want to consider
|
|
7771 * it set when 'ff' or 'fenc' changed. */
|
|
7772 if ((int *)varp == &curbuf->b_changed)
|
|
7773 *numval = curbufIsChanged();
|
|
7774 else
|
|
7775 *numval = *(int *)varp;
|
|
7776 }
|
|
7777 return 1;
|
|
7778 }
|
|
7779 #endif
|
|
7780
|
|
7781 /*
|
|
7782 * Set the value of option "name".
|
|
7783 * Use "string" for string options, use "number" for other options.
|
|
7784 */
|
|
7785 void
|
|
7786 set_option_value(name, number, string, opt_flags)
|
|
7787 char_u *name;
|
|
7788 long number;
|
|
7789 char_u *string;
|
|
7790 int opt_flags; /* OPT_LOCAL or 0 (both) */
|
|
7791 {
|
|
7792 int opt_idx;
|
|
7793 char_u *varp;
|
|
7794 int flags;
|
|
7795
|
|
7796 opt_idx = findoption(name);
|
|
7797 if (opt_idx == -1)
|
|
7798 EMSG2(_("E355: Unknown option: %s"), name);
|
|
7799 else
|
|
7800 {
|
|
7801 flags = options[opt_idx].flags;
|
|
7802 #ifdef HAVE_SANDBOX
|
|
7803 /* Disallow changing some options in the sandbox */
|
|
7804 if (sandbox > 0 && (flags & P_SECURE))
|
634
|
7805 {
|
7
|
7806 EMSG(_(e_sandbox));
|
634
|
7807 return;
|
|
7808 }
|
|
7809 #endif
|
|
7810 if (flags & P_STRING)
|
7
|
7811 set_string_option(opt_idx, string, opt_flags);
|
|
7812 else
|
|
7813 {
|
|
7814 varp = get_varp(&options[opt_idx]);
|
|
7815 if (varp != NULL) /* hidden option is not changed */
|
|
7816 {
|
|
7817 if (flags & P_NUM)
|
274
|
7818 (void)set_num_option(opt_idx, varp, number,
|
|
7819 NULL, 0, opt_flags);
|
7
|
7820 else
|
634
|
7821 (void)set_bool_option(opt_idx, varp, (int)number,
|
|
7822 opt_flags);
|
7
|
7823 }
|
|
7824 }
|
|
7825 }
|
|
7826 }
|
|
7827
|
|
7828 /*
|
|
7829 * Get the terminal code for a terminal option.
|
|
7830 * Returns NULL when not found.
|
|
7831 */
|
|
7832 char_u *
|
|
7833 get_term_code(tname)
|
|
7834 char_u *tname;
|
|
7835 {
|
|
7836 int opt_idx;
|
|
7837 char_u *varp;
|
|
7838
|
|
7839 if (tname[0] != 't' || tname[1] != '_' ||
|
|
7840 tname[2] == NUL || tname[3] == NUL)
|
|
7841 return NULL;
|
|
7842 if ((opt_idx = findoption(tname)) >= 0)
|
|
7843 {
|
|
7844 varp = get_varp(&(options[opt_idx]));
|
|
7845 if (varp != NULL)
|
|
7846 varp = *(char_u **)(varp);
|
|
7847 return varp;
|
|
7848 }
|
|
7849 return find_termcode(tname + 2);
|
|
7850 }
|
|
7851
|
|
7852 char_u *
|
|
7853 get_highlight_default()
|
|
7854 {
|
|
7855 int i;
|
|
7856
|
|
7857 i = findoption((char_u *)"hl");
|
|
7858 if (i >= 0)
|
|
7859 return options[i].def_val[VI_DEFAULT];
|
|
7860 return (char_u *)NULL;
|
|
7861 }
|
|
7862
|
39
|
7863 #if defined(FEAT_MBYTE) || defined(PROTO)
|
|
7864 char_u *
|
|
7865 get_encoding_default()
|
|
7866 {
|
|
7867 int i;
|
|
7868
|
|
7869 i = findoption((char_u *)"enc");
|
|
7870 if (i >= 0)
|
|
7871 return options[i].def_val[VI_DEFAULT];
|
|
7872 return (char_u *)NULL;
|
|
7873 }
|
|
7874 #endif
|
|
7875
|
7
|
7876 /*
|
|
7877 * Translate a string like "t_xx", "<t_xx>" or "<S-Tab>" to a key number.
|
|
7878 */
|
|
7879 static int
|
|
7880 find_key_option(arg)
|
|
7881 char_u *arg;
|
|
7882 {
|
|
7883 int key;
|
|
7884 int modifiers;
|
|
7885
|
|
7886 /*
|
|
7887 * Don't use get_special_key_code() for t_xx, we don't want it to call
|
|
7888 * add_termcap_entry().
|
|
7889 */
|
|
7890 if (arg[0] == 't' && arg[1] == '_' && arg[2] && arg[3])
|
|
7891 key = TERMCAP2KEY(arg[2], arg[3]);
|
|
7892 else
|
|
7893 {
|
|
7894 --arg; /* put arg at the '<' */
|
|
7895 modifiers = 0;
|
|
7896 key = find_special_key(&arg, &modifiers, TRUE);
|
|
7897 if (modifiers) /* can't handle modifiers here */
|
|
7898 key = 0;
|
|
7899 }
|
|
7900 return key;
|
|
7901 }
|
|
7902
|
|
7903 /*
|
|
7904 * if 'all' == 0: show changed options
|
|
7905 * if 'all' == 1: show all normal options
|
|
7906 * if 'all' == 2: show all terminal options
|
|
7907 */
|
|
7908 static void
|
|
7909 showoptions(all, opt_flags)
|
|
7910 int all;
|
|
7911 int opt_flags; /* OPT_LOCAL and/or OPT_GLOBAL */
|
|
7912 {
|
|
7913 struct vimoption *p;
|
|
7914 int col;
|
|
7915 int isterm;
|
|
7916 char_u *varp;
|
|
7917 struct vimoption **items;
|
|
7918 int item_count;
|
|
7919 int run;
|
|
7920 int row, rows;
|
|
7921 int cols;
|
|
7922 int i;
|
|
7923 int len;
|
|
7924
|
|
7925 #define INC 20
|
|
7926 #define GAP 3
|
|
7927
|
|
7928 items = (struct vimoption **)alloc((unsigned)(sizeof(struct vimoption *) *
|
|
7929 PARAM_COUNT));
|
|
7930 if (items == NULL)
|
|
7931 return;
|
|
7932
|
|
7933 /* Highlight title */
|
|
7934 if (all == 2)
|
|
7935 MSG_PUTS_TITLE(_("\n--- Terminal codes ---"));
|
|
7936 else if (opt_flags & OPT_GLOBAL)
|
|
7937 MSG_PUTS_TITLE(_("\n--- Global option values ---"));
|
|
7938 else if (opt_flags & OPT_LOCAL)
|
|
7939 MSG_PUTS_TITLE(_("\n--- Local option values ---"));
|
|
7940 else
|
|
7941 MSG_PUTS_TITLE(_("\n--- Options ---"));
|
|
7942
|
|
7943 /*
|
|
7944 * do the loop two times:
|
|
7945 * 1. display the short items
|
|
7946 * 2. display the long items (only strings and numbers)
|
|
7947 */
|
|
7948 for (run = 1; run <= 2 && !got_int; ++run)
|
|
7949 {
|
|
7950 /*
|
|
7951 * collect the items in items[]
|
|
7952 */
|
|
7953 item_count = 0;
|
|
7954 for (p = &options[0]; p->fullname != NULL; p++)
|
|
7955 {
|
|
7956 varp = NULL;
|
|
7957 isterm = istermoption(p);
|
|
7958 if (opt_flags != 0)
|
|
7959 {
|
|
7960 if (p->indir != PV_NONE && !isterm)
|
|
7961 varp = get_varp_scope(p, opt_flags);
|
|
7962 }
|
|
7963 else
|
|
7964 varp = get_varp(p);
|
|
7965 if (varp != NULL
|
|
7966 && ((all == 2 && isterm)
|
|
7967 || (all == 1 && !isterm)
|
|
7968 || (all == 0 && !optval_default(p, varp))))
|
|
7969 {
|
|
7970 if (p->flags & P_BOOL)
|
|
7971 len = 1; /* a toggle option fits always */
|
|
7972 else
|
|
7973 {
|
|
7974 option_value2string(p, opt_flags);
|
|
7975 len = (int)STRLEN(p->fullname) + vim_strsize(NameBuff) + 1;
|
|
7976 }
|
|
7977 if ((len <= INC - GAP && run == 1) ||
|
|
7978 (len > INC - GAP && run == 2))
|
|
7979 items[item_count++] = p;
|
|
7980 }
|
|
7981 }
|
|
7982
|
|
7983 /*
|
|
7984 * display the items
|
|
7985 */
|
|
7986 if (run == 1)
|
|
7987 {
|
|
7988 cols = (Columns + GAP - 3) / INC;
|
|
7989 if (cols == 0)
|
|
7990 cols = 1;
|
|
7991 rows = (item_count + cols - 1) / cols;
|
|
7992 }
|
|
7993 else /* run == 2 */
|
|
7994 rows = item_count;
|
|
7995 for (row = 0; row < rows && !got_int; ++row)
|
|
7996 {
|
|
7997 msg_putchar('\n'); /* go to next line */
|
|
7998 if (got_int) /* 'q' typed in more */
|
|
7999 break;
|
|
8000 col = 0;
|
|
8001 for (i = row; i < item_count; i += rows)
|
|
8002 {
|
|
8003 msg_col = col; /* make columns */
|
|
8004 showoneopt(items[i], opt_flags);
|
|
8005 col += INC;
|
|
8006 }
|
|
8007 out_flush();
|
|
8008 ui_breakcheck();
|
|
8009 }
|
|
8010 }
|
|
8011 vim_free(items);
|
|
8012 }
|
|
8013
|
|
8014 /*
|
|
8015 * Return TRUE if option "p" has its default value.
|
|
8016 */
|
|
8017 static int
|
|
8018 optval_default(p, varp)
|
|
8019 struct vimoption *p;
|
|
8020 char_u *varp;
|
|
8021 {
|
|
8022 int dvi;
|
|
8023
|
|
8024 if (varp == NULL)
|
|
8025 return TRUE; /* hidden option is always at default */
|
|
8026 dvi = ((p->flags & P_VI_DEF) || p_cp) ? VI_DEFAULT : VIM_DEFAULT;
|
|
8027 if (p->flags & P_NUM)
|
|
8028 return (*(long *)varp == (long)p->def_val[dvi]);
|
|
8029 if (p->flags & P_BOOL)
|
|
8030 /* the cast to long is required for Manx C */
|
|
8031 return (*(int *)varp == (int)(long)p->def_val[dvi]);
|
|
8032 /* P_STRING */
|
|
8033 return (STRCMP(*(char_u **)varp, p->def_val[dvi]) == 0);
|
|
8034 }
|
|
8035
|
|
8036 /*
|
|
8037 * showoneopt: show the value of one option
|
|
8038 * must not be called with a hidden option!
|
|
8039 */
|
|
8040 static void
|
|
8041 showoneopt(p, opt_flags)
|
|
8042 struct vimoption *p;
|
|
8043 int opt_flags; /* OPT_LOCAL or OPT_GLOBAL */
|
|
8044 {
|
168
|
8045 char_u *varp;
|
|
8046 int save_silent = silent_mode;
|
|
8047
|
|
8048 silent_mode = FALSE;
|
|
8049 info_message = TRUE; /* use mch_msg(), not mch_errmsg() */
|
7
|
8050
|
|
8051 varp = get_varp_scope(p, opt_flags);
|
|
8052
|
|
8053 /* for 'modified' we also need to check if 'ff' or 'fenc' changed. */
|
|
8054 if ((p->flags & P_BOOL) && ((int *)varp == &curbuf->b_changed
|
|
8055 ? !curbufIsChanged() : !*(int *)varp))
|
|
8056 MSG_PUTS("no");
|
|
8057 else if ((p->flags & P_BOOL) && *(int *)varp < 0)
|
|
8058 MSG_PUTS("--");
|
|
8059 else
|
|
8060 MSG_PUTS(" ");
|
|
8061 MSG_PUTS(p->fullname);
|
|
8062 if (!(p->flags & P_BOOL))
|
|
8063 {
|
|
8064 msg_putchar('=');
|
|
8065 /* put value string in NameBuff */
|
|
8066 option_value2string(p, opt_flags);
|
|
8067 msg_outtrans(NameBuff);
|
|
8068 }
|
168
|
8069
|
|
8070 silent_mode = save_silent;
|
|
8071 info_message = FALSE;
|
7
|
8072 }
|
|
8073
|
|
8074 /*
|
|
8075 * Write modified options as ":set" commands to a file.
|
|
8076 *
|
|
8077 * There are three values for "opt_flags":
|
|
8078 * OPT_GLOBAL: Write global option values and fresh values of
|
|
8079 * buffer-local options (used for start of a session
|
|
8080 * file).
|
|
8081 * OPT_GLOBAL + OPT_LOCAL: Idem, add fresh values of window-local options for
|
|
8082 * curwin (used for a vimrc file).
|
|
8083 * OPT_LOCAL: Write buffer-local option values for curbuf, fresh
|
|
8084 * and local values for window-local options of
|
|
8085 * curwin. Local values are also written when at the
|
|
8086 * default value, because a modeline or autocommand
|
|
8087 * may have set them when doing ":edit file" and the
|
|
8088 * user has set them back at the default or fresh
|
|
8089 * value.
|
|
8090 * When "local_only" is TRUE, don't write fresh
|
|
8091 * values, only local values (for ":mkview").
|
|
8092 * (fresh value = value used for a new buffer or window for a local option).
|
|
8093 *
|
|
8094 * Return FAIL on error, OK otherwise.
|
|
8095 */
|
|
8096 int
|
|
8097 makeset(fd, opt_flags, local_only)
|
|
8098 FILE *fd;
|
|
8099 int opt_flags;
|
|
8100 int local_only;
|
|
8101 {
|
|
8102 struct vimoption *p;
|
|
8103 char_u *varp; /* currently used value */
|
|
8104 char_u *varp_fresh; /* local value */
|
|
8105 char_u *varp_local = NULL; /* fresh value */
|
|
8106 char *cmd;
|
|
8107 int round;
|
|
8108
|
|
8109 /*
|
|
8110 * The options that don't have a default (terminal name, columns, lines)
|
|
8111 * are never written. Terminal options are also not written.
|
|
8112 */
|
|
8113 for (p = &options[0]; !istermoption(p); p++)
|
|
8114 if (!(p->flags & P_NO_MKRC) && !istermoption(p))
|
|
8115 {
|
|
8116 /* skip global option when only doing locals */
|
|
8117 if (p->indir == PV_NONE && !(opt_flags & OPT_GLOBAL))
|
|
8118 continue;
|
|
8119
|
|
8120 /* Do not store options like 'bufhidden' and 'syntax' in a vimrc
|
|
8121 * file, they are always buffer-specific. */
|
|
8122 if ((opt_flags & OPT_GLOBAL) && (p->flags & P_NOGLOB))
|
|
8123 continue;
|
|
8124
|
|
8125 /* Global values are only written when not at the default value. */
|
|
8126 varp = get_varp_scope(p, opt_flags);
|
|
8127 if ((opt_flags & OPT_GLOBAL) && optval_default(p, varp))
|
|
8128 continue;
|
|
8129
|
|
8130 round = 2;
|
|
8131 if (p->indir != PV_NONE)
|
|
8132 {
|
|
8133 if (p->var == VAR_WIN)
|
|
8134 {
|
|
8135 /* skip window-local option when only doing globals */
|
|
8136 if (!(opt_flags & OPT_LOCAL))
|
|
8137 continue;
|
|
8138 /* When fresh value of window-local option is not at the
|
|
8139 * default, need to write it too. */
|
|
8140 if (!(opt_flags & OPT_GLOBAL) && !local_only)
|
|
8141 {
|
|
8142 varp_fresh = get_varp_scope(p, OPT_GLOBAL);
|
|
8143 if (!optval_default(p, varp_fresh))
|
|
8144 {
|
|
8145 round = 1;
|
|
8146 varp_local = varp;
|
|
8147 varp = varp_fresh;
|
|
8148 }
|
|
8149 }
|
|
8150 }
|
|
8151 }
|
|
8152
|
|
8153 /* Round 1: fresh value for window-local options.
|
|
8154 * Round 2: other values */
|
|
8155 for ( ; round <= 2; varp = varp_local, ++round)
|
|
8156 {
|
|
8157 if (round == 1 || (opt_flags & OPT_GLOBAL))
|
|
8158 cmd = "set";
|
|
8159 else
|
|
8160 cmd = "setlocal";
|
|
8161
|
|
8162 if (p->flags & P_BOOL)
|
|
8163 {
|
|
8164 if (put_setbool(fd, cmd, p->fullname, *(int *)varp) == FAIL)
|
|
8165 return FAIL;
|
|
8166 }
|
|
8167 else if (p->flags & P_NUM)
|
|
8168 {
|
|
8169 if (put_setnum(fd, cmd, p->fullname, (long *)varp) == FAIL)
|
|
8170 return FAIL;
|
|
8171 }
|
|
8172 else /* P_STRING */
|
|
8173 {
|
|
8174 /* Don't set 'syntax' and 'filetype' again if the value is
|
|
8175 * already right, avoids reloading the syntax file. */
|
|
8176 if (p->indir == PV_SYN || p->indir == PV_FT)
|
|
8177 {
|
|
8178 if (fprintf(fd, "if &%s != '%s'", p->fullname,
|
|
8179 *(char_u **)(varp)) < 0
|
|
8180 || put_eol(fd) < 0)
|
|
8181 return FAIL;
|
|
8182 }
|
|
8183 if (put_setstring(fd, cmd, p->fullname, (char_u **)varp,
|
|
8184 (p->flags & P_EXPAND) != 0) == FAIL)
|
|
8185 return FAIL;
|
|
8186 if (p->indir == PV_SYN || p->indir == PV_FT)
|
|
8187 {
|
|
8188 if (put_line(fd, "endif") == FAIL)
|
|
8189 return FAIL;
|
|
8190 }
|
|
8191 }
|
|
8192 }
|
|
8193 }
|
|
8194 return OK;
|
|
8195 }
|
|
8196
|
|
8197 #if defined(FEAT_FOLDING) || defined(PROTO)
|
|
8198 /*
|
|
8199 * Generate set commands for the local fold options only. Used when
|
|
8200 * 'sessionoptions' or 'viewoptions' contains "folds" but not "options".
|
|
8201 */
|
|
8202 int
|
|
8203 makefoldset(fd)
|
|
8204 FILE *fd;
|
|
8205 {
|
|
8206 if (put_setstring(fd, "setlocal", "fdm", &curwin->w_p_fdm, FALSE) == FAIL
|
|
8207 # ifdef FEAT_EVAL
|
|
8208 || put_setstring(fd, "setlocal", "fde", &curwin->w_p_fde, FALSE)
|
|
8209 == FAIL
|
|
8210 # endif
|
|
8211 || put_setstring(fd, "setlocal", "fmr", &curwin->w_p_fmr, FALSE)
|
|
8212 == FAIL
|
|
8213 || put_setstring(fd, "setlocal", "fdi", &curwin->w_p_fdi, FALSE)
|
|
8214 == FAIL
|
|
8215 || put_setnum(fd, "setlocal", "fdl", &curwin->w_p_fdl) == FAIL
|
|
8216 || put_setnum(fd, "setlocal", "fml", &curwin->w_p_fml) == FAIL
|
|
8217 || put_setnum(fd, "setlocal", "fdn", &curwin->w_p_fdn) == FAIL
|
|
8218 || put_setbool(fd, "setlocal", "fen", curwin->w_p_fen) == FAIL
|
|
8219 )
|
|
8220 return FAIL;
|
|
8221
|
|
8222 return OK;
|
|
8223 }
|
|
8224 #endif
|
|
8225
|
|
8226 static int
|
|
8227 put_setstring(fd, cmd, name, valuep, expand)
|
|
8228 FILE *fd;
|
|
8229 char *cmd;
|
|
8230 char *name;
|
|
8231 char_u **valuep;
|
|
8232 int expand;
|
|
8233 {
|
|
8234 char_u *s;
|
|
8235 char_u buf[MAXPATHL];
|
|
8236
|
|
8237 if (fprintf(fd, "%s %s=", cmd, name) < 0)
|
|
8238 return FAIL;
|
|
8239 if (*valuep != NULL)
|
|
8240 {
|
|
8241 /* Output 'pastetoggle' as key names. For other
|
|
8242 * options some characters have to be escaped with
|
|
8243 * CTRL-V or backslash */
|
|
8244 if (valuep == &p_pt)
|
|
8245 {
|
|
8246 s = *valuep;
|
|
8247 while (*s != NUL)
|
|
8248 if (fputs((char *)str2special(&s, FALSE), fd) < 0)
|
|
8249 return FAIL;
|
|
8250 }
|
|
8251 else if (expand)
|
|
8252 {
|
|
8253 home_replace(NULL, *valuep, buf, MAXPATHL, FALSE);
|
|
8254 if (put_escstr(fd, buf, 2) == FAIL)
|
|
8255 return FAIL;
|
|
8256 }
|
|
8257 else if (put_escstr(fd, *valuep, 2) == FAIL)
|
|
8258 return FAIL;
|
|
8259 }
|
|
8260 if (put_eol(fd) < 0)
|
|
8261 return FAIL;
|
|
8262 return OK;
|
|
8263 }
|
|
8264
|
|
8265 static int
|
|
8266 put_setnum(fd, cmd, name, valuep)
|
|
8267 FILE *fd;
|
|
8268 char *cmd;
|
|
8269 char *name;
|
|
8270 long *valuep;
|
|
8271 {
|
|
8272 long wc;
|
|
8273
|
|
8274 if (fprintf(fd, "%s %s=", cmd, name) < 0)
|
|
8275 return FAIL;
|
|
8276 if (wc_use_keyname((char_u *)valuep, &wc))
|
|
8277 {
|
|
8278 /* print 'wildchar' and 'wildcharm' as a key name */
|
|
8279 if (fputs((char *)get_special_key_name((int)wc, 0), fd) < 0)
|
|
8280 return FAIL;
|
|
8281 }
|
|
8282 else if (fprintf(fd, "%ld", *valuep) < 0)
|
|
8283 return FAIL;
|
|
8284 if (put_eol(fd) < 0)
|
|
8285 return FAIL;
|
|
8286 return OK;
|
|
8287 }
|
|
8288
|
|
8289 static int
|
|
8290 put_setbool(fd, cmd, name, value)
|
|
8291 FILE *fd;
|
|
8292 char *cmd;
|
|
8293 char *name;
|
|
8294 int value;
|
|
8295 {
|
|
8296 if (fprintf(fd, "%s %s%s", cmd, value ? "" : "no", name) < 0
|
|
8297 || put_eol(fd) < 0)
|
|
8298 return FAIL;
|
|
8299 return OK;
|
|
8300 }
|
|
8301
|
|
8302 /*
|
|
8303 * Clear all the terminal options.
|
|
8304 * If the option has been allocated, free the memory.
|
|
8305 * Terminal options are never hidden or indirect.
|
|
8306 */
|
|
8307 void
|
|
8308 clear_termoptions()
|
|
8309 {
|
|
8310 /*
|
|
8311 * Reset a few things before clearing the old options. This may cause
|
|
8312 * outputting a few things that the terminal doesn't understand, but the
|
|
8313 * screen will be cleared later, so this is OK.
|
|
8314 */
|
|
8315 #ifdef FEAT_MOUSE_TTY
|
|
8316 mch_setmouse(FALSE); /* switch mouse off */
|
|
8317 #endif
|
|
8318 #ifdef FEAT_TITLE
|
|
8319 mch_restore_title(3); /* restore window titles */
|
|
8320 #endif
|
|
8321 #if defined(FEAT_XCLIPBOARD) && defined(FEAT_GUI)
|
|
8322 /* When starting the GUI close the display opened for the clipboard.
|
|
8323 * After restoring the title, because that will need the display. */
|
|
8324 if (gui.starting)
|
|
8325 clear_xterm_clip();
|
|
8326 #endif
|
|
8327 #ifdef WIN3264
|
|
8328 /*
|
|
8329 * Check if this is allowed now.
|
|
8330 */
|
|
8331 if (can_end_termcap_mode(FALSE) == TRUE)
|
|
8332 #endif
|
|
8333 stoptermcap(); /* stop termcap mode */
|
|
8334
|
359
|
8335 free_termoptions();
|
|
8336 }
|
|
8337
|
|
8338 void
|
|
8339 free_termoptions()
|
|
8340 {
|
|
8341 struct vimoption *p;
|
|
8342
|
7
|
8343 for (p = &options[0]; p->fullname != NULL; p++)
|
|
8344 if (istermoption(p))
|
|
8345 {
|
|
8346 if (p->flags & P_ALLOCED)
|
|
8347 free_string_option(*(char_u **)(p->var));
|
|
8348 if (p->flags & P_DEF_ALLOCED)
|
|
8349 free_string_option(p->def_val[VI_DEFAULT]);
|
|
8350 *(char_u **)(p->var) = empty_option;
|
|
8351 p->def_val[VI_DEFAULT] = empty_option;
|
|
8352 p->flags &= ~(P_ALLOCED|P_DEF_ALLOCED);
|
|
8353 }
|
|
8354 clear_termcodes();
|
|
8355 }
|
|
8356
|
|
8357 /*
|
|
8358 * Set the terminal option defaults to the current value.
|
|
8359 * Used after setting the terminal name.
|
|
8360 */
|
|
8361 void
|
|
8362 set_term_defaults()
|
|
8363 {
|
|
8364 struct vimoption *p;
|
|
8365
|
|
8366 for (p = &options[0]; p->fullname != NULL; p++)
|
|
8367 {
|
|
8368 if (istermoption(p) && p->def_val[VI_DEFAULT] != *(char_u **)(p->var))
|
|
8369 {
|
|
8370 if (p->flags & P_DEF_ALLOCED)
|
|
8371 {
|
|
8372 free_string_option(p->def_val[VI_DEFAULT]);
|
|
8373 p->flags &= ~P_DEF_ALLOCED;
|
|
8374 }
|
|
8375 p->def_val[VI_DEFAULT] = *(char_u **)(p->var);
|
|
8376 if (p->flags & P_ALLOCED)
|
|
8377 {
|
|
8378 p->flags |= P_DEF_ALLOCED;
|
|
8379 p->flags &= ~P_ALLOCED; /* don't free the value now */
|
|
8380 }
|
|
8381 }
|
|
8382 }
|
|
8383 }
|
|
8384
|
|
8385 /*
|
|
8386 * return TRUE if 'p' starts with 't_'
|
|
8387 */
|
|
8388 static int
|
|
8389 istermoption(p)
|
|
8390 struct vimoption *p;
|
|
8391 {
|
|
8392 return (p->fullname[0] == 't' && p->fullname[1] == '_');
|
|
8393 }
|
|
8394
|
|
8395 /*
|
|
8396 * Compute columns for ruler and shown command. 'sc_col' is also used to
|
|
8397 * decide what the maximum length of a message on the status line can be.
|
|
8398 * If there is a status line for the last window, 'sc_col' is independent
|
|
8399 * of 'ru_col'.
|
|
8400 */
|
|
8401
|
|
8402 #define COL_RULER 17 /* columns needed by standard ruler */
|
|
8403
|
|
8404 void
|
|
8405 comp_col()
|
|
8406 {
|
|
8407 #if defined(FEAT_CMDL_INFO) && defined(FEAT_WINDOWS)
|
|
8408 int last_has_status = (p_ls == 2 || (p_ls == 1 && firstwin != lastwin));
|
|
8409
|
|
8410 sc_col = 0;
|
|
8411 ru_col = 0;
|
|
8412 if (p_ru)
|
|
8413 {
|
|
8414 #ifdef FEAT_STL_OPT
|
|
8415 ru_col = (ru_wid ? ru_wid : COL_RULER) + 1;
|
|
8416 #else
|
|
8417 ru_col = COL_RULER + 1;
|
|
8418 #endif
|
|
8419 /* no last status line, adjust sc_col */
|
|
8420 if (!last_has_status)
|
|
8421 sc_col = ru_col;
|
|
8422 }
|
|
8423 if (p_sc)
|
|
8424 {
|
|
8425 sc_col += SHOWCMD_COLS;
|
|
8426 if (!p_ru || last_has_status) /* no need for separating space */
|
|
8427 ++sc_col;
|
|
8428 }
|
|
8429 sc_col = Columns - sc_col;
|
|
8430 ru_col = Columns - ru_col;
|
|
8431 if (sc_col <= 0) /* screen too narrow, will become a mess */
|
|
8432 sc_col = 1;
|
|
8433 if (ru_col <= 0)
|
|
8434 ru_col = 1;
|
|
8435 #else
|
|
8436 sc_col = Columns;
|
|
8437 ru_col = Columns;
|
|
8438 #endif
|
|
8439 }
|
|
8440
|
|
8441 /*
|
|
8442 * Get pointer to option variable, depending on local or global scope.
|
|
8443 */
|
|
8444 static char_u *
|
|
8445 get_varp_scope(p, opt_flags)
|
|
8446 struct vimoption *p;
|
|
8447 int opt_flags;
|
|
8448 {
|
|
8449 if ((opt_flags & OPT_GLOBAL) && p->indir != PV_NONE)
|
|
8450 {
|
|
8451 if (p->var == VAR_WIN)
|
|
8452 return (char_u *)GLOBAL_WO(get_varp(p));
|
|
8453 return p->var;
|
|
8454 }
|
|
8455 if ((opt_flags & OPT_LOCAL) && (int)p->indir >= PV_BOTH)
|
|
8456 {
|
|
8457 switch ((int)p->indir)
|
|
8458 {
|
|
8459 #ifdef FEAT_QUICKFIX
|
|
8460 case OPT_BOTH(PV_GP): return (char_u *)&(curbuf->b_p_gp);
|
|
8461 case OPT_BOTH(PV_MP): return (char_u *)&(curbuf->b_p_mp);
|
|
8462 case OPT_BOTH(PV_EFM): return (char_u *)&(curbuf->b_p_efm);
|
|
8463 #endif
|
|
8464 case OPT_BOTH(PV_EP): return (char_u *)&(curbuf->b_p_ep);
|
|
8465 case OPT_BOTH(PV_KP): return (char_u *)&(curbuf->b_p_kp);
|
|
8466 case OPT_BOTH(PV_PATH): return (char_u *)&(curbuf->b_p_path);
|
|
8467 case OPT_BOTH(PV_AR): return (char_u *)&(curbuf->b_p_ar);
|
|
8468 case OPT_BOTH(PV_TAGS): return (char_u *)&(curbuf->b_p_tags);
|
|
8469 #ifdef FEAT_FIND_ID
|
|
8470 case OPT_BOTH(PV_DEF): return (char_u *)&(curbuf->b_p_def);
|
|
8471 case OPT_BOTH(PV_INC): return (char_u *)&(curbuf->b_p_inc);
|
|
8472 #endif
|
|
8473 #ifdef FEAT_INS_EXPAND
|
|
8474 case OPT_BOTH(PV_DICT): return (char_u *)&(curbuf->b_p_dict);
|
|
8475 case OPT_BOTH(PV_TSR): return (char_u *)&(curbuf->b_p_tsr);
|
|
8476 #endif
|
40
|
8477 #ifdef FEAT_STL_OPT
|
|
8478 case OPT_BOTH(PV_STL): return (char_u *)&(curwin->w_p_stl);
|
|
8479 #endif
|
7
|
8480 }
|
|
8481 return NULL; /* "cannot happen" */
|
|
8482 }
|
|
8483 return get_varp(p);
|
|
8484 }
|
|
8485
|
|
8486 /*
|
|
8487 * Get pointer to option variable.
|
|
8488 */
|
|
8489 static char_u *
|
|
8490 get_varp(p)
|
|
8491 struct vimoption *p;
|
|
8492 {
|
|
8493 /* hidden option, always return NULL */
|
|
8494 if (p->var == NULL)
|
|
8495 return NULL;
|
|
8496
|
|
8497 switch ((int)p->indir)
|
|
8498 {
|
|
8499 case PV_NONE: return p->var;
|
|
8500
|
|
8501 /* global option with local value: use local value if it's been set */
|
|
8502 case OPT_BOTH(PV_EP): return *curbuf->b_p_ep != NUL
|
|
8503 ? (char_u *)&curbuf->b_p_ep : p->var;
|
|
8504 case OPT_BOTH(PV_KP): return *curbuf->b_p_kp != NUL
|
|
8505 ? (char_u *)&curbuf->b_p_kp : p->var;
|
|
8506 case OPT_BOTH(PV_PATH): return *curbuf->b_p_path != NUL
|
|
8507 ? (char_u *)&(curbuf->b_p_path) : p->var;
|
|
8508 case OPT_BOTH(PV_AR): return curbuf->b_p_ar >= 0
|
|
8509 ? (char_u *)&(curbuf->b_p_ar) : p->var;
|
|
8510 case OPT_BOTH(PV_TAGS): return *curbuf->b_p_tags != NUL
|
|
8511 ? (char_u *)&(curbuf->b_p_tags) : p->var;
|
|
8512 #ifdef FEAT_FIND_ID
|
|
8513 case OPT_BOTH(PV_DEF): return *curbuf->b_p_def != NUL
|
|
8514 ? (char_u *)&(curbuf->b_p_def) : p->var;
|
|
8515 case OPT_BOTH(PV_INC): return *curbuf->b_p_inc != NUL
|
|
8516 ? (char_u *)&(curbuf->b_p_inc) : p->var;
|
|
8517 #endif
|
|
8518 #ifdef FEAT_INS_EXPAND
|
|
8519 case OPT_BOTH(PV_DICT): return *curbuf->b_p_dict != NUL
|
|
8520 ? (char_u *)&(curbuf->b_p_dict) : p->var;
|
|
8521 case OPT_BOTH(PV_TSR): return *curbuf->b_p_tsr != NUL
|
|
8522 ? (char_u *)&(curbuf->b_p_tsr) : p->var;
|
|
8523 #endif
|
|
8524 #ifdef FEAT_QUICKFIX
|
|
8525 case OPT_BOTH(PV_GP): return *curbuf->b_p_gp != NUL
|
|
8526 ? (char_u *)&(curbuf->b_p_gp) : p->var;
|
|
8527 case OPT_BOTH(PV_MP): return *curbuf->b_p_mp != NUL
|
|
8528 ? (char_u *)&(curbuf->b_p_mp) : p->var;
|
|
8529 case OPT_BOTH(PV_EFM): return *curbuf->b_p_efm != NUL
|
|
8530 ? (char_u *)&(curbuf->b_p_efm) : p->var;
|
|
8531 #endif
|
40
|
8532 #ifdef FEAT_STL_OPT
|
|
8533 case OPT_BOTH(PV_STL): return *curwin->w_p_stl != NUL
|
|
8534 ? (char_u *)&(curwin->w_p_stl) : p->var;
|
|
8535 #endif
|
7
|
8536
|
|
8537 #ifdef FEAT_ARABIC
|
|
8538 case PV_ARAB: return (char_u *)&(curwin->w_p_arab);
|
|
8539 #endif
|
|
8540 case PV_LIST: return (char_u *)&(curwin->w_p_list);
|
221
|
8541 #ifdef FEAT_SYN_HL
|
|
8542 case PV_SPELL: return (char_u *)&(curwin->w_p_spell);
|
|
8543 #endif
|
7
|
8544 #ifdef FEAT_DIFF
|
|
8545 case PV_DIFF: return (char_u *)&(curwin->w_p_diff);
|
|
8546 #endif
|
|
8547 #ifdef FEAT_FOLDING
|
|
8548 case PV_FDC: return (char_u *)&(curwin->w_p_fdc);
|
|
8549 case PV_FEN: return (char_u *)&(curwin->w_p_fen);
|
|
8550 case PV_FDI: return (char_u *)&(curwin->w_p_fdi);
|
|
8551 case PV_FDL: return (char_u *)&(curwin->w_p_fdl);
|
|
8552 case PV_FDM: return (char_u *)&(curwin->w_p_fdm);
|
|
8553 case PV_FML: return (char_u *)&(curwin->w_p_fml);
|
|
8554 case PV_FDN: return (char_u *)&(curwin->w_p_fdn);
|
|
8555 # ifdef FEAT_EVAL
|
|
8556 case PV_FDE: return (char_u *)&(curwin->w_p_fde);
|
|
8557 case PV_FDT: return (char_u *)&(curwin->w_p_fdt);
|
|
8558 # endif
|
|
8559 case PV_FMR: return (char_u *)&(curwin->w_p_fmr);
|
|
8560 #endif
|
|
8561 case PV_NU: return (char_u *)&(curwin->w_p_nu);
|
13
|
8562 #ifdef FEAT_LINEBREAK
|
|
8563 case PV_NUW: return (char_u *)&(curwin->w_p_nuw);
|
|
8564 #endif
|
7
|
8565 #if defined(FEAT_WINDOWS)
|
|
8566 case PV_WFH: return (char_u *)&(curwin->w_p_wfh);
|
|
8567 #endif
|
|
8568 #if defined(FEAT_WINDOWS) && defined(FEAT_QUICKFIX)
|
|
8569 case PV_PVW: return (char_u *)&(curwin->w_p_pvw);
|
|
8570 #endif
|
|
8571 #ifdef FEAT_RIGHTLEFT
|
|
8572 case PV_RL: return (char_u *)&(curwin->w_p_rl);
|
|
8573 case PV_RLC: return (char_u *)&(curwin->w_p_rlc);
|
|
8574 #endif
|
|
8575 case PV_SCROLL: return (char_u *)&(curwin->w_p_scr);
|
|
8576 case PV_WRAP: return (char_u *)&(curwin->w_p_wrap);
|
|
8577 #ifdef FEAT_LINEBREAK
|
|
8578 case PV_LBR: return (char_u *)&(curwin->w_p_lbr);
|
|
8579 #endif
|
|
8580 #ifdef FEAT_SCROLLBIND
|
|
8581 case PV_SCBIND: return (char_u *)&(curwin->w_p_scb);
|
|
8582 #endif
|
|
8583
|
|
8584 case PV_AI: return (char_u *)&(curbuf->b_p_ai);
|
|
8585 case PV_BIN: return (char_u *)&(curbuf->b_p_bin);
|
|
8586 #ifdef FEAT_MBYTE
|
|
8587 case PV_BOMB: return (char_u *)&(curbuf->b_p_bomb);
|
|
8588 #endif
|
|
8589 #if defined(FEAT_QUICKFIX)
|
|
8590 case PV_BH: return (char_u *)&(curbuf->b_p_bh);
|
|
8591 case PV_BT: return (char_u *)&(curbuf->b_p_bt);
|
|
8592 #endif
|
|
8593 case PV_BL: return (char_u *)&(curbuf->b_p_bl);
|
|
8594 case PV_CI: return (char_u *)&(curbuf->b_p_ci);
|
|
8595 #ifdef FEAT_CINDENT
|
|
8596 case PV_CIN: return (char_u *)&(curbuf->b_p_cin);
|
|
8597 case PV_CINK: return (char_u *)&(curbuf->b_p_cink);
|
|
8598 case PV_CINO: return (char_u *)&(curbuf->b_p_cino);
|
|
8599 #endif
|
|
8600 #if defined(FEAT_SMARTINDENT) || defined(FEAT_CINDENT)
|
|
8601 case PV_CINW: return (char_u *)&(curbuf->b_p_cinw);
|
|
8602 #endif
|
|
8603 #ifdef FEAT_COMMENTS
|
|
8604 case PV_COM: return (char_u *)&(curbuf->b_p_com);
|
|
8605 #endif
|
|
8606 #ifdef FEAT_FOLDING
|
|
8607 case PV_CMS: return (char_u *)&(curbuf->b_p_cms);
|
|
8608 #endif
|
|
8609 #ifdef FEAT_INS_EXPAND
|
|
8610 case PV_CPT: return (char_u *)&(curbuf->b_p_cpt);
|
|
8611 #endif
|
12
|
8612 #ifdef FEAT_COMPL_FUNC
|
|
8613 case PV_CFU: return (char_u *)&(curbuf->b_p_cfu);
|
502
|
8614 case PV_OFU: return (char_u *)&(curbuf->b_p_ofu);
|
12
|
8615 #endif
|
7
|
8616 case PV_EOL: return (char_u *)&(curbuf->b_p_eol);
|
|
8617 case PV_ET: return (char_u *)&(curbuf->b_p_et);
|
|
8618 #ifdef FEAT_MBYTE
|
|
8619 case PV_FENC: return (char_u *)&(curbuf->b_p_fenc);
|
|
8620 #endif
|
|
8621 case PV_FF: return (char_u *)&(curbuf->b_p_ff);
|
|
8622 #ifdef FEAT_AUTOCMD
|
|
8623 case PV_FT: return (char_u *)&(curbuf->b_p_ft);
|
|
8624 #endif
|
|
8625 case PV_FO: return (char_u *)&(curbuf->b_p_fo);
|
41
|
8626 case PV_FLP: return (char_u *)&(curbuf->b_p_flp);
|
7
|
8627 case PV_IMI: return (char_u *)&(curbuf->b_p_iminsert);
|
|
8628 case PV_IMS: return (char_u *)&(curbuf->b_p_imsearch);
|
|
8629 case PV_INF: return (char_u *)&(curbuf->b_p_inf);
|
|
8630 case PV_ISK: return (char_u *)&(curbuf->b_p_isk);
|
|
8631 #ifdef FEAT_FIND_ID
|
|
8632 # ifdef FEAT_EVAL
|
|
8633 case PV_INEX: return (char_u *)&(curbuf->b_p_inex);
|
|
8634 # endif
|
|
8635 #endif
|
|
8636 #if defined(FEAT_CINDENT) && defined(FEAT_EVAL)
|
|
8637 case PV_INDE: return (char_u *)&(curbuf->b_p_inde);
|
|
8638 case PV_INDK: return (char_u *)&(curbuf->b_p_indk);
|
|
8639 #endif
|
667
|
8640 #if defined(FEAT_EVAL)
|
|
8641 case PV_FEX: return (char_u *)&(curbuf->b_p_fex);
|
|
8642 #endif
|
7
|
8643 #ifdef FEAT_CRYPT
|
|
8644 case PV_KEY: return (char_u *)&(curbuf->b_p_key);
|
|
8645 #endif
|
|
8646 #ifdef FEAT_LISP
|
|
8647 case PV_LISP: return (char_u *)&(curbuf->b_p_lisp);
|
|
8648 #endif
|
|
8649 case PV_ML: return (char_u *)&(curbuf->b_p_ml);
|
|
8650 case PV_MPS: return (char_u *)&(curbuf->b_p_mps);
|
|
8651 case PV_MA: return (char_u *)&(curbuf->b_p_ma);
|
|
8652 case PV_MOD: return (char_u *)&(curbuf->b_changed);
|
|
8653 case PV_NF: return (char_u *)&(curbuf->b_p_nf);
|
|
8654 #ifdef FEAT_OSFILETYPE
|
|
8655 case PV_OFT: return (char_u *)&(curbuf->b_p_oft);
|
|
8656 #endif
|
|
8657 case PV_PI: return (char_u *)&(curbuf->b_p_pi);
|
12
|
8658 #ifdef FEAT_TEXTOBJ
|
|
8659 case PV_QE: return (char_u *)&(curbuf->b_p_qe);
|
|
8660 #endif
|
7
|
8661 case PV_RO: return (char_u *)&(curbuf->b_p_ro);
|
|
8662 #ifdef FEAT_SMARTINDENT
|
|
8663 case PV_SI: return (char_u *)&(curbuf->b_p_si);
|
|
8664 #endif
|
|
8665 #ifndef SHORT_FNAME
|
|
8666 case PV_SN: return (char_u *)&(curbuf->b_p_sn);
|
|
8667 #endif
|
|
8668 case PV_STS: return (char_u *)&(curbuf->b_p_sts);
|
|
8669 #ifdef FEAT_SEARCHPATH
|
|
8670 case PV_SUA: return (char_u *)&(curbuf->b_p_sua);
|
|
8671 #endif
|
|
8672 case PV_SWF: return (char_u *)&(curbuf->b_p_swf);
|
|
8673 #ifdef FEAT_SYN_HL
|
410
|
8674 case PV_SMC: return (char_u *)&(curbuf->b_p_smc);
|
7
|
8675 case PV_SYN: return (char_u *)&(curbuf->b_p_syn);
|
386
|
8676 case PV_SPC: return (char_u *)&(curbuf->b_p_spc);
|
314
|
8677 case PV_SPF: return (char_u *)&(curbuf->b_p_spf);
|
221
|
8678 case PV_SPL: return (char_u *)&(curbuf->b_p_spl);
|
7
|
8679 #endif
|
|
8680 case PV_SW: return (char_u *)&(curbuf->b_p_sw);
|
|
8681 case PV_TS: return (char_u *)&(curbuf->b_p_ts);
|
|
8682 case PV_TW: return (char_u *)&(curbuf->b_p_tw);
|
|
8683 case PV_TX: return (char_u *)&(curbuf->b_p_tx);
|
|
8684 case PV_WM: return (char_u *)&(curbuf->b_p_wm);
|
|
8685 #ifdef FEAT_KEYMAP
|
|
8686 case PV_KMAP: return (char_u *)&(curbuf->b_p_keymap);
|
|
8687 #endif
|
|
8688 default: EMSG(_("E356: get_varp ERROR"));
|
|
8689 }
|
|
8690 /* always return a valid pointer to avoid a crash! */
|
|
8691 return (char_u *)&(curbuf->b_p_wm);
|
|
8692 }
|
|
8693
|
|
8694 /*
|
|
8695 * Get the value of 'equalprg', either the buffer-local one or the global one.
|
|
8696 */
|
|
8697 char_u *
|
|
8698 get_equalprg()
|
|
8699 {
|
|
8700 if (*curbuf->b_p_ep == NUL)
|
|
8701 return p_ep;
|
|
8702 return curbuf->b_p_ep;
|
|
8703 }
|
|
8704
|
|
8705 #if defined(FEAT_WINDOWS) || defined(PROTO)
|
|
8706 /*
|
|
8707 * Copy options from one window to another.
|
|
8708 * Used when splitting a window.
|
|
8709 */
|
|
8710 void
|
|
8711 win_copy_options(wp_from, wp_to)
|
|
8712 win_T *wp_from;
|
|
8713 win_T *wp_to;
|
|
8714 {
|
|
8715 copy_winopt(&wp_from->w_onebuf_opt, &wp_to->w_onebuf_opt);
|
|
8716 copy_winopt(&wp_from->w_allbuf_opt, &wp_to->w_allbuf_opt);
|
|
8717 # ifdef FEAT_RIGHTLEFT
|
|
8718 # ifdef FEAT_FKMAP
|
|
8719 /* Is this right? */
|
|
8720 wp_to->w_farsi = wp_from->w_farsi;
|
|
8721 # endif
|
|
8722 # endif
|
|
8723 }
|
|
8724 #endif
|
|
8725
|
|
8726 /*
|
|
8727 * Copy the options from one winopt_T to another.
|
|
8728 * Doesn't free the old option values in "to", use clear_winopt() for that.
|
|
8729 * The 'scroll' option is not copied, because it depends on the window height.
|
|
8730 * The 'previewwindow' option is reset, there can be only one preview window.
|
|
8731 */
|
|
8732 void
|
|
8733 copy_winopt(from, to)
|
|
8734 winopt_T *from;
|
|
8735 winopt_T *to;
|
|
8736 {
|
|
8737 #ifdef FEAT_ARABIC
|
|
8738 to->wo_arab = from->wo_arab;
|
|
8739 #endif
|
|
8740 to->wo_list = from->wo_list;
|
|
8741 to->wo_nu = from->wo_nu;
|
13
|
8742 #ifdef FEAT_LINEBREAK
|
|
8743 to->wo_nuw = from->wo_nuw;
|
|
8744 #endif
|
7
|
8745 #ifdef FEAT_RIGHTLEFT
|
|
8746 to->wo_rl = from->wo_rl;
|
|
8747 to->wo_rlc = vim_strsave(from->wo_rlc);
|
|
8748 #endif
|
40
|
8749 #ifdef FEAT_STL_OPT
|
|
8750 to->wo_stl = vim_strsave(from->wo_stl);
|
|
8751 #endif
|
7
|
8752 to->wo_wrap = from->wo_wrap;
|
|
8753 #ifdef FEAT_LINEBREAK
|
|
8754 to->wo_lbr = from->wo_lbr;
|
|
8755 #endif
|
|
8756 #ifdef FEAT_SCROLLBIND
|
|
8757 to->wo_scb = from->wo_scb;
|
|
8758 #endif
|
221
|
8759 #ifdef FEAT_SYN_HL
|
|
8760 to->wo_spell = from->wo_spell;
|
|
8761 #endif
|
7
|
8762 #ifdef FEAT_DIFF
|
|
8763 to->wo_diff = from->wo_diff;
|
|
8764 #endif
|
|
8765 #ifdef FEAT_FOLDING
|
|
8766 to->wo_fdc = from->wo_fdc;
|
|
8767 to->wo_fen = from->wo_fen;
|
|
8768 to->wo_fdi = vim_strsave(from->wo_fdi);
|
|
8769 to->wo_fml = from->wo_fml;
|
|
8770 to->wo_fdl = from->wo_fdl;
|
|
8771 to->wo_fdm = vim_strsave(from->wo_fdm);
|
|
8772 to->wo_fdn = from->wo_fdn;
|
|
8773 # ifdef FEAT_EVAL
|
|
8774 to->wo_fde = vim_strsave(from->wo_fde);
|
|
8775 to->wo_fdt = vim_strsave(from->wo_fdt);
|
|
8776 # endif
|
|
8777 to->wo_fmr = vim_strsave(from->wo_fmr);
|
|
8778 #endif
|
|
8779 check_winopt(to); /* don't want NULL pointers */
|
|
8780 }
|
|
8781
|
|
8782 /*
|
|
8783 * Check string options in a window for a NULL value.
|
|
8784 */
|
|
8785 void
|
|
8786 check_win_options(win)
|
|
8787 win_T *win;
|
|
8788 {
|
|
8789 check_winopt(&win->w_onebuf_opt);
|
|
8790 check_winopt(&win->w_allbuf_opt);
|
|
8791 }
|
|
8792
|
|
8793 /*
|
|
8794 * Check for NULL pointers in a winopt_T and replace them with empty_option.
|
|
8795 */
|
|
8796 /*ARGSUSED*/
|
|
8797 void
|
|
8798 check_winopt(wop)
|
|
8799 winopt_T *wop;
|
|
8800 {
|
|
8801 #ifdef FEAT_FOLDING
|
|
8802 check_string_option(&wop->wo_fdi);
|
|
8803 check_string_option(&wop->wo_fdm);
|
|
8804 # ifdef FEAT_EVAL
|
|
8805 check_string_option(&wop->wo_fde);
|
|
8806 check_string_option(&wop->wo_fdt);
|
|
8807 # endif
|
|
8808 check_string_option(&wop->wo_fmr);
|
|
8809 #endif
|
|
8810 #ifdef FEAT_RIGHTLEFT
|
|
8811 check_string_option(&wop->wo_rlc);
|
|
8812 #endif
|
40
|
8813 #ifdef FEAT_STL_OPT
|
|
8814 check_string_option(&wop->wo_stl);
|
|
8815 #endif
|
7
|
8816 }
|
|
8817
|
|
8818 /*
|
|
8819 * Free the allocated memory inside a winopt_T.
|
|
8820 */
|
|
8821 /*ARGSUSED*/
|
|
8822 void
|
|
8823 clear_winopt(wop)
|
|
8824 winopt_T *wop;
|
|
8825 {
|
|
8826 #ifdef FEAT_FOLDING
|
|
8827 clear_string_option(&wop->wo_fdi);
|
|
8828 clear_string_option(&wop->wo_fdm);
|
|
8829 # ifdef FEAT_EVAL
|
|
8830 clear_string_option(&wop->wo_fde);
|
|
8831 clear_string_option(&wop->wo_fdt);
|
|
8832 # endif
|
|
8833 clear_string_option(&wop->wo_fmr);
|
|
8834 #endif
|
|
8835 #ifdef FEAT_RIGHTLEFT
|
|
8836 clear_string_option(&wop->wo_rlc);
|
|
8837 #endif
|
40
|
8838 #ifdef FEAT_STL_OPT
|
|
8839 clear_string_option(&wop->wo_stl);
|
|
8840 #endif
|
7
|
8841 }
|
|
8842
|
|
8843 /*
|
|
8844 * Copy global option values to local options for one buffer.
|
|
8845 * Used when creating a new buffer and sometimes when entering a buffer.
|
|
8846 * flags:
|
|
8847 * BCO_ENTER We will enter the buf buffer.
|
|
8848 * BCO_ALWAYS Always copy the options, but only set b_p_initialized when
|
|
8849 * appropriate.
|
|
8850 * BCO_NOHELP Don't copy the values to a help buffer.
|
|
8851 */
|
|
8852 void
|
|
8853 buf_copy_options(buf, flags)
|
|
8854 buf_T *buf;
|
|
8855 int flags;
|
|
8856 {
|
|
8857 int should_copy = TRUE;
|
|
8858 char_u *save_p_isk = NULL; /* init for GCC */
|
|
8859 int dont_do_help;
|
|
8860 int did_isk = FALSE;
|
|
8861
|
|
8862 /*
|
|
8863 * Don't do anything of the buffer is invalid.
|
|
8864 */
|
|
8865 if (buf == NULL || !buf_valid(buf))
|
|
8866 return;
|
|
8867
|
|
8868 /*
|
|
8869 * Skip this when the option defaults have not been set yet. Happens when
|
|
8870 * main() allocates the first buffer.
|
|
8871 */
|
|
8872 if (p_cpo != NULL)
|
|
8873 {
|
|
8874 /*
|
|
8875 * Always copy when entering and 'cpo' contains 'S'.
|
|
8876 * Don't copy when already initialized.
|
|
8877 * Don't copy when 'cpo' contains 's' and not entering.
|
|
8878 * 'S' BCO_ENTER initialized 's' should_copy
|
|
8879 * yes yes X X TRUE
|
|
8880 * yes no yes X FALSE
|
|
8881 * no X yes X FALSE
|
|
8882 * X no no yes FALSE
|
|
8883 * X no no no TRUE
|
|
8884 * no yes no X TRUE
|
|
8885 */
|
|
8886 if ((vim_strchr(p_cpo, CPO_BUFOPTGLOB) == NULL || !(flags & BCO_ENTER))
|
|
8887 && (buf->b_p_initialized
|
|
8888 || (!(flags & BCO_ENTER)
|
|
8889 && vim_strchr(p_cpo, CPO_BUFOPT) != NULL)))
|
|
8890 should_copy = FALSE;
|
|
8891
|
|
8892 if (should_copy || (flags & BCO_ALWAYS))
|
|
8893 {
|
|
8894 /* Don't copy the options specific to a help buffer when
|
|
8895 * BCO_NOHELP is given or the options were initialized already
|
|
8896 * (jumping back to a help file with CTRL-T or CTRL-O) */
|
|
8897 dont_do_help = ((flags & BCO_NOHELP) && buf->b_help)
|
|
8898 || buf->b_p_initialized;
|
|
8899 if (dont_do_help) /* don't free b_p_isk */
|
|
8900 {
|
|
8901 save_p_isk = buf->b_p_isk;
|
|
8902 buf->b_p_isk = NULL;
|
|
8903 }
|
|
8904 /*
|
|
8905 * Always free the allocated strings.
|
|
8906 * If not already initialized, set 'readonly' and copy 'fileformat'.
|
|
8907 */
|
|
8908 if (!buf->b_p_initialized)
|
|
8909 {
|
|
8910 free_buf_options(buf, TRUE);
|
|
8911 buf->b_p_ro = FALSE; /* don't copy readonly */
|
|
8912 buf->b_p_tx = p_tx;
|
|
8913 #ifdef FEAT_MBYTE
|
|
8914 buf->b_p_fenc = vim_strsave(p_fenc);
|
|
8915 #endif
|
|
8916 buf->b_p_ff = vim_strsave(p_ff);
|
|
8917 #if defined(FEAT_QUICKFIX)
|
|
8918 buf->b_p_bh = empty_option;
|
|
8919 buf->b_p_bt = empty_option;
|
|
8920 #endif
|
|
8921 }
|
|
8922 else
|
|
8923 free_buf_options(buf, FALSE);
|
|
8924
|
|
8925 buf->b_p_ai = p_ai;
|
|
8926 buf->b_p_ai_nopaste = p_ai_nopaste;
|
|
8927 buf->b_p_sw = p_sw;
|
|
8928 buf->b_p_tw = p_tw;
|
|
8929 buf->b_p_tw_nopaste = p_tw_nopaste;
|
|
8930 buf->b_p_tw_nobin = p_tw_nobin;
|
|
8931 buf->b_p_wm = p_wm;
|
|
8932 buf->b_p_wm_nopaste = p_wm_nopaste;
|
|
8933 buf->b_p_wm_nobin = p_wm_nobin;
|
|
8934 buf->b_p_bin = p_bin;
|
402
|
8935 #ifdef FEAT_MBYTE
|
|
8936 buf->b_p_bomb = p_bomb;
|
|
8937 #endif
|
7
|
8938 buf->b_p_et = p_et;
|
|
8939 buf->b_p_et_nobin = p_et_nobin;
|
|
8940 buf->b_p_ml = p_ml;
|
|
8941 buf->b_p_ml_nobin = p_ml_nobin;
|
|
8942 buf->b_p_inf = p_inf;
|
|
8943 buf->b_p_swf = p_swf;
|
|
8944 #ifdef FEAT_INS_EXPAND
|
|
8945 buf->b_p_cpt = vim_strsave(p_cpt);
|
|
8946 #endif
|
12
|
8947 #ifdef FEAT_COMPL_FUNC
|
|
8948 buf->b_p_cfu = vim_strsave(p_cfu);
|
502
|
8949 buf->b_p_ofu = vim_strsave(p_ofu);
|
12
|
8950 #endif
|
7
|
8951 buf->b_p_sts = p_sts;
|
|
8952 buf->b_p_sts_nopaste = p_sts_nopaste;
|
|
8953 #ifndef SHORT_FNAME
|
|
8954 buf->b_p_sn = p_sn;
|
|
8955 #endif
|
|
8956 #ifdef FEAT_COMMENTS
|
|
8957 buf->b_p_com = vim_strsave(p_com);
|
|
8958 #endif
|
|
8959 #ifdef FEAT_FOLDING
|
|
8960 buf->b_p_cms = vim_strsave(p_cms);
|
|
8961 #endif
|
|
8962 buf->b_p_fo = vim_strsave(p_fo);
|
41
|
8963 buf->b_p_flp = vim_strsave(p_flp);
|
7
|
8964 buf->b_p_nf = vim_strsave(p_nf);
|
|
8965 buf->b_p_mps = vim_strsave(p_mps);
|
|
8966 #ifdef FEAT_SMARTINDENT
|
|
8967 buf->b_p_si = p_si;
|
|
8968 #endif
|
|
8969 buf->b_p_ci = p_ci;
|
|
8970 #ifdef FEAT_CINDENT
|
|
8971 buf->b_p_cin = p_cin;
|
|
8972 buf->b_p_cink = vim_strsave(p_cink);
|
|
8973 buf->b_p_cino = vim_strsave(p_cino);
|
|
8974 #endif
|
|
8975 #ifdef FEAT_AUTOCMD
|
|
8976 /* Don't copy 'filetype', it must be detected */
|
|
8977 buf->b_p_ft = empty_option;
|
|
8978 #endif
|
|
8979 #ifdef FEAT_OSFILETYPE
|
|
8980 buf->b_p_oft = vim_strsave(p_oft);
|
|
8981 #endif
|
|
8982 buf->b_p_pi = p_pi;
|
|
8983 #if defined(FEAT_SMARTINDENT) || defined(FEAT_CINDENT)
|
|
8984 buf->b_p_cinw = vim_strsave(p_cinw);
|
|
8985 #endif
|
|
8986 #ifdef FEAT_LISP
|
|
8987 buf->b_p_lisp = p_lisp;
|
|
8988 #endif
|
|
8989 #ifdef FEAT_SYN_HL
|
|
8990 /* Don't copy 'syntax', it must be set */
|
|
8991 buf->b_p_syn = empty_option;
|
410
|
8992 buf->b_p_smc = p_smc;
|
386
|
8993 buf->b_p_spc = vim_strsave(p_spc);
|
389
|
8994 (void)compile_cap_prog(buf);
|
314
|
8995 buf->b_p_spf = vim_strsave(p_spf);
|
221
|
8996 buf->b_p_spl = vim_strsave(p_spl);
|
7
|
8997 #endif
|
|
8998 #if defined(FEAT_CINDENT) && defined(FEAT_EVAL)
|
|
8999 buf->b_p_inde = vim_strsave(p_inde);
|
|
9000 buf->b_p_indk = vim_strsave(p_indk);
|
|
9001 #endif
|
667
|
9002 #if defined(FEAT_EVAL)
|
|
9003 buf->b_p_fex = vim_strsave(p_fex);
|
|
9004 #endif
|
7
|
9005 #ifdef FEAT_CRYPT
|
|
9006 buf->b_p_key = vim_strsave(p_key);
|
|
9007 #endif
|
|
9008 #ifdef FEAT_SEARCHPATH
|
|
9009 buf->b_p_sua = vim_strsave(p_sua);
|
|
9010 #endif
|
|
9011 #ifdef FEAT_KEYMAP
|
|
9012 buf->b_p_keymap = vim_strsave(p_keymap);
|
|
9013 buf->b_kmap_state |= KEYMAP_INIT;
|
|
9014 #endif
|
|
9015 /* This isn't really an option, but copying the langmap and IME
|
|
9016 * state from the current buffer is better than resetting it. */
|
|
9017 buf->b_p_iminsert = p_iminsert;
|
|
9018 buf->b_p_imsearch = p_imsearch;
|
|
9019
|
|
9020 /* options that are normally global but also have a local value
|
|
9021 * are not copied, start using the global value */
|
|
9022 buf->b_p_ar = -1;
|
|
9023 #ifdef FEAT_QUICKFIX
|
|
9024 buf->b_p_gp = empty_option;
|
|
9025 buf->b_p_mp = empty_option;
|
|
9026 buf->b_p_efm = empty_option;
|
|
9027 #endif
|
|
9028 buf->b_p_ep = empty_option;
|
|
9029 buf->b_p_kp = empty_option;
|
|
9030 buf->b_p_path = empty_option;
|
|
9031 buf->b_p_tags = empty_option;
|
|
9032 #ifdef FEAT_FIND_ID
|
|
9033 buf->b_p_def = empty_option;
|
|
9034 buf->b_p_inc = empty_option;
|
|
9035 # ifdef FEAT_EVAL
|
|
9036 buf->b_p_inex = vim_strsave(p_inex);
|
|
9037 # endif
|
|
9038 #endif
|
|
9039 #ifdef FEAT_INS_EXPAND
|
|
9040 buf->b_p_dict = empty_option;
|
|
9041 buf->b_p_tsr = empty_option;
|
|
9042 #endif
|
12
|
9043 #ifdef FEAT_TEXTOBJ
|
|
9044 buf->b_p_qe = vim_strsave(p_qe);
|
|
9045 #endif
|
7
|
9046
|
|
9047 /*
|
|
9048 * Don't copy the options set by ex_help(), use the saved values,
|
|
9049 * when going from a help buffer to a non-help buffer.
|
|
9050 * Don't touch these at all when BCO_NOHELP is used and going from
|
|
9051 * or to a help buffer.
|
|
9052 */
|
|
9053 if (dont_do_help)
|
|
9054 buf->b_p_isk = save_p_isk;
|
|
9055 else
|
|
9056 {
|
|
9057 buf->b_p_isk = vim_strsave(p_isk);
|
|
9058 did_isk = TRUE;
|
|
9059 buf->b_p_ts = p_ts;
|
|
9060 buf->b_help = FALSE;
|
|
9061 #ifdef FEAT_QUICKFIX
|
|
9062 if (buf->b_p_bt[0] == 'h')
|
|
9063 clear_string_option(&buf->b_p_bt);
|
|
9064 #endif
|
|
9065 buf->b_p_ma = p_ma;
|
|
9066 }
|
|
9067 }
|
|
9068
|
|
9069 /*
|
|
9070 * When the options should be copied (ignoring BCO_ALWAYS), set the
|
|
9071 * flag that indicates that the options have been initialized.
|
|
9072 */
|
|
9073 if (should_copy)
|
|
9074 buf->b_p_initialized = TRUE;
|
|
9075 }
|
|
9076
|
|
9077 check_buf_options(buf); /* make sure we don't have NULLs */
|
|
9078 if (did_isk)
|
|
9079 (void)buf_init_chartab(buf, FALSE);
|
|
9080 }
|
|
9081
|
|
9082 /*
|
|
9083 * Reset the 'modifiable' option and its default value.
|
|
9084 */
|
|
9085 void
|
|
9086 reset_modifiable()
|
|
9087 {
|
|
9088 int opt_idx;
|
|
9089
|
|
9090 curbuf->b_p_ma = FALSE;
|
|
9091 p_ma = FALSE;
|
|
9092 opt_idx = findoption((char_u *)"ma");
|
|
9093 options[opt_idx].def_val[VI_DEFAULT] = FALSE;
|
|
9094 }
|
|
9095
|
|
9096 /*
|
|
9097 * Set the global value for 'iminsert' to the local value.
|
|
9098 */
|
|
9099 void
|
|
9100 set_iminsert_global()
|
|
9101 {
|
|
9102 p_iminsert = curbuf->b_p_iminsert;
|
|
9103 }
|
|
9104
|
|
9105 /*
|
|
9106 * Set the global value for 'imsearch' to the local value.
|
|
9107 */
|
|
9108 void
|
|
9109 set_imsearch_global()
|
|
9110 {
|
|
9111 p_imsearch = curbuf->b_p_imsearch;
|
|
9112 }
|
|
9113
|
|
9114 #if defined(FEAT_CMDL_COMPL) || defined(PROTO)
|
|
9115 static int expand_option_idx = -1;
|
|
9116 static char_u expand_option_name[5] = {'t', '_', NUL, NUL, NUL};
|
|
9117 static int expand_option_flags = 0;
|
|
9118
|
|
9119 void
|
|
9120 set_context_in_set_cmd(xp, arg, opt_flags)
|
|
9121 expand_T *xp;
|
|
9122 char_u *arg;
|
|
9123 int opt_flags; /* OPT_GLOBAL and/or OPT_LOCAL */
|
|
9124 {
|
|
9125 int nextchar;
|
|
9126 long_u flags = 0; /* init for GCC */
|
|
9127 int opt_idx = 0; /* init for GCC */
|
|
9128 char_u *p;
|
|
9129 char_u *s;
|
|
9130 int is_term_option = FALSE;
|
|
9131 int key;
|
|
9132
|
|
9133 expand_option_flags = opt_flags;
|
|
9134
|
|
9135 xp->xp_context = EXPAND_SETTINGS;
|
|
9136 if (*arg == NUL)
|
|
9137 {
|
|
9138 xp->xp_pattern = arg;
|
|
9139 return;
|
|
9140 }
|
|
9141 p = arg + STRLEN(arg) - 1;
|
|
9142 if (*p == ' ' && *(p - 1) != '\\')
|
|
9143 {
|
|
9144 xp->xp_pattern = p + 1;
|
|
9145 return;
|
|
9146 }
|
|
9147 while (p > arg)
|
|
9148 {
|
|
9149 s = p;
|
|
9150 /* count number of backslashes before ' ' or ',' */
|
|
9151 if (*p == ' ' || *p == ',')
|
|
9152 {
|
|
9153 while (s > arg && *(s - 1) == '\\')
|
|
9154 --s;
|
|
9155 }
|
|
9156 /* break at a space with an even number of backslashes */
|
|
9157 if (*p == ' ' && ((p - s) & 1) == 0)
|
|
9158 {
|
|
9159 ++p;
|
|
9160 break;
|
|
9161 }
|
|
9162 --p;
|
|
9163 }
|
|
9164 if (STRNCMP(p, "no", 2) == 0)
|
|
9165 {
|
|
9166 xp->xp_context = EXPAND_BOOL_SETTINGS;
|
|
9167 p += 2;
|
|
9168 }
|
|
9169 if (STRNCMP(p, "inv", 3) == 0)
|
|
9170 {
|
|
9171 xp->xp_context = EXPAND_BOOL_SETTINGS;
|
|
9172 p += 3;
|
|
9173 }
|
|
9174 xp->xp_pattern = arg = p;
|
|
9175 if (*arg == '<')
|
|
9176 {
|
|
9177 while (*p != '>')
|
|
9178 if (*p++ == NUL) /* expand terminal option name */
|
|
9179 return;
|
|
9180 key = get_special_key_code(arg + 1);
|
|
9181 if (key == 0) /* unknown name */
|
|
9182 {
|
|
9183 xp->xp_context = EXPAND_NOTHING;
|
|
9184 return;
|
|
9185 }
|
|
9186 nextchar = *++p;
|
|
9187 is_term_option = TRUE;
|
|
9188 expand_option_name[2] = KEY2TERMCAP0(key);
|
|
9189 expand_option_name[3] = KEY2TERMCAP1(key);
|
|
9190 }
|
|
9191 else
|
|
9192 {
|
|
9193 if (p[0] == 't' && p[1] == '_')
|
|
9194 {
|
|
9195 p += 2;
|
|
9196 if (*p != NUL)
|
|
9197 ++p;
|
|
9198 if (*p == NUL)
|
|
9199 return; /* expand option name */
|
|
9200 nextchar = *++p;
|
|
9201 is_term_option = TRUE;
|
|
9202 expand_option_name[2] = p[-2];
|
|
9203 expand_option_name[3] = p[-1];
|
|
9204 }
|
|
9205 else
|
|
9206 {
|
|
9207 /* Allow * wildcard */
|
|
9208 while (ASCII_ISALNUM(*p) || *p == '_' || *p == '*')
|
|
9209 p++;
|
|
9210 if (*p == NUL)
|
|
9211 return;
|
|
9212 nextchar = *p;
|
|
9213 *p = NUL;
|
|
9214 opt_idx = findoption(arg);
|
|
9215 *p = nextchar;
|
|
9216 if (opt_idx == -1 || options[opt_idx].var == NULL)
|
|
9217 {
|
|
9218 xp->xp_context = EXPAND_NOTHING;
|
|
9219 return;
|
|
9220 }
|
|
9221 flags = options[opt_idx].flags;
|
|
9222 if (flags & P_BOOL)
|
|
9223 {
|
|
9224 xp->xp_context = EXPAND_NOTHING;
|
|
9225 return;
|
|
9226 }
|
|
9227 }
|
|
9228 }
|
|
9229 /* handle "-=" and "+=" */
|
|
9230 if ((nextchar == '-' || nextchar == '+' || nextchar == '^') && p[1] == '=')
|
|
9231 {
|
|
9232 ++p;
|
|
9233 nextchar = '=';
|
|
9234 }
|
|
9235 if ((nextchar != '=' && nextchar != ':')
|
|
9236 || xp->xp_context == EXPAND_BOOL_SETTINGS)
|
|
9237 {
|
|
9238 xp->xp_context = EXPAND_UNSUCCESSFUL;
|
|
9239 return;
|
|
9240 }
|
|
9241 if (xp->xp_context != EXPAND_BOOL_SETTINGS && p[1] == NUL)
|
|
9242 {
|
|
9243 xp->xp_context = EXPAND_OLD_SETTING;
|
|
9244 if (is_term_option)
|
|
9245 expand_option_idx = -1;
|
|
9246 else
|
|
9247 expand_option_idx = opt_idx;
|
|
9248 xp->xp_pattern = p + 1;
|
|
9249 return;
|
|
9250 }
|
|
9251 xp->xp_context = EXPAND_NOTHING;
|
|
9252 if (is_term_option || (flags & P_NUM))
|
|
9253 return;
|
|
9254
|
|
9255 xp->xp_pattern = p + 1;
|
|
9256
|
|
9257 if (flags & P_EXPAND)
|
|
9258 {
|
|
9259 p = options[opt_idx].var;
|
|
9260 if (p == (char_u *)&p_bdir
|
|
9261 || p == (char_u *)&p_dir
|
|
9262 || p == (char_u *)&p_path
|
|
9263 || p == (char_u *)&p_rtp
|
|
9264 #ifdef FEAT_SEARCHPATH
|
|
9265 || p == (char_u *)&p_cdpath
|
|
9266 #endif
|
|
9267 #ifdef FEAT_SESSION
|
|
9268 || p == (char_u *)&p_vdir
|
|
9269 #endif
|
|
9270 )
|
|
9271 {
|
|
9272 xp->xp_context = EXPAND_DIRECTORIES;
|
|
9273 if (p == (char_u *)&p_path
|
|
9274 #ifdef FEAT_SEARCHPATH
|
|
9275 || p == (char_u *)&p_cdpath
|
|
9276 #endif
|
|
9277 )
|
|
9278 xp->xp_backslash = XP_BS_THREE;
|
|
9279 else
|
|
9280 xp->xp_backslash = XP_BS_ONE;
|
|
9281 }
|
|
9282 else
|
|
9283 {
|
|
9284 xp->xp_context = EXPAND_FILES;
|
|
9285 /* for 'tags' need three backslashes for a space */
|
|
9286 if (p == (char_u *)&p_tags)
|
|
9287 xp->xp_backslash = XP_BS_THREE;
|
|
9288 else
|
|
9289 xp->xp_backslash = XP_BS_ONE;
|
|
9290 }
|
|
9291 }
|
|
9292
|
|
9293 /* For an option that is a list of file names, find the start of the
|
|
9294 * last file name. */
|
|
9295 for (p = arg + STRLEN(arg) - 1; p > xp->xp_pattern; --p)
|
|
9296 {
|
|
9297 /* count number of backslashes before ' ' or ',' */
|
|
9298 if (*p == ' ' || *p == ',')
|
|
9299 {
|
|
9300 s = p;
|
|
9301 while (s > xp->xp_pattern && *(s - 1) == '\\')
|
|
9302 --s;
|
|
9303 if ((*p == ' ' && (xp->xp_backslash == XP_BS_THREE && (p - s) < 3))
|
|
9304 || (*p == ',' && (flags & P_COMMA) && ((p - s) & 1) == 0))
|
|
9305 {
|
|
9306 xp->xp_pattern = p + 1;
|
|
9307 break;
|
|
9308 }
|
|
9309 }
|
374
|
9310
|
|
9311 #ifdef FEAT_SYN_HL
|
|
9312 /* for 'spellsuggest' start at "file:" */
|
|
9313 if (options[opt_idx].var == (char_u *)&p_sps
|
|
9314 && STRNCMP(p, "file:", 5) == 0)
|
|
9315 {
|
|
9316 xp->xp_pattern = p + 5;
|
|
9317 break;
|
|
9318 }
|
|
9319 #endif
|
7
|
9320 }
|
|
9321
|
|
9322 return;
|
|
9323 }
|
|
9324
|
|
9325 int
|
|
9326 ExpandSettings(xp, regmatch, num_file, file)
|
|
9327 expand_T *xp;
|
|
9328 regmatch_T *regmatch;
|
|
9329 int *num_file;
|
|
9330 char_u ***file;
|
|
9331 {
|
|
9332 int num_normal = 0; /* Nr of matching non-term-code settings */
|
|
9333 int num_term = 0; /* Nr of matching terminal code settings */
|
|
9334 int opt_idx;
|
|
9335 int match;
|
|
9336 int count = 0;
|
|
9337 char_u *str;
|
|
9338 int loop;
|
|
9339 int is_term_opt;
|
|
9340 char_u name_buf[MAX_KEY_NAME_LEN];
|
|
9341 static char *(names[]) = {"all", "termcap"};
|
|
9342 int ic = regmatch->rm_ic; /* remember the ignore-case flag */
|
|
9343
|
|
9344 /* do this loop twice:
|
|
9345 * loop == 0: count the number of matching options
|
|
9346 * loop == 1: copy the matching options into allocated memory
|
|
9347 */
|
|
9348 for (loop = 0; loop <= 1; ++loop)
|
|
9349 {
|
|
9350 regmatch->rm_ic = ic;
|
|
9351 if (xp->xp_context != EXPAND_BOOL_SETTINGS)
|
|
9352 {
|
|
9353 for (match = 0; match < sizeof(names) / sizeof(char *); ++match)
|
|
9354 if (vim_regexec(regmatch, (char_u *)names[match], (colnr_T)0))
|
|
9355 {
|
|
9356 if (loop == 0)
|
|
9357 num_normal++;
|
|
9358 else
|
|
9359 (*file)[count++] = vim_strsave((char_u *)names[match]);
|
|
9360 }
|
|
9361 }
|
|
9362 for (opt_idx = 0; (str = (char_u *)options[opt_idx].fullname) != NULL;
|
|
9363 opt_idx++)
|
|
9364 {
|
|
9365 if (options[opt_idx].var == NULL)
|
|
9366 continue;
|
|
9367 if (xp->xp_context == EXPAND_BOOL_SETTINGS
|
|
9368 && !(options[opt_idx].flags & P_BOOL))
|
|
9369 continue;
|
|
9370 is_term_opt = istermoption(&options[opt_idx]);
|
|
9371 if (is_term_opt && num_normal > 0)
|
|
9372 continue;
|
|
9373 match = FALSE;
|
|
9374 if (vim_regexec(regmatch, str, (colnr_T)0)
|
|
9375 || (options[opt_idx].shortname != NULL
|
|
9376 && vim_regexec(regmatch,
|
|
9377 (char_u *)options[opt_idx].shortname, (colnr_T)0)))
|
|
9378 match = TRUE;
|
|
9379 else if (is_term_opt)
|
|
9380 {
|
|
9381 name_buf[0] = '<';
|
|
9382 name_buf[1] = 't';
|
|
9383 name_buf[2] = '_';
|
|
9384 name_buf[3] = str[2];
|
|
9385 name_buf[4] = str[3];
|
|
9386 name_buf[5] = '>';
|
|
9387 name_buf[6] = NUL;
|
|
9388 if (vim_regexec(regmatch, name_buf, (colnr_T)0))
|
|
9389 {
|
|
9390 match = TRUE;
|
|
9391 str = name_buf;
|
|
9392 }
|
|
9393 }
|
|
9394 if (match)
|
|
9395 {
|
|
9396 if (loop == 0)
|
|
9397 {
|
|
9398 if (is_term_opt)
|
|
9399 num_term++;
|
|
9400 else
|
|
9401 num_normal++;
|
|
9402 }
|
|
9403 else
|
|
9404 (*file)[count++] = vim_strsave(str);
|
|
9405 }
|
|
9406 }
|
|
9407 /*
|
|
9408 * Check terminal key codes, these are not in the option table
|
|
9409 */
|
|
9410 if (xp->xp_context != EXPAND_BOOL_SETTINGS && num_normal == 0)
|
|
9411 {
|
|
9412 for (opt_idx = 0; (str = get_termcode(opt_idx)) != NULL; opt_idx++)
|
|
9413 {
|
|
9414 if (!isprint(str[0]) || !isprint(str[1]))
|
|
9415 continue;
|
|
9416
|
|
9417 name_buf[0] = 't';
|
|
9418 name_buf[1] = '_';
|
|
9419 name_buf[2] = str[0];
|
|
9420 name_buf[3] = str[1];
|
|
9421 name_buf[4] = NUL;
|
|
9422
|
|
9423 match = FALSE;
|
|
9424 if (vim_regexec(regmatch, name_buf, (colnr_T)0))
|
|
9425 match = TRUE;
|
|
9426 else
|
|
9427 {
|
|
9428 name_buf[0] = '<';
|
|
9429 name_buf[1] = 't';
|
|
9430 name_buf[2] = '_';
|
|
9431 name_buf[3] = str[0];
|
|
9432 name_buf[4] = str[1];
|
|
9433 name_buf[5] = '>';
|
|
9434 name_buf[6] = NUL;
|
|
9435
|
|
9436 if (vim_regexec(regmatch, name_buf, (colnr_T)0))
|
|
9437 match = TRUE;
|
|
9438 }
|
|
9439 if (match)
|
|
9440 {
|
|
9441 if (loop == 0)
|
|
9442 num_term++;
|
|
9443 else
|
|
9444 (*file)[count++] = vim_strsave(name_buf);
|
|
9445 }
|
|
9446 }
|
|
9447
|
|
9448 /*
|
|
9449 * Check special key names.
|
|
9450 */
|
|
9451 regmatch->rm_ic = TRUE; /* ignore case here */
|
|
9452 for (opt_idx = 0; (str = get_key_name(opt_idx)) != NULL; opt_idx++)
|
|
9453 {
|
|
9454 name_buf[0] = '<';
|
|
9455 STRCPY(name_buf + 1, str);
|
|
9456 STRCAT(name_buf, ">");
|
|
9457
|
|
9458 if (vim_regexec(regmatch, name_buf, (colnr_T)0))
|
|
9459 {
|
|
9460 if (loop == 0)
|
|
9461 num_term++;
|
|
9462 else
|
|
9463 (*file)[count++] = vim_strsave(name_buf);
|
|
9464 }
|
|
9465 }
|
|
9466 }
|
|
9467 if (loop == 0)
|
|
9468 {
|
|
9469 if (num_normal > 0)
|
|
9470 *num_file = num_normal;
|
|
9471 else if (num_term > 0)
|
|
9472 *num_file = num_term;
|
|
9473 else
|
|
9474 return OK;
|
|
9475 *file = (char_u **)alloc((unsigned)(*num_file * sizeof(char_u *)));
|
|
9476 if (*file == NULL)
|
|
9477 {
|
|
9478 *file = (char_u **)"";
|
|
9479 return FAIL;
|
|
9480 }
|
|
9481 }
|
|
9482 }
|
|
9483 return OK;
|
|
9484 }
|
|
9485
|
|
9486 int
|
|
9487 ExpandOldSetting(num_file, file)
|
|
9488 int *num_file;
|
|
9489 char_u ***file;
|
|
9490 {
|
|
9491 char_u *var = NULL; /* init for GCC */
|
|
9492 char_u *buf;
|
|
9493
|
|
9494 *num_file = 0;
|
|
9495 *file = (char_u **)alloc((unsigned)sizeof(char_u *));
|
|
9496 if (*file == NULL)
|
|
9497 return FAIL;
|
|
9498
|
|
9499 /*
|
|
9500 * For a terminal key code expand_option_idx is < 0.
|
|
9501 */
|
|
9502 if (expand_option_idx < 0)
|
|
9503 {
|
|
9504 var = find_termcode(expand_option_name + 2);
|
|
9505 if (var == NULL)
|
|
9506 expand_option_idx = findoption(expand_option_name);
|
|
9507 }
|
|
9508
|
|
9509 if (expand_option_idx >= 0)
|
|
9510 {
|
|
9511 /* put string of option value in NameBuff */
|
|
9512 option_value2string(&options[expand_option_idx], expand_option_flags);
|
|
9513 var = NameBuff;
|
|
9514 }
|
|
9515 else if (var == NULL)
|
|
9516 var = (char_u *)"";
|
|
9517
|
|
9518 /* A backslash is required before some characters. This is the reverse of
|
|
9519 * what happens in do_set(). */
|
|
9520 buf = vim_strsave_escaped(var, escape_chars);
|
|
9521
|
|
9522 if (buf == NULL)
|
|
9523 {
|
|
9524 vim_free(*file);
|
|
9525 *file = NULL;
|
|
9526 return FAIL;
|
|
9527 }
|
|
9528
|
|
9529 #ifdef BACKSLASH_IN_FILENAME
|
|
9530 /* For MS-Windows et al. we don't double backslashes at the start and
|
|
9531 * before a file name character. */
|
39
|
9532 for (var = buf; *var != NUL; mb_ptr_adv(var))
|
7
|
9533 if (var[0] == '\\' && var[1] == '\\'
|
|
9534 && expand_option_idx >= 0
|
|
9535 && (options[expand_option_idx].flags & P_EXPAND)
|
|
9536 && vim_isfilec(var[2])
|
|
9537 && (var[2] != '\\' || (var == buf && var[4] != '\\')))
|
|
9538 mch_memmove(var, var + 1, STRLEN(var));
|
|
9539 #endif
|
|
9540
|
|
9541 *file[0] = buf;
|
|
9542 *num_file = 1;
|
|
9543 return OK;
|
|
9544 }
|
|
9545 #endif
|
|
9546
|
|
9547 /*
|
|
9548 * Get the value for the numeric or string option *opp in a nice format into
|
|
9549 * NameBuff[]. Must not be called with a hidden option!
|
|
9550 */
|
|
9551 static void
|
|
9552 option_value2string(opp, opt_flags)
|
|
9553 struct vimoption *opp;
|
|
9554 int opt_flags; /* OPT_GLOBAL and/or OPT_LOCAL */
|
|
9555 {
|
|
9556 char_u *varp;
|
|
9557
|
|
9558 varp = get_varp_scope(opp, opt_flags);
|
|
9559
|
|
9560 if (opp->flags & P_NUM)
|
|
9561 {
|
|
9562 long wc = 0;
|
|
9563
|
|
9564 if (wc_use_keyname(varp, &wc))
|
|
9565 STRCPY(NameBuff, get_special_key_name((int)wc, 0));
|
|
9566 else if (wc != 0)
|
|
9567 STRCPY(NameBuff, transchar((int)wc));
|
|
9568 else
|
|
9569 sprintf((char *)NameBuff, "%ld", *(long *)varp);
|
|
9570 }
|
|
9571 else /* P_STRING */
|
|
9572 {
|
|
9573 varp = *(char_u **)(varp);
|
|
9574 if (varp == NULL) /* just in case */
|
|
9575 NameBuff[0] = NUL;
|
|
9576 #ifdef FEAT_CRYPT
|
|
9577 /* don't show the actual value of 'key', only that it's set */
|
|
9578 if (opp->var == (char_u *)&p_key && *varp)
|
|
9579 STRCPY(NameBuff, "*****");
|
|
9580 #endif
|
|
9581 else if (opp->flags & P_EXPAND)
|
|
9582 home_replace(NULL, varp, NameBuff, MAXPATHL, FALSE);
|
|
9583 /* Translate 'pastetoggle' into special key names */
|
|
9584 else if ((char_u **)opp->var == &p_pt)
|
|
9585 str2specialbuf(p_pt, NameBuff, MAXPATHL);
|
|
9586 else
|
419
|
9587 vim_strncpy(NameBuff, varp, MAXPATHL - 1);
|
7
|
9588 }
|
|
9589 }
|
|
9590
|
|
9591 /*
|
|
9592 * Return TRUE if "varp" points to 'wildchar' or 'wildcharm' and it can be
|
|
9593 * printed as a keyname.
|
|
9594 * "*wcp" is set to the value of the option if it's 'wildchar' or 'wildcharm'.
|
|
9595 */
|
|
9596 static int
|
|
9597 wc_use_keyname(varp, wcp)
|
|
9598 char_u *varp;
|
|
9599 long *wcp;
|
|
9600 {
|
|
9601 if (((long *)varp == &p_wc) || ((long *)varp == &p_wcm))
|
|
9602 {
|
|
9603 *wcp = *(long *)varp;
|
|
9604 if (IS_SPECIAL(*wcp) || find_special_key_in_table((int)*wcp) >= 0)
|
|
9605 return TRUE;
|
|
9606 }
|
|
9607 return FALSE;
|
|
9608 }
|
|
9609
|
|
9610 #ifdef FEAT_LANGMAP
|
|
9611 /*
|
|
9612 * Any character has an equivalent character. This is used for keyboards that
|
|
9613 * have a special language mode that sends characters above 128 (although
|
|
9614 * other characters can be translated too).
|
|
9615 */
|
|
9616
|
|
9617 /*
|
|
9618 * char_u langmap_mapchar[256];
|
|
9619 * Normally maps each of the 128 upper chars to an <128 ascii char; used to
|
|
9620 * "translate" native lang chars in normal mode or some cases of
|
|
9621 * insert mode without having to tediously switch lang mode back&forth.
|
|
9622 */
|
|
9623
|
|
9624 static void
|
|
9625 langmap_init()
|
|
9626 {
|
|
9627 int i;
|
|
9628
|
|
9629 for (i = 0; i < 256; i++) /* we init with a-one-to one map */
|
|
9630 langmap_mapchar[i] = i;
|
|
9631 }
|
|
9632
|
|
9633 /*
|
|
9634 * Called when langmap option is set; the language map can be
|
|
9635 * changed at any time!
|
|
9636 */
|
|
9637 static void
|
|
9638 langmap_set()
|
|
9639 {
|
|
9640 char_u *p;
|
|
9641 char_u *p2;
|
|
9642 int from, to;
|
|
9643
|
|
9644 langmap_init(); /* back to one-to-one map first */
|
|
9645
|
|
9646 for (p = p_langmap; p[0] != NUL; )
|
|
9647 {
|
39
|
9648 for (p2 = p; p2[0] != NUL && p2[0] != ',' && p2[0] != ';';
|
|
9649 mb_ptr_adv(p2))
|
7
|
9650 {
|
|
9651 if (p2[0] == '\\' && p2[1] != NUL)
|
|
9652 ++p2;
|
|
9653 }
|
|
9654 if (p2[0] == ';')
|
|
9655 ++p2; /* abcd;ABCD form, p2 points to A */
|
|
9656 else
|
|
9657 p2 = NULL; /* aAbBcCdD form, p2 is NULL */
|
|
9658 while (p[0])
|
|
9659 {
|
|
9660 if (p[0] == '\\' && p[1] != NUL)
|
|
9661 ++p;
|
|
9662 #ifdef FEAT_MBYTE
|
|
9663 from = (*mb_ptr2char)(p);
|
|
9664 #else
|
|
9665 from = p[0];
|
|
9666 #endif
|
|
9667 if (p2 == NULL)
|
|
9668 {
|
39
|
9669 mb_ptr_adv(p);
|
7
|
9670 if (p[0] == '\\')
|
|
9671 ++p;
|
|
9672 #ifdef FEAT_MBYTE
|
|
9673 to = (*mb_ptr2char)(p);
|
|
9674 #else
|
|
9675 to = p[0];
|
|
9676 #endif
|
|
9677 }
|
|
9678 else
|
|
9679 {
|
|
9680 if (p2[0] == '\\')
|
|
9681 ++p2;
|
|
9682 #ifdef FEAT_MBYTE
|
|
9683 to = (*mb_ptr2char)(p2);
|
|
9684 #else
|
|
9685 to = p2[0];
|
|
9686 #endif
|
|
9687 }
|
|
9688 if (to == NUL)
|
|
9689 {
|
|
9690 EMSG2(_("E357: 'langmap': Matching character missing for %s"),
|
|
9691 transchar(from));
|
|
9692 return;
|
|
9693 }
|
|
9694 langmap_mapchar[from & 255] = to;
|
|
9695
|
|
9696 /* Advance to next pair */
|
39
|
9697 mb_ptr_adv(p);
|
7
|
9698 if (p2 == NULL)
|
|
9699 {
|
|
9700 if (p[0] == ',')
|
|
9701 {
|
|
9702 ++p;
|
|
9703 break;
|
|
9704 }
|
|
9705 }
|
|
9706 else
|
|
9707 {
|
39
|
9708 mb_ptr_adv(p2);
|
7
|
9709 if (*p == ';')
|
|
9710 {
|
|
9711 p = p2;
|
|
9712 if (p[0] != NUL)
|
|
9713 {
|
|
9714 if (p[0] != ',')
|
|
9715 {
|
|
9716 EMSG2(_("E358: 'langmap': Extra characters after semicolon: %s"), p);
|
|
9717 return;
|
|
9718 }
|
|
9719 ++p;
|
|
9720 }
|
|
9721 break;
|
|
9722 }
|
|
9723 }
|
|
9724 }
|
|
9725 }
|
|
9726 }
|
|
9727 #endif
|
|
9728
|
|
9729 /*
|
|
9730 * Return TRUE if format option 'x' is in effect.
|
|
9731 * Take care of no formatting when 'paste' is set.
|
|
9732 */
|
|
9733 int
|
|
9734 has_format_option(x)
|
|
9735 int x;
|
|
9736 {
|
|
9737 if (p_paste)
|
|
9738 return FALSE;
|
|
9739 return (vim_strchr(curbuf->b_p_fo, x) != NULL);
|
|
9740 }
|
|
9741
|
|
9742 /*
|
|
9743 * Return TRUE if "x" is present in 'shortmess' option, or
|
|
9744 * 'shortmess' contains 'a' and "x" is present in SHM_A.
|
|
9745 */
|
|
9746 int
|
|
9747 shortmess(x)
|
|
9748 int x;
|
|
9749 {
|
|
9750 return ( vim_strchr(p_shm, x) != NULL
|
|
9751 || (vim_strchr(p_shm, 'a') != NULL
|
|
9752 && vim_strchr((char_u *)SHM_A, x) != NULL));
|
|
9753 }
|
|
9754
|
|
9755 /*
|
|
9756 * paste_option_changed() - Called after p_paste was set or reset.
|
|
9757 */
|
|
9758 static void
|
|
9759 paste_option_changed()
|
|
9760 {
|
|
9761 static int old_p_paste = FALSE;
|
|
9762 static int save_sm = 0;
|
|
9763 #ifdef FEAT_CMDL_INFO
|
|
9764 static int save_ru = 0;
|
|
9765 #endif
|
|
9766 #ifdef FEAT_RIGHTLEFT
|
|
9767 static int save_ri = 0;
|
|
9768 static int save_hkmap = 0;
|
|
9769 #endif
|
|
9770 buf_T *buf;
|
|
9771
|
|
9772 if (p_paste)
|
|
9773 {
|
|
9774 /*
|
|
9775 * Paste switched from off to on.
|
|
9776 * Save the current values, so they can be restored later.
|
|
9777 */
|
|
9778 if (!old_p_paste)
|
|
9779 {
|
|
9780 /* save options for each buffer */
|
|
9781 for (buf = firstbuf; buf != NULL; buf = buf->b_next)
|
|
9782 {
|
|
9783 buf->b_p_tw_nopaste = buf->b_p_tw;
|
|
9784 buf->b_p_wm_nopaste = buf->b_p_wm;
|
|
9785 buf->b_p_sts_nopaste = buf->b_p_sts;
|
|
9786 buf->b_p_ai_nopaste = buf->b_p_ai;
|
|
9787 }
|
|
9788
|
|
9789 /* save global options */
|
|
9790 save_sm = p_sm;
|
|
9791 #ifdef FEAT_CMDL_INFO
|
|
9792 save_ru = p_ru;
|
|
9793 #endif
|
|
9794 #ifdef FEAT_RIGHTLEFT
|
|
9795 save_ri = p_ri;
|
|
9796 save_hkmap = p_hkmap;
|
|
9797 #endif
|
|
9798 /* save global values for local buffer options */
|
|
9799 p_tw_nopaste = p_tw;
|
|
9800 p_wm_nopaste = p_wm;
|
|
9801 p_sts_nopaste = p_sts;
|
|
9802 p_ai_nopaste = p_ai;
|
|
9803 }
|
|
9804
|
|
9805 /*
|
|
9806 * Always set the option values, also when 'paste' is set when it is
|
|
9807 * already on.
|
|
9808 */
|
|
9809 /* set options for each buffer */
|
|
9810 for (buf = firstbuf; buf != NULL; buf = buf->b_next)
|
|
9811 {
|
|
9812 buf->b_p_tw = 0; /* textwidth is 0 */
|
|
9813 buf->b_p_wm = 0; /* wrapmargin is 0 */
|
|
9814 buf->b_p_sts = 0; /* softtabstop is 0 */
|
|
9815 buf->b_p_ai = 0; /* no auto-indent */
|
|
9816 }
|
|
9817
|
|
9818 /* set global options */
|
|
9819 p_sm = 0; /* no showmatch */
|
|
9820 #ifdef FEAT_CMDL_INFO
|
|
9821 # ifdef FEAT_WINDOWS
|
|
9822 if (p_ru)
|
|
9823 status_redraw_all(); /* redraw to remove the ruler */
|
|
9824 # endif
|
|
9825 p_ru = 0; /* no ruler */
|
|
9826 #endif
|
|
9827 #ifdef FEAT_RIGHTLEFT
|
|
9828 p_ri = 0; /* no reverse insert */
|
|
9829 p_hkmap = 0; /* no Hebrew keyboard */
|
|
9830 #endif
|
|
9831 /* set global values for local buffer options */
|
|
9832 p_tw = 0;
|
|
9833 p_wm = 0;
|
|
9834 p_sts = 0;
|
|
9835 p_ai = 0;
|
|
9836 }
|
|
9837
|
|
9838 /*
|
|
9839 * Paste switched from on to off: Restore saved values.
|
|
9840 */
|
|
9841 else if (old_p_paste)
|
|
9842 {
|
|
9843 /* restore options for each buffer */
|
|
9844 for (buf = firstbuf; buf != NULL; buf = buf->b_next)
|
|
9845 {
|
|
9846 buf->b_p_tw = buf->b_p_tw_nopaste;
|
|
9847 buf->b_p_wm = buf->b_p_wm_nopaste;
|
|
9848 buf->b_p_sts = buf->b_p_sts_nopaste;
|
|
9849 buf->b_p_ai = buf->b_p_ai_nopaste;
|
|
9850 }
|
|
9851
|
|
9852 /* restore global options */
|
|
9853 p_sm = save_sm;
|
|
9854 #ifdef FEAT_CMDL_INFO
|
|
9855 # ifdef FEAT_WINDOWS
|
|
9856 if (p_ru != save_ru)
|
|
9857 status_redraw_all(); /* redraw to draw the ruler */
|
|
9858 # endif
|
|
9859 p_ru = save_ru;
|
|
9860 #endif
|
|
9861 #ifdef FEAT_RIGHTLEFT
|
|
9862 p_ri = save_ri;
|
|
9863 p_hkmap = save_hkmap;
|
|
9864 #endif
|
|
9865 /* set global values for local buffer options */
|
|
9866 p_tw = p_tw_nopaste;
|
|
9867 p_wm = p_wm_nopaste;
|
|
9868 p_sts = p_sts_nopaste;
|
|
9869 p_ai = p_ai_nopaste;
|
|
9870 }
|
|
9871
|
|
9872 old_p_paste = p_paste;
|
|
9873 }
|
|
9874
|
|
9875 /*
|
|
9876 * vimrc_found() - Called when a ".vimrc" or "VIMINIT" has been found.
|
|
9877 *
|
|
9878 * Reset 'compatible' and set the values for options that didn't get set yet
|
|
9879 * to the Vim defaults.
|
|
9880 * Don't do this if the 'compatible' option has been set or reset before.
|
|
9881 */
|
|
9882 void
|
|
9883 vimrc_found()
|
|
9884 {
|
|
9885 int opt_idx;
|
|
9886
|
|
9887 if (!option_was_set((char_u *)"cp"))
|
|
9888 {
|
|
9889 p_cp = FALSE;
|
|
9890 for (opt_idx = 0; !istermoption(&options[opt_idx]); opt_idx++)
|
|
9891 if (!(options[opt_idx].flags & (P_WAS_SET|P_VI_DEF)))
|
|
9892 set_option_default(opt_idx, OPT_FREE, FALSE);
|
|
9893 didset_options();
|
|
9894 }
|
|
9895 }
|
|
9896
|
|
9897 /*
|
|
9898 * Set 'compatible' on or off. Called for "-C" and "-N" command line arg.
|
|
9899 */
|
|
9900 void
|
|
9901 change_compatible(on)
|
|
9902 int on;
|
|
9903 {
|
|
9904 if (p_cp != on)
|
|
9905 {
|
|
9906 p_cp = on;
|
|
9907 compatible_set();
|
|
9908 }
|
|
9909 options[findoption((char_u *)"cp")].flags |= P_WAS_SET;
|
|
9910 }
|
|
9911
|
|
9912 /*
|
|
9913 * Return TRUE when option "name" has been set.
|
|
9914 */
|
|
9915 int
|
|
9916 option_was_set(name)
|
|
9917 char_u *name;
|
|
9918 {
|
|
9919 int idx;
|
|
9920
|
|
9921 idx = findoption(name);
|
|
9922 if (idx < 0) /* unknown option */
|
|
9923 return FALSE;
|
|
9924 if (options[idx].flags & P_WAS_SET)
|
|
9925 return TRUE;
|
|
9926 return FALSE;
|
|
9927 }
|
|
9928
|
|
9929 /*
|
|
9930 * compatible_set() - Called when 'compatible' has been set or unset.
|
|
9931 *
|
|
9932 * When 'compatible' set: Set all relevant options (those that have the P_VIM)
|
|
9933 * flag) to a Vi compatible value.
|
|
9934 * When 'compatible' is unset: Set all options that have a different default
|
|
9935 * for Vim (without the P_VI_DEF flag) to that default.
|
|
9936 */
|
|
9937 static void
|
|
9938 compatible_set()
|
|
9939 {
|
|
9940 int opt_idx;
|
|
9941
|
|
9942 for (opt_idx = 0; !istermoption(&options[opt_idx]); opt_idx++)
|
|
9943 if ( ((options[opt_idx].flags & P_VIM) && p_cp)
|
|
9944 || (!(options[opt_idx].flags & P_VI_DEF) && !p_cp))
|
|
9945 set_option_default(opt_idx, OPT_FREE, p_cp);
|
|
9946 didset_options();
|
|
9947 }
|
|
9948
|
|
9949 #ifdef FEAT_LINEBREAK
|
|
9950
|
|
9951 # if defined(__BORLANDC__) && (__BORLANDC__ < 0x500)
|
|
9952 /* Borland C++ screws up loop optimisation here (negri) */
|
133
|
9953 #pragma option -O-l
|
7
|
9954 # endif
|
|
9955
|
|
9956 /*
|
|
9957 * fill_breakat_flags() -- called when 'breakat' changes value.
|
|
9958 */
|
|
9959 static void
|
|
9960 fill_breakat_flags()
|
|
9961 {
|
500
|
9962 char_u *p;
|
7
|
9963 int i;
|
|
9964
|
|
9965 for (i = 0; i < 256; i++)
|
|
9966 breakat_flags[i] = FALSE;
|
|
9967
|
|
9968 if (p_breakat != NULL)
|
500
|
9969 for (p = p_breakat; *p; p++)
|
|
9970 breakat_flags[*p] = TRUE;
|
7
|
9971 }
|
|
9972
|
|
9973 # if defined(__BORLANDC__) && (__BORLANDC__ < 0x500)
|
133
|
9974 #pragma option -O.l
|
7
|
9975 # endif
|
|
9976
|
|
9977 #endif
|
|
9978
|
|
9979 /*
|
|
9980 * Check an option that can be a range of string values.
|
|
9981 *
|
|
9982 * Return OK for correct value, FAIL otherwise.
|
|
9983 * Empty is always OK.
|
|
9984 */
|
|
9985 static int
|
|
9986 check_opt_strings(val, values, list)
|
|
9987 char_u *val;
|
|
9988 char **values;
|
|
9989 int list; /* when TRUE: accept a list of values */
|
|
9990 {
|
|
9991 return opt_strings_flags(val, values, NULL, list);
|
|
9992 }
|
|
9993
|
|
9994 /*
|
|
9995 * Handle an option that can be a range of string values.
|
|
9996 * Set a flag in "*flagp" for each string present.
|
|
9997 *
|
|
9998 * Return OK for correct value, FAIL otherwise.
|
|
9999 * Empty is always OK.
|
|
10000 */
|
|
10001 static int
|
|
10002 opt_strings_flags(val, values, flagp, list)
|
|
10003 char_u *val; /* new value */
|
|
10004 char **values; /* array of valid string values */
|
|
10005 unsigned *flagp;
|
|
10006 int list; /* when TRUE: accept a list of values */
|
|
10007 {
|
|
10008 int i;
|
|
10009 int len;
|
|
10010 unsigned new_flags = 0;
|
|
10011
|
|
10012 while (*val)
|
|
10013 {
|
|
10014 for (i = 0; ; ++i)
|
|
10015 {
|
|
10016 if (values[i] == NULL) /* val not found in values[] */
|
|
10017 return FAIL;
|
|
10018
|
|
10019 len = (int)STRLEN(values[i]);
|
|
10020 if (STRNCMP(values[i], val, len) == 0
|
|
10021 && ((list && val[len] == ',') || val[len] == NUL))
|
|
10022 {
|
|
10023 val += len + (val[len] == ',');
|
|
10024 new_flags |= (1 << i);
|
|
10025 break; /* check next item in val list */
|
|
10026 }
|
|
10027 }
|
|
10028 }
|
|
10029 if (flagp != NULL)
|
|
10030 *flagp = new_flags;
|
|
10031
|
|
10032 return OK;
|
|
10033 }
|
|
10034
|
|
10035 /*
|
|
10036 * Read the 'wildmode' option, fill wim_flags[].
|
|
10037 */
|
|
10038 static int
|
|
10039 check_opt_wim()
|
|
10040 {
|
|
10041 char_u new_wim_flags[4];
|
|
10042 char_u *p;
|
|
10043 int i;
|
|
10044 int idx = 0;
|
|
10045
|
|
10046 for (i = 0; i < 4; ++i)
|
|
10047 new_wim_flags[i] = 0;
|
|
10048
|
|
10049 for (p = p_wim; *p; ++p)
|
|
10050 {
|
|
10051 for (i = 0; ASCII_ISALPHA(p[i]); ++i)
|
|
10052 ;
|
|
10053 if (p[i] != NUL && p[i] != ',' && p[i] != ':')
|
|
10054 return FAIL;
|
|
10055 if (i == 7 && STRNCMP(p, "longest", 7) == 0)
|
|
10056 new_wim_flags[idx] |= WIM_LONGEST;
|
|
10057 else if (i == 4 && STRNCMP(p, "full", 4) == 0)
|
|
10058 new_wim_flags[idx] |= WIM_FULL;
|
|
10059 else if (i == 4 && STRNCMP(p, "list", 4) == 0)
|
|
10060 new_wim_flags[idx] |= WIM_LIST;
|
|
10061 else
|
|
10062 return FAIL;
|
|
10063 p += i;
|
|
10064 if (*p == NUL)
|
|
10065 break;
|
|
10066 if (*p == ',')
|
|
10067 {
|
|
10068 if (idx == 3)
|
|
10069 return FAIL;
|
|
10070 ++idx;
|
|
10071 }
|
|
10072 }
|
|
10073
|
|
10074 /* fill remaining entries with last flag */
|
|
10075 while (idx < 3)
|
|
10076 {
|
|
10077 new_wim_flags[idx + 1] = new_wim_flags[idx];
|
|
10078 ++idx;
|
|
10079 }
|
|
10080
|
|
10081 /* only when there are no errors, wim_flags[] is changed */
|
|
10082 for (i = 0; i < 4; ++i)
|
|
10083 wim_flags[i] = new_wim_flags[i];
|
|
10084 return OK;
|
|
10085 }
|
|
10086
|
|
10087 /*
|
|
10088 * Check if backspacing over something is allowed.
|
|
10089 */
|
|
10090 int
|
|
10091 can_bs(what)
|
|
10092 int what; /* BS_INDENT, BS_EOL or BS_START */
|
|
10093 {
|
|
10094 switch (*p_bs)
|
|
10095 {
|
|
10096 case '2': return TRUE;
|
|
10097 case '1': return (what != BS_START);
|
|
10098 case '0': return FALSE;
|
|
10099 }
|
|
10100 return vim_strchr(p_bs, what) != NULL;
|
|
10101 }
|
|
10102
|
|
10103 /*
|
|
10104 * Save the current values of 'fileformat' and 'fileencoding', so that we know
|
|
10105 * the file must be considered changed when the value is different.
|
|
10106 */
|
|
10107 void
|
|
10108 save_file_ff(buf)
|
|
10109 buf_T *buf;
|
|
10110 {
|
|
10111 buf->b_start_ffc = *buf->b_p_ff;
|
|
10112 buf->b_start_eol = buf->b_p_eol;
|
|
10113 #ifdef FEAT_MBYTE
|
|
10114 /* Only use free/alloc when necessary, they take time. */
|
|
10115 if (buf->b_start_fenc == NULL
|
|
10116 || STRCMP(buf->b_start_fenc, buf->b_p_fenc) != 0)
|
|
10117 {
|
|
10118 vim_free(buf->b_start_fenc);
|
|
10119 buf->b_start_fenc = vim_strsave(buf->b_p_fenc);
|
|
10120 }
|
|
10121 #endif
|
|
10122 }
|
|
10123
|
|
10124 /*
|
|
10125 * Return TRUE if 'fileformat' and/or 'fileencoding' has a different value
|
|
10126 * from when editing started (save_file_ff() called).
|
|
10127 * Also when 'endofline' was changed and 'binary' is set.
|
|
10128 * Don't consider a new, empty buffer to be changed.
|
|
10129 */
|
|
10130 int
|
|
10131 file_ff_differs(buf)
|
|
10132 buf_T *buf;
|
|
10133 {
|
|
10134 if ((buf->b_flags & BF_NEW)
|
|
10135 && buf->b_ml.ml_line_count == 1
|
|
10136 && *ml_get_buf(buf, (linenr_T)1, FALSE) == NUL)
|
|
10137 return FALSE;
|
|
10138 if (buf->b_start_ffc != *buf->b_p_ff)
|
|
10139 return TRUE;
|
|
10140 if (buf->b_p_bin && buf->b_start_eol != buf->b_p_eol)
|
|
10141 return TRUE;
|
|
10142 #ifdef FEAT_MBYTE
|
|
10143 if (buf->b_start_fenc == NULL)
|
|
10144 return (*buf->b_p_fenc != NUL);
|
|
10145 return (STRCMP(buf->b_start_fenc, buf->b_p_fenc) != 0);
|
|
10146 #else
|
|
10147 return FALSE;
|
|
10148 #endif
|
|
10149 }
|
|
10150
|
|
10151 /*
|
|
10152 * return OK if "p" is a valid fileformat name, FAIL otherwise.
|
|
10153 */
|
|
10154 int
|
|
10155 check_ff_value(p)
|
|
10156 char_u *p;
|
|
10157 {
|
|
10158 return check_opt_strings(p, p_ff_values, FALSE);
|
|
10159 }
|