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
|
|
82 , PV_FF
|
|
83 , PV_FML
|
|
84 , PV_FMR
|
41
|
85 , PV_FLP
|
7
|
86 , PV_FO
|
|
87 , PV_FT
|
|
88 , PV_GP
|
|
89 , PV_IMI
|
|
90 , PV_IMS
|
|
91 , PV_INC
|
|
92 , PV_INDE
|
|
93 , PV_INDK
|
|
94 , PV_INEX
|
|
95 , PV_INF
|
|
96 , PV_ISK
|
|
97 , PV_KEY
|
|
98 , PV_KMAP
|
|
99 , PV_KP
|
|
100 , PV_LBR
|
|
101 , PV_LISP
|
|
102 , PV_LIST
|
|
103 , PV_MA
|
|
104 , PV_ML
|
|
105 , PV_MOD
|
|
106 , PV_MP
|
|
107 , PV_MPS
|
|
108 , PV_NF
|
|
109 , PV_NU
|
13
|
110 , PV_NUW
|
7
|
111 , PV_OFT
|
502
|
112 , PV_OFU
|
7
|
113 , PV_PATH
|
|
114 , PV_PI
|
|
115 , PV_PVW
|
12
|
116 , PV_QE
|
7
|
117 , PV_RL
|
|
118 , PV_RLC
|
|
119 , PV_RO
|
|
120 , PV_SCBIND
|
|
121 , PV_SCROLL
|
|
122 , PV_SI
|
221
|
123 , PV_SN
|
|
124 , PV_SPELL
|
386
|
125 , PV_SPC
|
314
|
126 , PV_SPF
|
221
|
127 , PV_SPL
|
40
|
128 , PV_STL
|
7
|
129 , PV_STS
|
|
130 , PV_SUA
|
|
131 , PV_SW
|
|
132 , PV_SWF
|
410
|
133 , PV_SMC
|
7
|
134 , PV_SYN
|
|
135 , PV_TAGS
|
|
136 , PV_TS
|
|
137 , PV_TSR
|
|
138 , PV_TW
|
|
139 , PV_TX
|
|
140 , PV_WFH
|
|
141 , PV_WM
|
|
142 , PV_WRAP
|
|
143 } idopt_T;
|
|
144
|
|
145 /*
|
|
146 * Options local to a window have a value local to a buffer and global to all
|
|
147 * buffers. Indicate this by setting "var" to VAR_WIN.
|
|
148 */
|
|
149 #define VAR_WIN ((char_u *)-1)
|
|
150
|
|
151 /*
|
|
152 * These the global values for options which are also local to a buffer.
|
|
153 * Only to be used in option.c!
|
|
154 */
|
|
155 static int p_ai;
|
|
156 static int p_bin;
|
|
157 #ifdef FEAT_MBYTE
|
|
158 static int p_bomb;
|
|
159 #endif
|
|
160 #if defined(FEAT_QUICKFIX)
|
|
161 static char_u *p_bh;
|
|
162 static char_u *p_bt;
|
|
163 #endif
|
|
164 static int p_bl;
|
|
165 static int p_ci;
|
|
166 #ifdef FEAT_CINDENT
|
|
167 static int p_cin;
|
|
168 static char_u *p_cink;
|
|
169 static char_u *p_cino;
|
|
170 #endif
|
|
171 #if defined(FEAT_SMARTINDENT) || defined(FEAT_CINDENT)
|
|
172 static char_u *p_cinw;
|
|
173 #endif
|
|
174 #ifdef FEAT_COMMENTS
|
|
175 static char_u *p_com;
|
|
176 #endif
|
|
177 #ifdef FEAT_FOLDING
|
|
178 static char_u *p_cms;
|
|
179 #endif
|
|
180 #ifdef FEAT_INS_EXPAND
|
|
181 static char_u *p_cpt;
|
|
182 #endif
|
12
|
183 #ifdef FEAT_COMPL_FUNC
|
|
184 static char_u *p_cfu;
|
502
|
185 static char_u *p_ofu;
|
12
|
186 #endif
|
7
|
187 static int p_eol;
|
|
188 static int p_et;
|
|
189 #ifdef FEAT_MBYTE
|
|
190 static char_u *p_fenc;
|
|
191 #endif
|
|
192 static char_u *p_ff;
|
|
193 static char_u *p_fo;
|
41
|
194 static char_u *p_flp;
|
7
|
195 #ifdef FEAT_AUTOCMD
|
|
196 static char_u *p_ft;
|
|
197 #endif
|
|
198 static long p_iminsert;
|
|
199 static long p_imsearch;
|
|
200 #if defined(FEAT_FIND_ID) && defined(FEAT_EVAL)
|
|
201 static char_u *p_inex;
|
|
202 #endif
|
|
203 #if defined(FEAT_CINDENT) && defined(FEAT_EVAL)
|
|
204 static char_u *p_inde;
|
|
205 static char_u *p_indk;
|
|
206 #endif
|
|
207 static int p_inf;
|
|
208 static char_u *p_isk;
|
|
209 #ifdef FEAT_CRYPT
|
|
210 static char_u *p_key;
|
|
211 #endif
|
|
212 #ifdef FEAT_LISP
|
|
213 static int p_lisp;
|
|
214 #endif
|
|
215 static int p_ml;
|
|
216 static int p_ma;
|
|
217 static int p_mod;
|
|
218 static char_u *p_mps;
|
|
219 static char_u *p_nf;
|
|
220 #ifdef FEAT_OSFILETYPE
|
|
221 static char_u *p_oft;
|
|
222 #endif
|
|
223 static int p_pi;
|
12
|
224 #ifdef FEAT_TEXTOBJ
|
|
225 static char_u *p_qe;
|
|
226 #endif
|
7
|
227 static int p_ro;
|
|
228 #ifdef FEAT_SMARTINDENT
|
|
229 static int p_si;
|
|
230 #endif
|
|
231 #ifndef SHORT_FNAME
|
|
232 static int p_sn;
|
|
233 #endif
|
|
234 static long p_sts;
|
|
235 #if defined(FEAT_SEARCHPATH)
|
|
236 static char_u *p_sua;
|
|
237 #endif
|
|
238 static long p_sw;
|
|
239 static int p_swf;
|
|
240 #ifdef FEAT_SYN_HL
|
410
|
241 static long p_smc;
|
7
|
242 static char_u *p_syn;
|
386
|
243 static char_u *p_spc;
|
314
|
244 static char_u *p_spf;
|
221
|
245 static char_u *p_spl;
|
7
|
246 #endif
|
|
247 static long p_ts;
|
|
248 static long p_tw;
|
|
249 static int p_tx;
|
|
250 static long p_wm;
|
|
251 #ifdef FEAT_KEYMAP
|
|
252 static char_u *p_keymap;
|
|
253 #endif
|
|
254
|
|
255 /* Saved values for when 'bin' is set. */
|
|
256 static int p_et_nobin;
|
|
257 static int p_ml_nobin;
|
|
258 static long p_tw_nobin;
|
|
259 static long p_wm_nobin;
|
|
260
|
|
261 /* Saved values for when 'paste' is set */
|
|
262 static long p_tw_nopaste;
|
|
263 static long p_wm_nopaste;
|
|
264 static long p_sts_nopaste;
|
|
265 static int p_ai_nopaste;
|
|
266
|
|
267 struct vimoption
|
|
268 {
|
|
269 char *fullname; /* full option name */
|
|
270 char *shortname; /* permissible abbreviation */
|
|
271 long_u flags; /* see below */
|
|
272 char_u *var; /* global option: pointer to variable;
|
|
273 * window-local option: VAR_WIN;
|
|
274 * buffer-local option: global value */
|
|
275 idopt_T indir; /* global option: PV_NONE;
|
|
276 * local option: indirect option index */
|
|
277 char_u *def_val[2]; /* default values for variable (vi and vim) */
|
|
278 #ifdef FEAT_EVAL
|
|
279 scid_T scriptID; /* script in which the option was last set */
|
|
280 #endif
|
|
281 };
|
|
282
|
|
283 #define VI_DEFAULT 0 /* def_val[VI_DEFAULT] is Vi default value */
|
|
284 #define VIM_DEFAULT 1 /* def_val[VIM_DEFAULT] is Vim default value */
|
|
285
|
|
286 /*
|
|
287 * Flags
|
|
288 */
|
|
289 #define P_BOOL 0x01 /* the option is boolean */
|
|
290 #define P_NUM 0x02 /* the option is numeric */
|
|
291 #define P_STRING 0x04 /* the option is a string */
|
|
292 #define P_ALLOCED 0x08 /* the string option is in allocated memory,
|
|
293 must use vim_free() when assigning new
|
|
294 value. Not set if default is the same. */
|
|
295 #define P_EXPAND 0x10 /* environment expansion. NOTE: P_EXPAND can
|
|
296 never be used for local or hidden options! */
|
|
297 #define P_NODEFAULT 0x40 /* don't set to default value */
|
|
298 #define P_DEF_ALLOCED 0x80 /* default value is in allocated memory, must
|
|
299 use vim_free() when assigning new value */
|
|
300 #define P_WAS_SET 0x100 /* option has been set/reset */
|
|
301 #define P_NO_MKRC 0x200 /* don't include in :mkvimrc output */
|
|
302 #define P_VI_DEF 0x400 /* Use Vi default for Vim */
|
|
303 #define P_VIM 0x800 /* Vim option, reset when 'cp' set */
|
|
304
|
|
305 /* when option changed, what to display: */
|
|
306 #define P_RSTAT 0x1000 /* redraw status lines */
|
|
307 #define P_RWIN 0x2000 /* redraw current window */
|
|
308 #define P_RBUF 0x4000 /* redraw current buffer */
|
|
309 #define P_RALL 0x6000 /* redraw all windows */
|
|
310 #define P_RCLR 0x7000 /* clear and redraw all */
|
|
311
|
|
312 #define P_COMMA 0x8000 /* comma separated list */
|
|
313 #define P_NODUP 0x10000L/* don't allow duplicate strings */
|
|
314 #define P_FLAGLIST 0x20000L/* list of single-char flags */
|
|
315
|
|
316 #define P_SECURE 0x40000L/* cannot change in modeline or secure mode */
|
|
317 #define P_GETTEXT 0x80000L/* expand default value with _() */
|
|
318 #define P_NOGLOB 0x100000L/* do not use local value for global vimrc */
|
36
|
319 #define P_NFNAME 0x200000L/* only normal file name chars allowed */
|
7
|
320
|
|
321 /*
|
|
322 * options[] is initialized here.
|
|
323 * The order of the options MUST be alphabetic for ":set all" and findoption().
|
|
324 * All option names MUST start with a lowercase letter (for findoption()).
|
|
325 * Exception: "t_" options are at the end.
|
|
326 * The options with a NULL variable are 'hidden': a set command for them is
|
|
327 * ignored and they are not printed.
|
|
328 */
|
|
329 static struct vimoption
|
|
330 #ifdef FEAT_GUI_W16
|
|
331 _far
|
|
332 #endif
|
|
333 options[] =
|
|
334 {
|
|
335 {"aleph", "al", P_NUM|P_VI_DEF,
|
|
336 #ifdef FEAT_RIGHTLEFT
|
|
337 (char_u *)&p_aleph, PV_NONE,
|
|
338 #else
|
|
339 (char_u *)NULL, PV_NONE,
|
|
340 #endif
|
|
341 {
|
|
342 #if (defined(MSDOS) || defined(WIN3264) || defined(OS2)) && !defined(FEAT_GUI_W32)
|
|
343 (char_u *)128L,
|
|
344 #else
|
|
345 (char_u *)224L,
|
|
346 #endif
|
|
347 (char_u *)0L}},
|
|
348 {"antialias", "anti", P_BOOL|P_VI_DEF|P_VIM|P_RCLR,
|
|
349 #if defined(FEAT_GUI) && defined(MACOS_X)
|
|
350 (char_u *)&p_antialias, PV_NONE,
|
|
351 {(char_u *)FALSE, (char_u *)FALSE}
|
|
352 #else
|
|
353 (char_u *)NULL, PV_NONE,
|
|
354 {(char_u *)FALSE, (char_u *)FALSE}
|
|
355 #endif
|
|
356 },
|
|
357 {"arabic", "arab", P_BOOL|P_VI_DEF|P_VIM,
|
|
358 #ifdef FEAT_ARABIC
|
|
359 (char_u *)VAR_WIN, PV_ARAB,
|
|
360 #else
|
|
361 (char_u *)NULL, PV_NONE,
|
|
362 #endif
|
|
363 {(char_u *)FALSE, (char_u *)0L}},
|
|
364 {"arabicshape", "arshape", P_BOOL|P_VI_DEF|P_VIM|P_RCLR,
|
|
365 #ifdef FEAT_ARABIC
|
|
366 (char_u *)&p_arshape, PV_NONE,
|
|
367 #else
|
|
368 (char_u *)NULL, PV_NONE,
|
|
369 #endif
|
|
370 {(char_u *)TRUE, (char_u *)0L}},
|
|
371 {"allowrevins", "ari", P_BOOL|P_VI_DEF|P_VIM,
|
|
372 #ifdef FEAT_RIGHTLEFT
|
|
373 (char_u *)&p_ari, PV_NONE,
|
|
374 #else
|
|
375 (char_u *)NULL, PV_NONE,
|
|
376 #endif
|
|
377 {(char_u *)FALSE, (char_u *)0L}},
|
|
378 {"altkeymap", "akm", P_BOOL|P_VI_DEF,
|
|
379 #ifdef FEAT_FKMAP
|
|
380 (char_u *)&p_altkeymap, PV_NONE,
|
|
381 #else
|
|
382 (char_u *)NULL, PV_NONE,
|
|
383 #endif
|
|
384 {(char_u *)FALSE, (char_u *)0L}},
|
|
385 {"ambiwidth", "ambw", P_STRING|P_VI_DEF|P_RCLR,
|
|
386 #if defined(FEAT_MBYTE)
|
|
387 (char_u *)&p_ambw, PV_NONE,
|
|
388 {(char_u *)"single", (char_u *)0L}
|
|
389 #else
|
|
390 (char_u *)NULL, PV_NONE,
|
|
391 {(char_u *)0L, (char_u *)0L}
|
|
392 #endif
|
|
393 },
|
|
394 #if defined(FEAT_NETBEANS_INTG) || defined(FEAT_SUN_WORKSHOP)
|
|
395 {"autochdir", "acd", P_BOOL|P_VI_DEF,
|
|
396 (char_u *)&p_acd, PV_NONE,
|
|
397 {(char_u *)FALSE, (char_u *)0L}},
|
|
398 #endif
|
|
399 {"autoindent", "ai", P_BOOL|P_VI_DEF,
|
|
400 (char_u *)&p_ai, PV_AI,
|
|
401 {(char_u *)FALSE, (char_u *)0L}},
|
|
402 {"autoprint", "ap", P_BOOL|P_VI_DEF,
|
|
403 (char_u *)NULL, PV_NONE,
|
|
404 {(char_u *)FALSE, (char_u *)0L}},
|
|
405 {"autoread", "ar", P_BOOL|P_VI_DEF,
|
|
406 (char_u *)&p_ar, OPT_BOTH(PV_AR),
|
|
407 {(char_u *)FALSE, (char_u *)0L}},
|
|
408 {"autowrite", "aw", P_BOOL|P_VI_DEF,
|
|
409 (char_u *)&p_aw, PV_NONE,
|
|
410 {(char_u *)FALSE, (char_u *)0L}},
|
|
411 {"autowriteall","awa", P_BOOL|P_VI_DEF,
|
|
412 (char_u *)&p_awa, PV_NONE,
|
|
413 {(char_u *)FALSE, (char_u *)0L}},
|
|
414 {"background", "bg", P_STRING|P_VI_DEF|P_RCLR,
|
|
415 (char_u *)&p_bg, PV_NONE,
|
|
416 {
|
|
417 #if (defined(MSDOS) || defined(OS2) || defined(WIN3264)) && !defined(FEAT_GUI)
|
|
418 (char_u *)"dark",
|
|
419 #else
|
|
420 (char_u *)"light",
|
|
421 #endif
|
|
422 (char_u *)0L}},
|
|
423 {"backspace", "bs", P_STRING|P_VI_DEF|P_VIM|P_COMMA|P_NODUP,
|
|
424 (char_u *)&p_bs, PV_NONE,
|
|
425 {(char_u *)"", (char_u *)0L}},
|
|
426 {"backup", "bk", P_BOOL|P_VI_DEF|P_VIM,
|
|
427 (char_u *)&p_bk, PV_NONE,
|
|
428 {(char_u *)FALSE, (char_u *)0L}},
|
|
429 {"backupcopy", "bkc", P_STRING|P_VIM|P_COMMA|P_NODUP,
|
|
430 (char_u *)&p_bkc, PV_NONE,
|
|
431 #ifdef UNIX
|
|
432 {(char_u *)"yes", (char_u *)"auto"}
|
|
433 #else
|
|
434 {(char_u *)"auto", (char_u *)"auto"}
|
|
435 #endif
|
|
436 },
|
|
437 {"backupdir", "bdir", P_STRING|P_EXPAND|P_VI_DEF|P_COMMA|P_NODUP|P_SECURE,
|
|
438 (char_u *)&p_bdir, PV_NONE,
|
|
439 {(char_u *)DFLT_BDIR, (char_u *)0L}},
|
36
|
440 {"backupext", "bex", P_STRING|P_VI_DEF|P_NFNAME,
|
7
|
441 (char_u *)&p_bex, PV_NONE,
|
|
442 {
|
|
443 #ifdef VMS
|
|
444 (char_u *)"_",
|
|
445 #else
|
|
446 (char_u *)"~",
|
|
447 #endif
|
|
448 (char_u *)0L}},
|
|
449 {"backupskip", "bsk", P_STRING|P_VI_DEF|P_COMMA,
|
|
450 #ifdef FEAT_WILDIGN
|
|
451 (char_u *)&p_bsk, PV_NONE,
|
|
452 {(char_u *)"", (char_u *)0L}
|
|
453 #else
|
|
454 (char_u *)NULL, PV_NONE,
|
|
455 {(char_u *)0L, (char_u *)0L}
|
|
456 #endif
|
|
457 },
|
|
458 #ifdef FEAT_BEVAL
|
|
459 {"balloondelay","bdlay",P_NUM|P_VI_DEF,
|
|
460 (char_u *)&p_bdlay, PV_NONE,
|
|
461 {(char_u *)600L, (char_u *)0L}},
|
|
462 {"ballooneval", "beval",P_BOOL|P_VI_DEF|P_NO_MKRC,
|
|
463 (char_u *)&p_beval, PV_NONE,
|
190
|
464 {(char_u *)FALSE, (char_u *)0L}},
|
|
465 # ifdef FEAT_EVAL
|
|
466 {"balloonexpr", "bexpr", P_STRING|P_ALLOCED|P_VI_DEF|P_VIM,
|
|
467 (char_u *)&p_bexpr, PV_NONE,
|
|
468 {(char_u *)"", (char_u *)0L}},
|
|
469 # endif
|
7
|
470 #endif
|
|
471 {"beautify", "bf", P_BOOL|P_VI_DEF,
|
|
472 (char_u *)NULL, PV_NONE,
|
|
473 {(char_u *)FALSE, (char_u *)0L}},
|
|
474 {"binary", "bin", P_BOOL|P_VI_DEF|P_RSTAT,
|
|
475 (char_u *)&p_bin, PV_BIN,
|
|
476 {(char_u *)FALSE, (char_u *)0L}},
|
|
477 {"bioskey", "biosk",P_BOOL|P_VI_DEF,
|
|
478 #ifdef MSDOS
|
|
479 (char_u *)&p_biosk, PV_NONE,
|
|
480 #else
|
|
481 (char_u *)NULL, PV_NONE,
|
|
482 #endif
|
|
483 {(char_u *)TRUE, (char_u *)0L}},
|
|
484 {"bomb", NULL, P_BOOL|P_NO_MKRC|P_VI_DEF|P_RSTAT,
|
|
485 #ifdef FEAT_MBYTE
|
|
486 (char_u *)&p_bomb, PV_BOMB,
|
|
487 #else
|
|
488 (char_u *)NULL, PV_NONE,
|
|
489 #endif
|
|
490 {(char_u *)FALSE, (char_u *)0L}},
|
|
491 {"breakat", "brk", P_STRING|P_VI_DEF|P_RALL|P_FLAGLIST,
|
|
492 #ifdef FEAT_LINEBREAK
|
|
493 (char_u *)&p_breakat, PV_NONE,
|
|
494 {(char_u *)" \t!@*-+;:,./?", (char_u *)0L}
|
|
495 #else
|
|
496 (char_u *)NULL, PV_NONE,
|
|
497 {(char_u *)0L, (char_u *)0L}
|
|
498 #endif
|
|
499 },
|
|
500 {"browsedir", "bsdir",P_STRING|P_VI_DEF,
|
|
501 #ifdef FEAT_BROWSE
|
|
502 (char_u *)&p_bsdir, PV_NONE,
|
|
503 {(char_u *)"last", (char_u *)0L}
|
|
504 #else
|
|
505 (char_u *)NULL, PV_NONE,
|
|
506 {(char_u *)0L, (char_u *)0L}
|
|
507 #endif
|
|
508 },
|
|
509 {"bufhidden", "bh", P_STRING|P_ALLOCED|P_VI_DEF|P_NOGLOB,
|
|
510 #if defined(FEAT_QUICKFIX)
|
|
511 (char_u *)&p_bh, PV_BH,
|
|
512 {(char_u *)"", (char_u *)0L}
|
|
513 #else
|
|
514 (char_u *)NULL, PV_NONE,
|
|
515 {(char_u *)0L, (char_u *)0L}
|
|
516 #endif
|
|
517 },
|
|
518 {"buflisted", "bl", P_BOOL|P_VI_DEF|P_NOGLOB,
|
|
519 (char_u *)&p_bl, PV_BL,
|
|
520 {(char_u *)1L, (char_u *)0L}
|
|
521 },
|
|
522 {"buftype", "bt", P_STRING|P_ALLOCED|P_VI_DEF|P_NOGLOB,
|
|
523 #if defined(FEAT_QUICKFIX)
|
|
524 (char_u *)&p_bt, PV_BT,
|
|
525 {(char_u *)"", (char_u *)0L}
|
|
526 #else
|
|
527 (char_u *)NULL, PV_NONE,
|
|
528 {(char_u *)0L, (char_u *)0L}
|
|
529 #endif
|
|
530 },
|
|
531 {"casemap", "cmp", P_STRING|P_VI_DEF|P_COMMA|P_NODUP,
|
|
532 (char_u *)&p_cmp, PV_NONE,
|
|
533 {(char_u *)"internal,keepascii", (char_u *)0L}
|
|
534 },
|
|
535 {"cdpath", "cd", P_STRING|P_EXPAND|P_VI_DEF|P_COMMA|P_NODUP,
|
|
536 #ifdef FEAT_SEARCHPATH
|
|
537 (char_u *)&p_cdpath, PV_NONE,
|
|
538 {(char_u *)",,", (char_u *)0L}
|
|
539 #else
|
|
540 (char_u *)NULL, PV_NONE,
|
|
541 {(char_u *)0L, (char_u *)0L}
|
|
542 #endif
|
|
543 },
|
|
544 {"cedit", NULL, P_STRING,
|
|
545 #ifdef FEAT_CMDWIN
|
|
546 (char_u *)&p_cedit, PV_NONE,
|
|
547 {(char_u *)"", (char_u *)CTRL_F_STR}
|
|
548 #else
|
|
549 (char_u *)NULL, PV_NONE,
|
|
550 {(char_u *)0L, (char_u *)0L}
|
|
551 #endif
|
|
552 },
|
|
553 {"charconvert", "ccv", P_STRING|P_VI_DEF|P_SECURE,
|
|
554 #if defined(FEAT_MBYTE) && defined(FEAT_EVAL)
|
|
555 (char_u *)&p_ccv, PV_NONE,
|
|
556 {(char_u *)"", (char_u *)0L}
|
|
557 #else
|
|
558 (char_u *)NULL, PV_NONE,
|
|
559 {(char_u *)0L, (char_u *)0L}
|
|
560 #endif
|
|
561 },
|
|
562 {"cindent", "cin", P_BOOL|P_VI_DEF|P_VIM,
|
|
563 #ifdef FEAT_CINDENT
|
|
564 (char_u *)&p_cin, PV_CIN,
|
|
565 #else
|
|
566 (char_u *)NULL, PV_NONE,
|
|
567 #endif
|
|
568 {(char_u *)FALSE, (char_u *)0L}},
|
|
569 {"cinkeys", "cink", P_STRING|P_ALLOCED|P_VI_DEF|P_COMMA|P_NODUP,
|
|
570 #ifdef FEAT_CINDENT
|
|
571 (char_u *)&p_cink, PV_CINK,
|
|
572 {(char_u *)"0{,0},0),:,0#,!^F,o,O,e", (char_u *)0L}
|
|
573 #else
|
|
574 (char_u *)NULL, PV_NONE,
|
|
575 {(char_u *)0L, (char_u *)0L}
|
|
576 #endif
|
|
577 },
|
|
578 {"cinoptions", "cino", P_STRING|P_ALLOCED|P_VI_DEF|P_COMMA|P_NODUP,
|
|
579 #ifdef FEAT_CINDENT
|
|
580 (char_u *)&p_cino, PV_CINO,
|
|
581 #else
|
|
582 (char_u *)NULL, PV_NONE,
|
|
583 #endif
|
|
584 {(char_u *)"", (char_u *)0L}},
|
|
585 {"cinwords", "cinw", P_STRING|P_ALLOCED|P_VI_DEF|P_COMMA|P_NODUP,
|
|
586 #if defined(FEAT_SMARTINDENT) || defined(FEAT_CINDENT)
|
|
587 (char_u *)&p_cinw, PV_CINW,
|
|
588 {(char_u *)"if,else,while,do,for,switch",
|
|
589 (char_u *)0L}
|
|
590 #else
|
|
591 (char_u *)NULL, PV_NONE,
|
|
592 {(char_u *)0L, (char_u *)0L}
|
|
593 #endif
|
|
594 },
|
|
595 {"clipboard", "cb", P_STRING|P_VI_DEF|P_COMMA|P_NODUP,
|
|
596 #ifdef FEAT_CLIPBOARD
|
|
597 (char_u *)&p_cb, PV_NONE,
|
|
598 # ifdef FEAT_XCLIPBOARD
|
|
599 {(char_u *)"autoselect,exclude:cons\\|linux",
|
|
600 (char_u *)0L}
|
|
601 # else
|
|
602 {(char_u *)"", (char_u *)0L}
|
|
603 # endif
|
|
604 #else
|
|
605 (char_u *)NULL, PV_NONE,
|
|
606 {(char_u *)"", (char_u *)0L}
|
|
607 #endif
|
|
608 },
|
|
609 {"cmdheight", "ch", P_NUM|P_VI_DEF|P_RALL,
|
|
610 (char_u *)&p_ch, PV_NONE,
|
|
611 {(char_u *)1L, (char_u *)0L}},
|
|
612 {"cmdwinheight", "cwh", P_NUM|P_VI_DEF,
|
|
613 #ifdef FEAT_CMDWIN
|
|
614 (char_u *)&p_cwh, PV_NONE,
|
|
615 #else
|
|
616 (char_u *)NULL, PV_NONE,
|
|
617 #endif
|
|
618 {(char_u *)7L, (char_u *)0L}},
|
|
619 {"columns", "co", P_NUM|P_NODEFAULT|P_NO_MKRC|P_VI_DEF|P_RCLR,
|
|
620 (char_u *)&Columns, PV_NONE,
|
|
621 {(char_u *)80L, (char_u *)0L}},
|
|
622 {"comments", "com", P_STRING|P_ALLOCED|P_VI_DEF|P_COMMA|P_NODUP,
|
|
623 #ifdef FEAT_COMMENTS
|
|
624 (char_u *)&p_com, PV_COM,
|
|
625 {(char_u *)"s1:/*,mb:*,ex:*/,://,b:#,:%,:XCOMM,n:>,fb:-",
|
|
626 (char_u *)0L}
|
|
627 #else
|
|
628 (char_u *)NULL, PV_NONE,
|
|
629 {(char_u *)0L, (char_u *)0L}
|
|
630 #endif
|
|
631 },
|
|
632 {"commentstring", "cms", P_STRING|P_ALLOCED|P_VI_DEF,
|
|
633 #ifdef FEAT_FOLDING
|
|
634 (char_u *)&p_cms, PV_CMS,
|
|
635 {(char_u *)"/*%s*/", (char_u *)0L}
|
|
636 #else
|
|
637 (char_u *)NULL, PV_NONE,
|
|
638 {(char_u *)0L, (char_u *)0L}
|
|
639 #endif
|
|
640 },
|
|
641 {"compatible", "cp", P_BOOL|P_RALL,
|
|
642 (char_u *)&p_cp, PV_NONE,
|
|
643 {(char_u *)TRUE, (char_u *)FALSE}},
|
|
644 {"complete", "cpt", P_STRING|P_ALLOCED|P_VI_DEF|P_COMMA|P_NODUP,
|
|
645 #ifdef FEAT_INS_EXPAND
|
|
646 (char_u *)&p_cpt, PV_CPT,
|
|
647 {(char_u *)".,w,b,u,t,i", (char_u *)0L}
|
|
648 #else
|
|
649 (char_u *)NULL, PV_NONE,
|
|
650 {(char_u *)0L, (char_u *)0L}
|
|
651 #endif
|
|
652 },
|
12
|
653 {"completefunc", "cfu", P_STRING|P_ALLOCED|P_VI_DEF|P_SECURE,
|
|
654 #ifdef FEAT_COMPL_FUNC
|
|
655 (char_u *)&p_cfu, PV_CFU,
|
|
656 {(char_u *)"", (char_u *)0L}
|
|
657 #else
|
|
658 (char_u *)NULL, PV_NONE,
|
|
659 {(char_u *)0L, (char_u *)0L}
|
|
660 #endif
|
|
661 },
|
7
|
662 {"confirm", "cf", P_BOOL|P_VI_DEF,
|
|
663 #if defined(FEAT_GUI_DIALOG) || defined(FEAT_CON_DIALOG)
|
|
664 (char_u *)&p_confirm, PV_NONE,
|
|
665 #else
|
|
666 (char_u *)NULL, PV_NONE,
|
|
667 #endif
|
|
668 {(char_u *)FALSE, (char_u *)0L}},
|
|
669 {"conskey", "consk",P_BOOL|P_VI_DEF,
|
|
670 #ifdef MSDOS
|
|
671 (char_u *)&p_consk, PV_NONE,
|
|
672 #else
|
|
673 (char_u *)NULL, PV_NONE,
|
|
674 #endif
|
|
675 {(char_u *)FALSE, (char_u *)0L}},
|
|
676 {"copyindent", "ci", P_BOOL|P_VI_DEF|P_VIM,
|
|
677 (char_u *)&p_ci, PV_CI,
|
|
678 {(char_u *)FALSE, (char_u *)0L}},
|
|
679 {"cpoptions", "cpo", P_STRING|P_VIM|P_RALL|P_FLAGLIST,
|
|
680 (char_u *)&p_cpo, PV_NONE,
|
164
|
681 {(char_u *)CPO_VI, (char_u *)CPO_VIM}},
|
7
|
682 {"cscopepathcomp", "cspc", P_NUM|P_VI_DEF|P_VIM,
|
|
683 #ifdef FEAT_CSCOPE
|
|
684 (char_u *)&p_cspc, PV_NONE,
|
|
685 #else
|
|
686 (char_u *)NULL, PV_NONE,
|
|
687 #endif
|
|
688 {(char_u *)0L, (char_u *)0L}},
|
|
689 {"cscopeprg", "csprg", P_STRING|P_EXPAND|P_VI_DEF|P_SECURE,
|
|
690 #ifdef FEAT_CSCOPE
|
|
691 (char_u *)&p_csprg, PV_NONE,
|
|
692 {(char_u *)"cscope", (char_u *)0L}
|
|
693 #else
|
|
694 (char_u *)NULL, PV_NONE,
|
|
695 {(char_u *)0L, (char_u *)0L}
|
|
696 #endif
|
|
697 },
|
|
698 {"cscopequickfix", "csqf", P_STRING|P_VI_DEF|P_COMMA|P_NODUP,
|
|
699 #if defined(FEAT_CSCOPE) && defined(FEAT_QUICKFIX)
|
|
700 (char_u *)&p_csqf, PV_NONE,
|
|
701 {(char_u *)"", (char_u *)0L}
|
|
702 #else
|
|
703 (char_u *)NULL, PV_NONE,
|
|
704 {(char_u *)0L, (char_u *)0L}
|
|
705 #endif
|
|
706 },
|
|
707 {"cscopetag", "cst", P_BOOL|P_VI_DEF|P_VIM,
|
|
708 #ifdef FEAT_CSCOPE
|
|
709 (char_u *)&p_cst, PV_NONE,
|
|
710 #else
|
|
711 (char_u *)NULL, PV_NONE,
|
|
712 #endif
|
|
713 {(char_u *)0L, (char_u *)0L}},
|
|
714 {"cscopetagorder", "csto", P_NUM|P_VI_DEF|P_VIM,
|
|
715 #ifdef FEAT_CSCOPE
|
|
716 (char_u *)&p_csto, PV_NONE,
|
|
717 #else
|
|
718 (char_u *)NULL, PV_NONE,
|
|
719 #endif
|
|
720 {(char_u *)0L, (char_u *)0L}},
|
|
721 {"cscopeverbose", "csverb", P_BOOL|P_VI_DEF|P_VIM,
|
|
722 #ifdef FEAT_CSCOPE
|
|
723 (char_u *)&p_csverbose, PV_NONE,
|
|
724 #else
|
|
725 (char_u *)NULL, PV_NONE,
|
|
726 #endif
|
|
727 {(char_u *)0L, (char_u *)0L}},
|
|
728 {"debug", NULL, P_STRING|P_VI_DEF,
|
|
729 (char_u *)&p_debug, PV_NONE,
|
|
730 {(char_u *)"", (char_u *)0L}},
|
|
731 {"define", "def", P_STRING|P_ALLOCED|P_VI_DEF,
|
|
732 #ifdef FEAT_FIND_ID
|
|
733 (char_u *)&p_def, OPT_BOTH(PV_DEF),
|
22
|
734 {(char_u *)"^\\s*#\\s*define", (char_u *)0L}
|
7
|
735 #else
|
|
736 (char_u *)NULL, PV_NONE,
|
|
737 {(char_u *)NULL, (char_u *)0L}
|
|
738 #endif
|
|
739 },
|
|
740 {"delcombine", "deco", P_BOOL|P_VI_DEF|P_VIM,
|
|
741 #ifdef FEAT_MBYTE
|
|
742 (char_u *)&p_deco, PV_NONE,
|
|
743 #else
|
|
744 (char_u *)NULL, PV_NONE,
|
|
745 #endif
|
|
746 {(char_u *)FALSE, (char_u *)0L}
|
|
747 },
|
|
748 {"dictionary", "dict", P_STRING|P_EXPAND|P_VI_DEF|P_COMMA|P_NODUP,
|
|
749 #ifdef FEAT_INS_EXPAND
|
|
750 (char_u *)&p_dict, OPT_BOTH(PV_DICT),
|
|
751 #else
|
|
752 (char_u *)NULL, PV_NONE,
|
|
753 #endif
|
|
754 {(char_u *)"", (char_u *)0L}},
|
|
755 {"diff", NULL, P_BOOL|P_VI_DEF|P_RWIN|P_NOGLOB,
|
|
756 #ifdef FEAT_DIFF
|
|
757 (char_u *)VAR_WIN, PV_DIFF,
|
|
758 #else
|
|
759 (char_u *)NULL, PV_NONE,
|
|
760 #endif
|
|
761 {(char_u *)FALSE, (char_u *)0L}},
|
|
762 {"diffexpr", "dex", P_STRING|P_VI_DEF|P_SECURE,
|
|
763 #if defined(FEAT_DIFF) && defined(FEAT_EVAL)
|
|
764 (char_u *)&p_dex, PV_NONE,
|
|
765 {(char_u *)"", (char_u *)0L}
|
|
766 #else
|
|
767 (char_u *)NULL, PV_NONE,
|
|
768 {(char_u *)0L, (char_u *)0L}
|
|
769 #endif
|
|
770 },
|
|
771 {"diffopt", "dip", P_STRING|P_ALLOCED|P_VI_DEF|P_RWIN|P_COMMA|P_NODUP,
|
|
772 #ifdef FEAT_DIFF
|
|
773 (char_u *)&p_dip, PV_NONE,
|
|
774 {(char_u *)"filler", (char_u *)NULL}
|
|
775 #else
|
|
776 (char_u *)NULL, PV_NONE,
|
|
777 {(char_u *)"", (char_u *)NULL}
|
|
778 #endif
|
|
779 },
|
|
780 {"digraph", "dg", P_BOOL|P_VI_DEF|P_VIM,
|
|
781 #ifdef FEAT_DIGRAPHS
|
|
782 (char_u *)&p_dg, PV_NONE,
|
|
783 #else
|
|
784 (char_u *)NULL, PV_NONE,
|
|
785 #endif
|
|
786 {(char_u *)FALSE, (char_u *)0L}},
|
|
787 {"directory", "dir", P_STRING|P_EXPAND|P_VI_DEF|P_COMMA|P_NODUP|P_SECURE,
|
|
788 (char_u *)&p_dir, PV_NONE,
|
|
789 {(char_u *)DFLT_DIR, (char_u *)0L}},
|
|
790 {"display", "dy", P_STRING|P_VI_DEF|P_COMMA|P_RALL|P_NODUP,
|
|
791 (char_u *)&p_dy, PV_NONE,
|
|
792 {(char_u *)"", (char_u *)0L}},
|
|
793 {"eadirection", "ead", P_STRING|P_VI_DEF,
|
|
794 #ifdef FEAT_VERTSPLIT
|
|
795 (char_u *)&p_ead, PV_NONE,
|
|
796 {(char_u *)"both", (char_u *)0L}
|
|
797 #else
|
|
798 (char_u *)NULL, PV_NONE,
|
|
799 {(char_u *)NULL, (char_u *)0L}
|
|
800 #endif
|
|
801 },
|
|
802 {"edcompatible","ed", P_BOOL|P_VI_DEF,
|
|
803 (char_u *)&p_ed, PV_NONE,
|
|
804 {(char_u *)FALSE, (char_u *)0L}},
|
|
805 {"encoding", "enc", P_STRING|P_VI_DEF|P_RCLR,
|
|
806 #ifdef FEAT_MBYTE
|
|
807 (char_u *)&p_enc, PV_NONE,
|
|
808 {(char_u *)ENC_DFLT, (char_u *)0L}
|
|
809 #else
|
|
810 (char_u *)NULL, PV_NONE,
|
|
811 {(char_u *)0L, (char_u *)0L}
|
|
812 #endif
|
|
813 },
|
|
814 {"endofline", "eol", P_BOOL|P_NO_MKRC|P_VI_DEF|P_RSTAT,
|
|
815 (char_u *)&p_eol, PV_EOL,
|
|
816 {(char_u *)TRUE, (char_u *)0L}},
|
|
817 {"equalalways", "ea", P_BOOL|P_VI_DEF|P_RALL,
|
|
818 (char_u *)&p_ea, PV_NONE,
|
|
819 {(char_u *)TRUE, (char_u *)0L}},
|
|
820 {"equalprg", "ep", P_STRING|P_EXPAND|P_VI_DEF|P_SECURE,
|
|
821 (char_u *)&p_ep, OPT_BOTH(PV_EP),
|
|
822 {(char_u *)"", (char_u *)0L}},
|
|
823 {"errorbells", "eb", P_BOOL|P_VI_DEF,
|
|
824 (char_u *)&p_eb, PV_NONE,
|
|
825 {(char_u *)FALSE, (char_u *)0L}},
|
|
826 {"errorfile", "ef", P_STRING|P_EXPAND|P_VI_DEF|P_SECURE,
|
|
827 #ifdef FEAT_QUICKFIX
|
|
828 (char_u *)&p_ef, PV_NONE,
|
|
829 {(char_u *)DFLT_ERRORFILE, (char_u *)0L}
|
|
830 #else
|
|
831 (char_u *)NULL, PV_NONE,
|
|
832 {(char_u *)NULL, (char_u *)0L}
|
|
833 #endif
|
|
834 },
|
|
835 {"errorformat", "efm", P_STRING|P_VI_DEF|P_COMMA|P_NODUP,
|
|
836 #ifdef FEAT_QUICKFIX
|
|
837 (char_u *)&p_efm, OPT_BOTH(PV_EFM),
|
|
838 {(char_u *)DFLT_EFM, (char_u *)0L},
|
|
839 #else
|
|
840 (char_u *)NULL, PV_NONE,
|
|
841 {(char_u *)NULL, (char_u *)0L}
|
|
842 #endif
|
|
843 },
|
|
844 {"esckeys", "ek", P_BOOL|P_VIM,
|
|
845 (char_u *)&p_ek, PV_NONE,
|
|
846 {(char_u *)FALSE, (char_u *)TRUE}},
|
|
847 {"eventignore", "ei", P_STRING|P_VI_DEF|P_COMMA|P_NODUP,
|
|
848 #ifdef FEAT_AUTOCMD
|
|
849 (char_u *)&p_ei, PV_NONE,
|
|
850 #else
|
|
851 (char_u *)NULL, PV_NONE,
|
|
852 #endif
|
|
853 {(char_u *)"", (char_u *)0L}},
|
|
854 {"expandtab", "et", P_BOOL|P_VI_DEF|P_VIM,
|
|
855 (char_u *)&p_et, PV_ET,
|
|
856 {(char_u *)FALSE, (char_u *)0L}},
|
|
857 {"exrc", "ex", P_BOOL|P_VI_DEF|P_SECURE,
|
|
858 (char_u *)&p_exrc, PV_NONE,
|
|
859 {(char_u *)FALSE, (char_u *)0L}},
|
|
860 {"fileencoding","fenc", P_STRING|P_ALLOCED|P_VI_DEF|P_RSTAT|P_RBUF|P_NO_MKRC,
|
|
861 #ifdef FEAT_MBYTE
|
|
862 (char_u *)&p_fenc, PV_FENC,
|
|
863 {(char_u *)"", (char_u *)0L}
|
|
864 #else
|
|
865 (char_u *)NULL, PV_NONE,
|
|
866 {(char_u *)0L, (char_u *)0L}
|
|
867 #endif
|
|
868 },
|
|
869 {"fileencodings","fencs", P_STRING|P_VI_DEF|P_COMMA,
|
|
870 #ifdef FEAT_MBYTE
|
|
871 (char_u *)&p_fencs, PV_NONE,
|
|
872 {(char_u *)"ucs-bom", (char_u *)0L}
|
|
873 #else
|
|
874 (char_u *)NULL, PV_NONE,
|
|
875 {(char_u *)0L, (char_u *)0L}
|
|
876 #endif
|
|
877 },
|
|
878 {"fileformat", "ff", P_STRING|P_ALLOCED|P_VI_DEF|P_RSTAT|P_NO_MKRC,
|
|
879 (char_u *)&p_ff, PV_FF,
|
|
880 {(char_u *)DFLT_FF, (char_u *)0L}},
|
|
881 {"fileformats", "ffs", P_STRING|P_VIM|P_COMMA|P_NODUP,
|
|
882 (char_u *)&p_ffs, PV_NONE,
|
|
883 {(char_u *)DFLT_FFS_VI, (char_u *)DFLT_FFS_VIM}},
|
36
|
884 {"filetype", "ft", P_STRING|P_ALLOCED|P_VI_DEF|P_NOGLOB|P_NFNAME,
|
7
|
885 #ifdef FEAT_AUTOCMD
|
|
886 (char_u *)&p_ft, PV_FT,
|
|
887 {(char_u *)"", (char_u *)0L}
|
|
888 #else
|
|
889 (char_u *)NULL, PV_NONE,
|
|
890 {(char_u *)0L, (char_u *)0L}
|
|
891 #endif
|
|
892 },
|
|
893 {"fillchars", "fcs", P_STRING|P_VI_DEF|P_RALL|P_COMMA|P_NODUP,
|
|
894 #if defined(FEAT_WINDOWS) || defined(FEAT_FOLDING)
|
|
895 (char_u *)&p_fcs, PV_NONE,
|
|
896 {(char_u *)"vert:|,fold:-", (char_u *)0L}
|
|
897 #else
|
|
898 (char_u *)NULL, PV_NONE,
|
|
899 {(char_u *)"", (char_u *)0L}
|
|
900 #endif
|
|
901 },
|
|
902 {"fkmap", "fk", P_BOOL|P_VI_DEF,
|
|
903 #ifdef FEAT_FKMAP
|
|
904 (char_u *)&p_fkmap, PV_NONE,
|
|
905 #else
|
|
906 (char_u *)NULL, PV_NONE,
|
|
907 #endif
|
|
908 {(char_u *)FALSE, (char_u *)0L}},
|
|
909 {"flash", "fl", P_BOOL|P_VI_DEF,
|
|
910 (char_u *)NULL, PV_NONE,
|
|
911 {(char_u *)FALSE, (char_u *)0L}},
|
|
912 #ifdef FEAT_FOLDING
|
|
913 {"foldclose", "fcl", P_STRING|P_VI_DEF|P_COMMA|P_NODUP|P_RWIN,
|
|
914 (char_u *)&p_fcl, PV_NONE,
|
|
915 {(char_u *)"", (char_u *)0L}},
|
|
916 {"foldcolumn", "fdc", P_NUM|P_VI_DEF|P_RWIN,
|
|
917 (char_u *)VAR_WIN, PV_FDC,
|
|
918 {(char_u *)FALSE, (char_u *)0L}},
|
|
919 {"foldenable", "fen", P_BOOL|P_VI_DEF|P_RWIN,
|
|
920 (char_u *)VAR_WIN, PV_FEN,
|
|
921 {(char_u *)TRUE, (char_u *)0L}},
|
|
922 {"foldexpr", "fde", P_STRING|P_ALLOCED|P_VIM|P_VI_DEF|P_RWIN,
|
|
923 # ifdef FEAT_EVAL
|
|
924 (char_u *)VAR_WIN, PV_FDE,
|
|
925 {(char_u *)"0", (char_u *)NULL}
|
|
926 # else
|
|
927 (char_u *)NULL, PV_NONE,
|
|
928 {(char_u *)NULL, (char_u *)0L}
|
|
929 # endif
|
|
930 },
|
|
931 {"foldignore", "fdi", P_STRING|P_ALLOCED|P_VIM|P_VI_DEF|P_RWIN,
|
|
932 (char_u *)VAR_WIN, PV_FDI,
|
|
933 {(char_u *)"#", (char_u *)NULL}},
|
|
934 {"foldlevel", "fdl", P_NUM|P_VI_DEF|P_RWIN,
|
|
935 (char_u *)VAR_WIN, PV_FDL,
|
|
936 {(char_u *)0L, (char_u *)0L}},
|
|
937 {"foldlevelstart","fdls", P_NUM|P_VI_DEF,
|
|
938 (char_u *)&p_fdls, PV_NONE,
|
|
939 {(char_u *)-1L, (char_u *)0L}},
|
|
940 {"foldmarker", "fmr", P_STRING|P_ALLOCED|P_VIM|P_VI_DEF|
|
|
941 P_RWIN|P_COMMA|P_NODUP,
|
|
942 (char_u *)VAR_WIN, PV_FMR,
|
|
943 {(char_u *)"{{{,}}}", (char_u *)NULL}},
|
|
944 {"foldmethod", "fdm", P_STRING|P_ALLOCED|P_VIM|P_VI_DEF|P_RWIN,
|
|
945 (char_u *)VAR_WIN, PV_FDM,
|
|
946 {(char_u *)"manual", (char_u *)NULL}},
|
|
947 {"foldminlines","fml", P_NUM|P_VI_DEF|P_RWIN,
|
|
948 (char_u *)VAR_WIN, PV_FML,
|
|
949 {(char_u *)1L, (char_u *)0L}},
|
|
950 {"foldnestmax", "fdn", P_NUM|P_VI_DEF|P_RWIN,
|
|
951 (char_u *)VAR_WIN, PV_FDN,
|
|
952 {(char_u *)20L, (char_u *)0L}},
|
|
953 {"foldopen", "fdo", P_STRING|P_VI_DEF|P_COMMA|P_NODUP,
|
|
954 (char_u *)&p_fdo, PV_NONE,
|
|
955 {(char_u *)"block,hor,mark,percent,quickfix,search,tag,undo",
|
|
956 (char_u *)0L}},
|
|
957 {"foldtext", "fdt", P_STRING|P_ALLOCED|P_VIM|P_VI_DEF|P_RWIN,
|
|
958 # ifdef FEAT_EVAL
|
|
959 (char_u *)VAR_WIN, PV_FDT,
|
|
960 {(char_u *)"foldtext()", (char_u *)NULL}
|
29
|
961 # else
|
7
|
962 (char_u *)NULL, PV_NONE,
|
|
963 {(char_u *)NULL, (char_u *)0L}
|
29
|
964 # endif
|
7
|
965 },
|
|
966 #endif
|
|
967 {"formatoptions","fo", P_STRING|P_ALLOCED|P_VIM|P_FLAGLIST,
|
|
968 (char_u *)&p_fo, PV_FO,
|
|
969 {(char_u *)DFLT_FO_VI, (char_u *)DFLT_FO_VIM}},
|
41
|
970 {"formatlistpat","flp", P_STRING|P_ALLOCED|P_VI_DEF,
|
|
971 (char_u *)&p_flp, PV_FLP,
|
|
972 {(char_u *)"^\\s*\\d\\+[\\]:.)}\\t ]\\s*", (char_u *)0L}},
|
7
|
973 {"formatprg", "fp", P_STRING|P_EXPAND|P_VI_DEF|P_SECURE,
|
|
974 (char_u *)&p_fp, PV_NONE,
|
|
975 {(char_u *)"", (char_u *)0L}},
|
36
|
976 {"fsync", "fs", P_BOOL|P_SECURE|P_VI_DEF,
|
|
977 #ifdef HAVE_FSYNC
|
|
978 (char_u *)&p_fs, PV_NONE,
|
|
979 {(char_u *)TRUE, (char_u *)0L}
|
|
980 #else
|
|
981 (char_u *)NULL, PV_NONE,
|
|
982 {(char_u *)FALSE, (char_u *)0L}
|
|
983 #endif
|
|
984 },
|
7
|
985 {"gdefault", "gd", P_BOOL|P_VI_DEF|P_VIM,
|
|
986 (char_u *)&p_gd, PV_NONE,
|
|
987 {(char_u *)FALSE, (char_u *)0L}},
|
|
988 {"graphic", "gr", P_BOOL|P_VI_DEF,
|
|
989 (char_u *)NULL, PV_NONE,
|
|
990 {(char_u *)FALSE, (char_u *)0L}},
|
|
991 {"grepformat", "gfm", P_STRING|P_VI_DEF|P_COMMA|P_NODUP,
|
|
992 #ifdef FEAT_QUICKFIX
|
|
993 (char_u *)&p_gefm, PV_NONE,
|
|
994 {(char_u *)DFLT_GREPFORMAT, (char_u *)0L},
|
|
995 #else
|
|
996 (char_u *)NULL, PV_NONE,
|
|
997 {(char_u *)NULL, (char_u *)0L}
|
|
998 #endif
|
|
999 },
|
|
1000 {"grepprg", "gp", P_STRING|P_EXPAND|P_VI_DEF|P_SECURE,
|
|
1001 #ifdef FEAT_QUICKFIX
|
|
1002 (char_u *)&p_gp, OPT_BOTH(PV_GP),
|
|
1003 {
|
|
1004 # ifdef WIN3264
|
|
1005 /* may be changed to "grep -n" in os_win32.c */
|
|
1006 (char_u *)"findstr /n",
|
|
1007 # else
|
|
1008 # ifdef UNIX
|
|
1009 /* Add an extra file name so that grep will always
|
|
1010 * insert a file name in the match line. */
|
|
1011 (char_u *)"grep -n $* /dev/null",
|
|
1012 # else
|
|
1013 # ifdef VMS
|
|
1014 (char_u *)"SEARCH/NUMBERS ",
|
|
1015 # else
|
|
1016 (char_u *)"grep -n ",
|
|
1017 #endif
|
|
1018 #endif
|
|
1019 # endif
|
|
1020 (char_u *)0L},
|
|
1021 #else
|
|
1022 (char_u *)NULL, PV_NONE,
|
|
1023 {(char_u *)NULL, (char_u *)0L}
|
|
1024 #endif
|
|
1025 },
|
|
1026 {"guicursor", "gcr", P_STRING|P_VI_DEF|P_COMMA|P_NODUP,
|
|
1027 #ifdef CURSOR_SHAPE
|
|
1028 (char_u *)&p_guicursor, PV_NONE,
|
|
1029 {
|
|
1030 # ifdef FEAT_GUI
|
|
1031 (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",
|
|
1032 # else /* MSDOS or Win32 console */
|
|
1033 (char_u *)"n-v-c:block,o:hor50,i-ci:hor15,r-cr:hor30,sm:block",
|
|
1034 # endif
|
|
1035 (char_u *)0L}
|
|
1036 #else
|
|
1037 (char_u *)NULL, PV_NONE,
|
|
1038 {(char_u *)NULL, (char_u *)0L}
|
|
1039 #endif
|
|
1040 },
|
|
1041 {"guifont", "gfn", P_STRING|P_VI_DEF|P_RCLR|P_COMMA|P_NODUP,
|
|
1042 #ifdef FEAT_GUI
|
|
1043 (char_u *)&p_guifont, PV_NONE,
|
|
1044 {(char_u *)"", (char_u *)0L}
|
|
1045 #else
|
|
1046 (char_u *)NULL, PV_NONE,
|
|
1047 {(char_u *)NULL, (char_u *)0L}
|
|
1048 #endif
|
|
1049 },
|
|
1050 {"guifontset", "gfs", P_STRING|P_VI_DEF|P_RCLR|P_COMMA,
|
|
1051 #if defined(FEAT_GUI) && defined(FEAT_XFONTSET)
|
|
1052 (char_u *)&p_guifontset, PV_NONE,
|
|
1053 {(char_u *)"", (char_u *)0L}
|
|
1054 #else
|
|
1055 (char_u *)NULL, PV_NONE,
|
|
1056 {(char_u *)NULL, (char_u *)0L}
|
|
1057 #endif
|
|
1058 },
|
|
1059 {"guifontwide", "gfw", P_STRING|P_VI_DEF|P_RCLR|P_COMMA|P_NODUP,
|
|
1060 #if defined(FEAT_GUI) && defined(FEAT_MBYTE)
|
|
1061 (char_u *)&p_guifontwide, PV_NONE,
|
|
1062 {(char_u *)"", (char_u *)0L}
|
|
1063 #else
|
|
1064 (char_u *)NULL, PV_NONE,
|
|
1065 {(char_u *)NULL, (char_u *)0L}
|
|
1066 #endif
|
|
1067 },
|
|
1068 {"guiheadroom", "ghr", P_NUM|P_VI_DEF,
|
11
|
1069 #if defined(FEAT_GUI_GTK) || defined(FEAT_GUI_X11) || defined(FEAT_GUI_KDE)
|
7
|
1070 (char_u *)&p_ghr, PV_NONE,
|
|
1071 #else
|
|
1072 (char_u *)NULL, PV_NONE,
|
|
1073 #endif
|
|
1074 {(char_u *)50L, (char_u *)0L}},
|
|
1075 {"guioptions", "go", P_STRING|P_VI_DEF|P_RALL|P_FLAGLIST,
|
11
|
1076 #if defined(FEAT_GUI) || defined(FEAT_GUI_KDE)
|
7
|
1077 (char_u *)&p_go, PV_NONE,
|
|
1078 # if defined(UNIX) && !defined(MACOS)
|
|
1079 {(char_u *)"agimrLtT", (char_u *)0L}
|
|
1080 # else
|
|
1081 {(char_u *)"gmrLtT", (char_u *)0L}
|
|
1082 # endif
|
|
1083 #else
|
|
1084 (char_u *)NULL, PV_NONE,
|
|
1085 {(char_u *)NULL, (char_u *)0L}
|
|
1086 #endif
|
|
1087 },
|
|
1088 {"guipty", NULL, P_BOOL|P_VI_DEF,
|
|
1089 #if defined(FEAT_GUI)
|
|
1090 (char_u *)&p_guipty, PV_NONE,
|
|
1091 #else
|
|
1092 (char_u *)NULL, PV_NONE,
|
|
1093 #endif
|
|
1094 {(char_u *)TRUE, (char_u *)0L}},
|
|
1095 {"hardtabs", "ht", P_NUM|P_VI_DEF,
|
|
1096 (char_u *)NULL, PV_NONE,
|
|
1097 {(char_u *)0L, (char_u *)0L}},
|
|
1098 {"helpfile", "hf", P_STRING|P_EXPAND|P_VI_DEF|P_SECURE,
|
|
1099 (char_u *)&p_hf, PV_NONE,
|
|
1100 {(char_u *)DFLT_HELPFILE, (char_u *)0L}},
|
|
1101 {"helpheight", "hh", P_NUM|P_VI_DEF,
|
|
1102 #ifdef FEAT_WINDOWS
|
|
1103 (char_u *)&p_hh, PV_NONE,
|
|
1104 #else
|
|
1105 (char_u *)NULL, PV_NONE,
|
|
1106 #endif
|
|
1107 {(char_u *)20L, (char_u *)0L}},
|
|
1108 {"helplang", "hlg", P_STRING|P_VI_DEF|P_COMMA,
|
|
1109 #ifdef FEAT_MULTI_LANG
|
|
1110 (char_u *)&p_hlg, PV_NONE,
|
|
1111 {(char_u *)"", (char_u *)0L}
|
|
1112 #else
|
|
1113 (char_u *)NULL, PV_NONE,
|
|
1114 {(char_u *)0L, (char_u *)0L}
|
|
1115 #endif
|
|
1116 },
|
|
1117 {"hidden", "hid", P_BOOL|P_VI_DEF,
|
|
1118 (char_u *)&p_hid, PV_NONE,
|
|
1119 {(char_u *)FALSE, (char_u *)0L}},
|
|
1120 {"highlight", "hl", P_STRING|P_VI_DEF|P_RCLR|P_COMMA|P_NODUP,
|
|
1121 (char_u *)&p_hl, PV_NONE,
|
386
|
1122 {(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",
|
7
|
1123 (char_u *)0L}},
|
|
1124 {"history", "hi", P_NUM|P_VIM,
|
|
1125 (char_u *)&p_hi, PV_NONE,
|
|
1126 {(char_u *)0L, (char_u *)20L}},
|
|
1127 {"hkmap", "hk", P_BOOL|P_VI_DEF|P_VIM,
|
|
1128 #ifdef FEAT_RIGHTLEFT
|
|
1129 (char_u *)&p_hkmap, PV_NONE,
|
|
1130 #else
|
|
1131 (char_u *)NULL, PV_NONE,
|
|
1132 #endif
|
|
1133 {(char_u *)FALSE, (char_u *)0L}},
|
|
1134 {"hkmapp", "hkp", P_BOOL|P_VI_DEF|P_VIM,
|
|
1135 #ifdef FEAT_RIGHTLEFT
|
|
1136 (char_u *)&p_hkmapp, PV_NONE,
|
|
1137 #else
|
|
1138 (char_u *)NULL, PV_NONE,
|
|
1139 #endif
|
|
1140 {(char_u *)FALSE, (char_u *)0L}},
|
|
1141 {"hlsearch", "hls", P_BOOL|P_VI_DEF|P_VIM|P_RALL,
|
|
1142 (char_u *)&p_hls, PV_NONE,
|
|
1143 {(char_u *)FALSE, (char_u *)0L}},
|
|
1144 {"icon", NULL, P_BOOL|P_VI_DEF,
|
|
1145 #ifdef FEAT_TITLE
|
|
1146 (char_u *)&p_icon, PV_NONE,
|
|
1147 #else
|
|
1148 (char_u *)NULL, PV_NONE,
|
|
1149 #endif
|
|
1150 {(char_u *)FALSE, (char_u *)0L}},
|
|
1151 {"iconstring", NULL, P_STRING|P_VI_DEF,
|
|
1152 #ifdef FEAT_TITLE
|
|
1153 (char_u *)&p_iconstring, PV_NONE,
|
|
1154 #else
|
|
1155 (char_u *)NULL, PV_NONE,
|
|
1156 #endif
|
|
1157 {(char_u *)"", (char_u *)0L}},
|
|
1158 {"ignorecase", "ic", P_BOOL|P_VI_DEF,
|
|
1159 (char_u *)&p_ic, PV_NONE,
|
|
1160 {(char_u *)FALSE, (char_u *)0L}},
|
|
1161 {"imactivatekey","imak",P_STRING|P_VI_DEF,
|
11
|
1162 #if defined(FEAT_XIM) && (defined(FEAT_GUI_GTK) || defined(FEAT_GUI_KDE))
|
7
|
1163 (char_u *)&p_imak, PV_NONE,
|
|
1164 #else
|
|
1165 (char_u *)NULL, PV_NONE,
|
|
1166 #endif
|
|
1167 {(char_u *)"", (char_u *)0L}},
|
|
1168 {"imcmdline", "imc", P_BOOL|P_VI_DEF,
|
|
1169 #ifdef USE_IM_CONTROL
|
|
1170 (char_u *)&p_imcmdline, PV_NONE,
|
|
1171 #else
|
|
1172 (char_u *)NULL, PV_NONE,
|
|
1173 #endif
|
|
1174 {(char_u *)FALSE, (char_u *)0L}},
|
|
1175 {"imdisable", "imd", P_BOOL|P_VI_DEF,
|
|
1176 #ifdef USE_IM_CONTROL
|
|
1177 (char_u *)&p_imdisable, PV_NONE,
|
|
1178 #else
|
|
1179 (char_u *)NULL, PV_NONE,
|
|
1180 #endif
|
|
1181 #ifdef __sgi
|
|
1182 {(char_u *)TRUE, (char_u *)0L}
|
|
1183 #else
|
|
1184 {(char_u *)FALSE, (char_u *)0L}
|
|
1185 #endif
|
|
1186 },
|
|
1187 {"iminsert", "imi", P_NUM|P_VI_DEF,
|
|
1188 (char_u *)&p_iminsert, PV_IMI,
|
|
1189 #ifdef B_IMODE_IM
|
|
1190 {(char_u *)B_IMODE_IM, (char_u *)0L}
|
|
1191 #else
|
|
1192 {(char_u *)B_IMODE_NONE, (char_u *)0L}
|
|
1193 #endif
|
|
1194 },
|
|
1195 {"imsearch", "ims", P_NUM|P_VI_DEF,
|
|
1196 (char_u *)&p_imsearch, PV_IMS,
|
|
1197 #ifdef B_IMODE_IM
|
|
1198 {(char_u *)B_IMODE_IM, (char_u *)0L}
|
|
1199 #else
|
|
1200 {(char_u *)B_IMODE_NONE, (char_u *)0L}
|
|
1201 #endif
|
|
1202 },
|
|
1203 {"include", "inc", P_STRING|P_ALLOCED|P_VI_DEF,
|
|
1204 #ifdef FEAT_FIND_ID
|
|
1205 (char_u *)&p_inc, OPT_BOTH(PV_INC),
|
|
1206 {(char_u *)"^\\s*#\\s*include", (char_u *)0L}
|
|
1207 #else
|
|
1208 (char_u *)NULL, PV_NONE,
|
|
1209 {(char_u *)0L, (char_u *)0L}
|
|
1210 #endif
|
|
1211 },
|
|
1212 {"includeexpr", "inex", P_STRING|P_ALLOCED|P_VI_DEF,
|
|
1213 #if defined(FEAT_FIND_ID) && defined(FEAT_EVAL)
|
|
1214 (char_u *)&p_inex, PV_INEX,
|
|
1215 {(char_u *)"", (char_u *)0L}
|
|
1216 #else
|
|
1217 (char_u *)NULL, PV_NONE,
|
|
1218 {(char_u *)0L, (char_u *)0L}
|
|
1219 #endif
|
|
1220 },
|
|
1221 {"incsearch", "is", P_BOOL|P_VI_DEF|P_VIM,
|
|
1222 (char_u *)&p_is, PV_NONE,
|
|
1223 {(char_u *)FALSE, (char_u *)0L}},
|
|
1224 {"indentexpr", "inde", P_STRING|P_ALLOCED|P_VI_DEF|P_VIM,
|
|
1225 #if defined(FEAT_CINDENT) && defined(FEAT_EVAL)
|
|
1226 (char_u *)&p_inde, PV_INDE,
|
|
1227 {(char_u *)"", (char_u *)0L}
|
|
1228 #else
|
|
1229 (char_u *)NULL, PV_NONE,
|
|
1230 {(char_u *)0L, (char_u *)0L}
|
|
1231 #endif
|
|
1232 },
|
|
1233 {"indentkeys", "indk", P_STRING|P_ALLOCED|P_VI_DEF|P_COMMA|P_NODUP,
|
|
1234 #if defined(FEAT_CINDENT) && defined(FEAT_EVAL)
|
|
1235 (char_u *)&p_indk, PV_INDK,
|
|
1236 {(char_u *)"0{,0},:,0#,!^F,o,O,e", (char_u *)0L}
|
|
1237 #else
|
|
1238 (char_u *)NULL, PV_NONE,
|
|
1239 {(char_u *)0L, (char_u *)0L}
|
|
1240 #endif
|
|
1241 },
|
|
1242 {"infercase", "inf", P_BOOL|P_VI_DEF,
|
|
1243 (char_u *)&p_inf, PV_INF,
|
|
1244 {(char_u *)FALSE, (char_u *)0L}},
|
|
1245 {"insertmode", "im", P_BOOL|P_VI_DEF|P_VIM,
|
|
1246 (char_u *)&p_im, PV_NONE,
|
|
1247 {(char_u *)FALSE, (char_u *)0L}},
|
|
1248 {"isfname", "isf", P_STRING|P_VI_DEF|P_COMMA|P_NODUP,
|
|
1249 (char_u *)&p_isf, PV_NONE,
|
|
1250 {
|
|
1251 #ifdef BACKSLASH_IN_FILENAME
|
|
1252 /* Excluded are: & and ^ are special in cmd.exe
|
|
1253 * ( and ) are used in text separating fnames */
|
|
1254 (char_u *)"@,48-57,/,\\,.,-,_,+,,,#,$,%,{,},[,],:,@-@,!,~,=",
|
|
1255 #else
|
|
1256 # ifdef AMIGA
|
|
1257 (char_u *)"@,48-57,/,.,-,_,+,,,$,:",
|
|
1258 # else
|
|
1259 # ifdef VMS
|
|
1260 (char_u *)"@,48-57,/,.,-,_,+,,,#,$,%,<,>,[,],:,;,~",
|
|
1261 # else /* UNIX et al. */
|
|
1262 # ifdef EBCDIC
|
|
1263 (char_u *)"@,240-249,/,.,-,_,+,,,#,$,%,~,=",
|
|
1264 # else
|
|
1265 (char_u *)"@,48-57,/,.,-,_,+,,,#,$,%,~,=",
|
|
1266 # endif
|
|
1267 # endif
|
|
1268 # endif
|
|
1269 #endif
|
|
1270 (char_u *)0L}},
|
|
1271 {"isident", "isi", P_STRING|P_VI_DEF|P_COMMA|P_NODUP,
|
|
1272 (char_u *)&p_isi, PV_NONE,
|
|
1273 {
|
|
1274 #if defined(MSDOS) || defined(MSWIN) || defined(OS2)
|
|
1275 (char_u *)"@,48-57,_,128-167,224-235",
|
|
1276 #else
|
|
1277 # ifdef EBCDIC
|
|
1278 /* TODO: EBCDIC Check this! @ == isalpha()*/
|
|
1279 (char_u *)"@,240-249,_,66-73,81-89,98-105,"
|
|
1280 "112-120,128,140-142,156,158,172,"
|
|
1281 "174,186,191,203-207,219-225,235-239,"
|
|
1282 "251-254",
|
|
1283 # else
|
|
1284 (char_u *)"@,48-57,_,192-255",
|
|
1285 # endif
|
|
1286 #endif
|
|
1287 (char_u *)0L}},
|
|
1288 {"iskeyword", "isk", P_STRING|P_ALLOCED|P_VIM|P_COMMA|P_NODUP,
|
|
1289 (char_u *)&p_isk, PV_ISK,
|
|
1290 {
|
|
1291 #ifdef EBCDIC
|
|
1292 (char_u *)"@,240-249,_",
|
|
1293 /* TODO: EBCDIC Check this! @ == isalpha()*/
|
|
1294 (char_u *)"@,240-249,_,66-73,81-89,98-105,"
|
|
1295 "112-120,128,140-142,156,158,172,"
|
|
1296 "174,186,191,203-207,219-225,235-239,"
|
|
1297 "251-254",
|
|
1298 #else
|
|
1299 (char_u *)"@,48-57,_",
|
|
1300 # if defined(MSDOS) || defined(MSWIN) || defined(OS2)
|
|
1301 (char_u *)"@,48-57,_,128-167,224-235"
|
|
1302 # else
|
|
1303 (char_u *)"@,48-57,_,192-255"
|
|
1304 # endif
|
|
1305 #endif
|
|
1306 }},
|
|
1307 {"isprint", "isp", P_STRING|P_VI_DEF|P_RALL|P_COMMA|P_NODUP,
|
|
1308 (char_u *)&p_isp, PV_NONE,
|
|
1309 {
|
36
|
1310 #if defined(MSDOS) || defined(MSWIN) || defined(OS2) \
|
|
1311 || (defined(MACOS) && !defined(MACOS_X)) \
|
7
|
1312 || defined(VMS)
|
|
1313 (char_u *)"@,~-255",
|
|
1314 #else
|
|
1315 # ifdef EBCDIC
|
|
1316 /* all chars above 63 are printable */
|
|
1317 (char_u *)"63-255",
|
|
1318 # else
|
|
1319 (char_u *)"@,161-255",
|
|
1320 # endif
|
|
1321 #endif
|
|
1322 (char_u *)0L}},
|
|
1323 {"joinspaces", "js", P_BOOL|P_VI_DEF|P_VIM,
|
|
1324 (char_u *)&p_js, PV_NONE,
|
|
1325 {(char_u *)TRUE, (char_u *)0L}},
|
|
1326 {"key", NULL, P_STRING|P_ALLOCED|P_VI_DEF|P_NO_MKRC,
|
|
1327 #ifdef FEAT_CRYPT
|
|
1328 (char_u *)&p_key, PV_KEY,
|
|
1329 {(char_u *)"", (char_u *)0L}
|
|
1330 #else
|
|
1331 (char_u *)NULL, PV_NONE,
|
|
1332 {(char_u *)0L, (char_u *)0L}
|
|
1333 #endif
|
|
1334 },
|
36
|
1335 {"keymap", "kmp", P_STRING|P_ALLOCED|P_VI_DEF|P_RBUF|P_RSTAT|P_NFNAME,
|
7
|
1336 #ifdef FEAT_KEYMAP
|
|
1337 (char_u *)&p_keymap, PV_KMAP,
|
|
1338 {(char_u *)"", (char_u *)0L}
|
|
1339 #else
|
|
1340 (char_u *)NULL, PV_NONE,
|
|
1341 {(char_u *)"", (char_u *)0L}
|
|
1342 #endif
|
|
1343 },
|
|
1344 {"keymodel", "km", P_STRING|P_VI_DEF|P_COMMA|P_NODUP,
|
|
1345 #ifdef FEAT_VISUAL
|
|
1346 (char_u *)&p_km, PV_NONE,
|
|
1347 #else
|
|
1348 (char_u *)NULL, PV_NONE,
|
|
1349 #endif
|
|
1350 {(char_u *)"", (char_u *)0L}},
|
|
1351 {"keywordprg", "kp", P_STRING|P_EXPAND|P_VI_DEF|P_SECURE,
|
|
1352 (char_u *)&p_kp, OPT_BOTH(PV_KP),
|
|
1353 {
|
|
1354 #if defined(MSDOS) || defined(MSWIN)
|
|
1355 (char_u *)":help",
|
|
1356 #else
|
|
1357 #ifdef VMS
|
|
1358 (char_u *)"help",
|
|
1359 #else
|
|
1360 # if defined(OS2)
|
|
1361 (char_u *)"view /",
|
|
1362 # else
|
|
1363 # ifdef USEMAN_S
|
|
1364 (char_u *)"man -s",
|
|
1365 # else
|
|
1366 (char_u *)"man",
|
|
1367 # endif
|
|
1368 # endif
|
|
1369 #endif
|
|
1370 #endif
|
|
1371 (char_u *)0L}},
|
|
1372 {"langmap", "lmap", P_STRING|P_VI_DEF|P_COMMA|P_NODUP,
|
|
1373 #ifdef FEAT_LANGMAP
|
|
1374 (char_u *)&p_langmap, PV_NONE,
|
|
1375 {(char_u *)"", /* unmatched } */
|
|
1376 #else
|
|
1377 (char_u *)NULL, PV_NONE,
|
|
1378 {(char_u *)NULL,
|
|
1379 #endif
|
|
1380 (char_u *)0L}},
|
36
|
1381 {"langmenu", "lm", P_STRING|P_VI_DEF|P_NFNAME,
|
7
|
1382 #if defined(FEAT_MENU) && defined(FEAT_MULTI_LANG)
|
|
1383 (char_u *)&p_lm, PV_NONE,
|
|
1384 #else
|
|
1385 (char_u *)NULL, PV_NONE,
|
|
1386 #endif
|
|
1387 {(char_u *)"", (char_u *)0L}},
|
|
1388 {"laststatus", "ls", P_NUM|P_VI_DEF|P_RALL,
|
|
1389 #ifdef FEAT_WINDOWS
|
|
1390 (char_u *)&p_ls, PV_NONE,
|
|
1391 #else
|
|
1392 (char_u *)NULL, PV_NONE,
|
|
1393 #endif
|
|
1394 {(char_u *)1L, (char_u *)0L}},
|
|
1395 {"lazyredraw", "lz", P_BOOL|P_VI_DEF,
|
|
1396 (char_u *)&p_lz, PV_NONE,
|
|
1397 {(char_u *)FALSE, (char_u *)0L}},
|
|
1398 {"linebreak", "lbr", P_BOOL|P_VI_DEF|P_RWIN,
|
|
1399 #ifdef FEAT_LINEBREAK
|
|
1400 (char_u *)VAR_WIN, PV_LBR,
|
|
1401 #else
|
|
1402 (char_u *)NULL, PV_NONE,
|
|
1403 #endif
|
|
1404 {(char_u *)FALSE, (char_u *)0L}},
|
|
1405 {"lines", NULL, P_NUM|P_NODEFAULT|P_NO_MKRC|P_VI_DEF|P_RCLR,
|
|
1406 (char_u *)&Rows, PV_NONE,
|
|
1407 {
|
|
1408 #if defined(MSDOS) || defined(WIN3264) || defined(OS2)
|
|
1409 (char_u *)25L,
|
|
1410 #else
|
|
1411 (char_u *)24L,
|
|
1412 #endif
|
|
1413 (char_u *)0L}},
|
|
1414 {"linespace", "lsp", P_NUM|P_VI_DEF|P_RCLR,
|
|
1415 #ifdef FEAT_GUI
|
|
1416 (char_u *)&p_linespace, PV_NONE,
|
|
1417 #else
|
|
1418 (char_u *)NULL, PV_NONE,
|
|
1419 #endif
|
|
1420 #ifdef FEAT_GUI_W32
|
|
1421 {(char_u *)1L, (char_u *)0L}
|
|
1422 #else
|
|
1423 {(char_u *)0L, (char_u *)0L}
|
|
1424 #endif
|
|
1425 },
|
|
1426 {"lisp", NULL, P_BOOL|P_VI_DEF,
|
|
1427 #ifdef FEAT_LISP
|
|
1428 (char_u *)&p_lisp, PV_LISP,
|
|
1429 #else
|
|
1430 (char_u *)NULL, PV_NONE,
|
|
1431 #endif
|
|
1432 {(char_u *)FALSE, (char_u *)0L}},
|
|
1433 {"lispwords", "lw", P_STRING|P_VI_DEF|P_COMMA|P_NODUP,
|
|
1434 #ifdef FEAT_LISP
|
|
1435 (char_u *)&p_lispwords, PV_NONE,
|
|
1436 {(char_u *)LISPWORD_VALUE, (char_u *)0L}
|
|
1437 #else
|
|
1438 (char_u *)NULL, PV_NONE,
|
|
1439 {(char_u *)"", (char_u *)0L}
|
|
1440 #endif
|
|
1441 },
|
|
1442 {"list", NULL, P_BOOL|P_VI_DEF|P_RWIN,
|
|
1443 (char_u *)VAR_WIN, PV_LIST,
|
|
1444 {(char_u *)FALSE, (char_u *)0L}},
|
|
1445 {"listchars", "lcs", P_STRING|P_VI_DEF|P_RALL|P_COMMA|P_NODUP,
|
|
1446 (char_u *)&p_lcs, PV_NONE,
|
|
1447 {(char_u *)"eol:$", (char_u *)0L}},
|
|
1448 {"loadplugins", "lpl", P_BOOL|P_VI_DEF,
|
|
1449 (char_u *)&p_lpl, PV_NONE,
|
|
1450 {(char_u *)TRUE, (char_u *)0L}},
|
|
1451 {"magic", NULL, P_BOOL|P_VI_DEF,
|
|
1452 (char_u *)&p_magic, PV_NONE,
|
|
1453 {(char_u *)TRUE, (char_u *)0L}},
|
|
1454 {"makeef", "mef", P_STRING|P_EXPAND|P_VI_DEF|P_SECURE,
|
|
1455 #ifdef FEAT_QUICKFIX
|
|
1456 (char_u *)&p_mef, PV_NONE,
|
|
1457 {(char_u *)"", (char_u *)0L}
|
|
1458 #else
|
|
1459 (char_u *)NULL, PV_NONE,
|
|
1460 {(char_u *)NULL, (char_u *)0L}
|
|
1461 #endif
|
|
1462 },
|
|
1463 {"makeprg", "mp", P_STRING|P_EXPAND|P_VI_DEF|P_SECURE,
|
|
1464 #ifdef FEAT_QUICKFIX
|
|
1465 (char_u *)&p_mp, OPT_BOTH(PV_MP),
|
|
1466 # ifdef VMS
|
|
1467 {(char_u *)"MMS", (char_u *)0L}
|
|
1468 # else
|
|
1469 {(char_u *)"make", (char_u *)0L}
|
|
1470 # endif
|
|
1471 #else
|
|
1472 (char_u *)NULL, PV_NONE,
|
|
1473 {(char_u *)NULL, (char_u *)0L}
|
|
1474 #endif
|
|
1475 },
|
|
1476 {"matchpairs", "mps", P_STRING|P_ALLOCED|P_VI_DEF|P_COMMA|P_NODUP,
|
|
1477 (char_u *)&p_mps, PV_MPS,
|
|
1478 {(char_u *)"(:),{:},[:]", (char_u *)0L}},
|
|
1479 {"matchtime", "mat", P_NUM|P_VI_DEF,
|
|
1480 (char_u *)&p_mat, PV_NONE,
|
|
1481 {(char_u *)5L, (char_u *)0L}},
|
|
1482 {"maxfuncdepth", "mfd", P_NUM|P_VI_DEF,
|
|
1483 #ifdef FEAT_EVAL
|
|
1484 (char_u *)&p_mfd, PV_NONE,
|
|
1485 #else
|
|
1486 (char_u *)NULL, PV_NONE,
|
|
1487 #endif
|
|
1488 {(char_u *)100L, (char_u *)0L}},
|
|
1489 {"maxmapdepth", "mmd", P_NUM|P_VI_DEF,
|
|
1490 (char_u *)&p_mmd, PV_NONE,
|
|
1491 {(char_u *)1000L, (char_u *)0L}},
|
|
1492 {"maxmem", "mm", P_NUM|P_VI_DEF,
|
|
1493 (char_u *)&p_mm, PV_NONE,
|
|
1494 {(char_u *)DFLT_MAXMEM, (char_u *)0L}},
|
190
|
1495 {"maxmempattern","mmp", P_NUM|P_VI_DEF,
|
|
1496 (char_u *)&p_mmp, PV_NONE,
|
|
1497 {(char_u *)1000L, (char_u *)0L}},
|
7
|
1498 {"maxmemtot", "mmt", P_NUM|P_VI_DEF,
|
|
1499 (char_u *)&p_mmt, PV_NONE,
|
|
1500 {(char_u *)DFLT_MAXMEMTOT, (char_u *)0L}},
|
|
1501 {"menuitems", "mis", P_NUM|P_VI_DEF,
|
|
1502 #ifdef FEAT_MENU
|
|
1503 (char_u *)&p_mis, PV_NONE,
|
|
1504 #else
|
|
1505 (char_u *)NULL, PV_NONE,
|
|
1506 #endif
|
|
1507 {(char_u *)25L, (char_u *)0L}},
|
|
1508 {"mesg", NULL, P_BOOL|P_VI_DEF,
|
|
1509 (char_u *)NULL, PV_NONE,
|
|
1510 {(char_u *)FALSE, (char_u *)0L}},
|
484
|
1511 {"mkspellmem", "msm", P_STRING|P_VI_DEF|P_EXPAND|P_SECURE,
|
|
1512 #ifdef FEAT_SYN_HL
|
|
1513 (char_u *)&p_msm, PV_NONE,
|
|
1514 {(char_u *)"460000,2000,500", (char_u *)0L}
|
|
1515 #else
|
|
1516 (char_u *)NULL, PV_NONE,
|
|
1517 {(char_u *)0L, (char_u *)0L}
|
|
1518 #endif
|
|
1519 },
|
7
|
1520 {"modeline", "ml", P_BOOL|P_VIM,
|
|
1521 (char_u *)&p_ml, PV_ML,
|
|
1522 {(char_u *)FALSE, (char_u *)TRUE}},
|
|
1523 {"modelines", "mls", P_NUM|P_VI_DEF,
|
|
1524 (char_u *)&p_mls, PV_NONE,
|
|
1525 {(char_u *)5L, (char_u *)0L}},
|
|
1526 {"modifiable", "ma", P_BOOL|P_VI_DEF|P_NOGLOB,
|
|
1527 (char_u *)&p_ma, PV_MA,
|
|
1528 {(char_u *)TRUE, (char_u *)0L}},
|
|
1529 {"modified", "mod", P_BOOL|P_NO_MKRC|P_VI_DEF|P_RSTAT,
|
|
1530 (char_u *)&p_mod, PV_MOD,
|
|
1531 {(char_u *)FALSE, (char_u *)0L}},
|
|
1532 {"more", NULL, P_BOOL|P_VIM,
|
|
1533 (char_u *)&p_more, PV_NONE,
|
|
1534 {(char_u *)FALSE, (char_u *)TRUE}},
|
|
1535 {"mouse", NULL, P_STRING|P_VI_DEF|P_FLAGLIST,
|
|
1536 (char_u *)&p_mouse, PV_NONE,
|
|
1537 {
|
|
1538 #if defined(MSDOS) || defined(WIN3264)
|
|
1539 (char_u *)"a",
|
|
1540 #else
|
|
1541 (char_u *)"",
|
|
1542 #endif
|
|
1543 (char_u *)0L}},
|
|
1544 {"mousefocus", "mousef", P_BOOL|P_VI_DEF,
|
|
1545 #ifdef FEAT_GUI
|
|
1546 (char_u *)&p_mousef, PV_NONE,
|
|
1547 #else
|
|
1548 (char_u *)NULL, PV_NONE,
|
|
1549 #endif
|
|
1550 {(char_u *)FALSE, (char_u *)0L}},
|
|
1551 {"mousehide", "mh", P_BOOL|P_VI_DEF,
|
|
1552 #ifdef FEAT_GUI
|
|
1553 (char_u *)&p_mh, PV_NONE,
|
|
1554 #else
|
|
1555 (char_u *)NULL, PV_NONE,
|
|
1556 #endif
|
|
1557 {(char_u *)TRUE, (char_u *)0L}},
|
|
1558 {"mousemodel", "mousem", P_STRING|P_VI_DEF,
|
|
1559 (char_u *)&p_mousem, PV_NONE,
|
|
1560 {
|
|
1561 #if defined(MSDOS) || defined(MSWIN)
|
|
1562 (char_u *)"popup",
|
|
1563 #else
|
|
1564 # if defined(MACOS)
|
|
1565 (char_u *)"popup_setpos",
|
|
1566 # else
|
|
1567 (char_u *)"extend",
|
|
1568 # endif
|
|
1569 #endif
|
|
1570 (char_u *)0L}},
|
|
1571 {"mouseshape", "mouses", P_STRING|P_VI_DEF|P_COMMA|P_NODUP,
|
|
1572 #ifdef FEAT_MOUSESHAPE
|
|
1573 (char_u *)&p_mouseshape, PV_NONE,
|
|
1574 {(char_u *)"i-r:beam,s:updown,sd:udsizing,vs:leftright,vd:lrsizing,m:no,ml:up-arrow,v:rightup-arrow", (char_u *)0L}
|
|
1575 #else
|
|
1576 (char_u *)NULL, PV_NONE,
|
|
1577 {(char_u *)NULL, (char_u *)0L}
|
|
1578 #endif
|
|
1579 },
|
|
1580 {"mousetime", "mouset", P_NUM|P_VI_DEF,
|
|
1581 (char_u *)&p_mouset, PV_NONE,
|
|
1582 {(char_u *)500L, (char_u *)0L}},
|
14
|
1583 {"mzquantum", "mzq", P_NUM,
|
|
1584 #ifdef FEAT_MZSCHEME
|
|
1585 (char_u *)&p_mzq, PV_NONE,
|
|
1586 #else
|
|
1587 (char_u *)NULL, PV_NONE,
|
|
1588 #endif
|
|
1589 {(char_u *)100L, (char_u *)100L}},
|
7
|
1590 {"novice", NULL, P_BOOL|P_VI_DEF,
|
|
1591 (char_u *)NULL, PV_NONE,
|
|
1592 {(char_u *)FALSE, (char_u *)0L}},
|
|
1593 {"nrformats", "nf", P_STRING|P_ALLOCED|P_VI_DEF|P_COMMA|P_NODUP,
|
|
1594 (char_u *)&p_nf, PV_NF,
|
|
1595 {(char_u *)"octal,hex", (char_u *)0L}},
|
|
1596 {"number", "nu", P_BOOL|P_VI_DEF|P_RWIN,
|
|
1597 (char_u *)VAR_WIN, PV_NU,
|
|
1598 {(char_u *)FALSE, (char_u *)0L}},
|
13
|
1599 {"numberwidth", "nuw", P_NUM|P_RWIN|P_VIM,
|
|
1600 #ifdef FEAT_LINEBREAK
|
|
1601 (char_u *)VAR_WIN, PV_NUW,
|
|
1602 #else
|
|
1603 (char_u *)NULL, PV_NONE,
|
|
1604 #endif
|
|
1605 {(char_u *)8L, (char_u *)4L}},
|
523
|
1606 {"omnifunc", "ofu", P_STRING|P_ALLOCED|P_VI_DEF|P_SECURE,
|
502
|
1607 #ifdef FEAT_COMPL_FUNC
|
|
1608 (char_u *)&p_ofu, PV_OFU,
|
|
1609 {(char_u *)"", (char_u *)0L}
|
|
1610 #else
|
|
1611 (char_u *)NULL, PV_NONE,
|
|
1612 {(char_u *)0L, (char_u *)0L}
|
|
1613 #endif
|
|
1614 },
|
7
|
1615 {"open", NULL, P_BOOL|P_VI_DEF,
|
|
1616 (char_u *)NULL, PV_NONE,
|
|
1617 {(char_u *)FALSE, (char_u *)0L}},
|
|
1618 {"optimize", "opt", P_BOOL|P_VI_DEF,
|
|
1619 (char_u *)NULL, PV_NONE,
|
|
1620 {(char_u *)FALSE, (char_u *)0L}},
|
|
1621 {"osfiletype", "oft", P_STRING|P_ALLOCED|P_VI_DEF,
|
|
1622 #ifdef FEAT_OSFILETYPE
|
|
1623 (char_u *)&p_oft, PV_OFT,
|
|
1624 {(char_u *)DFLT_OFT, (char_u *)0L}
|
|
1625 #else
|
|
1626 (char_u *)NULL, PV_NONE,
|
|
1627 {(char_u *)0L, (char_u *)0L}
|
|
1628 #endif
|
|
1629 },
|
|
1630 {"paragraphs", "para", P_STRING|P_VI_DEF,
|
|
1631 (char_u *)&p_para, PV_NONE,
|
|
1632 {(char_u *)"IPLPPPQPP LIpplpipbp", (char_u *)0L}},
|
|
1633 {"paste", NULL, P_BOOL|P_VI_DEF,
|
|
1634 (char_u *)&p_paste, PV_NONE,
|
|
1635 {(char_u *)FALSE, (char_u *)0L}},
|
|
1636 {"pastetoggle", "pt", P_STRING|P_VI_DEF,
|
|
1637 (char_u *)&p_pt, PV_NONE,
|
|
1638 {(char_u *)"", (char_u *)0L}},
|
|
1639 {"patchexpr", "pex", P_STRING|P_VI_DEF|P_SECURE,
|
|
1640 #if defined(FEAT_DIFF) && defined(FEAT_EVAL)
|
|
1641 (char_u *)&p_pex, PV_NONE,
|
|
1642 {(char_u *)"", (char_u *)0L}
|
|
1643 #else
|
|
1644 (char_u *)NULL, PV_NONE,
|
|
1645 {(char_u *)0L, (char_u *)0L}
|
|
1646 #endif
|
|
1647 },
|
36
|
1648 {"patchmode", "pm", P_STRING|P_VI_DEF|P_NFNAME,
|
7
|
1649 (char_u *)&p_pm, PV_NONE,
|
|
1650 {(char_u *)"", (char_u *)0L}},
|
|
1651 {"path", "pa", P_STRING|P_EXPAND|P_VI_DEF|P_COMMA|P_NODUP,
|
|
1652 (char_u *)&p_path, OPT_BOTH(PV_PATH),
|
|
1653 {
|
|
1654 #if defined AMIGA || defined MSDOS || defined MSWIN
|
|
1655 (char_u *)".,,",
|
|
1656 #else
|
|
1657 # if defined(__EMX__)
|
|
1658 (char_u *)".,/emx/include,,",
|
|
1659 # else /* Unix, probably */
|
|
1660 (char_u *)".,/usr/include,,",
|
|
1661 # endif
|
|
1662 #endif
|
|
1663 (char_u *)0L}},
|
|
1664 {"preserveindent", "pi", P_BOOL|P_VI_DEF|P_VIM,
|
|
1665 (char_u *)&p_pi, PV_PI,
|
|
1666 {(char_u *)FALSE, (char_u *)0L}},
|
13
|
1667 {"previewheight", "pvh", P_NUM|P_VI_DEF,
|
7
|
1668 #if defined(FEAT_WINDOWS) && defined(FEAT_QUICKFIX)
|
|
1669 (char_u *)&p_pvh, PV_NONE,
|
|
1670 #else
|
|
1671 (char_u *)NULL, PV_NONE,
|
|
1672 #endif
|
|
1673 {(char_u *)12L, (char_u *)0L}},
|
|
1674 {"previewwindow", "pvw", P_BOOL|P_VI_DEF|P_RSTAT|P_NOGLOB,
|
|
1675 #if defined(FEAT_WINDOWS) && defined(FEAT_QUICKFIX)
|
|
1676 (char_u *)VAR_WIN, PV_PVW,
|
|
1677 #else
|
|
1678 (char_u *)NULL, PV_NONE,
|
|
1679 #endif
|
|
1680 {(char_u *)FALSE, (char_u *)0L}},
|
36
|
1681 {"printdevice", "pdev", P_STRING|P_VI_DEF|P_SECURE,
|
7
|
1682 #ifdef FEAT_PRINTER
|
|
1683 (char_u *)&p_pdev, PV_NONE,
|
|
1684 {(char_u *)"", (char_u *)0L}
|
|
1685 #else
|
|
1686 (char_u *)NULL, PV_NONE,
|
|
1687 {(char_u *)NULL, (char_u *)0L}
|
|
1688 #endif
|
|
1689 },
|
|
1690 {"printencoding", "penc", P_STRING|P_VI_DEF,
|
|
1691 #ifdef FEAT_POSTSCRIPT
|
|
1692 (char_u *)&p_penc, PV_NONE,
|
|
1693 {(char_u *)"", (char_u *)0L}
|
|
1694 #else
|
|
1695 (char_u *)NULL, PV_NONE,
|
|
1696 {(char_u *)NULL, (char_u *)0L}
|
|
1697 #endif
|
|
1698 },
|
|
1699 {"printexpr", "pexpr", P_STRING|P_VI_DEF,
|
|
1700 #ifdef FEAT_POSTSCRIPT
|
|
1701 (char_u *)&p_pexpr, PV_NONE,
|
|
1702 {(char_u *)"", (char_u *)0L}
|
|
1703 #else
|
|
1704 (char_u *)NULL, PV_NONE,
|
|
1705 {(char_u *)NULL, (char_u *)0L}
|
|
1706 #endif
|
|
1707 },
|
|
1708 {"printfont", "pfn", P_STRING|P_VI_DEF,
|
|
1709 #ifdef FEAT_PRINTER
|
|
1710 (char_u *)&p_pfn, PV_NONE,
|
|
1711 {
|
|
1712 # ifdef MSWIN
|
|
1713 (char_u *)"Courier_New:h10",
|
|
1714 # else
|
|
1715 (char_u *)"courier",
|
|
1716 # endif
|
|
1717 (char_u *)0L}
|
|
1718 #else
|
|
1719 (char_u *)NULL, PV_NONE,
|
|
1720 {(char_u *)NULL, (char_u *)0L}
|
|
1721 #endif
|
|
1722 },
|
|
1723 {"printheader", "pheader", P_STRING|P_VI_DEF|P_GETTEXT,
|
|
1724 #ifdef FEAT_PRINTER
|
|
1725 (char_u *)&p_header, PV_NONE,
|
|
1726 {(char_u *)N_("%<%f%h%m%=Page %N"), (char_u *)0L}
|
|
1727 #else
|
|
1728 (char_u *)NULL, PV_NONE,
|
|
1729 {(char_u *)NULL, (char_u *)0L}
|
|
1730 #endif
|
|
1731 },
|
15
|
1732 {"printmbcharset", "pmbcs", P_STRING|P_VI_DEF,
|
|
1733 #if defined(FEAT_POSTSCRIPT) && defined(FEAT_MBYTE)
|
|
1734 (char_u *)&p_pmcs, PV_NONE,
|
|
1735 {(char_u *)"", (char_u *)0L}
|
|
1736 #else
|
|
1737 (char_u *)NULL, PV_NONE,
|
|
1738 {(char_u *)NULL, (char_u *)0L}
|
|
1739 #endif
|
|
1740 },
|
|
1741 {"printmbfont", "pmbfn", P_STRING|P_VI_DEF,
|
|
1742 #if defined(FEAT_POSTSCRIPT) && defined(FEAT_MBYTE)
|
|
1743 (char_u *)&p_pmfn, PV_NONE,
|
|
1744 {(char_u *)"", (char_u *)0L}
|
|
1745 #else
|
|
1746 (char_u *)NULL, PV_NONE,
|
|
1747 {(char_u *)NULL, (char_u *)0L}
|
|
1748 #endif
|
|
1749 },
|
7
|
1750 {"printoptions", "popt", P_STRING|P_VI_DEF|P_COMMA|P_NODUP,
|
|
1751 #ifdef FEAT_PRINTER
|
|
1752 (char_u *)&p_popt, PV_NONE,
|
|
1753 {(char_u *)"", (char_u *)0L}
|
|
1754 #else
|
|
1755 (char_u *)NULL, PV_NONE,
|
|
1756 {(char_u *)NULL, (char_u *)0L}
|
|
1757 #endif
|
|
1758 },
|
|
1759 {"prompt", NULL, P_BOOL|P_VI_DEF,
|
168
|
1760 (char_u *)&p_prompt, PV_NONE,
|
|
1761 {(char_u *)TRUE, (char_u *)0L}},
|
12
|
1762 {"quoteescape", "qe", P_STRING|P_ALLOCED|P_VI_DEF,
|
|
1763 #ifdef FEAT_TEXTOBJ
|
|
1764 (char_u *)&p_qe, PV_QE,
|
|
1765 {(char_u *)"\\", (char_u *)0L}
|
|
1766 #else
|
|
1767 (char_u *)NULL, PV_NONE,
|
|
1768 {(char_u *)NULL, (char_u *)0L}
|
|
1769 #endif
|
|
1770 },
|
7
|
1771 {"readonly", "ro", P_BOOL|P_VI_DEF|P_RSTAT|P_NOGLOB,
|
|
1772 (char_u *)&p_ro, PV_RO,
|
|
1773 {(char_u *)FALSE, (char_u *)0L}},
|
|
1774 {"redraw", NULL, P_BOOL|P_VI_DEF,
|
|
1775 (char_u *)NULL, PV_NONE,
|
|
1776 {(char_u *)FALSE, (char_u *)0L}},
|
|
1777 {"remap", NULL, P_BOOL|P_VI_DEF,
|
|
1778 (char_u *)&p_remap, PV_NONE,
|
|
1779 {(char_u *)TRUE, (char_u *)0L}},
|
|
1780 {"report", NULL, P_NUM|P_VI_DEF,
|
|
1781 (char_u *)&p_report, PV_NONE,
|
|
1782 {(char_u *)2L, (char_u *)0L}},
|
|
1783 {"restorescreen", "rs", P_BOOL|P_VI_DEF,
|
|
1784 #ifdef WIN3264
|
|
1785 (char_u *)&p_rs, PV_NONE,
|
|
1786 #else
|
|
1787 (char_u *)NULL, PV_NONE,
|
|
1788 #endif
|
|
1789 {(char_u *)TRUE, (char_u *)0L}},
|
|
1790 {"revins", "ri", P_BOOL|P_VI_DEF|P_VIM,
|
|
1791 #ifdef FEAT_RIGHTLEFT
|
|
1792 (char_u *)&p_ri, PV_NONE,
|
|
1793 #else
|
|
1794 (char_u *)NULL, PV_NONE,
|
|
1795 #endif
|
|
1796 {(char_u *)FALSE, (char_u *)0L}},
|
|
1797 {"rightleft", "rl", P_BOOL|P_VI_DEF|P_RWIN,
|
|
1798 #ifdef FEAT_RIGHTLEFT
|
|
1799 (char_u *)VAR_WIN, PV_RL,
|
|
1800 #else
|
|
1801 (char_u *)NULL, PV_NONE,
|
|
1802 #endif
|
|
1803 {(char_u *)FALSE, (char_u *)0L}},
|
|
1804 {"rightleftcmd", "rlc", P_STRING|P_ALLOCED|P_VI_DEF|P_RWIN,
|
|
1805 #ifdef FEAT_RIGHTLEFT
|
|
1806 (char_u *)VAR_WIN, PV_RLC,
|
|
1807 {(char_u *)"search", (char_u *)NULL}
|
|
1808 #else
|
|
1809 (char_u *)NULL, PV_NONE,
|
|
1810 {(char_u *)NULL, (char_u *)0L}
|
|
1811 #endif
|
|
1812 },
|
|
1813 {"ruler", "ru", P_BOOL|P_VI_DEF|P_VIM|P_RSTAT,
|
|
1814 #ifdef FEAT_CMDL_INFO
|
|
1815 (char_u *)&p_ru, PV_NONE,
|
|
1816 #else
|
|
1817 (char_u *)NULL, PV_NONE,
|
|
1818 #endif
|
|
1819 {(char_u *)FALSE, (char_u *)0L}},
|
|
1820 {"rulerformat", "ruf", P_STRING|P_VI_DEF|P_ALLOCED|P_RSTAT,
|
|
1821 #ifdef FEAT_STL_OPT
|
|
1822 (char_u *)&p_ruf, PV_NONE,
|
|
1823 #else
|
|
1824 (char_u *)NULL, PV_NONE,
|
|
1825 #endif
|
|
1826 {(char_u *)"", (char_u *)0L}},
|
|
1827 {"runtimepath", "rtp", P_STRING|P_VI_DEF|P_EXPAND|P_COMMA|P_NODUP|P_SECURE,
|
|
1828 (char_u *)&p_rtp, PV_NONE,
|
|
1829 {(char_u *)DFLT_RUNTIMEPATH, (char_u *)0L}},
|
|
1830 {"scroll", "scr", P_NUM|P_NO_MKRC|P_VI_DEF,
|
|
1831 (char_u *)VAR_WIN, PV_SCROLL,
|
|
1832 {(char_u *)12L, (char_u *)0L}},
|
|
1833 {"scrollbind", "scb", P_BOOL|P_VI_DEF,
|
|
1834 #ifdef FEAT_SCROLLBIND
|
|
1835 (char_u *)VAR_WIN, PV_SCBIND,
|
|
1836 #else
|
|
1837 (char_u *)NULL, PV_NONE,
|
|
1838 #endif
|
|
1839 {(char_u *)FALSE, (char_u *)0L}},
|
|
1840 {"scrolljump", "sj", P_NUM|P_VI_DEF|P_VIM,
|
|
1841 (char_u *)&p_sj, PV_NONE,
|
|
1842 {(char_u *)1L, (char_u *)0L}},
|
|
1843 {"scrolloff", "so", P_NUM|P_VI_DEF|P_VIM|P_RALL,
|
|
1844 (char_u *)&p_so, PV_NONE,
|
|
1845 {(char_u *)0L, (char_u *)0L}},
|
|
1846 {"scrollopt", "sbo", P_STRING|P_VI_DEF|P_COMMA|P_NODUP,
|
|
1847 #ifdef FEAT_SCROLLBIND
|
|
1848 (char_u *)&p_sbo, PV_NONE,
|
|
1849 {(char_u *)"ver,jump", (char_u *)0L}
|
|
1850 #else
|
|
1851 (char_u *)NULL, PV_NONE,
|
|
1852 {(char_u *)0L, (char_u *)0L}
|
|
1853 #endif
|
|
1854 },
|
|
1855 {"sections", "sect", P_STRING|P_VI_DEF,
|
|
1856 (char_u *)&p_sections, PV_NONE,
|
|
1857 {(char_u *)"SHNHH HUnhsh", (char_u *)0L}},
|
|
1858 {"secure", NULL, P_BOOL|P_VI_DEF|P_SECURE,
|
|
1859 (char_u *)&p_secure, PV_NONE,
|
|
1860 {(char_u *)FALSE, (char_u *)0L}},
|
|
1861 {"selection", "sel", P_STRING|P_VI_DEF,
|
|
1862 #ifdef FEAT_VISUAL
|
|
1863 (char_u *)&p_sel, PV_NONE,
|
|
1864 #else
|
|
1865 (char_u *)NULL, PV_NONE,
|
|
1866 #endif
|
|
1867 {(char_u *)"inclusive", (char_u *)0L}},
|
|
1868 {"selectmode", "slm", P_STRING|P_VI_DEF|P_COMMA|P_NODUP,
|
|
1869 #ifdef FEAT_VISUAL
|
|
1870 (char_u *)&p_slm, PV_NONE,
|
|
1871 #else
|
|
1872 (char_u *)NULL, PV_NONE,
|
|
1873 #endif
|
|
1874 {(char_u *)"", (char_u *)0L}},
|
|
1875 {"sessionoptions", "ssop", P_STRING|P_VI_DEF|P_COMMA|P_NODUP,
|
|
1876 #ifdef FEAT_SESSION
|
|
1877 (char_u *)&p_ssop, PV_NONE,
|
|
1878 {(char_u *)"blank,buffers,curdir,folds,help,options,winsize",
|
|
1879 (char_u *)0L}
|
|
1880 #else
|
|
1881 (char_u *)NULL, PV_NONE,
|
|
1882 {(char_u *)0L, (char_u *)0L}
|
|
1883 #endif
|
|
1884 },
|
|
1885 {"shell", "sh", P_STRING|P_EXPAND|P_VI_DEF|P_SECURE,
|
|
1886 (char_u *)&p_sh, PV_NONE,
|
|
1887 {
|
|
1888 #ifdef VMS
|
|
1889 (char_u *)"-",
|
|
1890 #else
|
|
1891 # if defined(MSDOS)
|
|
1892 (char_u *)"command",
|
|
1893 # else
|
|
1894 # if defined(WIN16)
|
|
1895 (char_u *)"command.com",
|
|
1896 # else
|
|
1897 # if defined(WIN3264)
|
|
1898 (char_u *)"", /* set in set_init_1() */
|
|
1899 # else
|
|
1900 # if defined(OS2)
|
|
1901 (char_u *)"cmd.exe",
|
|
1902 # else
|
|
1903 # if defined(ARCHIE)
|
|
1904 (char_u *)"gos",
|
|
1905 # else
|
|
1906 (char_u *)"sh",
|
|
1907 # endif
|
|
1908 # endif
|
|
1909 # endif
|
|
1910 # endif
|
|
1911 # endif
|
|
1912 #endif /* VMS */
|
|
1913 (char_u *)0L}},
|
|
1914 {"shellcmdflag","shcf", P_STRING|P_VI_DEF|P_SECURE,
|
|
1915 (char_u *)&p_shcf, PV_NONE,
|
|
1916 {
|
|
1917 #if defined(MSDOS) || defined(MSWIN)
|
|
1918 (char_u *)"/c",
|
|
1919 #else
|
|
1920 # if defined(OS2)
|
|
1921 (char_u *)"/c",
|
|
1922 # else
|
|
1923 (char_u *)"-c",
|
|
1924 # endif
|
|
1925 #endif
|
|
1926 (char_u *)0L}},
|
|
1927 {"shellpipe", "sp", P_STRING|P_VI_DEF|P_SECURE,
|
|
1928 #ifdef FEAT_QUICKFIX
|
|
1929 (char_u *)&p_sp, PV_NONE,
|
|
1930 {
|
|
1931 #if defined(UNIX) || defined(OS2)
|
|
1932 # ifdef ARCHIE
|
|
1933 (char_u *)"2>",
|
|
1934 # else
|
|
1935 (char_u *)"| tee",
|
|
1936 # endif
|
|
1937 #else
|
|
1938 (char_u *)">",
|
|
1939 #endif
|
|
1940 (char_u *)0L}
|
|
1941 #else
|
|
1942 (char_u *)NULL, PV_NONE,
|
|
1943 {(char_u *)0L, (char_u *)0L}
|
|
1944 #endif
|
|
1945 },
|
|
1946 {"shellquote", "shq", P_STRING|P_VI_DEF|P_SECURE,
|
|
1947 (char_u *)&p_shq, PV_NONE,
|
|
1948 {(char_u *)"", (char_u *)0L}},
|
|
1949 {"shellredir", "srr", P_STRING|P_VI_DEF|P_SECURE,
|
|
1950 (char_u *)&p_srr, PV_NONE,
|
|
1951 {(char_u *)">", (char_u *)0L}},
|
|
1952 {"shellslash", "ssl", P_BOOL|P_VI_DEF,
|
|
1953 #ifdef BACKSLASH_IN_FILENAME
|
|
1954 (char_u *)&p_ssl, PV_NONE,
|
|
1955 #else
|
|
1956 (char_u *)NULL, PV_NONE,
|
|
1957 #endif
|
|
1958 {(char_u *)FALSE, (char_u *)0L}},
|
168
|
1959 {"shelltemp", "stmp", P_BOOL,
|
|
1960 (char_u *)&p_stmp, PV_NONE,
|
|
1961 {(char_u *)FALSE, (char_u *)TRUE}},
|
7
|
1962 {"shelltype", "st", P_NUM|P_VI_DEF,
|
|
1963 #ifdef AMIGA
|
|
1964 (char_u *)&p_st, PV_NONE,
|
|
1965 #else
|
|
1966 (char_u *)NULL, PV_NONE,
|
|
1967 #endif
|
|
1968 {(char_u *)0L, (char_u *)0L}},
|
|
1969 {"shellxquote", "sxq", P_STRING|P_VI_DEF|P_SECURE,
|
|
1970 (char_u *)&p_sxq, PV_NONE,
|
|
1971 {
|
|
1972 #if defined(UNIX) && defined(USE_SYSTEM) && !defined(__EMX__)
|
|
1973 (char_u *)"\"",
|
|
1974 #else
|
|
1975 (char_u *)"",
|
|
1976 #endif
|
|
1977 (char_u *)0L}},
|
|
1978 {"shiftround", "sr", P_BOOL|P_VI_DEF|P_VIM,
|
|
1979 (char_u *)&p_sr, PV_NONE,
|
|
1980 {(char_u *)FALSE, (char_u *)0L}},
|
|
1981 {"shiftwidth", "sw", P_NUM|P_VI_DEF,
|
|
1982 (char_u *)&p_sw, PV_SW,
|
|
1983 {(char_u *)8L, (char_u *)0L}},
|
|
1984 {"shortmess", "shm", P_STRING|P_VIM|P_FLAGLIST,
|
|
1985 (char_u *)&p_shm, PV_NONE,
|
|
1986 {(char_u *)"", (char_u *)"filnxtToO"}},
|
|
1987 {"shortname", "sn", P_BOOL|P_VI_DEF,
|
|
1988 #ifdef SHORT_FNAME
|
|
1989 (char_u *)NULL, PV_NONE,
|
|
1990 #else
|
|
1991 (char_u *)&p_sn, PV_SN,
|
|
1992 #endif
|
|
1993 {(char_u *)FALSE, (char_u *)0L}},
|
|
1994 {"showbreak", "sbr", P_STRING|P_VI_DEF|P_RALL,
|
|
1995 #ifdef FEAT_LINEBREAK
|
|
1996 (char_u *)&p_sbr, PV_NONE,
|
|
1997 #else
|
|
1998 (char_u *)NULL, PV_NONE,
|
|
1999 #endif
|
|
2000 {(char_u *)"", (char_u *)0L}},
|
|
2001 {"showcmd", "sc", P_BOOL|P_VIM,
|
|
2002 #ifdef FEAT_CMDL_INFO
|
|
2003 (char_u *)&p_sc, PV_NONE,
|
|
2004 #else
|
|
2005 (char_u *)NULL, PV_NONE,
|
|
2006 #endif
|
|
2007 {(char_u *)FALSE,
|
|
2008 #ifdef UNIX
|
|
2009 (char_u *)FALSE
|
|
2010 #else
|
|
2011 (char_u *)TRUE
|
|
2012 #endif
|
|
2013 }},
|
|
2014 {"showfulltag", "sft", P_BOOL|P_VI_DEF,
|
|
2015 (char_u *)&p_sft, PV_NONE,
|
|
2016 {(char_u *)FALSE, (char_u *)0L}},
|
|
2017 {"showmatch", "sm", P_BOOL|P_VI_DEF,
|
|
2018 (char_u *)&p_sm, PV_NONE,
|
|
2019 {(char_u *)FALSE, (char_u *)0L}},
|
|
2020 {"showmode", "smd", P_BOOL|P_VIM,
|
|
2021 (char_u *)&p_smd, PV_NONE,
|
|
2022 {(char_u *)FALSE, (char_u *)TRUE}},
|
|
2023 {"sidescroll", "ss", P_NUM|P_VI_DEF,
|
|
2024 (char_u *)&p_ss, PV_NONE,
|
|
2025 {(char_u *)0L, (char_u *)0L}},
|
|
2026 {"sidescrolloff", "siso", P_NUM|P_VI_DEF|P_VIM|P_RBUF,
|
|
2027 (char_u *)&p_siso, PV_NONE,
|
|
2028 {(char_u *)0L, (char_u *)0L}},
|
|
2029 {"slowopen", "slow", P_BOOL|P_VI_DEF,
|
|
2030 (char_u *)NULL, PV_NONE,
|
|
2031 {(char_u *)FALSE, (char_u *)0L}},
|
|
2032 {"smartcase", "scs", P_BOOL|P_VI_DEF|P_VIM,
|
|
2033 (char_u *)&p_scs, PV_NONE,
|
|
2034 {(char_u *)FALSE, (char_u *)0L}},
|
|
2035 {"smartindent", "si", P_BOOL|P_VI_DEF|P_VIM,
|
|
2036 #ifdef FEAT_SMARTINDENT
|
|
2037 (char_u *)&p_si, PV_SI,
|
|
2038 #else
|
|
2039 (char_u *)NULL, PV_NONE,
|
|
2040 #endif
|
|
2041 {(char_u *)FALSE, (char_u *)0L}},
|
|
2042 {"smarttab", "sta", P_BOOL|P_VI_DEF|P_VIM,
|
|
2043 (char_u *)&p_sta, PV_NONE,
|
|
2044 {(char_u *)FALSE, (char_u *)0L}},
|
|
2045 {"softtabstop", "sts", P_NUM|P_VI_DEF|P_VIM,
|
|
2046 (char_u *)&p_sts, PV_STS,
|
|
2047 {(char_u *)0L, (char_u *)0L}},
|
|
2048 {"sourceany", NULL, P_BOOL|P_VI_DEF,
|
|
2049 (char_u *)NULL, PV_NONE,
|
|
2050 {(char_u *)FALSE, (char_u *)0L}},
|
221
|
2051 {"spell", NULL, P_BOOL|P_VI_DEF|P_RWIN,
|
|
2052 #ifdef FEAT_SYN_HL
|
|
2053 (char_u *)VAR_WIN, PV_SPELL,
|
|
2054 #else
|
|
2055 (char_u *)NULL, PV_NONE,
|
|
2056 #endif
|
|
2057 {(char_u *)FALSE, (char_u *)0L}},
|
477
|
2058 {"spellcapcheck", "spc", P_STRING|P_ALLOCED|P_VI_DEF|P_RBUF,
|
386
|
2059 #ifdef FEAT_SYN_HL
|
|
2060 (char_u *)&p_spc, PV_SPC,
|
389
|
2061 {(char_u *)"[.?!]\\_[\\])'\" ]\\+", (char_u *)0L}
|
386
|
2062 #else
|
|
2063 (char_u *)NULL, PV_NONE,
|
|
2064 {(char_u *)0L, (char_u *)0L}
|
|
2065 #endif
|
|
2066 },
|
|
2067 {"spellfile", "spf", P_STRING|P_EXPAND|P_ALLOCED|P_VI_DEF|P_SECURE|P_COMMA,
|
314
|
2068 #ifdef FEAT_SYN_HL
|
|
2069 (char_u *)&p_spf, PV_SPF,
|
|
2070 {(char_u *)"", (char_u *)0L}
|
|
2071 #else
|
|
2072 (char_u *)NULL, PV_NONE,
|
|
2073 {(char_u *)0L, (char_u *)0L}
|
|
2074 #endif
|
|
2075 },
|
374
|
2076 {"spelllang", "spl", P_STRING|P_ALLOCED|P_VI_DEF|P_COMMA|P_RBUF|P_EXPAND,
|
221
|
2077 #ifdef FEAT_SYN_HL
|
|
2078 (char_u *)&p_spl, PV_SPL,
|
314
|
2079 {(char_u *)"en", (char_u *)0L}
|
221
|
2080 #else
|
|
2081 (char_u *)NULL, PV_NONE,
|
|
2082 {(char_u *)0L, (char_u *)0L}
|
|
2083 #endif
|
|
2084 },
|
374
|
2085 {"spellsuggest", "sps", P_STRING|P_VI_DEF|P_EXPAND|P_SECURE,
|
344
|
2086 #ifdef FEAT_SYN_HL
|
|
2087 (char_u *)&p_sps, PV_NONE,
|
|
2088 {(char_u *)"best", (char_u *)0L}
|
|
2089 #else
|
|
2090 (char_u *)NULL, PV_NONE,
|
|
2091 {(char_u *)0L, (char_u *)0L}
|
|
2092 #endif
|
|
2093 },
|
7
|
2094 {"splitbelow", "sb", P_BOOL|P_VI_DEF,
|
|
2095 #ifdef FEAT_WINDOWS
|
|
2096 (char_u *)&p_sb, PV_NONE,
|
|
2097 #else
|
|
2098 (char_u *)NULL, PV_NONE,
|
|
2099 #endif
|
|
2100 {(char_u *)FALSE, (char_u *)0L}},
|
|
2101 {"splitright", "spr", P_BOOL|P_VI_DEF,
|
|
2102 #ifdef FEAT_VERTSPLIT
|
|
2103 (char_u *)&p_spr, PV_NONE,
|
|
2104 #else
|
|
2105 (char_u *)NULL, PV_NONE,
|
|
2106 #endif
|
|
2107 {(char_u *)FALSE, (char_u *)0L}},
|
|
2108 {"startofline", "sol", P_BOOL|P_VI_DEF|P_VIM,
|
|
2109 (char_u *)&p_sol, PV_NONE,
|
|
2110 {(char_u *)TRUE, (char_u *)0L}},
|
|
2111 {"statusline" ,"stl", P_STRING|P_VI_DEF|P_ALLOCED|P_RSTAT,
|
|
2112 #ifdef FEAT_STL_OPT
|
40
|
2113 (char_u *)&p_stl, OPT_BOTH(PV_STL),
|
7
|
2114 #else
|
|
2115 (char_u *)NULL, PV_NONE,
|
|
2116 #endif
|
|
2117 {(char_u *)"", (char_u *)0L}},
|
|
2118 {"suffixes", "su", P_STRING|P_VI_DEF|P_COMMA|P_NODUP,
|
|
2119 (char_u *)&p_su, PV_NONE,
|
|
2120 {(char_u *)".bak,~,.o,.h,.info,.swp,.obj",
|
|
2121 (char_u *)0L}},
|
|
2122 {"suffixesadd", "sua", P_STRING|P_VI_DEF|P_ALLOCED|P_COMMA|P_NODUP,
|
|
2123 #if defined(FEAT_SEARCHPATH)
|
|
2124 (char_u *)&p_sua, PV_SUA,
|
|
2125 {(char_u *)"", (char_u *)0L}
|
|
2126 #else
|
|
2127 (char_u *)NULL, PV_NONE,
|
|
2128 {(char_u *)0L, (char_u *)0L}
|
|
2129 #endif
|
|
2130 },
|
|
2131 {"swapfile", "swf", P_BOOL|P_VI_DEF|P_RSTAT,
|
|
2132 (char_u *)&p_swf, PV_SWF,
|
|
2133 {(char_u *)TRUE, (char_u *)0L}},
|
|
2134 {"swapsync", "sws", P_STRING|P_VI_DEF,
|
|
2135 (char_u *)&p_sws, PV_NONE,
|
|
2136 {(char_u *)"fsync", (char_u *)0L}},
|
|
2137 {"switchbuf", "swb", P_STRING|P_VI_DEF|P_COMMA|P_NODUP,
|
|
2138 (char_u *)&p_swb, PV_NONE,
|
|
2139 {(char_u *)"", (char_u *)0L}},
|
410
|
2140 {"synmaxcol", "smc", P_NUM|P_VI_DEF|P_RBUF,
|
|
2141 #ifdef FEAT_SYN_HL
|
|
2142 (char_u *)&p_smc, PV_SMC,
|
|
2143 {(char_u *)3000L, (char_u *)0L}
|
|
2144 #else
|
|
2145 (char_u *)NULL, PV_NONE,
|
|
2146 {(char_u *)0L, (char_u *)0L}
|
|
2147 #endif
|
|
2148 },
|
36
|
2149 {"syntax", "syn", P_STRING|P_ALLOCED|P_VI_DEF|P_NOGLOB|P_NFNAME,
|
7
|
2150 #ifdef FEAT_SYN_HL
|
|
2151 (char_u *)&p_syn, PV_SYN,
|
|
2152 {(char_u *)"", (char_u *)0L}
|
|
2153 #else
|
|
2154 (char_u *)NULL, PV_NONE,
|
|
2155 {(char_u *)0L, (char_u *)0L}
|
|
2156 #endif
|
|
2157 },
|
|
2158 {"tabstop", "ts", P_NUM|P_VI_DEF|P_RBUF,
|
|
2159 (char_u *)&p_ts, PV_TS,
|
|
2160 {(char_u *)8L, (char_u *)0L}},
|
|
2161 {"tagbsearch", "tbs", P_BOOL|P_VI_DEF,
|
|
2162 (char_u *)&p_tbs, PV_NONE,
|
|
2163 #ifdef VMS /* binary searching doesn't appear to work on VMS */
|
|
2164 {(char_u *)0L, (char_u *)0L}
|
|
2165 #else
|
|
2166 {(char_u *)TRUE, (char_u *)0L}
|
|
2167 #endif
|
|
2168 },
|
|
2169 {"taglength", "tl", P_NUM|P_VI_DEF,
|
|
2170 (char_u *)&p_tl, PV_NONE,
|
|
2171 {(char_u *)0L, (char_u *)0L}},
|
|
2172 {"tagrelative", "tr", P_BOOL|P_VIM,
|
|
2173 (char_u *)&p_tr, PV_NONE,
|
|
2174 {(char_u *)FALSE, (char_u *)TRUE}},
|
|
2175 {"tags", "tag", P_STRING|P_EXPAND|P_VI_DEF|P_COMMA|P_NODUP,
|
|
2176 (char_u *)&p_tags, OPT_BOTH(PV_TAGS),
|
|
2177 {
|
|
2178 #if defined(FEAT_EMACS_TAGS) && !defined(CASE_INSENSITIVE_FILENAME)
|
|
2179 (char_u *)"./tags,./TAGS,tags,TAGS",
|
|
2180 #else
|
|
2181 (char_u *)"./tags,tags",
|
|
2182 #endif
|
|
2183 (char_u *)0L}},
|
|
2184 {"tagstack", "tgst", P_BOOL|P_VI_DEF,
|
|
2185 (char_u *)&p_tgst, PV_NONE,
|
|
2186 {(char_u *)TRUE, (char_u *)0L}},
|
|
2187 {"term", NULL, P_STRING|P_EXPAND|P_NODEFAULT|P_NO_MKRC|P_VI_DEF|P_RALL,
|
|
2188 (char_u *)&T_NAME, PV_NONE,
|
|
2189 {(char_u *)"", (char_u *)0L}},
|
|
2190 {"termbidi", "tbidi", P_BOOL|P_VI_DEF,
|
|
2191 #ifdef FEAT_ARABIC
|
|
2192 (char_u *)&p_tbidi, PV_NONE,
|
|
2193 #else
|
|
2194 (char_u *)NULL, PV_NONE,
|
|
2195 #endif
|
|
2196 {(char_u *)FALSE, (char_u *)0L}},
|
|
2197 {"termencoding", "tenc", P_STRING|P_VI_DEF|P_RCLR,
|
|
2198 #ifdef FEAT_MBYTE
|
|
2199 (char_u *)&p_tenc, PV_NONE,
|
|
2200 {(char_u *)"", (char_u *)0L}
|
|
2201 #else
|
|
2202 (char_u *)NULL, PV_NONE,
|
|
2203 {(char_u *)0L, (char_u *)0L}
|
|
2204 #endif
|
|
2205 },
|
|
2206 {"terse", NULL, P_BOOL|P_VI_DEF,
|
|
2207 (char_u *)&p_terse, PV_NONE,
|
|
2208 {(char_u *)FALSE, (char_u *)0L}},
|
|
2209 {"textauto", "ta", P_BOOL|P_VIM,
|
|
2210 (char_u *)&p_ta, PV_NONE,
|
|
2211 {(char_u *)DFLT_TEXTAUTO, (char_u *)TRUE}},
|
|
2212 {"textmode", "tx", P_BOOL|P_VI_DEF|P_NO_MKRC,
|
|
2213 (char_u *)&p_tx, PV_TX,
|
|
2214 {
|
|
2215 #ifdef USE_CRNL
|
|
2216 (char_u *)TRUE,
|
|
2217 #else
|
|
2218 (char_u *)FALSE,
|
|
2219 #endif
|
|
2220 (char_u *)0L}},
|
|
2221 {"textwidth", "tw", P_NUM|P_VI_DEF|P_VIM,
|
|
2222 (char_u *)&p_tw, PV_TW,
|
|
2223 {(char_u *)0L, (char_u *)0L}},
|
|
2224 {"thesaurus", "tsr", P_STRING|P_EXPAND|P_VI_DEF|P_COMMA|P_NODUP,
|
|
2225 #ifdef FEAT_INS_EXPAND
|
|
2226 (char_u *)&p_tsr, OPT_BOTH(PV_TSR),
|
|
2227 #else
|
|
2228 (char_u *)NULL, PV_NONE,
|
|
2229 #endif
|
|
2230 {(char_u *)"", (char_u *)0L}},
|
|
2231 {"tildeop", "top", P_BOOL|P_VI_DEF|P_VIM,
|
|
2232 (char_u *)&p_to, PV_NONE,
|
|
2233 {(char_u *)FALSE, (char_u *)0L}},
|
|
2234 {"timeout", "to", P_BOOL|P_VI_DEF,
|
|
2235 (char_u *)&p_timeout, PV_NONE,
|
|
2236 {(char_u *)TRUE, (char_u *)0L}},
|
|
2237 {"timeoutlen", "tm", P_NUM|P_VI_DEF,
|
|
2238 (char_u *)&p_tm, PV_NONE,
|
|
2239 {(char_u *)1000L, (char_u *)0L}},
|
|
2240 {"title", NULL, P_BOOL|P_VI_DEF,
|
|
2241 #ifdef FEAT_TITLE
|
|
2242 (char_u *)&p_title, PV_NONE,
|
|
2243 #else
|
|
2244 (char_u *)NULL, PV_NONE,
|
|
2245 #endif
|
|
2246 {(char_u *)FALSE, (char_u *)0L}},
|
|
2247 {"titlelen", NULL, P_NUM|P_VI_DEF,
|
|
2248 #ifdef FEAT_TITLE
|
|
2249 (char_u *)&p_titlelen, PV_NONE,
|
|
2250 #else
|
|
2251 (char_u *)NULL, PV_NONE,
|
|
2252 #endif
|
|
2253 {(char_u *)85L, (char_u *)0L}},
|
36
|
2254 {"titleold", NULL, P_STRING|P_VI_DEF|P_GETTEXT|P_SECURE,
|
7
|
2255 #ifdef FEAT_TITLE
|
|
2256 (char_u *)&p_titleold, PV_NONE,
|
|
2257 {(char_u *)N_("Thanks for flying Vim"),
|
|
2258 (char_u *)0L}
|
|
2259 #else
|
|
2260 (char_u *)NULL, PV_NONE,
|
|
2261 {(char_u *)0L, (char_u *)0L}
|
|
2262 #endif
|
|
2263 },
|
|
2264 {"titlestring", NULL, P_STRING|P_VI_DEF,
|
|
2265 #ifdef FEAT_TITLE
|
|
2266 (char_u *)&p_titlestring, PV_NONE,
|
|
2267 #else
|
|
2268 (char_u *)NULL, PV_NONE,
|
|
2269 #endif
|
|
2270 {(char_u *)"", (char_u *)0L}},
|
|
2271 #if defined(FEAT_TOOLBAR) && !defined(FEAT_GUI_W32)
|
|
2272 {"toolbar", "tb", P_STRING|P_COMMA|P_VI_DEF|P_NODUP,
|
|
2273 (char_u *)&p_toolbar, PV_NONE,
|
|
2274 {(char_u *)"icons,tooltips", (char_u *)0L}},
|
|
2275 #endif
|
|
2276 #if defined(FEAT_TOOLBAR) && defined(FEAT_GUI_GTK) && defined(HAVE_GTK2)
|
|
2277 {"toolbariconsize", "tbis", P_STRING|P_VI_DEF,
|
|
2278 (char_u *)&p_tbis, PV_NONE,
|
|
2279 {(char_u *)"small", (char_u *)0L}},
|
|
2280 #endif
|
|
2281 {"ttimeout", NULL, P_BOOL|P_VI_DEF|P_VIM,
|
|
2282 (char_u *)&p_ttimeout, PV_NONE,
|
|
2283 {(char_u *)FALSE, (char_u *)0L}},
|
|
2284 {"ttimeoutlen", "ttm", P_NUM|P_VI_DEF,
|
|
2285 (char_u *)&p_ttm, PV_NONE,
|
|
2286 {(char_u *)-1L, (char_u *)0L}},
|
|
2287 {"ttybuiltin", "tbi", P_BOOL|P_VI_DEF,
|
|
2288 (char_u *)&p_tbi, PV_NONE,
|
|
2289 {(char_u *)TRUE, (char_u *)0L}},
|
|
2290 {"ttyfast", "tf", P_BOOL|P_NO_MKRC|P_VI_DEF,
|
|
2291 (char_u *)&p_tf, PV_NONE,
|
|
2292 {(char_u *)FALSE, (char_u *)0L}},
|
|
2293 {"ttymouse", "ttym", P_STRING|P_NODEFAULT|P_NO_MKRC|P_VI_DEF,
|
|
2294 #if defined(FEAT_MOUSE) && (defined(UNIX) || defined(VMS))
|
|
2295 (char_u *)&p_ttym, PV_NONE,
|
|
2296 #else
|
|
2297 (char_u *)NULL, PV_NONE,
|
|
2298 #endif
|
|
2299 {(char_u *)"", (char_u *)0L}},
|
|
2300 {"ttyscroll", "tsl", P_NUM|P_VI_DEF,
|
|
2301 (char_u *)&p_ttyscroll, PV_NONE,
|
|
2302 {(char_u *)999L, (char_u *)0L}},
|
|
2303 {"ttytype", "tty", P_STRING|P_EXPAND|P_NODEFAULT|P_NO_MKRC|P_VI_DEF|P_RALL,
|
|
2304 (char_u *)&T_NAME, PV_NONE,
|
|
2305 {(char_u *)"", (char_u *)0L}},
|
|
2306 {"undolevels", "ul", P_NUM|P_VI_DEF,
|
|
2307 (char_u *)&p_ul, PV_NONE,
|
|
2308 {
|
|
2309 #if defined(UNIX) || defined(WIN3264) || defined(OS2) || defined(VMS)
|
|
2310 (char_u *)1000L,
|
|
2311 #else
|
|
2312 (char_u *)100L,
|
|
2313 #endif
|
|
2314 (char_u *)0L}},
|
|
2315 {"updatecount", "uc", P_NUM|P_VI_DEF,
|
|
2316 (char_u *)&p_uc, PV_NONE,
|
|
2317 {(char_u *)200L, (char_u *)0L}},
|
|
2318 {"updatetime", "ut", P_NUM|P_VI_DEF,
|
|
2319 (char_u *)&p_ut, PV_NONE,
|
|
2320 {(char_u *)4000L, (char_u *)0L}},
|
|
2321 {"verbose", "vbs", P_NUM|P_VI_DEF,
|
|
2322 (char_u *)&p_verbose, PV_NONE,
|
|
2323 {(char_u *)0L, (char_u *)0L}},
|
294
|
2324 {"verbosefile", "vfile", P_STRING|P_EXPAND|P_VI_DEF|P_SECURE,
|
|
2325 (char_u *)&p_vfile, PV_NONE,
|
|
2326 {(char_u *)"", (char_u *)0L}},
|
7
|
2327 {"viewdir", "vdir", P_STRING|P_EXPAND|P_VI_DEF|P_SECURE,
|
|
2328 #ifdef FEAT_SESSION
|
|
2329 (char_u *)&p_vdir, PV_NONE,
|
|
2330 {(char_u *)DFLT_VDIR, (char_u *)0L}
|
|
2331 #else
|
|
2332 (char_u *)NULL, PV_NONE,
|
|
2333 {(char_u *)0L, (char_u *)0L}
|
|
2334 #endif
|
|
2335 },
|
|
2336 {"viewoptions", "vop", P_STRING|P_VI_DEF|P_COMMA|P_NODUP,
|
|
2337 #ifdef FEAT_SESSION
|
|
2338 (char_u *)&p_vop, PV_NONE,
|
|
2339 {(char_u *)"folds,options,cursor", (char_u *)0L}
|
|
2340 #else
|
|
2341 (char_u *)NULL, PV_NONE,
|
|
2342 {(char_u *)0L, (char_u *)0L}
|
|
2343 #endif
|
|
2344 },
|
|
2345 {"viminfo", "vi", P_STRING|P_COMMA|P_NODUP|P_SECURE,
|
|
2346 #ifdef FEAT_VIMINFO
|
|
2347 (char_u *)&p_viminfo, PV_NONE,
|
|
2348 #if defined(MSDOS) || defined(MSWIN) || defined(OS2)
|
|
2349 {(char_u *)"", (char_u *)"'20,<50,s10,h,rA:,rB:"}
|
|
2350 #else
|
|
2351 # ifdef AMIGA
|
|
2352 {(char_u *)"",
|
|
2353 (char_u *)"'20,<50,s10,h,rdf0:,rdf1:,rdf2:"}
|
|
2354 # else
|
|
2355 {(char_u *)"", (char_u *)"'20,<50,s10,h"}
|
|
2356 # endif
|
|
2357 #endif
|
|
2358 #else
|
|
2359 (char_u *)NULL, PV_NONE,
|
|
2360 {(char_u *)0L, (char_u *)0L}
|
|
2361 #endif
|
|
2362 },
|
|
2363 {"virtualedit", "ve", P_STRING|P_COMMA|P_NODUP|P_VI_DEF|P_VIM,
|
|
2364 #ifdef FEAT_VIRTUALEDIT
|
|
2365 (char_u *)&p_ve, PV_NONE,
|
|
2366 {(char_u *)"", (char_u *)""}
|
|
2367 #else
|
|
2368 (char_u *)NULL, PV_NONE,
|
|
2369 {(char_u *)0L, (char_u *)0L}
|
|
2370 #endif
|
|
2371 },
|
|
2372 {"visualbell", "vb", P_BOOL|P_VI_DEF,
|
|
2373 (char_u *)&p_vb, PV_NONE,
|
|
2374 {(char_u *)FALSE, (char_u *)0L}},
|
|
2375 {"w300", NULL, P_NUM|P_VI_DEF,
|
|
2376 (char_u *)NULL, PV_NONE,
|
|
2377 {(char_u *)0L, (char_u *)0L}},
|
|
2378 {"w1200", NULL, P_NUM|P_VI_DEF,
|
|
2379 (char_u *)NULL, PV_NONE,
|
|
2380 {(char_u *)0L, (char_u *)0L}},
|
|
2381 {"w9600", NULL, P_NUM|P_VI_DEF,
|
|
2382 (char_u *)NULL, PV_NONE,
|
|
2383 {(char_u *)0L, (char_u *)0L}},
|
|
2384 {"warn", NULL, P_BOOL|P_VI_DEF,
|
|
2385 (char_u *)&p_warn, PV_NONE,
|
|
2386 {(char_u *)TRUE, (char_u *)0L}},
|
|
2387 {"weirdinvert", "wiv", P_BOOL|P_VI_DEF|P_RCLR,
|
|
2388 (char_u *)&p_wiv, PV_NONE,
|
|
2389 {(char_u *)FALSE, (char_u *)0L}},
|
|
2390 {"whichwrap", "ww", P_STRING|P_VIM|P_COMMA|P_FLAGLIST,
|
|
2391 (char_u *)&p_ww, PV_NONE,
|
|
2392 {(char_u *)"", (char_u *)"b,s"}},
|
|
2393 {"wildchar", "wc", P_NUM|P_VIM,
|
|
2394 (char_u *)&p_wc, PV_NONE,
|
|
2395 {(char_u *)(long)Ctrl_E, (char_u *)(long)TAB}},
|
|
2396 {"wildcharm", "wcm", P_NUM|P_VI_DEF,
|
|
2397 (char_u *)&p_wcm, PV_NONE,
|
|
2398 {(char_u *)0L, (char_u *)0L}},
|
|
2399 {"wildignore", "wig", P_STRING|P_VI_DEF|P_COMMA|P_NODUP,
|
|
2400 #ifdef FEAT_WILDIGN
|
|
2401 (char_u *)&p_wig, PV_NONE,
|
|
2402 #else
|
|
2403 (char_u *)NULL, PV_NONE,
|
|
2404 #endif
|
|
2405 {(char_u *)"", (char_u *)0L}},
|
|
2406 {"wildmenu", "wmnu", P_BOOL|P_VI_DEF,
|
|
2407 #ifdef FEAT_WILDMENU
|
|
2408 (char_u *)&p_wmnu, PV_NONE,
|
|
2409 #else
|
|
2410 (char_u *)NULL, PV_NONE,
|
|
2411 #endif
|
|
2412 {(char_u *)FALSE, (char_u *)0L}},
|
|
2413 {"wildmode", "wim", P_STRING|P_VI_DEF|P_COMMA|P_NODUP,
|
|
2414 (char_u *)&p_wim, PV_NONE,
|
|
2415 {(char_u *)"full", (char_u *)0L}},
|
40
|
2416 {"wildoptions", "wop", P_STRING|P_VI_DEF,
|
|
2417 #ifdef FEAT_CMDL_COMPL
|
|
2418 (char_u *)&p_wop, PV_NONE,
|
|
2419 {(char_u *)"", (char_u *)0L}
|
|
2420 #else
|
|
2421 (char_u *)NULL, PV_NONE,
|
|
2422 {(char_u *)NULL, (char_u *)0L}
|
|
2423 #endif
|
|
2424 },
|
7
|
2425 {"winaltkeys", "wak", P_STRING|P_VI_DEF,
|
|
2426 #ifdef FEAT_WAK
|
|
2427 (char_u *)&p_wak, PV_NONE,
|
|
2428 {(char_u *)"menu", (char_u *)0L}
|
|
2429 #else
|
|
2430 (char_u *)NULL, PV_NONE,
|
|
2431 {(char_u *)NULL, (char_u *)0L}
|
|
2432 #endif
|
|
2433 },
|
|
2434 {"window", "wi", P_NUM|P_VI_DEF,
|
164
|
2435 (char_u *)&p_window, PV_NONE,
|
7
|
2436 {(char_u *)0L, (char_u *)0L}},
|
|
2437 {"winheight", "wh", P_NUM|P_VI_DEF,
|
|
2438 #ifdef FEAT_WINDOWS
|
|
2439 (char_u *)&p_wh, PV_NONE,
|
|
2440 #else
|
|
2441 (char_u *)NULL, PV_NONE,
|
|
2442 #endif
|
|
2443 {(char_u *)1L, (char_u *)0L}},
|
|
2444 {"winfixheight", "wfh", P_BOOL|P_VI_DEF|P_RSTAT,
|
|
2445 #if defined(FEAT_WINDOWS)
|
|
2446 (char_u *)VAR_WIN, PV_WFH,
|
|
2447 #else
|
|
2448 (char_u *)NULL, PV_NONE,
|
|
2449 #endif
|
|
2450 {(char_u *)FALSE, (char_u *)0L}},
|
|
2451 {"winminheight", "wmh", P_NUM|P_VI_DEF,
|
|
2452 #ifdef FEAT_WINDOWS
|
|
2453 (char_u *)&p_wmh, PV_NONE,
|
|
2454 #else
|
|
2455 (char_u *)NULL, PV_NONE,
|
|
2456 #endif
|
|
2457 {(char_u *)1L, (char_u *)0L}},
|
|
2458 {"winminwidth", "wmw", P_NUM|P_VI_DEF,
|
|
2459 #ifdef FEAT_VERTSPLIT
|
|
2460 (char_u *)&p_wmw, PV_NONE,
|
|
2461 #else
|
|
2462 (char_u *)NULL, PV_NONE,
|
|
2463 #endif
|
|
2464 {(char_u *)1L, (char_u *)0L}},
|
|
2465 {"winwidth", "wiw", P_NUM|P_VI_DEF,
|
|
2466 #ifdef FEAT_VERTSPLIT
|
|
2467 (char_u *)&p_wiw, PV_NONE,
|
|
2468 #else
|
|
2469 (char_u *)NULL, PV_NONE,
|
|
2470 #endif
|
|
2471 {(char_u *)20L, (char_u *)0L}},
|
|
2472 {"wrap", NULL, P_BOOL|P_VI_DEF|P_RWIN,
|
|
2473 (char_u *)VAR_WIN, PV_WRAP,
|
|
2474 {(char_u *)TRUE, (char_u *)0L}},
|
|
2475 {"wrapmargin", "wm", P_NUM|P_VI_DEF,
|
|
2476 (char_u *)&p_wm, PV_WM,
|
|
2477 {(char_u *)0L, (char_u *)0L}},
|
|
2478 {"wrapscan", "ws", P_BOOL|P_VI_DEF,
|
|
2479 (char_u *)&p_ws, PV_NONE,
|
|
2480 {(char_u *)TRUE, (char_u *)0L}},
|
|
2481 {"write", NULL, P_BOOL|P_VI_DEF,
|
|
2482 (char_u *)&p_write, PV_NONE,
|
|
2483 {(char_u *)TRUE, (char_u *)0L}},
|
|
2484 {"writeany", "wa", P_BOOL|P_VI_DEF,
|
|
2485 (char_u *)&p_wa, PV_NONE,
|
|
2486 {(char_u *)FALSE, (char_u *)0L}},
|
|
2487 {"writebackup", "wb", P_BOOL|P_VI_DEF|P_VIM,
|
|
2488 (char_u *)&p_wb, PV_NONE,
|
|
2489 {
|
|
2490 #ifdef FEAT_WRITEBACKUP
|
|
2491 (char_u *)TRUE,
|
|
2492 #else
|
|
2493 (char_u *)FALSE,
|
|
2494 #endif
|
|
2495 (char_u *)0L}},
|
|
2496 {"writedelay", "wd", P_NUM|P_VI_DEF,
|
|
2497 (char_u *)&p_wd, PV_NONE,
|
|
2498 {(char_u *)0L, (char_u *)0L}},
|
|
2499
|
|
2500 /* terminal output codes */
|
36
|
2501 #define p_term(sss, vvv) {sss, NULL, P_STRING|P_VI_DEF|P_RALL|P_SECURE, \
|
7
|
2502 (char_u *)&vvv, PV_NONE, \
|
|
2503 {(char_u *)"", (char_u *)0L}},
|
|
2504
|
|
2505 p_term("t_AB", T_CAB)
|
|
2506 p_term("t_AF", T_CAF)
|
|
2507 p_term("t_AL", T_CAL)
|
|
2508 p_term("t_al", T_AL)
|
|
2509 p_term("t_bc", T_BC)
|
|
2510 p_term("t_cd", T_CD)
|
|
2511 p_term("t_ce", T_CE)
|
|
2512 p_term("t_cl", T_CL)
|
|
2513 p_term("t_cm", T_CM)
|
|
2514 p_term("t_Co", T_CCO)
|
|
2515 p_term("t_CS", T_CCS)
|
|
2516 p_term("t_cs", T_CS)
|
|
2517 #ifdef FEAT_VERTSPLIT
|
|
2518 p_term("t_CV", T_CSV)
|
|
2519 #endif
|
|
2520 p_term("t_ut", T_UT)
|
|
2521 p_term("t_da", T_DA)
|
|
2522 p_term("t_db", T_DB)
|
|
2523 p_term("t_DL", T_CDL)
|
|
2524 p_term("t_dl", T_DL)
|
|
2525 p_term("t_fs", T_FS)
|
|
2526 p_term("t_IE", T_CIE)
|
|
2527 p_term("t_IS", T_CIS)
|
|
2528 p_term("t_ke", T_KE)
|
|
2529 p_term("t_ks", T_KS)
|
|
2530 p_term("t_le", T_LE)
|
|
2531 p_term("t_mb", T_MB)
|
|
2532 p_term("t_md", T_MD)
|
|
2533 p_term("t_me", T_ME)
|
|
2534 p_term("t_mr", T_MR)
|
|
2535 p_term("t_ms", T_MS)
|
|
2536 p_term("t_nd", T_ND)
|
|
2537 p_term("t_op", T_OP)
|
|
2538 p_term("t_RI", T_CRI)
|
|
2539 p_term("t_RV", T_CRV)
|
|
2540 p_term("t_Sb", T_CSB)
|
|
2541 p_term("t_Sf", T_CSF)
|
|
2542 p_term("t_se", T_SE)
|
|
2543 p_term("t_so", T_SO)
|
|
2544 p_term("t_sr", T_SR)
|
|
2545 p_term("t_ts", T_TS)
|
|
2546 p_term("t_te", T_TE)
|
|
2547 p_term("t_ti", T_TI)
|
|
2548 p_term("t_ue", T_UE)
|
|
2549 p_term("t_us", T_US)
|
|
2550 p_term("t_vb", T_VB)
|
|
2551 p_term("t_ve", T_VE)
|
|
2552 p_term("t_vi", T_VI)
|
|
2553 p_term("t_vs", T_VS)
|
|
2554 p_term("t_WP", T_CWP)
|
|
2555 p_term("t_WS", T_CWS)
|
36
|
2556 p_term("t_SI", T_CSI)
|
|
2557 p_term("t_EI", T_CEI)
|
7
|
2558 p_term("t_xs", T_XS)
|
|
2559 p_term("t_ZH", T_CZH)
|
|
2560 p_term("t_ZR", T_CZR)
|
|
2561
|
|
2562 /* terminal key codes are not in here */
|
|
2563
|
|
2564 {NULL, NULL, 0, NULL, PV_NONE, {NULL, NULL}} /* end marker */
|
|
2565 };
|
|
2566
|
|
2567 #define PARAM_COUNT (sizeof(options) / sizeof(struct vimoption))
|
|
2568
|
|
2569 #ifdef FEAT_MBYTE
|
|
2570 static char *(p_ambw_values[]) = {"single", "double", NULL};
|
|
2571 #endif
|
|
2572 static char *(p_bg_values[]) = {"light", "dark", NULL};
|
|
2573 static char *(p_nf_values[]) = {"octal", "hex", "alpha", NULL};
|
|
2574 static char *(p_ff_values[]) = {FF_UNIX, FF_DOS, FF_MAC, NULL};
|
40
|
2575 #ifdef FEAT_CMDL_COMPL
|
|
2576 static char *(p_wop_values[]) = {"tagfile", NULL};
|
|
2577 #endif
|
7
|
2578 #ifdef FEAT_WAK
|
|
2579 static char *(p_wak_values[]) = {"yes", "menu", "no", NULL};
|
|
2580 #endif
|
|
2581 static char *(p_mousem_values[]) = {"extend", "popup", "popup_setpos", "mac", NULL};
|
|
2582 #ifdef FEAT_VISUAL
|
|
2583 static char *(p_sel_values[]) = {"inclusive", "exclusive", "old", NULL};
|
|
2584 static char *(p_slm_values[]) = {"mouse", "key", "cmd", NULL};
|
|
2585 #endif
|
|
2586 #ifdef FEAT_VISUAL
|
|
2587 static char *(p_km_values[]) = {"startsel", "stopsel", NULL};
|
|
2588 #endif
|
|
2589 #ifdef FEAT_BROWSE
|
|
2590 static char *(p_bsdir_values[]) = {"current", "last", "buffer", NULL};
|
|
2591 #endif
|
|
2592 #ifdef FEAT_SCROLLBIND
|
|
2593 static char *(p_scbopt_values[]) = {"ver", "hor", "jump", NULL};
|
|
2594 #endif
|
|
2595 static char *(p_swb_values[]) = {"useopen", "split", NULL};
|
168
|
2596 static char *(p_debug_values[]) = {"msg", "beep", NULL};
|
7
|
2597 #ifdef FEAT_VERTSPLIT
|
|
2598 static char *(p_ead_values[]) = {"both", "ver", "hor", NULL};
|
|
2599 #endif
|
|
2600 #if defined(FEAT_QUICKFIX)
|
17
|
2601 # ifdef FEAT_AUTOCMD
|
|
2602 static char *(p_buftype_values[]) = {"nofile", "nowrite", "quickfix", "help", "acwrite", NULL};
|
|
2603 # else
|
7
|
2604 static char *(p_buftype_values[]) = {"nofile", "nowrite", "quickfix", "help", NULL};
|
17
|
2605 # endif
|
7
|
2606 static char *(p_bufhidden_values[]) = {"hide", "unload", "delete", "wipe", NULL};
|
|
2607 #endif
|
|
2608 static char *(p_bs_values[]) = {"indent", "eol", "start", NULL};
|
|
2609 #ifdef FEAT_FOLDING
|
|
2610 static char *(p_fdm_values[]) = {"manual", "expr", "marker", "indent", "syntax",
|
|
2611 #ifdef FEAT_DIFF
|
|
2612 "diff",
|
|
2613 #endif
|
|
2614 NULL};
|
|
2615 static char *(p_fcl_values[]) = {"all", NULL};
|
|
2616 #endif
|
|
2617
|
|
2618 static void set_option_default __ARGS((int, int opt_flags, int compatible));
|
|
2619 static void set_options_default __ARGS((int opt_flags));
|
|
2620 static char_u *illegal_char __ARGS((char_u *, int));
|
|
2621 static int string_to_key __ARGS((char_u *arg));
|
|
2622 #ifdef FEAT_CMDWIN
|
|
2623 static char_u *check_cedit __ARGS((void));
|
|
2624 #endif
|
|
2625 #ifdef FEAT_TITLE
|
|
2626 static void did_set_title __ARGS((int icon));
|
|
2627 #endif
|
|
2628 static char_u *option_expand __ARGS((int opt_idx, char_u *val));
|
|
2629 static void didset_options __ARGS((void));
|
|
2630 static void check_string_option __ARGS((char_u **pp));
|
|
2631 static void set_string_option_global __ARGS((int opt_idx, char_u **varp));
|
|
2632 static void set_string_option __ARGS((int opt_idx, char_u *value, int opt_flags));
|
|
2633 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));
|
|
2634 static char_u *set_chars_option __ARGS((char_u **varp));
|
|
2635 #ifdef FEAT_CLIPBOARD
|
|
2636 static char_u *check_clipboard_option __ARGS((void));
|
|
2637 #endif
|
386
|
2638 #ifdef FEAT_SYN_HL
|
389
|
2639 static char_u *compile_cap_prog __ARGS((buf_T *buf));
|
386
|
2640 #endif
|
7
|
2641 static char_u *set_bool_option __ARGS((int opt_idx, char_u *varp, int value, int opt_flags));
|
274
|
2642 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
|
2643 static void check_redraw __ARGS((long_u flags));
|
|
2644 static int findoption __ARGS((char_u *));
|
|
2645 static int find_key_option __ARGS((char_u *));
|
|
2646 static void showoptions __ARGS((int all, int opt_flags));
|
|
2647 static int optval_default __ARGS((struct vimoption *, char_u *varp));
|
|
2648 static void showoneopt __ARGS((struct vimoption *, int opt_flags));
|
|
2649 static int put_setstring __ARGS((FILE *fd, char *cmd, char *name, char_u **valuep, int expand));
|
|
2650 static int put_setnum __ARGS((FILE *fd, char *cmd, char *name, long *valuep));
|
|
2651 static int put_setbool __ARGS((FILE *fd, char *cmd, char *name, int value));
|
|
2652 static int istermoption __ARGS((struct vimoption *));
|
|
2653 static char_u *get_varp_scope __ARGS((struct vimoption *p, int opt_flags));
|
|
2654 static char_u *get_varp __ARGS((struct vimoption *));
|
|
2655 static void option_value2string __ARGS((struct vimoption *, int opt_flags));
|
|
2656 static int wc_use_keyname __ARGS((char_u *varp, long *wcp));
|
|
2657 #ifdef FEAT_LANGMAP
|
|
2658 static void langmap_init __ARGS((void));
|
|
2659 static void langmap_set __ARGS((void));
|
|
2660 #endif
|
|
2661 static void paste_option_changed __ARGS((void));
|
|
2662 static void compatible_set __ARGS((void));
|
|
2663 #ifdef FEAT_LINEBREAK
|
|
2664 static void fill_breakat_flags __ARGS((void));
|
|
2665 #endif
|
|
2666 static int opt_strings_flags __ARGS((char_u *val, char **values, unsigned *flagp, int list));
|
|
2667 static int check_opt_strings __ARGS((char_u *val, char **values, int));
|
|
2668 static int check_opt_wim __ARGS((void));
|
|
2669
|
|
2670 /*
|
|
2671 * Initialize the options, first part.
|
|
2672 *
|
|
2673 * Called only once from main(), just after creating the first buffer.
|
|
2674 */
|
|
2675 void
|
|
2676 set_init_1()
|
|
2677 {
|
|
2678 char_u *p;
|
|
2679 int opt_idx;
|
|
2680 long n;
|
|
2681
|
|
2682 #ifdef FEAT_LANGMAP
|
|
2683 langmap_init();
|
|
2684 #endif
|
|
2685
|
|
2686 /* Be Vi compatible by default */
|
|
2687 p_cp = TRUE;
|
|
2688
|
164
|
2689 /* Use POSIX compatibility when $VIM_POSIX is set. */
|
|
2690 if (mch_getenv((char_u *)"VIM_POSIX") != NULL)
|
168
|
2691 {
|
164
|
2692 set_string_default("cpo", (char_u *)CPO_ALL);
|
168
|
2693 set_string_default("shm", (char_u *)"A");
|
|
2694 }
|
164
|
2695
|
7
|
2696 /*
|
|
2697 * Find default value for 'shell' option.
|
161
|
2698 * Don't use it if it is empty.
|
7
|
2699 */
|
161
|
2700 if (((p = mch_getenv((char_u *)"SHELL")) != NULL && *p != NUL)
|
7
|
2701 #if defined(MSDOS) || defined(MSWIN) || defined(OS2)
|
|
2702 # ifdef __EMX__
|
161
|
2703 || ((p = mch_getenv((char_u *)"EMXSHELL")) != NULL && *p != NUL)
|
7
|
2704 # endif
|
161
|
2705 || ((p = mch_getenv((char_u *)"COMSPEC")) != NULL && *p != NUL)
|
7
|
2706 # ifdef WIN3264
|
161
|
2707 || ((p = default_shell()) != NULL && *p != NUL)
|
7
|
2708 # endif
|
|
2709 #endif
|
161
|
2710 )
|
7
|
2711 set_string_default("sh", p);
|
|
2712
|
|
2713 #ifdef FEAT_WILDIGN
|
|
2714 /*
|
|
2715 * Set the default for 'backupskip' to include environment variables for
|
|
2716 * temp files.
|
|
2717 */
|
|
2718 {
|
|
2719 # ifdef UNIX
|
|
2720 static char *(names[4]) = {"", "TMPDIR", "TEMP", "TMP"};
|
|
2721 # else
|
|
2722 static char *(names[3]) = {"TMPDIR", "TEMP", "TMP"};
|
|
2723 # endif
|
170
|
2724 int len;
|
|
2725 garray_T ga;
|
|
2726 int mustfree;
|
7
|
2727
|
|
2728 ga_init2(&ga, 1, 100);
|
|
2729 for (n = 0; n < (long)(sizeof(names) / sizeof(char *)); ++n)
|
|
2730 {
|
170
|
2731 mustfree = FALSE;
|
7
|
2732 # ifdef UNIX
|
|
2733 if (*names[n] == NUL)
|
|
2734 p = (char_u *)"/tmp";
|
|
2735 else
|
|
2736 # endif
|
170
|
2737 p = vim_getenv((char_u *)names[n], &mustfree);
|
7
|
2738 if (p != NULL && *p != NUL)
|
|
2739 {
|
|
2740 /* First time count the NUL, otherwise count the ','. */
|
|
2741 len = STRLEN(p) + 3;
|
|
2742 if (ga_grow(&ga, len) == OK)
|
|
2743 {
|
|
2744 if (ga.ga_len > 0)
|
|
2745 STRCAT(ga.ga_data, ",");
|
|
2746 STRCAT(ga.ga_data, p);
|
|
2747 add_pathsep(ga.ga_data);
|
|
2748 STRCAT(ga.ga_data, "*");
|
|
2749 ga.ga_len += len;
|
|
2750 }
|
|
2751 }
|
170
|
2752 if (mustfree)
|
|
2753 vim_free(p);
|
7
|
2754 }
|
|
2755 if (ga.ga_data != NULL)
|
|
2756 {
|
|
2757 set_string_default("bsk", ga.ga_data);
|
|
2758 vim_free(ga.ga_data);
|
|
2759 }
|
|
2760 }
|
|
2761 #endif
|
|
2762
|
|
2763 /*
|
|
2764 * 'maxmemtot' and 'maxmem' may have to be adjusted for available memory
|
|
2765 */
|
|
2766 opt_idx = findoption((char_u *)"maxmemtot");
|
|
2767 #if !defined(HAVE_AVAIL_MEM) && !defined(HAVE_TOTAL_MEM)
|
|
2768 if (options[opt_idx].def_val[VI_DEFAULT] == (char_u *)0L)
|
|
2769 #endif
|
|
2770 {
|
|
2771 #ifdef HAVE_AVAIL_MEM
|
|
2772 /* Use amount of memory available at this moment. */
|
|
2773 n = (mch_avail_mem(FALSE) >> 11);
|
|
2774 #else
|
|
2775 # ifdef HAVE_TOTAL_MEM
|
|
2776 /* Use amount of memory available to Vim. */
|
|
2777 n = (mch_total_mem(FALSE) >> 11);
|
|
2778 # else
|
|
2779 n = (0x7fffffff >> 11);
|
|
2780 # endif
|
|
2781 #endif
|
|
2782 options[opt_idx].def_val[VI_DEFAULT] = (char_u *)n;
|
|
2783 opt_idx = findoption((char_u *)"maxmem");
|
|
2784 #if !defined(HAVE_AVAIL_MEM) && !defined(HAVE_TOTAL_MEM)
|
|
2785 if ((long)options[opt_idx].def_val[VI_DEFAULT] > n
|
|
2786 || (long)options[opt_idx].def_val[VI_DEFAULT] == 0L)
|
|
2787 #endif
|
|
2788 options[opt_idx].def_val[VI_DEFAULT] = (char_u *)n;
|
|
2789 }
|
|
2790
|
|
2791 #ifdef FEAT_GUI_W32
|
|
2792 /* force 'shortname' for Win32s */
|
|
2793 if (gui_is_win32s())
|
|
2794 options[findoption((char_u *)"shortname")].def_val[VI_DEFAULT] =
|
|
2795 (char_u *)TRUE;
|
|
2796 #endif
|
|
2797
|
|
2798 #ifdef FEAT_SEARCHPATH
|
|
2799 {
|
|
2800 char_u *cdpath;
|
|
2801 char_u *buf;
|
|
2802 int i;
|
|
2803 int j;
|
170
|
2804 int mustfree = FALSE;
|
7
|
2805
|
|
2806 /* Initialize the 'cdpath' option's default value. */
|
170
|
2807 cdpath = vim_getenv((char_u *)"CDPATH", &mustfree);
|
7
|
2808 if (cdpath != NULL)
|
|
2809 {
|
|
2810 buf = alloc((unsigned)((STRLEN(cdpath) << 1) + 2));
|
|
2811 if (buf != NULL)
|
|
2812 {
|
|
2813 buf[0] = ','; /* start with ",", current dir first */
|
|
2814 j = 1;
|
|
2815 for (i = 0; cdpath[i] != NUL; ++i)
|
|
2816 {
|
|
2817 if (vim_ispathlistsep(cdpath[i]))
|
|
2818 buf[j++] = ',';
|
|
2819 else
|
|
2820 {
|
|
2821 if (cdpath[i] == ' ' || cdpath[i] == ',')
|
|
2822 buf[j++] = '\\';
|
|
2823 buf[j++] = cdpath[i];
|
|
2824 }
|
|
2825 }
|
|
2826 buf[j] = NUL;
|
|
2827 opt_idx = findoption((char_u *)"cdpath");
|
|
2828 options[opt_idx].def_val[VI_DEFAULT] = buf;
|
|
2829 options[opt_idx].flags |= P_DEF_ALLOCED;
|
|
2830 }
|
170
|
2831 if (mustfree)
|
|
2832 vim_free(cdpath);
|
7
|
2833 }
|
|
2834 }
|
|
2835 #endif
|
|
2836
|
|
2837 #if defined(FEAT_POSTSCRIPT) && (defined(MSWIN) || defined(OS2) || defined(VMS) || defined(EBCDIC) || defined(MAC) || defined(hpux))
|
|
2838 /* Set print encoding on platforms that don't default to latin1 */
|
|
2839 set_string_default("penc",
|
|
2840 # if defined(MSWIN) || defined(OS2)
|
|
2841 (char_u *)"cp1252"
|
|
2842 # else
|
|
2843 # ifdef VMS
|
|
2844 (char_u *)"dec-mcs"
|
|
2845 # else
|
|
2846 # ifdef EBCDIC
|
|
2847 (char_u *)"ebcdic-uk"
|
|
2848 # else
|
|
2849 # ifdef MAC
|
|
2850 (char_u *)"mac-roman"
|
|
2851 # else /* HPUX */
|
|
2852 (char_u *)"hp-roman8"
|
|
2853 # endif
|
|
2854 # endif
|
|
2855 # endif
|
|
2856 # endif
|
|
2857 );
|
|
2858 #endif
|
|
2859
|
|
2860 #ifdef FEAT_POSTSCRIPT
|
|
2861 /* 'printexpr' must be allocated to be able to evaluate it. */
|
|
2862 set_string_default("pexpr",
|
8
|
2863 # if defined(MSWIN) || defined(MSDOS) || defined(OS2)
|
|
2864 (char_u *)"system('copy' . ' ' . v:fname_in . (&printdevice == '' ? ' LPT1:' : (' \"' . &printdevice . '\"'))) . delete(v:fname_in)"
|
7
|
2865 # else
|
|
2866 # ifdef VMS
|
|
2867 (char_u *)"system('print/delete' . (&printdevice == '' ? '' : ' /queue=' . &printdevice) . ' ' . v:fname_in)"
|
|
2868
|
|
2869 # else
|
|
2870 (char_u *)"system('lpr' . (&printdevice == '' ? '' : ' -P' . &printdevice) . ' ' . v:fname_in) . delete(v:fname_in) + v:shell_error"
|
|
2871 # endif
|
|
2872 # endif
|
|
2873 );
|
|
2874 #endif
|
|
2875
|
|
2876 /*
|
|
2877 * Set all the options (except the terminal options) to their default
|
|
2878 * value. Also set the global value for local options.
|
|
2879 */
|
|
2880 set_options_default(0);
|
|
2881
|
|
2882 #ifdef FEAT_GUI
|
|
2883 if (found_reverse_arg)
|
|
2884 set_option_value((char_u *)"bg", 0L, (char_u *)"dark", 0);
|
|
2885 #endif
|
|
2886
|
|
2887 curbuf->b_p_initialized = TRUE;
|
|
2888 curbuf->b_p_ar = -1; /* no local 'autoread' value */
|
|
2889 check_buf_options(curbuf);
|
|
2890 check_win_options(curwin);
|
|
2891 check_options();
|
|
2892
|
|
2893 /* Must be before option_expand(), because that one needs vim_isIDc() */
|
|
2894 didset_options();
|
|
2895
|
227
|
2896 #ifdef FEAT_SYN_HL
|
|
2897 /* Use the current chartab for the generic chartab. */
|
|
2898 init_spell_chartab();
|
|
2899 #endif
|
|
2900
|
7
|
2901 #ifdef FEAT_LINEBREAK
|
|
2902 /*
|
|
2903 * initialize the table for 'breakat'.
|
|
2904 */
|
|
2905 fill_breakat_flags();
|
|
2906 #endif
|
|
2907
|
|
2908 /*
|
|
2909 * Expand environment variables and things like "~" for the defaults.
|
|
2910 * If option_expand() returns non-NULL the variable is expanded. This can
|
|
2911 * only happen for non-indirect options.
|
|
2912 * Also set the default to the expanded value, so ":set" does not list
|
|
2913 * them.
|
|
2914 * Don't set the P_ALLOCED flag, because we don't want to free the
|
|
2915 * default.
|
|
2916 */
|
|
2917 for (opt_idx = 0; !istermoption(&options[opt_idx]); opt_idx++)
|
|
2918 {
|
|
2919 if ((options[opt_idx].flags & P_GETTEXT)
|
|
2920 && options[opt_idx].var != NULL)
|
|
2921 p = (char_u *)_(*(char **)options[opt_idx].var);
|
|
2922 else
|
|
2923 p = option_expand(opt_idx, NULL);
|
|
2924 if (p != NULL && (p = vim_strsave(p)) != NULL)
|
|
2925 {
|
|
2926 *(char_u **)options[opt_idx].var = p;
|
|
2927 /* VIMEXP
|
|
2928 * Defaults for all expanded options are currently the same for Vi
|
|
2929 * and Vim. When this changes, add some code here! Also need to
|
|
2930 * split P_DEF_ALLOCED in two.
|
|
2931 */
|
|
2932 if (options[opt_idx].flags & P_DEF_ALLOCED)
|
|
2933 vim_free(options[opt_idx].def_val[VI_DEFAULT]);
|
|
2934 options[opt_idx].def_val[VI_DEFAULT] = p;
|
|
2935 options[opt_idx].flags |= P_DEF_ALLOCED;
|
|
2936 }
|
|
2937 }
|
|
2938
|
|
2939 /* Initialize the highlight_attr[] table. */
|
|
2940 highlight_changed();
|
|
2941
|
|
2942 save_file_ff(curbuf); /* Buffer is unchanged */
|
|
2943
|
|
2944 /* Parse default for 'wildmode' */
|
|
2945 check_opt_wim();
|
|
2946
|
|
2947 #if defined(FEAT_ARABIC)
|
|
2948 /* Detect use of mlterm.
|
|
2949 * Mlterm is a terminal emulator akin to xterm that has some special
|
|
2950 * abilities (bidi namely).
|
|
2951 * NOTE: mlterm's author is being asked to 'set' a variable
|
|
2952 * instead of an environment variable due to inheritance.
|
|
2953 */
|
|
2954 if (mch_getenv((char_u *)"MLTERM") != NULL)
|
|
2955 set_option_value((char_u *)"tbidi", 1L, NULL, 0);
|
|
2956 #endif
|
|
2957
|
|
2958 #if defined(FEAT_WINDOWS) || defined(FEAT_FOLDING)
|
|
2959 /* Parse default for 'fillchars'. */
|
|
2960 (void)set_chars_option(&p_fcs);
|
|
2961 #endif
|
|
2962
|
|
2963 #ifdef FEAT_CLIPBOARD
|
|
2964 /* Parse default for 'clipboard' */
|
|
2965 (void)check_clipboard_option();
|
|
2966 #endif
|
|
2967
|
|
2968 #ifdef FEAT_MBYTE
|
|
2969 # if defined(WIN3264) && defined(FEAT_GETTEXT)
|
|
2970 /*
|
|
2971 * If $LANG isn't set, try to get a good value for it. This makes the
|
|
2972 * right language be used automatically. Don't do this for English.
|
|
2973 */
|
|
2974 if (mch_getenv((char_u *)"LANG") == NULL)
|
|
2975 {
|
|
2976 char buf[20];
|
|
2977
|
|
2978 /* Could use LOCALE_SISO639LANGNAME, but it's not in Win95.
|
|
2979 * LOCALE_SABBREVLANGNAME gives us three letters, like "enu", we use
|
|
2980 * only the first two. */
|
|
2981 n = GetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_SABBREVLANGNAME,
|
|
2982 (LPTSTR)buf, 20);
|
|
2983 if (n >= 2 && STRNICMP(buf, "en", 2) != 0)
|
|
2984 {
|
|
2985 /* There are a few exceptions (probably more) */
|
|
2986 if (STRNICMP(buf, "cht", 3) == 0 || STRNICMP(buf, "zht", 3) == 0)
|
|
2987 STRCPY(buf, "zh_TW");
|
|
2988 else if (STRNICMP(buf, "chs", 3) == 0
|
|
2989 || STRNICMP(buf, "zhc", 3) == 0)
|
|
2990 STRCPY(buf, "zh_CN");
|
|
2991 else if (STRNICMP(buf, "jp", 2) == 0)
|
|
2992 STRCPY(buf, "ja");
|
|
2993 else
|
|
2994 buf[2] = NUL; /* truncate to two-letter code */
|
|
2995 vim_setenv("LANG", buf);
|
|
2996 }
|
|
2997 }
|
168
|
2998 # else
|
|
2999 # ifdef MACOS
|
|
3000 if (mch_getenv((char_u *)"LANG") == NULL)
|
|
3001 {
|
|
3002 char buf[20];
|
|
3003 if (LocaleRefGetPartString(NULL,
|
|
3004 kLocaleLanguageMask | kLocaleLanguageVariantMask |
|
|
3005 kLocaleRegionMask | kLocaleRegionVariantMask,
|
|
3006 sizeof buf, buf) == noErr && *buf)
|
|
3007 {
|
501
|
3008 vim_setenv((char_u *)"LANG", (char_u *)buf);
|
168
|
3009 # ifdef HAVE_LOCALE_H
|
|
3010 setlocale(LC_ALL, "");
|
|
3011 # endif
|
|
3012 }
|
|
3013 }
|
|
3014 # endif
|
7
|
3015 # endif
|
|
3016
|
|
3017 /* enc_locale() will try to find the encoding of the current locale. */
|
|
3018 p = enc_locale();
|
|
3019 if (p != NULL)
|
|
3020 {
|
|
3021 char_u *save_enc;
|
|
3022
|
|
3023 /* Try setting 'encoding' and check if the value is valid.
|
|
3024 * If not, go back to the default "latin1". */
|
|
3025 save_enc = p_enc;
|
|
3026 p_enc = p;
|
|
3027 if (mb_init() == NULL)
|
|
3028 {
|
|
3029 opt_idx = findoption((char_u *)"encoding");
|
|
3030 options[opt_idx].def_val[VI_DEFAULT] = p_enc;
|
|
3031 options[opt_idx].flags |= P_DEF_ALLOCED;
|
|
3032
|
24
|
3033 #if defined(MSDOS) || defined(MSWIN) || defined(OS2) || defined(MACOS) \
|
|
3034 || defined(VMS)
|
|
3035 if (STRCMP(p_enc, "latin1") == 0
|
|
3036 # ifdef FEAT_MBYTE
|
|
3037 || enc_utf8
|
|
3038 # endif
|
|
3039 )
|
|
3040 {
|
|
3041 /* Adjust the default for 'isprint' to match latin1. */
|
|
3042 set_string_option_direct((char_u *)"isp", -1,
|
|
3043 (char_u *)"@,161-255", OPT_FREE);
|
|
3044 (void)init_chartab();
|
|
3045 }
|
|
3046 #endif
|
|
3047
|
7
|
3048 # if defined(WIN3264) && !defined(FEAT_GUI)
|
|
3049 /* Win32 console: When GetACP() returns a different value from
|
|
3050 * GetConsoleCP() set 'termencoding'. */
|
|
3051 if (GetACP() != GetConsoleCP())
|
|
3052 {
|
|
3053 char buf[50];
|
|
3054
|
|
3055 sprintf(buf, "cp%ld", (long)GetConsoleCP());
|
|
3056 p_tenc = vim_strsave((char_u *)buf);
|
|
3057 if (p_tenc != NULL)
|
|
3058 {
|
|
3059 opt_idx = findoption((char_u *)"termencoding");
|
|
3060 options[opt_idx].def_val[VI_DEFAULT] = p_tenc;
|
|
3061 options[opt_idx].flags |= P_DEF_ALLOCED;
|
|
3062 convert_setup(&input_conv, p_tenc, p_enc);
|
|
3063 convert_setup(&output_conv, p_enc, p_tenc);
|
|
3064 }
|
|
3065 else
|
|
3066 p_tenc = empty_option;
|
|
3067 }
|
|
3068 # endif
|
170
|
3069 # if defined(WIN3264) && defined(FEAT_MBYTE)
|
|
3070 /* $HOME may have characters in active code page. */
|
|
3071 init_homedir();
|
|
3072 # endif
|
7
|
3073 }
|
|
3074 else
|
|
3075 {
|
|
3076 vim_free(p_enc);
|
|
3077 p_enc = save_enc;
|
|
3078 }
|
|
3079 }
|
|
3080 #endif
|
|
3081
|
|
3082 #ifdef FEAT_MULTI_LANG
|
|
3083 /* Set the default for 'helplang'. */
|
|
3084 set_helplang_default(get_mess_lang());
|
|
3085 #endif
|
|
3086 }
|
|
3087
|
|
3088 /*
|
|
3089 * Set an option to its default value.
|
|
3090 * This does not take care of side effects!
|
|
3091 */
|
|
3092 static void
|
|
3093 set_option_default(opt_idx, opt_flags, compatible)
|
|
3094 int opt_idx;
|
|
3095 int opt_flags; /* OPT_FREE, OPT_LOCAL and/or OPT_GLOBAL */
|
|
3096 int compatible; /* use Vi default value */
|
|
3097 {
|
|
3098 char_u *varp; /* pointer to variable for current option */
|
|
3099 int dvi; /* index in def_val[] */
|
|
3100 long_u flags;
|
|
3101 int both = (opt_flags & (OPT_LOCAL | OPT_GLOBAL)) == 0;
|
|
3102
|
|
3103 varp = get_varp_scope(&(options[opt_idx]), both ? OPT_LOCAL : opt_flags);
|
|
3104 flags = options[opt_idx].flags;
|
320
|
3105 if (varp != NULL) /* skip hidden option, nothing to do for it */
|
7
|
3106 {
|
|
3107 dvi = ((flags & P_VI_DEF) || compatible) ? VI_DEFAULT : VIM_DEFAULT;
|
|
3108 if (flags & P_STRING)
|
|
3109 {
|
|
3110 /* Use set_string_option_direct() for local options to handle
|
|
3111 * freeing and allocating the value. */
|
|
3112 if (options[opt_idx].indir != PV_NONE)
|
|
3113 set_string_option_direct(NULL, opt_idx,
|
|
3114 options[opt_idx].def_val[dvi], opt_flags);
|
|
3115 else
|
|
3116 {
|
|
3117 if ((opt_flags & OPT_FREE) && (flags & P_ALLOCED))
|
|
3118 free_string_option(*(char_u **)(varp));
|
|
3119 *(char_u **)varp = options[opt_idx].def_val[dvi];
|
|
3120 options[opt_idx].flags &= ~P_ALLOCED;
|
|
3121 }
|
|
3122 }
|
|
3123 else if (flags & P_NUM)
|
|
3124 {
|
|
3125 if (varp == (char_u *)PV_SCROLL)
|
|
3126 win_comp_scroll(curwin);
|
|
3127 else
|
|
3128 {
|
|
3129 *(long *)varp = (long)options[opt_idx].def_val[dvi];
|
|
3130 /* May also set global value for local option. */
|
|
3131 if (both)
|
|
3132 *(long *)get_varp_scope(&(options[opt_idx]), OPT_GLOBAL) =
|
|
3133 *(long *)varp;
|
|
3134 }
|
|
3135 }
|
|
3136 else /* P_BOOL */
|
|
3137 {
|
|
3138 /* the cast to long is required for Manx C */
|
|
3139 *(int *)varp = (int)(long)options[opt_idx].def_val[dvi];
|
|
3140 /* May also set global value for local option. */
|
|
3141 if (both)
|
|
3142 *(int *)get_varp_scope(&(options[opt_idx]), OPT_GLOBAL) =
|
|
3143 *(int *)varp;
|
|
3144 }
|
|
3145 }
|
|
3146
|
|
3147 #ifdef FEAT_EVAL
|
|
3148 /* Remember where the option was set. */
|
|
3149 options[opt_idx].scriptID = current_SID;
|
|
3150 #endif
|
|
3151 }
|
|
3152
|
|
3153 /*
|
|
3154 * Set all options (except terminal options) to their default value.
|
|
3155 */
|
|
3156 static void
|
|
3157 set_options_default(opt_flags)
|
|
3158 int opt_flags; /* OPT_FREE, OPT_LOCAL and/or OPT_GLOBAL */
|
|
3159 {
|
|
3160 int i;
|
|
3161 #ifdef FEAT_WINDOWS
|
|
3162 win_T *wp;
|
|
3163 #endif
|
|
3164
|
|
3165 for (i = 0; !istermoption(&options[i]); i++)
|
|
3166 if (!(options[i].flags & P_NODEFAULT))
|
|
3167 set_option_default(i, opt_flags, p_cp);
|
|
3168
|
|
3169 #ifdef FEAT_WINDOWS
|
|
3170 /* The 'scroll' option must be computed for all windows. */
|
|
3171 for (wp = firstwin; wp != NULL; wp = wp->w_next)
|
|
3172 win_comp_scroll(wp);
|
|
3173 #else
|
|
3174 win_comp_scroll(curwin);
|
|
3175 #endif
|
|
3176 }
|
|
3177
|
|
3178 /*
|
|
3179 * Set the Vi-default value of a string option.
|
|
3180 * Used for 'sh', 'backupskip' and 'term'.
|
|
3181 */
|
|
3182 void
|
|
3183 set_string_default(name, val)
|
|
3184 char *name;
|
|
3185 char_u *val;
|
|
3186 {
|
|
3187 char_u *p;
|
|
3188 int opt_idx;
|
|
3189
|
|
3190 p = vim_strsave(val);
|
|
3191 if (p != NULL) /* we don't want a NULL */
|
|
3192 {
|
|
3193 opt_idx = findoption((char_u *)name);
|
|
3194 if (options[opt_idx].flags & P_DEF_ALLOCED)
|
|
3195 vim_free(options[opt_idx].def_val[VI_DEFAULT]);
|
|
3196 options[opt_idx].def_val[VI_DEFAULT] = p;
|
|
3197 options[opt_idx].flags |= P_DEF_ALLOCED;
|
|
3198 }
|
|
3199 }
|
|
3200
|
|
3201 /*
|
|
3202 * Set the Vi-default value of a number option.
|
|
3203 * Used for 'lines' and 'columns'.
|
|
3204 */
|
|
3205 void
|
|
3206 set_number_default(name, val)
|
|
3207 char *name;
|
|
3208 long val;
|
|
3209 {
|
|
3210 options[findoption((char_u *)name)].def_val[VI_DEFAULT] = (char_u *)val;
|
|
3211 }
|
|
3212
|
359
|
3213 #if defined(EXITFREE) || defined(PROTO)
|
|
3214 /*
|
|
3215 * Free all options.
|
|
3216 */
|
|
3217 void
|
|
3218 free_all_options()
|
|
3219 {
|
|
3220 int i;
|
|
3221
|
|
3222 for (i = 0; !istermoption(&options[i]); i++)
|
|
3223 {
|
|
3224 if (options[i].indir == PV_NONE)
|
|
3225 {
|
|
3226 /* global option: free value and default value. */
|
|
3227 if (options[i].flags & P_ALLOCED && options[i].var != NULL)
|
|
3228 free_string_option(*(char_u **)options[i].var);
|
|
3229 if (options[i].flags & P_DEF_ALLOCED)
|
|
3230 free_string_option(options[i].def_val[VI_DEFAULT]);
|
|
3231 }
|
|
3232 else if (options[i].var != VAR_WIN
|
|
3233 && (options[i].flags & P_STRING))
|
|
3234 /* buffer-local option: free global value */
|
|
3235 free_string_option(*(char_u **)options[i].var);
|
|
3236 }
|
|
3237 }
|
|
3238 #endif
|
|
3239
|
|
3240
|
7
|
3241 /*
|
|
3242 * Initialize the options, part two: After getting Rows and Columns and
|
|
3243 * setting 'term'.
|
|
3244 */
|
|
3245 void
|
|
3246 set_init_2()
|
|
3247 {
|
164
|
3248 int idx;
|
|
3249
|
7
|
3250 /*
|
|
3251 * 'scroll' defaults to half the window height. Note that this default is
|
|
3252 * wrong when the window height changes.
|
|
3253 */
|
164
|
3254 set_number_default("scroll", (long_u)Rows >> 1);
|
168
|
3255 idx = findoption((char_u *)"scroll");
|
|
3256 if (!(options[idx].flags & P_WAS_SET))
|
|
3257 set_option_default(idx, OPT_LOCAL, p_cp);
|
7
|
3258 comp_col();
|
|
3259
|
164
|
3260 /*
|
|
3261 * 'window' is only for backwards compatibility with Vi.
|
|
3262 * Default is Rows - 1.
|
|
3263 */
|
|
3264 idx = findoption((char_u *)"wi");
|
|
3265 if (!(options[idx].flags & P_WAS_SET))
|
|
3266 p_window = Rows - 1;
|
|
3267 set_number_default("window", Rows - 1);
|
|
3268
|
7
|
3269 #if !((defined(MSDOS) || defined(OS2) || defined(WIN3264)) && !defined(FEAT_GUI))
|
|
3270 {
|
500
|
3271 char_u *p;
|
|
3272
|
7
|
3273 /*
|
|
3274 * If 'background' wasn't set by the user, try guessing the value,
|
|
3275 * depending on the terminal name. Only need to check for terminals
|
173
|
3276 * with a dark background, that can handle color. Recognized are:
|
|
3277 * "linux" Linux console
|
|
3278 * "screen.linux" Linux console with screen
|
179
|
3279 * "cygwin" Cygwin shell
|
534
|
3280 * "putty" Putty program
|
500
|
3281 * We also check the COLORFGBG environment variable, which is set by
|
|
3282 * rxvt and derivatives. This variable contains either two or three
|
|
3283 * values separated by semicolons; we want the last value in either
|
|
3284 * case. If this value is 0-6 or 8, our background is dark.
|
7
|
3285 */
|
164
|
3286 idx = findoption((char_u *)"bg");
|
173
|
3287 if (!(options[idx].flags & P_WAS_SET)
|
|
3288 && (STRCMP(T_NAME, "linux") == 0
|
179
|
3289 || STRCMP(T_NAME, "screen.linux") == 0
|
500
|
3290 || STRCMP(T_NAME, "cygwin") == 0
|
534
|
3291 || STRCMP(T_NAME, "putty") == 0
|
510
|
3292 || ((p = mch_getenv((char_u *)"COLORFGBG")) != NULL
|
500
|
3293 && (p = vim_strrchr(p, ';')) != NULL
|
|
3294 && ((p[1] >= '0' && p[1] <= '6') || p[1] == '8')
|
|
3295 && p[2] == NUL)))
|
164
|
3296 {
|
|
3297 set_string_option_direct(NULL, idx, (char_u *)"dark", OPT_FREE);
|
500
|
3298 /* don't mark it as set, when starting the GUI it may be
|
|
3299 * changed again */
|
164
|
3300 options[idx].flags &= ~P_WAS_SET;
|
7
|
3301 }
|
|
3302 }
|
|
3303 #endif
|
440
|
3304
|
|
3305 #ifdef CURSOR_SHAPE
|
|
3306 parse_shape_opt(SHAPE_CURSOR); /* set cursor shapes from 'guicursor' */
|
|
3307 #endif
|
|
3308 #ifdef FEAT_MOUSESHAPE
|
|
3309 parse_shape_opt(SHAPE_MOUSE); /* set mouse shapes from 'mouseshape' */
|
|
3310 #endif
|
|
3311 #ifdef FEAT_PRINTER
|
|
3312 (void)parse_printoptions(); /* parse 'printoptions' default value */
|
|
3313 #endif
|
7
|
3314 }
|
|
3315
|
|
3316 /*
|
|
3317 * Initialize the options, part three: After reading the .vimrc
|
|
3318 */
|
|
3319 void
|
|
3320 set_init_3()
|
|
3321 {
|
|
3322 #if defined(UNIX) || defined(OS2) || defined(WIN3264)
|
|
3323 /*
|
|
3324 * Set 'shellpipe' and 'shellredir', depending on the 'shell' option.
|
|
3325 * This is done after other initializations, where 'shell' might have been
|
|
3326 * set, but only if they have not been set before.
|
|
3327 */
|
|
3328 char_u *p;
|
|
3329 int idx_srr;
|
|
3330 int do_srr;
|
|
3331 #ifdef FEAT_QUICKFIX
|
|
3332 int idx_sp;
|
|
3333 int do_sp;
|
|
3334 #endif
|
|
3335
|
|
3336 idx_srr = findoption((char_u *)"srr");
|
|
3337 do_srr = !(options[idx_srr].flags & P_WAS_SET);
|
|
3338 #ifdef FEAT_QUICKFIX
|
|
3339 idx_sp = findoption((char_u *)"sp");
|
|
3340 do_sp = !(options[idx_sp].flags & P_WAS_SET);
|
|
3341 #endif
|
|
3342
|
|
3343 /*
|
|
3344 * Isolate the name of the shell:
|
|
3345 * - Skip beyond any path. E.g., "/usr/bin/csh -f" -> "csh -f".
|
|
3346 * - Remove any argument. E.g., "csh -f" -> "csh".
|
|
3347 */
|
|
3348 p = gettail(p_sh);
|
|
3349 p = vim_strnsave(p, (int)(skiptowhite(p) - p));
|
|
3350 if (p != NULL)
|
|
3351 {
|
|
3352 /*
|
|
3353 * Default for p_sp is "| tee", for p_srr is ">".
|
|
3354 * For known shells it is changed here to include stderr.
|
|
3355 */
|
|
3356 if ( fnamecmp(p, "csh") == 0
|
|
3357 || fnamecmp(p, "tcsh") == 0
|
|
3358 # if defined(OS2) || defined(WIN3264) /* also check with .exe extension */
|
|
3359 || fnamecmp(p, "csh.exe") == 0
|
|
3360 || fnamecmp(p, "tcsh.exe") == 0
|
|
3361 # endif
|
|
3362 )
|
|
3363 {
|
|
3364 #if defined(FEAT_QUICKFIX)
|
|
3365 if (do_sp)
|
|
3366 {
|
|
3367 # ifdef WIN3264
|
|
3368 p_sp = (char_u *)">&";
|
|
3369 # else
|
|
3370 p_sp = (char_u *)"|& tee";
|
|
3371 # endif
|
|
3372 options[idx_sp].def_val[VI_DEFAULT] = p_sp;
|
|
3373 }
|
|
3374 #endif
|
|
3375 if (do_srr)
|
|
3376 {
|
|
3377 p_srr = (char_u *)">&";
|
|
3378 options[idx_srr].def_val[VI_DEFAULT] = p_srr;
|
|
3379 }
|
|
3380 }
|
|
3381 else
|
|
3382 # ifndef OS2 /* Always use bourne shell style redirection if we reach this */
|
|
3383 if ( fnamecmp(p, "sh") == 0
|
|
3384 || fnamecmp(p, "ksh") == 0
|
|
3385 || fnamecmp(p, "zsh") == 0
|
|
3386 || fnamecmp(p, "bash") == 0
|
|
3387 # ifdef WIN3264
|
|
3388 || fnamecmp(p, "cmd") == 0
|
|
3389 || fnamecmp(p, "sh.exe") == 0
|
|
3390 || fnamecmp(p, "ksh.exe") == 0
|
|
3391 || fnamecmp(p, "zsh.exe") == 0
|
|
3392 || fnamecmp(p, "bash.exe") == 0
|
|
3393 || fnamecmp(p, "cmd.exe") == 0
|
|
3394 # endif
|
|
3395 )
|
|
3396 # endif
|
|
3397 {
|
|
3398 #if defined(FEAT_QUICKFIX)
|
|
3399 if (do_sp)
|
|
3400 {
|
|
3401 # ifdef WIN3264
|
|
3402 p_sp = (char_u *)">%s 2>&1";
|
|
3403 # else
|
|
3404 p_sp = (char_u *)"2>&1| tee";
|
|
3405 # endif
|
|
3406 options[idx_sp].def_val[VI_DEFAULT] = p_sp;
|
|
3407 }
|
|
3408 #endif
|
|
3409 if (do_srr)
|
|
3410 {
|
|
3411 p_srr = (char_u *)">%s 2>&1";
|
|
3412 options[idx_srr].def_val[VI_DEFAULT] = p_srr;
|
|
3413 }
|
|
3414 }
|
|
3415 vim_free(p);
|
|
3416 }
|
|
3417 #endif
|
|
3418
|
|
3419 #if defined(MSDOS) || defined(WIN3264) || defined(OS2)
|
|
3420 /*
|
|
3421 * Set 'shellcmdflag and 'shellquote' depending on the 'shell' option.
|
|
3422 * This is done after other initializations, where 'shell' might have been
|
|
3423 * set, but only if they have not been set before. Default for p_shcf is
|
|
3424 * "/c", for p_shq is "". For "sh" like shells it is changed here to
|
|
3425 * "-c" and "\"", but not for DJGPP, because it starts the shell without
|
|
3426 * command.com. And for Win32 we need to set p_sxq instead.
|
|
3427 */
|
10
|
3428 if (strstr((char *)gettail(p_sh), "sh") != NULL)
|
7
|
3429 {
|
|
3430 int idx3;
|
|
3431
|
|
3432 idx3 = findoption((char_u *)"shcf");
|
|
3433 if (!(options[idx3].flags & P_WAS_SET))
|
|
3434 {
|
|
3435 p_shcf = (char_u *)"-c";
|
|
3436 options[idx3].def_val[VI_DEFAULT] = p_shcf;
|
|
3437 }
|
|
3438
|
|
3439 # ifndef DJGPP
|
|
3440 # ifdef WIN3264
|
|
3441 /* Somehow Win32 requires the quotes around the redirection too */
|
|
3442 idx3 = findoption((char_u *)"sxq");
|
|
3443 if (!(options[idx3].flags & P_WAS_SET))
|
|
3444 {
|
|
3445 p_sxq = (char_u *)"\"";
|
|
3446 options[idx3].def_val[VI_DEFAULT] = p_sxq;
|
|
3447 }
|
|
3448 # else
|
|
3449 idx3 = findoption((char_u *)"shq");
|
|
3450 if (!(options[idx3].flags & P_WAS_SET))
|
|
3451 {
|
|
3452 p_shq = (char_u *)"\"";
|
|
3453 options[idx3].def_val[VI_DEFAULT] = p_shq;
|
|
3454 }
|
|
3455 # endif
|
|
3456 # endif
|
|
3457 }
|
|
3458 #endif
|
|
3459
|
|
3460 #ifdef FEAT_TITLE
|
|
3461 set_title_defaults();
|
|
3462 #endif
|
|
3463 }
|
|
3464
|
|
3465 #if defined(FEAT_MULTI_LANG) || defined(PROTO)
|
|
3466 /*
|
|
3467 * When 'helplang' is still at its default value, set it to "lang".
|
|
3468 * Only the first two characters of "lang" are used.
|
|
3469 */
|
|
3470 void
|
|
3471 set_helplang_default(lang)
|
|
3472 char_u *lang;
|
|
3473 {
|
|
3474 int idx;
|
|
3475
|
|
3476 if (lang == NULL || STRLEN(lang) < 2) /* safety check */
|
|
3477 return;
|
|
3478 idx = findoption((char_u *)"hlg");
|
|
3479 if (!(options[idx].flags & P_WAS_SET))
|
|
3480 {
|
|
3481 if (options[idx].flags & P_ALLOCED)
|
|
3482 free_string_option(p_hlg);
|
|
3483 p_hlg = vim_strsave(lang);
|
|
3484 if (p_hlg == NULL)
|
|
3485 p_hlg = empty_option;
|
|
3486 else
|
18
|
3487 {
|
|
3488 /* zh_CN becomes "cn", zh_TW becomes "tw". */
|
|
3489 if (STRNICMP(p_hlg, "zh_", 3) == 0 && STRLEN(p_hlg) >= 5)
|
|
3490 {
|
|
3491 p_hlg[0] = TOLOWER_ASC(p_hlg[3]);
|
|
3492 p_hlg[1] = TOLOWER_ASC(p_hlg[4]);
|
|
3493 }
|
7
|
3494 p_hlg[2] = NUL;
|
18
|
3495 }
|
7
|
3496 options[idx].flags |= P_ALLOCED;
|
|
3497 }
|
|
3498 }
|
|
3499 #endif
|
|
3500
|
|
3501 #ifdef FEAT_GUI
|
|
3502 static char_u *gui_bg_default __ARGS((void));
|
|
3503
|
|
3504 static char_u *
|
|
3505 gui_bg_default()
|
|
3506 {
|
|
3507 if (gui_get_lightness(gui.back_pixel) < 127)
|
|
3508 return (char_u *)"dark";
|
|
3509 return (char_u *)"light";
|
|
3510 }
|
|
3511
|
|
3512 /*
|
|
3513 * Option initializations that can only be done after opening the GUI window.
|
|
3514 */
|
|
3515 void
|
|
3516 init_gui_options()
|
|
3517 {
|
|
3518 /* Set the 'background' option according to the lightness of the
|
|
3519 * background color, unless the user has set it already. */
|
|
3520 if (!option_was_set((char_u *)"bg") && STRCMP(p_bg, gui_bg_default()) != 0)
|
|
3521 {
|
|
3522 set_option_value((char_u *)"bg", 0L, gui_bg_default(), 0);
|
|
3523 highlight_changed();
|
|
3524 }
|
|
3525 }
|
|
3526 #endif
|
|
3527
|
|
3528 #ifdef FEAT_TITLE
|
|
3529 /*
|
|
3530 * 'title' and 'icon' only default to true if they have not been set or reset
|
|
3531 * in .vimrc and we can read the old value.
|
|
3532 * When 'title' and 'icon' have been reset in .vimrc, we won't even check if
|
|
3533 * they can be reset. This reduces startup time when using X on a remote
|
|
3534 * machine.
|
|
3535 */
|
|
3536 void
|
|
3537 set_title_defaults()
|
|
3538 {
|
|
3539 int idx1;
|
|
3540 long val;
|
|
3541
|
|
3542 /*
|
|
3543 * If GUI is (going to be) used, we can always set the window title and
|
|
3544 * icon name. Saves a bit of time, because the X11 display server does
|
|
3545 * not need to be contacted.
|
|
3546 */
|
|
3547 idx1 = findoption((char_u *)"title");
|
|
3548 if (!(options[idx1].flags & P_WAS_SET))
|
|
3549 {
|
|
3550 #ifdef FEAT_GUI
|
|
3551 if (gui.starting || gui.in_use)
|
|
3552 val = TRUE;
|
|
3553 else
|
|
3554 #endif
|
|
3555 val = mch_can_restore_title();
|
|
3556 options[idx1].def_val[VI_DEFAULT] = (char_u *)val;
|
|
3557 p_title = val;
|
|
3558 }
|
|
3559 idx1 = findoption((char_u *)"icon");
|
|
3560 if (!(options[idx1].flags & P_WAS_SET))
|
|
3561 {
|
|
3562 #ifdef FEAT_GUI
|
|
3563 if (gui.starting || gui.in_use)
|
|
3564 val = TRUE;
|
|
3565 else
|
|
3566 #endif
|
|
3567 val = mch_can_restore_icon();
|
|
3568 options[idx1].def_val[VI_DEFAULT] = (char_u *)val;
|
|
3569 p_icon = val;
|
|
3570 }
|
|
3571 }
|
|
3572 #endif
|
|
3573
|
|
3574 /*
|
|
3575 * Parse 'arg' for option settings.
|
|
3576 *
|
|
3577 * 'arg' may be IObuff, but only when no errors can be present and option
|
|
3578 * does not need to be expanded with option_expand().
|
|
3579 * "opt_flags":
|
|
3580 * 0 for ":set"
|
|
3581 * OPT_GLOBAL for ":setglobal"
|
|
3582 * OPT_LOCAL for ":setlocal" and a modeline
|
|
3583 * OPT_MODELINE for a modeline
|
|
3584 *
|
|
3585 * returns FAIL if an error is detected, OK otherwise
|
|
3586 */
|
|
3587 int
|
|
3588 do_set(arg, opt_flags)
|
|
3589 char_u *arg; /* option string (may be written to!) */
|
|
3590 int opt_flags;
|
|
3591 {
|
|
3592 int opt_idx;
|
|
3593 char_u *errmsg;
|
|
3594 char_u errbuf[80];
|
|
3595 char_u *startarg;
|
|
3596 int prefix; /* 1: nothing, 0: "no", 2: "inv" in front of name */
|
|
3597 int nextchar; /* next non-white char after option name */
|
|
3598 int afterchar; /* character just after option name */
|
|
3599 int len;
|
|
3600 int i;
|
|
3601 long value;
|
|
3602 int key;
|
|
3603 long_u flags; /* flags for current option */
|
|
3604 char_u *varp = NULL; /* pointer to variable for current option */
|
|
3605 int did_show = FALSE; /* already showed one value */
|
|
3606 int adding; /* "opt+=arg" */
|
|
3607 int prepending; /* "opt^=arg" */
|
|
3608 int removing; /* "opt-=arg" */
|
|
3609 int cp_val = 0;
|
|
3610 char_u key_name[2];
|
|
3611
|
|
3612 if (*arg == NUL)
|
|
3613 {
|
|
3614 showoptions(0, opt_flags);
|
168
|
3615 did_show = TRUE;
|
|
3616 goto theend;
|
7
|
3617 }
|
|
3618
|
|
3619 while (*arg != NUL) /* loop to process all options */
|
|
3620 {
|
|
3621 errmsg = NULL;
|
|
3622 startarg = arg; /* remember for error message */
|
|
3623
|
36
|
3624 if (STRNCMP(arg, "all", 3) == 0 && !isalpha(arg[3])
|
|
3625 && !(opt_flags & OPT_MODELINE))
|
7
|
3626 {
|
|
3627 /*
|
|
3628 * ":set all" show all options.
|
|
3629 * ":set all&" set all options to their default value.
|
|
3630 */
|
|
3631 arg += 3;
|
|
3632 if (*arg == '&')
|
|
3633 {
|
|
3634 ++arg;
|
|
3635 /* Only for :set command set global value of local options. */
|
|
3636 set_options_default(OPT_FREE | opt_flags);
|
|
3637 }
|
|
3638 else
|
168
|
3639 {
|
7
|
3640 showoptions(1, opt_flags);
|
168
|
3641 did_show = TRUE;
|
|
3642 }
|
7
|
3643 }
|
36
|
3644 else if (STRNCMP(arg, "termcap", 7) == 0 && !(opt_flags & OPT_MODELINE))
|
7
|
3645 {
|
|
3646 showoptions(2, opt_flags);
|
|
3647 show_termcodes();
|
168
|
3648 did_show = TRUE;
|
7
|
3649 arg += 7;
|
|
3650 }
|
|
3651 else
|
|
3652 {
|
|
3653 prefix = 1;
|
|
3654 if (STRNCMP(arg, "no", 2) == 0)
|
|
3655 {
|
|
3656 prefix = 0;
|
|
3657 arg += 2;
|
|
3658 }
|
|
3659 else if (STRNCMP(arg, "inv", 3) == 0)
|
|
3660 {
|
|
3661 prefix = 2;
|
|
3662 arg += 3;
|
|
3663 }
|
|
3664
|
|
3665 /* find end of name */
|
|
3666 key = 0;
|
|
3667 if (*arg == '<')
|
|
3668 {
|
|
3669 nextchar = 0;
|
|
3670 opt_idx = -1;
|
|
3671 /* look out for <t_>;> */
|
|
3672 if (arg[1] == 't' && arg[2] == '_' && arg[3] && arg[4])
|
|
3673 len = 5;
|
|
3674 else
|
|
3675 {
|
|
3676 len = 1;
|
|
3677 while (arg[len] != NUL && arg[len] != '>')
|
|
3678 ++len;
|
|
3679 }
|
|
3680 if (arg[len] != '>')
|
|
3681 {
|
|
3682 errmsg = e_invarg;
|
|
3683 goto skip;
|
|
3684 }
|
|
3685 arg[len] = NUL; /* put NUL after name */
|
|
3686 if (arg[1] == 't' && arg[2] == '_') /* could be term code */
|
|
3687 opt_idx = findoption(arg + 1);
|
|
3688 arg[len++] = '>'; /* restore '>' */
|
|
3689 if (opt_idx == -1)
|
|
3690 key = find_key_option(arg + 1);
|
|
3691 }
|
|
3692 else
|
|
3693 {
|
|
3694 len = 0;
|
|
3695 /*
|
|
3696 * The two characters after "t_" may not be alphanumeric.
|
|
3697 */
|
|
3698 if (arg[0] == 't' && arg[1] == '_' && arg[2] && arg[3])
|
|
3699 len = 4;
|
|
3700 else
|
|
3701 while (ASCII_ISALNUM(arg[len]) || arg[len] == '_')
|
|
3702 ++len;
|
|
3703 nextchar = arg[len];
|
|
3704 arg[len] = NUL; /* put NUL after name */
|
|
3705 opt_idx = findoption(arg);
|
|
3706 arg[len] = nextchar; /* restore nextchar */
|
|
3707 if (opt_idx == -1)
|
|
3708 key = find_key_option(arg);
|
|
3709 }
|
|
3710
|
|
3711 /* remember character after option name */
|
|
3712 afterchar = arg[len];
|
|
3713
|
|
3714 /* skip white space, allow ":set ai ?" */
|
|
3715 while (vim_iswhite(arg[len]))
|
|
3716 ++len;
|
|
3717
|
|
3718 adding = FALSE;
|
|
3719 prepending = FALSE;
|
|
3720 removing = FALSE;
|
|
3721 if (arg[len] != NUL && arg[len + 1] == '=')
|
|
3722 {
|
|
3723 if (arg[len] == '+')
|
|
3724 {
|
|
3725 adding = TRUE; /* "+=" */
|
|
3726 ++len;
|
|
3727 }
|
|
3728 else if (arg[len] == '^')
|
|
3729 {
|
|
3730 prepending = TRUE; /* "^=" */
|
|
3731 ++len;
|
|
3732 }
|
|
3733 else if (arg[len] == '-')
|
|
3734 {
|
|
3735 removing = TRUE; /* "-=" */
|
|
3736 ++len;
|
|
3737 }
|
|
3738 }
|
|
3739 nextchar = arg[len];
|
|
3740
|
|
3741 if (opt_idx == -1 && key == 0) /* found a mismatch: skip */
|
|
3742 {
|
|
3743 errmsg = (char_u *)N_("E518: Unknown option");
|
|
3744 goto skip;
|
|
3745 }
|
|
3746
|
|
3747 if (opt_idx >= 0)
|
|
3748 {
|
|
3749 if (options[opt_idx].var == NULL) /* hidden option: skip */
|
|
3750 {
|
|
3751 /* Only give an error message when requesting the value of
|
|
3752 * a hidden option, ignore setting it. */
|
|
3753 if (vim_strchr((char_u *)"=:!&<", nextchar) == NULL
|
|
3754 && (!(options[opt_idx].flags & P_BOOL)
|
|
3755 || nextchar == '?'))
|
|
3756 errmsg = (char_u *)N_("E519: Option not supported");
|
|
3757 goto skip;
|
|
3758 }
|
|
3759
|
|
3760 flags = options[opt_idx].flags;
|
|
3761 varp = get_varp_scope(&(options[opt_idx]), opt_flags);
|
|
3762 }
|
|
3763 else
|
|
3764 {
|
|
3765 flags = P_STRING;
|
|
3766 if (key < 0)
|
|
3767 {
|
|
3768 key_name[0] = KEY2TERMCAP0(key);
|
|
3769 key_name[1] = KEY2TERMCAP1(key);
|
|
3770 }
|
|
3771 else
|
|
3772 {
|
|
3773 key_name[0] = KS_KEY;
|
|
3774 key_name[1] = (key & 0xff);
|
|
3775 }
|
|
3776 }
|
|
3777
|
|
3778 /* Disallow changing some options from modelines */
|
|
3779 if ((opt_flags & OPT_MODELINE) && (flags & P_SECURE))
|
|
3780 {
|
|
3781 errmsg = (char_u *)_("E520: Not allowed in a modeline");
|
|
3782 goto skip;
|
|
3783 }
|
|
3784
|
23
|
3785 /* Skip all options that are not window-local (used when showing
|
|
3786 * an already loaded buffer in a window). */
|
|
3787 if ((opt_flags & OPT_WINONLY)
|
|
3788 && (opt_idx < 0 || options[opt_idx].var != VAR_WIN))
|
|
3789 goto skip;
|
|
3790
|
7
|
3791 #ifdef HAVE_SANDBOX
|
|
3792 /* Disallow changing some options in the sandbox */
|
|
3793 if (sandbox > 0 && (flags & P_SECURE))
|
|
3794 {
|
|
3795 errmsg = (char_u *)_(e_sandbox);
|
|
3796 goto skip;
|
|
3797 }
|
|
3798 #endif
|
|
3799
|
|
3800 if (vim_strchr((char_u *)"?=:!&<", nextchar) != NULL)
|
|
3801 {
|
|
3802 arg += len;
|
|
3803 cp_val = p_cp;
|
|
3804 if (nextchar == '&' && arg[1] == 'v' && arg[2] == 'i')
|
|
3805 {
|
|
3806 if (arg[3] == 'm') /* "opt&vim": set to Vim default */
|
|
3807 {
|
|
3808 cp_val = FALSE;
|
|
3809 arg += 3;
|
|
3810 }
|
|
3811 else /* "opt&vi": set to Vi default */
|
|
3812 {
|
|
3813 cp_val = TRUE;
|
|
3814 arg += 2;
|
|
3815 }
|
|
3816 }
|
|
3817 if (vim_strchr((char_u *)"?!&<", nextchar) != NULL
|
|
3818 && arg[1] != NUL && !vim_iswhite(arg[1]))
|
|
3819 {
|
|
3820 errmsg = e_trailing;
|
|
3821 goto skip;
|
|
3822 }
|
|
3823 }
|
|
3824
|
|
3825 /*
|
|
3826 * allow '=' and ':' as MSDOS command.com allows only one
|
|
3827 * '=' character per "set" command line. grrr. (jw)
|
|
3828 */
|
|
3829 if (nextchar == '?'
|
|
3830 || (prefix == 1
|
|
3831 && vim_strchr((char_u *)"=:&<", nextchar) == NULL
|
|
3832 && !(flags & P_BOOL)))
|
|
3833 {
|
|
3834 /*
|
|
3835 * print value
|
|
3836 */
|
|
3837 if (did_show)
|
|
3838 msg_putchar('\n'); /* cursor below last one */
|
|
3839 else
|
|
3840 {
|
|
3841 gotocmdline(TRUE); /* cursor at status line */
|
|
3842 did_show = TRUE; /* remember that we did a line */
|
|
3843 }
|
|
3844 if (opt_idx >= 0)
|
|
3845 {
|
|
3846 showoneopt(&options[opt_idx], opt_flags);
|
|
3847 #ifdef FEAT_EVAL
|
|
3848 if (p_verbose > 0)
|
448
|
3849 last_set_msg(options[opt_idx].scriptID);
|
7
|
3850 #endif
|
|
3851 }
|
|
3852 else
|
|
3853 {
|
|
3854 char_u *p;
|
|
3855
|
|
3856 p = find_termcode(key_name);
|
|
3857 if (p == NULL)
|
|
3858 {
|
|
3859 errmsg = (char_u *)N_("E518: Unknown option");
|
|
3860 goto skip;
|
|
3861 }
|
|
3862 else
|
|
3863 (void)show_one_termcode(key_name, p, TRUE);
|
|
3864 }
|
|
3865 if (nextchar != '?'
|
|
3866 && nextchar != NUL && !vim_iswhite(afterchar))
|
|
3867 errmsg = e_trailing;
|
|
3868 }
|
|
3869 else
|
|
3870 {
|
|
3871 if (flags & P_BOOL) /* boolean */
|
|
3872 {
|
|
3873 if (nextchar == '=' || nextchar == ':')
|
|
3874 {
|
|
3875 errmsg = e_invarg;
|
|
3876 goto skip;
|
|
3877 }
|
|
3878
|
|
3879 /*
|
|
3880 * ":set opt!": invert
|
|
3881 * ":set opt&": reset to default value
|
|
3882 * ":set opt<": reset to global value
|
|
3883 */
|
|
3884 if (nextchar == '!')
|
|
3885 value = *(int *)(varp) ^ 1;
|
|
3886 else if (nextchar == '&')
|
|
3887 value = (int)(long)options[opt_idx].def_val[
|
|
3888 ((flags & P_VI_DEF) || cp_val)
|
|
3889 ? VI_DEFAULT : VIM_DEFAULT];
|
|
3890 else if (nextchar == '<')
|
|
3891 {
|
|
3892 /* For 'autoread' -1 means to use global value. */
|
|
3893 if ((int *)varp == &curbuf->b_p_ar
|
|
3894 && opt_flags == OPT_LOCAL)
|
|
3895 value = -1;
|
|
3896 else
|
|
3897 value = *(int *)get_varp_scope(&(options[opt_idx]),
|
|
3898 OPT_GLOBAL);
|
|
3899 }
|
|
3900 else
|
|
3901 {
|
|
3902 /*
|
|
3903 * ":set invopt": invert
|
|
3904 * ":set opt" or ":set noopt": set or reset
|
|
3905 */
|
|
3906 if (nextchar != NUL && !vim_iswhite(afterchar))
|
|
3907 {
|
|
3908 errmsg = e_trailing;
|
|
3909 goto skip;
|
|
3910 }
|
|
3911 if (prefix == 2) /* inv */
|
|
3912 value = *(int *)(varp) ^ 1;
|
|
3913 else
|
|
3914 value = prefix;
|
|
3915 }
|
|
3916
|
|
3917 errmsg = set_bool_option(opt_idx, varp, (int)value,
|
|
3918 opt_flags);
|
|
3919 }
|
|
3920 else /* numeric or string */
|
|
3921 {
|
|
3922 if (vim_strchr((char_u *)"=:&<", nextchar) == NULL
|
|
3923 || prefix != 1)
|
|
3924 {
|
|
3925 errmsg = e_invarg;
|
|
3926 goto skip;
|
|
3927 }
|
|
3928
|
|
3929 if (flags & P_NUM) /* numeric */
|
|
3930 {
|
|
3931 /*
|
|
3932 * Different ways to set a number option:
|
|
3933 * & set to default value
|
|
3934 * < set to global value
|
|
3935 * <xx> accept special key codes for 'wildchar'
|
|
3936 * c accept any non-digit for 'wildchar'
|
|
3937 * [-]0-9 set number
|
|
3938 * other error
|
|
3939 */
|
|
3940 ++arg;
|
|
3941 if (nextchar == '&')
|
|
3942 value = (long)options[opt_idx].def_val[
|
|
3943 ((flags & P_VI_DEF) || cp_val)
|
|
3944 ? VI_DEFAULT : VIM_DEFAULT];
|
|
3945 else if (nextchar == '<')
|
|
3946 value = *(long *)get_varp_scope(&(options[opt_idx]),
|
|
3947 OPT_GLOBAL);
|
|
3948 else if (((long *)varp == &p_wc
|
|
3949 || (long *)varp == &p_wcm)
|
|
3950 && (*arg == '<'
|
|
3951 || *arg == '^'
|
|
3952 || ((!arg[1] || vim_iswhite(arg[1]))
|
|
3953 && !VIM_ISDIGIT(*arg))))
|
|
3954 {
|
|
3955 value = string_to_key(arg);
|
|
3956 if (value == 0 && (long *)varp != &p_wcm)
|
|
3957 {
|
|
3958 errmsg = e_invarg;
|
|
3959 goto skip;
|
|
3960 }
|
|
3961 }
|
|
3962 /* allow negative numbers (for 'undolevels') */
|
|
3963 else if (*arg == '-' || VIM_ISDIGIT(*arg))
|
|
3964 {
|
|
3965 i = 0;
|
|
3966 if (*arg == '-')
|
|
3967 i = 1;
|
|
3968 #ifdef HAVE_STRTOL
|
|
3969 value = strtol((char *)arg, NULL, 0);
|
|
3970 if (arg[i] == '0' && TOLOWER_ASC(arg[i + 1]) == 'x')
|
|
3971 i += 2;
|
|
3972 #else
|
|
3973 value = atol((char *)arg);
|
|
3974 #endif
|
|
3975 while (VIM_ISDIGIT(arg[i]))
|
|
3976 ++i;
|
|
3977 if (arg[i] != NUL && !vim_iswhite(arg[i]))
|
|
3978 {
|
|
3979 errmsg = e_invarg;
|
|
3980 goto skip;
|
|
3981 }
|
|
3982 }
|
|
3983 else
|
|
3984 {
|
|
3985 errmsg = (char_u *)N_("E521: Number required after =");
|
|
3986 goto skip;
|
|
3987 }
|
|
3988
|
|
3989 if (adding)
|
|
3990 value = *(long *)varp + value;
|
|
3991 if (prepending)
|
|
3992 value = *(long *)varp * value;
|
|
3993 if (removing)
|
|
3994 value = *(long *)varp - value;
|
|
3995 errmsg = set_num_option(opt_idx, varp, value,
|
274
|
3996 errbuf, sizeof(errbuf), opt_flags);
|
7
|
3997 }
|
|
3998 else if (opt_idx >= 0) /* string */
|
|
3999 {
|
|
4000 char_u *save_arg = NULL;
|
|
4001 char_u *s = NULL;
|
|
4002 char_u *oldval; /* previous value if *varp */
|
|
4003 char_u *newval;
|
|
4004 char_u *origval;
|
|
4005 unsigned newlen;
|
|
4006 int comma;
|
|
4007 int bs;
|
|
4008 int new_value_alloced; /* new string option
|
|
4009 was allocated */
|
|
4010
|
|
4011 /* When using ":set opt=val" for a global option
|
|
4012 * with a local value the local value will be
|
|
4013 * reset, use the global value here. */
|
|
4014 if ((opt_flags & (OPT_LOCAL | OPT_GLOBAL)) == 0
|
|
4015 && (int)options[opt_idx].indir >= PV_BOTH)
|
|
4016 varp = options[opt_idx].var;
|
|
4017
|
|
4018 /* The old value is kept until we are sure that the
|
|
4019 * new value is valid. */
|
|
4020 oldval = *(char_u **)varp;
|
|
4021 if (nextchar == '&') /* set to default val */
|
|
4022 {
|
|
4023 newval = options[opt_idx].def_val[
|
|
4024 ((flags & P_VI_DEF) || cp_val)
|
|
4025 ? VI_DEFAULT : VIM_DEFAULT];
|
|
4026 if ((char_u **)varp == &p_bg)
|
|
4027 {
|
|
4028 /* guess the value of 'background' */
|
|
4029 #ifdef FEAT_GUI
|
|
4030 if (gui.in_use)
|
|
4031 newval = gui_bg_default();
|
|
4032 else
|
|
4033 #endif
|
|
4034 if (STRCMP(T_NAME, "linux") == 0)
|
|
4035 newval = (char_u *)"dark";
|
|
4036 }
|
|
4037
|
|
4038 /* expand environment variables and ~ (since the
|
|
4039 * default value was already expanded, only
|
|
4040 * required when an environment variable was set
|
|
4041 * later */
|
|
4042 if (newval == NULL)
|
|
4043 newval = empty_option;
|
|
4044 else
|
|
4045 {
|
|
4046 s = option_expand(opt_idx, newval);
|
|
4047 if (s == NULL)
|
|
4048 s = newval;
|
|
4049 newval = vim_strsave(s);
|
|
4050 }
|
|
4051 new_value_alloced = TRUE;
|
|
4052 }
|
|
4053 else if (nextchar == '<') /* set to global val */
|
|
4054 {
|
|
4055 newval = vim_strsave(*(char_u **)get_varp_scope(
|
|
4056 &(options[opt_idx]), OPT_GLOBAL));
|
|
4057 new_value_alloced = TRUE;
|
|
4058 }
|
|
4059 else
|
|
4060 {
|
|
4061 ++arg; /* jump to after the '=' or ':' */
|
|
4062
|
|
4063 /*
|
|
4064 * Set 'keywordprg' to ":help" if an empty
|
|
4065 * value was passed to :set by the user.
|
|
4066 * Misuse errbuf[] for the resulting string.
|
|
4067 */
|
|
4068 if (varp == (char_u *)&p_kp
|
|
4069 && (*arg == NUL || *arg == ' '))
|
|
4070 {
|
|
4071 STRCPY(errbuf, ":help");
|
|
4072 save_arg = arg;
|
|
4073 arg = errbuf;
|
|
4074 }
|
|
4075 /*
|
|
4076 * Convert 'whichwrap' number to string, for
|
|
4077 * backwards compatibility with Vim 3.0.
|
|
4078 * Misuse errbuf[] for the resulting string.
|
|
4079 */
|
|
4080 else if (varp == (char_u *)&p_ww
|
|
4081 && VIM_ISDIGIT(*arg))
|
|
4082 {
|
|
4083 *errbuf = NUL;
|
|
4084 i = getdigits(&arg);
|
|
4085 if (i & 1)
|
|
4086 STRCAT(errbuf, "b,");
|
|
4087 if (i & 2)
|
|
4088 STRCAT(errbuf, "s,");
|
|
4089 if (i & 4)
|
|
4090 STRCAT(errbuf, "h,l,");
|
|
4091 if (i & 8)
|
|
4092 STRCAT(errbuf, "<,>,");
|
|
4093 if (i & 16)
|
|
4094 STRCAT(errbuf, "[,],");
|
|
4095 if (*errbuf != NUL) /* remove trailing , */
|
|
4096 errbuf[STRLEN(errbuf) - 1] = NUL;
|
|
4097 save_arg = arg;
|
|
4098 arg = errbuf;
|
|
4099 }
|
|
4100 /*
|
|
4101 * Remove '>' before 'dir' and 'bdir', for
|
|
4102 * backwards compatibility with version 3.0
|
|
4103 */
|
|
4104 else if ( *arg == '>'
|
|
4105 && (varp == (char_u *)&p_dir
|
|
4106 || varp == (char_u *)&p_bdir))
|
|
4107 {
|
|
4108 ++arg;
|
|
4109 }
|
|
4110
|
|
4111 /* When setting the local value of a global
|
|
4112 * option, the old value may be the global value. */
|
|
4113 if ((int)options[opt_idx].indir >= PV_BOTH
|
|
4114 && (opt_flags & OPT_LOCAL))
|
|
4115 origval = *(char_u **)get_varp(
|
|
4116 &options[opt_idx]);
|
|
4117 else
|
|
4118 origval = oldval;
|
|
4119
|
|
4120 /*
|
|
4121 * Copy the new string into allocated memory.
|
|
4122 * Can't use set_string_option_direct(), because
|
|
4123 * we need to remove the backslashes.
|
|
4124 */
|
|
4125 /* get a bit too much */
|
|
4126 newlen = (unsigned)STRLEN(arg) + 1;
|
|
4127 if (adding || prepending || removing)
|
|
4128 newlen += (unsigned)STRLEN(origval) + 1;
|
|
4129 newval = alloc(newlen);
|
|
4130 if (newval == NULL) /* out of mem, don't change */
|
|
4131 break;
|
|
4132 s = newval;
|
|
4133
|
|
4134 /*
|
|
4135 * Copy the string, skip over escaped chars.
|
|
4136 * For MS-DOS and WIN32 backslashes before normal
|
|
4137 * file name characters are not removed, and keep
|
|
4138 * backslash at start, for "\\machine\path", but
|
|
4139 * do remove it for "\\\\machine\\path".
|
|
4140 * The reverse is found in ExpandOldSetting().
|
|
4141 */
|
|
4142 while (*arg && !vim_iswhite(*arg))
|
|
4143 {
|
|
4144 if (*arg == '\\' && arg[1] != NUL
|
|
4145 #ifdef BACKSLASH_IN_FILENAME
|
|
4146 && !((flags & P_EXPAND)
|
|
4147 && vim_isfilec(arg[1])
|
|
4148 && (arg[1] != '\\'
|
|
4149 || (s == newval
|
|
4150 && arg[2] != '\\')))
|
|
4151 #endif
|
|
4152 )
|
|
4153 ++arg; /* remove backslash */
|
|
4154 #ifdef FEAT_MBYTE
|
|
4155 if (has_mbyte
|
474
|
4156 && (i = (*mb_ptr2len)(arg)) > 1)
|
7
|
4157 {
|
|
4158 /* copy multibyte char */
|
|
4159 mch_memmove(s, arg, (size_t)i);
|
|
4160 arg += i;
|
|
4161 s += i;
|
|
4162 }
|
|
4163 else
|
|
4164 #endif
|
|
4165 *s++ = *arg++;
|
|
4166 }
|
|
4167 *s = NUL;
|
|
4168
|
|
4169 /*
|
|
4170 * Expand environment variables and ~.
|
|
4171 * Don't do it when adding without inserting a
|
|
4172 * comma.
|
|
4173 */
|
|
4174 if (!(adding || prepending || removing)
|
|
4175 || (flags & P_COMMA))
|
|
4176 {
|
|
4177 s = option_expand(opt_idx, newval);
|
|
4178 if (s != NULL)
|
|
4179 {
|
|
4180 vim_free(newval);
|
|
4181 newlen = (unsigned)STRLEN(s) + 1;
|
|
4182 if (adding || prepending || removing)
|
|
4183 newlen += (unsigned)STRLEN(origval) + 1;
|
|
4184 newval = alloc(newlen);
|
|
4185 if (newval == NULL)
|
|
4186 break;
|
|
4187 STRCPY(newval, s);
|
|
4188 }
|
|
4189 }
|
|
4190
|
|
4191 /* locate newval[] in origval[] when removing it
|
|
4192 * and when adding to avoid duplicates */
|
|
4193 i = 0; /* init for GCC */
|
|
4194 if (removing || (flags & P_NODUP))
|
|
4195 {
|
|
4196 i = (int)STRLEN(newval);
|
|
4197 bs = 0;
|
|
4198 for (s = origval; *s; ++s)
|
|
4199 {
|
|
4200 if ((!(flags & P_COMMA)
|
|
4201 || s == origval
|
|
4202 || (s[-1] == ',' && !(bs & 1)))
|
|
4203 && STRNCMP(s, newval, i) == 0
|
|
4204 && (!(flags & P_COMMA)
|
|
4205 || s[i] == ','
|
|
4206 || s[i] == NUL))
|
|
4207 break;
|
|
4208 /* Count backspaces. Only a comma with an
|
|
4209 * even number of backspaces before it is
|
|
4210 * recognized as a separator */
|
|
4211 if (s > origval && s[-1] == '\\')
|
|
4212 ++bs;
|
|
4213 else
|
|
4214 bs = 0;
|
|
4215 }
|
|
4216
|
|
4217 /* do not add if already there */
|
|
4218 if ((adding || prepending) && *s)
|
|
4219 {
|
|
4220 prepending = FALSE;
|
|
4221 adding = FALSE;
|
|
4222 STRCPY(newval, origval);
|
|
4223 }
|
|
4224 }
|
|
4225
|
|
4226 /* concatenate the two strings; add a ',' if
|
|
4227 * needed */
|
|
4228 if (adding || prepending)
|
|
4229 {
|
|
4230 comma = ((flags & P_COMMA) && *origval != NUL
|
|
4231 && *newval != NUL);
|
|
4232 if (adding)
|
|
4233 {
|
|
4234 i = (int)STRLEN(origval);
|
|
4235 mch_memmove(newval + i + comma, newval,
|
|
4236 STRLEN(newval) + 1);
|
|
4237 mch_memmove(newval, origval, (size_t)i);
|
|
4238 }
|
|
4239 else
|
|
4240 {
|
|
4241 i = (int)STRLEN(newval);
|
|
4242 mch_memmove(newval + i + comma, origval,
|
|
4243 STRLEN(origval) + 1);
|
|
4244 }
|
|
4245 if (comma)
|
|
4246 newval[i] = ',';
|
|
4247 }
|
|
4248
|
|
4249 /* Remove newval[] from origval[]. (Note: "i" has
|
|
4250 * been set above and is used here). */
|
|
4251 if (removing)
|
|
4252 {
|
|
4253 STRCPY(newval, origval);
|
|
4254 if (*s)
|
|
4255 {
|
|
4256 /* may need to remove a comma */
|
|
4257 if (flags & P_COMMA)
|
|
4258 {
|
|
4259 if (s == origval)
|
|
4260 {
|
|
4261 /* include comma after string */
|
|
4262 if (s[i] == ',')
|
|
4263 ++i;
|
|
4264 }
|
|
4265 else
|
|
4266 {
|
|
4267 /* include comma before string */
|
|
4268 --s;
|
|
4269 ++i;
|
|
4270 }
|
|
4271 }
|
|
4272 mch_memmove(newval + (s - origval), s + i,
|
|
4273 STRLEN(s + i) + 1);
|
|
4274 }
|
|
4275 }
|
|
4276
|
|
4277 if (flags & P_FLAGLIST)
|
|
4278 {
|
|
4279 /* Remove flags that appear twice. */
|
|
4280 for (s = newval; *s; ++s)
|
|
4281 if ((!(flags & P_COMMA) || *s != ',')
|
|
4282 && vim_strchr(s + 1, *s) != NULL)
|
|
4283 {
|
|
4284 STRCPY(s, s + 1);
|
|
4285 --s;
|
|
4286 }
|
|
4287 }
|
|
4288
|
|
4289 if (save_arg != NULL) /* number for 'whichwrap' */
|
|
4290 arg = save_arg;
|
|
4291 new_value_alloced = TRUE;
|
|
4292 }
|
|
4293
|
|
4294 /* Set the new value. */
|
|
4295 *(char_u **)(varp) = newval;
|
|
4296
|
|
4297 /* Handle side effects, and set the global value for
|
|
4298 * ":set" on local options. */
|
|
4299 errmsg = did_set_string_option(opt_idx, (char_u **)varp,
|
|
4300 new_value_alloced, oldval, errbuf, opt_flags);
|
|
4301
|
|
4302 /* If error detected, print the error message. */
|
|
4303 if (errmsg != NULL)
|
|
4304 goto skip;
|
|
4305 }
|
|
4306 else /* key code option */
|
|
4307 {
|
|
4308 char_u *p;
|
|
4309
|
|
4310 if (nextchar == '&')
|
|
4311 {
|
|
4312 if (add_termcap_entry(key_name, TRUE) == FAIL)
|
|
4313 errmsg = (char_u *)N_("E522: Not found in termcap");
|
|
4314 }
|
|
4315 else
|
|
4316 {
|
|
4317 ++arg; /* jump to after the '=' or ':' */
|
|
4318 for (p = arg; *p && !vim_iswhite(*p); ++p)
|
|
4319 if (*p == '\\' && p[1] != NUL)
|
|
4320 ++p;
|
|
4321 nextchar = *p;
|
|
4322 *p = NUL;
|
|
4323 add_termcode(key_name, arg, FALSE);
|
|
4324 *p = nextchar;
|
|
4325 }
|
|
4326 if (full_screen)
|
|
4327 ttest(FALSE);
|
|
4328 redraw_all_later(CLEAR);
|
|
4329 }
|
|
4330 }
|
|
4331 if (opt_idx >= 0)
|
|
4332 options[opt_idx].flags |= P_WAS_SET;
|
|
4333 }
|
|
4334
|
|
4335 skip:
|
|
4336 /*
|
|
4337 * Advance to next argument.
|
|
4338 * - skip until a blank found, taking care of backslashes
|
|
4339 * - skip blanks
|
|
4340 * - skip one "=val" argument (for hidden options ":set gfn =xx")
|
|
4341 */
|
|
4342 for (i = 0; i < 2 ; ++i)
|
|
4343 {
|
|
4344 while (*arg != NUL && !vim_iswhite(*arg))
|
|
4345 if (*arg++ == '\\' && *arg != NUL)
|
|
4346 ++arg;
|
|
4347 arg = skipwhite(arg);
|
|
4348 if (*arg != '=')
|
|
4349 break;
|
|
4350 }
|
|
4351 }
|
|
4352
|
|
4353 if (errmsg != NULL)
|
|
4354 {
|
419
|
4355 vim_strncpy(IObuff, (char_u *)_(errmsg), IOSIZE - 1);
|
7
|
4356 i = STRLEN(IObuff) + 2;
|
|
4357 if (i + (arg - startarg) < IOSIZE)
|
|
4358 {
|
|
4359 /* append the argument with the error */
|
|
4360 STRCAT(IObuff, ": ");
|
|
4361 mch_memmove(IObuff + i, startarg, (arg - startarg));
|
|
4362 IObuff[i + (arg - startarg)] = NUL;
|
|
4363 }
|
|
4364 /* make sure all characters are printable */
|
|
4365 trans_characters(IObuff, IOSIZE);
|
|
4366
|
|
4367 ++no_wait_return; /* wait_return done later */
|
|
4368 emsg(IObuff); /* show error highlighted */
|
|
4369 --no_wait_return;
|
|
4370
|
|
4371 return FAIL;
|
|
4372 }
|
|
4373
|
|
4374 arg = skipwhite(arg);
|
|
4375 }
|
|
4376
|
168
|
4377 theend:
|
|
4378 if (silent_mode && did_show)
|
|
4379 {
|
|
4380 /* After displaying option values in silent mode. */
|
|
4381 silent_mode = FALSE;
|
|
4382 info_message = TRUE; /* use mch_msg(), not mch_errmsg() */
|
|
4383 msg_putchar('\n');
|
|
4384 cursor_on(); /* msg_start() switches it off */
|
|
4385 out_flush();
|
|
4386 silent_mode = TRUE;
|
|
4387 info_message = FALSE; /* use mch_msg(), not mch_errmsg() */
|
|
4388 }
|
|
4389
|
7
|
4390 return OK;
|
|
4391 }
|
|
4392
|
|
4393 static char_u *
|
|
4394 illegal_char(errbuf, c)
|
|
4395 char_u *errbuf;
|
|
4396 int c;
|
|
4397 {
|
|
4398 if (errbuf == NULL)
|
|
4399 return (char_u *)"";
|
|
4400 sprintf((char *)errbuf, _("E539: Illegal character <%s>"),
|
274
|
4401 (char *)transchar(c));
|
7
|
4402 return errbuf;
|
|
4403 }
|
|
4404
|
|
4405 /*
|
|
4406 * Convert a key name or string into a key value.
|
|
4407 * Used for 'wildchar' and 'cedit' options.
|
|
4408 */
|
|
4409 static int
|
|
4410 string_to_key(arg)
|
|
4411 char_u *arg;
|
|
4412 {
|
|
4413 if (*arg == '<')
|
|
4414 return find_key_option(arg + 1);
|
|
4415 if (*arg == '^')
|
|
4416 return Ctrl_chr(arg[1]);
|
|
4417 return *arg;
|
|
4418 }
|
|
4419
|
|
4420 #ifdef FEAT_CMDWIN
|
|
4421 /*
|
|
4422 * Check value of 'cedit' and set cedit_key.
|
|
4423 * Returns NULL if value is OK, error message otherwise.
|
|
4424 */
|
|
4425 static char_u *
|
|
4426 check_cedit()
|
|
4427 {
|
|
4428 int n;
|
|
4429
|
|
4430 if (*p_cedit == NUL)
|
|
4431 cedit_key = -1;
|
|
4432 else
|
|
4433 {
|
|
4434 n = string_to_key(p_cedit);
|
|
4435 if (vim_isprintc(n))
|
|
4436 return e_invarg;
|
|
4437 cedit_key = n;
|
|
4438 }
|
|
4439 return NULL;
|
|
4440 }
|
|
4441 #endif
|
|
4442
|
|
4443 #ifdef FEAT_TITLE
|
|
4444 /*
|
|
4445 * When changing 'title', 'titlestring', 'icon' or 'iconstring', call
|
|
4446 * maketitle() to create and display it.
|
|
4447 * When switching the title or icon off, call mch_restore_title() to get
|
|
4448 * the old value back.
|
|
4449 */
|
|
4450 static void
|
|
4451 did_set_title(icon)
|
|
4452 int icon; /* Did set icon instead of title */
|
|
4453 {
|
|
4454 if (starting != NO_SCREEN
|
|
4455 #ifdef FEAT_GUI
|
|
4456 && !gui.starting
|
|
4457 #endif
|
|
4458 )
|
|
4459 {
|
|
4460 maketitle();
|
|
4461 if (icon)
|
|
4462 {
|
|
4463 if (!p_icon)
|
|
4464 mch_restore_title(2);
|
|
4465 }
|
|
4466 else
|
|
4467 {
|
|
4468 if (!p_title)
|
|
4469 mch_restore_title(1);
|
|
4470 }
|
|
4471 }
|
|
4472 }
|
|
4473 #endif
|
|
4474
|
|
4475 /*
|
|
4476 * set_options_bin - called when 'bin' changes value.
|
|
4477 */
|
|
4478 void
|
|
4479 set_options_bin(oldval, newval, opt_flags)
|
|
4480 int oldval;
|
|
4481 int newval;
|
|
4482 int opt_flags; /* OPT_LOCAL and/or OPT_GLOBAL */
|
|
4483 {
|
|
4484 /*
|
|
4485 * The option values that are changed when 'bin' changes are
|
|
4486 * copied when 'bin is set and restored when 'bin' is reset.
|
|
4487 */
|
|
4488 if (newval)
|
|
4489 {
|
|
4490 if (!oldval) /* switched on */
|
|
4491 {
|
|
4492 if (!(opt_flags & OPT_GLOBAL))
|
|
4493 {
|
|
4494 curbuf->b_p_tw_nobin = curbuf->b_p_tw;
|
|
4495 curbuf->b_p_wm_nobin = curbuf->b_p_wm;
|
|
4496 curbuf->b_p_ml_nobin = curbuf->b_p_ml;
|
|
4497 curbuf->b_p_et_nobin = curbuf->b_p_et;
|
|
4498 }
|
|
4499 if (!(opt_flags & OPT_LOCAL))
|
|
4500 {
|
|
4501 p_tw_nobin = p_tw;
|
|
4502 p_wm_nobin = p_wm;
|
|
4503 p_ml_nobin = p_ml;
|
|
4504 p_et_nobin = p_et;
|
|
4505 }
|
|
4506 }
|
|
4507
|
|
4508 if (!(opt_flags & OPT_GLOBAL))
|
|
4509 {
|
|
4510 curbuf->b_p_tw = 0; /* no automatic line wrap */
|
|
4511 curbuf->b_p_wm = 0; /* no automatic line wrap */
|
|
4512 curbuf->b_p_ml = 0; /* no modelines */
|
|
4513 curbuf->b_p_et = 0; /* no expandtab */
|
|
4514 }
|
|
4515 if (!(opt_flags & OPT_LOCAL))
|
|
4516 {
|
|
4517 p_tw = 0;
|
|
4518 p_wm = 0;
|
|
4519 p_ml = FALSE;
|
|
4520 p_et = FALSE;
|
|
4521 p_bin = TRUE; /* needed when called for the "-b" argument */
|
|
4522 }
|
|
4523 }
|
|
4524 else if (oldval) /* switched off */
|
|
4525 {
|
|
4526 if (!(opt_flags & OPT_GLOBAL))
|
|
4527 {
|
|
4528 curbuf->b_p_tw = curbuf->b_p_tw_nobin;
|
|
4529 curbuf->b_p_wm = curbuf->b_p_wm_nobin;
|
|
4530 curbuf->b_p_ml = curbuf->b_p_ml_nobin;
|
|
4531 curbuf->b_p_et = curbuf->b_p_et_nobin;
|
|
4532 }
|
|
4533 if (!(opt_flags & OPT_LOCAL))
|
|
4534 {
|
|
4535 p_tw = p_tw_nobin;
|
|
4536 p_wm = p_wm_nobin;
|
|
4537 p_ml = p_ml_nobin;
|
|
4538 p_et = p_et_nobin;
|
|
4539 }
|
|
4540 }
|
|
4541 }
|
|
4542
|
|
4543 #ifdef FEAT_VIMINFO
|
|
4544 /*
|
|
4545 * Find the parameter represented by the given character (eg ', :, ", or /),
|
|
4546 * and return its associated value in the 'viminfo' string.
|
|
4547 * Only works for number parameters, not for 'r' or 'n'.
|
23
|
4548 * If the parameter is not specified in the string or there is no following
|
|
4549 * number, return -1.
|
7
|
4550 */
|
|
4551 int
|
|
4552 get_viminfo_parameter(type)
|
|
4553 int type;
|
|
4554 {
|
|
4555 char_u *p;
|
|
4556
|
|
4557 p = find_viminfo_parameter(type);
|
|
4558 if (p != NULL && VIM_ISDIGIT(*p))
|
|
4559 return atoi((char *)p);
|
|
4560 return -1;
|
|
4561 }
|
|
4562
|
|
4563 /*
|
|
4564 * Find the parameter represented by the given character (eg ''', ':', '"', or
|
|
4565 * '/') in the 'viminfo' option and return a pointer to the string after it.
|
|
4566 * Return NULL if the parameter is not specified in the string.
|
|
4567 */
|
|
4568 char_u *
|
|
4569 find_viminfo_parameter(type)
|
|
4570 int type;
|
|
4571 {
|
|
4572 char_u *p;
|
|
4573
|
|
4574 for (p = p_viminfo; *p; ++p)
|
|
4575 {
|
|
4576 if (*p == type)
|
|
4577 return p + 1;
|
|
4578 if (*p == 'n') /* 'n' is always the last one */
|
|
4579 break;
|
|
4580 p = vim_strchr(p, ','); /* skip until next ',' */
|
|
4581 if (p == NULL) /* hit the end without finding parameter */
|
|
4582 break;
|
|
4583 }
|
|
4584 return NULL;
|
|
4585 }
|
|
4586 #endif
|
|
4587
|
|
4588 /*
|
|
4589 * Expand environment variables for some string options.
|
|
4590 * These string options cannot be indirect!
|
|
4591 * If "val" is NULL expand the current value of the option.
|
|
4592 * Return pointer to NameBuff, or NULL when not expanded.
|
|
4593 */
|
|
4594 static char_u *
|
|
4595 option_expand(opt_idx, val)
|
|
4596 int opt_idx;
|
|
4597 char_u *val;
|
|
4598 {
|
|
4599 /* if option doesn't need expansion nothing to do */
|
|
4600 if (!(options[opt_idx].flags & P_EXPAND) || options[opt_idx].var == NULL)
|
|
4601 return NULL;
|
|
4602
|
|
4603 /* If val is longer than MAXPATHL no meaningful expansion can be done,
|
|
4604 * expand_env() would truncate the string. */
|
|
4605 if (val != NULL && STRLEN(val) > MAXPATHL)
|
|
4606 return NULL;
|
|
4607
|
|
4608 if (val == NULL)
|
|
4609 val = *(char_u **)options[opt_idx].var;
|
|
4610
|
|
4611 /*
|
|
4612 * Expanding this with NameBuff, expand_env() must not be passed IObuff.
|
|
4613 * Escape spaces when expanding 'tags', they are used to separate file
|
|
4614 * names.
|
374
|
4615 * For 'spellsuggest' expand after "file:".
|
7
|
4616 */
|
|
4617 expand_env_esc(val, NameBuff, MAXPATHL,
|
374
|
4618 (char_u **)options[opt_idx].var == &p_tags,
|
|
4619 #ifdef FEAT_SYN_HL
|
|
4620 (char_u **)options[opt_idx].var == &p_sps ? (char_u *)"file:" :
|
|
4621 #endif
|
|
4622 NULL);
|
7
|
4623 if (STRCMP(NameBuff, val) == 0) /* they are the same */
|
|
4624 return NULL;
|
|
4625
|
|
4626 return NameBuff;
|
|
4627 }
|
|
4628
|
|
4629 /*
|
|
4630 * After setting various option values: recompute variables that depend on
|
|
4631 * option values.
|
|
4632 */
|
|
4633 static void
|
|
4634 didset_options()
|
|
4635 {
|
|
4636 /* initialize the table for 'iskeyword' et.al. */
|
|
4637 (void)init_chartab();
|
|
4638
|
|
4639 (void)opt_strings_flags(p_cmp, p_cmp_values, &cmp_flags, TRUE);
|
|
4640 (void)opt_strings_flags(p_bkc, p_bkc_values, &bkc_flags, TRUE);
|
|
4641 #ifdef FEAT_SESSION
|
|
4642 (void)opt_strings_flags(p_ssop, p_ssop_values, &ssop_flags, TRUE);
|
|
4643 (void)opt_strings_flags(p_vop, p_ssop_values, &vop_flags, TRUE);
|
|
4644 #endif
|
|
4645 #ifdef FEAT_FOLDING
|
|
4646 (void)opt_strings_flags(p_fdo, p_fdo_values, &fdo_flags, TRUE);
|
|
4647 #endif
|
|
4648 (void)opt_strings_flags(p_dy, p_dy_values, &dy_flags, TRUE);
|
|
4649 #ifdef FEAT_VIRTUALEDIT
|
|
4650 (void)opt_strings_flags(p_ve, p_ve_values, &ve_flags, TRUE);
|
|
4651 #endif
|
|
4652 #if defined(FEAT_MOUSE) && (defined(UNIX) || defined(VMS))
|
|
4653 (void)opt_strings_flags(p_ttym, p_ttym_values, &ttym_flags, FALSE);
|
|
4654 #endif
|
344
|
4655 #ifdef FEAT_SYN_HL
|
484
|
4656 (void)spell_check_msm();
|
374
|
4657 (void)spell_check_sps();
|
389
|
4658 (void)compile_cap_prog(curbuf);
|
344
|
4659 #endif
|
7
|
4660 #if defined(FEAT_TOOLBAR) && !defined(FEAT_GUI_W32)
|
|
4661 (void)opt_strings_flags(p_toolbar, p_toolbar_values, &toolbar_flags, TRUE);
|
|
4662 #endif
|
|
4663 #if defined(FEAT_TOOLBAR) && defined(FEAT_GUI_GTK) && defined(HAVE_GTK2)
|
|
4664 (void)opt_strings_flags(p_tbis, p_tbis_values, &tbis_flags, FALSE);
|
|
4665 #endif
|
|
4666 #ifdef FEAT_CMDWIN
|
|
4667 /* set cedit_key */
|
|
4668 (void)check_cedit();
|
|
4669 #endif
|
|
4670 }
|
|
4671
|
|
4672 /*
|
|
4673 * Check for string options that are NULL (normally only termcap options).
|
|
4674 */
|
|
4675 void
|
|
4676 check_options()
|
|
4677 {
|
|
4678 int opt_idx;
|
|
4679
|
|
4680 for (opt_idx = 0; options[opt_idx].fullname != NULL; opt_idx++)
|
|
4681 if ((options[opt_idx].flags & P_STRING) && options[opt_idx].var != NULL)
|
|
4682 check_string_option((char_u **)get_varp(&(options[opt_idx])));
|
|
4683 }
|
|
4684
|
|
4685 /*
|
|
4686 * Check string options in a buffer for NULL value.
|
|
4687 */
|
|
4688 void
|
|
4689 check_buf_options(buf)
|
|
4690 buf_T *buf;
|
|
4691 {
|
|
4692 #if defined(FEAT_QUICKFIX)
|
|
4693 check_string_option(&buf->b_p_bh);
|
|
4694 check_string_option(&buf->b_p_bt);
|
|
4695 #endif
|
|
4696 #ifdef FEAT_MBYTE
|
|
4697 check_string_option(&buf->b_p_fenc);
|
|
4698 #endif
|
|
4699 check_string_option(&buf->b_p_ff);
|
|
4700 #ifdef FEAT_FIND_ID
|
|
4701 check_string_option(&buf->b_p_def);
|
|
4702 check_string_option(&buf->b_p_inc);
|
|
4703 # ifdef FEAT_EVAL
|
|
4704 check_string_option(&buf->b_p_inex);
|
|
4705 # endif
|
|
4706 #endif
|
|
4707 #if defined(FEAT_CINDENT) && defined(FEAT_EVAL)
|
|
4708 check_string_option(&buf->b_p_inde);
|
|
4709 check_string_option(&buf->b_p_indk);
|
|
4710 #endif
|
|
4711 #ifdef FEAT_CRYPT
|
|
4712 check_string_option(&buf->b_p_key);
|
|
4713 #endif
|
|
4714 check_string_option(&buf->b_p_kp);
|
|
4715 check_string_option(&buf->b_p_mps);
|
|
4716 check_string_option(&buf->b_p_fo);
|
41
|
4717 check_string_option(&buf->b_p_flp);
|
7
|
4718 check_string_option(&buf->b_p_isk);
|
|
4719 #ifdef FEAT_COMMENTS
|
|
4720 check_string_option(&buf->b_p_com);
|
|
4721 #endif
|
|
4722 #ifdef FEAT_FOLDING
|
|
4723 check_string_option(&buf->b_p_cms);
|
|
4724 #endif
|
|
4725 check_string_option(&buf->b_p_nf);
|
12
|
4726 #ifdef FEAT_TEXTOBJ
|
|
4727 check_string_option(&buf->b_p_qe);
|
|
4728 #endif
|
7
|
4729 #ifdef FEAT_SYN_HL
|
|
4730 check_string_option(&buf->b_p_syn);
|
386
|
4731 check_string_option(&buf->b_p_spc);
|
314
|
4732 check_string_option(&buf->b_p_spf);
|
221
|
4733 check_string_option(&buf->b_p_spl);
|
7
|
4734 #endif
|
|
4735 #ifdef FEAT_SEARCHPATH
|
|
4736 check_string_option(&buf->b_p_sua);
|
|
4737 #endif
|
|
4738 #ifdef FEAT_CINDENT
|
|
4739 check_string_option(&buf->b_p_cink);
|
|
4740 check_string_option(&buf->b_p_cino);
|
|
4741 #endif
|
|
4742 #ifdef FEAT_AUTOCMD
|
|
4743 check_string_option(&buf->b_p_ft);
|
|
4744 #endif
|
|
4745 #ifdef FEAT_OSFILETYPE
|
|
4746 check_string_option(&buf->b_p_oft);
|
|
4747 #endif
|
|
4748 #if defined(FEAT_SMARTINDENT) || defined(FEAT_CINDENT)
|
|
4749 check_string_option(&buf->b_p_cinw);
|
|
4750 #endif
|
|
4751 #ifdef FEAT_INS_EXPAND
|
|
4752 check_string_option(&buf->b_p_cpt);
|
|
4753 #endif
|
12
|
4754 #ifdef FEAT_COMPL_FUNC
|
|
4755 check_string_option(&buf->b_p_cfu);
|
502
|
4756 check_string_option(&buf->b_p_ofu);
|
12
|
4757 #endif
|
7
|
4758 #ifdef FEAT_KEYMAP
|
|
4759 check_string_option(&buf->b_p_keymap);
|
|
4760 #endif
|
|
4761 #ifdef FEAT_QUICKFIX
|
|
4762 check_string_option(&buf->b_p_gp);
|
|
4763 check_string_option(&buf->b_p_mp);
|
|
4764 check_string_option(&buf->b_p_efm);
|
|
4765 #endif
|
|
4766 check_string_option(&buf->b_p_ep);
|
|
4767 check_string_option(&buf->b_p_path);
|
|
4768 check_string_option(&buf->b_p_tags);
|
|
4769 #ifdef FEAT_INS_EXPAND
|
|
4770 check_string_option(&buf->b_p_dict);
|
|
4771 check_string_option(&buf->b_p_tsr);
|
|
4772 #endif
|
|
4773 }
|
|
4774
|
|
4775 /*
|
|
4776 * Free the string allocated for an option.
|
|
4777 * Checks for the string being empty_option. This may happen if we're out of
|
|
4778 * memory, vim_strsave() returned NULL, which was replaced by empty_option by
|
|
4779 * check_options().
|
|
4780 * Does NOT check for P_ALLOCED flag!
|
|
4781 */
|
|
4782 void
|
|
4783 free_string_option(p)
|
|
4784 char_u *p;
|
|
4785 {
|
|
4786 if (p != empty_option)
|
|
4787 vim_free(p);
|
|
4788 }
|
|
4789
|
|
4790 void
|
|
4791 clear_string_option(pp)
|
|
4792 char_u **pp;
|
|
4793 {
|
|
4794 if (*pp != empty_option)
|
|
4795 vim_free(*pp);
|
|
4796 *pp = empty_option;
|
|
4797 }
|
|
4798
|
|
4799 static void
|
|
4800 check_string_option(pp)
|
|
4801 char_u **pp;
|
|
4802 {
|
|
4803 if (*pp == NULL)
|
|
4804 *pp = empty_option;
|
|
4805 }
|
|
4806
|
|
4807 /*
|
|
4808 * Mark a terminal option as allocated, found by a pointer into term_strings[].
|
|
4809 */
|
|
4810 void
|
|
4811 set_term_option_alloced(p)
|
|
4812 char_u **p;
|
|
4813 {
|
|
4814 int opt_idx;
|
|
4815
|
|
4816 for (opt_idx = 1; options[opt_idx].fullname != NULL; opt_idx++)
|
|
4817 if (options[opt_idx].var == (char_u *)p)
|
|
4818 {
|
|
4819 options[opt_idx].flags |= P_ALLOCED;
|
|
4820 return;
|
|
4821 }
|
|
4822 return; /* cannot happen: didn't find it! */
|
|
4823 }
|
|
4824
|
|
4825 /*
|
|
4826 * Set a string option to a new value (without checking the effect).
|
|
4827 * The string is copied into allocated memory.
|
|
4828 * if ("opt_idx" == -1) "name" is used, otherwise "opt_idx" is used.
|
|
4829 */
|
|
4830 void
|
|
4831 set_string_option_direct(name, opt_idx, val, opt_flags)
|
|
4832 char_u *name;
|
|
4833 int opt_idx;
|
|
4834 char_u *val;
|
|
4835 int opt_flags; /* OPT_FREE, OPT_LOCAL and/or OPT_GLOBAL */
|
|
4836 {
|
|
4837 char_u *s;
|
|
4838 char_u **varp;
|
|
4839 int both = (opt_flags & (OPT_LOCAL | OPT_GLOBAL)) == 0;
|
|
4840
|
|
4841 if (opt_idx == -1) /* use name */
|
|
4842 {
|
|
4843 opt_idx = findoption(name);
|
|
4844 if (opt_idx == -1) /* not found (should not happen) */
|
|
4845 return;
|
|
4846 }
|
|
4847
|
|
4848 if (options[opt_idx].var == NULL) /* can't set hidden option */
|
|
4849 return;
|
|
4850
|
|
4851 s = vim_strsave(val);
|
|
4852 if (s != NULL)
|
|
4853 {
|
|
4854 varp = (char_u **)get_varp_scope(&(options[opt_idx]),
|
|
4855 both ? OPT_LOCAL : opt_flags);
|
|
4856 if ((opt_flags & OPT_FREE) && (options[opt_idx].flags & P_ALLOCED))
|
|
4857 free_string_option(*varp);
|
|
4858 *varp = s;
|
|
4859
|
|
4860 /* For buffer/window local option may also set the global value. */
|
|
4861 if (both)
|
|
4862 set_string_option_global(opt_idx, varp);
|
|
4863
|
|
4864 options[opt_idx].flags |= P_ALLOCED;
|
|
4865
|
|
4866 /* When setting both values of a global option with a local value,
|
|
4867 * make the local value empty, so that the global value is used. */
|
|
4868 if ((int)options[opt_idx].indir >= PV_BOTH && both)
|
|
4869 {
|
|
4870 free_string_option(*varp);
|
|
4871 *varp = empty_option;
|
|
4872 }
|
|
4873 }
|
|
4874 }
|
|
4875
|
|
4876 /*
|
|
4877 * Set global value for string option when it's a local option.
|
|
4878 */
|
|
4879 static void
|
|
4880 set_string_option_global(opt_idx, varp)
|
|
4881 int opt_idx; /* option index */
|
|
4882 char_u **varp; /* pointer to option variable */
|
|
4883 {
|
|
4884 char_u **p, *s;
|
|
4885
|
|
4886 /* the global value is always allocated */
|
|
4887 if (options[opt_idx].var == VAR_WIN)
|
|
4888 p = (char_u **)GLOBAL_WO(varp);
|
|
4889 else
|
|
4890 p = (char_u **)options[opt_idx].var;
|
|
4891 if (options[opt_idx].indir != PV_NONE
|
|
4892 && p != varp
|
|
4893 && (s = vim_strsave(*varp)) != NULL)
|
|
4894 {
|
|
4895 free_string_option(*p);
|
|
4896 *p = s;
|
|
4897 }
|
|
4898 }
|
|
4899
|
|
4900 /*
|
|
4901 * Set a string option to a new value, and handle the effects.
|
|
4902 */
|
|
4903 static void
|
|
4904 set_string_option(opt_idx, value, opt_flags)
|
|
4905 int opt_idx;
|
|
4906 char_u *value;
|
|
4907 int opt_flags; /* OPT_LOCAL and/or OPT_GLOBAL */
|
|
4908 {
|
|
4909 char_u *s;
|
|
4910 char_u **varp;
|
|
4911 char_u *oldval;
|
|
4912
|
|
4913 if (options[opt_idx].var == NULL) /* don't set hidden option */
|
|
4914 return;
|
|
4915
|
|
4916 s = vim_strsave(value);
|
|
4917 if (s != NULL)
|
|
4918 {
|
|
4919 varp = (char_u **)get_varp_scope(&(options[opt_idx]),
|
|
4920 (opt_flags & (OPT_LOCAL | OPT_GLOBAL)) == 0
|
|
4921 ? ((int)options[opt_idx].indir >= PV_BOTH
|
|
4922 ? OPT_GLOBAL : OPT_LOCAL)
|
|
4923 : opt_flags);
|
|
4924 oldval = *varp;
|
|
4925 *varp = s;
|
|
4926 options[opt_idx].flags |= P_WAS_SET;
|
|
4927 (void)did_set_string_option(opt_idx, varp, TRUE, oldval, NULL,
|
|
4928 opt_flags);
|
|
4929 }
|
|
4930 }
|
|
4931
|
|
4932 /*
|
|
4933 * Handle string options that need some action to perform when changed.
|
|
4934 * Returns NULL for success, or an error message for an error.
|
|
4935 */
|
|
4936 static char_u *
|
|
4937 did_set_string_option(opt_idx, varp, new_value_alloced, oldval, errbuf,
|
|
4938 opt_flags)
|
|
4939 int opt_idx; /* index in options[] table */
|
|
4940 char_u **varp; /* pointer to the option variable */
|
|
4941 int new_value_alloced; /* new value was allocated */
|
|
4942 char_u *oldval; /* previous value of the option */
|
|
4943 char_u *errbuf; /* buffer for errors, or NULL */
|
|
4944 int opt_flags; /* OPT_LOCAL and/or OPT_GLOBAL */
|
|
4945 {
|
|
4946 char_u *errmsg = NULL;
|
|
4947 char_u *s, *p;
|
|
4948 int did_chartab = FALSE;
|
|
4949 char_u **gvarp;
|
24
|
4950 int free_oldval = (options[opt_idx].flags & P_ALLOCED);
|
7
|
4951
|
|
4952 /* Get the global option to compare with, otherwise we would have to check
|
|
4953 * two values for all local options. */
|
|
4954 gvarp = (char_u **)get_varp_scope(&(options[opt_idx]), OPT_GLOBAL);
|
|
4955
|
|
4956 /* Disallow changing some options from secure mode */
|
|
4957 if ((secure
|
|
4958 #ifdef HAVE_SANDBOX
|
|
4959 || sandbox != 0
|
|
4960 #endif
|
|
4961 ) && (options[opt_idx].flags & P_SECURE))
|
|
4962 {
|
|
4963 errmsg = e_secure;
|
|
4964 }
|
|
4965
|
36
|
4966 /* Check for a "normal" file name in some options. Disallow a path
|
|
4967 * separator (slash and/or backslash), wildcards and characters that are
|
|
4968 * often illegal in a file name. */
|
|
4969 else if ((options[opt_idx].flags & P_NFNAME)
|
39
|
4970 && vim_strpbrk(*varp, (char_u *)"/\\*?[|<>") != NULL)
|
36
|
4971 {
|
|
4972 errmsg = e_invarg;
|
|
4973 }
|
|
4974
|
7
|
4975 /* 'term' */
|
|
4976 else if (varp == &T_NAME)
|
|
4977 {
|
|
4978 if (T_NAME[0] == NUL)
|
|
4979 errmsg = (char_u *)N_("E529: Cannot set 'term' to empty string");
|
|
4980 #ifdef FEAT_GUI
|
|
4981 if (gui.in_use)
|
|
4982 errmsg = (char_u *)N_("E530: Cannot change term in GUI");
|
|
4983 else if (term_is_gui(T_NAME))
|
|
4984 errmsg = (char_u *)N_("E531: Use \":gui\" to start the GUI");
|
|
4985 #endif
|
|
4986 else if (set_termname(T_NAME) == FAIL)
|
|
4987 errmsg = (char_u *)N_("E522: Not found in termcap");
|
|
4988 else
|
|
4989 /* Screen colors may have changed. */
|
|
4990 redraw_later_clear();
|
|
4991 }
|
|
4992
|
|
4993 /* 'backupcopy' */
|
|
4994 else if (varp == &p_bkc)
|
|
4995 {
|
|
4996 if (opt_strings_flags(p_bkc, p_bkc_values, &bkc_flags, TRUE) != OK)
|
|
4997 errmsg = e_invarg;
|
|
4998 if (((bkc_flags & BKC_AUTO) != 0)
|
|
4999 + ((bkc_flags & BKC_YES) != 0)
|
|
5000 + ((bkc_flags & BKC_NO) != 0) != 1)
|
|
5001 {
|
|
5002 /* Must have exactly one of "auto", "yes" and "no". */
|
|
5003 (void)opt_strings_flags(oldval, p_bkc_values, &bkc_flags, TRUE);
|
|
5004 errmsg = e_invarg;
|
|
5005 }
|
|
5006 }
|
|
5007
|
|
5008 /* 'backupext' and 'patchmode' */
|
|
5009 else if (varp == &p_bex || varp == &p_pm)
|
|
5010 {
|
|
5011 if (STRCMP(*p_bex == '.' ? p_bex + 1 : p_bex,
|
|
5012 *p_pm == '.' ? p_pm + 1 : p_pm) == 0)
|
|
5013 errmsg = (char_u *)N_("E589: 'backupext' and 'patchmode' are equal");
|
|
5014 }
|
|
5015
|
|
5016 /*
|
|
5017 * 'isident', 'iskeyword', 'isprint or 'isfname' option: refill chartab[]
|
|
5018 * If the new option is invalid, use old value. 'lisp' option: refill
|
|
5019 * chartab[] for '-' char
|
|
5020 */
|
|
5021 else if ( varp == &p_isi
|
|
5022 || varp == &(curbuf->b_p_isk)
|
|
5023 || varp == &p_isp
|
|
5024 || varp == &p_isf)
|
|
5025 {
|
|
5026 if (init_chartab() == FAIL)
|
|
5027 {
|
|
5028 did_chartab = TRUE; /* need to restore it below */
|
|
5029 errmsg = e_invarg; /* error in value */
|
|
5030 }
|
|
5031 }
|
|
5032
|
|
5033 /* 'helpfile' */
|
|
5034 else if (varp == &p_hf)
|
|
5035 {
|
|
5036 /* May compute new values for $VIM and $VIMRUNTIME */
|
|
5037 if (didset_vim)
|
|
5038 {
|
|
5039 vim_setenv((char_u *)"VIM", (char_u *)"");
|
|
5040 didset_vim = FALSE;
|
|
5041 }
|
|
5042 if (didset_vimruntime)
|
|
5043 {
|
|
5044 vim_setenv((char_u *)"VIMRUNTIME", (char_u *)"");
|
|
5045 didset_vimruntime = FALSE;
|
|
5046 }
|
|
5047 }
|
|
5048
|
|
5049 #ifdef FEAT_MULTI_LANG
|
|
5050 /* 'helplang' */
|
|
5051 else if (varp == &p_hlg)
|
|
5052 {
|
|
5053 /* Check for "", "ab", "ab,cd", etc. */
|
|
5054 for (s = p_hlg; *s != NUL; s += 3)
|
|
5055 {
|
|
5056 if (s[1] == NUL || ((s[2] != ',' || s[3] == NUL) && s[2] != NUL))
|
|
5057 {
|
|
5058 errmsg = e_invarg;
|
|
5059 break;
|
|
5060 }
|
|
5061 if (s[2] == NUL)
|
|
5062 break;
|
|
5063 }
|
|
5064 }
|
|
5065 #endif
|
|
5066
|
|
5067 /* 'highlight' */
|
|
5068 else if (varp == &p_hl)
|
|
5069 {
|
|
5070 if (highlight_changed() == FAIL)
|
|
5071 errmsg = e_invarg; /* invalid flags */
|
|
5072 }
|
|
5073
|
|
5074 /* 'nrformats' */
|
|
5075 else if (gvarp == &p_nf)
|
|
5076 {
|
|
5077 if (check_opt_strings(*varp, p_nf_values, TRUE) != OK)
|
|
5078 errmsg = e_invarg;
|
|
5079 }
|
|
5080
|
|
5081 #ifdef FEAT_SESSION
|
|
5082 /* 'sessionoptions' */
|
|
5083 else if (varp == &p_ssop)
|
|
5084 {
|
|
5085 if (opt_strings_flags(p_ssop, p_ssop_values, &ssop_flags, TRUE) != OK)
|
|
5086 errmsg = e_invarg;
|
|
5087 if ((ssop_flags & SSOP_CURDIR) && (ssop_flags & SSOP_SESDIR))
|
|
5088 {
|
|
5089 /* Don't allow both "sesdir" and "curdir". */
|
|
5090 (void)opt_strings_flags(oldval, p_ssop_values, &ssop_flags, TRUE);
|
|
5091 errmsg = e_invarg;
|
|
5092 }
|
|
5093 }
|
|
5094 /* 'viewoptions' */
|
|
5095 else if (varp == &p_vop)
|
|
5096 {
|
|
5097 if (opt_strings_flags(p_vop, p_ssop_values, &vop_flags, TRUE) != OK)
|
|
5098 errmsg = e_invarg;
|
|
5099 }
|
|
5100 #endif
|
|
5101
|
|
5102 /* 'scrollopt' */
|
|
5103 #ifdef FEAT_SCROLLBIND
|
|
5104 else if (varp == &p_sbo)
|
|
5105 {
|
|
5106 if (check_opt_strings(p_sbo, p_scbopt_values, TRUE) != OK)
|
|
5107 errmsg = e_invarg;
|
|
5108 }
|
|
5109 #endif
|
|
5110
|
|
5111 /* 'ambiwidth' */
|
|
5112 #ifdef FEAT_MBYTE
|
|
5113 else if (varp == &p_ambw)
|
|
5114 {
|
|
5115 if (check_opt_strings(p_ambw, p_ambw_values, FALSE) != OK)
|
|
5116 errmsg = e_invarg;
|
|
5117 }
|
|
5118 #endif
|
|
5119
|
|
5120 /* 'background' */
|
|
5121 else if (varp == &p_bg)
|
|
5122 {
|
|
5123 if (check_opt_strings(p_bg, p_bg_values, FALSE) == OK)
|
|
5124 {
|
|
5125 #ifdef FEAT_EVAL
|
|
5126 int dark = (*p_bg == 'd');
|
|
5127 #endif
|
|
5128
|
|
5129 init_highlight(FALSE, FALSE);
|
|
5130
|
|
5131 #ifdef FEAT_EVAL
|
|
5132 if (dark != (*p_bg == 'd')
|
|
5133 && get_var_value((char_u *)"g:colors_name") != NULL)
|
|
5134 {
|
|
5135 /* The color scheme must have set 'background' back to another
|
|
5136 * value, that's not what we want here. Disable the color
|
|
5137 * scheme and set the colors again. */
|
148
|
5138 do_unlet((char_u *)"g:colors_name", TRUE);
|
7
|
5139 free_string_option(p_bg);
|
|
5140 p_bg = vim_strsave((char_u *)(dark ? "dark" : "light"));
|
|
5141 check_string_option(&p_bg);
|
|
5142 init_highlight(FALSE, FALSE);
|
|
5143 }
|
|
5144 #endif
|
|
5145 }
|
|
5146 else
|
|
5147 errmsg = e_invarg;
|
|
5148 }
|
|
5149
|
|
5150 /* 'wildmode' */
|
|
5151 else if (varp == &p_wim)
|
|
5152 {
|
|
5153 if (check_opt_wim() == FAIL)
|
|
5154 errmsg = e_invarg;
|
|
5155 }
|
|
5156
|
40
|
5157 #ifdef FEAT_CMDL_COMPL
|
|
5158 /* 'wildoptions' */
|
|
5159 else if (varp == &p_wop)
|
|
5160 {
|
|
5161 if (check_opt_strings(p_wop, p_wop_values, TRUE) != OK)
|
|
5162 errmsg = e_invarg;
|
|
5163 }
|
|
5164 #endif
|
|
5165
|
7
|
5166 #ifdef FEAT_WAK
|
|
5167 /* 'winaltkeys' */
|
|
5168 else if (varp == &p_wak)
|
|
5169 {
|
|
5170 if (*p_wak == NUL
|
|
5171 || check_opt_strings(p_wak, p_wak_values, FALSE) != OK)
|
|
5172 errmsg = e_invarg;
|
|
5173 # ifdef FEAT_MENU
|
|
5174 # ifdef FEAT_GUI_MOTIF
|
|
5175 else if (gui.in_use)
|
|
5176 gui_motif_set_mnemonics(p_wak[0] == 'y' || p_wak[0] == 'm');
|
|
5177 # else
|
|
5178 # ifdef FEAT_GUI_GTK
|
|
5179 else if (gui.in_use)
|
|
5180 gui_gtk_set_mnemonics(p_wak[0] == 'y' || p_wak[0] == 'm');
|
|
5181 # endif
|
|
5182 # endif
|
|
5183 # endif
|
|
5184 }
|
|
5185 #endif
|
|
5186
|
|
5187 #ifdef FEAT_AUTOCMD
|
|
5188 /* 'eventignore' */
|
|
5189 else if (varp == &p_ei)
|
|
5190 {
|
|
5191 if (check_ei() == FAIL)
|
|
5192 errmsg = e_invarg;
|
|
5193 }
|
|
5194 #endif
|
|
5195
|
|
5196 #ifdef FEAT_MBYTE
|
|
5197 /* 'encoding' and 'fileencoding' */
|
|
5198 else if (varp == &p_enc || gvarp == &p_fenc || varp == &p_tenc)
|
|
5199 {
|
|
5200 if (gvarp == &p_fenc)
|
|
5201 {
|
|
5202 if (!curbuf->b_p_ma)
|
|
5203 errmsg = e_modifiable;
|
|
5204 else if (vim_strchr(*varp, ',') != NULL)
|
|
5205 /* No comma allowed in 'fileencoding'; catches confusing it
|
|
5206 * with 'fileencodings'. */
|
|
5207 errmsg = e_invarg;
|
39
|
5208 else
|
|
5209 {
|
7
|
5210 # ifdef FEAT_TITLE
|
|
5211 /* May show a "+" in the title now. */
|
|
5212 need_maketitle = TRUE;
|
|
5213 # endif
|
39
|
5214 /* Add 'fileencoding' to the swap file. */
|
|
5215 ml_setflags(curbuf);
|
|
5216 }
|
7
|
5217 }
|
|
5218 if (errmsg == NULL)
|
|
5219 {
|
|
5220 /* canonize the value, so that STRCMP() can be used on it */
|
|
5221 p = enc_canonize(*varp);
|
|
5222 if (p != NULL)
|
|
5223 {
|
|
5224 vim_free(*varp);
|
|
5225 *varp = p;
|
|
5226 }
|
|
5227 if (varp == &p_enc)
|
|
5228 {
|
|
5229 errmsg = mb_init();
|
|
5230 # ifdef FEAT_TITLE
|
|
5231 need_maketitle = TRUE;
|
|
5232 # endif
|
|
5233 }
|
|
5234 }
|
|
5235
|
|
5236 # if defined(FEAT_GUI_GTK) && defined(HAVE_GTK2)
|
|
5237 if (errmsg == NULL && varp == &p_tenc && gui.in_use)
|
|
5238 {
|
|
5239 /* GTK+ 2 uses only a single encoding, and that is UTF-8. */
|
|
5240 if (STRCMP(p_tenc, "utf-8") != 0)
|
|
5241 errmsg = (char_u *)N_("E617: Cannot be changed in the GTK+ 2 GUI");
|
|
5242 }
|
|
5243 # endif
|
|
5244
|
|
5245 if (errmsg == NULL)
|
|
5246 {
|
|
5247 # ifdef FEAT_KEYMAP
|
|
5248 /* When 'keymap' is used and 'encoding' changes, reload the keymap
|
|
5249 * (with another encoding). */
|
|
5250 if (varp == &p_enc && *curbuf->b_p_keymap != NUL)
|
|
5251 (void)keymap_init();
|
|
5252 # endif
|
|
5253
|
|
5254 /* When 'termencoding' is not empty and 'encoding' changes or when
|
|
5255 * 'termencoding' changes, need to setup for keyboard input and
|
|
5256 * display output conversion. */
|
|
5257 if (((varp == &p_enc && *p_tenc != NUL) || varp == &p_tenc))
|
|
5258 {
|
|
5259 convert_setup(&input_conv, p_tenc, p_enc);
|
|
5260 convert_setup(&output_conv, p_enc, p_tenc);
|
|
5261 }
|
170
|
5262
|
|
5263 # if defined(WIN3264) && defined(FEAT_MBYTE)
|
|
5264 /* $HOME may have characters in active code page. */
|
|
5265 if (varp == &p_enc)
|
|
5266 init_homedir();
|
|
5267 # endif
|
7
|
5268 }
|
|
5269 }
|
|
5270 #endif
|
|
5271
|
|
5272 #if defined(FEAT_POSTSCRIPT)
|
|
5273 else if (varp == &p_penc)
|
|
5274 {
|
|
5275 /* Canonize printencoding if VIM standard one */
|
|
5276 p = enc_canonize(p_penc);
|
|
5277 if (p != NULL)
|
|
5278 {
|
|
5279 vim_free(p_penc);
|
|
5280 p_penc = p;
|
|
5281 }
|
|
5282 else
|
|
5283 {
|
|
5284 /* Ensure lower case and '-' for '_' */
|
|
5285 for (s = p_penc; *s != NUL; s++)
|
|
5286 {
|
|
5287 if (*s == '_')
|
|
5288 *s = '-';
|
|
5289 else
|
|
5290 *s = TOLOWER_ASC(*s);
|
|
5291 }
|
|
5292 }
|
|
5293 }
|
|
5294 #endif
|
|
5295
|
11
|
5296 #if defined(FEAT_XIM) && ( defined(FEAT_GUI_GTK) || defined(FEAT_GUI_KDE) )
|
7
|
5297 else if (varp == &p_imak)
|
|
5298 {
|
|
5299 if (gui.in_use && !im_xim_isvalid_imactivate())
|
|
5300 errmsg = e_invarg;
|
|
5301 }
|
|
5302 #endif
|
|
5303
|
|
5304 #ifdef FEAT_KEYMAP
|
|
5305 else if (varp == &curbuf->b_p_keymap)
|
|
5306 {
|
|
5307 /* load or unload key mapping tables */
|
|
5308 errmsg = keymap_init();
|
|
5309
|
|
5310 /* When successfully installed a new keymap switch on using it. */
|
|
5311 if (*curbuf->b_p_keymap != NUL && errmsg == NULL)
|
|
5312 {
|
|
5313 curbuf->b_p_iminsert = B_IMODE_LMAP;
|
|
5314 if (curbuf->b_p_imsearch != B_IMODE_USE_INSERT)
|
|
5315 curbuf->b_p_imsearch = B_IMODE_LMAP;
|
|
5316 set_iminsert_global();
|
|
5317 set_imsearch_global();
|
|
5318 # ifdef FEAT_WINDOWS
|
|
5319 status_redraw_curbuf();
|
|
5320 # endif
|
|
5321 }
|
|
5322 }
|
|
5323 #endif
|
|
5324
|
|
5325 /* 'fileformat' */
|
|
5326 else if (gvarp == &p_ff)
|
|
5327 {
|
|
5328 if (!curbuf->b_p_ma && !(opt_flags & OPT_GLOBAL))
|
|
5329 errmsg = e_modifiable;
|
|
5330 else if (check_opt_strings(*varp, p_ff_values, FALSE) != OK)
|
|
5331 errmsg = e_invarg;
|
|
5332 else
|
|
5333 {
|
|
5334 /* may also change 'textmode' */
|
|
5335 if (get_fileformat(curbuf) == EOL_DOS)
|
|
5336 curbuf->b_p_tx = TRUE;
|
|
5337 else
|
|
5338 curbuf->b_p_tx = FALSE;
|
|
5339 #ifdef FEAT_TITLE
|
|
5340 need_maketitle = TRUE;
|
|
5341 #endif
|
39
|
5342 /* update flag in swap file */
|
|
5343 ml_setflags(curbuf);
|
7
|
5344 }
|
|
5345 }
|
|
5346
|
|
5347 /* 'fileformats' */
|
|
5348 else if (varp == &p_ffs)
|
|
5349 {
|
|
5350 if (check_opt_strings(p_ffs, p_ff_values, TRUE) != OK)
|
|
5351 errmsg = e_invarg;
|
|
5352 else
|
|
5353 {
|
|
5354 /* also change 'textauto' */
|
|
5355 if (*p_ffs == NUL)
|
|
5356 p_ta = FALSE;
|
|
5357 else
|
|
5358 p_ta = TRUE;
|
|
5359 }
|
|
5360 }
|
|
5361
|
|
5362 #if defined(FEAT_CRYPT) && defined(FEAT_CMDHIST)
|
|
5363 /* 'cryptkey' */
|
|
5364 else if (gvarp == &p_key)
|
|
5365 {
|
|
5366 /* Make sure the ":set" command doesn't show the new value in the
|
|
5367 * history. */
|
|
5368 remove_key_from_history();
|
|
5369 }
|
|
5370 #endif
|
|
5371
|
|
5372 /* 'matchpairs' */
|
|
5373 else if (gvarp == &p_mps)
|
|
5374 {
|
|
5375 /* Check for "x:y,x:y" */
|
|
5376 for (p = *varp; *p != NUL; p += 4)
|
|
5377 {
|
|
5378 if (p[1] != ':' || p[2] == NUL || (p[3] != NUL && p[3] != ','))
|
|
5379 {
|
|
5380 errmsg = e_invarg;
|
|
5381 break;
|
|
5382 }
|
|
5383 if (p[3] == NUL)
|
|
5384 break;
|
|
5385 }
|
|
5386 }
|
|
5387
|
|
5388 #ifdef FEAT_COMMENTS
|
|
5389 /* 'comments' */
|
|
5390 else if (gvarp == &p_com)
|
|
5391 {
|
|
5392 for (s = *varp; *s; )
|
|
5393 {
|
|
5394 while (*s && *s != ':')
|
|
5395 {
|
|
5396 if (vim_strchr((char_u *)COM_ALL, *s) == NULL
|
|
5397 && !VIM_ISDIGIT(*s) && *s != '-')
|
|
5398 {
|
|
5399 errmsg = illegal_char(errbuf, *s);
|
|
5400 break;
|
|
5401 }
|
|
5402 ++s;
|
|
5403 }
|
|
5404 if (*s++ == NUL)
|
|
5405 errmsg = (char_u *)N_("E524: Missing colon");
|
|
5406 else if (*s == ',' || *s == NUL)
|
|
5407 errmsg = (char_u *)N_("E525: Zero length string");
|
|
5408 if (errmsg != NULL)
|
|
5409 break;
|
|
5410 while (*s && *s != ',')
|
|
5411 {
|
|
5412 if (*s == '\\' && s[1] != NUL)
|
|
5413 ++s;
|
|
5414 ++s;
|
|
5415 }
|
|
5416 s = skip_to_option_part(s);
|
|
5417 }
|
|
5418 }
|
|
5419 #endif
|
|
5420
|
|
5421 /* 'listchars' */
|
|
5422 else if (varp == &p_lcs)
|
|
5423 {
|
|
5424 errmsg = set_chars_option(varp);
|
|
5425 }
|
|
5426
|
|
5427 #if defined(FEAT_WINDOWS) || defined(FEAT_FOLDING)
|
|
5428 /* 'fillchars' */
|
|
5429 else if (varp == &p_fcs)
|
|
5430 {
|
|
5431 errmsg = set_chars_option(varp);
|
|
5432 }
|
|
5433 #endif
|
|
5434
|
|
5435 #ifdef FEAT_CMDWIN
|
|
5436 /* 'cedit' */
|
|
5437 else if (varp == &p_cedit)
|
|
5438 {
|
|
5439 errmsg = check_cedit();
|
|
5440 }
|
|
5441 #endif
|
|
5442
|
294
|
5443 /* 'verbosefile' */
|
|
5444 else if (varp == &p_vfile)
|
|
5445 {
|
|
5446 verbose_stop();
|
|
5447 if (*p_vfile != NUL && verbose_open() == FAIL)
|
|
5448 errmsg = e_invarg;
|
|
5449 }
|
|
5450
|
7
|
5451 #ifdef FEAT_VIMINFO
|
|
5452 /* 'viminfo' */
|
|
5453 else if (varp == &p_viminfo)
|
|
5454 {
|
|
5455 for (s = p_viminfo; *s;)
|
|
5456 {
|
|
5457 /* Check it's a valid character */
|
|
5458 if (vim_strchr((char_u *)"!\"%'/:<@cfhnrs", *s) == NULL)
|
|
5459 {
|
|
5460 errmsg = illegal_char(errbuf, *s);
|
|
5461 break;
|
|
5462 }
|
|
5463 if (*s == 'n') /* name is always last one */
|
|
5464 {
|
|
5465 break;
|
|
5466 }
|
|
5467 else if (*s == 'r') /* skip until next ',' */
|
|
5468 {
|
|
5469 while (*++s && *s != ',')
|
|
5470 ;
|
|
5471 }
|
23
|
5472 else if (*s == '%')
|
|
5473 {
|
|
5474 /* optional number */
|
|
5475 while (vim_isdigit(*++s))
|
|
5476 ;
|
|
5477 }
|
|
5478 else if (*s == '!' || *s == 'h' || *s == 'c')
|
7
|
5479 ++s; /* no extra chars */
|
|
5480 else /* must have a number */
|
|
5481 {
|
|
5482 while (vim_isdigit(*++s))
|
|
5483 ;
|
|
5484
|
|
5485 if (!VIM_ISDIGIT(*(s - 1)))
|
|
5486 {
|
|
5487 if (errbuf != NULL)
|
|
5488 {
|
133
|
5489 sprintf((char *)errbuf,
|
|
5490 _("E526: Missing number after <%s>"),
|
7
|
5491 transchar_byte(*(s - 1)));
|
|
5492 errmsg = errbuf;
|
|
5493 }
|
|
5494 else
|
|
5495 errmsg = (char_u *)"";
|
|
5496 break;
|
|
5497 }
|
|
5498 }
|
|
5499 if (*s == ',')
|
|
5500 ++s;
|
|
5501 else if (*s)
|
|
5502 {
|
|
5503 if (errbuf != NULL)
|
|
5504 errmsg = (char_u *)N_("E527: Missing comma");
|
|
5505 else
|
|
5506 errmsg = (char_u *)"";
|
|
5507 break;
|
|
5508 }
|
|
5509 }
|
|
5510 if (*p_viminfo && errmsg == NULL && get_viminfo_parameter('\'') < 0)
|
|
5511 errmsg = (char_u *)N_("E528: Must specify a ' value");
|
|
5512 }
|
|
5513 #endif /* FEAT_VIMINFO */
|
|
5514
|
|
5515 /* terminal options */
|
|
5516 else if (istermoption(&options[opt_idx]) && full_screen)
|
|
5517 {
|
|
5518 /* ":set t_Co=0" and ":set t_Co=1" do ":set t_Co=" */
|
|
5519 if (varp == &T_CCO)
|
|
5520 {
|
|
5521 t_colors = atoi((char *)T_CCO);
|
|
5522 if (t_colors <= 1)
|
|
5523 {
|
|
5524 if (new_value_alloced)
|
|
5525 vim_free(T_CCO);
|
|
5526 T_CCO = empty_option;
|
|
5527 }
|
|
5528 /* We now have a different color setup, initialize it again. */
|
|
5529 init_highlight(TRUE, FALSE);
|
|
5530 }
|
|
5531 ttest(FALSE);
|
|
5532 if (varp == &T_ME)
|
|
5533 {
|
|
5534 out_str(T_ME);
|
|
5535 redraw_later(CLEAR);
|
|
5536 #if defined(MSDOS) || (defined(WIN3264) && !defined(FEAT_GUI_W32))
|
|
5537 /* Since t_me has been set, this probably means that the user
|
|
5538 * wants to use this as default colors. Need to reset default
|
|
5539 * background/foreground colors. */
|
|
5540 mch_set_normal_colors();
|
|
5541 #endif
|
|
5542 }
|
|
5543 }
|
|
5544
|
|
5545 #ifdef FEAT_LINEBREAK
|
|
5546 /* 'showbreak' */
|
|
5547 else if (varp == &p_sbr)
|
|
5548 {
|
|
5549 for (s = p_sbr; *s; )
|
|
5550 {
|
|
5551 if (ptr2cells(s) != 1)
|
|
5552 errmsg = (char_u *)N_("E595: contains unprintable or wide character");
|
39
|
5553 mb_ptr_adv(s);
|
7
|
5554 }
|
|
5555 }
|
|
5556 #endif
|
|
5557
|
|
5558 #ifdef FEAT_GUI
|
|
5559 /* 'guifont' */
|
|
5560 else if (varp == &p_guifont)
|
|
5561 {
|
|
5562 if (gui.in_use)
|
|
5563 {
|
|
5564 p = p_guifont;
|
11
|
5565 # if defined(FEAT_GUI_GTK) || defined(FEAT_GUI_KDE)
|
7
|
5566 /*
|
|
5567 * Put up a font dialog and let the user select a new value.
|
|
5568 * If this is cancelled go back to the old value but don't
|
|
5569 * give an error message.
|
|
5570 */
|
|
5571 if (STRCMP(p, "*") == 0)
|
|
5572 {
|
|
5573 p = gui_mch_font_dialog(oldval);
|
|
5574
|
|
5575 if (new_value_alloced)
|
|
5576 free_string_option(p_guifont);
|
|
5577
|
|
5578 p_guifont = (p != NULL) ? p : vim_strsave(oldval);
|
|
5579 new_value_alloced = TRUE;
|
|
5580 }
|
|
5581 # endif
|
|
5582 if (p != NULL && gui_init_font(p_guifont, FALSE) != OK)
|
|
5583 {
|
|
5584 # if defined(FEAT_GUI_MSWIN) || defined(FEAT_GUI_PHOTON)
|
|
5585 if (STRCMP(p_guifont, "*") == 0)
|
|
5586 {
|
|
5587 /* Dialog was cancelled: Keep the old value without giving
|
|
5588 * an error message. */
|
|
5589 if (new_value_alloced)
|
|
5590 free_string_option(p_guifont);
|
|
5591 p_guifont = vim_strsave(oldval);
|
|
5592 new_value_alloced = TRUE;
|
|
5593 }
|
|
5594 else
|
|
5595 # endif
|
|
5596 errmsg = (char_u *)N_("E596: Invalid font(s)");
|
|
5597 }
|
|
5598 }
|
|
5599 }
|
|
5600 # ifdef FEAT_XFONTSET
|
|
5601 else if (varp == &p_guifontset)
|
|
5602 {
|
|
5603 if (STRCMP(p_guifontset, "*") == 0)
|
|
5604 errmsg = (char_u *)N_("E597: can't select fontset");
|
|
5605 else if (gui.in_use && gui_init_font(p_guifontset, TRUE) != OK)
|
|
5606 errmsg = (char_u *)N_("E598: Invalid fontset");
|
|
5607 }
|
|
5608 # endif
|
|
5609 # ifdef FEAT_MBYTE
|
|
5610 else if (varp == &p_guifontwide)
|
|
5611 {
|
|
5612 if (STRCMP(p_guifontwide, "*") == 0)
|
|
5613 errmsg = (char_u *)N_("E533: can't select wide font");
|
|
5614 else if (gui_get_wide_font() == FAIL)
|
|
5615 errmsg = (char_u *)N_("E534: Invalid wide font");
|
|
5616 }
|
|
5617 # endif
|
|
5618 #endif
|
|
5619
|
|
5620 #ifdef CURSOR_SHAPE
|
|
5621 /* 'guicursor' */
|
|
5622 else if (varp == &p_guicursor)
|
|
5623 errmsg = parse_shape_opt(SHAPE_CURSOR);
|
|
5624 #endif
|
|
5625
|
|
5626 #ifdef FEAT_MOUSESHAPE
|
|
5627 /* 'mouseshape' */
|
|
5628 else if (varp == &p_mouseshape)
|
|
5629 {
|
|
5630 errmsg = parse_shape_opt(SHAPE_MOUSE);
|
|
5631 update_mouseshape(-1);
|
|
5632 }
|
|
5633 #endif
|
|
5634
|
|
5635 #ifdef FEAT_PRINTER
|
|
5636 else if (varp == &p_popt)
|
440
|
5637 errmsg = parse_printoptions();
|
16
|
5638 # if defined(FEAT_MBYTE) && defined(FEAT_POSTSCRIPT)
|
15
|
5639 else if (varp == &p_pmfn)
|
440
|
5640 errmsg = parse_printmbfont();
|
15
|
5641 # endif
|
7
|
5642 #endif
|
|
5643
|
|
5644 #ifdef FEAT_LANGMAP
|
|
5645 /* 'langmap' */
|
|
5646 else if (varp == &p_langmap)
|
|
5647 langmap_set();
|
|
5648 #endif
|
|
5649
|
|
5650 #ifdef FEAT_LINEBREAK
|
|
5651 /* 'breakat' */
|
|
5652 else if (varp == &p_breakat)
|
|
5653 fill_breakat_flags();
|
|
5654 #endif
|
|
5655
|
|
5656 #ifdef FEAT_TITLE
|
|
5657 /* 'titlestring' and 'iconstring' */
|
|
5658 else if (varp == &p_titlestring || varp == &p_iconstring)
|
|
5659 {
|
|
5660 # ifdef FEAT_STL_OPT
|
|
5661 int flagval = (varp == &p_titlestring) ? STL_IN_TITLE : STL_IN_ICON;
|
|
5662
|
|
5663 /* NULL => statusline syntax */
|
|
5664 if (vim_strchr(*varp, '%') && check_stl_option(*varp) == NULL)
|
|
5665 stl_syntax |= flagval;
|
|
5666 else
|
|
5667 stl_syntax &= ~flagval;
|
|
5668 # endif
|
|
5669 did_set_title(varp == &p_iconstring);
|
|
5670
|
|
5671 }
|
|
5672 #endif
|
|
5673
|
|
5674 #ifdef FEAT_GUI
|
|
5675 /* 'guioptions' */
|
|
5676 else if (varp == &p_go)
|
|
5677 gui_init_which_components(oldval);
|
|
5678 #endif
|
|
5679
|
|
5680 #if defined(FEAT_MOUSE_TTY) && (defined(UNIX) || defined(VMS))
|
|
5681 /* 'ttymouse' */
|
|
5682 else if (varp == &p_ttym)
|
|
5683 {
|
190
|
5684 /* Switch the mouse off before changing the escape sequences used for
|
|
5685 * that. */
|
|
5686 mch_setmouse(FALSE);
|
7
|
5687 if (opt_strings_flags(p_ttym, p_ttym_values, &ttym_flags, FALSE) != OK)
|
|
5688 errmsg = e_invarg;
|
|
5689 else
|
|
5690 check_mouse_termcode();
|
227
|
5691 if (termcap_active)
|
|
5692 setmouse(); /* may switch it on again */
|
7
|
5693 }
|
|
5694 #endif
|
|
5695
|
|
5696 #ifdef FEAT_VISUAL
|
|
5697 /* 'selection' */
|
|
5698 else if (varp == &p_sel)
|
|
5699 {
|
|
5700 if (*p_sel == NUL
|
|
5701 || check_opt_strings(p_sel, p_sel_values, FALSE) != OK)
|
|
5702 errmsg = e_invarg;
|
|
5703 }
|
|
5704
|
|
5705 /* 'selectmode' */
|
|
5706 else if (varp == &p_slm)
|
|
5707 {
|
|
5708 if (check_opt_strings(p_slm, p_slm_values, TRUE) != OK)
|
|
5709 errmsg = e_invarg;
|
|
5710 }
|
|
5711 #endif
|
|
5712
|
|
5713 #ifdef FEAT_BROWSE
|
|
5714 /* 'browsedir' */
|
|
5715 else if (varp == &p_bsdir)
|
|
5716 {
|
|
5717 if (check_opt_strings(p_bsdir, p_bsdir_values, FALSE) != OK
|
|
5718 && !mch_isdir(p_bsdir))
|
|
5719 errmsg = e_invarg;
|
|
5720 }
|
|
5721 #endif
|
|
5722
|
|
5723 #ifdef FEAT_VISUAL
|
|
5724 /* 'keymodel' */
|
|
5725 else if (varp == &p_km)
|
|
5726 {
|
|
5727 if (check_opt_strings(p_km, p_km_values, TRUE) != OK)
|
|
5728 errmsg = e_invarg;
|
|
5729 else
|
|
5730 {
|
|
5731 km_stopsel = (vim_strchr(p_km, 'o') != NULL);
|
|
5732 km_startsel = (vim_strchr(p_km, 'a') != NULL);
|
|
5733 }
|
|
5734 }
|
|
5735 #endif
|
|
5736
|
|
5737 /* 'mousemodel' */
|
|
5738 else if (varp == &p_mousem)
|
|
5739 {
|
|
5740 if (check_opt_strings(p_mousem, p_mousem_values, FALSE) != OK)
|
|
5741 errmsg = e_invarg;
|
|
5742 #if defined(FEAT_GUI_MOTIF) && defined(FEAT_MENU) && (XmVersion <= 1002)
|
|
5743 else if (*p_mousem != *oldval)
|
|
5744 /* Changed from "extend" to "popup" or "popup_setpos" or vv: need
|
|
5745 * to create or delete the popup menus. */
|
|
5746 gui_motif_update_mousemodel(root_menu);
|
|
5747 #endif
|
|
5748 }
|
|
5749
|
|
5750 /* 'switchbuf' */
|
|
5751 else if (varp == &p_swb)
|
|
5752 {
|
|
5753 if (check_opt_strings(p_swb, p_swb_values, TRUE) != OK)
|
|
5754 errmsg = e_invarg;
|
|
5755 }
|
|
5756
|
|
5757 /* 'debug' */
|
|
5758 else if (varp == &p_debug)
|
|
5759 {
|
|
5760 if (check_opt_strings(p_debug, p_debug_values, FALSE) != OK)
|
|
5761 errmsg = e_invarg;
|
|
5762 }
|
|
5763
|
|
5764 /* 'display' */
|
|
5765 else if (varp == &p_dy)
|
|
5766 {
|
|
5767 if (opt_strings_flags(p_dy, p_dy_values, &dy_flags, TRUE) != OK)
|
|
5768 errmsg = e_invarg;
|
|
5769 else
|
|
5770 (void)init_chartab();
|
|
5771
|
|
5772 }
|
|
5773
|
|
5774 #ifdef FEAT_VERTSPLIT
|
|
5775 /* 'eadirection' */
|
|
5776 else if (varp == &p_ead)
|
|
5777 {
|
|
5778 if (check_opt_strings(p_ead, p_ead_values, FALSE) != OK)
|
|
5779 errmsg = e_invarg;
|
|
5780 }
|
|
5781 #endif
|
|
5782
|
|
5783 #ifdef FEAT_CLIPBOARD
|
|
5784 /* 'clipboard' */
|
|
5785 else if (varp == &p_cb)
|
|
5786 errmsg = check_clipboard_option();
|
|
5787 #endif
|
|
5788
|
221
|
5789 #ifdef FEAT_SYN_HL
|
323
|
5790 /* When 'spelllang' or 'spellfile' is set and there is a window for this
|
|
5791 * buffer in which 'spell' is set load the wordlists. */
|
|
5792 else if (varp == &(curbuf->b_p_spl) || varp == &(curbuf->b_p_spf))
|
221
|
5793 {
|
258
|
5794 win_T *wp;
|
323
|
5795 int l;
|
|
5796
|
|
5797 if (varp == &(curbuf->b_p_spf))
|
|
5798 {
|
|
5799 l = STRLEN(curbuf->b_p_spf);
|
|
5800 if (l > 0 && (l < 4 || STRCMP(curbuf->b_p_spf + l - 4,
|
|
5801 ".add") != 0))
|
|
5802 errmsg = e_invarg;
|
|
5803 }
|
|
5804
|
|
5805 if (errmsg == NULL)
|
|
5806 {
|
|
5807 FOR_ALL_WINDOWS(wp)
|
|
5808 if (wp->w_buffer == curbuf && wp->w_p_spell)
|
|
5809 {
|
|
5810 errmsg = did_set_spelllang(curbuf);
|
258
|
5811 # ifdef FEAT_WINDOWS
|
323
|
5812 break;
|
258
|
5813 # endif
|
323
|
5814 }
|
|
5815 }
|
221
|
5816 }
|
386
|
5817 /* When 'spellcapcheck' is set compile the regexp program. */
|
|
5818 else if (varp == &(curbuf->b_p_spc))
|
|
5819 {
|
389
|
5820 errmsg = compile_cap_prog(curbuf);
|
386
|
5821 }
|
344
|
5822 /* 'spellsuggest' */
|
|
5823 else if (varp == &p_sps)
|
|
5824 {
|
374
|
5825 if (spell_check_sps() != OK)
|
344
|
5826 errmsg = e_invarg;
|
|
5827 }
|
484
|
5828 /* 'mkspellmem' */
|
|
5829 else if (varp == &p_msm)
|
|
5830 {
|
|
5831 if (spell_check_msm() != OK)
|
|
5832 errmsg = e_invarg;
|
|
5833 }
|
221
|
5834 #endif
|
|
5835
|
7
|
5836 #ifdef FEAT_QUICKFIX
|
|
5837 /* When 'bufhidden' is set, check for valid value. */
|
|
5838 else if (gvarp == &p_bh)
|
|
5839 {
|
|
5840 if (check_opt_strings(curbuf->b_p_bh, p_bufhidden_values, FALSE) != OK)
|
|
5841 errmsg = e_invarg;
|
|
5842 }
|
|
5843
|
|
5844 /* When 'buftype' is set, check for valid value. */
|
|
5845 else if (gvarp == &p_bt)
|
|
5846 {
|
|
5847 if (check_opt_strings(curbuf->b_p_bt, p_buftype_values, FALSE) != OK)
|
|
5848 errmsg = e_invarg;
|
|
5849 else
|
|
5850 {
|
|
5851 # ifdef FEAT_WINDOWS
|
|
5852 if (curwin->w_status_height)
|
|
5853 {
|
|
5854 curwin->w_redr_status = TRUE;
|
|
5855 redraw_later(VALID);
|
|
5856 }
|
|
5857 # endif
|
|
5858 curbuf->b_help = (curbuf->b_p_bt[0] == 'h');
|
|
5859 }
|
|
5860 }
|
|
5861 #endif
|
|
5862
|
|
5863 #ifdef FEAT_STL_OPT
|
|
5864 /* 'statusline' or 'rulerformat' */
|
40
|
5865 else if (gvarp == &p_stl || varp == &p_ruf)
|
7
|
5866 {
|
|
5867 int wid;
|
|
5868
|
|
5869 if (varp == &p_ruf) /* reset ru_wid first */
|
|
5870 ru_wid = 0;
|
|
5871 s = *varp;
|
|
5872 if (varp == &p_ruf && *s == '%')
|
|
5873 {
|
|
5874 /* set ru_wid if 'ruf' starts with "%99(" */
|
|
5875 if (*++s == '-') /* ignore a '-' */
|
|
5876 s++;
|
|
5877 wid = getdigits(&s);
|
|
5878 if (wid && *s == '(' && (errmsg = check_stl_option(p_ruf)) == NULL)
|
|
5879 ru_wid = wid;
|
|
5880 else
|
|
5881 errmsg = check_stl_option(p_ruf);
|
|
5882 }
|
|
5883 else
|
|
5884 errmsg = check_stl_option(s);
|
40
|
5885 if (varp == &p_ruf && errmsg == NULL)
|
7
|
5886 comp_col();
|
|
5887 }
|
|
5888 #endif
|
|
5889
|
|
5890 #ifdef FEAT_INS_EXPAND
|
|
5891 /* check if it is a valid value for 'complete' -- Acevedo */
|
|
5892 else if (gvarp == &p_cpt)
|
|
5893 {
|
|
5894 for (s = *varp; *s;)
|
|
5895 {
|
|
5896 while(*s == ',' || *s == ' ')
|
|
5897 s++;
|
|
5898 if (!*s)
|
|
5899 break;
|
|
5900 if (vim_strchr((char_u *)".wbuksid]tU", *s) == NULL)
|
|
5901 {
|
|
5902 errmsg = illegal_char(errbuf, *s);
|
|
5903 break;
|
|
5904 }
|
|
5905 if (*++s != NUL && *s != ',' && *s != ' ')
|
|
5906 {
|
|
5907 if (s[-1] == 'k' || s[-1] == 's')
|
|
5908 {
|
|
5909 /* skip optional filename after 'k' and 's' */
|
|
5910 while (*s && *s != ',' && *s != ' ')
|
|
5911 {
|
|
5912 if (*s == '\\')
|
|
5913 ++s;
|
|
5914 ++s;
|
|
5915 }
|
|
5916 }
|
|
5917 else
|
|
5918 {
|
|
5919 if (errbuf != NULL)
|
|
5920 {
|
|
5921 sprintf((char *)errbuf,
|
|
5922 _("E535: Illegal character after <%c>"),
|
|
5923 *--s);
|
|
5924 errmsg = errbuf;
|
|
5925 }
|
|
5926 else
|
|
5927 errmsg = (char_u *)"";
|
|
5928 break;
|
|
5929 }
|
|
5930 }
|
|
5931 }
|
|
5932 }
|
|
5933 #endif /* FEAT_INS_EXPAND */
|
|
5934
|
|
5935
|
|
5936 #if defined(FEAT_TOOLBAR) && !defined(FEAT_GUI_W32)
|
|
5937 else if (varp == &p_toolbar)
|
|
5938 {
|
|
5939 if (opt_strings_flags(p_toolbar, p_toolbar_values,
|
|
5940 &toolbar_flags, TRUE) != OK)
|
|
5941 errmsg = e_invarg;
|
|
5942 else
|
|
5943 {
|
|
5944 out_flush();
|
|
5945 gui_mch_show_toolbar((toolbar_flags &
|
|
5946 (TOOLBAR_TEXT | TOOLBAR_ICONS)) != 0);
|
|
5947 }
|
|
5948 }
|
|
5949 #endif
|
|
5950
|
|
5951 #if defined(FEAT_TOOLBAR) && defined(FEAT_GUI_GTK) && defined(HAVE_GTK2)
|
|
5952 /* 'toolbariconsize': GTK+ 2 only */
|
|
5953 else if (varp == &p_tbis)
|
|
5954 {
|
|
5955 if (opt_strings_flags(p_tbis, p_tbis_values, &tbis_flags, FALSE) != OK)
|
|
5956 errmsg = e_invarg;
|
|
5957 else
|
|
5958 {
|
|
5959 out_flush();
|
|
5960 gui_mch_show_toolbar((toolbar_flags &
|
|
5961 (TOOLBAR_TEXT | TOOLBAR_ICONS)) != 0);
|
|
5962 }
|
|
5963 }
|
|
5964 #endif
|
|
5965
|
|
5966 /* 'pastetoggle': translate key codes like in a mapping */
|
|
5967 else if (varp == &p_pt)
|
|
5968 {
|
|
5969 if (*p_pt)
|
|
5970 {
|
|
5971 (void)replace_termcodes(p_pt, &p, TRUE, TRUE);
|
|
5972 if (p != NULL)
|
|
5973 {
|
|
5974 if (new_value_alloced)
|
|
5975 free_string_option(p_pt);
|
|
5976 p_pt = p;
|
|
5977 new_value_alloced = TRUE;
|
|
5978 }
|
|
5979 }
|
|
5980 }
|
|
5981
|
|
5982 /* 'backspace' */
|
|
5983 else if (varp == &p_bs)
|
|
5984 {
|
|
5985 if (VIM_ISDIGIT(*p_bs))
|
|
5986 {
|
|
5987 if (*p_bs >'2' || p_bs[1] != NUL)
|
|
5988 errmsg = e_invarg;
|
|
5989 }
|
|
5990 else if (check_opt_strings(p_bs, p_bs_values, TRUE) != OK)
|
|
5991 errmsg = e_invarg;
|
|
5992 }
|
|
5993
|
|
5994 /* 'casemap' */
|
|
5995 else if (varp == &p_cmp)
|
|
5996 {
|
|
5997 if (opt_strings_flags(p_cmp, p_cmp_values, &cmp_flags, TRUE) != OK)
|
|
5998 errmsg = e_invarg;
|
|
5999 }
|
|
6000
|
|
6001 #ifdef FEAT_DIFF
|
|
6002 /* 'diffopt' */
|
|
6003 else if (varp == &p_dip)
|
|
6004 {
|
|
6005 if (diffopt_changed() == FAIL)
|
|
6006 errmsg = e_invarg;
|
|
6007 }
|
|
6008 #endif
|
|
6009
|
|
6010 #ifdef FEAT_FOLDING
|
|
6011 /* 'foldmethod' */
|
|
6012 else if (gvarp == &curwin->w_allbuf_opt.wo_fdm)
|
|
6013 {
|
|
6014 if (check_opt_strings(*varp, p_fdm_values, FALSE) != OK
|
|
6015 || *curwin->w_p_fdm == NUL)
|
|
6016 errmsg = e_invarg;
|
|
6017 else
|
|
6018 foldUpdateAll(curwin);
|
|
6019 }
|
|
6020 # ifdef FEAT_EVAL
|
|
6021 /* 'foldexpr' */
|
|
6022 else if (varp == &curwin->w_p_fde)
|
|
6023 {
|
|
6024 if (foldmethodIsExpr(curwin))
|
|
6025 foldUpdateAll(curwin);
|
|
6026 }
|
|
6027 # endif
|
|
6028 /* 'foldmarker' */
|
|
6029 else if (gvarp == &curwin->w_allbuf_opt.wo_fmr)
|
|
6030 {
|
|
6031 p = vim_strchr(*varp, ',');
|
|
6032 if (p == NULL)
|
|
6033 errmsg = (char_u *)N_("E536: comma required");
|
|
6034 else if (p == *varp || p[1] == NUL)
|
|
6035 errmsg = e_invarg;
|
|
6036 else if (foldmethodIsMarker(curwin))
|
|
6037 foldUpdateAll(curwin);
|
|
6038 }
|
|
6039 /* 'commentstring' */
|
|
6040 else if (gvarp == &p_cms)
|
|
6041 {
|
|
6042 if (**varp != NUL && strstr((char *)*varp, "%s") == NULL)
|
|
6043 errmsg = (char_u *)N_("E537: 'commentstring' must be empty or contain %s");
|
|
6044 }
|
|
6045 /* 'foldopen' */
|
|
6046 else if (varp == &p_fdo)
|
|
6047 {
|
|
6048 if (opt_strings_flags(p_fdo, p_fdo_values, &fdo_flags, TRUE) != OK)
|
|
6049 errmsg = e_invarg;
|
|
6050 }
|
|
6051 /* 'foldclose' */
|
|
6052 else if (varp == &p_fcl)
|
|
6053 {
|
|
6054 if (check_opt_strings(p_fcl, p_fcl_values, TRUE) != OK)
|
|
6055 errmsg = e_invarg;
|
|
6056 }
|
|
6057 #endif
|
|
6058
|
|
6059 #ifdef FEAT_VIRTUALEDIT
|
|
6060 /* 'virtualedit' */
|
|
6061 else if (varp == &p_ve)
|
|
6062 {
|
|
6063 if (opt_strings_flags(p_ve, p_ve_values, &ve_flags, TRUE) != OK)
|
|
6064 errmsg = e_invarg;
|
|
6065 else if (STRCMP(p_ve, oldval) != 0)
|
|
6066 {
|
|
6067 /* Recompute cursor position in case the new 've' setting
|
|
6068 * changes something. */
|
|
6069 validate_virtcol();
|
|
6070 coladvance(curwin->w_virtcol);
|
|
6071 }
|
|
6072 }
|
|
6073 #endif
|
|
6074
|
|
6075 #if defined(FEAT_CSCOPE) && defined(FEAT_QUICKFIX)
|
|
6076 else if (varp == &p_csqf)
|
|
6077 {
|
|
6078 if (p_csqf != NULL)
|
|
6079 {
|
|
6080 p = p_csqf;
|
|
6081 while (*p != NUL)
|
|
6082 {
|
|
6083 if (vim_strchr((char_u *)CSQF_CMDS, *p) == NULL
|
|
6084 || p[1] == NUL
|
|
6085 || vim_strchr((char_u *)CSQF_FLAGS, p[1]) == NULL
|
|
6086 || (p[2] != NUL && p[2] != ','))
|
|
6087 {
|
|
6088 errmsg = e_invarg;
|
|
6089 break;
|
|
6090 }
|
|
6091 else if (p[2] == NUL)
|
|
6092 break;
|
|
6093 else
|
|
6094 p += 3;
|
|
6095 }
|
|
6096 }
|
|
6097 }
|
|
6098 #endif
|
|
6099
|
|
6100 /* Options that are a list of flags. */
|
|
6101 else
|
|
6102 {
|
|
6103 p = NULL;
|
|
6104 if (varp == &p_ww)
|
|
6105 p = (char_u *)WW_ALL;
|
|
6106 if (varp == &p_shm)
|
|
6107 p = (char_u *)SHM_ALL;
|
|
6108 else if (varp == &(p_cpo))
|
|
6109 p = (char_u *)CPO_ALL;
|
|
6110 else if (varp == &(curbuf->b_p_fo))
|
|
6111 p = (char_u *)FO_ALL;
|
|
6112 else if (varp == &p_mouse)
|
|
6113 {
|
|
6114 #ifdef FEAT_MOUSE
|
|
6115 p = (char_u *)MOUSE_ALL;
|
|
6116 #else
|
|
6117 if (*p_mouse != NUL)
|
|
6118 errmsg = (char_u *)N_("E538: No mouse support");
|
|
6119 #endif
|
|
6120 }
|
|
6121 #if defined(FEAT_GUI)
|
|
6122 else if (varp == &p_go)
|
|
6123 p = (char_u *)GO_ALL;
|
|
6124 #endif
|
|
6125 if (p != NULL)
|
|
6126 {
|
|
6127 for (s = *varp; *s; ++s)
|
|
6128 if (vim_strchr(p, *s) == NULL)
|
|
6129 {
|
|
6130 errmsg = illegal_char(errbuf, *s);
|
|
6131 break;
|
|
6132 }
|
|
6133 }
|
|
6134 }
|
|
6135
|
|
6136 /*
|
|
6137 * If error detected, restore the previous value.
|
|
6138 */
|
|
6139 if (errmsg != NULL)
|
|
6140 {
|
|
6141 if (new_value_alloced)
|
|
6142 free_string_option(*varp);
|
|
6143 *varp = oldval;
|
|
6144 /*
|
|
6145 * When resetting some values, need to act on it.
|
|
6146 */
|
|
6147 if (did_chartab)
|
|
6148 (void)init_chartab();
|
|
6149 if (varp == &p_hl)
|
|
6150 (void)highlight_changed();
|
|
6151 }
|
|
6152 else
|
|
6153 {
|
|
6154 #ifdef FEAT_EVAL
|
|
6155 /* Remember where the option was set. */
|
|
6156 options[opt_idx].scriptID = current_SID;
|
|
6157 #endif
|
|
6158 /*
|
|
6159 * Free string options that are in allocated memory.
|
24
|
6160 * Use "free_oldval", because recursiveness may change the flags under
|
|
6161 * our fingers (esp. init_highlight()).
|
7
|
6162 */
|
24
|
6163 if (free_oldval)
|
7
|
6164 free_string_option(oldval);
|
|
6165 if (new_value_alloced)
|
|
6166 options[opt_idx].flags |= P_ALLOCED;
|
|
6167 else
|
|
6168 options[opt_idx].flags &= ~P_ALLOCED;
|
|
6169
|
|
6170 if ((opt_flags & (OPT_LOCAL | OPT_GLOBAL)) == 0
|
|
6171 && (int)options[opt_idx].indir >= PV_BOTH)
|
|
6172 {
|
|
6173 /* global option with local value set to use global value; free
|
|
6174 * the local value and make it empty */
|
|
6175 p = get_varp_scope(&(options[opt_idx]), OPT_LOCAL);
|
|
6176 free_string_option(*(char_u **)p);
|
|
6177 *(char_u **)p = empty_option;
|
|
6178 }
|
|
6179
|
|
6180 /* May set global value for local option. */
|
|
6181 else if (!(opt_flags & OPT_LOCAL) && opt_flags != OPT_GLOBAL)
|
|
6182 set_string_option_global(opt_idx, varp);
|
480
|
6183
|
|
6184 #ifdef FEAT_AUTOCMD
|
|
6185 /*
|
|
6186 * Trigger the autocommand only after setting the flags.
|
|
6187 */
|
|
6188 # ifdef FEAT_SYN_HL
|
|
6189 /* When 'syntax' is set, load the syntax of that name */
|
|
6190 if (varp == &(curbuf->b_p_syn))
|
|
6191 {
|
|
6192 apply_autocmds(EVENT_SYNTAX, curbuf->b_p_syn,
|
|
6193 curbuf->b_fname, TRUE, curbuf);
|
|
6194 }
|
|
6195 # endif
|
|
6196 else if (varp == &(curbuf->b_p_ft))
|
|
6197 {
|
|
6198 /* 'filetype' is set, trigger the FileType autocommand */
|
|
6199 did_filetype = TRUE;
|
|
6200 apply_autocmds(EVENT_FILETYPE, curbuf->b_p_ft,
|
|
6201 curbuf->b_fname, TRUE, curbuf);
|
|
6202 }
|
|
6203 #endif
|
|
6204 #ifdef FEAT_SYN_HL
|
|
6205 if (varp == &(curbuf->b_p_spl))
|
|
6206 {
|
|
6207 char_u fname[200];
|
|
6208
|
|
6209 /*
|
|
6210 * Source the spell/LANG.vim in 'runtimepath'.
|
|
6211 * They could set 'spellcapcheck' depending on the language.
|
|
6212 * Use the first name in 'spelllang' up to '_region' or
|
|
6213 * '.encoding'.
|
|
6214 */
|
|
6215 for (p = curbuf->b_p_spl; *p != NUL; ++p)
|
|
6216 if (vim_strchr((char_u *)"_.,", *p) != NULL)
|
|
6217 break;
|
|
6218 vim_snprintf((char *)fname, 200, "spell/%.*s.vim",
|
|
6219 (int)(p - curbuf->b_p_spl), curbuf->b_p_spl);
|
|
6220 source_runtime(fname, TRUE);
|
|
6221 }
|
|
6222 #endif
|
7
|
6223 }
|
|
6224
|
|
6225 #ifdef FEAT_MOUSE
|
|
6226 if (varp == &p_mouse)
|
|
6227 {
|
|
6228 # ifdef FEAT_MOUSE_TTY
|
|
6229 if (*p_mouse == NUL)
|
|
6230 mch_setmouse(FALSE); /* switch mouse off */
|
|
6231 else
|
|
6232 # endif
|
|
6233 setmouse(); /* in case 'mouse' changed */
|
|
6234 }
|
|
6235 #endif
|
|
6236
|
|
6237 if (curwin->w_curswant != MAXCOL)
|
|
6238 curwin->w_set_curswant = TRUE; /* in case 'showbreak' changed */
|
|
6239 check_redraw(options[opt_idx].flags);
|
|
6240
|
|
6241 return errmsg;
|
|
6242 }
|
|
6243
|
|
6244 /*
|
|
6245 * Handle setting 'listchars' or 'fillchars'.
|
|
6246 * Returns error message, NULL if it's OK.
|
|
6247 */
|
|
6248 static char_u *
|
|
6249 set_chars_option(varp)
|
|
6250 char_u **varp;
|
|
6251 {
|
|
6252 int round, i, len, entries;
|
|
6253 char_u *p, *s;
|
|
6254 int c1, c2 = 0;
|
|
6255 struct charstab
|
|
6256 {
|
|
6257 int *cp;
|
|
6258 char *name;
|
|
6259 };
|
|
6260 #if defined(FEAT_WINDOWS) || defined(FEAT_FOLDING)
|
|
6261 static struct charstab filltab[] =
|
|
6262 {
|
|
6263 {&fill_stl, "stl"},
|
|
6264 {&fill_stlnc, "stlnc"},
|
|
6265 {&fill_vert, "vert"},
|
|
6266 {&fill_fold, "fold"},
|
|
6267 {&fill_diff, "diff"},
|
|
6268 };
|
|
6269 #endif
|
|
6270 static struct charstab lcstab[] =
|
|
6271 {
|
|
6272 {&lcs_eol, "eol"},
|
|
6273 {&lcs_ext, "extends"},
|
12
|
6274 {&lcs_nbsp, "nbsp"},
|
7
|
6275 {&lcs_prec, "precedes"},
|
|
6276 {&lcs_tab2, "tab"},
|
|
6277 {&lcs_trail, "trail"},
|
|
6278 };
|
|
6279 struct charstab *tab;
|
|
6280
|
|
6281 #if defined(FEAT_WINDOWS) || defined(FEAT_FOLDING)
|
|
6282 if (varp == &p_lcs)
|
|
6283 #endif
|
|
6284 {
|
|
6285 tab = lcstab;
|
|
6286 entries = sizeof(lcstab) / sizeof(struct charstab);
|
|
6287 }
|
|
6288 #if defined(FEAT_WINDOWS) || defined(FEAT_FOLDING)
|
|
6289 else
|
|
6290 {
|
|
6291 tab = filltab;
|
|
6292 entries = sizeof(filltab) / sizeof(struct charstab);
|
|
6293 }
|
|
6294 #endif
|
|
6295
|
|
6296 /* first round: check for valid value, second round: assign values */
|
|
6297 for (round = 0; round <= 1; ++round)
|
|
6298 {
|
|
6299 if (round)
|
|
6300 {
|
|
6301 /* After checking that the value is valid: set defaults: space for
|
|
6302 * 'fillchars', NUL for 'listchars' */
|
|
6303 for (i = 0; i < entries; ++i)
|
|
6304 *(tab[i].cp) = (varp == &p_lcs ? NUL : ' ');
|
|
6305 if (varp == &p_lcs)
|
|
6306 lcs_tab1 = NUL;
|
|
6307 #if defined(FEAT_WINDOWS) || defined(FEAT_FOLDING)
|
|
6308 else
|
|
6309 fill_diff = '-';
|
|
6310 #endif
|
|
6311 }
|
|
6312 p = *varp;
|
|
6313 while (*p)
|
|
6314 {
|
|
6315 for (i = 0; i < entries; ++i)
|
|
6316 {
|
|
6317 len = (int)STRLEN(tab[i].name);
|
|
6318 if (STRNCMP(p, tab[i].name, len) == 0
|
|
6319 && p[len] == ':'
|
|
6320 && p[len + 1] != NUL)
|
|
6321 {
|
|
6322 s = p + len + 1;
|
|
6323 #ifdef FEAT_MBYTE
|
|
6324 c1 = mb_ptr2char_adv(&s);
|
|
6325 #else
|
|
6326 c1 = *s++;
|
|
6327 #endif
|
|
6328 if (tab[i].cp == &lcs_tab2)
|
|
6329 {
|
|
6330 if (*s == NUL)
|
|
6331 continue;
|
|
6332 #ifdef FEAT_MBYTE
|
|
6333 c2 = mb_ptr2char_adv(&s);
|
|
6334 #else
|
|
6335 c2 = *s++;
|
|
6336 #endif
|
|
6337 }
|
|
6338 if (*s == ',' || *s == NUL)
|
|
6339 {
|
|
6340 if (round)
|
|
6341 {
|
|
6342 if (tab[i].cp == &lcs_tab2)
|
|
6343 {
|
|
6344 lcs_tab1 = c1;
|
|
6345 lcs_tab2 = c2;
|
|
6346 }
|
|
6347 else
|
|
6348 *(tab[i].cp) = c1;
|
|
6349
|
|
6350 }
|
|
6351 p = s;
|
|
6352 break;
|
|
6353 }
|
|
6354 }
|
|
6355 }
|
|
6356
|
|
6357 if (i == entries)
|
|
6358 return e_invarg;
|
|
6359 if (*p == ',')
|
|
6360 ++p;
|
|
6361 }
|
|
6362 }
|
|
6363
|
|
6364 return NULL; /* no error */
|
|
6365 }
|
|
6366
|
|
6367 #ifdef FEAT_STL_OPT
|
|
6368 /*
|
|
6369 * Check validity of options with the 'statusline' format.
|
|
6370 * Return error message or NULL.
|
|
6371 */
|
|
6372 char_u *
|
|
6373 check_stl_option(s)
|
|
6374 char_u *s;
|
|
6375 {
|
|
6376 int itemcnt = 0;
|
|
6377 int groupdepth = 0;
|
|
6378 static char_u errbuf[80];
|
|
6379
|
|
6380 while (*s && itemcnt < STL_MAX_ITEM)
|
|
6381 {
|
|
6382 /* Check for valid keys after % sequences */
|
|
6383 while (*s && *s != '%')
|
|
6384 s++;
|
|
6385 if (!*s)
|
|
6386 break;
|
|
6387 s++;
|
|
6388 if (*s != '%' && *s != ')')
|
|
6389 ++itemcnt;
|
|
6390 if (*s == '%' || *s == STL_TRUNCMARK || *s == STL_MIDDLEMARK)
|
|
6391 {
|
|
6392 s++;
|
|
6393 continue;
|
|
6394 }
|
|
6395 if (*s == ')')
|
|
6396 {
|
|
6397 s++;
|
|
6398 if (--groupdepth < 0)
|
|
6399 break;
|
|
6400 continue;
|
|
6401 }
|
|
6402 if (*s == '-')
|
|
6403 s++;
|
|
6404 while (VIM_ISDIGIT(*s))
|
|
6405 s++;
|
|
6406 if (*s == STL_HIGHLIGHT)
|
|
6407 continue;
|
|
6408 if (*s == '.')
|
|
6409 {
|
|
6410 s++;
|
|
6411 while (*s && VIM_ISDIGIT(*s))
|
|
6412 s++;
|
|
6413 }
|
|
6414 if (*s == '(')
|
|
6415 {
|
|
6416 groupdepth++;
|
|
6417 continue;
|
|
6418 }
|
|
6419 if (vim_strchr(STL_ALL, *s) == NULL)
|
|
6420 {
|
|
6421 return illegal_char(errbuf, *s);
|
|
6422 }
|
|
6423 if (*s == '{')
|
|
6424 {
|
|
6425 s++;
|
|
6426 while (*s != '}' && *s)
|
|
6427 s++;
|
|
6428 if (*s != '}')
|
|
6429 return (char_u *)N_("E540: Unclosed expression sequence");
|
|
6430 }
|
|
6431 }
|
|
6432 if (itemcnt >= STL_MAX_ITEM)
|
|
6433 return (char_u *)N_("E541: too many items");
|
|
6434 if (groupdepth != 0)
|
|
6435 return (char_u *)N_("E542: unbalanced groups");
|
|
6436 return NULL;
|
|
6437 }
|
|
6438 #endif
|
|
6439
|
|
6440 #ifdef FEAT_CLIPBOARD
|
|
6441 /*
|
|
6442 * Extract the items in the 'clipboard' option and set global values.
|
|
6443 */
|
|
6444 static char_u *
|
|
6445 check_clipboard_option()
|
|
6446 {
|
|
6447 int new_unnamed = FALSE;
|
|
6448 int new_autoselect = FALSE;
|
|
6449 int new_autoselectml = FALSE;
|
|
6450 regprog_T *new_exclude_prog = NULL;
|
|
6451 char_u *errmsg = NULL;
|
|
6452 char_u *p;
|
|
6453
|
|
6454 for (p = p_cb; *p != NUL; )
|
|
6455 {
|
|
6456 if (STRNCMP(p, "unnamed", 7) == 0 && (p[7] == ',' || p[7] == NUL))
|
|
6457 {
|
|
6458 new_unnamed = TRUE;
|
|
6459 p += 7;
|
|
6460 }
|
|
6461 else if (STRNCMP(p, "autoselect", 10) == 0
|
|
6462 && (p[10] == ',' || p[10] == NUL))
|
|
6463 {
|
|
6464 new_autoselect = TRUE;
|
|
6465 p += 10;
|
|
6466 }
|
|
6467 else if (STRNCMP(p, "autoselectml", 12) == 0
|
|
6468 && (p[12] == ',' || p[12] == NUL))
|
|
6469 {
|
|
6470 new_autoselectml = TRUE;
|
|
6471 p += 12;
|
|
6472 }
|
|
6473 else if (STRNCMP(p, "exclude:", 8) == 0 && new_exclude_prog == NULL)
|
|
6474 {
|
|
6475 p += 8;
|
|
6476 new_exclude_prog = vim_regcomp(p, RE_MAGIC);
|
|
6477 if (new_exclude_prog == NULL)
|
|
6478 errmsg = e_invarg;
|
|
6479 break;
|
|
6480 }
|
|
6481 else
|
|
6482 {
|
|
6483 errmsg = e_invarg;
|
|
6484 break;
|
|
6485 }
|
|
6486 if (*p == ',')
|
|
6487 ++p;
|
|
6488 }
|
|
6489 if (errmsg == NULL)
|
|
6490 {
|
|
6491 clip_unnamed = new_unnamed;
|
|
6492 clip_autoselect = new_autoselect;
|
|
6493 clip_autoselectml = new_autoselectml;
|
|
6494 vim_free(clip_exclude_prog);
|
|
6495 clip_exclude_prog = new_exclude_prog;
|
|
6496 }
|
|
6497 else
|
|
6498 vim_free(new_exclude_prog);
|
|
6499
|
|
6500 return errmsg;
|
|
6501 }
|
|
6502 #endif
|
|
6503
|
386
|
6504 #ifdef FEAT_SYN_HL
|
|
6505 /*
|
|
6506 * Set curbuf->b_cap_prog to the regexp program for 'spellcapcheck'.
|
|
6507 * Return error message when failed, NULL when OK.
|
|
6508 */
|
|
6509 static char_u *
|
389
|
6510 compile_cap_prog(buf)
|
|
6511 buf_T *buf;
|
386
|
6512 {
|
389
|
6513 regprog_T *rp = buf->b_cap_prog;
|
|
6514
|
|
6515 if (*buf->b_p_spc == NUL)
|
|
6516 {
|
|
6517 buf->b_cap_prog = NULL;
|
386
|
6518 vim_free(rp);
|
|
6519 return NULL;
|
|
6520 }
|
|
6521
|
|
6522 /* Prepend a ^ so that we only match at one column */
|
389
|
6523 vim_snprintf((char *)IObuff, IOSIZE, "^%s", buf->b_p_spc);
|
|
6524 buf->b_cap_prog = vim_regcomp(IObuff, RE_MAGIC);
|
|
6525 if (buf->b_cap_prog == NULL)
|
|
6526 {
|
|
6527 buf->b_cap_prog = rp;
|
386
|
6528 return e_invarg;
|
|
6529 }
|
|
6530
|
|
6531 vim_free(rp);
|
|
6532 return NULL;
|
|
6533 }
|
|
6534 #endif
|
|
6535
|
7
|
6536 /*
|
|
6537 * Set the value of a boolean option, and take care of side effects.
|
|
6538 * Returns NULL for success, or an error message for an error.
|
|
6539 */
|
|
6540 static char_u *
|
|
6541 set_bool_option(opt_idx, varp, value, opt_flags)
|
|
6542 int opt_idx; /* index in options[] table */
|
|
6543 char_u *varp; /* pointer to the option variable */
|
|
6544 int value; /* new value */
|
|
6545 int opt_flags; /* OPT_LOCAL and/or OPT_GLOBAL */
|
|
6546 {
|
|
6547 int old_value = *(int *)varp;
|
|
6548
|
|
6549 #ifdef FEAT_GUI
|
|
6550 need_mouse_correct = TRUE;
|
|
6551 #endif
|
|
6552
|
|
6553 /* Disallow changing some options from secure mode */
|
|
6554 if ((secure
|
|
6555 #ifdef HAVE_SANDBOX
|
|
6556 || sandbox != 0
|
|
6557 #endif
|
|
6558 ) && (options[opt_idx].flags & P_SECURE))
|
|
6559 return e_secure;
|
|
6560
|
|
6561 *(int *)varp = value; /* set the new value */
|
|
6562 #ifdef FEAT_EVAL
|
|
6563 /* Remember where the option was set. */
|
|
6564 options[opt_idx].scriptID = current_SID;
|
|
6565 #endif
|
|
6566
|
|
6567 /* May set global value for local option. */
|
|
6568 if ((opt_flags & (OPT_LOCAL | OPT_GLOBAL)) == 0)
|
|
6569 *(int *)get_varp_scope(&(options[opt_idx]), OPT_GLOBAL) = value;
|
|
6570
|
|
6571 /*
|
|
6572 * Handle side effects of changing a bool option.
|
|
6573 */
|
|
6574
|
|
6575 /* 'compatible' */
|
|
6576 if ((int *)varp == &p_cp)
|
|
6577 {
|
|
6578 compatible_set();
|
|
6579 }
|
|
6580
|
|
6581 /* when 'readonly' is reset globally, also reset readonlymode */
|
|
6582 else if ((int *)varp == &curbuf->b_p_ro)
|
|
6583 {
|
|
6584 if (!curbuf->b_p_ro && (opt_flags & OPT_LOCAL) == 0)
|
|
6585 readonlymode = FALSE;
|
|
6586 #ifdef FEAT_TITLE
|
|
6587 need_maketitle = TRUE;
|
|
6588 #endif
|
|
6589 }
|
|
6590
|
|
6591 #ifdef FEAT_TITLE
|
|
6592 /* when 'modifiable' is changed, redraw the window title */
|
|
6593 else if ((int *)varp == &curbuf->b_p_ma)
|
|
6594 need_maketitle = TRUE;
|
|
6595 /* when 'endofline' is changed, redraw the window title */
|
|
6596 else if ((int *)varp == &curbuf->b_p_eol)
|
|
6597 need_maketitle = TRUE;
|
|
6598 #endif
|
|
6599
|
|
6600 /* when 'bin' is set also set some other options */
|
|
6601 else if ((int *)varp == &curbuf->b_p_bin)
|
|
6602 {
|
|
6603 set_options_bin(old_value, curbuf->b_p_bin, opt_flags);
|
|
6604 #ifdef FEAT_TITLE
|
|
6605 need_maketitle = TRUE;
|
|
6606 #endif
|
|
6607 }
|
|
6608
|
|
6609 #ifdef FEAT_AUTOCMD
|
|
6610 /* when 'buflisted' changes, trigger autocommands */
|
|
6611 else if ((int *)varp == &curbuf->b_p_bl && old_value != curbuf->b_p_bl)
|
|
6612 {
|
|
6613 apply_autocmds(curbuf->b_p_bl ? EVENT_BUFADD : EVENT_BUFDELETE,
|
|
6614 NULL, NULL, TRUE, curbuf);
|
|
6615 }
|
|
6616 #endif
|
|
6617
|
|
6618 /* when 'swf' is set, create swapfile, when reset remove swapfile */
|
|
6619 else if ((int *)varp == &curbuf->b_p_swf)
|
|
6620 {
|
|
6621 if (curbuf->b_p_swf && p_uc)
|
|
6622 ml_open_file(curbuf); /* create the swap file */
|
|
6623 else
|
|
6624 mf_close_file(curbuf, TRUE); /* remove the swap file */
|
|
6625 }
|
|
6626
|
|
6627 /* when 'terse' is set change 'shortmess' */
|
|
6628 else if ((int *)varp == &p_terse)
|
|
6629 {
|
|
6630 char_u *p;
|
|
6631
|
|
6632 p = vim_strchr(p_shm, SHM_SEARCH);
|
|
6633
|
|
6634 /* insert 's' in p_shm */
|
|
6635 if (p_terse && p == NULL)
|
|
6636 {
|
|
6637 STRCPY(IObuff, p_shm);
|
|
6638 STRCAT(IObuff, "s");
|
|
6639 set_string_option_direct((char_u *)"shm", -1, IObuff, OPT_FREE);
|
|
6640 }
|
|
6641 /* remove 's' from p_shm */
|
|
6642 else if (!p_terse && p != NULL)
|
|
6643 mch_memmove(p, p + 1, STRLEN(p));
|
|
6644 }
|
|
6645
|
|
6646 /* when 'paste' is set or reset also change other options */
|
|
6647 else if ((int *)varp == &p_paste)
|
|
6648 {
|
|
6649 paste_option_changed();
|
|
6650 }
|
|
6651
|
|
6652 /* when 'insertmode' is set from an autocommand need to do work here */
|
|
6653 else if ((int *)varp == &p_im)
|
|
6654 {
|
|
6655 if (p_im)
|
|
6656 {
|
|
6657 if ((State & INSERT) == 0)
|
|
6658 need_start_insertmode = TRUE;
|
|
6659 stop_insert_mode = FALSE;
|
|
6660 }
|
|
6661 else
|
|
6662 {
|
|
6663 need_start_insertmode = FALSE;
|
|
6664 stop_insert_mode = TRUE;
|
|
6665 if (p_smd && restart_edit != 0)
|
|
6666 clear_cmdline = TRUE; /* remove "(insert)" */
|
|
6667 restart_edit = 0;
|
|
6668 }
|
|
6669 }
|
|
6670
|
|
6671 /* when 'ignorecase' is set or reset and 'hlsearch' is set, redraw */
|
|
6672 else if ((int *)varp == &p_ic && p_hls)
|
|
6673 {
|
|
6674 redraw_all_later(NOT_VALID);
|
|
6675 }
|
|
6676
|
|
6677 #ifdef FEAT_SEARCH_EXTRA
|
|
6678 /* when 'hlsearch' is set or reset: reset no_hlsearch */
|
|
6679 else if ((int *)varp == &p_hls)
|
|
6680 {
|
|
6681 no_hlsearch = FALSE;
|
|
6682 }
|
|
6683 #endif
|
|
6684
|
|
6685 #ifdef FEAT_SCROLLBIND
|
|
6686 /* when 'scrollbind' is set: snapshot the current position to avoid a jump
|
|
6687 * at the end of normal_cmd() */
|
|
6688 else if ((int *)varp == &curwin->w_p_scb)
|
|
6689 {
|
|
6690 if (curwin->w_p_scb)
|
|
6691 do_check_scrollbind(FALSE);
|
|
6692 }
|
|
6693 #endif
|
|
6694
|
|
6695 #if defined(FEAT_WINDOWS) && defined(FEAT_QUICKFIX)
|
|
6696 /* There can be only one window with 'previewwindow' set. */
|
|
6697 else if ((int *)varp == &curwin->w_p_pvw)
|
|
6698 {
|
|
6699 if (curwin->w_p_pvw)
|
|
6700 {
|
|
6701 win_T *win;
|
|
6702
|
|
6703 for (win = firstwin; win != NULL; win = win->w_next)
|
|
6704 if (win->w_p_pvw && win != curwin)
|
|
6705 {
|
|
6706 curwin->w_p_pvw = FALSE;
|
|
6707 return (char_u *)N_("E590: A preview window already exists");
|
|
6708 }
|
|
6709 }
|
|
6710 }
|
|
6711 #endif
|
|
6712
|
|
6713 /* when 'textmode' is set or reset also change 'fileformat' */
|
|
6714 else if ((int *)varp == &curbuf->b_p_tx)
|
|
6715 {
|
|
6716 set_fileformat(curbuf->b_p_tx ? EOL_DOS : EOL_UNIX, opt_flags);
|
|
6717 }
|
|
6718
|
|
6719 /* when 'textauto' is set or reset also change 'fileformats' */
|
|
6720 else if ((int *)varp == &p_ta)
|
|
6721 {
|
|
6722 set_string_option_direct((char_u *)"ffs", -1,
|
|
6723 p_ta ? (char_u *)DFLT_FFS_VIM : (char_u *)"",
|
|
6724 OPT_FREE | opt_flags);
|
|
6725 }
|
|
6726
|
|
6727 /*
|
|
6728 * When 'lisp' option changes include/exclude '-' in
|
|
6729 * keyword characters.
|
|
6730 */
|
|
6731 #ifdef FEAT_LISP
|
|
6732 else if (varp == (char_u *)&(curbuf->b_p_lisp))
|
|
6733 {
|
|
6734 (void)buf_init_chartab(curbuf, FALSE); /* ignore errors */
|
|
6735 }
|
|
6736 #endif
|
|
6737
|
|
6738 #ifdef FEAT_TITLE
|
|
6739 /* when 'title' changed, may need to change the title; same for 'icon' */
|
|
6740 else if ((int *)varp == &p_title)
|
|
6741 {
|
|
6742 did_set_title(FALSE);
|
|
6743 }
|
|
6744
|
|
6745 else if ((int *)varp == &p_icon)
|
|
6746 {
|
|
6747 did_set_title(TRUE);
|
|
6748 }
|
|
6749 #endif
|
|
6750
|
|
6751 else if ((int *)varp == &curbuf->b_changed)
|
|
6752 {
|
|
6753 if (!value)
|
|
6754 save_file_ff(curbuf); /* Buffer is unchanged */
|
|
6755 #ifdef FEAT_TITLE
|
|
6756 need_maketitle = TRUE;
|
|
6757 #endif
|
|
6758 #ifdef FEAT_AUTOCMD
|
|
6759 modified_was_set = value;
|
|
6760 #endif
|
|
6761 }
|
|
6762
|
|
6763 #ifdef BACKSLASH_IN_FILENAME
|
|
6764 else if ((int *)varp == &p_ssl)
|
|
6765 {
|
|
6766 if (p_ssl)
|
|
6767 {
|
|
6768 psepc = '/';
|
|
6769 psepcN = '\\';
|
|
6770 pseps[0] = '/';
|
|
6771 }
|
|
6772 else
|
|
6773 {
|
|
6774 psepc = '\\';
|
|
6775 psepcN = '/';
|
|
6776 pseps[0] = '\\';
|
|
6777 }
|
|
6778
|
|
6779 /* need to adjust the file name arguments and buffer names. */
|
|
6780 buflist_slash_adjust();
|
|
6781 alist_slash_adjust();
|
|
6782 # ifdef FEAT_EVAL
|
|
6783 scriptnames_slash_adjust();
|
|
6784 # endif
|
|
6785 }
|
|
6786 #endif
|
|
6787
|
|
6788 /* If 'wrap' is set, set w_leftcol to zero. */
|
|
6789 else if ((int *)varp == &curwin->w_p_wrap)
|
|
6790 {
|
|
6791 if (curwin->w_p_wrap)
|
|
6792 curwin->w_leftcol = 0;
|
|
6793 }
|
|
6794
|
|
6795 #ifdef FEAT_WINDOWS
|
|
6796 else if ((int *)varp == &p_ea)
|
|
6797 {
|
|
6798 if (p_ea && !old_value)
|
|
6799 win_equal(curwin, FALSE, 0);
|
|
6800 }
|
|
6801 #endif
|
|
6802
|
|
6803 else if ((int *)varp == &p_wiv)
|
|
6804 {
|
|
6805 /*
|
|
6806 * When 'weirdinvert' changed, set/reset 't_xs'.
|
|
6807 * Then set 'weirdinvert' according to value of 't_xs'.
|
|
6808 */
|
|
6809 if (p_wiv && !old_value)
|
|
6810 T_XS = (char_u *)"y";
|
|
6811 else if (!p_wiv && old_value)
|
|
6812 T_XS = empty_option;
|
|
6813 p_wiv = (*T_XS != NUL);
|
|
6814 }
|
|
6815
|
190
|
6816 #ifdef FEAT_BEVAL
|
7
|
6817 else if ((int *)varp == &p_beval)
|
|
6818 {
|
|
6819 if (p_beval == TRUE)
|
|
6820 gui_mch_enable_beval_area(balloonEval);
|
|
6821 else
|
|
6822 gui_mch_disable_beval_area(balloonEval);
|
|
6823 }
|
|
6824
|
190
|
6825 # if defined(FEAT_NETBEANS_INTG) || defined(FEAT_SUN_WORKSHOP)
|
7
|
6826 else if ((int *)varp == &p_acd)
|
|
6827 {
|
|
6828 if (p_acd && curbuf->b_ffname != NULL
|
|
6829 && vim_chdirfile(curbuf->b_ffname) == OK)
|
|
6830 shorten_fnames(TRUE);
|
|
6831 }
|
190
|
6832 # endif
|
7
|
6833 #endif
|
|
6834
|
|
6835 #ifdef FEAT_DIFF
|
|
6836 /* 'diff' */
|
|
6837 else if ((int *)varp == &curwin->w_p_diff)
|
|
6838 {
|
16
|
6839 /* May add or remove the buffer from the list of diff buffers. */
|
|
6840 diff_buf_adjust(curwin);
|
|
6841 # ifdef FEAT_FOLDING
|
7
|
6842 if (foldmethodIsDiff(curwin))
|
|
6843 foldUpdateAll(curwin);
|
16
|
6844 # endif
|
7
|
6845 }
|
|
6846 #endif
|
|
6847
|
|
6848 #ifdef USE_IM_CONTROL
|
|
6849 /* 'imdisable' */
|
|
6850 else if ((int *)varp == &p_imdisable)
|
|
6851 {
|
|
6852 /* Only de-activate it here, it will be enabled when changing mode. */
|
|
6853 if (p_imdisable)
|
|
6854 im_set_active(FALSE);
|
|
6855 }
|
|
6856 #endif
|
|
6857
|
258
|
6858 #ifdef FEAT_SYN_HL
|
|
6859 /* 'spell' */
|
|
6860 else if ((int *)varp == &curwin->w_p_spell)
|
|
6861 {
|
|
6862 if (curwin->w_p_spell)
|
|
6863 {
|
|
6864 char_u *errmsg = did_set_spelllang(curbuf);
|
320
|
6865
|
258
|
6866 if (errmsg != NULL)
|
|
6867 EMSG(_(errmsg));
|
|
6868 }
|
|
6869 }
|
|
6870 #endif
|
|
6871
|
7
|
6872 #ifdef FEAT_FKMAP
|
|
6873 else if ((int *)varp == &p_altkeymap)
|
|
6874 {
|
|
6875 if (old_value != p_altkeymap)
|
|
6876 {
|
|
6877 if (!p_altkeymap)
|
|
6878 {
|
|
6879 p_hkmap = p_fkmap;
|
|
6880 p_fkmap = 0;
|
|
6881 }
|
|
6882 else
|
|
6883 {
|
|
6884 p_fkmap = p_hkmap;
|
|
6885 p_hkmap = 0;
|
|
6886 }
|
|
6887 (void)init_chartab();
|
|
6888 }
|
|
6889 }
|
|
6890
|
|
6891 /*
|
|
6892 * In case some second language keymapping options have changed, check
|
|
6893 * and correct the setting in a consistent way.
|
|
6894 */
|
|
6895
|
|
6896 /*
|
|
6897 * If hkmap or fkmap are set, reset Arabic keymapping.
|
|
6898 */
|
|
6899 if ((p_hkmap || p_fkmap) && p_altkeymap)
|
|
6900 {
|
|
6901 p_altkeymap = p_fkmap;
|
|
6902 # ifdef FEAT_ARABIC
|
|
6903 curwin->w_p_arab = FALSE;
|
|
6904 # endif
|
|
6905 (void)init_chartab();
|
|
6906 }
|
|
6907
|
|
6908 /*
|
|
6909 * If hkmap set, reset Farsi keymapping.
|
|
6910 */
|
|
6911 if (p_hkmap && p_altkeymap)
|
|
6912 {
|
|
6913 p_altkeymap = 0;
|
|
6914 p_fkmap = 0;
|
|
6915 # ifdef FEAT_ARABIC
|
|
6916 curwin->w_p_arab = FALSE;
|
|
6917 # endif
|
|
6918 (void)init_chartab();
|
|
6919 }
|
|
6920
|
|
6921 /*
|
|
6922 * If fkmap set, reset Hebrew keymapping.
|
|
6923 */
|
|
6924 if (p_fkmap && !p_altkeymap)
|
|
6925 {
|
|
6926 p_altkeymap = 1;
|
|
6927 p_hkmap = 0;
|
|
6928 # ifdef FEAT_ARABIC
|
|
6929 curwin->w_p_arab = FALSE;
|
|
6930 # endif
|
|
6931 (void)init_chartab();
|
|
6932 }
|
|
6933 #endif
|
|
6934
|
|
6935 #ifdef FEAT_ARABIC
|
|
6936 if ((int *)varp == &curwin->w_p_arab)
|
|
6937 {
|
|
6938 if (curwin->w_p_arab)
|
|
6939 {
|
|
6940 /*
|
|
6941 * 'arabic' is set, handle various sub-settings.
|
|
6942 */
|
|
6943 if (!p_tbidi)
|
|
6944 {
|
|
6945 /* set rightleft mode */
|
|
6946 if (!curwin->w_p_rl)
|
|
6947 {
|
|
6948 curwin->w_p_rl = TRUE;
|
|
6949 changed_window_setting();
|
|
6950 }
|
|
6951
|
|
6952 /* Enable Arabic shaping (major part of what Arabic requires) */
|
|
6953 if (!p_arshape)
|
|
6954 {
|
|
6955 p_arshape = TRUE;
|
|
6956 redraw_later_clear();
|
|
6957 }
|
|
6958 }
|
|
6959
|
|
6960 /* Arabic requires a utf-8 encoding, inform the user if its not
|
|
6961 * set. */
|
|
6962 if (STRCMP(p_enc, "utf-8") != 0)
|
16
|
6963 {
|
|
6964 msg_source(hl_attr(HLF_W));
|
7
|
6965 MSG_ATTR(_("W17: Arabic requires UTF-8, do ':set encoding=utf-8'"),
|
|
6966 hl_attr(HLF_W));
|
16
|
6967 }
|
7
|
6968
|
|
6969 # ifdef FEAT_MBYTE
|
|
6970 /* set 'delcombine' */
|
|
6971 p_deco = TRUE;
|
|
6972 # endif
|
|
6973
|
|
6974 # ifdef FEAT_KEYMAP
|
|
6975 /* Force-set the necessary keymap for arabic */
|
|
6976 set_option_value((char_u *)"keymap", 0L, (char_u *)"arabic",
|
|
6977 OPT_LOCAL);
|
|
6978 # endif
|
|
6979 # ifdef FEAT_FKMAP
|
|
6980 p_altkeymap = 0;
|
|
6981 p_hkmap = 0;
|
|
6982 p_fkmap = 0;
|
|
6983 (void)init_chartab();
|
|
6984 # endif
|
|
6985 }
|
|
6986 else
|
|
6987 {
|
|
6988 /*
|
|
6989 * 'arabic' is reset, handle various sub-settings.
|
|
6990 */
|
|
6991 if (!p_tbidi)
|
|
6992 {
|
|
6993 /* reset rightleft mode */
|
|
6994 if (curwin->w_p_rl)
|
|
6995 {
|
|
6996 curwin->w_p_rl = FALSE;
|
|
6997 changed_window_setting();
|
|
6998 }
|
|
6999
|
|
7000 /* 'arabicshape' isn't reset, it is a global option and
|
|
7001 * another window may still need it "on". */
|
|
7002 }
|
|
7003
|
|
7004 /* 'delcombine' isn't reset, it is a global option and another
|
|
7005 * window may still want it "on". */
|
|
7006
|
|
7007 # ifdef FEAT_KEYMAP
|
|
7008 /* Revert to the default keymap */
|
|
7009 curbuf->b_p_iminsert = B_IMODE_NONE;
|
|
7010 curbuf->b_p_imsearch = B_IMODE_USE_INSERT;
|
|
7011 # endif
|
|
7012 }
|
|
7013 }
|
|
7014 #endif
|
|
7015
|
|
7016 /*
|
|
7017 * End of handling side effects for bool options.
|
|
7018 */
|
|
7019
|
|
7020 options[opt_idx].flags |= P_WAS_SET;
|
|
7021
|
|
7022 comp_col(); /* in case 'ruler' or 'showcmd' changed */
|
|
7023 if (curwin->w_curswant != MAXCOL)
|
|
7024 curwin->w_set_curswant = TRUE; /* in case 'list' changed */
|
|
7025 check_redraw(options[opt_idx].flags);
|
|
7026
|
|
7027 return NULL;
|
|
7028 }
|
|
7029
|
|
7030 /*
|
|
7031 * Set the value of a number option, and take care of side effects.
|
|
7032 * Returns NULL for success, or an error message for an error.
|
|
7033 */
|
|
7034 static char_u *
|
274
|
7035 set_num_option(opt_idx, varp, value, errbuf, errbuflen, opt_flags)
|
7
|
7036 int opt_idx; /* index in options[] table */
|
|
7037 char_u *varp; /* pointer to the option variable */
|
|
7038 long value; /* new value */
|
|
7039 char_u *errbuf; /* buffer for error messages */
|
274
|
7040 size_t errbuflen; /* length of "errbuf" */
|
7
|
7041 int opt_flags; /* OPT_LOCAL, OPT_GLOBAL and
|
|
7042 OPT_MODELINE */
|
|
7043 {
|
|
7044 char_u *errmsg = NULL;
|
|
7045 long old_value = *(long *)varp;
|
|
7046 long old_Rows = Rows; /* remember old Rows */
|
|
7047 long old_Columns = Columns; /* remember old Columns */
|
|
7048 long *pp = (long *)varp;
|
|
7049
|
|
7050 #ifdef FEAT_GUI
|
|
7051 need_mouse_correct = TRUE;
|
|
7052 #endif
|
|
7053
|
|
7054 *pp = value;
|
|
7055 #ifdef FEAT_EVAL
|
|
7056 /* Remember where the option was set. */
|
|
7057 options[opt_idx].scriptID = current_SID;
|
|
7058 #endif
|
|
7059
|
|
7060 if (curbuf->b_p_sw <= 0)
|
|
7061 {
|
|
7062 errmsg = e_positive;
|
|
7063 curbuf->b_p_sw = curbuf->b_p_ts;
|
|
7064 }
|
|
7065
|
|
7066 /*
|
|
7067 * Number options that need some action when changed
|
|
7068 */
|
|
7069 #ifdef FEAT_WINDOWS
|
|
7070 if (pp == &p_wh || pp == &p_hh)
|
|
7071 {
|
|
7072 if (p_wh < 1)
|
|
7073 {
|
|
7074 errmsg = e_positive;
|
|
7075 p_wh = 1;
|
|
7076 }
|
|
7077 if (p_wmh > p_wh)
|
|
7078 {
|
|
7079 errmsg = e_winheight;
|
|
7080 p_wh = p_wmh;
|
|
7081 }
|
|
7082 if (p_hh < 0)
|
|
7083 {
|
|
7084 errmsg = e_positive;
|
|
7085 p_hh = 0;
|
|
7086 }
|
|
7087
|
|
7088 /* Change window height NOW */
|
|
7089 if (lastwin != firstwin)
|
|
7090 {
|
|
7091 if (pp == &p_wh && curwin->w_height < p_wh)
|
|
7092 win_setheight((int)p_wh);
|
|
7093 if (pp == &p_hh && curbuf->b_help && curwin->w_height < p_hh)
|
|
7094 win_setheight((int)p_hh);
|
|
7095 }
|
|
7096 }
|
|
7097
|
|
7098 /* 'winminheight' */
|
|
7099 else if (pp == &p_wmh)
|
|
7100 {
|
|
7101 if (p_wmh < 0)
|
|
7102 {
|
|
7103 errmsg = e_positive;
|
|
7104 p_wmh = 0;
|
|
7105 }
|
|
7106 if (p_wmh > p_wh)
|
|
7107 {
|
|
7108 errmsg = e_winheight;
|
|
7109 p_wmh = p_wh;
|
|
7110 }
|
|
7111 win_setminheight();
|
|
7112 }
|
|
7113
|
|
7114 # ifdef FEAT_VERTSPLIT
|
13
|
7115 else if (pp == &p_wiw)
|
7
|
7116 {
|
|
7117 if (p_wiw < 1)
|
|
7118 {
|
|
7119 errmsg = e_positive;
|
|
7120 p_wiw = 1;
|
|
7121 }
|
|
7122 if (p_wmw > p_wiw)
|
|
7123 {
|
|
7124 errmsg = e_winwidth;
|
|
7125 p_wiw = p_wmw;
|
|
7126 }
|
|
7127
|
|
7128 /* Change window width NOW */
|
|
7129 if (lastwin != firstwin && curwin->w_width < p_wiw)
|
|
7130 win_setwidth((int)p_wiw);
|
|
7131 }
|
|
7132
|
|
7133 /* 'winminwidth' */
|
|
7134 else if (pp == &p_wmw)
|
|
7135 {
|
|
7136 if (p_wmw < 0)
|
|
7137 {
|
|
7138 errmsg = e_positive;
|
|
7139 p_wmw = 0;
|
|
7140 }
|
|
7141 if (p_wmw > p_wiw)
|
|
7142 {
|
|
7143 errmsg = e_winwidth;
|
|
7144 p_wmw = p_wiw;
|
|
7145 }
|
|
7146 win_setminheight();
|
|
7147 }
|
|
7148 # endif
|
|
7149
|
|
7150 #endif
|
|
7151
|
|
7152 #ifdef FEAT_WINDOWS
|
|
7153 /* (re)set last window status line */
|
|
7154 else if (pp == &p_ls)
|
|
7155 {
|
|
7156 last_status(FALSE);
|
|
7157 }
|
|
7158 #endif
|
|
7159
|
|
7160 #ifdef FEAT_GUI
|
|
7161 else if (pp == &p_linespace)
|
|
7162 {
|
444
|
7163 /* Recompute gui.char_height and resize the Vim window to keep the
|
|
7164 * same number of lines. */
|
|
7165 if (gui.in_use && gui_mch_adjust_charheight() == OK)
|
7
|
7166 gui_set_shellsize(FALSE, FALSE);
|
|
7167 }
|
|
7168 #endif
|
|
7169
|
|
7170 #ifdef FEAT_FOLDING
|
|
7171 /* 'foldlevel' */
|
|
7172 else if (pp == &curwin->w_p_fdl)
|
|
7173 {
|
|
7174 if (curwin->w_p_fdl < 0)
|
|
7175 curwin->w_p_fdl = 0;
|
|
7176 newFoldLevel();
|
|
7177 }
|
|
7178
|
|
7179 /* 'foldminlevel' */
|
|
7180 else if (pp == &curwin->w_p_fml)
|
|
7181 {
|
|
7182 foldUpdateAll(curwin);
|
|
7183 }
|
|
7184
|
|
7185 /* 'foldnestmax' */
|
|
7186 else if (pp == &curwin->w_p_fdn)
|
|
7187 {
|
|
7188 if (foldmethodIsSyntax(curwin) || foldmethodIsIndent(curwin))
|
|
7189 foldUpdateAll(curwin);
|
|
7190 }
|
|
7191
|
|
7192 /* 'foldcolumn' */
|
|
7193 else if (pp == &curwin->w_p_fdc)
|
|
7194 {
|
|
7195 if (curwin->w_p_fdc < 0)
|
|
7196 {
|
|
7197 errmsg = e_positive;
|
|
7198 curwin->w_p_fdc = 0;
|
|
7199 }
|
|
7200 else if (curwin->w_p_fdc > 12)
|
|
7201 {
|
|
7202 errmsg = e_invarg;
|
|
7203 curwin->w_p_fdc = 12;
|
|
7204 }
|
|
7205 }
|
|
7206
|
|
7207 /* 'shiftwidth' or 'tabstop' */
|
|
7208 else if (pp == &curbuf->b_p_sw || pp == &curbuf->b_p_ts)
|
|
7209 {
|
|
7210 if (foldmethodIsIndent(curwin))
|
|
7211 foldUpdateAll(curwin);
|
|
7212 }
|
|
7213 #endif /* FEAT_FOLDING */
|
|
7214
|
|
7215 else if (pp == &curbuf->b_p_iminsert)
|
|
7216 {
|
|
7217 if (curbuf->b_p_iminsert < 0 || curbuf->b_p_iminsert > B_IMODE_LAST)
|
|
7218 {
|
|
7219 errmsg = e_invarg;
|
|
7220 curbuf->b_p_iminsert = B_IMODE_NONE;
|
|
7221 }
|
|
7222 p_iminsert = curbuf->b_p_iminsert;
|
|
7223 if (termcap_active) /* don't do this in the alternate screen */
|
|
7224 showmode();
|
|
7225 #if defined(FEAT_WINDOWS) && defined(FEAT_KEYMAP)
|
|
7226 /* Show/unshow value of 'keymap' in status lines. */
|
|
7227 status_redraw_curbuf();
|
|
7228 #endif
|
|
7229 }
|
|
7230
|
164
|
7231 else if (pp == &p_window)
|
|
7232 {
|
|
7233 if (p_window < 1)
|
|
7234 p_window = 1;
|
|
7235 else if (p_window >= Rows)
|
|
7236 p_window = Rows - 1;
|
|
7237 }
|
|
7238
|
7
|
7239 else if (pp == &curbuf->b_p_imsearch)
|
|
7240 {
|
|
7241 if (curbuf->b_p_imsearch < -1 || curbuf->b_p_imsearch > B_IMODE_LAST)
|
|
7242 {
|
|
7243 errmsg = e_invarg;
|
|
7244 curbuf->b_p_imsearch = B_IMODE_NONE;
|
|
7245 }
|
|
7246 p_imsearch = curbuf->b_p_imsearch;
|
|
7247 }
|
|
7248
|
|
7249 #ifdef FEAT_TITLE
|
|
7250 /* if 'titlelen' has changed, redraw the title */
|
|
7251 else if (pp == &p_titlelen)
|
|
7252 {
|
|
7253 if (p_titlelen < 0)
|
|
7254 {
|
|
7255 errmsg = e_positive;
|
|
7256 p_titlelen = 85;
|
|
7257 }
|
|
7258 if (starting != NO_SCREEN && old_value != p_titlelen)
|
|
7259 need_maketitle = TRUE;
|
|
7260 }
|
|
7261 #endif
|
|
7262
|
|
7263 /* if p_ch changed value, change the command line height */
|
|
7264 else if (pp == &p_ch)
|
|
7265 {
|
|
7266 if (p_ch < 1)
|
|
7267 {
|
|
7268 errmsg = e_positive;
|
|
7269 p_ch = 1;
|
|
7270 }
|
|
7271
|
|
7272 /* Only compute the new window layout when startup has been
|
|
7273 * completed. Otherwise the frame sizes may be wrong. */
|
|
7274 if (p_ch != old_value && full_screen
|
|
7275 #ifdef FEAT_GUI
|
|
7276 && !gui.starting
|
|
7277 #endif
|
|
7278 )
|
|
7279 command_height(old_value);
|
|
7280 }
|
|
7281
|
|
7282 /* when 'updatecount' changes from zero to non-zero, open swap files */
|
|
7283 else if (pp == &p_uc)
|
|
7284 {
|
|
7285 if (p_uc < 0)
|
|
7286 {
|
|
7287 errmsg = e_positive;
|
|
7288 p_uc = 100;
|
|
7289 }
|
|
7290 if (p_uc && !old_value)
|
|
7291 ml_open_files();
|
|
7292 }
|
16
|
7293 #ifdef MZSCHEME_GUI_THREADS
|
14
|
7294 else if (pp == &p_mzq)
|
|
7295 mzvim_reset_timer();
|
|
7296 #endif
|
7
|
7297
|
|
7298 /* sync undo before 'undolevels' changes */
|
|
7299 else if (pp == &p_ul)
|
|
7300 {
|
|
7301 /* use the old value, otherwise u_sync() may not work properly */
|
|
7302 p_ul = old_value;
|
|
7303 u_sync();
|
|
7304 p_ul = value;
|
|
7305 }
|
|
7306
|
13
|
7307 #ifdef FEAT_LINEBREAK
|
|
7308 /* 'numberwidth' must be positive */
|
|
7309 else if (pp == &curwin->w_p_nuw)
|
|
7310 {
|
|
7311 if (curwin->w_p_nuw < 1)
|
|
7312 {
|
|
7313 errmsg = e_positive;
|
|
7314 curwin->w_p_nuw = 1;
|
|
7315 }
|
|
7316 if (curwin->w_p_nuw > 10)
|
|
7317 {
|
|
7318 errmsg = e_invarg;
|
|
7319 curwin->w_p_nuw = 10;
|
|
7320 }
|
|
7321 curwin->w_nrwidth_line_count = 0;
|
|
7322 }
|
|
7323 #endif
|
|
7324
|
7
|
7325 /*
|
|
7326 * Check the bounds for numeric options here
|
|
7327 */
|
|
7328 if (Rows < min_rows() && full_screen)
|
|
7329 {
|
|
7330 if (errbuf != NULL)
|
|
7331 {
|
274
|
7332 vim_snprintf((char *)errbuf, errbuflen,
|
|
7333 _("E593: Need at least %d lines"), min_rows());
|
7
|
7334 errmsg = errbuf;
|
|
7335 }
|
|
7336 Rows = min_rows();
|
|
7337 }
|
|
7338 if (Columns < MIN_COLUMNS && full_screen)
|
|
7339 {
|
|
7340 if (errbuf != NULL)
|
|
7341 {
|
274
|
7342 vim_snprintf((char *)errbuf, errbuflen,
|
|
7343 _("E594: Need at least %d columns"), MIN_COLUMNS);
|
7
|
7344 errmsg = errbuf;
|
|
7345 }
|
|
7346 Columns = MIN_COLUMNS;
|
|
7347 }
|
534
|
7348 /* Limit the values to avoid an overflow in Rows * Columns. */
|
|
7349 if (Columns > 10000)
|
|
7350 Columns = 10000;
|
|
7351 if (Rows > 1000)
|
|
7352 Rows = 1000;
|
7
|
7353
|
|
7354 #ifdef DJGPP
|
|
7355 /* avoid a crash by checking for a too large value of 'columns' */
|
|
7356 if (old_Columns != Columns && full_screen && term_console)
|
|
7357 mch_check_columns();
|
|
7358 #endif
|
|
7359
|
|
7360 /*
|
|
7361 * If the screen (shell) height has been changed, assume it is the
|
|
7362 * physical screenheight.
|
|
7363 */
|
|
7364 if (old_Rows != Rows || old_Columns != Columns)
|
|
7365 {
|
|
7366 /* Changing the screen size is not allowed while updating the screen. */
|
|
7367 if (updating_screen)
|
|
7368 *pp = old_value;
|
|
7369 else if (full_screen
|
|
7370 #ifdef FEAT_GUI
|
|
7371 && !gui.starting
|
|
7372 #endif
|
|
7373 )
|
|
7374 set_shellsize((int)Columns, (int)Rows, TRUE);
|
|
7375 else
|
|
7376 {
|
|
7377 /* Postpone the resizing; check the size and cmdline position for
|
|
7378 * messages. */
|
|
7379 check_shellsize();
|
|
7380 if (cmdline_row > Rows - p_ch && Rows > p_ch)
|
|
7381 cmdline_row = Rows - p_ch;
|
|
7382 }
|
164
|
7383 if (p_window >= Rows)
|
|
7384 p_window = Rows - 1;
|
7
|
7385 }
|
|
7386
|
|
7387 if (curbuf->b_p_sts < 0)
|
|
7388 {
|
|
7389 errmsg = e_positive;
|
|
7390 curbuf->b_p_sts = 0;
|
|
7391 }
|
|
7392 if (curbuf->b_p_ts <= 0)
|
|
7393 {
|
|
7394 errmsg = e_positive;
|
|
7395 curbuf->b_p_ts = 8;
|
|
7396 }
|
|
7397 if (curbuf->b_p_tw < 0)
|
|
7398 {
|
|
7399 errmsg = e_positive;
|
|
7400 curbuf->b_p_tw = 0;
|
|
7401 }
|
|
7402 if (p_tm < 0)
|
|
7403 {
|
|
7404 errmsg = e_positive;
|
|
7405 p_tm = 0;
|
|
7406 }
|
|
7407 if ((curwin->w_p_scr <= 0
|
|
7408 || (curwin->w_p_scr > curwin->w_height
|
|
7409 && curwin->w_height > 0))
|
|
7410 && full_screen)
|
|
7411 {
|
|
7412 if (pp == &(curwin->w_p_scr))
|
|
7413 {
|
|
7414 if (curwin->w_p_scr != 0)
|
|
7415 errmsg = e_scroll;
|
|
7416 win_comp_scroll(curwin);
|
|
7417 }
|
|
7418 /* If 'scroll' became invalid because of a side effect silently adjust
|
|
7419 * it. */
|
|
7420 else if (curwin->w_p_scr <= 0)
|
|
7421 curwin->w_p_scr = 1;
|
|
7422 else /* curwin->w_p_scr > curwin->w_height */
|
|
7423 curwin->w_p_scr = curwin->w_height;
|
|
7424 }
|
|
7425 if (p_report < 0)
|
|
7426 {
|
|
7427 errmsg = e_positive;
|
|
7428 p_report = 1;
|
|
7429 }
|
532
|
7430 if ((p_sj < -100 || p_sj >= Rows) && full_screen)
|
7
|
7431 {
|
|
7432 if (Rows != old_Rows) /* Rows changed, just adjust p_sj */
|
|
7433 p_sj = Rows / 2;
|
|
7434 else
|
|
7435 {
|
|
7436 errmsg = e_scroll;
|
|
7437 p_sj = 1;
|
|
7438 }
|
|
7439 }
|
|
7440 if (p_so < 0 && full_screen)
|
|
7441 {
|
|
7442 errmsg = e_scroll;
|
|
7443 p_so = 0;
|
|
7444 }
|
|
7445 if (p_siso < 0 && full_screen)
|
|
7446 {
|
|
7447 errmsg = e_positive;
|
|
7448 p_siso = 0;
|
|
7449 }
|
|
7450 #ifdef FEAT_CMDWIN
|
|
7451 if (p_cwh < 1)
|
|
7452 {
|
|
7453 errmsg = e_positive;
|
|
7454 p_cwh = 1;
|
|
7455 }
|
|
7456 #endif
|
|
7457 if (p_ut < 0)
|
|
7458 {
|
|
7459 errmsg = e_positive;
|
|
7460 p_ut = 2000;
|
|
7461 }
|
|
7462 if (p_ss < 0)
|
|
7463 {
|
|
7464 errmsg = e_positive;
|
|
7465 p_ss = 0;
|
|
7466 }
|
|
7467
|
|
7468 /* May set global value for local option. */
|
|
7469 if ((opt_flags & (OPT_LOCAL | OPT_GLOBAL)) == 0)
|
|
7470 *(long *)get_varp_scope(&(options[opt_idx]), OPT_GLOBAL) = *pp;
|
|
7471
|
|
7472 options[opt_idx].flags |= P_WAS_SET;
|
|
7473
|
|
7474 comp_col(); /* in case 'columns' or 'ls' changed */
|
|
7475 if (curwin->w_curswant != MAXCOL)
|
|
7476 curwin->w_set_curswant = TRUE; /* in case 'tabstop' changed */
|
|
7477 check_redraw(options[opt_idx].flags);
|
|
7478
|
|
7479 return errmsg;
|
|
7480 }
|
|
7481
|
|
7482 /*
|
|
7483 * Called after an option changed: check if something needs to be redrawn.
|
|
7484 */
|
|
7485 static void
|
|
7486 check_redraw(flags)
|
|
7487 long_u flags;
|
|
7488 {
|
|
7489 /* Careful: P_RCLR and P_RALL are a combination of other P_ flags */
|
|
7490 int clear = (flags & P_RCLR) == P_RCLR;
|
|
7491 int all = ((flags & P_RALL) == P_RALL || clear);
|
|
7492
|
|
7493 #ifdef FEAT_WINDOWS
|
|
7494 if ((flags & P_RSTAT) || all) /* mark all status lines dirty */
|
|
7495 status_redraw_all();
|
|
7496 #endif
|
|
7497
|
|
7498 if ((flags & P_RBUF) || (flags & P_RWIN) || all)
|
|
7499 changed_window_setting();
|
|
7500 if (flags & P_RBUF)
|
|
7501 redraw_curbuf_later(NOT_VALID);
|
|
7502 if (clear)
|
|
7503 redraw_all_later(CLEAR);
|
|
7504 else if (all)
|
|
7505 redraw_all_later(NOT_VALID);
|
|
7506 }
|
|
7507
|
|
7508 /*
|
|
7509 * Find index for option 'arg'.
|
|
7510 * Return -1 if not found.
|
|
7511 */
|
|
7512 static int
|
|
7513 findoption(arg)
|
|
7514 char_u *arg;
|
|
7515 {
|
|
7516 int opt_idx;
|
|
7517 char *s, *p;
|
|
7518 static short quick_tab[27] = {0, 0}; /* quick access table */
|
|
7519 int is_term_opt;
|
|
7520
|
|
7521 /*
|
|
7522 * For first call: Initialize the quick-access table.
|
|
7523 * It contains the index for the first option that starts with a certain
|
|
7524 * letter. There are 26 letters, plus the first "t_" option.
|
|
7525 */
|
|
7526 if (quick_tab[1] == 0)
|
|
7527 {
|
|
7528 p = options[0].fullname;
|
|
7529 for (opt_idx = 1; (s = options[opt_idx].fullname) != NULL; opt_idx++)
|
|
7530 {
|
|
7531 if (s[0] != p[0])
|
|
7532 {
|
|
7533 if (s[0] == 't' && s[1] == '_')
|
|
7534 quick_tab[26] = opt_idx;
|
|
7535 else
|
|
7536 quick_tab[CharOrdLow(s[0])] = opt_idx;
|
|
7537 }
|
|
7538 p = s;
|
|
7539 }
|
|
7540 }
|
|
7541
|
|
7542 /*
|
|
7543 * Check for name starting with an illegal character.
|
|
7544 */
|
|
7545 #ifdef EBCDIC
|
|
7546 if (!islower(arg[0]))
|
|
7547 #else
|
|
7548 if (arg[0] < 'a' || arg[0] > 'z')
|
|
7549 #endif
|
|
7550 return -1;
|
|
7551
|
|
7552 is_term_opt = (arg[0] == 't' && arg[1] == '_');
|
|
7553 if (is_term_opt)
|
|
7554 opt_idx = quick_tab[26];
|
|
7555 else
|
|
7556 opt_idx = quick_tab[CharOrdLow(arg[0])];
|
|
7557 for ( ; (s = options[opt_idx].fullname) != NULL; opt_idx++)
|
|
7558 {
|
|
7559 if (STRCMP(arg, s) == 0) /* match full name */
|
|
7560 break;
|
|
7561 }
|
|
7562 if (s == NULL && !is_term_opt)
|
|
7563 {
|
|
7564 opt_idx = quick_tab[CharOrdLow(arg[0])];
|
|
7565 for ( ; options[opt_idx].fullname != NULL; opt_idx++)
|
|
7566 {
|
|
7567 s = options[opt_idx].shortname;
|
|
7568 if (s != NULL && STRCMP(arg, s) == 0) /* match short name */
|
|
7569 break;
|
|
7570 s = NULL;
|
|
7571 }
|
|
7572 }
|
|
7573 if (s == NULL)
|
|
7574 opt_idx = -1;
|
|
7575 return opt_idx;
|
|
7576 }
|
|
7577
|
14
|
7578 #if defined(FEAT_EVAL) || defined(FEAT_TCL) || defined(FEAT_MZSCHEME)
|
7
|
7579 /*
|
|
7580 * Get the value for an option.
|
|
7581 *
|
|
7582 * Returns:
|
|
7583 * Number or Toggle option: 1, *numval gets value.
|
|
7584 * String option: 0, *stringval gets allocated string.
|
|
7585 * Hidden Number or Toggle option: -1.
|
|
7586 * hidden String option: -2.
|
|
7587 * unknown option: -3.
|
|
7588 */
|
|
7589 int
|
|
7590 get_option_value(name, numval, stringval, opt_flags)
|
|
7591 char_u *name;
|
|
7592 long *numval;
|
|
7593 char_u **stringval; /* NULL when only checking existance */
|
|
7594 int opt_flags;
|
|
7595 {
|
|
7596 int opt_idx;
|
|
7597 char_u *varp;
|
|
7598
|
|
7599 opt_idx = findoption(name);
|
|
7600 if (opt_idx < 0) /* unknown option */
|
|
7601 return -3;
|
|
7602
|
|
7603 varp = get_varp_scope(&(options[opt_idx]), opt_flags);
|
|
7604
|
|
7605 if (options[opt_idx].flags & P_STRING)
|
|
7606 {
|
|
7607 if (varp == NULL) /* hidden option */
|
|
7608 return -2;
|
|
7609 if (stringval != NULL)
|
|
7610 {
|
|
7611 #ifdef FEAT_CRYPT
|
|
7612 /* never return the value of the crypt key */
|
|
7613 if ((char_u **)varp == &curbuf->b_p_key)
|
|
7614 *stringval = vim_strsave((char_u *)"*****");
|
|
7615 else
|
|
7616 #endif
|
|
7617 *stringval = vim_strsave(*(char_u **)(varp));
|
|
7618 }
|
|
7619 return 0;
|
|
7620 }
|
|
7621
|
|
7622 if (varp == NULL) /* hidden option */
|
|
7623 return -1;
|
|
7624 if (options[opt_idx].flags & P_NUM)
|
|
7625 *numval = *(long *)varp;
|
|
7626 else
|
|
7627 {
|
|
7628 /* Special case: 'modified' is b_changed, but we also want to consider
|
|
7629 * it set when 'ff' or 'fenc' changed. */
|
|
7630 if ((int *)varp == &curbuf->b_changed)
|
|
7631 *numval = curbufIsChanged();
|
|
7632 else
|
|
7633 *numval = *(int *)varp;
|
|
7634 }
|
|
7635 return 1;
|
|
7636 }
|
|
7637 #endif
|
|
7638
|
|
7639 /*
|
|
7640 * Set the value of option "name".
|
|
7641 * Use "string" for string options, use "number" for other options.
|
|
7642 */
|
|
7643 void
|
|
7644 set_option_value(name, number, string, opt_flags)
|
|
7645 char_u *name;
|
|
7646 long number;
|
|
7647 char_u *string;
|
|
7648 int opt_flags; /* OPT_LOCAL or 0 (both) */
|
|
7649 {
|
|
7650 int opt_idx;
|
|
7651 char_u *varp;
|
|
7652 int flags;
|
|
7653
|
|
7654 opt_idx = findoption(name);
|
|
7655 if (opt_idx == -1)
|
|
7656 EMSG2(_("E355: Unknown option: %s"), name);
|
|
7657 else
|
|
7658 {
|
|
7659 flags = options[opt_idx].flags;
|
|
7660 #ifdef HAVE_SANDBOX
|
|
7661 /* Disallow changing some options in the sandbox */
|
|
7662 if (sandbox > 0 && (flags & P_SECURE))
|
|
7663 EMSG(_(e_sandbox));
|
|
7664 else
|
|
7665 #endif
|
|
7666 if (flags & P_STRING)
|
|
7667 set_string_option(opt_idx, string, opt_flags);
|
|
7668 else
|
|
7669 {
|
|
7670 varp = get_varp(&options[opt_idx]);
|
|
7671 if (varp != NULL) /* hidden option is not changed */
|
|
7672 {
|
|
7673 if (flags & P_NUM)
|
274
|
7674 (void)set_num_option(opt_idx, varp, number,
|
|
7675 NULL, 0, opt_flags);
|
7
|
7676 else
|
|
7677 (void)set_bool_option(opt_idx, varp, (int)number, opt_flags);
|
|
7678 }
|
|
7679 }
|
|
7680 }
|
|
7681 }
|
|
7682
|
|
7683 /*
|
|
7684 * Get the terminal code for a terminal option.
|
|
7685 * Returns NULL when not found.
|
|
7686 */
|
|
7687 char_u *
|
|
7688 get_term_code(tname)
|
|
7689 char_u *tname;
|
|
7690 {
|
|
7691 int opt_idx;
|
|
7692 char_u *varp;
|
|
7693
|
|
7694 if (tname[0] != 't' || tname[1] != '_' ||
|
|
7695 tname[2] == NUL || tname[3] == NUL)
|
|
7696 return NULL;
|
|
7697 if ((opt_idx = findoption(tname)) >= 0)
|
|
7698 {
|
|
7699 varp = get_varp(&(options[opt_idx]));
|
|
7700 if (varp != NULL)
|
|
7701 varp = *(char_u **)(varp);
|
|
7702 return varp;
|
|
7703 }
|
|
7704 return find_termcode(tname + 2);
|
|
7705 }
|
|
7706
|
|
7707 char_u *
|
|
7708 get_highlight_default()
|
|
7709 {
|
|
7710 int i;
|
|
7711
|
|
7712 i = findoption((char_u *)"hl");
|
|
7713 if (i >= 0)
|
|
7714 return options[i].def_val[VI_DEFAULT];
|
|
7715 return (char_u *)NULL;
|
|
7716 }
|
|
7717
|
39
|
7718 #if defined(FEAT_MBYTE) || defined(PROTO)
|
|
7719 char_u *
|
|
7720 get_encoding_default()
|
|
7721 {
|
|
7722 int i;
|
|
7723
|
|
7724 i = findoption((char_u *)"enc");
|
|
7725 if (i >= 0)
|
|
7726 return options[i].def_val[VI_DEFAULT];
|
|
7727 return (char_u *)NULL;
|
|
7728 }
|
|
7729 #endif
|
|
7730
|
7
|
7731 /*
|
|
7732 * Translate a string like "t_xx", "<t_xx>" or "<S-Tab>" to a key number.
|
|
7733 */
|
|
7734 static int
|
|
7735 find_key_option(arg)
|
|
7736 char_u *arg;
|
|
7737 {
|
|
7738 int key;
|
|
7739 int modifiers;
|
|
7740
|
|
7741 /*
|
|
7742 * Don't use get_special_key_code() for t_xx, we don't want it to call
|
|
7743 * add_termcap_entry().
|
|
7744 */
|
|
7745 if (arg[0] == 't' && arg[1] == '_' && arg[2] && arg[3])
|
|
7746 key = TERMCAP2KEY(arg[2], arg[3]);
|
|
7747 else
|
|
7748 {
|
|
7749 --arg; /* put arg at the '<' */
|
|
7750 modifiers = 0;
|
|
7751 key = find_special_key(&arg, &modifiers, TRUE);
|
|
7752 if (modifiers) /* can't handle modifiers here */
|
|
7753 key = 0;
|
|
7754 }
|
|
7755 return key;
|
|
7756 }
|
|
7757
|
|
7758 /*
|
|
7759 * if 'all' == 0: show changed options
|
|
7760 * if 'all' == 1: show all normal options
|
|
7761 * if 'all' == 2: show all terminal options
|
|
7762 */
|
|
7763 static void
|
|
7764 showoptions(all, opt_flags)
|
|
7765 int all;
|
|
7766 int opt_flags; /* OPT_LOCAL and/or OPT_GLOBAL */
|
|
7767 {
|
|
7768 struct vimoption *p;
|
|
7769 int col;
|
|
7770 int isterm;
|
|
7771 char_u *varp;
|
|
7772 struct vimoption **items;
|
|
7773 int item_count;
|
|
7774 int run;
|
|
7775 int row, rows;
|
|
7776 int cols;
|
|
7777 int i;
|
|
7778 int len;
|
|
7779
|
|
7780 #define INC 20
|
|
7781 #define GAP 3
|
|
7782
|
|
7783 items = (struct vimoption **)alloc((unsigned)(sizeof(struct vimoption *) *
|
|
7784 PARAM_COUNT));
|
|
7785 if (items == NULL)
|
|
7786 return;
|
|
7787
|
|
7788 /* Highlight title */
|
|
7789 if (all == 2)
|
|
7790 MSG_PUTS_TITLE(_("\n--- Terminal codes ---"));
|
|
7791 else if (opt_flags & OPT_GLOBAL)
|
|
7792 MSG_PUTS_TITLE(_("\n--- Global option values ---"));
|
|
7793 else if (opt_flags & OPT_LOCAL)
|
|
7794 MSG_PUTS_TITLE(_("\n--- Local option values ---"));
|
|
7795 else
|
|
7796 MSG_PUTS_TITLE(_("\n--- Options ---"));
|
|
7797
|
|
7798 /*
|
|
7799 * do the loop two times:
|
|
7800 * 1. display the short items
|
|
7801 * 2. display the long items (only strings and numbers)
|
|
7802 */
|
|
7803 for (run = 1; run <= 2 && !got_int; ++run)
|
|
7804 {
|
|
7805 /*
|
|
7806 * collect the items in items[]
|
|
7807 */
|
|
7808 item_count = 0;
|
|
7809 for (p = &options[0]; p->fullname != NULL; p++)
|
|
7810 {
|
|
7811 varp = NULL;
|
|
7812 isterm = istermoption(p);
|
|
7813 if (opt_flags != 0)
|
|
7814 {
|
|
7815 if (p->indir != PV_NONE && !isterm)
|
|
7816 varp = get_varp_scope(p, opt_flags);
|
|
7817 }
|
|
7818 else
|
|
7819 varp = get_varp(p);
|
|
7820 if (varp != NULL
|
|
7821 && ((all == 2 && isterm)
|
|
7822 || (all == 1 && !isterm)
|
|
7823 || (all == 0 && !optval_default(p, varp))))
|
|
7824 {
|
|
7825 if (p->flags & P_BOOL)
|
|
7826 len = 1; /* a toggle option fits always */
|
|
7827 else
|
|
7828 {
|
|
7829 option_value2string(p, opt_flags);
|
|
7830 len = (int)STRLEN(p->fullname) + vim_strsize(NameBuff) + 1;
|
|
7831 }
|
|
7832 if ((len <= INC - GAP && run == 1) ||
|
|
7833 (len > INC - GAP && run == 2))
|
|
7834 items[item_count++] = p;
|
|
7835 }
|
|
7836 }
|
|
7837
|
|
7838 /*
|
|
7839 * display the items
|
|
7840 */
|
|
7841 if (run == 1)
|
|
7842 {
|
|
7843 cols = (Columns + GAP - 3) / INC;
|
|
7844 if (cols == 0)
|
|
7845 cols = 1;
|
|
7846 rows = (item_count + cols - 1) / cols;
|
|
7847 }
|
|
7848 else /* run == 2 */
|
|
7849 rows = item_count;
|
|
7850 for (row = 0; row < rows && !got_int; ++row)
|
|
7851 {
|
|
7852 msg_putchar('\n'); /* go to next line */
|
|
7853 if (got_int) /* 'q' typed in more */
|
|
7854 break;
|
|
7855 col = 0;
|
|
7856 for (i = row; i < item_count; i += rows)
|
|
7857 {
|
|
7858 msg_col = col; /* make columns */
|
|
7859 showoneopt(items[i], opt_flags);
|
|
7860 col += INC;
|
|
7861 }
|
|
7862 out_flush();
|
|
7863 ui_breakcheck();
|
|
7864 }
|
|
7865 }
|
|
7866 vim_free(items);
|
|
7867 }
|
|
7868
|
|
7869 /*
|
|
7870 * Return TRUE if option "p" has its default value.
|
|
7871 */
|
|
7872 static int
|
|
7873 optval_default(p, varp)
|
|
7874 struct vimoption *p;
|
|
7875 char_u *varp;
|
|
7876 {
|
|
7877 int dvi;
|
|
7878
|
|
7879 if (varp == NULL)
|
|
7880 return TRUE; /* hidden option is always at default */
|
|
7881 dvi = ((p->flags & P_VI_DEF) || p_cp) ? VI_DEFAULT : VIM_DEFAULT;
|
|
7882 if (p->flags & P_NUM)
|
|
7883 return (*(long *)varp == (long)p->def_val[dvi]);
|
|
7884 if (p->flags & P_BOOL)
|
|
7885 /* the cast to long is required for Manx C */
|
|
7886 return (*(int *)varp == (int)(long)p->def_val[dvi]);
|
|
7887 /* P_STRING */
|
|
7888 return (STRCMP(*(char_u **)varp, p->def_val[dvi]) == 0);
|
|
7889 }
|
|
7890
|
|
7891 /*
|
|
7892 * showoneopt: show the value of one option
|
|
7893 * must not be called with a hidden option!
|
|
7894 */
|
|
7895 static void
|
|
7896 showoneopt(p, opt_flags)
|
|
7897 struct vimoption *p;
|
|
7898 int opt_flags; /* OPT_LOCAL or OPT_GLOBAL */
|
|
7899 {
|
168
|
7900 char_u *varp;
|
|
7901 int save_silent = silent_mode;
|
|
7902
|
|
7903 silent_mode = FALSE;
|
|
7904 info_message = TRUE; /* use mch_msg(), not mch_errmsg() */
|
7
|
7905
|
|
7906 varp = get_varp_scope(p, opt_flags);
|
|
7907
|
|
7908 /* for 'modified' we also need to check if 'ff' or 'fenc' changed. */
|
|
7909 if ((p->flags & P_BOOL) && ((int *)varp == &curbuf->b_changed
|
|
7910 ? !curbufIsChanged() : !*(int *)varp))
|
|
7911 MSG_PUTS("no");
|
|
7912 else if ((p->flags & P_BOOL) && *(int *)varp < 0)
|
|
7913 MSG_PUTS("--");
|
|
7914 else
|
|
7915 MSG_PUTS(" ");
|
|
7916 MSG_PUTS(p->fullname);
|
|
7917 if (!(p->flags & P_BOOL))
|
|
7918 {
|
|
7919 msg_putchar('=');
|
|
7920 /* put value string in NameBuff */
|
|
7921 option_value2string(p, opt_flags);
|
|
7922 msg_outtrans(NameBuff);
|
|
7923 }
|
168
|
7924
|
|
7925 silent_mode = save_silent;
|
|
7926 info_message = FALSE;
|
7
|
7927 }
|
|
7928
|
|
7929 /*
|
|
7930 * Write modified options as ":set" commands to a file.
|
|
7931 *
|
|
7932 * There are three values for "opt_flags":
|
|
7933 * OPT_GLOBAL: Write global option values and fresh values of
|
|
7934 * buffer-local options (used for start of a session
|
|
7935 * file).
|
|
7936 * OPT_GLOBAL + OPT_LOCAL: Idem, add fresh values of window-local options for
|
|
7937 * curwin (used for a vimrc file).
|
|
7938 * OPT_LOCAL: Write buffer-local option values for curbuf, fresh
|
|
7939 * and local values for window-local options of
|
|
7940 * curwin. Local values are also written when at the
|
|
7941 * default value, because a modeline or autocommand
|
|
7942 * may have set them when doing ":edit file" and the
|
|
7943 * user has set them back at the default or fresh
|
|
7944 * value.
|
|
7945 * When "local_only" is TRUE, don't write fresh
|
|
7946 * values, only local values (for ":mkview").
|
|
7947 * (fresh value = value used for a new buffer or window for a local option).
|
|
7948 *
|
|
7949 * Return FAIL on error, OK otherwise.
|
|
7950 */
|
|
7951 int
|
|
7952 makeset(fd, opt_flags, local_only)
|
|
7953 FILE *fd;
|
|
7954 int opt_flags;
|
|
7955 int local_only;
|
|
7956 {
|
|
7957 struct vimoption *p;
|
|
7958 char_u *varp; /* currently used value */
|
|
7959 char_u *varp_fresh; /* local value */
|
|
7960 char_u *varp_local = NULL; /* fresh value */
|
|
7961 char *cmd;
|
|
7962 int round;
|
|
7963
|
|
7964 /*
|
|
7965 * The options that don't have a default (terminal name, columns, lines)
|
|
7966 * are never written. Terminal options are also not written.
|
|
7967 */
|
|
7968 for (p = &options[0]; !istermoption(p); p++)
|
|
7969 if (!(p->flags & P_NO_MKRC) && !istermoption(p))
|
|
7970 {
|
|
7971 /* skip global option when only doing locals */
|
|
7972 if (p->indir == PV_NONE && !(opt_flags & OPT_GLOBAL))
|
|
7973 continue;
|
|
7974
|
|
7975 /* Do not store options like 'bufhidden' and 'syntax' in a vimrc
|
|
7976 * file, they are always buffer-specific. */
|
|
7977 if ((opt_flags & OPT_GLOBAL) && (p->flags & P_NOGLOB))
|
|
7978 continue;
|
|
7979
|
|
7980 /* Global values are only written when not at the default value. */
|
|
7981 varp = get_varp_scope(p, opt_flags);
|
|
7982 if ((opt_flags & OPT_GLOBAL) && optval_default(p, varp))
|
|
7983 continue;
|
|
7984
|
|
7985 round = 2;
|
|
7986 if (p->indir != PV_NONE)
|
|
7987 {
|
|
7988 if (p->var == VAR_WIN)
|
|
7989 {
|
|
7990 /* skip window-local option when only doing globals */
|
|
7991 if (!(opt_flags & OPT_LOCAL))
|
|
7992 continue;
|
|
7993 /* When fresh value of window-local option is not at the
|
|
7994 * default, need to write it too. */
|
|
7995 if (!(opt_flags & OPT_GLOBAL) && !local_only)
|
|
7996 {
|
|
7997 varp_fresh = get_varp_scope(p, OPT_GLOBAL);
|
|
7998 if (!optval_default(p, varp_fresh))
|
|
7999 {
|
|
8000 round = 1;
|
|
8001 varp_local = varp;
|
|
8002 varp = varp_fresh;
|
|
8003 }
|
|
8004 }
|
|
8005 }
|
|
8006 }
|
|
8007
|
|
8008 /* Round 1: fresh value for window-local options.
|
|
8009 * Round 2: other values */
|
|
8010 for ( ; round <= 2; varp = varp_local, ++round)
|
|
8011 {
|
|
8012 if (round == 1 || (opt_flags & OPT_GLOBAL))
|
|
8013 cmd = "set";
|
|
8014 else
|
|
8015 cmd = "setlocal";
|
|
8016
|
|
8017 if (p->flags & P_BOOL)
|
|
8018 {
|
|
8019 if (put_setbool(fd, cmd, p->fullname, *(int *)varp) == FAIL)
|
|
8020 return FAIL;
|
|
8021 }
|
|
8022 else if (p->flags & P_NUM)
|
|
8023 {
|
|
8024 if (put_setnum(fd, cmd, p->fullname, (long *)varp) == FAIL)
|
|
8025 return FAIL;
|
|
8026 }
|
|
8027 else /* P_STRING */
|
|
8028 {
|
|
8029 /* Don't set 'syntax' and 'filetype' again if the value is
|
|
8030 * already right, avoids reloading the syntax file. */
|
|
8031 if (p->indir == PV_SYN || p->indir == PV_FT)
|
|
8032 {
|
|
8033 if (fprintf(fd, "if &%s != '%s'", p->fullname,
|
|
8034 *(char_u **)(varp)) < 0
|
|
8035 || put_eol(fd) < 0)
|
|
8036 return FAIL;
|
|
8037 }
|
|
8038 if (put_setstring(fd, cmd, p->fullname, (char_u **)varp,
|
|
8039 (p->flags & P_EXPAND) != 0) == FAIL)
|
|
8040 return FAIL;
|
|
8041 if (p->indir == PV_SYN || p->indir == PV_FT)
|
|
8042 {
|
|
8043 if (put_line(fd, "endif") == FAIL)
|
|
8044 return FAIL;
|
|
8045 }
|
|
8046 }
|
|
8047 }
|
|
8048 }
|
|
8049 return OK;
|
|
8050 }
|
|
8051
|
|
8052 #if defined(FEAT_FOLDING) || defined(PROTO)
|
|
8053 /*
|
|
8054 * Generate set commands for the local fold options only. Used when
|
|
8055 * 'sessionoptions' or 'viewoptions' contains "folds" but not "options".
|
|
8056 */
|
|
8057 int
|
|
8058 makefoldset(fd)
|
|
8059 FILE *fd;
|
|
8060 {
|
|
8061 if (put_setstring(fd, "setlocal", "fdm", &curwin->w_p_fdm, FALSE) == FAIL
|
|
8062 # ifdef FEAT_EVAL
|
|
8063 || put_setstring(fd, "setlocal", "fde", &curwin->w_p_fde, FALSE)
|
|
8064 == FAIL
|
|
8065 # endif
|
|
8066 || put_setstring(fd, "setlocal", "fmr", &curwin->w_p_fmr, FALSE)
|
|
8067 == FAIL
|
|
8068 || put_setstring(fd, "setlocal", "fdi", &curwin->w_p_fdi, FALSE)
|
|
8069 == FAIL
|
|
8070 || put_setnum(fd, "setlocal", "fdl", &curwin->w_p_fdl) == FAIL
|
|
8071 || put_setnum(fd, "setlocal", "fml", &curwin->w_p_fml) == FAIL
|
|
8072 || put_setnum(fd, "setlocal", "fdn", &curwin->w_p_fdn) == FAIL
|
|
8073 || put_setbool(fd, "setlocal", "fen", curwin->w_p_fen) == FAIL
|
|
8074 )
|
|
8075 return FAIL;
|
|
8076
|
|
8077 return OK;
|
|
8078 }
|
|
8079 #endif
|
|
8080
|
|
8081 static int
|
|
8082 put_setstring(fd, cmd, name, valuep, expand)
|
|
8083 FILE *fd;
|
|
8084 char *cmd;
|
|
8085 char *name;
|
|
8086 char_u **valuep;
|
|
8087 int expand;
|
|
8088 {
|
|
8089 char_u *s;
|
|
8090 char_u buf[MAXPATHL];
|
|
8091
|
|
8092 if (fprintf(fd, "%s %s=", cmd, name) < 0)
|
|
8093 return FAIL;
|
|
8094 if (*valuep != NULL)
|
|
8095 {
|
|
8096 /* Output 'pastetoggle' as key names. For other
|
|
8097 * options some characters have to be escaped with
|
|
8098 * CTRL-V or backslash */
|
|
8099 if (valuep == &p_pt)
|
|
8100 {
|
|
8101 s = *valuep;
|
|
8102 while (*s != NUL)
|
|
8103 if (fputs((char *)str2special(&s, FALSE), fd) < 0)
|
|
8104 return FAIL;
|
|
8105 }
|
|
8106 else if (expand)
|
|
8107 {
|
|
8108 home_replace(NULL, *valuep, buf, MAXPATHL, FALSE);
|
|
8109 if (put_escstr(fd, buf, 2) == FAIL)
|
|
8110 return FAIL;
|
|
8111 }
|
|
8112 else if (put_escstr(fd, *valuep, 2) == FAIL)
|
|
8113 return FAIL;
|
|
8114 }
|
|
8115 if (put_eol(fd) < 0)
|
|
8116 return FAIL;
|
|
8117 return OK;
|
|
8118 }
|
|
8119
|
|
8120 static int
|
|
8121 put_setnum(fd, cmd, name, valuep)
|
|
8122 FILE *fd;
|
|
8123 char *cmd;
|
|
8124 char *name;
|
|
8125 long *valuep;
|
|
8126 {
|
|
8127 long wc;
|
|
8128
|
|
8129 if (fprintf(fd, "%s %s=", cmd, name) < 0)
|
|
8130 return FAIL;
|
|
8131 if (wc_use_keyname((char_u *)valuep, &wc))
|
|
8132 {
|
|
8133 /* print 'wildchar' and 'wildcharm' as a key name */
|
|
8134 if (fputs((char *)get_special_key_name((int)wc, 0), fd) < 0)
|
|
8135 return FAIL;
|
|
8136 }
|
|
8137 else if (fprintf(fd, "%ld", *valuep) < 0)
|
|
8138 return FAIL;
|
|
8139 if (put_eol(fd) < 0)
|
|
8140 return FAIL;
|
|
8141 return OK;
|
|
8142 }
|
|
8143
|
|
8144 static int
|
|
8145 put_setbool(fd, cmd, name, value)
|
|
8146 FILE *fd;
|
|
8147 char *cmd;
|
|
8148 char *name;
|
|
8149 int value;
|
|
8150 {
|
|
8151 if (fprintf(fd, "%s %s%s", cmd, value ? "" : "no", name) < 0
|
|
8152 || put_eol(fd) < 0)
|
|
8153 return FAIL;
|
|
8154 return OK;
|
|
8155 }
|
|
8156
|
|
8157 /*
|
|
8158 * Clear all the terminal options.
|
|
8159 * If the option has been allocated, free the memory.
|
|
8160 * Terminal options are never hidden or indirect.
|
|
8161 */
|
|
8162 void
|
|
8163 clear_termoptions()
|
|
8164 {
|
|
8165 /*
|
|
8166 * Reset a few things before clearing the old options. This may cause
|
|
8167 * outputting a few things that the terminal doesn't understand, but the
|
|
8168 * screen will be cleared later, so this is OK.
|
|
8169 */
|
|
8170 #ifdef FEAT_MOUSE_TTY
|
|
8171 mch_setmouse(FALSE); /* switch mouse off */
|
|
8172 #endif
|
|
8173 #ifdef FEAT_TITLE
|
|
8174 mch_restore_title(3); /* restore window titles */
|
|
8175 #endif
|
|
8176 #if defined(FEAT_XCLIPBOARD) && defined(FEAT_GUI)
|
|
8177 /* When starting the GUI close the display opened for the clipboard.
|
|
8178 * After restoring the title, because that will need the display. */
|
|
8179 if (gui.starting)
|
|
8180 clear_xterm_clip();
|
|
8181 #endif
|
|
8182 #ifdef WIN3264
|
|
8183 /*
|
|
8184 * Check if this is allowed now.
|
|
8185 */
|
|
8186 if (can_end_termcap_mode(FALSE) == TRUE)
|
|
8187 #endif
|
|
8188 stoptermcap(); /* stop termcap mode */
|
|
8189
|
359
|
8190 free_termoptions();
|
|
8191 }
|
|
8192
|
|
8193 void
|
|
8194 free_termoptions()
|
|
8195 {
|
|
8196 struct vimoption *p;
|
|
8197
|
7
|
8198 for (p = &options[0]; p->fullname != NULL; p++)
|
|
8199 if (istermoption(p))
|
|
8200 {
|
|
8201 if (p->flags & P_ALLOCED)
|
|
8202 free_string_option(*(char_u **)(p->var));
|
|
8203 if (p->flags & P_DEF_ALLOCED)
|
|
8204 free_string_option(p->def_val[VI_DEFAULT]);
|
|
8205 *(char_u **)(p->var) = empty_option;
|
|
8206 p->def_val[VI_DEFAULT] = empty_option;
|
|
8207 p->flags &= ~(P_ALLOCED|P_DEF_ALLOCED);
|
|
8208 }
|
|
8209 clear_termcodes();
|
|
8210 }
|
|
8211
|
|
8212 /*
|
|
8213 * Set the terminal option defaults to the current value.
|
|
8214 * Used after setting the terminal name.
|
|
8215 */
|
|
8216 void
|
|
8217 set_term_defaults()
|
|
8218 {
|
|
8219 struct vimoption *p;
|
|
8220
|
|
8221 for (p = &options[0]; p->fullname != NULL; p++)
|
|
8222 {
|
|
8223 if (istermoption(p) && p->def_val[VI_DEFAULT] != *(char_u **)(p->var))
|
|
8224 {
|
|
8225 if (p->flags & P_DEF_ALLOCED)
|
|
8226 {
|
|
8227 free_string_option(p->def_val[VI_DEFAULT]);
|
|
8228 p->flags &= ~P_DEF_ALLOCED;
|
|
8229 }
|
|
8230 p->def_val[VI_DEFAULT] = *(char_u **)(p->var);
|
|
8231 if (p->flags & P_ALLOCED)
|
|
8232 {
|
|
8233 p->flags |= P_DEF_ALLOCED;
|
|
8234 p->flags &= ~P_ALLOCED; /* don't free the value now */
|
|
8235 }
|
|
8236 }
|
|
8237 }
|
|
8238 }
|
|
8239
|
|
8240 /*
|
|
8241 * return TRUE if 'p' starts with 't_'
|
|
8242 */
|
|
8243 static int
|
|
8244 istermoption(p)
|
|
8245 struct vimoption *p;
|
|
8246 {
|
|
8247 return (p->fullname[0] == 't' && p->fullname[1] == '_');
|
|
8248 }
|
|
8249
|
|
8250 /*
|
|
8251 * Compute columns for ruler and shown command. 'sc_col' is also used to
|
|
8252 * decide what the maximum length of a message on the status line can be.
|
|
8253 * If there is a status line for the last window, 'sc_col' is independent
|
|
8254 * of 'ru_col'.
|
|
8255 */
|
|
8256
|
|
8257 #define COL_RULER 17 /* columns needed by standard ruler */
|
|
8258
|
|
8259 void
|
|
8260 comp_col()
|
|
8261 {
|
|
8262 #if defined(FEAT_CMDL_INFO) && defined(FEAT_WINDOWS)
|
|
8263 int last_has_status = (p_ls == 2 || (p_ls == 1 && firstwin != lastwin));
|
|
8264
|
|
8265 sc_col = 0;
|
|
8266 ru_col = 0;
|
|
8267 if (p_ru)
|
|
8268 {
|
|
8269 #ifdef FEAT_STL_OPT
|
|
8270 ru_col = (ru_wid ? ru_wid : COL_RULER) + 1;
|
|
8271 #else
|
|
8272 ru_col = COL_RULER + 1;
|
|
8273 #endif
|
|
8274 /* no last status line, adjust sc_col */
|
|
8275 if (!last_has_status)
|
|
8276 sc_col = ru_col;
|
|
8277 }
|
|
8278 if (p_sc)
|
|
8279 {
|
|
8280 sc_col += SHOWCMD_COLS;
|
|
8281 if (!p_ru || last_has_status) /* no need for separating space */
|
|
8282 ++sc_col;
|
|
8283 }
|
|
8284 sc_col = Columns - sc_col;
|
|
8285 ru_col = Columns - ru_col;
|
|
8286 if (sc_col <= 0) /* screen too narrow, will become a mess */
|
|
8287 sc_col = 1;
|
|
8288 if (ru_col <= 0)
|
|
8289 ru_col = 1;
|
|
8290 #else
|
|
8291 sc_col = Columns;
|
|
8292 ru_col = Columns;
|
|
8293 #endif
|
|
8294 }
|
|
8295
|
|
8296 /*
|
|
8297 * Get pointer to option variable, depending on local or global scope.
|
|
8298 */
|
|
8299 static char_u *
|
|
8300 get_varp_scope(p, opt_flags)
|
|
8301 struct vimoption *p;
|
|
8302 int opt_flags;
|
|
8303 {
|
|
8304 if ((opt_flags & OPT_GLOBAL) && p->indir != PV_NONE)
|
|
8305 {
|
|
8306 if (p->var == VAR_WIN)
|
|
8307 return (char_u *)GLOBAL_WO(get_varp(p));
|
|
8308 return p->var;
|
|
8309 }
|
|
8310 if ((opt_flags & OPT_LOCAL) && (int)p->indir >= PV_BOTH)
|
|
8311 {
|
|
8312 switch ((int)p->indir)
|
|
8313 {
|
|
8314 #ifdef FEAT_QUICKFIX
|
|
8315 case OPT_BOTH(PV_GP): return (char_u *)&(curbuf->b_p_gp);
|
|
8316 case OPT_BOTH(PV_MP): return (char_u *)&(curbuf->b_p_mp);
|
|
8317 case OPT_BOTH(PV_EFM): return (char_u *)&(curbuf->b_p_efm);
|
|
8318 #endif
|
|
8319 case OPT_BOTH(PV_EP): return (char_u *)&(curbuf->b_p_ep);
|
|
8320 case OPT_BOTH(PV_KP): return (char_u *)&(curbuf->b_p_kp);
|
|
8321 case OPT_BOTH(PV_PATH): return (char_u *)&(curbuf->b_p_path);
|
|
8322 case OPT_BOTH(PV_AR): return (char_u *)&(curbuf->b_p_ar);
|
|
8323 case OPT_BOTH(PV_TAGS): return (char_u *)&(curbuf->b_p_tags);
|
|
8324 #ifdef FEAT_FIND_ID
|
|
8325 case OPT_BOTH(PV_DEF): return (char_u *)&(curbuf->b_p_def);
|
|
8326 case OPT_BOTH(PV_INC): return (char_u *)&(curbuf->b_p_inc);
|
|
8327 #endif
|
|
8328 #ifdef FEAT_INS_EXPAND
|
|
8329 case OPT_BOTH(PV_DICT): return (char_u *)&(curbuf->b_p_dict);
|
|
8330 case OPT_BOTH(PV_TSR): return (char_u *)&(curbuf->b_p_tsr);
|
|
8331 #endif
|
40
|
8332 #ifdef FEAT_STL_OPT
|
|
8333 case OPT_BOTH(PV_STL): return (char_u *)&(curwin->w_p_stl);
|
|
8334 #endif
|
7
|
8335 }
|
|
8336 return NULL; /* "cannot happen" */
|
|
8337 }
|
|
8338 return get_varp(p);
|
|
8339 }
|
|
8340
|
|
8341 /*
|
|
8342 * Get pointer to option variable.
|
|
8343 */
|
|
8344 static char_u *
|
|
8345 get_varp(p)
|
|
8346 struct vimoption *p;
|
|
8347 {
|
|
8348 /* hidden option, always return NULL */
|
|
8349 if (p->var == NULL)
|
|
8350 return NULL;
|
|
8351
|
|
8352 switch ((int)p->indir)
|
|
8353 {
|
|
8354 case PV_NONE: return p->var;
|
|
8355
|
|
8356 /* global option with local value: use local value if it's been set */
|
|
8357 case OPT_BOTH(PV_EP): return *curbuf->b_p_ep != NUL
|
|
8358 ? (char_u *)&curbuf->b_p_ep : p->var;
|
|
8359 case OPT_BOTH(PV_KP): return *curbuf->b_p_kp != NUL
|
|
8360 ? (char_u *)&curbuf->b_p_kp : p->var;
|
|
8361 case OPT_BOTH(PV_PATH): return *curbuf->b_p_path != NUL
|
|
8362 ? (char_u *)&(curbuf->b_p_path) : p->var;
|
|
8363 case OPT_BOTH(PV_AR): return curbuf->b_p_ar >= 0
|
|
8364 ? (char_u *)&(curbuf->b_p_ar) : p->var;
|
|
8365 case OPT_BOTH(PV_TAGS): return *curbuf->b_p_tags != NUL
|
|
8366 ? (char_u *)&(curbuf->b_p_tags) : p->var;
|
|
8367 #ifdef FEAT_FIND_ID
|
|
8368 case OPT_BOTH(PV_DEF): return *curbuf->b_p_def != NUL
|
|
8369 ? (char_u *)&(curbuf->b_p_def) : p->var;
|
|
8370 case OPT_BOTH(PV_INC): return *curbuf->b_p_inc != NUL
|
|
8371 ? (char_u *)&(curbuf->b_p_inc) : p->var;
|
|
8372 #endif
|
|
8373 #ifdef FEAT_INS_EXPAND
|
|
8374 case OPT_BOTH(PV_DICT): return *curbuf->b_p_dict != NUL
|
|
8375 ? (char_u *)&(curbuf->b_p_dict) : p->var;
|
|
8376 case OPT_BOTH(PV_TSR): return *curbuf->b_p_tsr != NUL
|
|
8377 ? (char_u *)&(curbuf->b_p_tsr) : p->var;
|
|
8378 #endif
|
|
8379 #ifdef FEAT_QUICKFIX
|
|
8380 case OPT_BOTH(PV_GP): return *curbuf->b_p_gp != NUL
|
|
8381 ? (char_u *)&(curbuf->b_p_gp) : p->var;
|
|
8382 case OPT_BOTH(PV_MP): return *curbuf->b_p_mp != NUL
|
|
8383 ? (char_u *)&(curbuf->b_p_mp) : p->var;
|
|
8384 case OPT_BOTH(PV_EFM): return *curbuf->b_p_efm != NUL
|
|
8385 ? (char_u *)&(curbuf->b_p_efm) : p->var;
|
|
8386 #endif
|
40
|
8387 #ifdef FEAT_STL_OPT
|
|
8388 case OPT_BOTH(PV_STL): return *curwin->w_p_stl != NUL
|
|
8389 ? (char_u *)&(curwin->w_p_stl) : p->var;
|
|
8390 #endif
|
7
|
8391
|
|
8392 #ifdef FEAT_ARABIC
|
|
8393 case PV_ARAB: return (char_u *)&(curwin->w_p_arab);
|
|
8394 #endif
|
|
8395 case PV_LIST: return (char_u *)&(curwin->w_p_list);
|
221
|
8396 #ifdef FEAT_SYN_HL
|
|
8397 case PV_SPELL: return (char_u *)&(curwin->w_p_spell);
|
|
8398 #endif
|
7
|
8399 #ifdef FEAT_DIFF
|
|
8400 case PV_DIFF: return (char_u *)&(curwin->w_p_diff);
|
|
8401 #endif
|
|
8402 #ifdef FEAT_FOLDING
|
|
8403 case PV_FDC: return (char_u *)&(curwin->w_p_fdc);
|
|
8404 case PV_FEN: return (char_u *)&(curwin->w_p_fen);
|
|
8405 case PV_FDI: return (char_u *)&(curwin->w_p_fdi);
|
|
8406 case PV_FDL: return (char_u *)&(curwin->w_p_fdl);
|
|
8407 case PV_FDM: return (char_u *)&(curwin->w_p_fdm);
|
|
8408 case PV_FML: return (char_u *)&(curwin->w_p_fml);
|
|
8409 case PV_FDN: return (char_u *)&(curwin->w_p_fdn);
|
|
8410 # ifdef FEAT_EVAL
|
|
8411 case PV_FDE: return (char_u *)&(curwin->w_p_fde);
|
|
8412 case PV_FDT: return (char_u *)&(curwin->w_p_fdt);
|
|
8413 # endif
|
|
8414 case PV_FMR: return (char_u *)&(curwin->w_p_fmr);
|
|
8415 #endif
|
|
8416 case PV_NU: return (char_u *)&(curwin->w_p_nu);
|
13
|
8417 #ifdef FEAT_LINEBREAK
|
|
8418 case PV_NUW: return (char_u *)&(curwin->w_p_nuw);
|
|
8419 #endif
|
7
|
8420 #if defined(FEAT_WINDOWS)
|
|
8421 case PV_WFH: return (char_u *)&(curwin->w_p_wfh);
|
|
8422 #endif
|
|
8423 #if defined(FEAT_WINDOWS) && defined(FEAT_QUICKFIX)
|
|
8424 case PV_PVW: return (char_u *)&(curwin->w_p_pvw);
|
|
8425 #endif
|
|
8426 #ifdef FEAT_RIGHTLEFT
|
|
8427 case PV_RL: return (char_u *)&(curwin->w_p_rl);
|
|
8428 case PV_RLC: return (char_u *)&(curwin->w_p_rlc);
|
|
8429 #endif
|
|
8430 case PV_SCROLL: return (char_u *)&(curwin->w_p_scr);
|
|
8431 case PV_WRAP: return (char_u *)&(curwin->w_p_wrap);
|
|
8432 #ifdef FEAT_LINEBREAK
|
|
8433 case PV_LBR: return (char_u *)&(curwin->w_p_lbr);
|
|
8434 #endif
|
|
8435 #ifdef FEAT_SCROLLBIND
|
|
8436 case PV_SCBIND: return (char_u *)&(curwin->w_p_scb);
|
|
8437 #endif
|
|
8438
|
|
8439 case PV_AI: return (char_u *)&(curbuf->b_p_ai);
|
|
8440 case PV_BIN: return (char_u *)&(curbuf->b_p_bin);
|
|
8441 #ifdef FEAT_MBYTE
|
|
8442 case PV_BOMB: return (char_u *)&(curbuf->b_p_bomb);
|
|
8443 #endif
|
|
8444 #if defined(FEAT_QUICKFIX)
|
|
8445 case PV_BH: return (char_u *)&(curbuf->b_p_bh);
|
|
8446 case PV_BT: return (char_u *)&(curbuf->b_p_bt);
|
|
8447 #endif
|
|
8448 case PV_BL: return (char_u *)&(curbuf->b_p_bl);
|
|
8449 case PV_CI: return (char_u *)&(curbuf->b_p_ci);
|
|
8450 #ifdef FEAT_CINDENT
|
|
8451 case PV_CIN: return (char_u *)&(curbuf->b_p_cin);
|
|
8452 case PV_CINK: return (char_u *)&(curbuf->b_p_cink);
|
|
8453 case PV_CINO: return (char_u *)&(curbuf->b_p_cino);
|
|
8454 #endif
|
|
8455 #if defined(FEAT_SMARTINDENT) || defined(FEAT_CINDENT)
|
|
8456 case PV_CINW: return (char_u *)&(curbuf->b_p_cinw);
|
|
8457 #endif
|
|
8458 #ifdef FEAT_COMMENTS
|
|
8459 case PV_COM: return (char_u *)&(curbuf->b_p_com);
|
|
8460 #endif
|
|
8461 #ifdef FEAT_FOLDING
|
|
8462 case PV_CMS: return (char_u *)&(curbuf->b_p_cms);
|
|
8463 #endif
|
|
8464 #ifdef FEAT_INS_EXPAND
|
|
8465 case PV_CPT: return (char_u *)&(curbuf->b_p_cpt);
|
|
8466 #endif
|
12
|
8467 #ifdef FEAT_COMPL_FUNC
|
|
8468 case PV_CFU: return (char_u *)&(curbuf->b_p_cfu);
|
502
|
8469 case PV_OFU: return (char_u *)&(curbuf->b_p_ofu);
|
12
|
8470 #endif
|
7
|
8471 case PV_EOL: return (char_u *)&(curbuf->b_p_eol);
|
|
8472 case PV_ET: return (char_u *)&(curbuf->b_p_et);
|
|
8473 #ifdef FEAT_MBYTE
|
|
8474 case PV_FENC: return (char_u *)&(curbuf->b_p_fenc);
|
|
8475 #endif
|
|
8476 case PV_FF: return (char_u *)&(curbuf->b_p_ff);
|
|
8477 #ifdef FEAT_AUTOCMD
|
|
8478 case PV_FT: return (char_u *)&(curbuf->b_p_ft);
|
|
8479 #endif
|
|
8480 case PV_FO: return (char_u *)&(curbuf->b_p_fo);
|
41
|
8481 case PV_FLP: return (char_u *)&(curbuf->b_p_flp);
|
7
|
8482 case PV_IMI: return (char_u *)&(curbuf->b_p_iminsert);
|
|
8483 case PV_IMS: return (char_u *)&(curbuf->b_p_imsearch);
|
|
8484 case PV_INF: return (char_u *)&(curbuf->b_p_inf);
|
|
8485 case PV_ISK: return (char_u *)&(curbuf->b_p_isk);
|
|
8486 #ifdef FEAT_FIND_ID
|
|
8487 # ifdef FEAT_EVAL
|
|
8488 case PV_INEX: return (char_u *)&(curbuf->b_p_inex);
|
|
8489 # endif
|
|
8490 #endif
|
|
8491 #if defined(FEAT_CINDENT) && defined(FEAT_EVAL)
|
|
8492 case PV_INDE: return (char_u *)&(curbuf->b_p_inde);
|
|
8493 case PV_INDK: return (char_u *)&(curbuf->b_p_indk);
|
|
8494 #endif
|
|
8495 #ifdef FEAT_CRYPT
|
|
8496 case PV_KEY: return (char_u *)&(curbuf->b_p_key);
|
|
8497 #endif
|
|
8498 #ifdef FEAT_LISP
|
|
8499 case PV_LISP: return (char_u *)&(curbuf->b_p_lisp);
|
|
8500 #endif
|
|
8501 case PV_ML: return (char_u *)&(curbuf->b_p_ml);
|
|
8502 case PV_MPS: return (char_u *)&(curbuf->b_p_mps);
|
|
8503 case PV_MA: return (char_u *)&(curbuf->b_p_ma);
|
|
8504 case PV_MOD: return (char_u *)&(curbuf->b_changed);
|
|
8505 case PV_NF: return (char_u *)&(curbuf->b_p_nf);
|
|
8506 #ifdef FEAT_OSFILETYPE
|
|
8507 case PV_OFT: return (char_u *)&(curbuf->b_p_oft);
|
|
8508 #endif
|
|
8509 case PV_PI: return (char_u *)&(curbuf->b_p_pi);
|
12
|
8510 #ifdef FEAT_TEXTOBJ
|
|
8511 case PV_QE: return (char_u *)&(curbuf->b_p_qe);
|
|
8512 #endif
|
7
|
8513 case PV_RO: return (char_u *)&(curbuf->b_p_ro);
|
|
8514 #ifdef FEAT_SMARTINDENT
|
|
8515 case PV_SI: return (char_u *)&(curbuf->b_p_si);
|
|
8516 #endif
|
|
8517 #ifndef SHORT_FNAME
|
|
8518 case PV_SN: return (char_u *)&(curbuf->b_p_sn);
|
|
8519 #endif
|
|
8520 case PV_STS: return (char_u *)&(curbuf->b_p_sts);
|
|
8521 #ifdef FEAT_SEARCHPATH
|
|
8522 case PV_SUA: return (char_u *)&(curbuf->b_p_sua);
|
|
8523 #endif
|
|
8524 case PV_SWF: return (char_u *)&(curbuf->b_p_swf);
|
|
8525 #ifdef FEAT_SYN_HL
|
410
|
8526 case PV_SMC: return (char_u *)&(curbuf->b_p_smc);
|
7
|
8527 case PV_SYN: return (char_u *)&(curbuf->b_p_syn);
|
386
|
8528 case PV_SPC: return (char_u *)&(curbuf->b_p_spc);
|
314
|
8529 case PV_SPF: return (char_u *)&(curbuf->b_p_spf);
|
221
|
8530 case PV_SPL: return (char_u *)&(curbuf->b_p_spl);
|
7
|
8531 #endif
|
|
8532 case PV_SW: return (char_u *)&(curbuf->b_p_sw);
|
|
8533 case PV_TS: return (char_u *)&(curbuf->b_p_ts);
|
|
8534 case PV_TW: return (char_u *)&(curbuf->b_p_tw);
|
|
8535 case PV_TX: return (char_u *)&(curbuf->b_p_tx);
|
|
8536 case PV_WM: return (char_u *)&(curbuf->b_p_wm);
|
|
8537 #ifdef FEAT_KEYMAP
|
|
8538 case PV_KMAP: return (char_u *)&(curbuf->b_p_keymap);
|
|
8539 #endif
|
|
8540 default: EMSG(_("E356: get_varp ERROR"));
|
|
8541 }
|
|
8542 /* always return a valid pointer to avoid a crash! */
|
|
8543 return (char_u *)&(curbuf->b_p_wm);
|
|
8544 }
|
|
8545
|
|
8546 /*
|
|
8547 * Get the value of 'equalprg', either the buffer-local one or the global one.
|
|
8548 */
|
|
8549 char_u *
|
|
8550 get_equalprg()
|
|
8551 {
|
|
8552 if (*curbuf->b_p_ep == NUL)
|
|
8553 return p_ep;
|
|
8554 return curbuf->b_p_ep;
|
|
8555 }
|
|
8556
|
|
8557 #if defined(FEAT_WINDOWS) || defined(PROTO)
|
|
8558 /*
|
|
8559 * Copy options from one window to another.
|
|
8560 * Used when splitting a window.
|
|
8561 */
|
|
8562 void
|
|
8563 win_copy_options(wp_from, wp_to)
|
|
8564 win_T *wp_from;
|
|
8565 win_T *wp_to;
|
|
8566 {
|
|
8567 copy_winopt(&wp_from->w_onebuf_opt, &wp_to->w_onebuf_opt);
|
|
8568 copy_winopt(&wp_from->w_allbuf_opt, &wp_to->w_allbuf_opt);
|
|
8569 # ifdef FEAT_RIGHTLEFT
|
|
8570 # ifdef FEAT_FKMAP
|
|
8571 /* Is this right? */
|
|
8572 wp_to->w_farsi = wp_from->w_farsi;
|
|
8573 # endif
|
|
8574 # endif
|
|
8575 }
|
|
8576 #endif
|
|
8577
|
|
8578 /*
|
|
8579 * Copy the options from one winopt_T to another.
|
|
8580 * Doesn't free the old option values in "to", use clear_winopt() for that.
|
|
8581 * The 'scroll' option is not copied, because it depends on the window height.
|
|
8582 * The 'previewwindow' option is reset, there can be only one preview window.
|
|
8583 */
|
|
8584 void
|
|
8585 copy_winopt(from, to)
|
|
8586 winopt_T *from;
|
|
8587 winopt_T *to;
|
|
8588 {
|
|
8589 #ifdef FEAT_ARABIC
|
|
8590 to->wo_arab = from->wo_arab;
|
|
8591 #endif
|
|
8592 to->wo_list = from->wo_list;
|
|
8593 to->wo_nu = from->wo_nu;
|
13
|
8594 #ifdef FEAT_LINEBREAK
|
|
8595 to->wo_nuw = from->wo_nuw;
|
|
8596 #endif
|
7
|
8597 #ifdef FEAT_RIGHTLEFT
|
|
8598 to->wo_rl = from->wo_rl;
|
|
8599 to->wo_rlc = vim_strsave(from->wo_rlc);
|
|
8600 #endif
|
40
|
8601 #ifdef FEAT_STL_OPT
|
|
8602 to->wo_stl = vim_strsave(from->wo_stl);
|
|
8603 #endif
|
7
|
8604 to->wo_wrap = from->wo_wrap;
|
|
8605 #ifdef FEAT_LINEBREAK
|
|
8606 to->wo_lbr = from->wo_lbr;
|
|
8607 #endif
|
|
8608 #ifdef FEAT_SCROLLBIND
|
|
8609 to->wo_scb = from->wo_scb;
|
|
8610 #endif
|
221
|
8611 #ifdef FEAT_SYN_HL
|
|
8612 to->wo_spell = from->wo_spell;
|
|
8613 #endif
|
7
|
8614 #ifdef FEAT_DIFF
|
|
8615 to->wo_diff = from->wo_diff;
|
|
8616 #endif
|
|
8617 #ifdef FEAT_FOLDING
|
|
8618 to->wo_fdc = from->wo_fdc;
|
|
8619 to->wo_fen = from->wo_fen;
|
|
8620 to->wo_fdi = vim_strsave(from->wo_fdi);
|
|
8621 to->wo_fml = from->wo_fml;
|
|
8622 to->wo_fdl = from->wo_fdl;
|
|
8623 to->wo_fdm = vim_strsave(from->wo_fdm);
|
|
8624 to->wo_fdn = from->wo_fdn;
|
|
8625 # ifdef FEAT_EVAL
|
|
8626 to->wo_fde = vim_strsave(from->wo_fde);
|
|
8627 to->wo_fdt = vim_strsave(from->wo_fdt);
|
|
8628 # endif
|
|
8629 to->wo_fmr = vim_strsave(from->wo_fmr);
|
|
8630 #endif
|
|
8631 check_winopt(to); /* don't want NULL pointers */
|
|
8632 }
|
|
8633
|
|
8634 /*
|
|
8635 * Check string options in a window for a NULL value.
|
|
8636 */
|
|
8637 void
|
|
8638 check_win_options(win)
|
|
8639 win_T *win;
|
|
8640 {
|
|
8641 check_winopt(&win->w_onebuf_opt);
|
|
8642 check_winopt(&win->w_allbuf_opt);
|
|
8643 }
|
|
8644
|
|
8645 /*
|
|
8646 * Check for NULL pointers in a winopt_T and replace them with empty_option.
|
|
8647 */
|
|
8648 /*ARGSUSED*/
|
|
8649 void
|
|
8650 check_winopt(wop)
|
|
8651 winopt_T *wop;
|
|
8652 {
|
|
8653 #ifdef FEAT_FOLDING
|
|
8654 check_string_option(&wop->wo_fdi);
|
|
8655 check_string_option(&wop->wo_fdm);
|
|
8656 # ifdef FEAT_EVAL
|
|
8657 check_string_option(&wop->wo_fde);
|
|
8658 check_string_option(&wop->wo_fdt);
|
|
8659 # endif
|
|
8660 check_string_option(&wop->wo_fmr);
|
|
8661 #endif
|
|
8662 #ifdef FEAT_RIGHTLEFT
|
|
8663 check_string_option(&wop->wo_rlc);
|
|
8664 #endif
|
40
|
8665 #ifdef FEAT_STL_OPT
|
|
8666 check_string_option(&wop->wo_stl);
|
|
8667 #endif
|
7
|
8668 }
|
|
8669
|
|
8670 /*
|
|
8671 * Free the allocated memory inside a winopt_T.
|
|
8672 */
|
|
8673 /*ARGSUSED*/
|
|
8674 void
|
|
8675 clear_winopt(wop)
|
|
8676 winopt_T *wop;
|
|
8677 {
|
|
8678 #ifdef FEAT_FOLDING
|
|
8679 clear_string_option(&wop->wo_fdi);
|
|
8680 clear_string_option(&wop->wo_fdm);
|
|
8681 # ifdef FEAT_EVAL
|
|
8682 clear_string_option(&wop->wo_fde);
|
|
8683 clear_string_option(&wop->wo_fdt);
|
|
8684 # endif
|
|
8685 clear_string_option(&wop->wo_fmr);
|
|
8686 #endif
|
|
8687 #ifdef FEAT_RIGHTLEFT
|
|
8688 clear_string_option(&wop->wo_rlc);
|
|
8689 #endif
|
40
|
8690 #ifdef FEAT_STL_OPT
|
|
8691 clear_string_option(&wop->wo_stl);
|
|
8692 #endif
|
7
|
8693 }
|
|
8694
|
|
8695 /*
|
|
8696 * Copy global option values to local options for one buffer.
|
|
8697 * Used when creating a new buffer and sometimes when entering a buffer.
|
|
8698 * flags:
|
|
8699 * BCO_ENTER We will enter the buf buffer.
|
|
8700 * BCO_ALWAYS Always copy the options, but only set b_p_initialized when
|
|
8701 * appropriate.
|
|
8702 * BCO_NOHELP Don't copy the values to a help buffer.
|
|
8703 */
|
|
8704 void
|
|
8705 buf_copy_options(buf, flags)
|
|
8706 buf_T *buf;
|
|
8707 int flags;
|
|
8708 {
|
|
8709 int should_copy = TRUE;
|
|
8710 char_u *save_p_isk = NULL; /* init for GCC */
|
|
8711 int dont_do_help;
|
|
8712 int did_isk = FALSE;
|
|
8713
|
|
8714 /*
|
|
8715 * Don't do anything of the buffer is invalid.
|
|
8716 */
|
|
8717 if (buf == NULL || !buf_valid(buf))
|
|
8718 return;
|
|
8719
|
|
8720 /*
|
|
8721 * Skip this when the option defaults have not been set yet. Happens when
|
|
8722 * main() allocates the first buffer.
|
|
8723 */
|
|
8724 if (p_cpo != NULL)
|
|
8725 {
|
|
8726 /*
|
|
8727 * Always copy when entering and 'cpo' contains 'S'.
|
|
8728 * Don't copy when already initialized.
|
|
8729 * Don't copy when 'cpo' contains 's' and not entering.
|
|
8730 * 'S' BCO_ENTER initialized 's' should_copy
|
|
8731 * yes yes X X TRUE
|
|
8732 * yes no yes X FALSE
|
|
8733 * no X yes X FALSE
|
|
8734 * X no no yes FALSE
|
|
8735 * X no no no TRUE
|
|
8736 * no yes no X TRUE
|
|
8737 */
|
|
8738 if ((vim_strchr(p_cpo, CPO_BUFOPTGLOB) == NULL || !(flags & BCO_ENTER))
|
|
8739 && (buf->b_p_initialized
|
|
8740 || (!(flags & BCO_ENTER)
|
|
8741 && vim_strchr(p_cpo, CPO_BUFOPT) != NULL)))
|
|
8742 should_copy = FALSE;
|
|
8743
|
|
8744 if (should_copy || (flags & BCO_ALWAYS))
|
|
8745 {
|
|
8746 /* Don't copy the options specific to a help buffer when
|
|
8747 * BCO_NOHELP is given or the options were initialized already
|
|
8748 * (jumping back to a help file with CTRL-T or CTRL-O) */
|
|
8749 dont_do_help = ((flags & BCO_NOHELP) && buf->b_help)
|
|
8750 || buf->b_p_initialized;
|
|
8751 if (dont_do_help) /* don't free b_p_isk */
|
|
8752 {
|
|
8753 save_p_isk = buf->b_p_isk;
|
|
8754 buf->b_p_isk = NULL;
|
|
8755 }
|
|
8756 /*
|
|
8757 * Always free the allocated strings.
|
|
8758 * If not already initialized, set 'readonly' and copy 'fileformat'.
|
|
8759 */
|
|
8760 if (!buf->b_p_initialized)
|
|
8761 {
|
|
8762 free_buf_options(buf, TRUE);
|
|
8763 buf->b_p_ro = FALSE; /* don't copy readonly */
|
|
8764 buf->b_p_tx = p_tx;
|
|
8765 #ifdef FEAT_MBYTE
|
|
8766 buf->b_p_fenc = vim_strsave(p_fenc);
|
|
8767 #endif
|
|
8768 buf->b_p_ff = vim_strsave(p_ff);
|
|
8769 #if defined(FEAT_QUICKFIX)
|
|
8770 buf->b_p_bh = empty_option;
|
|
8771 buf->b_p_bt = empty_option;
|
|
8772 #endif
|
|
8773 }
|
|
8774 else
|
|
8775 free_buf_options(buf, FALSE);
|
|
8776
|
|
8777 buf->b_p_ai = p_ai;
|
|
8778 buf->b_p_ai_nopaste = p_ai_nopaste;
|
|
8779 buf->b_p_sw = p_sw;
|
|
8780 buf->b_p_tw = p_tw;
|
|
8781 buf->b_p_tw_nopaste = p_tw_nopaste;
|
|
8782 buf->b_p_tw_nobin = p_tw_nobin;
|
|
8783 buf->b_p_wm = p_wm;
|
|
8784 buf->b_p_wm_nopaste = p_wm_nopaste;
|
|
8785 buf->b_p_wm_nobin = p_wm_nobin;
|
|
8786 buf->b_p_bin = p_bin;
|
402
|
8787 #ifdef FEAT_MBYTE
|
|
8788 buf->b_p_bomb = p_bomb;
|
|
8789 #endif
|
7
|
8790 buf->b_p_et = p_et;
|
|
8791 buf->b_p_et_nobin = p_et_nobin;
|
|
8792 buf->b_p_ml = p_ml;
|
|
8793 buf->b_p_ml_nobin = p_ml_nobin;
|
|
8794 buf->b_p_inf = p_inf;
|
|
8795 buf->b_p_swf = p_swf;
|
|
8796 #ifdef FEAT_INS_EXPAND
|
|
8797 buf->b_p_cpt = vim_strsave(p_cpt);
|
|
8798 #endif
|
12
|
8799 #ifdef FEAT_COMPL_FUNC
|
|
8800 buf->b_p_cfu = vim_strsave(p_cfu);
|
502
|
8801 buf->b_p_ofu = vim_strsave(p_ofu);
|
12
|
8802 #endif
|
7
|
8803 buf->b_p_sts = p_sts;
|
|
8804 buf->b_p_sts_nopaste = p_sts_nopaste;
|
|
8805 #ifndef SHORT_FNAME
|
|
8806 buf->b_p_sn = p_sn;
|
|
8807 #endif
|
|
8808 #ifdef FEAT_COMMENTS
|
|
8809 buf->b_p_com = vim_strsave(p_com);
|
|
8810 #endif
|
|
8811 #ifdef FEAT_FOLDING
|
|
8812 buf->b_p_cms = vim_strsave(p_cms);
|
|
8813 #endif
|
|
8814 buf->b_p_fo = vim_strsave(p_fo);
|
41
|
8815 buf->b_p_flp = vim_strsave(p_flp);
|
7
|
8816 buf->b_p_nf = vim_strsave(p_nf);
|
|
8817 buf->b_p_mps = vim_strsave(p_mps);
|
|
8818 #ifdef FEAT_SMARTINDENT
|
|
8819 buf->b_p_si = p_si;
|
|
8820 #endif
|
|
8821 buf->b_p_ci = p_ci;
|
|
8822 #ifdef FEAT_CINDENT
|
|
8823 buf->b_p_cin = p_cin;
|
|
8824 buf->b_p_cink = vim_strsave(p_cink);
|
|
8825 buf->b_p_cino = vim_strsave(p_cino);
|
|
8826 #endif
|
|
8827 #ifdef FEAT_AUTOCMD
|
|
8828 /* Don't copy 'filetype', it must be detected */
|
|
8829 buf->b_p_ft = empty_option;
|
|
8830 #endif
|
|
8831 #ifdef FEAT_OSFILETYPE
|
|
8832 buf->b_p_oft = vim_strsave(p_oft);
|
|
8833 #endif
|
|
8834 buf->b_p_pi = p_pi;
|
|
8835 #if defined(FEAT_SMARTINDENT) || defined(FEAT_CINDENT)
|
|
8836 buf->b_p_cinw = vim_strsave(p_cinw);
|
|
8837 #endif
|
|
8838 #ifdef FEAT_LISP
|
|
8839 buf->b_p_lisp = p_lisp;
|
|
8840 #endif
|
|
8841 #ifdef FEAT_SYN_HL
|
|
8842 /* Don't copy 'syntax', it must be set */
|
|
8843 buf->b_p_syn = empty_option;
|
410
|
8844 buf->b_p_smc = p_smc;
|
386
|
8845 buf->b_p_spc = vim_strsave(p_spc);
|
389
|
8846 (void)compile_cap_prog(buf);
|
314
|
8847 buf->b_p_spf = vim_strsave(p_spf);
|
221
|
8848 buf->b_p_spl = vim_strsave(p_spl);
|
7
|
8849 #endif
|
|
8850 #if defined(FEAT_CINDENT) && defined(FEAT_EVAL)
|
|
8851 buf->b_p_inde = vim_strsave(p_inde);
|
|
8852 buf->b_p_indk = vim_strsave(p_indk);
|
|
8853 #endif
|
|
8854 #ifdef FEAT_CRYPT
|
|
8855 buf->b_p_key = vim_strsave(p_key);
|
|
8856 #endif
|
|
8857 #ifdef FEAT_SEARCHPATH
|
|
8858 buf->b_p_sua = vim_strsave(p_sua);
|
|
8859 #endif
|
|
8860 #ifdef FEAT_KEYMAP
|
|
8861 buf->b_p_keymap = vim_strsave(p_keymap);
|
|
8862 buf->b_kmap_state |= KEYMAP_INIT;
|
|
8863 #endif
|
|
8864 /* This isn't really an option, but copying the langmap and IME
|
|
8865 * state from the current buffer is better than resetting it. */
|
|
8866 buf->b_p_iminsert = p_iminsert;
|
|
8867 buf->b_p_imsearch = p_imsearch;
|
|
8868
|
|
8869 /* options that are normally global but also have a local value
|
|
8870 * are not copied, start using the global value */
|
|
8871 buf->b_p_ar = -1;
|
|
8872 #ifdef FEAT_QUICKFIX
|
|
8873 buf->b_p_gp = empty_option;
|
|
8874 buf->b_p_mp = empty_option;
|
|
8875 buf->b_p_efm = empty_option;
|
|
8876 #endif
|
|
8877 buf->b_p_ep = empty_option;
|
|
8878 buf->b_p_kp = empty_option;
|
|
8879 buf->b_p_path = empty_option;
|
|
8880 buf->b_p_tags = empty_option;
|
|
8881 #ifdef FEAT_FIND_ID
|
|
8882 buf->b_p_def = empty_option;
|
|
8883 buf->b_p_inc = empty_option;
|
|
8884 # ifdef FEAT_EVAL
|
|
8885 buf->b_p_inex = vim_strsave(p_inex);
|
|
8886 # endif
|
|
8887 #endif
|
|
8888 #ifdef FEAT_INS_EXPAND
|
|
8889 buf->b_p_dict = empty_option;
|
|
8890 buf->b_p_tsr = empty_option;
|
|
8891 #endif
|
12
|
8892 #ifdef FEAT_TEXTOBJ
|
|
8893 buf->b_p_qe = vim_strsave(p_qe);
|
|
8894 #endif
|
7
|
8895
|
|
8896 /*
|
|
8897 * Don't copy the options set by ex_help(), use the saved values,
|
|
8898 * when going from a help buffer to a non-help buffer.
|
|
8899 * Don't touch these at all when BCO_NOHELP is used and going from
|
|
8900 * or to a help buffer.
|
|
8901 */
|
|
8902 if (dont_do_help)
|
|
8903 buf->b_p_isk = save_p_isk;
|
|
8904 else
|
|
8905 {
|
|
8906 buf->b_p_isk = vim_strsave(p_isk);
|
|
8907 did_isk = TRUE;
|
|
8908 buf->b_p_ts = p_ts;
|
|
8909 buf->b_help = FALSE;
|
|
8910 #ifdef FEAT_QUICKFIX
|
|
8911 if (buf->b_p_bt[0] == 'h')
|
|
8912 clear_string_option(&buf->b_p_bt);
|
|
8913 #endif
|
|
8914 buf->b_p_ma = p_ma;
|
|
8915 }
|
|
8916 }
|
|
8917
|
|
8918 /*
|
|
8919 * When the options should be copied (ignoring BCO_ALWAYS), set the
|
|
8920 * flag that indicates that the options have been initialized.
|
|
8921 */
|
|
8922 if (should_copy)
|
|
8923 buf->b_p_initialized = TRUE;
|
|
8924 }
|
|
8925
|
|
8926 check_buf_options(buf); /* make sure we don't have NULLs */
|
|
8927 if (did_isk)
|
|
8928 (void)buf_init_chartab(buf, FALSE);
|
|
8929 }
|
|
8930
|
|
8931 /*
|
|
8932 * Reset the 'modifiable' option and its default value.
|
|
8933 */
|
|
8934 void
|
|
8935 reset_modifiable()
|
|
8936 {
|
|
8937 int opt_idx;
|
|
8938
|
|
8939 curbuf->b_p_ma = FALSE;
|
|
8940 p_ma = FALSE;
|
|
8941 opt_idx = findoption((char_u *)"ma");
|
|
8942 options[opt_idx].def_val[VI_DEFAULT] = FALSE;
|
|
8943 }
|
|
8944
|
|
8945 /*
|
|
8946 * Set the global value for 'iminsert' to the local value.
|
|
8947 */
|
|
8948 void
|
|
8949 set_iminsert_global()
|
|
8950 {
|
|
8951 p_iminsert = curbuf->b_p_iminsert;
|
|
8952 }
|
|
8953
|
|
8954 /*
|
|
8955 * Set the global value for 'imsearch' to the local value.
|
|
8956 */
|
|
8957 void
|
|
8958 set_imsearch_global()
|
|
8959 {
|
|
8960 p_imsearch = curbuf->b_p_imsearch;
|
|
8961 }
|
|
8962
|
|
8963 #if defined(FEAT_CMDL_COMPL) || defined(PROTO)
|
|
8964 static int expand_option_idx = -1;
|
|
8965 static char_u expand_option_name[5] = {'t', '_', NUL, NUL, NUL};
|
|
8966 static int expand_option_flags = 0;
|
|
8967
|
|
8968 void
|
|
8969 set_context_in_set_cmd(xp, arg, opt_flags)
|
|
8970 expand_T *xp;
|
|
8971 char_u *arg;
|
|
8972 int opt_flags; /* OPT_GLOBAL and/or OPT_LOCAL */
|
|
8973 {
|
|
8974 int nextchar;
|
|
8975 long_u flags = 0; /* init for GCC */
|
|
8976 int opt_idx = 0; /* init for GCC */
|
|
8977 char_u *p;
|
|
8978 char_u *s;
|
|
8979 int is_term_option = FALSE;
|
|
8980 int key;
|
|
8981
|
|
8982 expand_option_flags = opt_flags;
|
|
8983
|
|
8984 xp->xp_context = EXPAND_SETTINGS;
|
|
8985 if (*arg == NUL)
|
|
8986 {
|
|
8987 xp->xp_pattern = arg;
|
|
8988 return;
|
|
8989 }
|
|
8990 p = arg + STRLEN(arg) - 1;
|
|
8991 if (*p == ' ' && *(p - 1) != '\\')
|
|
8992 {
|
|
8993 xp->xp_pattern = p + 1;
|
|
8994 return;
|
|
8995 }
|
|
8996 while (p > arg)
|
|
8997 {
|
|
8998 s = p;
|
|
8999 /* count number of backslashes before ' ' or ',' */
|
|
9000 if (*p == ' ' || *p == ',')
|
|
9001 {
|
|
9002 while (s > arg && *(s - 1) == '\\')
|
|
9003 --s;
|
|
9004 }
|
|
9005 /* break at a space with an even number of backslashes */
|
|
9006 if (*p == ' ' && ((p - s) & 1) == 0)
|
|
9007 {
|
|
9008 ++p;
|
|
9009 break;
|
|
9010 }
|
|
9011 --p;
|
|
9012 }
|
|
9013 if (STRNCMP(p, "no", 2) == 0)
|
|
9014 {
|
|
9015 xp->xp_context = EXPAND_BOOL_SETTINGS;
|
|
9016 p += 2;
|
|
9017 }
|
|
9018 if (STRNCMP(p, "inv", 3) == 0)
|
|
9019 {
|
|
9020 xp->xp_context = EXPAND_BOOL_SETTINGS;
|
|
9021 p += 3;
|
|
9022 }
|
|
9023 xp->xp_pattern = arg = p;
|
|
9024 if (*arg == '<')
|
|
9025 {
|
|
9026 while (*p != '>')
|
|
9027 if (*p++ == NUL) /* expand terminal option name */
|
|
9028 return;
|
|
9029 key = get_special_key_code(arg + 1);
|
|
9030 if (key == 0) /* unknown name */
|
|
9031 {
|
|
9032 xp->xp_context = EXPAND_NOTHING;
|
|
9033 return;
|
|
9034 }
|
|
9035 nextchar = *++p;
|
|
9036 is_term_option = TRUE;
|
|
9037 expand_option_name[2] = KEY2TERMCAP0(key);
|
|
9038 expand_option_name[3] = KEY2TERMCAP1(key);
|
|
9039 }
|
|
9040 else
|
|
9041 {
|
|
9042 if (p[0] == 't' && p[1] == '_')
|
|
9043 {
|
|
9044 p += 2;
|
|
9045 if (*p != NUL)
|
|
9046 ++p;
|
|
9047 if (*p == NUL)
|
|
9048 return; /* expand option name */
|
|
9049 nextchar = *++p;
|
|
9050 is_term_option = TRUE;
|
|
9051 expand_option_name[2] = p[-2];
|
|
9052 expand_option_name[3] = p[-1];
|
|
9053 }
|
|
9054 else
|
|
9055 {
|
|
9056 /* Allow * wildcard */
|
|
9057 while (ASCII_ISALNUM(*p) || *p == '_' || *p == '*')
|
|
9058 p++;
|
|
9059 if (*p == NUL)
|
|
9060 return;
|
|
9061 nextchar = *p;
|
|
9062 *p = NUL;
|
|
9063 opt_idx = findoption(arg);
|
|
9064 *p = nextchar;
|
|
9065 if (opt_idx == -1 || options[opt_idx].var == NULL)
|
|
9066 {
|
|
9067 xp->xp_context = EXPAND_NOTHING;
|
|
9068 return;
|
|
9069 }
|
|
9070 flags = options[opt_idx].flags;
|
|
9071 if (flags & P_BOOL)
|
|
9072 {
|
|
9073 xp->xp_context = EXPAND_NOTHING;
|
|
9074 return;
|
|
9075 }
|
|
9076 }
|
|
9077 }
|
|
9078 /* handle "-=" and "+=" */
|
|
9079 if ((nextchar == '-' || nextchar == '+' || nextchar == '^') && p[1] == '=')
|
|
9080 {
|
|
9081 ++p;
|
|
9082 nextchar = '=';
|
|
9083 }
|
|
9084 if ((nextchar != '=' && nextchar != ':')
|
|
9085 || xp->xp_context == EXPAND_BOOL_SETTINGS)
|
|
9086 {
|
|
9087 xp->xp_context = EXPAND_UNSUCCESSFUL;
|
|
9088 return;
|
|
9089 }
|
|
9090 if (xp->xp_context != EXPAND_BOOL_SETTINGS && p[1] == NUL)
|
|
9091 {
|
|
9092 xp->xp_context = EXPAND_OLD_SETTING;
|
|
9093 if (is_term_option)
|
|
9094 expand_option_idx = -1;
|
|
9095 else
|
|
9096 expand_option_idx = opt_idx;
|
|
9097 xp->xp_pattern = p + 1;
|
|
9098 return;
|
|
9099 }
|
|
9100 xp->xp_context = EXPAND_NOTHING;
|
|
9101 if (is_term_option || (flags & P_NUM))
|
|
9102 return;
|
|
9103
|
|
9104 xp->xp_pattern = p + 1;
|
|
9105
|
|
9106 if (flags & P_EXPAND)
|
|
9107 {
|
|
9108 p = options[opt_idx].var;
|
|
9109 if (p == (char_u *)&p_bdir
|
|
9110 || p == (char_u *)&p_dir
|
|
9111 || p == (char_u *)&p_path
|
|
9112 || p == (char_u *)&p_rtp
|
|
9113 #ifdef FEAT_SEARCHPATH
|
|
9114 || p == (char_u *)&p_cdpath
|
|
9115 #endif
|
|
9116 #ifdef FEAT_SESSION
|
|
9117 || p == (char_u *)&p_vdir
|
|
9118 #endif
|
|
9119 )
|
|
9120 {
|
|
9121 xp->xp_context = EXPAND_DIRECTORIES;
|
|
9122 if (p == (char_u *)&p_path
|
|
9123 #ifdef FEAT_SEARCHPATH
|
|
9124 || p == (char_u *)&p_cdpath
|
|
9125 #endif
|
|
9126 )
|
|
9127 xp->xp_backslash = XP_BS_THREE;
|
|
9128 else
|
|
9129 xp->xp_backslash = XP_BS_ONE;
|
|
9130 }
|
|
9131 else
|
|
9132 {
|
|
9133 xp->xp_context = EXPAND_FILES;
|
|
9134 /* for 'tags' need three backslashes for a space */
|
|
9135 if (p == (char_u *)&p_tags)
|
|
9136 xp->xp_backslash = XP_BS_THREE;
|
|
9137 else
|
|
9138 xp->xp_backslash = XP_BS_ONE;
|
|
9139 }
|
|
9140 }
|
|
9141
|
|
9142 /* For an option that is a list of file names, find the start of the
|
|
9143 * last file name. */
|
|
9144 for (p = arg + STRLEN(arg) - 1; p > xp->xp_pattern; --p)
|
|
9145 {
|
|
9146 /* count number of backslashes before ' ' or ',' */
|
|
9147 if (*p == ' ' || *p == ',')
|
|
9148 {
|
|
9149 s = p;
|
|
9150 while (s > xp->xp_pattern && *(s - 1) == '\\')
|
|
9151 --s;
|
|
9152 if ((*p == ' ' && (xp->xp_backslash == XP_BS_THREE && (p - s) < 3))
|
|
9153 || (*p == ',' && (flags & P_COMMA) && ((p - s) & 1) == 0))
|
|
9154 {
|
|
9155 xp->xp_pattern = p + 1;
|
|
9156 break;
|
|
9157 }
|
|
9158 }
|
374
|
9159
|
|
9160 #ifdef FEAT_SYN_HL
|
|
9161 /* for 'spellsuggest' start at "file:" */
|
|
9162 if (options[opt_idx].var == (char_u *)&p_sps
|
|
9163 && STRNCMP(p, "file:", 5) == 0)
|
|
9164 {
|
|
9165 xp->xp_pattern = p + 5;
|
|
9166 break;
|
|
9167 }
|
|
9168 #endif
|
7
|
9169 }
|
|
9170
|
|
9171 return;
|
|
9172 }
|
|
9173
|
|
9174 int
|
|
9175 ExpandSettings(xp, regmatch, num_file, file)
|
|
9176 expand_T *xp;
|
|
9177 regmatch_T *regmatch;
|
|
9178 int *num_file;
|
|
9179 char_u ***file;
|
|
9180 {
|
|
9181 int num_normal = 0; /* Nr of matching non-term-code settings */
|
|
9182 int num_term = 0; /* Nr of matching terminal code settings */
|
|
9183 int opt_idx;
|
|
9184 int match;
|
|
9185 int count = 0;
|
|
9186 char_u *str;
|
|
9187 int loop;
|
|
9188 int is_term_opt;
|
|
9189 char_u name_buf[MAX_KEY_NAME_LEN];
|
|
9190 static char *(names[]) = {"all", "termcap"};
|
|
9191 int ic = regmatch->rm_ic; /* remember the ignore-case flag */
|
|
9192
|
|
9193 /* do this loop twice:
|
|
9194 * loop == 0: count the number of matching options
|
|
9195 * loop == 1: copy the matching options into allocated memory
|
|
9196 */
|
|
9197 for (loop = 0; loop <= 1; ++loop)
|
|
9198 {
|
|
9199 regmatch->rm_ic = ic;
|
|
9200 if (xp->xp_context != EXPAND_BOOL_SETTINGS)
|
|
9201 {
|
|
9202 for (match = 0; match < sizeof(names) / sizeof(char *); ++match)
|
|
9203 if (vim_regexec(regmatch, (char_u *)names[match], (colnr_T)0))
|
|
9204 {
|
|
9205 if (loop == 0)
|
|
9206 num_normal++;
|
|
9207 else
|
|
9208 (*file)[count++] = vim_strsave((char_u *)names[match]);
|
|
9209 }
|
|
9210 }
|
|
9211 for (opt_idx = 0; (str = (char_u *)options[opt_idx].fullname) != NULL;
|
|
9212 opt_idx++)
|
|
9213 {
|
|
9214 if (options[opt_idx].var == NULL)
|
|
9215 continue;
|
|
9216 if (xp->xp_context == EXPAND_BOOL_SETTINGS
|
|
9217 && !(options[opt_idx].flags & P_BOOL))
|
|
9218 continue;
|
|
9219 is_term_opt = istermoption(&options[opt_idx]);
|
|
9220 if (is_term_opt && num_normal > 0)
|
|
9221 continue;
|
|
9222 match = FALSE;
|
|
9223 if (vim_regexec(regmatch, str, (colnr_T)0)
|
|
9224 || (options[opt_idx].shortname != NULL
|
|
9225 && vim_regexec(regmatch,
|
|
9226 (char_u *)options[opt_idx].shortname, (colnr_T)0)))
|
|
9227 match = TRUE;
|
|
9228 else if (is_term_opt)
|
|
9229 {
|
|
9230 name_buf[0] = '<';
|
|
9231 name_buf[1] = 't';
|
|
9232 name_buf[2] = '_';
|
|
9233 name_buf[3] = str[2];
|
|
9234 name_buf[4] = str[3];
|
|
9235 name_buf[5] = '>';
|
|
9236 name_buf[6] = NUL;
|
|
9237 if (vim_regexec(regmatch, name_buf, (colnr_T)0))
|
|
9238 {
|
|
9239 match = TRUE;
|
|
9240 str = name_buf;
|
|
9241 }
|
|
9242 }
|
|
9243 if (match)
|
|
9244 {
|
|
9245 if (loop == 0)
|
|
9246 {
|
|
9247 if (is_term_opt)
|
|
9248 num_term++;
|
|
9249 else
|
|
9250 num_normal++;
|
|
9251 }
|
|
9252 else
|
|
9253 (*file)[count++] = vim_strsave(str);
|
|
9254 }
|
|
9255 }
|
|
9256 /*
|
|
9257 * Check terminal key codes, these are not in the option table
|
|
9258 */
|
|
9259 if (xp->xp_context != EXPAND_BOOL_SETTINGS && num_normal == 0)
|
|
9260 {
|
|
9261 for (opt_idx = 0; (str = get_termcode(opt_idx)) != NULL; opt_idx++)
|
|
9262 {
|
|
9263 if (!isprint(str[0]) || !isprint(str[1]))
|
|
9264 continue;
|
|
9265
|
|
9266 name_buf[0] = 't';
|
|
9267 name_buf[1] = '_';
|
|
9268 name_buf[2] = str[0];
|
|
9269 name_buf[3] = str[1];
|
|
9270 name_buf[4] = NUL;
|
|
9271
|
|
9272 match = FALSE;
|
|
9273 if (vim_regexec(regmatch, name_buf, (colnr_T)0))
|
|
9274 match = TRUE;
|
|
9275 else
|
|
9276 {
|
|
9277 name_buf[0] = '<';
|
|
9278 name_buf[1] = 't';
|
|
9279 name_buf[2] = '_';
|
|
9280 name_buf[3] = str[0];
|
|
9281 name_buf[4] = str[1];
|
|
9282 name_buf[5] = '>';
|
|
9283 name_buf[6] = NUL;
|
|
9284
|
|
9285 if (vim_regexec(regmatch, name_buf, (colnr_T)0))
|
|
9286 match = TRUE;
|
|
9287 }
|
|
9288 if (match)
|
|
9289 {
|
|
9290 if (loop == 0)
|
|
9291 num_term++;
|
|
9292 else
|
|
9293 (*file)[count++] = vim_strsave(name_buf);
|
|
9294 }
|
|
9295 }
|
|
9296
|
|
9297 /*
|
|
9298 * Check special key names.
|
|
9299 */
|
|
9300 regmatch->rm_ic = TRUE; /* ignore case here */
|
|
9301 for (opt_idx = 0; (str = get_key_name(opt_idx)) != NULL; opt_idx++)
|
|
9302 {
|
|
9303 name_buf[0] = '<';
|
|
9304 STRCPY(name_buf + 1, str);
|
|
9305 STRCAT(name_buf, ">");
|
|
9306
|
|
9307 if (vim_regexec(regmatch, name_buf, (colnr_T)0))
|
|
9308 {
|
|
9309 if (loop == 0)
|
|
9310 num_term++;
|
|
9311 else
|
|
9312 (*file)[count++] = vim_strsave(name_buf);
|
|
9313 }
|
|
9314 }
|
|
9315 }
|
|
9316 if (loop == 0)
|
|
9317 {
|
|
9318 if (num_normal > 0)
|
|
9319 *num_file = num_normal;
|
|
9320 else if (num_term > 0)
|
|
9321 *num_file = num_term;
|
|
9322 else
|
|
9323 return OK;
|
|
9324 *file = (char_u **)alloc((unsigned)(*num_file * sizeof(char_u *)));
|
|
9325 if (*file == NULL)
|
|
9326 {
|
|
9327 *file = (char_u **)"";
|
|
9328 return FAIL;
|
|
9329 }
|
|
9330 }
|
|
9331 }
|
|
9332 return OK;
|
|
9333 }
|
|
9334
|
|
9335 int
|
|
9336 ExpandOldSetting(num_file, file)
|
|
9337 int *num_file;
|
|
9338 char_u ***file;
|
|
9339 {
|
|
9340 char_u *var = NULL; /* init for GCC */
|
|
9341 char_u *buf;
|
|
9342
|
|
9343 *num_file = 0;
|
|
9344 *file = (char_u **)alloc((unsigned)sizeof(char_u *));
|
|
9345 if (*file == NULL)
|
|
9346 return FAIL;
|
|
9347
|
|
9348 /*
|
|
9349 * For a terminal key code expand_option_idx is < 0.
|
|
9350 */
|
|
9351 if (expand_option_idx < 0)
|
|
9352 {
|
|
9353 var = find_termcode(expand_option_name + 2);
|
|
9354 if (var == NULL)
|
|
9355 expand_option_idx = findoption(expand_option_name);
|
|
9356 }
|
|
9357
|
|
9358 if (expand_option_idx >= 0)
|
|
9359 {
|
|
9360 /* put string of option value in NameBuff */
|
|
9361 option_value2string(&options[expand_option_idx], expand_option_flags);
|
|
9362 var = NameBuff;
|
|
9363 }
|
|
9364 else if (var == NULL)
|
|
9365 var = (char_u *)"";
|
|
9366
|
|
9367 /* A backslash is required before some characters. This is the reverse of
|
|
9368 * what happens in do_set(). */
|
|
9369 buf = vim_strsave_escaped(var, escape_chars);
|
|
9370
|
|
9371 if (buf == NULL)
|
|
9372 {
|
|
9373 vim_free(*file);
|
|
9374 *file = NULL;
|
|
9375 return FAIL;
|
|
9376 }
|
|
9377
|
|
9378 #ifdef BACKSLASH_IN_FILENAME
|
|
9379 /* For MS-Windows et al. we don't double backslashes at the start and
|
|
9380 * before a file name character. */
|
39
|
9381 for (var = buf; *var != NUL; mb_ptr_adv(var))
|
7
|
9382 if (var[0] == '\\' && var[1] == '\\'
|
|
9383 && expand_option_idx >= 0
|
|
9384 && (options[expand_option_idx].flags & P_EXPAND)
|
|
9385 && vim_isfilec(var[2])
|
|
9386 && (var[2] != '\\' || (var == buf && var[4] != '\\')))
|
|
9387 mch_memmove(var, var + 1, STRLEN(var));
|
|
9388 #endif
|
|
9389
|
|
9390 *file[0] = buf;
|
|
9391 *num_file = 1;
|
|
9392 return OK;
|
|
9393 }
|
|
9394 #endif
|
|
9395
|
|
9396 /*
|
|
9397 * Get the value for the numeric or string option *opp in a nice format into
|
|
9398 * NameBuff[]. Must not be called with a hidden option!
|
|
9399 */
|
|
9400 static void
|
|
9401 option_value2string(opp, opt_flags)
|
|
9402 struct vimoption *opp;
|
|
9403 int opt_flags; /* OPT_GLOBAL and/or OPT_LOCAL */
|
|
9404 {
|
|
9405 char_u *varp;
|
|
9406
|
|
9407 varp = get_varp_scope(opp, opt_flags);
|
|
9408
|
|
9409 if (opp->flags & P_NUM)
|
|
9410 {
|
|
9411 long wc = 0;
|
|
9412
|
|
9413 if (wc_use_keyname(varp, &wc))
|
|
9414 STRCPY(NameBuff, get_special_key_name((int)wc, 0));
|
|
9415 else if (wc != 0)
|
|
9416 STRCPY(NameBuff, transchar((int)wc));
|
|
9417 else
|
|
9418 sprintf((char *)NameBuff, "%ld", *(long *)varp);
|
|
9419 }
|
|
9420 else /* P_STRING */
|
|
9421 {
|
|
9422 varp = *(char_u **)(varp);
|
|
9423 if (varp == NULL) /* just in case */
|
|
9424 NameBuff[0] = NUL;
|
|
9425 #ifdef FEAT_CRYPT
|
|
9426 /* don't show the actual value of 'key', only that it's set */
|
|
9427 if (opp->var == (char_u *)&p_key && *varp)
|
|
9428 STRCPY(NameBuff, "*****");
|
|
9429 #endif
|
|
9430 else if (opp->flags & P_EXPAND)
|
|
9431 home_replace(NULL, varp, NameBuff, MAXPATHL, FALSE);
|
|
9432 /* Translate 'pastetoggle' into special key names */
|
|
9433 else if ((char_u **)opp->var == &p_pt)
|
|
9434 str2specialbuf(p_pt, NameBuff, MAXPATHL);
|
|
9435 else
|
419
|
9436 vim_strncpy(NameBuff, varp, MAXPATHL - 1);
|
7
|
9437 }
|
|
9438 }
|
|
9439
|
|
9440 /*
|
|
9441 * Return TRUE if "varp" points to 'wildchar' or 'wildcharm' and it can be
|
|
9442 * printed as a keyname.
|
|
9443 * "*wcp" is set to the value of the option if it's 'wildchar' or 'wildcharm'.
|
|
9444 */
|
|
9445 static int
|
|
9446 wc_use_keyname(varp, wcp)
|
|
9447 char_u *varp;
|
|
9448 long *wcp;
|
|
9449 {
|
|
9450 if (((long *)varp == &p_wc) || ((long *)varp == &p_wcm))
|
|
9451 {
|
|
9452 *wcp = *(long *)varp;
|
|
9453 if (IS_SPECIAL(*wcp) || find_special_key_in_table((int)*wcp) >= 0)
|
|
9454 return TRUE;
|
|
9455 }
|
|
9456 return FALSE;
|
|
9457 }
|
|
9458
|
|
9459 #ifdef FEAT_LANGMAP
|
|
9460 /*
|
|
9461 * Any character has an equivalent character. This is used for keyboards that
|
|
9462 * have a special language mode that sends characters above 128 (although
|
|
9463 * other characters can be translated too).
|
|
9464 */
|
|
9465
|
|
9466 /*
|
|
9467 * char_u langmap_mapchar[256];
|
|
9468 * Normally maps each of the 128 upper chars to an <128 ascii char; used to
|
|
9469 * "translate" native lang chars in normal mode or some cases of
|
|
9470 * insert mode without having to tediously switch lang mode back&forth.
|
|
9471 */
|
|
9472
|
|
9473 static void
|
|
9474 langmap_init()
|
|
9475 {
|
|
9476 int i;
|
|
9477
|
|
9478 for (i = 0; i < 256; i++) /* we init with a-one-to one map */
|
|
9479 langmap_mapchar[i] = i;
|
|
9480 }
|
|
9481
|
|
9482 /*
|
|
9483 * Called when langmap option is set; the language map can be
|
|
9484 * changed at any time!
|
|
9485 */
|
|
9486 static void
|
|
9487 langmap_set()
|
|
9488 {
|
|
9489 char_u *p;
|
|
9490 char_u *p2;
|
|
9491 int from, to;
|
|
9492
|
|
9493 langmap_init(); /* back to one-to-one map first */
|
|
9494
|
|
9495 for (p = p_langmap; p[0] != NUL; )
|
|
9496 {
|
39
|
9497 for (p2 = p; p2[0] != NUL && p2[0] != ',' && p2[0] != ';';
|
|
9498 mb_ptr_adv(p2))
|
7
|
9499 {
|
|
9500 if (p2[0] == '\\' && p2[1] != NUL)
|
|
9501 ++p2;
|
|
9502 }
|
|
9503 if (p2[0] == ';')
|
|
9504 ++p2; /* abcd;ABCD form, p2 points to A */
|
|
9505 else
|
|
9506 p2 = NULL; /* aAbBcCdD form, p2 is NULL */
|
|
9507 while (p[0])
|
|
9508 {
|
|
9509 if (p[0] == '\\' && p[1] != NUL)
|
|
9510 ++p;
|
|
9511 #ifdef FEAT_MBYTE
|
|
9512 from = (*mb_ptr2char)(p);
|
|
9513 #else
|
|
9514 from = p[0];
|
|
9515 #endif
|
|
9516 if (p2 == NULL)
|
|
9517 {
|
39
|
9518 mb_ptr_adv(p);
|
7
|
9519 if (p[0] == '\\')
|
|
9520 ++p;
|
|
9521 #ifdef FEAT_MBYTE
|
|
9522 to = (*mb_ptr2char)(p);
|
|
9523 #else
|
|
9524 to = p[0];
|
|
9525 #endif
|
|
9526 }
|
|
9527 else
|
|
9528 {
|
|
9529 if (p2[0] == '\\')
|
|
9530 ++p2;
|
|
9531 #ifdef FEAT_MBYTE
|
|
9532 to = (*mb_ptr2char)(p2);
|
|
9533 #else
|
|
9534 to = p2[0];
|
|
9535 #endif
|
|
9536 }
|
|
9537 if (to == NUL)
|
|
9538 {
|
|
9539 EMSG2(_("E357: 'langmap': Matching character missing for %s"),
|
|
9540 transchar(from));
|
|
9541 return;
|
|
9542 }
|
|
9543 langmap_mapchar[from & 255] = to;
|
|
9544
|
|
9545 /* Advance to next pair */
|
39
|
9546 mb_ptr_adv(p);
|
7
|
9547 if (p2 == NULL)
|
|
9548 {
|
|
9549 if (p[0] == ',')
|
|
9550 {
|
|
9551 ++p;
|
|
9552 break;
|
|
9553 }
|
|
9554 }
|
|
9555 else
|
|
9556 {
|
39
|
9557 mb_ptr_adv(p2);
|
7
|
9558 if (*p == ';')
|
|
9559 {
|
|
9560 p = p2;
|
|
9561 if (p[0] != NUL)
|
|
9562 {
|
|
9563 if (p[0] != ',')
|
|
9564 {
|
|
9565 EMSG2(_("E358: 'langmap': Extra characters after semicolon: %s"), p);
|
|
9566 return;
|
|
9567 }
|
|
9568 ++p;
|
|
9569 }
|
|
9570 break;
|
|
9571 }
|
|
9572 }
|
|
9573 }
|
|
9574 }
|
|
9575 }
|
|
9576 #endif
|
|
9577
|
|
9578 /*
|
|
9579 * Return TRUE if format option 'x' is in effect.
|
|
9580 * Take care of no formatting when 'paste' is set.
|
|
9581 */
|
|
9582 int
|
|
9583 has_format_option(x)
|
|
9584 int x;
|
|
9585 {
|
|
9586 if (p_paste)
|
|
9587 return FALSE;
|
|
9588 return (vim_strchr(curbuf->b_p_fo, x) != NULL);
|
|
9589 }
|
|
9590
|
|
9591 /*
|
|
9592 * Return TRUE if "x" is present in 'shortmess' option, or
|
|
9593 * 'shortmess' contains 'a' and "x" is present in SHM_A.
|
|
9594 */
|
|
9595 int
|
|
9596 shortmess(x)
|
|
9597 int x;
|
|
9598 {
|
|
9599 return ( vim_strchr(p_shm, x) != NULL
|
|
9600 || (vim_strchr(p_shm, 'a') != NULL
|
|
9601 && vim_strchr((char_u *)SHM_A, x) != NULL));
|
|
9602 }
|
|
9603
|
|
9604 /*
|
|
9605 * paste_option_changed() - Called after p_paste was set or reset.
|
|
9606 */
|
|
9607 static void
|
|
9608 paste_option_changed()
|
|
9609 {
|
|
9610 static int old_p_paste = FALSE;
|
|
9611 static int save_sm = 0;
|
|
9612 #ifdef FEAT_CMDL_INFO
|
|
9613 static int save_ru = 0;
|
|
9614 #endif
|
|
9615 #ifdef FEAT_RIGHTLEFT
|
|
9616 static int save_ri = 0;
|
|
9617 static int save_hkmap = 0;
|
|
9618 #endif
|
|
9619 buf_T *buf;
|
|
9620
|
|
9621 if (p_paste)
|
|
9622 {
|
|
9623 /*
|
|
9624 * Paste switched from off to on.
|
|
9625 * Save the current values, so they can be restored later.
|
|
9626 */
|
|
9627 if (!old_p_paste)
|
|
9628 {
|
|
9629 /* save options for each buffer */
|
|
9630 for (buf = firstbuf; buf != NULL; buf = buf->b_next)
|
|
9631 {
|
|
9632 buf->b_p_tw_nopaste = buf->b_p_tw;
|
|
9633 buf->b_p_wm_nopaste = buf->b_p_wm;
|
|
9634 buf->b_p_sts_nopaste = buf->b_p_sts;
|
|
9635 buf->b_p_ai_nopaste = buf->b_p_ai;
|
|
9636 }
|
|
9637
|
|
9638 /* save global options */
|
|
9639 save_sm = p_sm;
|
|
9640 #ifdef FEAT_CMDL_INFO
|
|
9641 save_ru = p_ru;
|
|
9642 #endif
|
|
9643 #ifdef FEAT_RIGHTLEFT
|
|
9644 save_ri = p_ri;
|
|
9645 save_hkmap = p_hkmap;
|
|
9646 #endif
|
|
9647 /* save global values for local buffer options */
|
|
9648 p_tw_nopaste = p_tw;
|
|
9649 p_wm_nopaste = p_wm;
|
|
9650 p_sts_nopaste = p_sts;
|
|
9651 p_ai_nopaste = p_ai;
|
|
9652 }
|
|
9653
|
|
9654 /*
|
|
9655 * Always set the option values, also when 'paste' is set when it is
|
|
9656 * already on.
|
|
9657 */
|
|
9658 /* set options for each buffer */
|
|
9659 for (buf = firstbuf; buf != NULL; buf = buf->b_next)
|
|
9660 {
|
|
9661 buf->b_p_tw = 0; /* textwidth is 0 */
|
|
9662 buf->b_p_wm = 0; /* wrapmargin is 0 */
|
|
9663 buf->b_p_sts = 0; /* softtabstop is 0 */
|
|
9664 buf->b_p_ai = 0; /* no auto-indent */
|
|
9665 }
|
|
9666
|
|
9667 /* set global options */
|
|
9668 p_sm = 0; /* no showmatch */
|
|
9669 #ifdef FEAT_CMDL_INFO
|
|
9670 # ifdef FEAT_WINDOWS
|
|
9671 if (p_ru)
|
|
9672 status_redraw_all(); /* redraw to remove the ruler */
|
|
9673 # endif
|
|
9674 p_ru = 0; /* no ruler */
|
|
9675 #endif
|
|
9676 #ifdef FEAT_RIGHTLEFT
|
|
9677 p_ri = 0; /* no reverse insert */
|
|
9678 p_hkmap = 0; /* no Hebrew keyboard */
|
|
9679 #endif
|
|
9680 /* set global values for local buffer options */
|
|
9681 p_tw = 0;
|
|
9682 p_wm = 0;
|
|
9683 p_sts = 0;
|
|
9684 p_ai = 0;
|
|
9685 }
|
|
9686
|
|
9687 /*
|
|
9688 * Paste switched from on to off: Restore saved values.
|
|
9689 */
|
|
9690 else if (old_p_paste)
|
|
9691 {
|
|
9692 /* restore options for each buffer */
|
|
9693 for (buf = firstbuf; buf != NULL; buf = buf->b_next)
|
|
9694 {
|
|
9695 buf->b_p_tw = buf->b_p_tw_nopaste;
|
|
9696 buf->b_p_wm = buf->b_p_wm_nopaste;
|
|
9697 buf->b_p_sts = buf->b_p_sts_nopaste;
|
|
9698 buf->b_p_ai = buf->b_p_ai_nopaste;
|
|
9699 }
|
|
9700
|
|
9701 /* restore global options */
|
|
9702 p_sm = save_sm;
|
|
9703 #ifdef FEAT_CMDL_INFO
|
|
9704 # ifdef FEAT_WINDOWS
|
|
9705 if (p_ru != save_ru)
|
|
9706 status_redraw_all(); /* redraw to draw the ruler */
|
|
9707 # endif
|
|
9708 p_ru = save_ru;
|
|
9709 #endif
|
|
9710 #ifdef FEAT_RIGHTLEFT
|
|
9711 p_ri = save_ri;
|
|
9712 p_hkmap = save_hkmap;
|
|
9713 #endif
|
|
9714 /* set global values for local buffer options */
|
|
9715 p_tw = p_tw_nopaste;
|
|
9716 p_wm = p_wm_nopaste;
|
|
9717 p_sts = p_sts_nopaste;
|
|
9718 p_ai = p_ai_nopaste;
|
|
9719 }
|
|
9720
|
|
9721 old_p_paste = p_paste;
|
|
9722 }
|
|
9723
|
|
9724 /*
|
|
9725 * vimrc_found() - Called when a ".vimrc" or "VIMINIT" has been found.
|
|
9726 *
|
|
9727 * Reset 'compatible' and set the values for options that didn't get set yet
|
|
9728 * to the Vim defaults.
|
|
9729 * Don't do this if the 'compatible' option has been set or reset before.
|
|
9730 */
|
|
9731 void
|
|
9732 vimrc_found()
|
|
9733 {
|
|
9734 int opt_idx;
|
|
9735
|
|
9736 if (!option_was_set((char_u *)"cp"))
|
|
9737 {
|
|
9738 p_cp = FALSE;
|
|
9739 for (opt_idx = 0; !istermoption(&options[opt_idx]); opt_idx++)
|
|
9740 if (!(options[opt_idx].flags & (P_WAS_SET|P_VI_DEF)))
|
|
9741 set_option_default(opt_idx, OPT_FREE, FALSE);
|
|
9742 didset_options();
|
|
9743 }
|
|
9744 }
|
|
9745
|
|
9746 /*
|
|
9747 * Set 'compatible' on or off. Called for "-C" and "-N" command line arg.
|
|
9748 */
|
|
9749 void
|
|
9750 change_compatible(on)
|
|
9751 int on;
|
|
9752 {
|
|
9753 if (p_cp != on)
|
|
9754 {
|
|
9755 p_cp = on;
|
|
9756 compatible_set();
|
|
9757 }
|
|
9758 options[findoption((char_u *)"cp")].flags |= P_WAS_SET;
|
|
9759 }
|
|
9760
|
|
9761 /*
|
|
9762 * Return TRUE when option "name" has been set.
|
|
9763 */
|
|
9764 int
|
|
9765 option_was_set(name)
|
|
9766 char_u *name;
|
|
9767 {
|
|
9768 int idx;
|
|
9769
|
|
9770 idx = findoption(name);
|
|
9771 if (idx < 0) /* unknown option */
|
|
9772 return FALSE;
|
|
9773 if (options[idx].flags & P_WAS_SET)
|
|
9774 return TRUE;
|
|
9775 return FALSE;
|
|
9776 }
|
|
9777
|
|
9778 /*
|
|
9779 * compatible_set() - Called when 'compatible' has been set or unset.
|
|
9780 *
|
|
9781 * When 'compatible' set: Set all relevant options (those that have the P_VIM)
|
|
9782 * flag) to a Vi compatible value.
|
|
9783 * When 'compatible' is unset: Set all options that have a different default
|
|
9784 * for Vim (without the P_VI_DEF flag) to that default.
|
|
9785 */
|
|
9786 static void
|
|
9787 compatible_set()
|
|
9788 {
|
|
9789 int opt_idx;
|
|
9790
|
|
9791 for (opt_idx = 0; !istermoption(&options[opt_idx]); opt_idx++)
|
|
9792 if ( ((options[opt_idx].flags & P_VIM) && p_cp)
|
|
9793 || (!(options[opt_idx].flags & P_VI_DEF) && !p_cp))
|
|
9794 set_option_default(opt_idx, OPT_FREE, p_cp);
|
|
9795 didset_options();
|
|
9796 }
|
|
9797
|
|
9798 #ifdef FEAT_LINEBREAK
|
|
9799
|
|
9800 # if defined(__BORLANDC__) && (__BORLANDC__ < 0x500)
|
|
9801 /* Borland C++ screws up loop optimisation here (negri) */
|
133
|
9802 #pragma option -O-l
|
7
|
9803 # endif
|
|
9804
|
|
9805 /*
|
|
9806 * fill_breakat_flags() -- called when 'breakat' changes value.
|
|
9807 */
|
|
9808 static void
|
|
9809 fill_breakat_flags()
|
|
9810 {
|
500
|
9811 char_u *p;
|
7
|
9812 int i;
|
|
9813
|
|
9814 for (i = 0; i < 256; i++)
|
|
9815 breakat_flags[i] = FALSE;
|
|
9816
|
|
9817 if (p_breakat != NULL)
|
500
|
9818 for (p = p_breakat; *p; p++)
|
|
9819 breakat_flags[*p] = TRUE;
|
7
|
9820 }
|
|
9821
|
|
9822 # if defined(__BORLANDC__) && (__BORLANDC__ < 0x500)
|
133
|
9823 #pragma option -O.l
|
7
|
9824 # endif
|
|
9825
|
|
9826 #endif
|
|
9827
|
|
9828 /*
|
|
9829 * Check an option that can be a range of string values.
|
|
9830 *
|
|
9831 * Return OK for correct value, FAIL otherwise.
|
|
9832 * Empty is always OK.
|
|
9833 */
|
|
9834 static int
|
|
9835 check_opt_strings(val, values, list)
|
|
9836 char_u *val;
|
|
9837 char **values;
|
|
9838 int list; /* when TRUE: accept a list of values */
|
|
9839 {
|
|
9840 return opt_strings_flags(val, values, NULL, list);
|
|
9841 }
|
|
9842
|
|
9843 /*
|
|
9844 * Handle an option that can be a range of string values.
|
|
9845 * Set a flag in "*flagp" for each string present.
|
|
9846 *
|
|
9847 * Return OK for correct value, FAIL otherwise.
|
|
9848 * Empty is always OK.
|
|
9849 */
|
|
9850 static int
|
|
9851 opt_strings_flags(val, values, flagp, list)
|
|
9852 char_u *val; /* new value */
|
|
9853 char **values; /* array of valid string values */
|
|
9854 unsigned *flagp;
|
|
9855 int list; /* when TRUE: accept a list of values */
|
|
9856 {
|
|
9857 int i;
|
|
9858 int len;
|
|
9859 unsigned new_flags = 0;
|
|
9860
|
|
9861 while (*val)
|
|
9862 {
|
|
9863 for (i = 0; ; ++i)
|
|
9864 {
|
|
9865 if (values[i] == NULL) /* val not found in values[] */
|
|
9866 return FAIL;
|
|
9867
|
|
9868 len = (int)STRLEN(values[i]);
|
|
9869 if (STRNCMP(values[i], val, len) == 0
|
|
9870 && ((list && val[len] == ',') || val[len] == NUL))
|
|
9871 {
|
|
9872 val += len + (val[len] == ',');
|
|
9873 new_flags |= (1 << i);
|
|
9874 break; /* check next item in val list */
|
|
9875 }
|
|
9876 }
|
|
9877 }
|
|
9878 if (flagp != NULL)
|
|
9879 *flagp = new_flags;
|
|
9880
|
|
9881 return OK;
|
|
9882 }
|
|
9883
|
|
9884 /*
|
|
9885 * Read the 'wildmode' option, fill wim_flags[].
|
|
9886 */
|
|
9887 static int
|
|
9888 check_opt_wim()
|
|
9889 {
|
|
9890 char_u new_wim_flags[4];
|
|
9891 char_u *p;
|
|
9892 int i;
|
|
9893 int idx = 0;
|
|
9894
|
|
9895 for (i = 0; i < 4; ++i)
|
|
9896 new_wim_flags[i] = 0;
|
|
9897
|
|
9898 for (p = p_wim; *p; ++p)
|
|
9899 {
|
|
9900 for (i = 0; ASCII_ISALPHA(p[i]); ++i)
|
|
9901 ;
|
|
9902 if (p[i] != NUL && p[i] != ',' && p[i] != ':')
|
|
9903 return FAIL;
|
|
9904 if (i == 7 && STRNCMP(p, "longest", 7) == 0)
|
|
9905 new_wim_flags[idx] |= WIM_LONGEST;
|
|
9906 else if (i == 4 && STRNCMP(p, "full", 4) == 0)
|
|
9907 new_wim_flags[idx] |= WIM_FULL;
|
|
9908 else if (i == 4 && STRNCMP(p, "list", 4) == 0)
|
|
9909 new_wim_flags[idx] |= WIM_LIST;
|
|
9910 else
|
|
9911 return FAIL;
|
|
9912 p += i;
|
|
9913 if (*p == NUL)
|
|
9914 break;
|
|
9915 if (*p == ',')
|
|
9916 {
|
|
9917 if (idx == 3)
|
|
9918 return FAIL;
|
|
9919 ++idx;
|
|
9920 }
|
|
9921 }
|
|
9922
|
|
9923 /* fill remaining entries with last flag */
|
|
9924 while (idx < 3)
|
|
9925 {
|
|
9926 new_wim_flags[idx + 1] = new_wim_flags[idx];
|
|
9927 ++idx;
|
|
9928 }
|
|
9929
|
|
9930 /* only when there are no errors, wim_flags[] is changed */
|
|
9931 for (i = 0; i < 4; ++i)
|
|
9932 wim_flags[i] = new_wim_flags[i];
|
|
9933 return OK;
|
|
9934 }
|
|
9935
|
|
9936 /*
|
|
9937 * Check if backspacing over something is allowed.
|
|
9938 */
|
|
9939 int
|
|
9940 can_bs(what)
|
|
9941 int what; /* BS_INDENT, BS_EOL or BS_START */
|
|
9942 {
|
|
9943 switch (*p_bs)
|
|
9944 {
|
|
9945 case '2': return TRUE;
|
|
9946 case '1': return (what != BS_START);
|
|
9947 case '0': return FALSE;
|
|
9948 }
|
|
9949 return vim_strchr(p_bs, what) != NULL;
|
|
9950 }
|
|
9951
|
|
9952 /*
|
|
9953 * Save the current values of 'fileformat' and 'fileencoding', so that we know
|
|
9954 * the file must be considered changed when the value is different.
|
|
9955 */
|
|
9956 void
|
|
9957 save_file_ff(buf)
|
|
9958 buf_T *buf;
|
|
9959 {
|
|
9960 buf->b_start_ffc = *buf->b_p_ff;
|
|
9961 buf->b_start_eol = buf->b_p_eol;
|
|
9962 #ifdef FEAT_MBYTE
|
|
9963 /* Only use free/alloc when necessary, they take time. */
|
|
9964 if (buf->b_start_fenc == NULL
|
|
9965 || STRCMP(buf->b_start_fenc, buf->b_p_fenc) != 0)
|
|
9966 {
|
|
9967 vim_free(buf->b_start_fenc);
|
|
9968 buf->b_start_fenc = vim_strsave(buf->b_p_fenc);
|
|
9969 }
|
|
9970 #endif
|
|
9971 }
|
|
9972
|
|
9973 /*
|
|
9974 * Return TRUE if 'fileformat' and/or 'fileencoding' has a different value
|
|
9975 * from when editing started (save_file_ff() called).
|
|
9976 * Also when 'endofline' was changed and 'binary' is set.
|
|
9977 * Don't consider a new, empty buffer to be changed.
|
|
9978 */
|
|
9979 int
|
|
9980 file_ff_differs(buf)
|
|
9981 buf_T *buf;
|
|
9982 {
|
|
9983 if ((buf->b_flags & BF_NEW)
|
|
9984 && buf->b_ml.ml_line_count == 1
|
|
9985 && *ml_get_buf(buf, (linenr_T)1, FALSE) == NUL)
|
|
9986 return FALSE;
|
|
9987 if (buf->b_start_ffc != *buf->b_p_ff)
|
|
9988 return TRUE;
|
|
9989 if (buf->b_p_bin && buf->b_start_eol != buf->b_p_eol)
|
|
9990 return TRUE;
|
|
9991 #ifdef FEAT_MBYTE
|
|
9992 if (buf->b_start_fenc == NULL)
|
|
9993 return (*buf->b_p_fenc != NUL);
|
|
9994 return (STRCMP(buf->b_start_fenc, buf->b_p_fenc) != 0);
|
|
9995 #else
|
|
9996 return FALSE;
|
|
9997 #endif
|
|
9998 }
|
|
9999
|
|
10000 /*
|
|
10001 * return OK if "p" is a valid fileformat name, FAIL otherwise.
|
|
10002 */
|
|
10003 int
|
|
10004 check_ff_value(p)
|
|
10005 char_u *p;
|
|
10006 {
|
|
10007 return check_opt_strings(p, p_ff_values, FALSE);
|
|
10008 }
|