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
|
|
112 , PV_PATH
|
|
113 , PV_PI
|
|
114 , PV_PVW
|
12
|
115 , PV_QE
|
7
|
116 , PV_RL
|
|
117 , PV_RLC
|
|
118 , PV_RO
|
|
119 , PV_SCBIND
|
|
120 , PV_SCROLL
|
|
121 , PV_SI
|
221
|
122 , PV_SN
|
|
123 , PV_SPELL
|
314
|
124 , PV_SPF
|
221
|
125 , PV_SPL
|
40
|
126 , PV_STL
|
7
|
127 , PV_STS
|
|
128 , PV_SUA
|
|
129 , PV_SW
|
|
130 , PV_SWF
|
|
131 , PV_SYN
|
|
132 , PV_TAGS
|
|
133 , PV_TS
|
|
134 , PV_TSR
|
|
135 , PV_TW
|
|
136 , PV_TX
|
|
137 , PV_WFH
|
|
138 , PV_WM
|
|
139 , PV_WRAP
|
|
140 } idopt_T;
|
|
141
|
|
142 /*
|
|
143 * Options local to a window have a value local to a buffer and global to all
|
|
144 * buffers. Indicate this by setting "var" to VAR_WIN.
|
|
145 */
|
|
146 #define VAR_WIN ((char_u *)-1)
|
|
147
|
|
148 /*
|
|
149 * These the global values for options which are also local to a buffer.
|
|
150 * Only to be used in option.c!
|
|
151 */
|
|
152 static int p_ai;
|
|
153 static int p_bin;
|
|
154 #ifdef FEAT_MBYTE
|
|
155 static int p_bomb;
|
|
156 #endif
|
|
157 #if defined(FEAT_QUICKFIX)
|
|
158 static char_u *p_bh;
|
|
159 static char_u *p_bt;
|
|
160 #endif
|
|
161 static int p_bl;
|
|
162 static int p_ci;
|
|
163 #ifdef FEAT_CINDENT
|
|
164 static int p_cin;
|
|
165 static char_u *p_cink;
|
|
166 static char_u *p_cino;
|
|
167 #endif
|
|
168 #if defined(FEAT_SMARTINDENT) || defined(FEAT_CINDENT)
|
|
169 static char_u *p_cinw;
|
|
170 #endif
|
|
171 #ifdef FEAT_COMMENTS
|
|
172 static char_u *p_com;
|
|
173 #endif
|
|
174 #ifdef FEAT_FOLDING
|
|
175 static char_u *p_cms;
|
|
176 #endif
|
|
177 #ifdef FEAT_INS_EXPAND
|
|
178 static char_u *p_cpt;
|
|
179 #endif
|
12
|
180 #ifdef FEAT_COMPL_FUNC
|
|
181 static char_u *p_cfu;
|
|
182 #endif
|
7
|
183 static int p_eol;
|
|
184 static int p_et;
|
|
185 #ifdef FEAT_MBYTE
|
|
186 static char_u *p_fenc;
|
|
187 #endif
|
|
188 static char_u *p_ff;
|
|
189 static char_u *p_fo;
|
41
|
190 static char_u *p_flp;
|
7
|
191 #ifdef FEAT_AUTOCMD
|
|
192 static char_u *p_ft;
|
|
193 #endif
|
|
194 static long p_iminsert;
|
|
195 static long p_imsearch;
|
|
196 #if defined(FEAT_FIND_ID) && defined(FEAT_EVAL)
|
|
197 static char_u *p_inex;
|
|
198 #endif
|
|
199 #if defined(FEAT_CINDENT) && defined(FEAT_EVAL)
|
|
200 static char_u *p_inde;
|
|
201 static char_u *p_indk;
|
|
202 #endif
|
|
203 static int p_inf;
|
|
204 static char_u *p_isk;
|
|
205 #ifdef FEAT_CRYPT
|
|
206 static char_u *p_key;
|
|
207 #endif
|
|
208 #ifdef FEAT_LISP
|
|
209 static int p_lisp;
|
|
210 #endif
|
|
211 static int p_ml;
|
|
212 static int p_ma;
|
|
213 static int p_mod;
|
|
214 static char_u *p_mps;
|
|
215 static char_u *p_nf;
|
|
216 #ifdef FEAT_OSFILETYPE
|
|
217 static char_u *p_oft;
|
|
218 #endif
|
|
219 static int p_pi;
|
12
|
220 #ifdef FEAT_TEXTOBJ
|
|
221 static char_u *p_qe;
|
|
222 #endif
|
7
|
223 static int p_ro;
|
|
224 #ifdef FEAT_SMARTINDENT
|
|
225 static int p_si;
|
|
226 #endif
|
|
227 #ifndef SHORT_FNAME
|
|
228 static int p_sn;
|
|
229 #endif
|
|
230 static long p_sts;
|
|
231 #if defined(FEAT_SEARCHPATH)
|
|
232 static char_u *p_sua;
|
|
233 #endif
|
|
234 static long p_sw;
|
|
235 static int p_swf;
|
|
236 #ifdef FEAT_SYN_HL
|
|
237 static char_u *p_syn;
|
314
|
238 static char_u *p_spf;
|
221
|
239 static char_u *p_spl;
|
7
|
240 #endif
|
|
241 static long p_ts;
|
|
242 static long p_tw;
|
|
243 static int p_tx;
|
|
244 static long p_wm;
|
|
245 #ifdef FEAT_KEYMAP
|
|
246 static char_u *p_keymap;
|
|
247 #endif
|
|
248
|
|
249 /* Saved values for when 'bin' is set. */
|
|
250 static int p_et_nobin;
|
|
251 static int p_ml_nobin;
|
|
252 static long p_tw_nobin;
|
|
253 static long p_wm_nobin;
|
|
254
|
|
255 /* Saved values for when 'paste' is set */
|
|
256 static long p_tw_nopaste;
|
|
257 static long p_wm_nopaste;
|
|
258 static long p_sts_nopaste;
|
|
259 static int p_ai_nopaste;
|
|
260
|
|
261 struct vimoption
|
|
262 {
|
|
263 char *fullname; /* full option name */
|
|
264 char *shortname; /* permissible abbreviation */
|
|
265 long_u flags; /* see below */
|
|
266 char_u *var; /* global option: pointer to variable;
|
|
267 * window-local option: VAR_WIN;
|
|
268 * buffer-local option: global value */
|
|
269 idopt_T indir; /* global option: PV_NONE;
|
|
270 * local option: indirect option index */
|
|
271 char_u *def_val[2]; /* default values for variable (vi and vim) */
|
|
272 #ifdef FEAT_EVAL
|
|
273 scid_T scriptID; /* script in which the option was last set */
|
|
274 #endif
|
|
275 };
|
|
276
|
|
277 #define VI_DEFAULT 0 /* def_val[VI_DEFAULT] is Vi default value */
|
|
278 #define VIM_DEFAULT 1 /* def_val[VIM_DEFAULT] is Vim default value */
|
|
279
|
|
280 /*
|
|
281 * Flags
|
|
282 */
|
|
283 #define P_BOOL 0x01 /* the option is boolean */
|
|
284 #define P_NUM 0x02 /* the option is numeric */
|
|
285 #define P_STRING 0x04 /* the option is a string */
|
|
286 #define P_ALLOCED 0x08 /* the string option is in allocated memory,
|
|
287 must use vim_free() when assigning new
|
|
288 value. Not set if default is the same. */
|
|
289 #define P_EXPAND 0x10 /* environment expansion. NOTE: P_EXPAND can
|
|
290 never be used for local or hidden options! */
|
|
291 #define P_NODEFAULT 0x40 /* don't set to default value */
|
|
292 #define P_DEF_ALLOCED 0x80 /* default value is in allocated memory, must
|
|
293 use vim_free() when assigning new value */
|
|
294 #define P_WAS_SET 0x100 /* option has been set/reset */
|
|
295 #define P_NO_MKRC 0x200 /* don't include in :mkvimrc output */
|
|
296 #define P_VI_DEF 0x400 /* Use Vi default for Vim */
|
|
297 #define P_VIM 0x800 /* Vim option, reset when 'cp' set */
|
|
298
|
|
299 /* when option changed, what to display: */
|
|
300 #define P_RSTAT 0x1000 /* redraw status lines */
|
|
301 #define P_RWIN 0x2000 /* redraw current window */
|
|
302 #define P_RBUF 0x4000 /* redraw current buffer */
|
|
303 #define P_RALL 0x6000 /* redraw all windows */
|
|
304 #define P_RCLR 0x7000 /* clear and redraw all */
|
|
305
|
|
306 #define P_COMMA 0x8000 /* comma separated list */
|
|
307 #define P_NODUP 0x10000L/* don't allow duplicate strings */
|
|
308 #define P_FLAGLIST 0x20000L/* list of single-char flags */
|
|
309
|
|
310 #define P_SECURE 0x40000L/* cannot change in modeline or secure mode */
|
|
311 #define P_GETTEXT 0x80000L/* expand default value with _() */
|
|
312 #define P_NOGLOB 0x100000L/* do not use local value for global vimrc */
|
36
|
313 #define P_NFNAME 0x200000L/* only normal file name chars allowed */
|
7
|
314
|
|
315 /*
|
|
316 * options[] is initialized here.
|
|
317 * The order of the options MUST be alphabetic for ":set all" and findoption().
|
|
318 * All option names MUST start with a lowercase letter (for findoption()).
|
|
319 * Exception: "t_" options are at the end.
|
|
320 * The options with a NULL variable are 'hidden': a set command for them is
|
|
321 * ignored and they are not printed.
|
|
322 */
|
|
323 static struct vimoption
|
|
324 #ifdef FEAT_GUI_W16
|
|
325 _far
|
|
326 #endif
|
|
327 options[] =
|
|
328 {
|
|
329 {"aleph", "al", P_NUM|P_VI_DEF,
|
|
330 #ifdef FEAT_RIGHTLEFT
|
|
331 (char_u *)&p_aleph, PV_NONE,
|
|
332 #else
|
|
333 (char_u *)NULL, PV_NONE,
|
|
334 #endif
|
|
335 {
|
|
336 #if (defined(MSDOS) || defined(WIN3264) || defined(OS2)) && !defined(FEAT_GUI_W32)
|
|
337 (char_u *)128L,
|
|
338 #else
|
|
339 (char_u *)224L,
|
|
340 #endif
|
|
341 (char_u *)0L}},
|
|
342 {"antialias", "anti", P_BOOL|P_VI_DEF|P_VIM|P_RCLR,
|
|
343 #if defined(FEAT_GUI) && defined(MACOS_X)
|
|
344 (char_u *)&p_antialias, PV_NONE,
|
|
345 {(char_u *)FALSE, (char_u *)FALSE}
|
|
346 #else
|
|
347 (char_u *)NULL, PV_NONE,
|
|
348 {(char_u *)FALSE, (char_u *)FALSE}
|
|
349 #endif
|
|
350 },
|
|
351 {"arabic", "arab", P_BOOL|P_VI_DEF|P_VIM,
|
|
352 #ifdef FEAT_ARABIC
|
|
353 (char_u *)VAR_WIN, PV_ARAB,
|
|
354 #else
|
|
355 (char_u *)NULL, PV_NONE,
|
|
356 #endif
|
|
357 {(char_u *)FALSE, (char_u *)0L}},
|
|
358 {"arabicshape", "arshape", P_BOOL|P_VI_DEF|P_VIM|P_RCLR,
|
|
359 #ifdef FEAT_ARABIC
|
|
360 (char_u *)&p_arshape, PV_NONE,
|
|
361 #else
|
|
362 (char_u *)NULL, PV_NONE,
|
|
363 #endif
|
|
364 {(char_u *)TRUE, (char_u *)0L}},
|
|
365 {"allowrevins", "ari", P_BOOL|P_VI_DEF|P_VIM,
|
|
366 #ifdef FEAT_RIGHTLEFT
|
|
367 (char_u *)&p_ari, PV_NONE,
|
|
368 #else
|
|
369 (char_u *)NULL, PV_NONE,
|
|
370 #endif
|
|
371 {(char_u *)FALSE, (char_u *)0L}},
|
|
372 {"altkeymap", "akm", P_BOOL|P_VI_DEF,
|
|
373 #ifdef FEAT_FKMAP
|
|
374 (char_u *)&p_altkeymap, PV_NONE,
|
|
375 #else
|
|
376 (char_u *)NULL, PV_NONE,
|
|
377 #endif
|
|
378 {(char_u *)FALSE, (char_u *)0L}},
|
|
379 {"ambiwidth", "ambw", P_STRING|P_VI_DEF|P_RCLR,
|
|
380 #if defined(FEAT_MBYTE)
|
|
381 (char_u *)&p_ambw, PV_NONE,
|
|
382 {(char_u *)"single", (char_u *)0L}
|
|
383 #else
|
|
384 (char_u *)NULL, PV_NONE,
|
|
385 {(char_u *)0L, (char_u *)0L}
|
|
386 #endif
|
|
387 },
|
|
388 #if defined(FEAT_NETBEANS_INTG) || defined(FEAT_SUN_WORKSHOP)
|
|
389 {"autochdir", "acd", P_BOOL|P_VI_DEF,
|
|
390 (char_u *)&p_acd, PV_NONE,
|
|
391 {(char_u *)FALSE, (char_u *)0L}},
|
|
392 #endif
|
|
393 {"autoindent", "ai", P_BOOL|P_VI_DEF,
|
|
394 (char_u *)&p_ai, PV_AI,
|
|
395 {(char_u *)FALSE, (char_u *)0L}},
|
|
396 {"autoprint", "ap", P_BOOL|P_VI_DEF,
|
|
397 (char_u *)NULL, PV_NONE,
|
|
398 {(char_u *)FALSE, (char_u *)0L}},
|
|
399 {"autoread", "ar", P_BOOL|P_VI_DEF,
|
|
400 (char_u *)&p_ar, OPT_BOTH(PV_AR),
|
|
401 {(char_u *)FALSE, (char_u *)0L}},
|
|
402 {"autowrite", "aw", P_BOOL|P_VI_DEF,
|
|
403 (char_u *)&p_aw, PV_NONE,
|
|
404 {(char_u *)FALSE, (char_u *)0L}},
|
|
405 {"autowriteall","awa", P_BOOL|P_VI_DEF,
|
|
406 (char_u *)&p_awa, PV_NONE,
|
|
407 {(char_u *)FALSE, (char_u *)0L}},
|
|
408 {"background", "bg", P_STRING|P_VI_DEF|P_RCLR,
|
|
409 (char_u *)&p_bg, PV_NONE,
|
|
410 {
|
|
411 #if (defined(MSDOS) || defined(OS2) || defined(WIN3264)) && !defined(FEAT_GUI)
|
|
412 (char_u *)"dark",
|
|
413 #else
|
|
414 (char_u *)"light",
|
|
415 #endif
|
|
416 (char_u *)0L}},
|
|
417 {"backspace", "bs", P_STRING|P_VI_DEF|P_VIM|P_COMMA|P_NODUP,
|
|
418 (char_u *)&p_bs, PV_NONE,
|
|
419 {(char_u *)"", (char_u *)0L}},
|
|
420 {"backup", "bk", P_BOOL|P_VI_DEF|P_VIM,
|
|
421 (char_u *)&p_bk, PV_NONE,
|
|
422 {(char_u *)FALSE, (char_u *)0L}},
|
|
423 {"backupcopy", "bkc", P_STRING|P_VIM|P_COMMA|P_NODUP,
|
|
424 (char_u *)&p_bkc, PV_NONE,
|
|
425 #ifdef UNIX
|
|
426 {(char_u *)"yes", (char_u *)"auto"}
|
|
427 #else
|
|
428 {(char_u *)"auto", (char_u *)"auto"}
|
|
429 #endif
|
|
430 },
|
|
431 {"backupdir", "bdir", P_STRING|P_EXPAND|P_VI_DEF|P_COMMA|P_NODUP|P_SECURE,
|
|
432 (char_u *)&p_bdir, PV_NONE,
|
|
433 {(char_u *)DFLT_BDIR, (char_u *)0L}},
|
36
|
434 {"backupext", "bex", P_STRING|P_VI_DEF|P_NFNAME,
|
7
|
435 (char_u *)&p_bex, PV_NONE,
|
|
436 {
|
|
437 #ifdef VMS
|
|
438 (char_u *)"_",
|
|
439 #else
|
|
440 (char_u *)"~",
|
|
441 #endif
|
|
442 (char_u *)0L}},
|
|
443 {"backupskip", "bsk", P_STRING|P_VI_DEF|P_COMMA,
|
|
444 #ifdef FEAT_WILDIGN
|
|
445 (char_u *)&p_bsk, PV_NONE,
|
|
446 {(char_u *)"", (char_u *)0L}
|
|
447 #else
|
|
448 (char_u *)NULL, PV_NONE,
|
|
449 {(char_u *)0L, (char_u *)0L}
|
|
450 #endif
|
|
451 },
|
|
452 #ifdef FEAT_BEVAL
|
|
453 {"balloondelay","bdlay",P_NUM|P_VI_DEF,
|
|
454 (char_u *)&p_bdlay, PV_NONE,
|
|
455 {(char_u *)600L, (char_u *)0L}},
|
|
456 {"ballooneval", "beval",P_BOOL|P_VI_DEF|P_NO_MKRC,
|
|
457 (char_u *)&p_beval, PV_NONE,
|
190
|
458 {(char_u *)FALSE, (char_u *)0L}},
|
|
459 # ifdef FEAT_EVAL
|
|
460 {"balloonexpr", "bexpr", P_STRING|P_ALLOCED|P_VI_DEF|P_VIM,
|
|
461 (char_u *)&p_bexpr, PV_NONE,
|
|
462 {(char_u *)"", (char_u *)0L}},
|
|
463 # endif
|
7
|
464 #endif
|
|
465 {"beautify", "bf", P_BOOL|P_VI_DEF,
|
|
466 (char_u *)NULL, PV_NONE,
|
|
467 {(char_u *)FALSE, (char_u *)0L}},
|
|
468 {"binary", "bin", P_BOOL|P_VI_DEF|P_RSTAT,
|
|
469 (char_u *)&p_bin, PV_BIN,
|
|
470 {(char_u *)FALSE, (char_u *)0L}},
|
|
471 {"bioskey", "biosk",P_BOOL|P_VI_DEF,
|
|
472 #ifdef MSDOS
|
|
473 (char_u *)&p_biosk, PV_NONE,
|
|
474 #else
|
|
475 (char_u *)NULL, PV_NONE,
|
|
476 #endif
|
|
477 {(char_u *)TRUE, (char_u *)0L}},
|
|
478 {"bomb", NULL, P_BOOL|P_NO_MKRC|P_VI_DEF|P_RSTAT,
|
|
479 #ifdef FEAT_MBYTE
|
|
480 (char_u *)&p_bomb, PV_BOMB,
|
|
481 #else
|
|
482 (char_u *)NULL, PV_NONE,
|
|
483 #endif
|
|
484 {(char_u *)FALSE, (char_u *)0L}},
|
|
485 {"breakat", "brk", P_STRING|P_VI_DEF|P_RALL|P_FLAGLIST,
|
|
486 #ifdef FEAT_LINEBREAK
|
|
487 (char_u *)&p_breakat, PV_NONE,
|
|
488 {(char_u *)" \t!@*-+;:,./?", (char_u *)0L}
|
|
489 #else
|
|
490 (char_u *)NULL, PV_NONE,
|
|
491 {(char_u *)0L, (char_u *)0L}
|
|
492 #endif
|
|
493 },
|
|
494 {"browsedir", "bsdir",P_STRING|P_VI_DEF,
|
|
495 #ifdef FEAT_BROWSE
|
|
496 (char_u *)&p_bsdir, PV_NONE,
|
|
497 {(char_u *)"last", (char_u *)0L}
|
|
498 #else
|
|
499 (char_u *)NULL, PV_NONE,
|
|
500 {(char_u *)0L, (char_u *)0L}
|
|
501 #endif
|
|
502 },
|
|
503 {"bufhidden", "bh", P_STRING|P_ALLOCED|P_VI_DEF|P_NOGLOB,
|
|
504 #if defined(FEAT_QUICKFIX)
|
|
505 (char_u *)&p_bh, PV_BH,
|
|
506 {(char_u *)"", (char_u *)0L}
|
|
507 #else
|
|
508 (char_u *)NULL, PV_NONE,
|
|
509 {(char_u *)0L, (char_u *)0L}
|
|
510 #endif
|
|
511 },
|
|
512 {"buflisted", "bl", P_BOOL|P_VI_DEF|P_NOGLOB,
|
|
513 (char_u *)&p_bl, PV_BL,
|
|
514 {(char_u *)1L, (char_u *)0L}
|
|
515 },
|
|
516 {"buftype", "bt", P_STRING|P_ALLOCED|P_VI_DEF|P_NOGLOB,
|
|
517 #if defined(FEAT_QUICKFIX)
|
|
518 (char_u *)&p_bt, PV_BT,
|
|
519 {(char_u *)"", (char_u *)0L}
|
|
520 #else
|
|
521 (char_u *)NULL, PV_NONE,
|
|
522 {(char_u *)0L, (char_u *)0L}
|
|
523 #endif
|
|
524 },
|
|
525 {"casemap", "cmp", P_STRING|P_VI_DEF|P_COMMA|P_NODUP,
|
|
526 (char_u *)&p_cmp, PV_NONE,
|
|
527 {(char_u *)"internal,keepascii", (char_u *)0L}
|
|
528 },
|
|
529 {"cdpath", "cd", P_STRING|P_EXPAND|P_VI_DEF|P_COMMA|P_NODUP,
|
|
530 #ifdef FEAT_SEARCHPATH
|
|
531 (char_u *)&p_cdpath, PV_NONE,
|
|
532 {(char_u *)",,", (char_u *)0L}
|
|
533 #else
|
|
534 (char_u *)NULL, PV_NONE,
|
|
535 {(char_u *)0L, (char_u *)0L}
|
|
536 #endif
|
|
537 },
|
|
538 {"cedit", NULL, P_STRING,
|
|
539 #ifdef FEAT_CMDWIN
|
|
540 (char_u *)&p_cedit, PV_NONE,
|
|
541 {(char_u *)"", (char_u *)CTRL_F_STR}
|
|
542 #else
|
|
543 (char_u *)NULL, PV_NONE,
|
|
544 {(char_u *)0L, (char_u *)0L}
|
|
545 #endif
|
|
546 },
|
|
547 {"charconvert", "ccv", P_STRING|P_VI_DEF|P_SECURE,
|
|
548 #if defined(FEAT_MBYTE) && defined(FEAT_EVAL)
|
|
549 (char_u *)&p_ccv, PV_NONE,
|
|
550 {(char_u *)"", (char_u *)0L}
|
|
551 #else
|
|
552 (char_u *)NULL, PV_NONE,
|
|
553 {(char_u *)0L, (char_u *)0L}
|
|
554 #endif
|
|
555 },
|
|
556 {"cindent", "cin", P_BOOL|P_VI_DEF|P_VIM,
|
|
557 #ifdef FEAT_CINDENT
|
|
558 (char_u *)&p_cin, PV_CIN,
|
|
559 #else
|
|
560 (char_u *)NULL, PV_NONE,
|
|
561 #endif
|
|
562 {(char_u *)FALSE, (char_u *)0L}},
|
|
563 {"cinkeys", "cink", P_STRING|P_ALLOCED|P_VI_DEF|P_COMMA|P_NODUP,
|
|
564 #ifdef FEAT_CINDENT
|
|
565 (char_u *)&p_cink, PV_CINK,
|
|
566 {(char_u *)"0{,0},0),:,0#,!^F,o,O,e", (char_u *)0L}
|
|
567 #else
|
|
568 (char_u *)NULL, PV_NONE,
|
|
569 {(char_u *)0L, (char_u *)0L}
|
|
570 #endif
|
|
571 },
|
|
572 {"cinoptions", "cino", P_STRING|P_ALLOCED|P_VI_DEF|P_COMMA|P_NODUP,
|
|
573 #ifdef FEAT_CINDENT
|
|
574 (char_u *)&p_cino, PV_CINO,
|
|
575 #else
|
|
576 (char_u *)NULL, PV_NONE,
|
|
577 #endif
|
|
578 {(char_u *)"", (char_u *)0L}},
|
|
579 {"cinwords", "cinw", P_STRING|P_ALLOCED|P_VI_DEF|P_COMMA|P_NODUP,
|
|
580 #if defined(FEAT_SMARTINDENT) || defined(FEAT_CINDENT)
|
|
581 (char_u *)&p_cinw, PV_CINW,
|
|
582 {(char_u *)"if,else,while,do,for,switch",
|
|
583 (char_u *)0L}
|
|
584 #else
|
|
585 (char_u *)NULL, PV_NONE,
|
|
586 {(char_u *)0L, (char_u *)0L}
|
|
587 #endif
|
|
588 },
|
|
589 {"clipboard", "cb", P_STRING|P_VI_DEF|P_COMMA|P_NODUP,
|
|
590 #ifdef FEAT_CLIPBOARD
|
|
591 (char_u *)&p_cb, PV_NONE,
|
|
592 # ifdef FEAT_XCLIPBOARD
|
|
593 {(char_u *)"autoselect,exclude:cons\\|linux",
|
|
594 (char_u *)0L}
|
|
595 # else
|
|
596 {(char_u *)"", (char_u *)0L}
|
|
597 # endif
|
|
598 #else
|
|
599 (char_u *)NULL, PV_NONE,
|
|
600 {(char_u *)"", (char_u *)0L}
|
|
601 #endif
|
|
602 },
|
|
603 {"cmdheight", "ch", P_NUM|P_VI_DEF|P_RALL,
|
|
604 (char_u *)&p_ch, PV_NONE,
|
|
605 {(char_u *)1L, (char_u *)0L}},
|
|
606 {"cmdwinheight", "cwh", P_NUM|P_VI_DEF,
|
|
607 #ifdef FEAT_CMDWIN
|
|
608 (char_u *)&p_cwh, PV_NONE,
|
|
609 #else
|
|
610 (char_u *)NULL, PV_NONE,
|
|
611 #endif
|
|
612 {(char_u *)7L, (char_u *)0L}},
|
|
613 {"columns", "co", P_NUM|P_NODEFAULT|P_NO_MKRC|P_VI_DEF|P_RCLR,
|
|
614 (char_u *)&Columns, PV_NONE,
|
|
615 {(char_u *)80L, (char_u *)0L}},
|
|
616 {"comments", "com", P_STRING|P_ALLOCED|P_VI_DEF|P_COMMA|P_NODUP,
|
|
617 #ifdef FEAT_COMMENTS
|
|
618 (char_u *)&p_com, PV_COM,
|
|
619 {(char_u *)"s1:/*,mb:*,ex:*/,://,b:#,:%,:XCOMM,n:>,fb:-",
|
|
620 (char_u *)0L}
|
|
621 #else
|
|
622 (char_u *)NULL, PV_NONE,
|
|
623 {(char_u *)0L, (char_u *)0L}
|
|
624 #endif
|
|
625 },
|
|
626 {"commentstring", "cms", P_STRING|P_ALLOCED|P_VI_DEF,
|
|
627 #ifdef FEAT_FOLDING
|
|
628 (char_u *)&p_cms, PV_CMS,
|
|
629 {(char_u *)"/*%s*/", (char_u *)0L}
|
|
630 #else
|
|
631 (char_u *)NULL, PV_NONE,
|
|
632 {(char_u *)0L, (char_u *)0L}
|
|
633 #endif
|
|
634 },
|
|
635 {"compatible", "cp", P_BOOL|P_RALL,
|
|
636 (char_u *)&p_cp, PV_NONE,
|
|
637 {(char_u *)TRUE, (char_u *)FALSE}},
|
|
638 {"complete", "cpt", P_STRING|P_ALLOCED|P_VI_DEF|P_COMMA|P_NODUP,
|
|
639 #ifdef FEAT_INS_EXPAND
|
|
640 (char_u *)&p_cpt, PV_CPT,
|
|
641 {(char_u *)".,w,b,u,t,i", (char_u *)0L}
|
|
642 #else
|
|
643 (char_u *)NULL, PV_NONE,
|
|
644 {(char_u *)0L, (char_u *)0L}
|
|
645 #endif
|
|
646 },
|
12
|
647 {"completefunc", "cfu", P_STRING|P_ALLOCED|P_VI_DEF|P_SECURE,
|
|
648 #ifdef FEAT_COMPL_FUNC
|
|
649 (char_u *)&p_cfu, PV_CFU,
|
|
650 {(char_u *)"", (char_u *)0L}
|
|
651 #else
|
|
652 (char_u *)NULL, PV_NONE,
|
|
653 {(char_u *)0L, (char_u *)0L}
|
|
654 #endif
|
|
655 },
|
7
|
656 {"confirm", "cf", P_BOOL|P_VI_DEF,
|
|
657 #if defined(FEAT_GUI_DIALOG) || defined(FEAT_CON_DIALOG)
|
|
658 (char_u *)&p_confirm, PV_NONE,
|
|
659 #else
|
|
660 (char_u *)NULL, PV_NONE,
|
|
661 #endif
|
|
662 {(char_u *)FALSE, (char_u *)0L}},
|
|
663 {"conskey", "consk",P_BOOL|P_VI_DEF,
|
|
664 #ifdef MSDOS
|
|
665 (char_u *)&p_consk, PV_NONE,
|
|
666 #else
|
|
667 (char_u *)NULL, PV_NONE,
|
|
668 #endif
|
|
669 {(char_u *)FALSE, (char_u *)0L}},
|
|
670 {"copyindent", "ci", P_BOOL|P_VI_DEF|P_VIM,
|
|
671 (char_u *)&p_ci, PV_CI,
|
|
672 {(char_u *)FALSE, (char_u *)0L}},
|
|
673 {"cpoptions", "cpo", P_STRING|P_VIM|P_RALL|P_FLAGLIST,
|
|
674 (char_u *)&p_cpo, PV_NONE,
|
164
|
675 {(char_u *)CPO_VI, (char_u *)CPO_VIM}},
|
7
|
676 {"cscopepathcomp", "cspc", P_NUM|P_VI_DEF|P_VIM,
|
|
677 #ifdef FEAT_CSCOPE
|
|
678 (char_u *)&p_cspc, PV_NONE,
|
|
679 #else
|
|
680 (char_u *)NULL, PV_NONE,
|
|
681 #endif
|
|
682 {(char_u *)0L, (char_u *)0L}},
|
|
683 {"cscopeprg", "csprg", P_STRING|P_EXPAND|P_VI_DEF|P_SECURE,
|
|
684 #ifdef FEAT_CSCOPE
|
|
685 (char_u *)&p_csprg, PV_NONE,
|
|
686 {(char_u *)"cscope", (char_u *)0L}
|
|
687 #else
|
|
688 (char_u *)NULL, PV_NONE,
|
|
689 {(char_u *)0L, (char_u *)0L}
|
|
690 #endif
|
|
691 },
|
|
692 {"cscopequickfix", "csqf", P_STRING|P_VI_DEF|P_COMMA|P_NODUP,
|
|
693 #if defined(FEAT_CSCOPE) && defined(FEAT_QUICKFIX)
|
|
694 (char_u *)&p_csqf, PV_NONE,
|
|
695 {(char_u *)"", (char_u *)0L}
|
|
696 #else
|
|
697 (char_u *)NULL, PV_NONE,
|
|
698 {(char_u *)0L, (char_u *)0L}
|
|
699 #endif
|
|
700 },
|
|
701 {"cscopetag", "cst", P_BOOL|P_VI_DEF|P_VIM,
|
|
702 #ifdef FEAT_CSCOPE
|
|
703 (char_u *)&p_cst, PV_NONE,
|
|
704 #else
|
|
705 (char_u *)NULL, PV_NONE,
|
|
706 #endif
|
|
707 {(char_u *)0L, (char_u *)0L}},
|
|
708 {"cscopetagorder", "csto", P_NUM|P_VI_DEF|P_VIM,
|
|
709 #ifdef FEAT_CSCOPE
|
|
710 (char_u *)&p_csto, PV_NONE,
|
|
711 #else
|
|
712 (char_u *)NULL, PV_NONE,
|
|
713 #endif
|
|
714 {(char_u *)0L, (char_u *)0L}},
|
|
715 {"cscopeverbose", "csverb", P_BOOL|P_VI_DEF|P_VIM,
|
|
716 #ifdef FEAT_CSCOPE
|
|
717 (char_u *)&p_csverbose, PV_NONE,
|
|
718 #else
|
|
719 (char_u *)NULL, PV_NONE,
|
|
720 #endif
|
|
721 {(char_u *)0L, (char_u *)0L}},
|
|
722 {"debug", NULL, P_STRING|P_VI_DEF,
|
|
723 (char_u *)&p_debug, PV_NONE,
|
|
724 {(char_u *)"", (char_u *)0L}},
|
|
725 {"define", "def", P_STRING|P_ALLOCED|P_VI_DEF,
|
|
726 #ifdef FEAT_FIND_ID
|
|
727 (char_u *)&p_def, OPT_BOTH(PV_DEF),
|
22
|
728 {(char_u *)"^\\s*#\\s*define", (char_u *)0L}
|
7
|
729 #else
|
|
730 (char_u *)NULL, PV_NONE,
|
|
731 {(char_u *)NULL, (char_u *)0L}
|
|
732 #endif
|
|
733 },
|
|
734 {"delcombine", "deco", P_BOOL|P_VI_DEF|P_VIM,
|
|
735 #ifdef FEAT_MBYTE
|
|
736 (char_u *)&p_deco, PV_NONE,
|
|
737 #else
|
|
738 (char_u *)NULL, PV_NONE,
|
|
739 #endif
|
|
740 {(char_u *)FALSE, (char_u *)0L}
|
|
741 },
|
|
742 {"dictionary", "dict", P_STRING|P_EXPAND|P_VI_DEF|P_COMMA|P_NODUP,
|
|
743 #ifdef FEAT_INS_EXPAND
|
|
744 (char_u *)&p_dict, OPT_BOTH(PV_DICT),
|
|
745 #else
|
|
746 (char_u *)NULL, PV_NONE,
|
|
747 #endif
|
|
748 {(char_u *)"", (char_u *)0L}},
|
|
749 {"diff", NULL, P_BOOL|P_VI_DEF|P_RWIN|P_NOGLOB,
|
|
750 #ifdef FEAT_DIFF
|
|
751 (char_u *)VAR_WIN, PV_DIFF,
|
|
752 #else
|
|
753 (char_u *)NULL, PV_NONE,
|
|
754 #endif
|
|
755 {(char_u *)FALSE, (char_u *)0L}},
|
|
756 {"diffexpr", "dex", P_STRING|P_VI_DEF|P_SECURE,
|
|
757 #if defined(FEAT_DIFF) && defined(FEAT_EVAL)
|
|
758 (char_u *)&p_dex, PV_NONE,
|
|
759 {(char_u *)"", (char_u *)0L}
|
|
760 #else
|
|
761 (char_u *)NULL, PV_NONE,
|
|
762 {(char_u *)0L, (char_u *)0L}
|
|
763 #endif
|
|
764 },
|
|
765 {"diffopt", "dip", P_STRING|P_ALLOCED|P_VI_DEF|P_RWIN|P_COMMA|P_NODUP,
|
|
766 #ifdef FEAT_DIFF
|
|
767 (char_u *)&p_dip, PV_NONE,
|
|
768 {(char_u *)"filler", (char_u *)NULL}
|
|
769 #else
|
|
770 (char_u *)NULL, PV_NONE,
|
|
771 {(char_u *)"", (char_u *)NULL}
|
|
772 #endif
|
|
773 },
|
|
774 {"digraph", "dg", P_BOOL|P_VI_DEF|P_VIM,
|
|
775 #ifdef FEAT_DIGRAPHS
|
|
776 (char_u *)&p_dg, PV_NONE,
|
|
777 #else
|
|
778 (char_u *)NULL, PV_NONE,
|
|
779 #endif
|
|
780 {(char_u *)FALSE, (char_u *)0L}},
|
|
781 {"directory", "dir", P_STRING|P_EXPAND|P_VI_DEF|P_COMMA|P_NODUP|P_SECURE,
|
|
782 (char_u *)&p_dir, PV_NONE,
|
|
783 {(char_u *)DFLT_DIR, (char_u *)0L}},
|
|
784 {"display", "dy", P_STRING|P_VI_DEF|P_COMMA|P_RALL|P_NODUP,
|
|
785 (char_u *)&p_dy, PV_NONE,
|
|
786 {(char_u *)"", (char_u *)0L}},
|
|
787 {"eadirection", "ead", P_STRING|P_VI_DEF,
|
|
788 #ifdef FEAT_VERTSPLIT
|
|
789 (char_u *)&p_ead, PV_NONE,
|
|
790 {(char_u *)"both", (char_u *)0L}
|
|
791 #else
|
|
792 (char_u *)NULL, PV_NONE,
|
|
793 {(char_u *)NULL, (char_u *)0L}
|
|
794 #endif
|
|
795 },
|
|
796 {"edcompatible","ed", P_BOOL|P_VI_DEF,
|
|
797 (char_u *)&p_ed, PV_NONE,
|
|
798 {(char_u *)FALSE, (char_u *)0L}},
|
|
799 {"encoding", "enc", P_STRING|P_VI_DEF|P_RCLR,
|
|
800 #ifdef FEAT_MBYTE
|
|
801 (char_u *)&p_enc, PV_NONE,
|
|
802 {(char_u *)ENC_DFLT, (char_u *)0L}
|
|
803 #else
|
|
804 (char_u *)NULL, PV_NONE,
|
|
805 {(char_u *)0L, (char_u *)0L}
|
|
806 #endif
|
|
807 },
|
|
808 {"endofline", "eol", P_BOOL|P_NO_MKRC|P_VI_DEF|P_RSTAT,
|
|
809 (char_u *)&p_eol, PV_EOL,
|
|
810 {(char_u *)TRUE, (char_u *)0L}},
|
|
811 {"equalalways", "ea", P_BOOL|P_VI_DEF|P_RALL,
|
|
812 (char_u *)&p_ea, PV_NONE,
|
|
813 {(char_u *)TRUE, (char_u *)0L}},
|
|
814 {"equalprg", "ep", P_STRING|P_EXPAND|P_VI_DEF|P_SECURE,
|
|
815 (char_u *)&p_ep, OPT_BOTH(PV_EP),
|
|
816 {(char_u *)"", (char_u *)0L}},
|
|
817 {"errorbells", "eb", P_BOOL|P_VI_DEF,
|
|
818 (char_u *)&p_eb, PV_NONE,
|
|
819 {(char_u *)FALSE, (char_u *)0L}},
|
|
820 {"errorfile", "ef", P_STRING|P_EXPAND|P_VI_DEF|P_SECURE,
|
|
821 #ifdef FEAT_QUICKFIX
|
|
822 (char_u *)&p_ef, PV_NONE,
|
|
823 {(char_u *)DFLT_ERRORFILE, (char_u *)0L}
|
|
824 #else
|
|
825 (char_u *)NULL, PV_NONE,
|
|
826 {(char_u *)NULL, (char_u *)0L}
|
|
827 #endif
|
|
828 },
|
|
829 {"errorformat", "efm", P_STRING|P_VI_DEF|P_COMMA|P_NODUP,
|
|
830 #ifdef FEAT_QUICKFIX
|
|
831 (char_u *)&p_efm, OPT_BOTH(PV_EFM),
|
|
832 {(char_u *)DFLT_EFM, (char_u *)0L},
|
|
833 #else
|
|
834 (char_u *)NULL, PV_NONE,
|
|
835 {(char_u *)NULL, (char_u *)0L}
|
|
836 #endif
|
|
837 },
|
|
838 {"esckeys", "ek", P_BOOL|P_VIM,
|
|
839 (char_u *)&p_ek, PV_NONE,
|
|
840 {(char_u *)FALSE, (char_u *)TRUE}},
|
|
841 {"eventignore", "ei", P_STRING|P_VI_DEF|P_COMMA|P_NODUP,
|
|
842 #ifdef FEAT_AUTOCMD
|
|
843 (char_u *)&p_ei, PV_NONE,
|
|
844 #else
|
|
845 (char_u *)NULL, PV_NONE,
|
|
846 #endif
|
|
847 {(char_u *)"", (char_u *)0L}},
|
|
848 {"expandtab", "et", P_BOOL|P_VI_DEF|P_VIM,
|
|
849 (char_u *)&p_et, PV_ET,
|
|
850 {(char_u *)FALSE, (char_u *)0L}},
|
|
851 {"exrc", "ex", P_BOOL|P_VI_DEF|P_SECURE,
|
|
852 (char_u *)&p_exrc, PV_NONE,
|
|
853 {(char_u *)FALSE, (char_u *)0L}},
|
|
854 {"fileencoding","fenc", P_STRING|P_ALLOCED|P_VI_DEF|P_RSTAT|P_RBUF|P_NO_MKRC,
|
|
855 #ifdef FEAT_MBYTE
|
|
856 (char_u *)&p_fenc, PV_FENC,
|
|
857 {(char_u *)"", (char_u *)0L}
|
|
858 #else
|
|
859 (char_u *)NULL, PV_NONE,
|
|
860 {(char_u *)0L, (char_u *)0L}
|
|
861 #endif
|
|
862 },
|
|
863 {"fileencodings","fencs", P_STRING|P_VI_DEF|P_COMMA,
|
|
864 #ifdef FEAT_MBYTE
|
|
865 (char_u *)&p_fencs, PV_NONE,
|
|
866 {(char_u *)"ucs-bom", (char_u *)0L}
|
|
867 #else
|
|
868 (char_u *)NULL, PV_NONE,
|
|
869 {(char_u *)0L, (char_u *)0L}
|
|
870 #endif
|
|
871 },
|
|
872 {"fileformat", "ff", P_STRING|P_ALLOCED|P_VI_DEF|P_RSTAT|P_NO_MKRC,
|
|
873 (char_u *)&p_ff, PV_FF,
|
|
874 {(char_u *)DFLT_FF, (char_u *)0L}},
|
|
875 {"fileformats", "ffs", P_STRING|P_VIM|P_COMMA|P_NODUP,
|
|
876 (char_u *)&p_ffs, PV_NONE,
|
|
877 {(char_u *)DFLT_FFS_VI, (char_u *)DFLT_FFS_VIM}},
|
36
|
878 {"filetype", "ft", P_STRING|P_ALLOCED|P_VI_DEF|P_NOGLOB|P_NFNAME,
|
7
|
879 #ifdef FEAT_AUTOCMD
|
|
880 (char_u *)&p_ft, PV_FT,
|
|
881 {(char_u *)"", (char_u *)0L}
|
|
882 #else
|
|
883 (char_u *)NULL, PV_NONE,
|
|
884 {(char_u *)0L, (char_u *)0L}
|
|
885 #endif
|
|
886 },
|
|
887 {"fillchars", "fcs", P_STRING|P_VI_DEF|P_RALL|P_COMMA|P_NODUP,
|
|
888 #if defined(FEAT_WINDOWS) || defined(FEAT_FOLDING)
|
|
889 (char_u *)&p_fcs, PV_NONE,
|
|
890 {(char_u *)"vert:|,fold:-", (char_u *)0L}
|
|
891 #else
|
|
892 (char_u *)NULL, PV_NONE,
|
|
893 {(char_u *)"", (char_u *)0L}
|
|
894 #endif
|
|
895 },
|
|
896 {"fkmap", "fk", P_BOOL|P_VI_DEF,
|
|
897 #ifdef FEAT_FKMAP
|
|
898 (char_u *)&p_fkmap, PV_NONE,
|
|
899 #else
|
|
900 (char_u *)NULL, PV_NONE,
|
|
901 #endif
|
|
902 {(char_u *)FALSE, (char_u *)0L}},
|
|
903 {"flash", "fl", P_BOOL|P_VI_DEF,
|
|
904 (char_u *)NULL, PV_NONE,
|
|
905 {(char_u *)FALSE, (char_u *)0L}},
|
|
906 #ifdef FEAT_FOLDING
|
|
907 {"foldclose", "fcl", P_STRING|P_VI_DEF|P_COMMA|P_NODUP|P_RWIN,
|
|
908 (char_u *)&p_fcl, PV_NONE,
|
|
909 {(char_u *)"", (char_u *)0L}},
|
|
910 {"foldcolumn", "fdc", P_NUM|P_VI_DEF|P_RWIN,
|
|
911 (char_u *)VAR_WIN, PV_FDC,
|
|
912 {(char_u *)FALSE, (char_u *)0L}},
|
|
913 {"foldenable", "fen", P_BOOL|P_VI_DEF|P_RWIN,
|
|
914 (char_u *)VAR_WIN, PV_FEN,
|
|
915 {(char_u *)TRUE, (char_u *)0L}},
|
|
916 {"foldexpr", "fde", P_STRING|P_ALLOCED|P_VIM|P_VI_DEF|P_RWIN,
|
|
917 # ifdef FEAT_EVAL
|
|
918 (char_u *)VAR_WIN, PV_FDE,
|
|
919 {(char_u *)"0", (char_u *)NULL}
|
|
920 # else
|
|
921 (char_u *)NULL, PV_NONE,
|
|
922 {(char_u *)NULL, (char_u *)0L}
|
|
923 # endif
|
|
924 },
|
|
925 {"foldignore", "fdi", P_STRING|P_ALLOCED|P_VIM|P_VI_DEF|P_RWIN,
|
|
926 (char_u *)VAR_WIN, PV_FDI,
|
|
927 {(char_u *)"#", (char_u *)NULL}},
|
|
928 {"foldlevel", "fdl", P_NUM|P_VI_DEF|P_RWIN,
|
|
929 (char_u *)VAR_WIN, PV_FDL,
|
|
930 {(char_u *)0L, (char_u *)0L}},
|
|
931 {"foldlevelstart","fdls", P_NUM|P_VI_DEF,
|
|
932 (char_u *)&p_fdls, PV_NONE,
|
|
933 {(char_u *)-1L, (char_u *)0L}},
|
|
934 {"foldmarker", "fmr", P_STRING|P_ALLOCED|P_VIM|P_VI_DEF|
|
|
935 P_RWIN|P_COMMA|P_NODUP,
|
|
936 (char_u *)VAR_WIN, PV_FMR,
|
|
937 {(char_u *)"{{{,}}}", (char_u *)NULL}},
|
|
938 {"foldmethod", "fdm", P_STRING|P_ALLOCED|P_VIM|P_VI_DEF|P_RWIN,
|
|
939 (char_u *)VAR_WIN, PV_FDM,
|
|
940 {(char_u *)"manual", (char_u *)NULL}},
|
|
941 {"foldminlines","fml", P_NUM|P_VI_DEF|P_RWIN,
|
|
942 (char_u *)VAR_WIN, PV_FML,
|
|
943 {(char_u *)1L, (char_u *)0L}},
|
|
944 {"foldnestmax", "fdn", P_NUM|P_VI_DEF|P_RWIN,
|
|
945 (char_u *)VAR_WIN, PV_FDN,
|
|
946 {(char_u *)20L, (char_u *)0L}},
|
|
947 {"foldopen", "fdo", P_STRING|P_VI_DEF|P_COMMA|P_NODUP,
|
|
948 (char_u *)&p_fdo, PV_NONE,
|
|
949 {(char_u *)"block,hor,mark,percent,quickfix,search,tag,undo",
|
|
950 (char_u *)0L}},
|
|
951 {"foldtext", "fdt", P_STRING|P_ALLOCED|P_VIM|P_VI_DEF|P_RWIN,
|
|
952 # ifdef FEAT_EVAL
|
|
953 (char_u *)VAR_WIN, PV_FDT,
|
|
954 {(char_u *)"foldtext()", (char_u *)NULL}
|
29
|
955 # else
|
7
|
956 (char_u *)NULL, PV_NONE,
|
|
957 {(char_u *)NULL, (char_u *)0L}
|
29
|
958 # endif
|
7
|
959 },
|
|
960 #endif
|
|
961 {"formatoptions","fo", P_STRING|P_ALLOCED|P_VIM|P_FLAGLIST,
|
|
962 (char_u *)&p_fo, PV_FO,
|
|
963 {(char_u *)DFLT_FO_VI, (char_u *)DFLT_FO_VIM}},
|
41
|
964 {"formatlistpat","flp", P_STRING|P_ALLOCED|P_VI_DEF,
|
|
965 (char_u *)&p_flp, PV_FLP,
|
|
966 {(char_u *)"^\\s*\\d\\+[\\]:.)}\\t ]\\s*", (char_u *)0L}},
|
7
|
967 {"formatprg", "fp", P_STRING|P_EXPAND|P_VI_DEF|P_SECURE,
|
|
968 (char_u *)&p_fp, PV_NONE,
|
|
969 {(char_u *)"", (char_u *)0L}},
|
36
|
970 {"fsync", "fs", P_BOOL|P_SECURE|P_VI_DEF,
|
|
971 #ifdef HAVE_FSYNC
|
|
972 (char_u *)&p_fs, PV_NONE,
|
|
973 {(char_u *)TRUE, (char_u *)0L}
|
|
974 #else
|
|
975 (char_u *)NULL, PV_NONE,
|
|
976 {(char_u *)FALSE, (char_u *)0L}
|
|
977 #endif
|
|
978 },
|
7
|
979 {"gdefault", "gd", P_BOOL|P_VI_DEF|P_VIM,
|
|
980 (char_u *)&p_gd, PV_NONE,
|
|
981 {(char_u *)FALSE, (char_u *)0L}},
|
|
982 {"graphic", "gr", P_BOOL|P_VI_DEF,
|
|
983 (char_u *)NULL, PV_NONE,
|
|
984 {(char_u *)FALSE, (char_u *)0L}},
|
|
985 {"grepformat", "gfm", P_STRING|P_VI_DEF|P_COMMA|P_NODUP,
|
|
986 #ifdef FEAT_QUICKFIX
|
|
987 (char_u *)&p_gefm, PV_NONE,
|
|
988 {(char_u *)DFLT_GREPFORMAT, (char_u *)0L},
|
|
989 #else
|
|
990 (char_u *)NULL, PV_NONE,
|
|
991 {(char_u *)NULL, (char_u *)0L}
|
|
992 #endif
|
|
993 },
|
|
994 {"grepprg", "gp", P_STRING|P_EXPAND|P_VI_DEF|P_SECURE,
|
|
995 #ifdef FEAT_QUICKFIX
|
|
996 (char_u *)&p_gp, OPT_BOTH(PV_GP),
|
|
997 {
|
|
998 # ifdef WIN3264
|
|
999 /* may be changed to "grep -n" in os_win32.c */
|
|
1000 (char_u *)"findstr /n",
|
|
1001 # else
|
|
1002 # ifdef UNIX
|
|
1003 /* Add an extra file name so that grep will always
|
|
1004 * insert a file name in the match line. */
|
|
1005 (char_u *)"grep -n $* /dev/null",
|
|
1006 # else
|
|
1007 # ifdef VMS
|
|
1008 (char_u *)"SEARCH/NUMBERS ",
|
|
1009 # else
|
|
1010 (char_u *)"grep -n ",
|
|
1011 #endif
|
|
1012 #endif
|
|
1013 # endif
|
|
1014 (char_u *)0L},
|
|
1015 #else
|
|
1016 (char_u *)NULL, PV_NONE,
|
|
1017 {(char_u *)NULL, (char_u *)0L}
|
|
1018 #endif
|
|
1019 },
|
|
1020 {"guicursor", "gcr", P_STRING|P_VI_DEF|P_COMMA|P_NODUP,
|
|
1021 #ifdef CURSOR_SHAPE
|
|
1022 (char_u *)&p_guicursor, PV_NONE,
|
|
1023 {
|
|
1024 # ifdef FEAT_GUI
|
|
1025 (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",
|
|
1026 # else /* MSDOS or Win32 console */
|
|
1027 (char_u *)"n-v-c:block,o:hor50,i-ci:hor15,r-cr:hor30,sm:block",
|
|
1028 # endif
|
|
1029 (char_u *)0L}
|
|
1030 #else
|
|
1031 (char_u *)NULL, PV_NONE,
|
|
1032 {(char_u *)NULL, (char_u *)0L}
|
|
1033 #endif
|
|
1034 },
|
|
1035 {"guifont", "gfn", P_STRING|P_VI_DEF|P_RCLR|P_COMMA|P_NODUP,
|
|
1036 #ifdef FEAT_GUI
|
|
1037 (char_u *)&p_guifont, PV_NONE,
|
|
1038 {(char_u *)"", (char_u *)0L}
|
|
1039 #else
|
|
1040 (char_u *)NULL, PV_NONE,
|
|
1041 {(char_u *)NULL, (char_u *)0L}
|
|
1042 #endif
|
|
1043 },
|
|
1044 {"guifontset", "gfs", P_STRING|P_VI_DEF|P_RCLR|P_COMMA,
|
|
1045 #if defined(FEAT_GUI) && defined(FEAT_XFONTSET)
|
|
1046 (char_u *)&p_guifontset, PV_NONE,
|
|
1047 {(char_u *)"", (char_u *)0L}
|
|
1048 #else
|
|
1049 (char_u *)NULL, PV_NONE,
|
|
1050 {(char_u *)NULL, (char_u *)0L}
|
|
1051 #endif
|
|
1052 },
|
|
1053 {"guifontwide", "gfw", P_STRING|P_VI_DEF|P_RCLR|P_COMMA|P_NODUP,
|
|
1054 #if defined(FEAT_GUI) && defined(FEAT_MBYTE)
|
|
1055 (char_u *)&p_guifontwide, PV_NONE,
|
|
1056 {(char_u *)"", (char_u *)0L}
|
|
1057 #else
|
|
1058 (char_u *)NULL, PV_NONE,
|
|
1059 {(char_u *)NULL, (char_u *)0L}
|
|
1060 #endif
|
|
1061 },
|
|
1062 {"guiheadroom", "ghr", P_NUM|P_VI_DEF,
|
11
|
1063 #if defined(FEAT_GUI_GTK) || defined(FEAT_GUI_X11) || defined(FEAT_GUI_KDE)
|
7
|
1064 (char_u *)&p_ghr, PV_NONE,
|
|
1065 #else
|
|
1066 (char_u *)NULL, PV_NONE,
|
|
1067 #endif
|
|
1068 {(char_u *)50L, (char_u *)0L}},
|
|
1069 {"guioptions", "go", P_STRING|P_VI_DEF|P_RALL|P_FLAGLIST,
|
11
|
1070 #if defined(FEAT_GUI) || defined(FEAT_GUI_KDE)
|
7
|
1071 (char_u *)&p_go, PV_NONE,
|
|
1072 # if defined(UNIX) && !defined(MACOS)
|
|
1073 {(char_u *)"agimrLtT", (char_u *)0L}
|
|
1074 # else
|
|
1075 {(char_u *)"gmrLtT", (char_u *)0L}
|
|
1076 # endif
|
|
1077 #else
|
|
1078 (char_u *)NULL, PV_NONE,
|
|
1079 {(char_u *)NULL, (char_u *)0L}
|
|
1080 #endif
|
|
1081 },
|
|
1082 {"guipty", NULL, P_BOOL|P_VI_DEF,
|
|
1083 #if defined(FEAT_GUI)
|
|
1084 (char_u *)&p_guipty, PV_NONE,
|
|
1085 #else
|
|
1086 (char_u *)NULL, PV_NONE,
|
|
1087 #endif
|
|
1088 {(char_u *)TRUE, (char_u *)0L}},
|
|
1089 {"hardtabs", "ht", P_NUM|P_VI_DEF,
|
|
1090 (char_u *)NULL, PV_NONE,
|
|
1091 {(char_u *)0L, (char_u *)0L}},
|
|
1092 {"helpfile", "hf", P_STRING|P_EXPAND|P_VI_DEF|P_SECURE,
|
|
1093 (char_u *)&p_hf, PV_NONE,
|
|
1094 {(char_u *)DFLT_HELPFILE, (char_u *)0L}},
|
|
1095 {"helpheight", "hh", P_NUM|P_VI_DEF,
|
|
1096 #ifdef FEAT_WINDOWS
|
|
1097 (char_u *)&p_hh, PV_NONE,
|
|
1098 #else
|
|
1099 (char_u *)NULL, PV_NONE,
|
|
1100 #endif
|
|
1101 {(char_u *)20L, (char_u *)0L}},
|
|
1102 {"helplang", "hlg", P_STRING|P_VI_DEF|P_COMMA,
|
|
1103 #ifdef FEAT_MULTI_LANG
|
|
1104 (char_u *)&p_hlg, PV_NONE,
|
|
1105 {(char_u *)"", (char_u *)0L}
|
|
1106 #else
|
|
1107 (char_u *)NULL, PV_NONE,
|
|
1108 {(char_u *)0L, (char_u *)0L}
|
|
1109 #endif
|
|
1110 },
|
|
1111 {"hidden", "hid", P_BOOL|P_VI_DEF,
|
|
1112 (char_u *)&p_hid, PV_NONE,
|
|
1113 {(char_u *)FALSE, (char_u *)0L}},
|
|
1114 {"highlight", "hl", P_STRING|P_VI_DEF|P_RCLR|P_COMMA|P_NODUP,
|
|
1115 (char_u *)&p_hl, PV_NONE,
|
221
|
1116 {(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,R:SpellRare,L:SpellLocal",
|
7
|
1117 (char_u *)0L}},
|
|
1118 {"history", "hi", P_NUM|P_VIM,
|
|
1119 (char_u *)&p_hi, PV_NONE,
|
|
1120 {(char_u *)0L, (char_u *)20L}},
|
|
1121 {"hkmap", "hk", P_BOOL|P_VI_DEF|P_VIM,
|
|
1122 #ifdef FEAT_RIGHTLEFT
|
|
1123 (char_u *)&p_hkmap, PV_NONE,
|
|
1124 #else
|
|
1125 (char_u *)NULL, PV_NONE,
|
|
1126 #endif
|
|
1127 {(char_u *)FALSE, (char_u *)0L}},
|
|
1128 {"hkmapp", "hkp", P_BOOL|P_VI_DEF|P_VIM,
|
|
1129 #ifdef FEAT_RIGHTLEFT
|
|
1130 (char_u *)&p_hkmapp, PV_NONE,
|
|
1131 #else
|
|
1132 (char_u *)NULL, PV_NONE,
|
|
1133 #endif
|
|
1134 {(char_u *)FALSE, (char_u *)0L}},
|
|
1135 {"hlsearch", "hls", P_BOOL|P_VI_DEF|P_VIM|P_RALL,
|
|
1136 (char_u *)&p_hls, PV_NONE,
|
|
1137 {(char_u *)FALSE, (char_u *)0L}},
|
|
1138 {"icon", NULL, P_BOOL|P_VI_DEF,
|
|
1139 #ifdef FEAT_TITLE
|
|
1140 (char_u *)&p_icon, PV_NONE,
|
|
1141 #else
|
|
1142 (char_u *)NULL, PV_NONE,
|
|
1143 #endif
|
|
1144 {(char_u *)FALSE, (char_u *)0L}},
|
|
1145 {"iconstring", NULL, P_STRING|P_VI_DEF,
|
|
1146 #ifdef FEAT_TITLE
|
|
1147 (char_u *)&p_iconstring, PV_NONE,
|
|
1148 #else
|
|
1149 (char_u *)NULL, PV_NONE,
|
|
1150 #endif
|
|
1151 {(char_u *)"", (char_u *)0L}},
|
|
1152 {"ignorecase", "ic", P_BOOL|P_VI_DEF,
|
|
1153 (char_u *)&p_ic, PV_NONE,
|
|
1154 {(char_u *)FALSE, (char_u *)0L}},
|
|
1155 {"imactivatekey","imak",P_STRING|P_VI_DEF,
|
11
|
1156 #if defined(FEAT_XIM) && (defined(FEAT_GUI_GTK) || defined(FEAT_GUI_KDE))
|
7
|
1157 (char_u *)&p_imak, PV_NONE,
|
|
1158 #else
|
|
1159 (char_u *)NULL, PV_NONE,
|
|
1160 #endif
|
|
1161 {(char_u *)"", (char_u *)0L}},
|
|
1162 {"imcmdline", "imc", P_BOOL|P_VI_DEF,
|
|
1163 #ifdef USE_IM_CONTROL
|
|
1164 (char_u *)&p_imcmdline, PV_NONE,
|
|
1165 #else
|
|
1166 (char_u *)NULL, PV_NONE,
|
|
1167 #endif
|
|
1168 {(char_u *)FALSE, (char_u *)0L}},
|
|
1169 {"imdisable", "imd", P_BOOL|P_VI_DEF,
|
|
1170 #ifdef USE_IM_CONTROL
|
|
1171 (char_u *)&p_imdisable, PV_NONE,
|
|
1172 #else
|
|
1173 (char_u *)NULL, PV_NONE,
|
|
1174 #endif
|
|
1175 #ifdef __sgi
|
|
1176 {(char_u *)TRUE, (char_u *)0L}
|
|
1177 #else
|
|
1178 {(char_u *)FALSE, (char_u *)0L}
|
|
1179 #endif
|
|
1180 },
|
|
1181 {"iminsert", "imi", P_NUM|P_VI_DEF,
|
|
1182 (char_u *)&p_iminsert, PV_IMI,
|
|
1183 #ifdef B_IMODE_IM
|
|
1184 {(char_u *)B_IMODE_IM, (char_u *)0L}
|
|
1185 #else
|
|
1186 {(char_u *)B_IMODE_NONE, (char_u *)0L}
|
|
1187 #endif
|
|
1188 },
|
|
1189 {"imsearch", "ims", P_NUM|P_VI_DEF,
|
|
1190 (char_u *)&p_imsearch, PV_IMS,
|
|
1191 #ifdef B_IMODE_IM
|
|
1192 {(char_u *)B_IMODE_IM, (char_u *)0L}
|
|
1193 #else
|
|
1194 {(char_u *)B_IMODE_NONE, (char_u *)0L}
|
|
1195 #endif
|
|
1196 },
|
|
1197 {"include", "inc", P_STRING|P_ALLOCED|P_VI_DEF,
|
|
1198 #ifdef FEAT_FIND_ID
|
|
1199 (char_u *)&p_inc, OPT_BOTH(PV_INC),
|
|
1200 {(char_u *)"^\\s*#\\s*include", (char_u *)0L}
|
|
1201 #else
|
|
1202 (char_u *)NULL, PV_NONE,
|
|
1203 {(char_u *)0L, (char_u *)0L}
|
|
1204 #endif
|
|
1205 },
|
|
1206 {"includeexpr", "inex", P_STRING|P_ALLOCED|P_VI_DEF,
|
|
1207 #if defined(FEAT_FIND_ID) && defined(FEAT_EVAL)
|
|
1208 (char_u *)&p_inex, PV_INEX,
|
|
1209 {(char_u *)"", (char_u *)0L}
|
|
1210 #else
|
|
1211 (char_u *)NULL, PV_NONE,
|
|
1212 {(char_u *)0L, (char_u *)0L}
|
|
1213 #endif
|
|
1214 },
|
|
1215 {"incsearch", "is", P_BOOL|P_VI_DEF|P_VIM,
|
|
1216 (char_u *)&p_is, PV_NONE,
|
|
1217 {(char_u *)FALSE, (char_u *)0L}},
|
|
1218 {"indentexpr", "inde", P_STRING|P_ALLOCED|P_VI_DEF|P_VIM,
|
|
1219 #if defined(FEAT_CINDENT) && defined(FEAT_EVAL)
|
|
1220 (char_u *)&p_inde, PV_INDE,
|
|
1221 {(char_u *)"", (char_u *)0L}
|
|
1222 #else
|
|
1223 (char_u *)NULL, PV_NONE,
|
|
1224 {(char_u *)0L, (char_u *)0L}
|
|
1225 #endif
|
|
1226 },
|
|
1227 {"indentkeys", "indk", P_STRING|P_ALLOCED|P_VI_DEF|P_COMMA|P_NODUP,
|
|
1228 #if defined(FEAT_CINDENT) && defined(FEAT_EVAL)
|
|
1229 (char_u *)&p_indk, PV_INDK,
|
|
1230 {(char_u *)"0{,0},:,0#,!^F,o,O,e", (char_u *)0L}
|
|
1231 #else
|
|
1232 (char_u *)NULL, PV_NONE,
|
|
1233 {(char_u *)0L, (char_u *)0L}
|
|
1234 #endif
|
|
1235 },
|
|
1236 {"infercase", "inf", P_BOOL|P_VI_DEF,
|
|
1237 (char_u *)&p_inf, PV_INF,
|
|
1238 {(char_u *)FALSE, (char_u *)0L}},
|
|
1239 {"insertmode", "im", P_BOOL|P_VI_DEF|P_VIM,
|
|
1240 (char_u *)&p_im, PV_NONE,
|
|
1241 {(char_u *)FALSE, (char_u *)0L}},
|
|
1242 {"isfname", "isf", P_STRING|P_VI_DEF|P_COMMA|P_NODUP,
|
|
1243 (char_u *)&p_isf, PV_NONE,
|
|
1244 {
|
|
1245 #ifdef BACKSLASH_IN_FILENAME
|
|
1246 /* Excluded are: & and ^ are special in cmd.exe
|
|
1247 * ( and ) are used in text separating fnames */
|
|
1248 (char_u *)"@,48-57,/,\\,.,-,_,+,,,#,$,%,{,},[,],:,@-@,!,~,=",
|
|
1249 #else
|
|
1250 # ifdef AMIGA
|
|
1251 (char_u *)"@,48-57,/,.,-,_,+,,,$,:",
|
|
1252 # else
|
|
1253 # ifdef VMS
|
|
1254 (char_u *)"@,48-57,/,.,-,_,+,,,#,$,%,<,>,[,],:,;,~",
|
|
1255 # else /* UNIX et al. */
|
|
1256 # ifdef EBCDIC
|
|
1257 (char_u *)"@,240-249,/,.,-,_,+,,,#,$,%,~,=",
|
|
1258 # else
|
|
1259 (char_u *)"@,48-57,/,.,-,_,+,,,#,$,%,~,=",
|
|
1260 # endif
|
|
1261 # endif
|
|
1262 # endif
|
|
1263 #endif
|
|
1264 (char_u *)0L}},
|
|
1265 {"isident", "isi", P_STRING|P_VI_DEF|P_COMMA|P_NODUP,
|
|
1266 (char_u *)&p_isi, PV_NONE,
|
|
1267 {
|
|
1268 #if defined(MSDOS) || defined(MSWIN) || defined(OS2)
|
|
1269 (char_u *)"@,48-57,_,128-167,224-235",
|
|
1270 #else
|
|
1271 # ifdef EBCDIC
|
|
1272 /* TODO: EBCDIC Check this! @ == isalpha()*/
|
|
1273 (char_u *)"@,240-249,_,66-73,81-89,98-105,"
|
|
1274 "112-120,128,140-142,156,158,172,"
|
|
1275 "174,186,191,203-207,219-225,235-239,"
|
|
1276 "251-254",
|
|
1277 # else
|
|
1278 (char_u *)"@,48-57,_,192-255",
|
|
1279 # endif
|
|
1280 #endif
|
|
1281 (char_u *)0L}},
|
|
1282 {"iskeyword", "isk", P_STRING|P_ALLOCED|P_VIM|P_COMMA|P_NODUP,
|
|
1283 (char_u *)&p_isk, PV_ISK,
|
|
1284 {
|
|
1285 #ifdef EBCDIC
|
|
1286 (char_u *)"@,240-249,_",
|
|
1287 /* TODO: EBCDIC Check this! @ == isalpha()*/
|
|
1288 (char_u *)"@,240-249,_,66-73,81-89,98-105,"
|
|
1289 "112-120,128,140-142,156,158,172,"
|
|
1290 "174,186,191,203-207,219-225,235-239,"
|
|
1291 "251-254",
|
|
1292 #else
|
|
1293 (char_u *)"@,48-57,_",
|
|
1294 # if defined(MSDOS) || defined(MSWIN) || defined(OS2)
|
|
1295 (char_u *)"@,48-57,_,128-167,224-235"
|
|
1296 # else
|
|
1297 (char_u *)"@,48-57,_,192-255"
|
|
1298 # endif
|
|
1299 #endif
|
|
1300 }},
|
|
1301 {"isprint", "isp", P_STRING|P_VI_DEF|P_RALL|P_COMMA|P_NODUP,
|
|
1302 (char_u *)&p_isp, PV_NONE,
|
|
1303 {
|
36
|
1304 #if defined(MSDOS) || defined(MSWIN) || defined(OS2) \
|
|
1305 || (defined(MACOS) && !defined(MACOS_X)) \
|
7
|
1306 || defined(VMS)
|
|
1307 (char_u *)"@,~-255",
|
|
1308 #else
|
|
1309 # ifdef EBCDIC
|
|
1310 /* all chars above 63 are printable */
|
|
1311 (char_u *)"63-255",
|
|
1312 # else
|
|
1313 (char_u *)"@,161-255",
|
|
1314 # endif
|
|
1315 #endif
|
|
1316 (char_u *)0L}},
|
|
1317 {"joinspaces", "js", P_BOOL|P_VI_DEF|P_VIM,
|
|
1318 (char_u *)&p_js, PV_NONE,
|
|
1319 {(char_u *)TRUE, (char_u *)0L}},
|
|
1320 {"key", NULL, P_STRING|P_ALLOCED|P_VI_DEF|P_NO_MKRC,
|
|
1321 #ifdef FEAT_CRYPT
|
|
1322 (char_u *)&p_key, PV_KEY,
|
|
1323 {(char_u *)"", (char_u *)0L}
|
|
1324 #else
|
|
1325 (char_u *)NULL, PV_NONE,
|
|
1326 {(char_u *)0L, (char_u *)0L}
|
|
1327 #endif
|
|
1328 },
|
36
|
1329 {"keymap", "kmp", P_STRING|P_ALLOCED|P_VI_DEF|P_RBUF|P_RSTAT|P_NFNAME,
|
7
|
1330 #ifdef FEAT_KEYMAP
|
|
1331 (char_u *)&p_keymap, PV_KMAP,
|
|
1332 {(char_u *)"", (char_u *)0L}
|
|
1333 #else
|
|
1334 (char_u *)NULL, PV_NONE,
|
|
1335 {(char_u *)"", (char_u *)0L}
|
|
1336 #endif
|
|
1337 },
|
|
1338 {"keymodel", "km", P_STRING|P_VI_DEF|P_COMMA|P_NODUP,
|
|
1339 #ifdef FEAT_VISUAL
|
|
1340 (char_u *)&p_km, PV_NONE,
|
|
1341 #else
|
|
1342 (char_u *)NULL, PV_NONE,
|
|
1343 #endif
|
|
1344 {(char_u *)"", (char_u *)0L}},
|
|
1345 {"keywordprg", "kp", P_STRING|P_EXPAND|P_VI_DEF|P_SECURE,
|
|
1346 (char_u *)&p_kp, OPT_BOTH(PV_KP),
|
|
1347 {
|
|
1348 #if defined(MSDOS) || defined(MSWIN)
|
|
1349 (char_u *)":help",
|
|
1350 #else
|
|
1351 #ifdef VMS
|
|
1352 (char_u *)"help",
|
|
1353 #else
|
|
1354 # if defined(OS2)
|
|
1355 (char_u *)"view /",
|
|
1356 # else
|
|
1357 # ifdef USEMAN_S
|
|
1358 (char_u *)"man -s",
|
|
1359 # else
|
|
1360 (char_u *)"man",
|
|
1361 # endif
|
|
1362 # endif
|
|
1363 #endif
|
|
1364 #endif
|
|
1365 (char_u *)0L}},
|
|
1366 {"langmap", "lmap", P_STRING|P_VI_DEF|P_COMMA|P_NODUP,
|
|
1367 #ifdef FEAT_LANGMAP
|
|
1368 (char_u *)&p_langmap, PV_NONE,
|
|
1369 {(char_u *)"", /* unmatched } */
|
|
1370 #else
|
|
1371 (char_u *)NULL, PV_NONE,
|
|
1372 {(char_u *)NULL,
|
|
1373 #endif
|
|
1374 (char_u *)0L}},
|
36
|
1375 {"langmenu", "lm", P_STRING|P_VI_DEF|P_NFNAME,
|
7
|
1376 #if defined(FEAT_MENU) && defined(FEAT_MULTI_LANG)
|
|
1377 (char_u *)&p_lm, PV_NONE,
|
|
1378 #else
|
|
1379 (char_u *)NULL, PV_NONE,
|
|
1380 #endif
|
|
1381 {(char_u *)"", (char_u *)0L}},
|
|
1382 {"laststatus", "ls", P_NUM|P_VI_DEF|P_RALL,
|
|
1383 #ifdef FEAT_WINDOWS
|
|
1384 (char_u *)&p_ls, PV_NONE,
|
|
1385 #else
|
|
1386 (char_u *)NULL, PV_NONE,
|
|
1387 #endif
|
|
1388 {(char_u *)1L, (char_u *)0L}},
|
|
1389 {"lazyredraw", "lz", P_BOOL|P_VI_DEF,
|
|
1390 (char_u *)&p_lz, PV_NONE,
|
|
1391 {(char_u *)FALSE, (char_u *)0L}},
|
|
1392 {"linebreak", "lbr", P_BOOL|P_VI_DEF|P_RWIN,
|
|
1393 #ifdef FEAT_LINEBREAK
|
|
1394 (char_u *)VAR_WIN, PV_LBR,
|
|
1395 #else
|
|
1396 (char_u *)NULL, PV_NONE,
|
|
1397 #endif
|
|
1398 {(char_u *)FALSE, (char_u *)0L}},
|
|
1399 {"lines", NULL, P_NUM|P_NODEFAULT|P_NO_MKRC|P_VI_DEF|P_RCLR,
|
|
1400 (char_u *)&Rows, PV_NONE,
|
|
1401 {
|
|
1402 #if defined(MSDOS) || defined(WIN3264) || defined(OS2)
|
|
1403 (char_u *)25L,
|
|
1404 #else
|
|
1405 (char_u *)24L,
|
|
1406 #endif
|
|
1407 (char_u *)0L}},
|
|
1408 {"linespace", "lsp", P_NUM|P_VI_DEF|P_RCLR,
|
|
1409 #ifdef FEAT_GUI
|
|
1410 (char_u *)&p_linespace, PV_NONE,
|
|
1411 #else
|
|
1412 (char_u *)NULL, PV_NONE,
|
|
1413 #endif
|
|
1414 #ifdef FEAT_GUI_W32
|
|
1415 {(char_u *)1L, (char_u *)0L}
|
|
1416 #else
|
|
1417 {(char_u *)0L, (char_u *)0L}
|
|
1418 #endif
|
|
1419 },
|
|
1420 {"lisp", NULL, P_BOOL|P_VI_DEF,
|
|
1421 #ifdef FEAT_LISP
|
|
1422 (char_u *)&p_lisp, PV_LISP,
|
|
1423 #else
|
|
1424 (char_u *)NULL, PV_NONE,
|
|
1425 #endif
|
|
1426 {(char_u *)FALSE, (char_u *)0L}},
|
|
1427 {"lispwords", "lw", P_STRING|P_VI_DEF|P_COMMA|P_NODUP,
|
|
1428 #ifdef FEAT_LISP
|
|
1429 (char_u *)&p_lispwords, PV_NONE,
|
|
1430 {(char_u *)LISPWORD_VALUE, (char_u *)0L}
|
|
1431 #else
|
|
1432 (char_u *)NULL, PV_NONE,
|
|
1433 {(char_u *)"", (char_u *)0L}
|
|
1434 #endif
|
|
1435 },
|
|
1436 {"list", NULL, P_BOOL|P_VI_DEF|P_RWIN,
|
|
1437 (char_u *)VAR_WIN, PV_LIST,
|
|
1438 {(char_u *)FALSE, (char_u *)0L}},
|
|
1439 {"listchars", "lcs", P_STRING|P_VI_DEF|P_RALL|P_COMMA|P_NODUP,
|
|
1440 (char_u *)&p_lcs, PV_NONE,
|
|
1441 {(char_u *)"eol:$", (char_u *)0L}},
|
|
1442 {"loadplugins", "lpl", P_BOOL|P_VI_DEF,
|
|
1443 (char_u *)&p_lpl, PV_NONE,
|
|
1444 {(char_u *)TRUE, (char_u *)0L}},
|
|
1445 {"magic", NULL, P_BOOL|P_VI_DEF,
|
|
1446 (char_u *)&p_magic, PV_NONE,
|
|
1447 {(char_u *)TRUE, (char_u *)0L}},
|
|
1448 {"makeef", "mef", P_STRING|P_EXPAND|P_VI_DEF|P_SECURE,
|
|
1449 #ifdef FEAT_QUICKFIX
|
|
1450 (char_u *)&p_mef, PV_NONE,
|
|
1451 {(char_u *)"", (char_u *)0L}
|
|
1452 #else
|
|
1453 (char_u *)NULL, PV_NONE,
|
|
1454 {(char_u *)NULL, (char_u *)0L}
|
|
1455 #endif
|
|
1456 },
|
|
1457 {"makeprg", "mp", P_STRING|P_EXPAND|P_VI_DEF|P_SECURE,
|
|
1458 #ifdef FEAT_QUICKFIX
|
|
1459 (char_u *)&p_mp, OPT_BOTH(PV_MP),
|
|
1460 # ifdef VMS
|
|
1461 {(char_u *)"MMS", (char_u *)0L}
|
|
1462 # else
|
|
1463 {(char_u *)"make", (char_u *)0L}
|
|
1464 # endif
|
|
1465 #else
|
|
1466 (char_u *)NULL, PV_NONE,
|
|
1467 {(char_u *)NULL, (char_u *)0L}
|
|
1468 #endif
|
|
1469 },
|
|
1470 {"matchpairs", "mps", P_STRING|P_ALLOCED|P_VI_DEF|P_COMMA|P_NODUP,
|
|
1471 (char_u *)&p_mps, PV_MPS,
|
|
1472 {(char_u *)"(:),{:},[:]", (char_u *)0L}},
|
|
1473 {"matchtime", "mat", P_NUM|P_VI_DEF,
|
|
1474 (char_u *)&p_mat, PV_NONE,
|
|
1475 {(char_u *)5L, (char_u *)0L}},
|
|
1476 {"maxfuncdepth", "mfd", P_NUM|P_VI_DEF,
|
|
1477 #ifdef FEAT_EVAL
|
|
1478 (char_u *)&p_mfd, PV_NONE,
|
|
1479 #else
|
|
1480 (char_u *)NULL, PV_NONE,
|
|
1481 #endif
|
|
1482 {(char_u *)100L, (char_u *)0L}},
|
|
1483 {"maxmapdepth", "mmd", P_NUM|P_VI_DEF,
|
|
1484 (char_u *)&p_mmd, PV_NONE,
|
|
1485 {(char_u *)1000L, (char_u *)0L}},
|
|
1486 {"maxmem", "mm", P_NUM|P_VI_DEF,
|
|
1487 (char_u *)&p_mm, PV_NONE,
|
|
1488 {(char_u *)DFLT_MAXMEM, (char_u *)0L}},
|
190
|
1489 {"maxmempattern","mmp", P_NUM|P_VI_DEF,
|
|
1490 (char_u *)&p_mmp, PV_NONE,
|
|
1491 {(char_u *)1000L, (char_u *)0L}},
|
7
|
1492 {"maxmemtot", "mmt", P_NUM|P_VI_DEF,
|
|
1493 (char_u *)&p_mmt, PV_NONE,
|
|
1494 {(char_u *)DFLT_MAXMEMTOT, (char_u *)0L}},
|
|
1495 {"menuitems", "mis", P_NUM|P_VI_DEF,
|
|
1496 #ifdef FEAT_MENU
|
|
1497 (char_u *)&p_mis, PV_NONE,
|
|
1498 #else
|
|
1499 (char_u *)NULL, PV_NONE,
|
|
1500 #endif
|
|
1501 {(char_u *)25L, (char_u *)0L}},
|
|
1502 {"mesg", NULL, P_BOOL|P_VI_DEF,
|
|
1503 (char_u *)NULL, PV_NONE,
|
|
1504 {(char_u *)FALSE, (char_u *)0L}},
|
|
1505 {"modeline", "ml", P_BOOL|P_VIM,
|
|
1506 (char_u *)&p_ml, PV_ML,
|
|
1507 {(char_u *)FALSE, (char_u *)TRUE}},
|
|
1508 {"modelines", "mls", P_NUM|P_VI_DEF,
|
|
1509 (char_u *)&p_mls, PV_NONE,
|
|
1510 {(char_u *)5L, (char_u *)0L}},
|
|
1511 {"modifiable", "ma", P_BOOL|P_VI_DEF|P_NOGLOB,
|
|
1512 (char_u *)&p_ma, PV_MA,
|
|
1513 {(char_u *)TRUE, (char_u *)0L}},
|
|
1514 {"modified", "mod", P_BOOL|P_NO_MKRC|P_VI_DEF|P_RSTAT,
|
|
1515 (char_u *)&p_mod, PV_MOD,
|
|
1516 {(char_u *)FALSE, (char_u *)0L}},
|
|
1517 {"more", NULL, P_BOOL|P_VIM,
|
|
1518 (char_u *)&p_more, PV_NONE,
|
|
1519 {(char_u *)FALSE, (char_u *)TRUE}},
|
|
1520 {"mouse", NULL, P_STRING|P_VI_DEF|P_FLAGLIST,
|
|
1521 (char_u *)&p_mouse, PV_NONE,
|
|
1522 {
|
|
1523 #if defined(MSDOS) || defined(WIN3264)
|
|
1524 (char_u *)"a",
|
|
1525 #else
|
|
1526 (char_u *)"",
|
|
1527 #endif
|
|
1528 (char_u *)0L}},
|
|
1529 {"mousefocus", "mousef", P_BOOL|P_VI_DEF,
|
|
1530 #ifdef FEAT_GUI
|
|
1531 (char_u *)&p_mousef, PV_NONE,
|
|
1532 #else
|
|
1533 (char_u *)NULL, PV_NONE,
|
|
1534 #endif
|
|
1535 {(char_u *)FALSE, (char_u *)0L}},
|
|
1536 {"mousehide", "mh", P_BOOL|P_VI_DEF,
|
|
1537 #ifdef FEAT_GUI
|
|
1538 (char_u *)&p_mh, PV_NONE,
|
|
1539 #else
|
|
1540 (char_u *)NULL, PV_NONE,
|
|
1541 #endif
|
|
1542 {(char_u *)TRUE, (char_u *)0L}},
|
|
1543 {"mousemodel", "mousem", P_STRING|P_VI_DEF,
|
|
1544 (char_u *)&p_mousem, PV_NONE,
|
|
1545 {
|
|
1546 #if defined(MSDOS) || defined(MSWIN)
|
|
1547 (char_u *)"popup",
|
|
1548 #else
|
|
1549 # if defined(MACOS)
|
|
1550 (char_u *)"popup_setpos",
|
|
1551 # else
|
|
1552 (char_u *)"extend",
|
|
1553 # endif
|
|
1554 #endif
|
|
1555 (char_u *)0L}},
|
|
1556 {"mouseshape", "mouses", P_STRING|P_VI_DEF|P_COMMA|P_NODUP,
|
|
1557 #ifdef FEAT_MOUSESHAPE
|
|
1558 (char_u *)&p_mouseshape, PV_NONE,
|
|
1559 {(char_u *)"i-r:beam,s:updown,sd:udsizing,vs:leftright,vd:lrsizing,m:no,ml:up-arrow,v:rightup-arrow", (char_u *)0L}
|
|
1560 #else
|
|
1561 (char_u *)NULL, PV_NONE,
|
|
1562 {(char_u *)NULL, (char_u *)0L}
|
|
1563 #endif
|
|
1564 },
|
|
1565 {"mousetime", "mouset", P_NUM|P_VI_DEF,
|
|
1566 (char_u *)&p_mouset, PV_NONE,
|
|
1567 {(char_u *)500L, (char_u *)0L}},
|
14
|
1568 {"mzquantum", "mzq", P_NUM,
|
|
1569 #ifdef FEAT_MZSCHEME
|
|
1570 (char_u *)&p_mzq, PV_NONE,
|
|
1571 #else
|
|
1572 (char_u *)NULL, PV_NONE,
|
|
1573 #endif
|
|
1574 {(char_u *)100L, (char_u *)100L}},
|
7
|
1575 {"novice", NULL, P_BOOL|P_VI_DEF,
|
|
1576 (char_u *)NULL, PV_NONE,
|
|
1577 {(char_u *)FALSE, (char_u *)0L}},
|
|
1578 {"nrformats", "nf", P_STRING|P_ALLOCED|P_VI_DEF|P_COMMA|P_NODUP,
|
|
1579 (char_u *)&p_nf, PV_NF,
|
|
1580 {(char_u *)"octal,hex", (char_u *)0L}},
|
|
1581 {"number", "nu", P_BOOL|P_VI_DEF|P_RWIN,
|
|
1582 (char_u *)VAR_WIN, PV_NU,
|
|
1583 {(char_u *)FALSE, (char_u *)0L}},
|
13
|
1584 {"numberwidth", "nuw", P_NUM|P_RWIN|P_VIM,
|
|
1585 #ifdef FEAT_LINEBREAK
|
|
1586 (char_u *)VAR_WIN, PV_NUW,
|
|
1587 #else
|
|
1588 (char_u *)NULL, PV_NONE,
|
|
1589 #endif
|
|
1590 {(char_u *)8L, (char_u *)4L}},
|
7
|
1591 {"open", NULL, P_BOOL|P_VI_DEF,
|
|
1592 (char_u *)NULL, PV_NONE,
|
|
1593 {(char_u *)FALSE, (char_u *)0L}},
|
|
1594 {"optimize", "opt", P_BOOL|P_VI_DEF,
|
|
1595 (char_u *)NULL, PV_NONE,
|
|
1596 {(char_u *)FALSE, (char_u *)0L}},
|
|
1597 {"osfiletype", "oft", P_STRING|P_ALLOCED|P_VI_DEF,
|
|
1598 #ifdef FEAT_OSFILETYPE
|
|
1599 (char_u *)&p_oft, PV_OFT,
|
|
1600 {(char_u *)DFLT_OFT, (char_u *)0L}
|
|
1601 #else
|
|
1602 (char_u *)NULL, PV_NONE,
|
|
1603 {(char_u *)0L, (char_u *)0L}
|
|
1604 #endif
|
|
1605 },
|
|
1606 {"paragraphs", "para", P_STRING|P_VI_DEF,
|
|
1607 (char_u *)&p_para, PV_NONE,
|
|
1608 {(char_u *)"IPLPPPQPP LIpplpipbp", (char_u *)0L}},
|
|
1609 {"paste", NULL, P_BOOL|P_VI_DEF,
|
|
1610 (char_u *)&p_paste, PV_NONE,
|
|
1611 {(char_u *)FALSE, (char_u *)0L}},
|
|
1612 {"pastetoggle", "pt", P_STRING|P_VI_DEF,
|
|
1613 (char_u *)&p_pt, PV_NONE,
|
|
1614 {(char_u *)"", (char_u *)0L}},
|
|
1615 {"patchexpr", "pex", P_STRING|P_VI_DEF|P_SECURE,
|
|
1616 #if defined(FEAT_DIFF) && defined(FEAT_EVAL)
|
|
1617 (char_u *)&p_pex, PV_NONE,
|
|
1618 {(char_u *)"", (char_u *)0L}
|
|
1619 #else
|
|
1620 (char_u *)NULL, PV_NONE,
|
|
1621 {(char_u *)0L, (char_u *)0L}
|
|
1622 #endif
|
|
1623 },
|
36
|
1624 {"patchmode", "pm", P_STRING|P_VI_DEF|P_NFNAME,
|
7
|
1625 (char_u *)&p_pm, PV_NONE,
|
|
1626 {(char_u *)"", (char_u *)0L}},
|
|
1627 {"path", "pa", P_STRING|P_EXPAND|P_VI_DEF|P_COMMA|P_NODUP,
|
|
1628 (char_u *)&p_path, OPT_BOTH(PV_PATH),
|
|
1629 {
|
|
1630 #if defined AMIGA || defined MSDOS || defined MSWIN
|
|
1631 (char_u *)".,,",
|
|
1632 #else
|
|
1633 # if defined(__EMX__)
|
|
1634 (char_u *)".,/emx/include,,",
|
|
1635 # else /* Unix, probably */
|
|
1636 (char_u *)".,/usr/include,,",
|
|
1637 # endif
|
|
1638 #endif
|
|
1639 (char_u *)0L}},
|
|
1640 {"preserveindent", "pi", P_BOOL|P_VI_DEF|P_VIM,
|
|
1641 (char_u *)&p_pi, PV_PI,
|
|
1642 {(char_u *)FALSE, (char_u *)0L}},
|
13
|
1643 {"previewheight", "pvh", P_NUM|P_VI_DEF,
|
7
|
1644 #if defined(FEAT_WINDOWS) && defined(FEAT_QUICKFIX)
|
|
1645 (char_u *)&p_pvh, PV_NONE,
|
|
1646 #else
|
|
1647 (char_u *)NULL, PV_NONE,
|
|
1648 #endif
|
|
1649 {(char_u *)12L, (char_u *)0L}},
|
|
1650 {"previewwindow", "pvw", P_BOOL|P_VI_DEF|P_RSTAT|P_NOGLOB,
|
|
1651 #if defined(FEAT_WINDOWS) && defined(FEAT_QUICKFIX)
|
|
1652 (char_u *)VAR_WIN, PV_PVW,
|
|
1653 #else
|
|
1654 (char_u *)NULL, PV_NONE,
|
|
1655 #endif
|
|
1656 {(char_u *)FALSE, (char_u *)0L}},
|
36
|
1657 {"printdevice", "pdev", P_STRING|P_VI_DEF|P_SECURE,
|
7
|
1658 #ifdef FEAT_PRINTER
|
|
1659 (char_u *)&p_pdev, PV_NONE,
|
|
1660 {(char_u *)"", (char_u *)0L}
|
|
1661 #else
|
|
1662 (char_u *)NULL, PV_NONE,
|
|
1663 {(char_u *)NULL, (char_u *)0L}
|
|
1664 #endif
|
|
1665 },
|
|
1666 {"printencoding", "penc", P_STRING|P_VI_DEF,
|
|
1667 #ifdef FEAT_POSTSCRIPT
|
|
1668 (char_u *)&p_penc, PV_NONE,
|
|
1669 {(char_u *)"", (char_u *)0L}
|
|
1670 #else
|
|
1671 (char_u *)NULL, PV_NONE,
|
|
1672 {(char_u *)NULL, (char_u *)0L}
|
|
1673 #endif
|
|
1674 },
|
|
1675 {"printexpr", "pexpr", P_STRING|P_VI_DEF,
|
|
1676 #ifdef FEAT_POSTSCRIPT
|
|
1677 (char_u *)&p_pexpr, PV_NONE,
|
|
1678 {(char_u *)"", (char_u *)0L}
|
|
1679 #else
|
|
1680 (char_u *)NULL, PV_NONE,
|
|
1681 {(char_u *)NULL, (char_u *)0L}
|
|
1682 #endif
|
|
1683 },
|
|
1684 {"printfont", "pfn", P_STRING|P_VI_DEF,
|
|
1685 #ifdef FEAT_PRINTER
|
|
1686 (char_u *)&p_pfn, PV_NONE,
|
|
1687 {
|
|
1688 # ifdef MSWIN
|
|
1689 (char_u *)"Courier_New:h10",
|
|
1690 # else
|
|
1691 (char_u *)"courier",
|
|
1692 # endif
|
|
1693 (char_u *)0L}
|
|
1694 #else
|
|
1695 (char_u *)NULL, PV_NONE,
|
|
1696 {(char_u *)NULL, (char_u *)0L}
|
|
1697 #endif
|
|
1698 },
|
|
1699 {"printheader", "pheader", P_STRING|P_VI_DEF|P_GETTEXT,
|
|
1700 #ifdef FEAT_PRINTER
|
|
1701 (char_u *)&p_header, PV_NONE,
|
|
1702 {(char_u *)N_("%<%f%h%m%=Page %N"), (char_u *)0L}
|
|
1703 #else
|
|
1704 (char_u *)NULL, PV_NONE,
|
|
1705 {(char_u *)NULL, (char_u *)0L}
|
|
1706 #endif
|
|
1707 },
|
15
|
1708 {"printmbcharset", "pmbcs", P_STRING|P_VI_DEF,
|
|
1709 #if defined(FEAT_POSTSCRIPT) && defined(FEAT_MBYTE)
|
|
1710 (char_u *)&p_pmcs, PV_NONE,
|
|
1711 {(char_u *)"", (char_u *)0L}
|
|
1712 #else
|
|
1713 (char_u *)NULL, PV_NONE,
|
|
1714 {(char_u *)NULL, (char_u *)0L}
|
|
1715 #endif
|
|
1716 },
|
|
1717 {"printmbfont", "pmbfn", P_STRING|P_VI_DEF,
|
|
1718 #if defined(FEAT_POSTSCRIPT) && defined(FEAT_MBYTE)
|
|
1719 (char_u *)&p_pmfn, PV_NONE,
|
|
1720 {(char_u *)"", (char_u *)0L}
|
|
1721 #else
|
|
1722 (char_u *)NULL, PV_NONE,
|
|
1723 {(char_u *)NULL, (char_u *)0L}
|
|
1724 #endif
|
|
1725 },
|
7
|
1726 {"printoptions", "popt", P_STRING|P_VI_DEF|P_COMMA|P_NODUP,
|
|
1727 #ifdef FEAT_PRINTER
|
|
1728 (char_u *)&p_popt, PV_NONE,
|
|
1729 {(char_u *)"", (char_u *)0L}
|
|
1730 #else
|
|
1731 (char_u *)NULL, PV_NONE,
|
|
1732 {(char_u *)NULL, (char_u *)0L}
|
|
1733 #endif
|
|
1734 },
|
|
1735 {"prompt", NULL, P_BOOL|P_VI_DEF,
|
168
|
1736 (char_u *)&p_prompt, PV_NONE,
|
|
1737 {(char_u *)TRUE, (char_u *)0L}},
|
12
|
1738 {"quoteescape", "qe", P_STRING|P_ALLOCED|P_VI_DEF,
|
|
1739 #ifdef FEAT_TEXTOBJ
|
|
1740 (char_u *)&p_qe, PV_QE,
|
|
1741 {(char_u *)"\\", (char_u *)0L}
|
|
1742 #else
|
|
1743 (char_u *)NULL, PV_NONE,
|
|
1744 {(char_u *)NULL, (char_u *)0L}
|
|
1745 #endif
|
|
1746 },
|
7
|
1747 {"readonly", "ro", P_BOOL|P_VI_DEF|P_RSTAT|P_NOGLOB,
|
|
1748 (char_u *)&p_ro, PV_RO,
|
|
1749 {(char_u *)FALSE, (char_u *)0L}},
|
|
1750 {"redraw", NULL, P_BOOL|P_VI_DEF,
|
|
1751 (char_u *)NULL, PV_NONE,
|
|
1752 {(char_u *)FALSE, (char_u *)0L}},
|
|
1753 {"remap", NULL, P_BOOL|P_VI_DEF,
|
|
1754 (char_u *)&p_remap, PV_NONE,
|
|
1755 {(char_u *)TRUE, (char_u *)0L}},
|
|
1756 {"report", NULL, P_NUM|P_VI_DEF,
|
|
1757 (char_u *)&p_report, PV_NONE,
|
|
1758 {(char_u *)2L, (char_u *)0L}},
|
|
1759 {"restorescreen", "rs", P_BOOL|P_VI_DEF,
|
|
1760 #ifdef WIN3264
|
|
1761 (char_u *)&p_rs, PV_NONE,
|
|
1762 #else
|
|
1763 (char_u *)NULL, PV_NONE,
|
|
1764 #endif
|
|
1765 {(char_u *)TRUE, (char_u *)0L}},
|
|
1766 {"revins", "ri", P_BOOL|P_VI_DEF|P_VIM,
|
|
1767 #ifdef FEAT_RIGHTLEFT
|
|
1768 (char_u *)&p_ri, PV_NONE,
|
|
1769 #else
|
|
1770 (char_u *)NULL, PV_NONE,
|
|
1771 #endif
|
|
1772 {(char_u *)FALSE, (char_u *)0L}},
|
|
1773 {"rightleft", "rl", P_BOOL|P_VI_DEF|P_RWIN,
|
|
1774 #ifdef FEAT_RIGHTLEFT
|
|
1775 (char_u *)VAR_WIN, PV_RL,
|
|
1776 #else
|
|
1777 (char_u *)NULL, PV_NONE,
|
|
1778 #endif
|
|
1779 {(char_u *)FALSE, (char_u *)0L}},
|
|
1780 {"rightleftcmd", "rlc", P_STRING|P_ALLOCED|P_VI_DEF|P_RWIN,
|
|
1781 #ifdef FEAT_RIGHTLEFT
|
|
1782 (char_u *)VAR_WIN, PV_RLC,
|
|
1783 {(char_u *)"search", (char_u *)NULL}
|
|
1784 #else
|
|
1785 (char_u *)NULL, PV_NONE,
|
|
1786 {(char_u *)NULL, (char_u *)0L}
|
|
1787 #endif
|
|
1788 },
|
|
1789 {"ruler", "ru", P_BOOL|P_VI_DEF|P_VIM|P_RSTAT,
|
|
1790 #ifdef FEAT_CMDL_INFO
|
|
1791 (char_u *)&p_ru, PV_NONE,
|
|
1792 #else
|
|
1793 (char_u *)NULL, PV_NONE,
|
|
1794 #endif
|
|
1795 {(char_u *)FALSE, (char_u *)0L}},
|
|
1796 {"rulerformat", "ruf", P_STRING|P_VI_DEF|P_ALLOCED|P_RSTAT,
|
|
1797 #ifdef FEAT_STL_OPT
|
|
1798 (char_u *)&p_ruf, PV_NONE,
|
|
1799 #else
|
|
1800 (char_u *)NULL, PV_NONE,
|
|
1801 #endif
|
|
1802 {(char_u *)"", (char_u *)0L}},
|
|
1803 {"runtimepath", "rtp", P_STRING|P_VI_DEF|P_EXPAND|P_COMMA|P_NODUP|P_SECURE,
|
|
1804 (char_u *)&p_rtp, PV_NONE,
|
|
1805 {(char_u *)DFLT_RUNTIMEPATH, (char_u *)0L}},
|
|
1806 {"scroll", "scr", P_NUM|P_NO_MKRC|P_VI_DEF,
|
|
1807 (char_u *)VAR_WIN, PV_SCROLL,
|
|
1808 {(char_u *)12L, (char_u *)0L}},
|
|
1809 {"scrollbind", "scb", P_BOOL|P_VI_DEF,
|
|
1810 #ifdef FEAT_SCROLLBIND
|
|
1811 (char_u *)VAR_WIN, PV_SCBIND,
|
|
1812 #else
|
|
1813 (char_u *)NULL, PV_NONE,
|
|
1814 #endif
|
|
1815 {(char_u *)FALSE, (char_u *)0L}},
|
|
1816 {"scrolljump", "sj", P_NUM|P_VI_DEF|P_VIM,
|
|
1817 (char_u *)&p_sj, PV_NONE,
|
|
1818 {(char_u *)1L, (char_u *)0L}},
|
|
1819 {"scrolloff", "so", P_NUM|P_VI_DEF|P_VIM|P_RALL,
|
|
1820 (char_u *)&p_so, PV_NONE,
|
|
1821 {(char_u *)0L, (char_u *)0L}},
|
|
1822 {"scrollopt", "sbo", P_STRING|P_VI_DEF|P_COMMA|P_NODUP,
|
|
1823 #ifdef FEAT_SCROLLBIND
|
|
1824 (char_u *)&p_sbo, PV_NONE,
|
|
1825 {(char_u *)"ver,jump", (char_u *)0L}
|
|
1826 #else
|
|
1827 (char_u *)NULL, PV_NONE,
|
|
1828 {(char_u *)0L, (char_u *)0L}
|
|
1829 #endif
|
|
1830 },
|
|
1831 {"sections", "sect", P_STRING|P_VI_DEF,
|
|
1832 (char_u *)&p_sections, PV_NONE,
|
|
1833 {(char_u *)"SHNHH HUnhsh", (char_u *)0L}},
|
|
1834 {"secure", NULL, P_BOOL|P_VI_DEF|P_SECURE,
|
|
1835 (char_u *)&p_secure, PV_NONE,
|
|
1836 {(char_u *)FALSE, (char_u *)0L}},
|
|
1837 {"selection", "sel", P_STRING|P_VI_DEF,
|
|
1838 #ifdef FEAT_VISUAL
|
|
1839 (char_u *)&p_sel, PV_NONE,
|
|
1840 #else
|
|
1841 (char_u *)NULL, PV_NONE,
|
|
1842 #endif
|
|
1843 {(char_u *)"inclusive", (char_u *)0L}},
|
|
1844 {"selectmode", "slm", P_STRING|P_VI_DEF|P_COMMA|P_NODUP,
|
|
1845 #ifdef FEAT_VISUAL
|
|
1846 (char_u *)&p_slm, PV_NONE,
|
|
1847 #else
|
|
1848 (char_u *)NULL, PV_NONE,
|
|
1849 #endif
|
|
1850 {(char_u *)"", (char_u *)0L}},
|
|
1851 {"sessionoptions", "ssop", P_STRING|P_VI_DEF|P_COMMA|P_NODUP,
|
|
1852 #ifdef FEAT_SESSION
|
|
1853 (char_u *)&p_ssop, PV_NONE,
|
|
1854 {(char_u *)"blank,buffers,curdir,folds,help,options,winsize",
|
|
1855 (char_u *)0L}
|
|
1856 #else
|
|
1857 (char_u *)NULL, PV_NONE,
|
|
1858 {(char_u *)0L, (char_u *)0L}
|
|
1859 #endif
|
|
1860 },
|
|
1861 {"shell", "sh", P_STRING|P_EXPAND|P_VI_DEF|P_SECURE,
|
|
1862 (char_u *)&p_sh, PV_NONE,
|
|
1863 {
|
|
1864 #ifdef VMS
|
|
1865 (char_u *)"-",
|
|
1866 #else
|
|
1867 # if defined(MSDOS)
|
|
1868 (char_u *)"command",
|
|
1869 # else
|
|
1870 # if defined(WIN16)
|
|
1871 (char_u *)"command.com",
|
|
1872 # else
|
|
1873 # if defined(WIN3264)
|
|
1874 (char_u *)"", /* set in set_init_1() */
|
|
1875 # else
|
|
1876 # if defined(OS2)
|
|
1877 (char_u *)"cmd.exe",
|
|
1878 # else
|
|
1879 # if defined(ARCHIE)
|
|
1880 (char_u *)"gos",
|
|
1881 # else
|
|
1882 (char_u *)"sh",
|
|
1883 # endif
|
|
1884 # endif
|
|
1885 # endif
|
|
1886 # endif
|
|
1887 # endif
|
|
1888 #endif /* VMS */
|
|
1889 (char_u *)0L}},
|
|
1890 {"shellcmdflag","shcf", P_STRING|P_VI_DEF|P_SECURE,
|
|
1891 (char_u *)&p_shcf, PV_NONE,
|
|
1892 {
|
|
1893 #if defined(MSDOS) || defined(MSWIN)
|
|
1894 (char_u *)"/c",
|
|
1895 #else
|
|
1896 # if defined(OS2)
|
|
1897 (char_u *)"/c",
|
|
1898 # else
|
|
1899 (char_u *)"-c",
|
|
1900 # endif
|
|
1901 #endif
|
|
1902 (char_u *)0L}},
|
|
1903 {"shellpipe", "sp", P_STRING|P_VI_DEF|P_SECURE,
|
|
1904 #ifdef FEAT_QUICKFIX
|
|
1905 (char_u *)&p_sp, PV_NONE,
|
|
1906 {
|
|
1907 #if defined(UNIX) || defined(OS2)
|
|
1908 # ifdef ARCHIE
|
|
1909 (char_u *)"2>",
|
|
1910 # else
|
|
1911 (char_u *)"| tee",
|
|
1912 # endif
|
|
1913 #else
|
|
1914 (char_u *)">",
|
|
1915 #endif
|
|
1916 (char_u *)0L}
|
|
1917 #else
|
|
1918 (char_u *)NULL, PV_NONE,
|
|
1919 {(char_u *)0L, (char_u *)0L}
|
|
1920 #endif
|
|
1921 },
|
|
1922 {"shellquote", "shq", P_STRING|P_VI_DEF|P_SECURE,
|
|
1923 (char_u *)&p_shq, PV_NONE,
|
|
1924 {(char_u *)"", (char_u *)0L}},
|
|
1925 {"shellredir", "srr", P_STRING|P_VI_DEF|P_SECURE,
|
|
1926 (char_u *)&p_srr, PV_NONE,
|
|
1927 {(char_u *)">", (char_u *)0L}},
|
|
1928 {"shellslash", "ssl", P_BOOL|P_VI_DEF,
|
|
1929 #ifdef BACKSLASH_IN_FILENAME
|
|
1930 (char_u *)&p_ssl, PV_NONE,
|
|
1931 #else
|
|
1932 (char_u *)NULL, PV_NONE,
|
|
1933 #endif
|
|
1934 {(char_u *)FALSE, (char_u *)0L}},
|
168
|
1935 {"shelltemp", "stmp", P_BOOL,
|
|
1936 (char_u *)&p_stmp, PV_NONE,
|
|
1937 {(char_u *)FALSE, (char_u *)TRUE}},
|
7
|
1938 {"shelltype", "st", P_NUM|P_VI_DEF,
|
|
1939 #ifdef AMIGA
|
|
1940 (char_u *)&p_st, PV_NONE,
|
|
1941 #else
|
|
1942 (char_u *)NULL, PV_NONE,
|
|
1943 #endif
|
|
1944 {(char_u *)0L, (char_u *)0L}},
|
|
1945 {"shellxquote", "sxq", P_STRING|P_VI_DEF|P_SECURE,
|
|
1946 (char_u *)&p_sxq, PV_NONE,
|
|
1947 {
|
|
1948 #if defined(UNIX) && defined(USE_SYSTEM) && !defined(__EMX__)
|
|
1949 (char_u *)"\"",
|
|
1950 #else
|
|
1951 (char_u *)"",
|
|
1952 #endif
|
|
1953 (char_u *)0L}},
|
|
1954 {"shiftround", "sr", P_BOOL|P_VI_DEF|P_VIM,
|
|
1955 (char_u *)&p_sr, PV_NONE,
|
|
1956 {(char_u *)FALSE, (char_u *)0L}},
|
|
1957 {"shiftwidth", "sw", P_NUM|P_VI_DEF,
|
|
1958 (char_u *)&p_sw, PV_SW,
|
|
1959 {(char_u *)8L, (char_u *)0L}},
|
|
1960 {"shortmess", "shm", P_STRING|P_VIM|P_FLAGLIST,
|
|
1961 (char_u *)&p_shm, PV_NONE,
|
|
1962 {(char_u *)"", (char_u *)"filnxtToO"}},
|
|
1963 {"shortname", "sn", P_BOOL|P_VI_DEF,
|
|
1964 #ifdef SHORT_FNAME
|
|
1965 (char_u *)NULL, PV_NONE,
|
|
1966 #else
|
|
1967 (char_u *)&p_sn, PV_SN,
|
|
1968 #endif
|
|
1969 {(char_u *)FALSE, (char_u *)0L}},
|
|
1970 {"showbreak", "sbr", P_STRING|P_VI_DEF|P_RALL,
|
|
1971 #ifdef FEAT_LINEBREAK
|
|
1972 (char_u *)&p_sbr, PV_NONE,
|
|
1973 #else
|
|
1974 (char_u *)NULL, PV_NONE,
|
|
1975 #endif
|
|
1976 {(char_u *)"", (char_u *)0L}},
|
|
1977 {"showcmd", "sc", P_BOOL|P_VIM,
|
|
1978 #ifdef FEAT_CMDL_INFO
|
|
1979 (char_u *)&p_sc, PV_NONE,
|
|
1980 #else
|
|
1981 (char_u *)NULL, PV_NONE,
|
|
1982 #endif
|
|
1983 {(char_u *)FALSE,
|
|
1984 #ifdef UNIX
|
|
1985 (char_u *)FALSE
|
|
1986 #else
|
|
1987 (char_u *)TRUE
|
|
1988 #endif
|
|
1989 }},
|
|
1990 {"showfulltag", "sft", P_BOOL|P_VI_DEF,
|
|
1991 (char_u *)&p_sft, PV_NONE,
|
|
1992 {(char_u *)FALSE, (char_u *)0L}},
|
|
1993 {"showmatch", "sm", P_BOOL|P_VI_DEF,
|
|
1994 (char_u *)&p_sm, PV_NONE,
|
|
1995 {(char_u *)FALSE, (char_u *)0L}},
|
|
1996 {"showmode", "smd", P_BOOL|P_VIM,
|
|
1997 (char_u *)&p_smd, PV_NONE,
|
|
1998 {(char_u *)FALSE, (char_u *)TRUE}},
|
|
1999 {"sidescroll", "ss", P_NUM|P_VI_DEF,
|
|
2000 (char_u *)&p_ss, PV_NONE,
|
|
2001 {(char_u *)0L, (char_u *)0L}},
|
|
2002 {"sidescrolloff", "siso", P_NUM|P_VI_DEF|P_VIM|P_RBUF,
|
|
2003 (char_u *)&p_siso, PV_NONE,
|
|
2004 {(char_u *)0L, (char_u *)0L}},
|
|
2005 {"slowopen", "slow", P_BOOL|P_VI_DEF,
|
|
2006 (char_u *)NULL, PV_NONE,
|
|
2007 {(char_u *)FALSE, (char_u *)0L}},
|
|
2008 {"smartcase", "scs", P_BOOL|P_VI_DEF|P_VIM,
|
|
2009 (char_u *)&p_scs, PV_NONE,
|
|
2010 {(char_u *)FALSE, (char_u *)0L}},
|
|
2011 {"smartindent", "si", P_BOOL|P_VI_DEF|P_VIM,
|
|
2012 #ifdef FEAT_SMARTINDENT
|
|
2013 (char_u *)&p_si, PV_SI,
|
|
2014 #else
|
|
2015 (char_u *)NULL, PV_NONE,
|
|
2016 #endif
|
|
2017 {(char_u *)FALSE, (char_u *)0L}},
|
|
2018 {"smarttab", "sta", P_BOOL|P_VI_DEF|P_VIM,
|
|
2019 (char_u *)&p_sta, PV_NONE,
|
|
2020 {(char_u *)FALSE, (char_u *)0L}},
|
|
2021 {"softtabstop", "sts", P_NUM|P_VI_DEF|P_VIM,
|
|
2022 (char_u *)&p_sts, PV_STS,
|
|
2023 {(char_u *)0L, (char_u *)0L}},
|
|
2024 {"sourceany", NULL, P_BOOL|P_VI_DEF,
|
|
2025 (char_u *)NULL, PV_NONE,
|
|
2026 {(char_u *)FALSE, (char_u *)0L}},
|
221
|
2027 {"spell", NULL, P_BOOL|P_VI_DEF|P_RWIN,
|
|
2028 #ifdef FEAT_SYN_HL
|
|
2029 (char_u *)VAR_WIN, PV_SPELL,
|
|
2030 #else
|
|
2031 (char_u *)NULL, PV_NONE,
|
|
2032 #endif
|
|
2033 {(char_u *)FALSE, (char_u *)0L}},
|
314
|
2034 {"spellfile", "spf", P_STRING|P_EXPAND|P_ALLOCED|P_VI_DEF|P_SECURE,
|
|
2035 #ifdef FEAT_SYN_HL
|
|
2036 (char_u *)&p_spf, PV_SPF,
|
|
2037 {(char_u *)"", (char_u *)0L}
|
|
2038 #else
|
|
2039 (char_u *)NULL, PV_NONE,
|
|
2040 {(char_u *)0L, (char_u *)0L}
|
|
2041 #endif
|
|
2042 },
|
227
|
2043 {"spelllang", "spl", P_STRING|P_ALLOCED|P_VI_DEF|P_COMMA|P_RBUF,
|
221
|
2044 #ifdef FEAT_SYN_HL
|
|
2045 (char_u *)&p_spl, PV_SPL,
|
314
|
2046 {(char_u *)"en", (char_u *)0L}
|
221
|
2047 #else
|
|
2048 (char_u *)NULL, PV_NONE,
|
|
2049 {(char_u *)0L, (char_u *)0L}
|
|
2050 #endif
|
|
2051 },
|
7
|
2052 {"splitbelow", "sb", P_BOOL|P_VI_DEF,
|
|
2053 #ifdef FEAT_WINDOWS
|
|
2054 (char_u *)&p_sb, PV_NONE,
|
|
2055 #else
|
|
2056 (char_u *)NULL, PV_NONE,
|
|
2057 #endif
|
|
2058 {(char_u *)FALSE, (char_u *)0L}},
|
|
2059 {"splitright", "spr", P_BOOL|P_VI_DEF,
|
|
2060 #ifdef FEAT_VERTSPLIT
|
|
2061 (char_u *)&p_spr, PV_NONE,
|
|
2062 #else
|
|
2063 (char_u *)NULL, PV_NONE,
|
|
2064 #endif
|
|
2065 {(char_u *)FALSE, (char_u *)0L}},
|
|
2066 {"startofline", "sol", P_BOOL|P_VI_DEF|P_VIM,
|
|
2067 (char_u *)&p_sol, PV_NONE,
|
|
2068 {(char_u *)TRUE, (char_u *)0L}},
|
|
2069 {"statusline" ,"stl", P_STRING|P_VI_DEF|P_ALLOCED|P_RSTAT,
|
|
2070 #ifdef FEAT_STL_OPT
|
40
|
2071 (char_u *)&p_stl, OPT_BOTH(PV_STL),
|
7
|
2072 #else
|
|
2073 (char_u *)NULL, PV_NONE,
|
|
2074 #endif
|
|
2075 {(char_u *)"", (char_u *)0L}},
|
|
2076 {"suffixes", "su", P_STRING|P_VI_DEF|P_COMMA|P_NODUP,
|
|
2077 (char_u *)&p_su, PV_NONE,
|
|
2078 {(char_u *)".bak,~,.o,.h,.info,.swp,.obj",
|
|
2079 (char_u *)0L}},
|
|
2080 {"suffixesadd", "sua", P_STRING|P_VI_DEF|P_ALLOCED|P_COMMA|P_NODUP,
|
|
2081 #if defined(FEAT_SEARCHPATH)
|
|
2082 (char_u *)&p_sua, PV_SUA,
|
|
2083 {(char_u *)"", (char_u *)0L}
|
|
2084 #else
|
|
2085 (char_u *)NULL, PV_NONE,
|
|
2086 {(char_u *)0L, (char_u *)0L}
|
|
2087 #endif
|
|
2088 },
|
|
2089 {"swapfile", "swf", P_BOOL|P_VI_DEF|P_RSTAT,
|
|
2090 (char_u *)&p_swf, PV_SWF,
|
|
2091 {(char_u *)TRUE, (char_u *)0L}},
|
|
2092 {"swapsync", "sws", P_STRING|P_VI_DEF,
|
|
2093 (char_u *)&p_sws, PV_NONE,
|
|
2094 {(char_u *)"fsync", (char_u *)0L}},
|
|
2095 {"switchbuf", "swb", P_STRING|P_VI_DEF|P_COMMA|P_NODUP,
|
|
2096 (char_u *)&p_swb, PV_NONE,
|
|
2097 {(char_u *)"", (char_u *)0L}},
|
36
|
2098 {"syntax", "syn", P_STRING|P_ALLOCED|P_VI_DEF|P_NOGLOB|P_NFNAME,
|
7
|
2099 #ifdef FEAT_SYN_HL
|
|
2100 (char_u *)&p_syn, PV_SYN,
|
|
2101 {(char_u *)"", (char_u *)0L}
|
|
2102 #else
|
|
2103 (char_u *)NULL, PV_NONE,
|
|
2104 {(char_u *)0L, (char_u *)0L}
|
|
2105 #endif
|
|
2106 },
|
|
2107 {"tabstop", "ts", P_NUM|P_VI_DEF|P_RBUF,
|
|
2108 (char_u *)&p_ts, PV_TS,
|
|
2109 {(char_u *)8L, (char_u *)0L}},
|
|
2110 {"tagbsearch", "tbs", P_BOOL|P_VI_DEF,
|
|
2111 (char_u *)&p_tbs, PV_NONE,
|
|
2112 #ifdef VMS /* binary searching doesn't appear to work on VMS */
|
|
2113 {(char_u *)0L, (char_u *)0L}
|
|
2114 #else
|
|
2115 {(char_u *)TRUE, (char_u *)0L}
|
|
2116 #endif
|
|
2117 },
|
|
2118 {"taglength", "tl", P_NUM|P_VI_DEF,
|
|
2119 (char_u *)&p_tl, PV_NONE,
|
|
2120 {(char_u *)0L, (char_u *)0L}},
|
|
2121 {"tagrelative", "tr", P_BOOL|P_VIM,
|
|
2122 (char_u *)&p_tr, PV_NONE,
|
|
2123 {(char_u *)FALSE, (char_u *)TRUE}},
|
|
2124 {"tags", "tag", P_STRING|P_EXPAND|P_VI_DEF|P_COMMA|P_NODUP,
|
|
2125 (char_u *)&p_tags, OPT_BOTH(PV_TAGS),
|
|
2126 {
|
|
2127 #if defined(FEAT_EMACS_TAGS) && !defined(CASE_INSENSITIVE_FILENAME)
|
|
2128 (char_u *)"./tags,./TAGS,tags,TAGS",
|
|
2129 #else
|
|
2130 (char_u *)"./tags,tags",
|
|
2131 #endif
|
|
2132 (char_u *)0L}},
|
|
2133 {"tagstack", "tgst", P_BOOL|P_VI_DEF,
|
|
2134 (char_u *)&p_tgst, PV_NONE,
|
|
2135 {(char_u *)TRUE, (char_u *)0L}},
|
|
2136 {"term", NULL, P_STRING|P_EXPAND|P_NODEFAULT|P_NO_MKRC|P_VI_DEF|P_RALL,
|
|
2137 (char_u *)&T_NAME, PV_NONE,
|
|
2138 {(char_u *)"", (char_u *)0L}},
|
|
2139 {"termbidi", "tbidi", P_BOOL|P_VI_DEF,
|
|
2140 #ifdef FEAT_ARABIC
|
|
2141 (char_u *)&p_tbidi, PV_NONE,
|
|
2142 #else
|
|
2143 (char_u *)NULL, PV_NONE,
|
|
2144 #endif
|
|
2145 {(char_u *)FALSE, (char_u *)0L}},
|
|
2146 {"termencoding", "tenc", P_STRING|P_VI_DEF|P_RCLR,
|
|
2147 #ifdef FEAT_MBYTE
|
|
2148 (char_u *)&p_tenc, PV_NONE,
|
|
2149 {(char_u *)"", (char_u *)0L}
|
|
2150 #else
|
|
2151 (char_u *)NULL, PV_NONE,
|
|
2152 {(char_u *)0L, (char_u *)0L}
|
|
2153 #endif
|
|
2154 },
|
|
2155 {"terse", NULL, P_BOOL|P_VI_DEF,
|
|
2156 (char_u *)&p_terse, PV_NONE,
|
|
2157 {(char_u *)FALSE, (char_u *)0L}},
|
|
2158 {"textauto", "ta", P_BOOL|P_VIM,
|
|
2159 (char_u *)&p_ta, PV_NONE,
|
|
2160 {(char_u *)DFLT_TEXTAUTO, (char_u *)TRUE}},
|
|
2161 {"textmode", "tx", P_BOOL|P_VI_DEF|P_NO_MKRC,
|
|
2162 (char_u *)&p_tx, PV_TX,
|
|
2163 {
|
|
2164 #ifdef USE_CRNL
|
|
2165 (char_u *)TRUE,
|
|
2166 #else
|
|
2167 (char_u *)FALSE,
|
|
2168 #endif
|
|
2169 (char_u *)0L}},
|
|
2170 {"textwidth", "tw", P_NUM|P_VI_DEF|P_VIM,
|
|
2171 (char_u *)&p_tw, PV_TW,
|
|
2172 {(char_u *)0L, (char_u *)0L}},
|
|
2173 {"thesaurus", "tsr", P_STRING|P_EXPAND|P_VI_DEF|P_COMMA|P_NODUP,
|
|
2174 #ifdef FEAT_INS_EXPAND
|
|
2175 (char_u *)&p_tsr, OPT_BOTH(PV_TSR),
|
|
2176 #else
|
|
2177 (char_u *)NULL, PV_NONE,
|
|
2178 #endif
|
|
2179 {(char_u *)"", (char_u *)0L}},
|
|
2180 {"tildeop", "top", P_BOOL|P_VI_DEF|P_VIM,
|
|
2181 (char_u *)&p_to, PV_NONE,
|
|
2182 {(char_u *)FALSE, (char_u *)0L}},
|
|
2183 {"timeout", "to", P_BOOL|P_VI_DEF,
|
|
2184 (char_u *)&p_timeout, PV_NONE,
|
|
2185 {(char_u *)TRUE, (char_u *)0L}},
|
|
2186 {"timeoutlen", "tm", P_NUM|P_VI_DEF,
|
|
2187 (char_u *)&p_tm, PV_NONE,
|
|
2188 {(char_u *)1000L, (char_u *)0L}},
|
|
2189 {"title", NULL, P_BOOL|P_VI_DEF,
|
|
2190 #ifdef FEAT_TITLE
|
|
2191 (char_u *)&p_title, PV_NONE,
|
|
2192 #else
|
|
2193 (char_u *)NULL, PV_NONE,
|
|
2194 #endif
|
|
2195 {(char_u *)FALSE, (char_u *)0L}},
|
|
2196 {"titlelen", NULL, P_NUM|P_VI_DEF,
|
|
2197 #ifdef FEAT_TITLE
|
|
2198 (char_u *)&p_titlelen, PV_NONE,
|
|
2199 #else
|
|
2200 (char_u *)NULL, PV_NONE,
|
|
2201 #endif
|
|
2202 {(char_u *)85L, (char_u *)0L}},
|
36
|
2203 {"titleold", NULL, P_STRING|P_VI_DEF|P_GETTEXT|P_SECURE,
|
7
|
2204 #ifdef FEAT_TITLE
|
|
2205 (char_u *)&p_titleold, PV_NONE,
|
|
2206 {(char_u *)N_("Thanks for flying Vim"),
|
|
2207 (char_u *)0L}
|
|
2208 #else
|
|
2209 (char_u *)NULL, PV_NONE,
|
|
2210 {(char_u *)0L, (char_u *)0L}
|
|
2211 #endif
|
|
2212 },
|
|
2213 {"titlestring", NULL, P_STRING|P_VI_DEF,
|
|
2214 #ifdef FEAT_TITLE
|
|
2215 (char_u *)&p_titlestring, PV_NONE,
|
|
2216 #else
|
|
2217 (char_u *)NULL, PV_NONE,
|
|
2218 #endif
|
|
2219 {(char_u *)"", (char_u *)0L}},
|
|
2220 #if defined(FEAT_TOOLBAR) && !defined(FEAT_GUI_W32)
|
|
2221 {"toolbar", "tb", P_STRING|P_COMMA|P_VI_DEF|P_NODUP,
|
|
2222 (char_u *)&p_toolbar, PV_NONE,
|
|
2223 {(char_u *)"icons,tooltips", (char_u *)0L}},
|
|
2224 #endif
|
|
2225 #if defined(FEAT_TOOLBAR) && defined(FEAT_GUI_GTK) && defined(HAVE_GTK2)
|
|
2226 {"toolbariconsize", "tbis", P_STRING|P_VI_DEF,
|
|
2227 (char_u *)&p_tbis, PV_NONE,
|
|
2228 {(char_u *)"small", (char_u *)0L}},
|
|
2229 #endif
|
|
2230 {"ttimeout", NULL, P_BOOL|P_VI_DEF|P_VIM,
|
|
2231 (char_u *)&p_ttimeout, PV_NONE,
|
|
2232 {(char_u *)FALSE, (char_u *)0L}},
|
|
2233 {"ttimeoutlen", "ttm", P_NUM|P_VI_DEF,
|
|
2234 (char_u *)&p_ttm, PV_NONE,
|
|
2235 {(char_u *)-1L, (char_u *)0L}},
|
|
2236 {"ttybuiltin", "tbi", P_BOOL|P_VI_DEF,
|
|
2237 (char_u *)&p_tbi, PV_NONE,
|
|
2238 {(char_u *)TRUE, (char_u *)0L}},
|
|
2239 {"ttyfast", "tf", P_BOOL|P_NO_MKRC|P_VI_DEF,
|
|
2240 (char_u *)&p_tf, PV_NONE,
|
|
2241 {(char_u *)FALSE, (char_u *)0L}},
|
|
2242 {"ttymouse", "ttym", P_STRING|P_NODEFAULT|P_NO_MKRC|P_VI_DEF,
|
|
2243 #if defined(FEAT_MOUSE) && (defined(UNIX) || defined(VMS))
|
|
2244 (char_u *)&p_ttym, PV_NONE,
|
|
2245 #else
|
|
2246 (char_u *)NULL, PV_NONE,
|
|
2247 #endif
|
|
2248 {(char_u *)"", (char_u *)0L}},
|
|
2249 {"ttyscroll", "tsl", P_NUM|P_VI_DEF,
|
|
2250 (char_u *)&p_ttyscroll, PV_NONE,
|
|
2251 {(char_u *)999L, (char_u *)0L}},
|
|
2252 {"ttytype", "tty", P_STRING|P_EXPAND|P_NODEFAULT|P_NO_MKRC|P_VI_DEF|P_RALL,
|
|
2253 (char_u *)&T_NAME, PV_NONE,
|
|
2254 {(char_u *)"", (char_u *)0L}},
|
|
2255 {"undolevels", "ul", P_NUM|P_VI_DEF,
|
|
2256 (char_u *)&p_ul, PV_NONE,
|
|
2257 {
|
|
2258 #if defined(UNIX) || defined(WIN3264) || defined(OS2) || defined(VMS)
|
|
2259 (char_u *)1000L,
|
|
2260 #else
|
|
2261 (char_u *)100L,
|
|
2262 #endif
|
|
2263 (char_u *)0L}},
|
|
2264 {"updatecount", "uc", P_NUM|P_VI_DEF,
|
|
2265 (char_u *)&p_uc, PV_NONE,
|
|
2266 {(char_u *)200L, (char_u *)0L}},
|
|
2267 {"updatetime", "ut", P_NUM|P_VI_DEF,
|
|
2268 (char_u *)&p_ut, PV_NONE,
|
|
2269 {(char_u *)4000L, (char_u *)0L}},
|
|
2270 {"verbose", "vbs", P_NUM|P_VI_DEF,
|
|
2271 (char_u *)&p_verbose, PV_NONE,
|
|
2272 {(char_u *)0L, (char_u *)0L}},
|
294
|
2273 {"verbosefile", "vfile", P_STRING|P_EXPAND|P_VI_DEF|P_SECURE,
|
|
2274 (char_u *)&p_vfile, PV_NONE,
|
|
2275 {(char_u *)"", (char_u *)0L}},
|
7
|
2276 {"viewdir", "vdir", P_STRING|P_EXPAND|P_VI_DEF|P_SECURE,
|
|
2277 #ifdef FEAT_SESSION
|
|
2278 (char_u *)&p_vdir, PV_NONE,
|
|
2279 {(char_u *)DFLT_VDIR, (char_u *)0L}
|
|
2280 #else
|
|
2281 (char_u *)NULL, PV_NONE,
|
|
2282 {(char_u *)0L, (char_u *)0L}
|
|
2283 #endif
|
|
2284 },
|
|
2285 {"viewoptions", "vop", P_STRING|P_VI_DEF|P_COMMA|P_NODUP,
|
|
2286 #ifdef FEAT_SESSION
|
|
2287 (char_u *)&p_vop, PV_NONE,
|
|
2288 {(char_u *)"folds,options,cursor", (char_u *)0L}
|
|
2289 #else
|
|
2290 (char_u *)NULL, PV_NONE,
|
|
2291 {(char_u *)0L, (char_u *)0L}
|
|
2292 #endif
|
|
2293 },
|
|
2294 {"viminfo", "vi", P_STRING|P_COMMA|P_NODUP|P_SECURE,
|
|
2295 #ifdef FEAT_VIMINFO
|
|
2296 (char_u *)&p_viminfo, PV_NONE,
|
|
2297 #if defined(MSDOS) || defined(MSWIN) || defined(OS2)
|
|
2298 {(char_u *)"", (char_u *)"'20,<50,s10,h,rA:,rB:"}
|
|
2299 #else
|
|
2300 # ifdef AMIGA
|
|
2301 {(char_u *)"",
|
|
2302 (char_u *)"'20,<50,s10,h,rdf0:,rdf1:,rdf2:"}
|
|
2303 # else
|
|
2304 {(char_u *)"", (char_u *)"'20,<50,s10,h"}
|
|
2305 # endif
|
|
2306 #endif
|
|
2307 #else
|
|
2308 (char_u *)NULL, PV_NONE,
|
|
2309 {(char_u *)0L, (char_u *)0L}
|
|
2310 #endif
|
|
2311 },
|
|
2312 {"virtualedit", "ve", P_STRING|P_COMMA|P_NODUP|P_VI_DEF|P_VIM,
|
|
2313 #ifdef FEAT_VIRTUALEDIT
|
|
2314 (char_u *)&p_ve, PV_NONE,
|
|
2315 {(char_u *)"", (char_u *)""}
|
|
2316 #else
|
|
2317 (char_u *)NULL, PV_NONE,
|
|
2318 {(char_u *)0L, (char_u *)0L}
|
|
2319 #endif
|
|
2320 },
|
|
2321 {"visualbell", "vb", P_BOOL|P_VI_DEF,
|
|
2322 (char_u *)&p_vb, PV_NONE,
|
|
2323 {(char_u *)FALSE, (char_u *)0L}},
|
|
2324 {"w300", NULL, P_NUM|P_VI_DEF,
|
|
2325 (char_u *)NULL, PV_NONE,
|
|
2326 {(char_u *)0L, (char_u *)0L}},
|
|
2327 {"w1200", NULL, P_NUM|P_VI_DEF,
|
|
2328 (char_u *)NULL, PV_NONE,
|
|
2329 {(char_u *)0L, (char_u *)0L}},
|
|
2330 {"w9600", NULL, P_NUM|P_VI_DEF,
|
|
2331 (char_u *)NULL, PV_NONE,
|
|
2332 {(char_u *)0L, (char_u *)0L}},
|
|
2333 {"warn", NULL, P_BOOL|P_VI_DEF,
|
|
2334 (char_u *)&p_warn, PV_NONE,
|
|
2335 {(char_u *)TRUE, (char_u *)0L}},
|
|
2336 {"weirdinvert", "wiv", P_BOOL|P_VI_DEF|P_RCLR,
|
|
2337 (char_u *)&p_wiv, PV_NONE,
|
|
2338 {(char_u *)FALSE, (char_u *)0L}},
|
|
2339 {"whichwrap", "ww", P_STRING|P_VIM|P_COMMA|P_FLAGLIST,
|
|
2340 (char_u *)&p_ww, PV_NONE,
|
|
2341 {(char_u *)"", (char_u *)"b,s"}},
|
|
2342 {"wildchar", "wc", P_NUM|P_VIM,
|
|
2343 (char_u *)&p_wc, PV_NONE,
|
|
2344 {(char_u *)(long)Ctrl_E, (char_u *)(long)TAB}},
|
|
2345 {"wildcharm", "wcm", P_NUM|P_VI_DEF,
|
|
2346 (char_u *)&p_wcm, PV_NONE,
|
|
2347 {(char_u *)0L, (char_u *)0L}},
|
|
2348 {"wildignore", "wig", P_STRING|P_VI_DEF|P_COMMA|P_NODUP,
|
|
2349 #ifdef FEAT_WILDIGN
|
|
2350 (char_u *)&p_wig, PV_NONE,
|
|
2351 #else
|
|
2352 (char_u *)NULL, PV_NONE,
|
|
2353 #endif
|
|
2354 {(char_u *)"", (char_u *)0L}},
|
|
2355 {"wildmenu", "wmnu", P_BOOL|P_VI_DEF,
|
|
2356 #ifdef FEAT_WILDMENU
|
|
2357 (char_u *)&p_wmnu, PV_NONE,
|
|
2358 #else
|
|
2359 (char_u *)NULL, PV_NONE,
|
|
2360 #endif
|
|
2361 {(char_u *)FALSE, (char_u *)0L}},
|
|
2362 {"wildmode", "wim", P_STRING|P_VI_DEF|P_COMMA|P_NODUP,
|
|
2363 (char_u *)&p_wim, PV_NONE,
|
|
2364 {(char_u *)"full", (char_u *)0L}},
|
40
|
2365 {"wildoptions", "wop", P_STRING|P_VI_DEF,
|
|
2366 #ifdef FEAT_CMDL_COMPL
|
|
2367 (char_u *)&p_wop, PV_NONE,
|
|
2368 {(char_u *)"", (char_u *)0L}
|
|
2369 #else
|
|
2370 (char_u *)NULL, PV_NONE,
|
|
2371 {(char_u *)NULL, (char_u *)0L}
|
|
2372 #endif
|
|
2373 },
|
7
|
2374 {"winaltkeys", "wak", P_STRING|P_VI_DEF,
|
|
2375 #ifdef FEAT_WAK
|
|
2376 (char_u *)&p_wak, PV_NONE,
|
|
2377 {(char_u *)"menu", (char_u *)0L}
|
|
2378 #else
|
|
2379 (char_u *)NULL, PV_NONE,
|
|
2380 {(char_u *)NULL, (char_u *)0L}
|
|
2381 #endif
|
|
2382 },
|
|
2383 {"window", "wi", P_NUM|P_VI_DEF,
|
164
|
2384 (char_u *)&p_window, PV_NONE,
|
7
|
2385 {(char_u *)0L, (char_u *)0L}},
|
|
2386 {"winheight", "wh", P_NUM|P_VI_DEF,
|
|
2387 #ifdef FEAT_WINDOWS
|
|
2388 (char_u *)&p_wh, PV_NONE,
|
|
2389 #else
|
|
2390 (char_u *)NULL, PV_NONE,
|
|
2391 #endif
|
|
2392 {(char_u *)1L, (char_u *)0L}},
|
|
2393 {"winfixheight", "wfh", P_BOOL|P_VI_DEF|P_RSTAT,
|
|
2394 #if defined(FEAT_WINDOWS)
|
|
2395 (char_u *)VAR_WIN, PV_WFH,
|
|
2396 #else
|
|
2397 (char_u *)NULL, PV_NONE,
|
|
2398 #endif
|
|
2399 {(char_u *)FALSE, (char_u *)0L}},
|
|
2400 {"winminheight", "wmh", P_NUM|P_VI_DEF,
|
|
2401 #ifdef FEAT_WINDOWS
|
|
2402 (char_u *)&p_wmh, PV_NONE,
|
|
2403 #else
|
|
2404 (char_u *)NULL, PV_NONE,
|
|
2405 #endif
|
|
2406 {(char_u *)1L, (char_u *)0L}},
|
|
2407 {"winminwidth", "wmw", P_NUM|P_VI_DEF,
|
|
2408 #ifdef FEAT_VERTSPLIT
|
|
2409 (char_u *)&p_wmw, PV_NONE,
|
|
2410 #else
|
|
2411 (char_u *)NULL, PV_NONE,
|
|
2412 #endif
|
|
2413 {(char_u *)1L, (char_u *)0L}},
|
|
2414 {"winwidth", "wiw", P_NUM|P_VI_DEF,
|
|
2415 #ifdef FEAT_VERTSPLIT
|
|
2416 (char_u *)&p_wiw, PV_NONE,
|
|
2417 #else
|
|
2418 (char_u *)NULL, PV_NONE,
|
|
2419 #endif
|
|
2420 {(char_u *)20L, (char_u *)0L}},
|
|
2421 {"wrap", NULL, P_BOOL|P_VI_DEF|P_RWIN,
|
|
2422 (char_u *)VAR_WIN, PV_WRAP,
|
|
2423 {(char_u *)TRUE, (char_u *)0L}},
|
|
2424 {"wrapmargin", "wm", P_NUM|P_VI_DEF,
|
|
2425 (char_u *)&p_wm, PV_WM,
|
|
2426 {(char_u *)0L, (char_u *)0L}},
|
|
2427 {"wrapscan", "ws", P_BOOL|P_VI_DEF,
|
|
2428 (char_u *)&p_ws, PV_NONE,
|
|
2429 {(char_u *)TRUE, (char_u *)0L}},
|
|
2430 {"write", NULL, P_BOOL|P_VI_DEF,
|
|
2431 (char_u *)&p_write, PV_NONE,
|
|
2432 {(char_u *)TRUE, (char_u *)0L}},
|
|
2433 {"writeany", "wa", P_BOOL|P_VI_DEF,
|
|
2434 (char_u *)&p_wa, PV_NONE,
|
|
2435 {(char_u *)FALSE, (char_u *)0L}},
|
|
2436 {"writebackup", "wb", P_BOOL|P_VI_DEF|P_VIM,
|
|
2437 (char_u *)&p_wb, PV_NONE,
|
|
2438 {
|
|
2439 #ifdef FEAT_WRITEBACKUP
|
|
2440 (char_u *)TRUE,
|
|
2441 #else
|
|
2442 (char_u *)FALSE,
|
|
2443 #endif
|
|
2444 (char_u *)0L}},
|
|
2445 {"writedelay", "wd", P_NUM|P_VI_DEF,
|
|
2446 (char_u *)&p_wd, PV_NONE,
|
|
2447 {(char_u *)0L, (char_u *)0L}},
|
|
2448
|
|
2449 /* terminal output codes */
|
36
|
2450 #define p_term(sss, vvv) {sss, NULL, P_STRING|P_VI_DEF|P_RALL|P_SECURE, \
|
7
|
2451 (char_u *)&vvv, PV_NONE, \
|
|
2452 {(char_u *)"", (char_u *)0L}},
|
|
2453
|
|
2454 p_term("t_AB", T_CAB)
|
|
2455 p_term("t_AF", T_CAF)
|
|
2456 p_term("t_AL", T_CAL)
|
|
2457 p_term("t_al", T_AL)
|
|
2458 p_term("t_bc", T_BC)
|
|
2459 p_term("t_cd", T_CD)
|
|
2460 p_term("t_ce", T_CE)
|
|
2461 p_term("t_cl", T_CL)
|
|
2462 p_term("t_cm", T_CM)
|
|
2463 p_term("t_Co", T_CCO)
|
|
2464 p_term("t_CS", T_CCS)
|
|
2465 p_term("t_cs", T_CS)
|
|
2466 #ifdef FEAT_VERTSPLIT
|
|
2467 p_term("t_CV", T_CSV)
|
|
2468 #endif
|
|
2469 p_term("t_ut", T_UT)
|
|
2470 p_term("t_da", T_DA)
|
|
2471 p_term("t_db", T_DB)
|
|
2472 p_term("t_DL", T_CDL)
|
|
2473 p_term("t_dl", T_DL)
|
|
2474 p_term("t_fs", T_FS)
|
|
2475 p_term("t_IE", T_CIE)
|
|
2476 p_term("t_IS", T_CIS)
|
|
2477 p_term("t_ke", T_KE)
|
|
2478 p_term("t_ks", T_KS)
|
|
2479 p_term("t_le", T_LE)
|
|
2480 p_term("t_mb", T_MB)
|
|
2481 p_term("t_md", T_MD)
|
|
2482 p_term("t_me", T_ME)
|
|
2483 p_term("t_mr", T_MR)
|
|
2484 p_term("t_ms", T_MS)
|
|
2485 p_term("t_nd", T_ND)
|
|
2486 p_term("t_op", T_OP)
|
|
2487 p_term("t_RI", T_CRI)
|
|
2488 p_term("t_RV", T_CRV)
|
|
2489 p_term("t_Sb", T_CSB)
|
|
2490 p_term("t_Sf", T_CSF)
|
|
2491 p_term("t_se", T_SE)
|
|
2492 p_term("t_so", T_SO)
|
|
2493 p_term("t_sr", T_SR)
|
|
2494 p_term("t_ts", T_TS)
|
|
2495 p_term("t_te", T_TE)
|
|
2496 p_term("t_ti", T_TI)
|
|
2497 p_term("t_ue", T_UE)
|
|
2498 p_term("t_us", T_US)
|
|
2499 p_term("t_vb", T_VB)
|
|
2500 p_term("t_ve", T_VE)
|
|
2501 p_term("t_vi", T_VI)
|
|
2502 p_term("t_vs", T_VS)
|
|
2503 p_term("t_WP", T_CWP)
|
|
2504 p_term("t_WS", T_CWS)
|
36
|
2505 p_term("t_SI", T_CSI)
|
|
2506 p_term("t_EI", T_CEI)
|
7
|
2507 p_term("t_xs", T_XS)
|
|
2508 p_term("t_ZH", T_CZH)
|
|
2509 p_term("t_ZR", T_CZR)
|
|
2510
|
|
2511 /* terminal key codes are not in here */
|
|
2512
|
|
2513 {NULL, NULL, 0, NULL, PV_NONE, {NULL, NULL}} /* end marker */
|
|
2514 };
|
|
2515
|
|
2516 #define PARAM_COUNT (sizeof(options) / sizeof(struct vimoption))
|
|
2517
|
|
2518 #ifdef FEAT_MBYTE
|
|
2519 static char *(p_ambw_values[]) = {"single", "double", NULL};
|
|
2520 #endif
|
|
2521 static char *(p_bg_values[]) = {"light", "dark", NULL};
|
|
2522 static char *(p_nf_values[]) = {"octal", "hex", "alpha", NULL};
|
|
2523 static char *(p_ff_values[]) = {FF_UNIX, FF_DOS, FF_MAC, NULL};
|
40
|
2524 #ifdef FEAT_CMDL_COMPL
|
|
2525 static char *(p_wop_values[]) = {"tagfile", NULL};
|
|
2526 #endif
|
7
|
2527 #ifdef FEAT_WAK
|
|
2528 static char *(p_wak_values[]) = {"yes", "menu", "no", NULL};
|
|
2529 #endif
|
|
2530 static char *(p_mousem_values[]) = {"extend", "popup", "popup_setpos", "mac", NULL};
|
|
2531 #ifdef FEAT_VISUAL
|
|
2532 static char *(p_sel_values[]) = {"inclusive", "exclusive", "old", NULL};
|
|
2533 static char *(p_slm_values[]) = {"mouse", "key", "cmd", NULL};
|
|
2534 #endif
|
|
2535 #ifdef FEAT_VISUAL
|
|
2536 static char *(p_km_values[]) = {"startsel", "stopsel", NULL};
|
|
2537 #endif
|
|
2538 #ifdef FEAT_BROWSE
|
|
2539 static char *(p_bsdir_values[]) = {"current", "last", "buffer", NULL};
|
|
2540 #endif
|
|
2541 #ifdef FEAT_SCROLLBIND
|
|
2542 static char *(p_scbopt_values[]) = {"ver", "hor", "jump", NULL};
|
|
2543 #endif
|
|
2544 static char *(p_swb_values[]) = {"useopen", "split", NULL};
|
168
|
2545 static char *(p_debug_values[]) = {"msg", "beep", NULL};
|
7
|
2546 #ifdef FEAT_VERTSPLIT
|
|
2547 static char *(p_ead_values[]) = {"both", "ver", "hor", NULL};
|
|
2548 #endif
|
|
2549 #if defined(FEAT_QUICKFIX)
|
17
|
2550 # ifdef FEAT_AUTOCMD
|
|
2551 static char *(p_buftype_values[]) = {"nofile", "nowrite", "quickfix", "help", "acwrite", NULL};
|
|
2552 # else
|
7
|
2553 static char *(p_buftype_values[]) = {"nofile", "nowrite", "quickfix", "help", NULL};
|
17
|
2554 # endif
|
7
|
2555 static char *(p_bufhidden_values[]) = {"hide", "unload", "delete", "wipe", NULL};
|
|
2556 #endif
|
|
2557 static char *(p_bs_values[]) = {"indent", "eol", "start", NULL};
|
|
2558 #ifdef FEAT_FOLDING
|
|
2559 static char *(p_fdm_values[]) = {"manual", "expr", "marker", "indent", "syntax",
|
|
2560 #ifdef FEAT_DIFF
|
|
2561 "diff",
|
|
2562 #endif
|
|
2563 NULL};
|
|
2564 static char *(p_fcl_values[]) = {"all", NULL};
|
|
2565 #endif
|
|
2566
|
|
2567 static void set_option_default __ARGS((int, int opt_flags, int compatible));
|
|
2568 static void set_options_default __ARGS((int opt_flags));
|
|
2569 static char_u *illegal_char __ARGS((char_u *, int));
|
|
2570 static int string_to_key __ARGS((char_u *arg));
|
|
2571 #ifdef FEAT_CMDWIN
|
|
2572 static char_u *check_cedit __ARGS((void));
|
|
2573 #endif
|
|
2574 #ifdef FEAT_TITLE
|
|
2575 static void did_set_title __ARGS((int icon));
|
|
2576 #endif
|
|
2577 static char_u *option_expand __ARGS((int opt_idx, char_u *val));
|
|
2578 static void didset_options __ARGS((void));
|
|
2579 static void check_string_option __ARGS((char_u **pp));
|
|
2580 static void set_string_option_global __ARGS((int opt_idx, char_u **varp));
|
|
2581 static void set_string_option __ARGS((int opt_idx, char_u *value, int opt_flags));
|
|
2582 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));
|
|
2583 static char_u *set_chars_option __ARGS((char_u **varp));
|
|
2584 #ifdef FEAT_CLIPBOARD
|
|
2585 static char_u *check_clipboard_option __ARGS((void));
|
|
2586 #endif
|
|
2587 static char_u *set_bool_option __ARGS((int opt_idx, char_u *varp, int value, int opt_flags));
|
274
|
2588 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
|
2589 static void check_redraw __ARGS((long_u flags));
|
|
2590 static int findoption __ARGS((char_u *));
|
|
2591 static int find_key_option __ARGS((char_u *));
|
|
2592 static void showoptions __ARGS((int all, int opt_flags));
|
|
2593 static int optval_default __ARGS((struct vimoption *, char_u *varp));
|
|
2594 static void showoneopt __ARGS((struct vimoption *, int opt_flags));
|
|
2595 static int put_setstring __ARGS((FILE *fd, char *cmd, char *name, char_u **valuep, int expand));
|
|
2596 static int put_setnum __ARGS((FILE *fd, char *cmd, char *name, long *valuep));
|
|
2597 static int put_setbool __ARGS((FILE *fd, char *cmd, char *name, int value));
|
|
2598 static int istermoption __ARGS((struct vimoption *));
|
|
2599 static char_u *get_varp_scope __ARGS((struct vimoption *p, int opt_flags));
|
|
2600 static char_u *get_varp __ARGS((struct vimoption *));
|
|
2601 static void option_value2string __ARGS((struct vimoption *, int opt_flags));
|
|
2602 static int wc_use_keyname __ARGS((char_u *varp, long *wcp));
|
|
2603 #ifdef FEAT_LANGMAP
|
|
2604 static void langmap_init __ARGS((void));
|
|
2605 static void langmap_set __ARGS((void));
|
|
2606 #endif
|
|
2607 static void paste_option_changed __ARGS((void));
|
|
2608 static void compatible_set __ARGS((void));
|
|
2609 #ifdef FEAT_LINEBREAK
|
|
2610 static void fill_breakat_flags __ARGS((void));
|
|
2611 #endif
|
|
2612 static int opt_strings_flags __ARGS((char_u *val, char **values, unsigned *flagp, int list));
|
|
2613 static int check_opt_strings __ARGS((char_u *val, char **values, int));
|
|
2614 static int check_opt_wim __ARGS((void));
|
|
2615
|
|
2616 /*
|
|
2617 * Initialize the options, first part.
|
|
2618 *
|
|
2619 * Called only once from main(), just after creating the first buffer.
|
|
2620 */
|
|
2621 void
|
|
2622 set_init_1()
|
|
2623 {
|
|
2624 char_u *p;
|
|
2625 int opt_idx;
|
|
2626 long n;
|
|
2627
|
|
2628 #ifdef FEAT_LANGMAP
|
|
2629 langmap_init();
|
|
2630 #endif
|
|
2631
|
|
2632 /* Be Vi compatible by default */
|
|
2633 p_cp = TRUE;
|
|
2634
|
164
|
2635 /* Use POSIX compatibility when $VIM_POSIX is set. */
|
|
2636 if (mch_getenv((char_u *)"VIM_POSIX") != NULL)
|
168
|
2637 {
|
164
|
2638 set_string_default("cpo", (char_u *)CPO_ALL);
|
168
|
2639 set_string_default("shm", (char_u *)"A");
|
|
2640 }
|
164
|
2641
|
7
|
2642 /*
|
|
2643 * Find default value for 'shell' option.
|
161
|
2644 * Don't use it if it is empty.
|
7
|
2645 */
|
161
|
2646 if (((p = mch_getenv((char_u *)"SHELL")) != NULL && *p != NUL)
|
7
|
2647 #if defined(MSDOS) || defined(MSWIN) || defined(OS2)
|
|
2648 # ifdef __EMX__
|
161
|
2649 || ((p = mch_getenv((char_u *)"EMXSHELL")) != NULL && *p != NUL)
|
7
|
2650 # endif
|
161
|
2651 || ((p = mch_getenv((char_u *)"COMSPEC")) != NULL && *p != NUL)
|
7
|
2652 # ifdef WIN3264
|
161
|
2653 || ((p = default_shell()) != NULL && *p != NUL)
|
7
|
2654 # endif
|
|
2655 #endif
|
161
|
2656 )
|
7
|
2657 set_string_default("sh", p);
|
|
2658
|
|
2659 #ifdef FEAT_WILDIGN
|
|
2660 /*
|
|
2661 * Set the default for 'backupskip' to include environment variables for
|
|
2662 * temp files.
|
|
2663 */
|
|
2664 {
|
|
2665 # ifdef UNIX
|
|
2666 static char *(names[4]) = {"", "TMPDIR", "TEMP", "TMP"};
|
|
2667 # else
|
|
2668 static char *(names[3]) = {"TMPDIR", "TEMP", "TMP"};
|
|
2669 # endif
|
170
|
2670 int len;
|
|
2671 garray_T ga;
|
|
2672 int mustfree;
|
7
|
2673
|
|
2674 ga_init2(&ga, 1, 100);
|
|
2675 for (n = 0; n < (long)(sizeof(names) / sizeof(char *)); ++n)
|
|
2676 {
|
170
|
2677 mustfree = FALSE;
|
7
|
2678 # ifdef UNIX
|
|
2679 if (*names[n] == NUL)
|
|
2680 p = (char_u *)"/tmp";
|
|
2681 else
|
|
2682 # endif
|
170
|
2683 p = vim_getenv((char_u *)names[n], &mustfree);
|
7
|
2684 if (p != NULL && *p != NUL)
|
|
2685 {
|
|
2686 /* First time count the NUL, otherwise count the ','. */
|
|
2687 len = STRLEN(p) + 3;
|
|
2688 if (ga_grow(&ga, len) == OK)
|
|
2689 {
|
|
2690 if (ga.ga_len > 0)
|
|
2691 STRCAT(ga.ga_data, ",");
|
|
2692 STRCAT(ga.ga_data, p);
|
|
2693 add_pathsep(ga.ga_data);
|
|
2694 STRCAT(ga.ga_data, "*");
|
|
2695 ga.ga_len += len;
|
|
2696 }
|
|
2697 }
|
170
|
2698 if (mustfree)
|
|
2699 vim_free(p);
|
7
|
2700 }
|
|
2701 if (ga.ga_data != NULL)
|
|
2702 {
|
|
2703 set_string_default("bsk", ga.ga_data);
|
|
2704 vim_free(ga.ga_data);
|
|
2705 }
|
|
2706 }
|
|
2707 #endif
|
|
2708
|
|
2709 /*
|
|
2710 * 'maxmemtot' and 'maxmem' may have to be adjusted for available memory
|
|
2711 */
|
|
2712 opt_idx = findoption((char_u *)"maxmemtot");
|
|
2713 #if !defined(HAVE_AVAIL_MEM) && !defined(HAVE_TOTAL_MEM)
|
|
2714 if (options[opt_idx].def_val[VI_DEFAULT] == (char_u *)0L)
|
|
2715 #endif
|
|
2716 {
|
|
2717 #ifdef HAVE_AVAIL_MEM
|
|
2718 /* Use amount of memory available at this moment. */
|
|
2719 n = (mch_avail_mem(FALSE) >> 11);
|
|
2720 #else
|
|
2721 # ifdef HAVE_TOTAL_MEM
|
|
2722 /* Use amount of memory available to Vim. */
|
|
2723 n = (mch_total_mem(FALSE) >> 11);
|
|
2724 # else
|
|
2725 n = (0x7fffffff >> 11);
|
|
2726 # endif
|
|
2727 #endif
|
|
2728 options[opt_idx].def_val[VI_DEFAULT] = (char_u *)n;
|
|
2729 opt_idx = findoption((char_u *)"maxmem");
|
|
2730 #if !defined(HAVE_AVAIL_MEM) && !defined(HAVE_TOTAL_MEM)
|
|
2731 if ((long)options[opt_idx].def_val[VI_DEFAULT] > n
|
|
2732 || (long)options[opt_idx].def_val[VI_DEFAULT] == 0L)
|
|
2733 #endif
|
|
2734 options[opt_idx].def_val[VI_DEFAULT] = (char_u *)n;
|
|
2735 }
|
|
2736
|
|
2737 #ifdef FEAT_GUI_W32
|
|
2738 /* force 'shortname' for Win32s */
|
|
2739 if (gui_is_win32s())
|
|
2740 options[findoption((char_u *)"shortname")].def_val[VI_DEFAULT] =
|
|
2741 (char_u *)TRUE;
|
|
2742 #endif
|
|
2743
|
|
2744 #ifdef FEAT_SEARCHPATH
|
|
2745 {
|
|
2746 char_u *cdpath;
|
|
2747 char_u *buf;
|
|
2748 int i;
|
|
2749 int j;
|
170
|
2750 int mustfree = FALSE;
|
7
|
2751
|
|
2752 /* Initialize the 'cdpath' option's default value. */
|
170
|
2753 cdpath = vim_getenv((char_u *)"CDPATH", &mustfree);
|
7
|
2754 if (cdpath != NULL)
|
|
2755 {
|
|
2756 buf = alloc((unsigned)((STRLEN(cdpath) << 1) + 2));
|
|
2757 if (buf != NULL)
|
|
2758 {
|
|
2759 buf[0] = ','; /* start with ",", current dir first */
|
|
2760 j = 1;
|
|
2761 for (i = 0; cdpath[i] != NUL; ++i)
|
|
2762 {
|
|
2763 if (vim_ispathlistsep(cdpath[i]))
|
|
2764 buf[j++] = ',';
|
|
2765 else
|
|
2766 {
|
|
2767 if (cdpath[i] == ' ' || cdpath[i] == ',')
|
|
2768 buf[j++] = '\\';
|
|
2769 buf[j++] = cdpath[i];
|
|
2770 }
|
|
2771 }
|
|
2772 buf[j] = NUL;
|
|
2773 opt_idx = findoption((char_u *)"cdpath");
|
|
2774 options[opt_idx].def_val[VI_DEFAULT] = buf;
|
|
2775 options[opt_idx].flags |= P_DEF_ALLOCED;
|
|
2776 }
|
170
|
2777 if (mustfree)
|
|
2778 vim_free(cdpath);
|
7
|
2779 }
|
|
2780 }
|
|
2781 #endif
|
|
2782
|
|
2783 #if defined(FEAT_POSTSCRIPT) && (defined(MSWIN) || defined(OS2) || defined(VMS) || defined(EBCDIC) || defined(MAC) || defined(hpux))
|
|
2784 /* Set print encoding on platforms that don't default to latin1 */
|
|
2785 set_string_default("penc",
|
|
2786 # if defined(MSWIN) || defined(OS2)
|
|
2787 (char_u *)"cp1252"
|
|
2788 # else
|
|
2789 # ifdef VMS
|
|
2790 (char_u *)"dec-mcs"
|
|
2791 # else
|
|
2792 # ifdef EBCDIC
|
|
2793 (char_u *)"ebcdic-uk"
|
|
2794 # else
|
|
2795 # ifdef MAC
|
|
2796 (char_u *)"mac-roman"
|
|
2797 # else /* HPUX */
|
|
2798 (char_u *)"hp-roman8"
|
|
2799 # endif
|
|
2800 # endif
|
|
2801 # endif
|
|
2802 # endif
|
|
2803 );
|
|
2804 #endif
|
|
2805
|
|
2806 #ifdef FEAT_POSTSCRIPT
|
|
2807 /* 'printexpr' must be allocated to be able to evaluate it. */
|
|
2808 set_string_default("pexpr",
|
8
|
2809 # if defined(MSWIN) || defined(MSDOS) || defined(OS2)
|
|
2810 (char_u *)"system('copy' . ' ' . v:fname_in . (&printdevice == '' ? ' LPT1:' : (' \"' . &printdevice . '\"'))) . delete(v:fname_in)"
|
7
|
2811 # else
|
|
2812 # ifdef VMS
|
|
2813 (char_u *)"system('print/delete' . (&printdevice == '' ? '' : ' /queue=' . &printdevice) . ' ' . v:fname_in)"
|
|
2814
|
|
2815 # else
|
|
2816 (char_u *)"system('lpr' . (&printdevice == '' ? '' : ' -P' . &printdevice) . ' ' . v:fname_in) . delete(v:fname_in) + v:shell_error"
|
|
2817 # endif
|
|
2818 # endif
|
|
2819 );
|
|
2820 #endif
|
|
2821
|
|
2822 /*
|
|
2823 * Set all the options (except the terminal options) to their default
|
|
2824 * value. Also set the global value for local options.
|
|
2825 */
|
|
2826 set_options_default(0);
|
|
2827
|
|
2828 #ifdef FEAT_GUI
|
|
2829 if (found_reverse_arg)
|
|
2830 set_option_value((char_u *)"bg", 0L, (char_u *)"dark", 0);
|
|
2831 #endif
|
|
2832
|
|
2833 curbuf->b_p_initialized = TRUE;
|
|
2834 curbuf->b_p_ar = -1; /* no local 'autoread' value */
|
|
2835 check_buf_options(curbuf);
|
|
2836 check_win_options(curwin);
|
|
2837 check_options();
|
|
2838
|
|
2839 /* Must be before option_expand(), because that one needs vim_isIDc() */
|
|
2840 didset_options();
|
|
2841
|
227
|
2842 #ifdef FEAT_SYN_HL
|
|
2843 /* Use the current chartab for the generic chartab. */
|
|
2844 init_spell_chartab();
|
|
2845 #endif
|
|
2846
|
7
|
2847 #ifdef FEAT_LINEBREAK
|
|
2848 /*
|
|
2849 * initialize the table for 'breakat'.
|
|
2850 */
|
|
2851 fill_breakat_flags();
|
|
2852 #endif
|
|
2853
|
|
2854 /*
|
|
2855 * Expand environment variables and things like "~" for the defaults.
|
|
2856 * If option_expand() returns non-NULL the variable is expanded. This can
|
|
2857 * only happen for non-indirect options.
|
|
2858 * Also set the default to the expanded value, so ":set" does not list
|
|
2859 * them.
|
|
2860 * Don't set the P_ALLOCED flag, because we don't want to free the
|
|
2861 * default.
|
|
2862 */
|
|
2863 for (opt_idx = 0; !istermoption(&options[opt_idx]); opt_idx++)
|
|
2864 {
|
|
2865 if ((options[opt_idx].flags & P_GETTEXT)
|
|
2866 && options[opt_idx].var != NULL)
|
|
2867 p = (char_u *)_(*(char **)options[opt_idx].var);
|
|
2868 else
|
|
2869 p = option_expand(opt_idx, NULL);
|
|
2870 if (p != NULL && (p = vim_strsave(p)) != NULL)
|
|
2871 {
|
|
2872 *(char_u **)options[opt_idx].var = p;
|
|
2873 /* VIMEXP
|
|
2874 * Defaults for all expanded options are currently the same for Vi
|
|
2875 * and Vim. When this changes, add some code here! Also need to
|
|
2876 * split P_DEF_ALLOCED in two.
|
|
2877 */
|
|
2878 if (options[opt_idx].flags & P_DEF_ALLOCED)
|
|
2879 vim_free(options[opt_idx].def_val[VI_DEFAULT]);
|
|
2880 options[opt_idx].def_val[VI_DEFAULT] = p;
|
|
2881 options[opt_idx].flags |= P_DEF_ALLOCED;
|
|
2882 }
|
|
2883 }
|
|
2884
|
|
2885 /* Initialize the highlight_attr[] table. */
|
|
2886 highlight_changed();
|
|
2887
|
|
2888 save_file_ff(curbuf); /* Buffer is unchanged */
|
|
2889
|
|
2890 /* Parse default for 'wildmode' */
|
|
2891 check_opt_wim();
|
|
2892
|
|
2893 #if defined(FEAT_ARABIC)
|
|
2894 /* Detect use of mlterm.
|
|
2895 * Mlterm is a terminal emulator akin to xterm that has some special
|
|
2896 * abilities (bidi namely).
|
|
2897 * NOTE: mlterm's author is being asked to 'set' a variable
|
|
2898 * instead of an environment variable due to inheritance.
|
|
2899 */
|
|
2900 if (mch_getenv((char_u *)"MLTERM") != NULL)
|
|
2901 set_option_value((char_u *)"tbidi", 1L, NULL, 0);
|
|
2902 #endif
|
|
2903
|
|
2904 #if defined(FEAT_WINDOWS) || defined(FEAT_FOLDING)
|
|
2905 /* Parse default for 'fillchars'. */
|
|
2906 (void)set_chars_option(&p_fcs);
|
|
2907 #endif
|
|
2908
|
|
2909 #ifdef FEAT_CLIPBOARD
|
|
2910 /* Parse default for 'clipboard' */
|
|
2911 (void)check_clipboard_option();
|
|
2912 #endif
|
|
2913
|
|
2914 #ifdef FEAT_MBYTE
|
|
2915 # if defined(WIN3264) && defined(FEAT_GETTEXT)
|
|
2916 /*
|
|
2917 * If $LANG isn't set, try to get a good value for it. This makes the
|
|
2918 * right language be used automatically. Don't do this for English.
|
|
2919 */
|
|
2920 if (mch_getenv((char_u *)"LANG") == NULL)
|
|
2921 {
|
|
2922 char buf[20];
|
|
2923
|
|
2924 /* Could use LOCALE_SISO639LANGNAME, but it's not in Win95.
|
|
2925 * LOCALE_SABBREVLANGNAME gives us three letters, like "enu", we use
|
|
2926 * only the first two. */
|
|
2927 n = GetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_SABBREVLANGNAME,
|
|
2928 (LPTSTR)buf, 20);
|
|
2929 if (n >= 2 && STRNICMP(buf, "en", 2) != 0)
|
|
2930 {
|
|
2931 /* There are a few exceptions (probably more) */
|
|
2932 if (STRNICMP(buf, "cht", 3) == 0 || STRNICMP(buf, "zht", 3) == 0)
|
|
2933 STRCPY(buf, "zh_TW");
|
|
2934 else if (STRNICMP(buf, "chs", 3) == 0
|
|
2935 || STRNICMP(buf, "zhc", 3) == 0)
|
|
2936 STRCPY(buf, "zh_CN");
|
|
2937 else if (STRNICMP(buf, "jp", 2) == 0)
|
|
2938 STRCPY(buf, "ja");
|
|
2939 else
|
|
2940 buf[2] = NUL; /* truncate to two-letter code */
|
|
2941 vim_setenv("LANG", buf);
|
|
2942 }
|
|
2943 }
|
168
|
2944 # else
|
|
2945 # ifdef MACOS
|
|
2946 if (mch_getenv((char_u *)"LANG") == NULL)
|
|
2947 {
|
|
2948 char buf[20];
|
|
2949 if (LocaleRefGetPartString(NULL,
|
|
2950 kLocaleLanguageMask | kLocaleLanguageVariantMask |
|
|
2951 kLocaleRegionMask | kLocaleRegionVariantMask,
|
|
2952 sizeof buf, buf) == noErr && *buf)
|
|
2953 {
|
|
2954 vim_setenv("LANG", buf);
|
|
2955 # ifdef HAVE_LOCALE_H
|
|
2956 setlocale(LC_ALL, "");
|
|
2957 # endif
|
|
2958 }
|
|
2959 }
|
|
2960 # endif
|
7
|
2961 # endif
|
|
2962
|
|
2963 /* enc_locale() will try to find the encoding of the current locale. */
|
|
2964 p = enc_locale();
|
|
2965 if (p != NULL)
|
|
2966 {
|
|
2967 char_u *save_enc;
|
|
2968
|
|
2969 /* Try setting 'encoding' and check if the value is valid.
|
|
2970 * If not, go back to the default "latin1". */
|
|
2971 save_enc = p_enc;
|
|
2972 p_enc = p;
|
|
2973 if (mb_init() == NULL)
|
|
2974 {
|
|
2975 opt_idx = findoption((char_u *)"encoding");
|
|
2976 options[opt_idx].def_val[VI_DEFAULT] = p_enc;
|
|
2977 options[opt_idx].flags |= P_DEF_ALLOCED;
|
|
2978
|
24
|
2979 #if defined(MSDOS) || defined(MSWIN) || defined(OS2) || defined(MACOS) \
|
|
2980 || defined(VMS)
|
|
2981 if (STRCMP(p_enc, "latin1") == 0
|
|
2982 # ifdef FEAT_MBYTE
|
|
2983 || enc_utf8
|
|
2984 # endif
|
|
2985 )
|
|
2986 {
|
|
2987 /* Adjust the default for 'isprint' to match latin1. */
|
|
2988 set_string_option_direct((char_u *)"isp", -1,
|
|
2989 (char_u *)"@,161-255", OPT_FREE);
|
|
2990 (void)init_chartab();
|
|
2991 }
|
|
2992 #endif
|
|
2993
|
7
|
2994 # if defined(WIN3264) && !defined(FEAT_GUI)
|
|
2995 /* Win32 console: When GetACP() returns a different value from
|
|
2996 * GetConsoleCP() set 'termencoding'. */
|
|
2997 if (GetACP() != GetConsoleCP())
|
|
2998 {
|
|
2999 char buf[50];
|
|
3000
|
|
3001 sprintf(buf, "cp%ld", (long)GetConsoleCP());
|
|
3002 p_tenc = vim_strsave((char_u *)buf);
|
|
3003 if (p_tenc != NULL)
|
|
3004 {
|
|
3005 opt_idx = findoption((char_u *)"termencoding");
|
|
3006 options[opt_idx].def_val[VI_DEFAULT] = p_tenc;
|
|
3007 options[opt_idx].flags |= P_DEF_ALLOCED;
|
|
3008 convert_setup(&input_conv, p_tenc, p_enc);
|
|
3009 convert_setup(&output_conv, p_enc, p_tenc);
|
|
3010 }
|
|
3011 else
|
|
3012 p_tenc = empty_option;
|
|
3013 }
|
|
3014 # endif
|
170
|
3015 # if defined(WIN3264) && defined(FEAT_MBYTE)
|
|
3016 /* $HOME may have characters in active code page. */
|
|
3017 init_homedir();
|
|
3018 # endif
|
7
|
3019 }
|
|
3020 else
|
|
3021 {
|
|
3022 vim_free(p_enc);
|
|
3023 p_enc = save_enc;
|
|
3024 }
|
|
3025 }
|
|
3026 #endif
|
|
3027
|
|
3028 #ifdef FEAT_MULTI_LANG
|
|
3029 /* Set the default for 'helplang'. */
|
|
3030 set_helplang_default(get_mess_lang());
|
|
3031 #endif
|
|
3032 }
|
|
3033
|
|
3034 /*
|
|
3035 * Set an option to its default value.
|
|
3036 * This does not take care of side effects!
|
|
3037 */
|
|
3038 static void
|
|
3039 set_option_default(opt_idx, opt_flags, compatible)
|
|
3040 int opt_idx;
|
|
3041 int opt_flags; /* OPT_FREE, OPT_LOCAL and/or OPT_GLOBAL */
|
|
3042 int compatible; /* use Vi default value */
|
|
3043 {
|
|
3044 char_u *varp; /* pointer to variable for current option */
|
|
3045 int dvi; /* index in def_val[] */
|
|
3046 long_u flags;
|
|
3047 int both = (opt_flags & (OPT_LOCAL | OPT_GLOBAL)) == 0;
|
|
3048
|
|
3049 varp = get_varp_scope(&(options[opt_idx]), both ? OPT_LOCAL : opt_flags);
|
|
3050 flags = options[opt_idx].flags;
|
320
|
3051 if (varp != NULL) /* skip hidden option, nothing to do for it */
|
7
|
3052 {
|
|
3053 dvi = ((flags & P_VI_DEF) || compatible) ? VI_DEFAULT : VIM_DEFAULT;
|
|
3054 if (flags & P_STRING)
|
|
3055 {
|
|
3056 /* Use set_string_option_direct() for local options to handle
|
|
3057 * freeing and allocating the value. */
|
|
3058 if (options[opt_idx].indir != PV_NONE)
|
|
3059 set_string_option_direct(NULL, opt_idx,
|
|
3060 options[opt_idx].def_val[dvi], opt_flags);
|
|
3061 else
|
|
3062 {
|
|
3063 if ((opt_flags & OPT_FREE) && (flags & P_ALLOCED))
|
|
3064 free_string_option(*(char_u **)(varp));
|
|
3065 *(char_u **)varp = options[opt_idx].def_val[dvi];
|
|
3066 options[opt_idx].flags &= ~P_ALLOCED;
|
|
3067 }
|
|
3068 }
|
|
3069 else if (flags & P_NUM)
|
|
3070 {
|
|
3071 if (varp == (char_u *)PV_SCROLL)
|
|
3072 win_comp_scroll(curwin);
|
|
3073 else
|
|
3074 {
|
|
3075 *(long *)varp = (long)options[opt_idx].def_val[dvi];
|
|
3076 /* May also set global value for local option. */
|
|
3077 if (both)
|
|
3078 *(long *)get_varp_scope(&(options[opt_idx]), OPT_GLOBAL) =
|
|
3079 *(long *)varp;
|
|
3080 }
|
|
3081 }
|
|
3082 else /* P_BOOL */
|
|
3083 {
|
|
3084 /* the cast to long is required for Manx C */
|
|
3085 *(int *)varp = (int)(long)options[opt_idx].def_val[dvi];
|
|
3086 /* May also set global value for local option. */
|
|
3087 if (both)
|
|
3088 *(int *)get_varp_scope(&(options[opt_idx]), OPT_GLOBAL) =
|
|
3089 *(int *)varp;
|
|
3090 }
|
|
3091 }
|
|
3092
|
|
3093 #ifdef FEAT_EVAL
|
|
3094 /* Remember where the option was set. */
|
|
3095 options[opt_idx].scriptID = current_SID;
|
|
3096 #endif
|
|
3097 }
|
|
3098
|
|
3099 /*
|
|
3100 * Set all options (except terminal options) to their default value.
|
|
3101 */
|
|
3102 static void
|
|
3103 set_options_default(opt_flags)
|
|
3104 int opt_flags; /* OPT_FREE, OPT_LOCAL and/or OPT_GLOBAL */
|
|
3105 {
|
|
3106 int i;
|
|
3107 #ifdef FEAT_WINDOWS
|
|
3108 win_T *wp;
|
|
3109 #endif
|
|
3110
|
|
3111 for (i = 0; !istermoption(&options[i]); i++)
|
|
3112 if (!(options[i].flags & P_NODEFAULT))
|
|
3113 set_option_default(i, opt_flags, p_cp);
|
|
3114
|
|
3115 #ifdef FEAT_WINDOWS
|
|
3116 /* The 'scroll' option must be computed for all windows. */
|
|
3117 for (wp = firstwin; wp != NULL; wp = wp->w_next)
|
|
3118 win_comp_scroll(wp);
|
|
3119 #else
|
|
3120 win_comp_scroll(curwin);
|
|
3121 #endif
|
|
3122 }
|
|
3123
|
|
3124 /*
|
|
3125 * Set the Vi-default value of a string option.
|
|
3126 * Used for 'sh', 'backupskip' and 'term'.
|
|
3127 */
|
|
3128 void
|
|
3129 set_string_default(name, val)
|
|
3130 char *name;
|
|
3131 char_u *val;
|
|
3132 {
|
|
3133 char_u *p;
|
|
3134 int opt_idx;
|
|
3135
|
|
3136 p = vim_strsave(val);
|
|
3137 if (p != NULL) /* we don't want a NULL */
|
|
3138 {
|
|
3139 opt_idx = findoption((char_u *)name);
|
|
3140 if (options[opt_idx].flags & P_DEF_ALLOCED)
|
|
3141 vim_free(options[opt_idx].def_val[VI_DEFAULT]);
|
|
3142 options[opt_idx].def_val[VI_DEFAULT] = p;
|
|
3143 options[opt_idx].flags |= P_DEF_ALLOCED;
|
|
3144 }
|
|
3145 }
|
|
3146
|
|
3147 /*
|
|
3148 * Set the Vi-default value of a number option.
|
|
3149 * Used for 'lines' and 'columns'.
|
|
3150 */
|
|
3151 void
|
|
3152 set_number_default(name, val)
|
|
3153 char *name;
|
|
3154 long val;
|
|
3155 {
|
|
3156 options[findoption((char_u *)name)].def_val[VI_DEFAULT] = (char_u *)val;
|
|
3157 }
|
|
3158
|
|
3159 /*
|
|
3160 * Initialize the options, part two: After getting Rows and Columns and
|
|
3161 * setting 'term'.
|
|
3162 */
|
|
3163 void
|
|
3164 set_init_2()
|
|
3165 {
|
164
|
3166 int idx;
|
|
3167
|
7
|
3168 /*
|
|
3169 * 'scroll' defaults to half the window height. Note that this default is
|
|
3170 * wrong when the window height changes.
|
|
3171 */
|
164
|
3172 set_number_default("scroll", (long_u)Rows >> 1);
|
168
|
3173 idx = findoption((char_u *)"scroll");
|
|
3174 if (!(options[idx].flags & P_WAS_SET))
|
|
3175 set_option_default(idx, OPT_LOCAL, p_cp);
|
7
|
3176 comp_col();
|
|
3177
|
164
|
3178 /*
|
|
3179 * 'window' is only for backwards compatibility with Vi.
|
|
3180 * Default is Rows - 1.
|
|
3181 */
|
|
3182 idx = findoption((char_u *)"wi");
|
|
3183 if (!(options[idx].flags & P_WAS_SET))
|
|
3184 p_window = Rows - 1;
|
|
3185 set_number_default("window", Rows - 1);
|
|
3186
|
7
|
3187 #if !((defined(MSDOS) || defined(OS2) || defined(WIN3264)) && !defined(FEAT_GUI))
|
|
3188 {
|
|
3189 /*
|
|
3190 * If 'background' wasn't set by the user, try guessing the value,
|
|
3191 * depending on the terminal name. Only need to check for terminals
|
173
|
3192 * with a dark background, that can handle color. Recognized are:
|
|
3193 * "linux" Linux console
|
|
3194 * "screen.linux" Linux console with screen
|
179
|
3195 * "cygwin" Cygwin shell
|
7
|
3196 */
|
164
|
3197 idx = findoption((char_u *)"bg");
|
173
|
3198 if (!(options[idx].flags & P_WAS_SET)
|
|
3199 && (STRCMP(T_NAME, "linux") == 0
|
179
|
3200 || STRCMP(T_NAME, "screen.linux") == 0
|
|
3201 || STRCMP(T_NAME, "cygwin") == 0))
|
164
|
3202 {
|
|
3203 set_string_option_direct(NULL, idx, (char_u *)"dark", OPT_FREE);
|
7
|
3204 /* don't mark it as set, when starting the GUI it may be changed
|
|
3205 * again */
|
164
|
3206 options[idx].flags &= ~P_WAS_SET;
|
7
|
3207 }
|
|
3208 }
|
|
3209 #endif
|
|
3210 }
|
|
3211
|
|
3212 /*
|
|
3213 * Initialize the options, part three: After reading the .vimrc
|
|
3214 */
|
|
3215 void
|
|
3216 set_init_3()
|
|
3217 {
|
|
3218 #if defined(UNIX) || defined(OS2) || defined(WIN3264)
|
|
3219 /*
|
|
3220 * Set 'shellpipe' and 'shellredir', depending on the 'shell' option.
|
|
3221 * This is done after other initializations, where 'shell' might have been
|
|
3222 * set, but only if they have not been set before.
|
|
3223 */
|
|
3224 char_u *p;
|
|
3225 int idx_srr;
|
|
3226 int do_srr;
|
|
3227 #ifdef FEAT_QUICKFIX
|
|
3228 int idx_sp;
|
|
3229 int do_sp;
|
|
3230 #endif
|
|
3231
|
|
3232 idx_srr = findoption((char_u *)"srr");
|
|
3233 do_srr = !(options[idx_srr].flags & P_WAS_SET);
|
|
3234 #ifdef FEAT_QUICKFIX
|
|
3235 idx_sp = findoption((char_u *)"sp");
|
|
3236 do_sp = !(options[idx_sp].flags & P_WAS_SET);
|
|
3237 #endif
|
|
3238
|
|
3239 /*
|
|
3240 * Isolate the name of the shell:
|
|
3241 * - Skip beyond any path. E.g., "/usr/bin/csh -f" -> "csh -f".
|
|
3242 * - Remove any argument. E.g., "csh -f" -> "csh".
|
|
3243 */
|
|
3244 p = gettail(p_sh);
|
|
3245 p = vim_strnsave(p, (int)(skiptowhite(p) - p));
|
|
3246 if (p != NULL)
|
|
3247 {
|
|
3248 /*
|
|
3249 * Default for p_sp is "| tee", for p_srr is ">".
|
|
3250 * For known shells it is changed here to include stderr.
|
|
3251 */
|
|
3252 if ( fnamecmp(p, "csh") == 0
|
|
3253 || fnamecmp(p, "tcsh") == 0
|
|
3254 # if defined(OS2) || defined(WIN3264) /* also check with .exe extension */
|
|
3255 || fnamecmp(p, "csh.exe") == 0
|
|
3256 || fnamecmp(p, "tcsh.exe") == 0
|
|
3257 # endif
|
|
3258 )
|
|
3259 {
|
|
3260 #if defined(FEAT_QUICKFIX)
|
|
3261 if (do_sp)
|
|
3262 {
|
|
3263 # ifdef WIN3264
|
|
3264 p_sp = (char_u *)">&";
|
|
3265 # else
|
|
3266 p_sp = (char_u *)"|& tee";
|
|
3267 # endif
|
|
3268 options[idx_sp].def_val[VI_DEFAULT] = p_sp;
|
|
3269 }
|
|
3270 #endif
|
|
3271 if (do_srr)
|
|
3272 {
|
|
3273 p_srr = (char_u *)">&";
|
|
3274 options[idx_srr].def_val[VI_DEFAULT] = p_srr;
|
|
3275 }
|
|
3276 }
|
|
3277 else
|
|
3278 # ifndef OS2 /* Always use bourne shell style redirection if we reach this */
|
|
3279 if ( fnamecmp(p, "sh") == 0
|
|
3280 || fnamecmp(p, "ksh") == 0
|
|
3281 || fnamecmp(p, "zsh") == 0
|
|
3282 || fnamecmp(p, "bash") == 0
|
|
3283 # ifdef WIN3264
|
|
3284 || fnamecmp(p, "cmd") == 0
|
|
3285 || fnamecmp(p, "sh.exe") == 0
|
|
3286 || fnamecmp(p, "ksh.exe") == 0
|
|
3287 || fnamecmp(p, "zsh.exe") == 0
|
|
3288 || fnamecmp(p, "bash.exe") == 0
|
|
3289 || fnamecmp(p, "cmd.exe") == 0
|
|
3290 # endif
|
|
3291 )
|
|
3292 # endif
|
|
3293 {
|
|
3294 #if defined(FEAT_QUICKFIX)
|
|
3295 if (do_sp)
|
|
3296 {
|
|
3297 # ifdef WIN3264
|
|
3298 p_sp = (char_u *)">%s 2>&1";
|
|
3299 # else
|
|
3300 p_sp = (char_u *)"2>&1| tee";
|
|
3301 # endif
|
|
3302 options[idx_sp].def_val[VI_DEFAULT] = p_sp;
|
|
3303 }
|
|
3304 #endif
|
|
3305 if (do_srr)
|
|
3306 {
|
|
3307 p_srr = (char_u *)">%s 2>&1";
|
|
3308 options[idx_srr].def_val[VI_DEFAULT] = p_srr;
|
|
3309 }
|
|
3310 }
|
|
3311 vim_free(p);
|
|
3312 }
|
|
3313 #endif
|
|
3314
|
|
3315 #if defined(MSDOS) || defined(WIN3264) || defined(OS2)
|
|
3316 /*
|
|
3317 * Set 'shellcmdflag and 'shellquote' depending on the 'shell' option.
|
|
3318 * This is done after other initializations, where 'shell' might have been
|
|
3319 * set, but only if they have not been set before. Default for p_shcf is
|
|
3320 * "/c", for p_shq is "". For "sh" like shells it is changed here to
|
|
3321 * "-c" and "\"", but not for DJGPP, because it starts the shell without
|
|
3322 * command.com. And for Win32 we need to set p_sxq instead.
|
|
3323 */
|
10
|
3324 if (strstr((char *)gettail(p_sh), "sh") != NULL)
|
7
|
3325 {
|
|
3326 int idx3;
|
|
3327
|
|
3328 idx3 = findoption((char_u *)"shcf");
|
|
3329 if (!(options[idx3].flags & P_WAS_SET))
|
|
3330 {
|
|
3331 p_shcf = (char_u *)"-c";
|
|
3332 options[idx3].def_val[VI_DEFAULT] = p_shcf;
|
|
3333 }
|
|
3334
|
|
3335 # ifndef DJGPP
|
|
3336 # ifdef WIN3264
|
|
3337 /* Somehow Win32 requires the quotes around the redirection too */
|
|
3338 idx3 = findoption((char_u *)"sxq");
|
|
3339 if (!(options[idx3].flags & P_WAS_SET))
|
|
3340 {
|
|
3341 p_sxq = (char_u *)"\"";
|
|
3342 options[idx3].def_val[VI_DEFAULT] = p_sxq;
|
|
3343 }
|
|
3344 # else
|
|
3345 idx3 = findoption((char_u *)"shq");
|
|
3346 if (!(options[idx3].flags & P_WAS_SET))
|
|
3347 {
|
|
3348 p_shq = (char_u *)"\"";
|
|
3349 options[idx3].def_val[VI_DEFAULT] = p_shq;
|
|
3350 }
|
|
3351 # endif
|
|
3352 # endif
|
|
3353 }
|
|
3354 #endif
|
|
3355
|
|
3356 #ifdef FEAT_TITLE
|
|
3357 set_title_defaults();
|
|
3358 #endif
|
|
3359 }
|
|
3360
|
|
3361 #if defined(FEAT_MULTI_LANG) || defined(PROTO)
|
|
3362 /*
|
|
3363 * When 'helplang' is still at its default value, set it to "lang".
|
|
3364 * Only the first two characters of "lang" are used.
|
|
3365 */
|
|
3366 void
|
|
3367 set_helplang_default(lang)
|
|
3368 char_u *lang;
|
|
3369 {
|
|
3370 int idx;
|
|
3371
|
|
3372 if (lang == NULL || STRLEN(lang) < 2) /* safety check */
|
|
3373 return;
|
|
3374 idx = findoption((char_u *)"hlg");
|
|
3375 if (!(options[idx].flags & P_WAS_SET))
|
|
3376 {
|
|
3377 if (options[idx].flags & P_ALLOCED)
|
|
3378 free_string_option(p_hlg);
|
|
3379 p_hlg = vim_strsave(lang);
|
|
3380 if (p_hlg == NULL)
|
|
3381 p_hlg = empty_option;
|
|
3382 else
|
18
|
3383 {
|
|
3384 /* zh_CN becomes "cn", zh_TW becomes "tw". */
|
|
3385 if (STRNICMP(p_hlg, "zh_", 3) == 0 && STRLEN(p_hlg) >= 5)
|
|
3386 {
|
|
3387 p_hlg[0] = TOLOWER_ASC(p_hlg[3]);
|
|
3388 p_hlg[1] = TOLOWER_ASC(p_hlg[4]);
|
|
3389 }
|
7
|
3390 p_hlg[2] = NUL;
|
18
|
3391 }
|
7
|
3392 options[idx].flags |= P_ALLOCED;
|
|
3393 }
|
|
3394 }
|
|
3395 #endif
|
|
3396
|
|
3397 #ifdef FEAT_GUI
|
|
3398 static char_u *gui_bg_default __ARGS((void));
|
|
3399
|
|
3400 static char_u *
|
|
3401 gui_bg_default()
|
|
3402 {
|
|
3403 if (gui_get_lightness(gui.back_pixel) < 127)
|
|
3404 return (char_u *)"dark";
|
|
3405 return (char_u *)"light";
|
|
3406 }
|
|
3407
|
|
3408 /*
|
|
3409 * Option initializations that can only be done after opening the GUI window.
|
|
3410 */
|
|
3411 void
|
|
3412 init_gui_options()
|
|
3413 {
|
|
3414 /* Set the 'background' option according to the lightness of the
|
|
3415 * background color, unless the user has set it already. */
|
|
3416 if (!option_was_set((char_u *)"bg") && STRCMP(p_bg, gui_bg_default()) != 0)
|
|
3417 {
|
|
3418 set_option_value((char_u *)"bg", 0L, gui_bg_default(), 0);
|
|
3419 highlight_changed();
|
|
3420 }
|
|
3421 }
|
|
3422 #endif
|
|
3423
|
|
3424 #ifdef FEAT_TITLE
|
|
3425 /*
|
|
3426 * 'title' and 'icon' only default to true if they have not been set or reset
|
|
3427 * in .vimrc and we can read the old value.
|
|
3428 * When 'title' and 'icon' have been reset in .vimrc, we won't even check if
|
|
3429 * they can be reset. This reduces startup time when using X on a remote
|
|
3430 * machine.
|
|
3431 */
|
|
3432 void
|
|
3433 set_title_defaults()
|
|
3434 {
|
|
3435 int idx1;
|
|
3436 long val;
|
|
3437
|
|
3438 /*
|
|
3439 * If GUI is (going to be) used, we can always set the window title and
|
|
3440 * icon name. Saves a bit of time, because the X11 display server does
|
|
3441 * not need to be contacted.
|
|
3442 */
|
|
3443 idx1 = findoption((char_u *)"title");
|
|
3444 if (!(options[idx1].flags & P_WAS_SET))
|
|
3445 {
|
|
3446 #ifdef FEAT_GUI
|
|
3447 if (gui.starting || gui.in_use)
|
|
3448 val = TRUE;
|
|
3449 else
|
|
3450 #endif
|
|
3451 val = mch_can_restore_title();
|
|
3452 options[idx1].def_val[VI_DEFAULT] = (char_u *)val;
|
|
3453 p_title = val;
|
|
3454 }
|
|
3455 idx1 = findoption((char_u *)"icon");
|
|
3456 if (!(options[idx1].flags & P_WAS_SET))
|
|
3457 {
|
|
3458 #ifdef FEAT_GUI
|
|
3459 if (gui.starting || gui.in_use)
|
|
3460 val = TRUE;
|
|
3461 else
|
|
3462 #endif
|
|
3463 val = mch_can_restore_icon();
|
|
3464 options[idx1].def_val[VI_DEFAULT] = (char_u *)val;
|
|
3465 p_icon = val;
|
|
3466 }
|
|
3467 }
|
|
3468 #endif
|
|
3469
|
|
3470 /*
|
|
3471 * Parse 'arg' for option settings.
|
|
3472 *
|
|
3473 * 'arg' may be IObuff, but only when no errors can be present and option
|
|
3474 * does not need to be expanded with option_expand().
|
|
3475 * "opt_flags":
|
|
3476 * 0 for ":set"
|
|
3477 * OPT_GLOBAL for ":setglobal"
|
|
3478 * OPT_LOCAL for ":setlocal" and a modeline
|
|
3479 * OPT_MODELINE for a modeline
|
|
3480 *
|
|
3481 * returns FAIL if an error is detected, OK otherwise
|
|
3482 */
|
|
3483 int
|
|
3484 do_set(arg, opt_flags)
|
|
3485 char_u *arg; /* option string (may be written to!) */
|
|
3486 int opt_flags;
|
|
3487 {
|
|
3488 int opt_idx;
|
|
3489 char_u *errmsg;
|
|
3490 char_u errbuf[80];
|
|
3491 char_u *startarg;
|
|
3492 int prefix; /* 1: nothing, 0: "no", 2: "inv" in front of name */
|
|
3493 int nextchar; /* next non-white char after option name */
|
|
3494 int afterchar; /* character just after option name */
|
|
3495 int len;
|
|
3496 int i;
|
|
3497 long value;
|
|
3498 int key;
|
|
3499 long_u flags; /* flags for current option */
|
|
3500 char_u *varp = NULL; /* pointer to variable for current option */
|
|
3501 int did_show = FALSE; /* already showed one value */
|
|
3502 int adding; /* "opt+=arg" */
|
|
3503 int prepending; /* "opt^=arg" */
|
|
3504 int removing; /* "opt-=arg" */
|
|
3505 int cp_val = 0;
|
|
3506 char_u key_name[2];
|
|
3507
|
|
3508 if (*arg == NUL)
|
|
3509 {
|
|
3510 showoptions(0, opt_flags);
|
168
|
3511 did_show = TRUE;
|
|
3512 goto theend;
|
7
|
3513 }
|
|
3514
|
|
3515 while (*arg != NUL) /* loop to process all options */
|
|
3516 {
|
|
3517 errmsg = NULL;
|
|
3518 startarg = arg; /* remember for error message */
|
|
3519
|
36
|
3520 if (STRNCMP(arg, "all", 3) == 0 && !isalpha(arg[3])
|
|
3521 && !(opt_flags & OPT_MODELINE))
|
7
|
3522 {
|
|
3523 /*
|
|
3524 * ":set all" show all options.
|
|
3525 * ":set all&" set all options to their default value.
|
|
3526 */
|
|
3527 arg += 3;
|
|
3528 if (*arg == '&')
|
|
3529 {
|
|
3530 ++arg;
|
|
3531 /* Only for :set command set global value of local options. */
|
|
3532 set_options_default(OPT_FREE | opt_flags);
|
|
3533 }
|
|
3534 else
|
168
|
3535 {
|
7
|
3536 showoptions(1, opt_flags);
|
168
|
3537 did_show = TRUE;
|
|
3538 }
|
7
|
3539 }
|
36
|
3540 else if (STRNCMP(arg, "termcap", 7) == 0 && !(opt_flags & OPT_MODELINE))
|
7
|
3541 {
|
|
3542 showoptions(2, opt_flags);
|
|
3543 show_termcodes();
|
168
|
3544 did_show = TRUE;
|
7
|
3545 arg += 7;
|
|
3546 }
|
|
3547 else
|
|
3548 {
|
|
3549 prefix = 1;
|
|
3550 if (STRNCMP(arg, "no", 2) == 0)
|
|
3551 {
|
|
3552 prefix = 0;
|
|
3553 arg += 2;
|
|
3554 }
|
|
3555 else if (STRNCMP(arg, "inv", 3) == 0)
|
|
3556 {
|
|
3557 prefix = 2;
|
|
3558 arg += 3;
|
|
3559 }
|
|
3560
|
|
3561 /* find end of name */
|
|
3562 key = 0;
|
|
3563 if (*arg == '<')
|
|
3564 {
|
|
3565 nextchar = 0;
|
|
3566 opt_idx = -1;
|
|
3567 /* look out for <t_>;> */
|
|
3568 if (arg[1] == 't' && arg[2] == '_' && arg[3] && arg[4])
|
|
3569 len = 5;
|
|
3570 else
|
|
3571 {
|
|
3572 len = 1;
|
|
3573 while (arg[len] != NUL && arg[len] != '>')
|
|
3574 ++len;
|
|
3575 }
|
|
3576 if (arg[len] != '>')
|
|
3577 {
|
|
3578 errmsg = e_invarg;
|
|
3579 goto skip;
|
|
3580 }
|
|
3581 arg[len] = NUL; /* put NUL after name */
|
|
3582 if (arg[1] == 't' && arg[2] == '_') /* could be term code */
|
|
3583 opt_idx = findoption(arg + 1);
|
|
3584 arg[len++] = '>'; /* restore '>' */
|
|
3585 if (opt_idx == -1)
|
|
3586 key = find_key_option(arg + 1);
|
|
3587 }
|
|
3588 else
|
|
3589 {
|
|
3590 len = 0;
|
|
3591 /*
|
|
3592 * The two characters after "t_" may not be alphanumeric.
|
|
3593 */
|
|
3594 if (arg[0] == 't' && arg[1] == '_' && arg[2] && arg[3])
|
|
3595 len = 4;
|
|
3596 else
|
|
3597 while (ASCII_ISALNUM(arg[len]) || arg[len] == '_')
|
|
3598 ++len;
|
|
3599 nextchar = arg[len];
|
|
3600 arg[len] = NUL; /* put NUL after name */
|
|
3601 opt_idx = findoption(arg);
|
|
3602 arg[len] = nextchar; /* restore nextchar */
|
|
3603 if (opt_idx == -1)
|
|
3604 key = find_key_option(arg);
|
|
3605 }
|
|
3606
|
|
3607 /* remember character after option name */
|
|
3608 afterchar = arg[len];
|
|
3609
|
|
3610 /* skip white space, allow ":set ai ?" */
|
|
3611 while (vim_iswhite(arg[len]))
|
|
3612 ++len;
|
|
3613
|
|
3614 adding = FALSE;
|
|
3615 prepending = FALSE;
|
|
3616 removing = FALSE;
|
|
3617 if (arg[len] != NUL && arg[len + 1] == '=')
|
|
3618 {
|
|
3619 if (arg[len] == '+')
|
|
3620 {
|
|
3621 adding = TRUE; /* "+=" */
|
|
3622 ++len;
|
|
3623 }
|
|
3624 else if (arg[len] == '^')
|
|
3625 {
|
|
3626 prepending = TRUE; /* "^=" */
|
|
3627 ++len;
|
|
3628 }
|
|
3629 else if (arg[len] == '-')
|
|
3630 {
|
|
3631 removing = TRUE; /* "-=" */
|
|
3632 ++len;
|
|
3633 }
|
|
3634 }
|
|
3635 nextchar = arg[len];
|
|
3636
|
|
3637 if (opt_idx == -1 && key == 0) /* found a mismatch: skip */
|
|
3638 {
|
|
3639 errmsg = (char_u *)N_("E518: Unknown option");
|
|
3640 goto skip;
|
|
3641 }
|
|
3642
|
|
3643 if (opt_idx >= 0)
|
|
3644 {
|
|
3645 if (options[opt_idx].var == NULL) /* hidden option: skip */
|
|
3646 {
|
|
3647 /* Only give an error message when requesting the value of
|
|
3648 * a hidden option, ignore setting it. */
|
|
3649 if (vim_strchr((char_u *)"=:!&<", nextchar) == NULL
|
|
3650 && (!(options[opt_idx].flags & P_BOOL)
|
|
3651 || nextchar == '?'))
|
|
3652 errmsg = (char_u *)N_("E519: Option not supported");
|
|
3653 goto skip;
|
|
3654 }
|
|
3655
|
|
3656 flags = options[opt_idx].flags;
|
|
3657 varp = get_varp_scope(&(options[opt_idx]), opt_flags);
|
|
3658 }
|
|
3659 else
|
|
3660 {
|
|
3661 flags = P_STRING;
|
|
3662 if (key < 0)
|
|
3663 {
|
|
3664 key_name[0] = KEY2TERMCAP0(key);
|
|
3665 key_name[1] = KEY2TERMCAP1(key);
|
|
3666 }
|
|
3667 else
|
|
3668 {
|
|
3669 key_name[0] = KS_KEY;
|
|
3670 key_name[1] = (key & 0xff);
|
|
3671 }
|
|
3672 }
|
|
3673
|
|
3674 /* Disallow changing some options from modelines */
|
|
3675 if ((opt_flags & OPT_MODELINE) && (flags & P_SECURE))
|
|
3676 {
|
|
3677 errmsg = (char_u *)_("E520: Not allowed in a modeline");
|
|
3678 goto skip;
|
|
3679 }
|
|
3680
|
23
|
3681 /* Skip all options that are not window-local (used when showing
|
|
3682 * an already loaded buffer in a window). */
|
|
3683 if ((opt_flags & OPT_WINONLY)
|
|
3684 && (opt_idx < 0 || options[opt_idx].var != VAR_WIN))
|
|
3685 goto skip;
|
|
3686
|
7
|
3687 #ifdef HAVE_SANDBOX
|
|
3688 /* Disallow changing some options in the sandbox */
|
|
3689 if (sandbox > 0 && (flags & P_SECURE))
|
|
3690 {
|
|
3691 errmsg = (char_u *)_(e_sandbox);
|
|
3692 goto skip;
|
|
3693 }
|
|
3694 #endif
|
|
3695
|
|
3696 if (vim_strchr((char_u *)"?=:!&<", nextchar) != NULL)
|
|
3697 {
|
|
3698 arg += len;
|
|
3699 cp_val = p_cp;
|
|
3700 if (nextchar == '&' && arg[1] == 'v' && arg[2] == 'i')
|
|
3701 {
|
|
3702 if (arg[3] == 'm') /* "opt&vim": set to Vim default */
|
|
3703 {
|
|
3704 cp_val = FALSE;
|
|
3705 arg += 3;
|
|
3706 }
|
|
3707 else /* "opt&vi": set to Vi default */
|
|
3708 {
|
|
3709 cp_val = TRUE;
|
|
3710 arg += 2;
|
|
3711 }
|
|
3712 }
|
|
3713 if (vim_strchr((char_u *)"?!&<", nextchar) != NULL
|
|
3714 && arg[1] != NUL && !vim_iswhite(arg[1]))
|
|
3715 {
|
|
3716 errmsg = e_trailing;
|
|
3717 goto skip;
|
|
3718 }
|
|
3719 }
|
|
3720
|
|
3721 /*
|
|
3722 * allow '=' and ':' as MSDOS command.com allows only one
|
|
3723 * '=' character per "set" command line. grrr. (jw)
|
|
3724 */
|
|
3725 if (nextchar == '?'
|
|
3726 || (prefix == 1
|
|
3727 && vim_strchr((char_u *)"=:&<", nextchar) == NULL
|
|
3728 && !(flags & P_BOOL)))
|
|
3729 {
|
|
3730 /*
|
|
3731 * print value
|
|
3732 */
|
|
3733 if (did_show)
|
|
3734 msg_putchar('\n'); /* cursor below last one */
|
|
3735 else
|
|
3736 {
|
|
3737 gotocmdline(TRUE); /* cursor at status line */
|
|
3738 did_show = TRUE; /* remember that we did a line */
|
|
3739 }
|
|
3740 if (opt_idx >= 0)
|
|
3741 {
|
|
3742 showoneopt(&options[opt_idx], opt_flags);
|
|
3743 #ifdef FEAT_EVAL
|
|
3744 if (p_verbose > 0)
|
|
3745 {
|
|
3746 if (options[opt_idx].scriptID != 0)
|
|
3747 {
|
294
|
3748 verbose_enter();
|
7
|
3749 MSG_PUTS(_("\n\tLast set from "));
|
|
3750 MSG_PUTS(get_scriptname(options[opt_idx].scriptID));
|
294
|
3751 verbose_leave();
|
7
|
3752 }
|
|
3753 }
|
|
3754 #endif
|
|
3755 }
|
|
3756 else
|
|
3757 {
|
|
3758 char_u *p;
|
|
3759
|
|
3760 p = find_termcode(key_name);
|
|
3761 if (p == NULL)
|
|
3762 {
|
|
3763 errmsg = (char_u *)N_("E518: Unknown option");
|
|
3764 goto skip;
|
|
3765 }
|
|
3766 else
|
|
3767 (void)show_one_termcode(key_name, p, TRUE);
|
|
3768 }
|
|
3769 if (nextchar != '?'
|
|
3770 && nextchar != NUL && !vim_iswhite(afterchar))
|
|
3771 errmsg = e_trailing;
|
|
3772 }
|
|
3773 else
|
|
3774 {
|
|
3775 if (flags & P_BOOL) /* boolean */
|
|
3776 {
|
|
3777 if (nextchar == '=' || nextchar == ':')
|
|
3778 {
|
|
3779 errmsg = e_invarg;
|
|
3780 goto skip;
|
|
3781 }
|
|
3782
|
|
3783 /*
|
|
3784 * ":set opt!": invert
|
|
3785 * ":set opt&": reset to default value
|
|
3786 * ":set opt<": reset to global value
|
|
3787 */
|
|
3788 if (nextchar == '!')
|
|
3789 value = *(int *)(varp) ^ 1;
|
|
3790 else if (nextchar == '&')
|
|
3791 value = (int)(long)options[opt_idx].def_val[
|
|
3792 ((flags & P_VI_DEF) || cp_val)
|
|
3793 ? VI_DEFAULT : VIM_DEFAULT];
|
|
3794 else if (nextchar == '<')
|
|
3795 {
|
|
3796 /* For 'autoread' -1 means to use global value. */
|
|
3797 if ((int *)varp == &curbuf->b_p_ar
|
|
3798 && opt_flags == OPT_LOCAL)
|
|
3799 value = -1;
|
|
3800 else
|
|
3801 value = *(int *)get_varp_scope(&(options[opt_idx]),
|
|
3802 OPT_GLOBAL);
|
|
3803 }
|
|
3804 else
|
|
3805 {
|
|
3806 /*
|
|
3807 * ":set invopt": invert
|
|
3808 * ":set opt" or ":set noopt": set or reset
|
|
3809 */
|
|
3810 if (nextchar != NUL && !vim_iswhite(afterchar))
|
|
3811 {
|
|
3812 errmsg = e_trailing;
|
|
3813 goto skip;
|
|
3814 }
|
|
3815 if (prefix == 2) /* inv */
|
|
3816 value = *(int *)(varp) ^ 1;
|
|
3817 else
|
|
3818 value = prefix;
|
|
3819 }
|
|
3820
|
|
3821 errmsg = set_bool_option(opt_idx, varp, (int)value,
|
|
3822 opt_flags);
|
|
3823 }
|
|
3824 else /* numeric or string */
|
|
3825 {
|
|
3826 if (vim_strchr((char_u *)"=:&<", nextchar) == NULL
|
|
3827 || prefix != 1)
|
|
3828 {
|
|
3829 errmsg = e_invarg;
|
|
3830 goto skip;
|
|
3831 }
|
|
3832
|
|
3833 if (flags & P_NUM) /* numeric */
|
|
3834 {
|
|
3835 /*
|
|
3836 * Different ways to set a number option:
|
|
3837 * & set to default value
|
|
3838 * < set to global value
|
|
3839 * <xx> accept special key codes for 'wildchar'
|
|
3840 * c accept any non-digit for 'wildchar'
|
|
3841 * [-]0-9 set number
|
|
3842 * other error
|
|
3843 */
|
|
3844 ++arg;
|
|
3845 if (nextchar == '&')
|
|
3846 value = (long)options[opt_idx].def_val[
|
|
3847 ((flags & P_VI_DEF) || cp_val)
|
|
3848 ? VI_DEFAULT : VIM_DEFAULT];
|
|
3849 else if (nextchar == '<')
|
|
3850 value = *(long *)get_varp_scope(&(options[opt_idx]),
|
|
3851 OPT_GLOBAL);
|
|
3852 else if (((long *)varp == &p_wc
|
|
3853 || (long *)varp == &p_wcm)
|
|
3854 && (*arg == '<'
|
|
3855 || *arg == '^'
|
|
3856 || ((!arg[1] || vim_iswhite(arg[1]))
|
|
3857 && !VIM_ISDIGIT(*arg))))
|
|
3858 {
|
|
3859 value = string_to_key(arg);
|
|
3860 if (value == 0 && (long *)varp != &p_wcm)
|
|
3861 {
|
|
3862 errmsg = e_invarg;
|
|
3863 goto skip;
|
|
3864 }
|
|
3865 }
|
|
3866 /* allow negative numbers (for 'undolevels') */
|
|
3867 else if (*arg == '-' || VIM_ISDIGIT(*arg))
|
|
3868 {
|
|
3869 i = 0;
|
|
3870 if (*arg == '-')
|
|
3871 i = 1;
|
|
3872 #ifdef HAVE_STRTOL
|
|
3873 value = strtol((char *)arg, NULL, 0);
|
|
3874 if (arg[i] == '0' && TOLOWER_ASC(arg[i + 1]) == 'x')
|
|
3875 i += 2;
|
|
3876 #else
|
|
3877 value = atol((char *)arg);
|
|
3878 #endif
|
|
3879 while (VIM_ISDIGIT(arg[i]))
|
|
3880 ++i;
|
|
3881 if (arg[i] != NUL && !vim_iswhite(arg[i]))
|
|
3882 {
|
|
3883 errmsg = e_invarg;
|
|
3884 goto skip;
|
|
3885 }
|
|
3886 }
|
|
3887 else
|
|
3888 {
|
|
3889 errmsg = (char_u *)N_("E521: Number required after =");
|
|
3890 goto skip;
|
|
3891 }
|
|
3892
|
|
3893 if (adding)
|
|
3894 value = *(long *)varp + value;
|
|
3895 if (prepending)
|
|
3896 value = *(long *)varp * value;
|
|
3897 if (removing)
|
|
3898 value = *(long *)varp - value;
|
|
3899 errmsg = set_num_option(opt_idx, varp, value,
|
274
|
3900 errbuf, sizeof(errbuf), opt_flags);
|
7
|
3901 }
|
|
3902 else if (opt_idx >= 0) /* string */
|
|
3903 {
|
|
3904 char_u *save_arg = NULL;
|
|
3905 char_u *s = NULL;
|
|
3906 char_u *oldval; /* previous value if *varp */
|
|
3907 char_u *newval;
|
|
3908 char_u *origval;
|
|
3909 unsigned newlen;
|
|
3910 int comma;
|
|
3911 int bs;
|
|
3912 int new_value_alloced; /* new string option
|
|
3913 was allocated */
|
|
3914
|
|
3915 /* When using ":set opt=val" for a global option
|
|
3916 * with a local value the local value will be
|
|
3917 * reset, use the global value here. */
|
|
3918 if ((opt_flags & (OPT_LOCAL | OPT_GLOBAL)) == 0
|
|
3919 && (int)options[opt_idx].indir >= PV_BOTH)
|
|
3920 varp = options[opt_idx].var;
|
|
3921
|
|
3922 /* The old value is kept until we are sure that the
|
|
3923 * new value is valid. */
|
|
3924 oldval = *(char_u **)varp;
|
|
3925 if (nextchar == '&') /* set to default val */
|
|
3926 {
|
|
3927 newval = options[opt_idx].def_val[
|
|
3928 ((flags & P_VI_DEF) || cp_val)
|
|
3929 ? VI_DEFAULT : VIM_DEFAULT];
|
|
3930 if ((char_u **)varp == &p_bg)
|
|
3931 {
|
|
3932 /* guess the value of 'background' */
|
|
3933 #ifdef FEAT_GUI
|
|
3934 if (gui.in_use)
|
|
3935 newval = gui_bg_default();
|
|
3936 else
|
|
3937 #endif
|
|
3938 if (STRCMP(T_NAME, "linux") == 0)
|
|
3939 newval = (char_u *)"dark";
|
|
3940 }
|
|
3941
|
|
3942 /* expand environment variables and ~ (since the
|
|
3943 * default value was already expanded, only
|
|
3944 * required when an environment variable was set
|
|
3945 * later */
|
|
3946 if (newval == NULL)
|
|
3947 newval = empty_option;
|
|
3948 else
|
|
3949 {
|
|
3950 s = option_expand(opt_idx, newval);
|
|
3951 if (s == NULL)
|
|
3952 s = newval;
|
|
3953 newval = vim_strsave(s);
|
|
3954 }
|
|
3955 new_value_alloced = TRUE;
|
|
3956 }
|
|
3957 else if (nextchar == '<') /* set to global val */
|
|
3958 {
|
|
3959 newval = vim_strsave(*(char_u **)get_varp_scope(
|
|
3960 &(options[opt_idx]), OPT_GLOBAL));
|
|
3961 new_value_alloced = TRUE;
|
|
3962 }
|
|
3963 else
|
|
3964 {
|
|
3965 ++arg; /* jump to after the '=' or ':' */
|
|
3966
|
|
3967 /*
|
|
3968 * Set 'keywordprg' to ":help" if an empty
|
|
3969 * value was passed to :set by the user.
|
|
3970 * Misuse errbuf[] for the resulting string.
|
|
3971 */
|
|
3972 if (varp == (char_u *)&p_kp
|
|
3973 && (*arg == NUL || *arg == ' '))
|
|
3974 {
|
|
3975 STRCPY(errbuf, ":help");
|
|
3976 save_arg = arg;
|
|
3977 arg = errbuf;
|
|
3978 }
|
|
3979 /*
|
|
3980 * Convert 'whichwrap' number to string, for
|
|
3981 * backwards compatibility with Vim 3.0.
|
|
3982 * Misuse errbuf[] for the resulting string.
|
|
3983 */
|
|
3984 else if (varp == (char_u *)&p_ww
|
|
3985 && VIM_ISDIGIT(*arg))
|
|
3986 {
|
|
3987 *errbuf = NUL;
|
|
3988 i = getdigits(&arg);
|
|
3989 if (i & 1)
|
|
3990 STRCAT(errbuf, "b,");
|
|
3991 if (i & 2)
|
|
3992 STRCAT(errbuf, "s,");
|
|
3993 if (i & 4)
|
|
3994 STRCAT(errbuf, "h,l,");
|
|
3995 if (i & 8)
|
|
3996 STRCAT(errbuf, "<,>,");
|
|
3997 if (i & 16)
|
|
3998 STRCAT(errbuf, "[,],");
|
|
3999 if (*errbuf != NUL) /* remove trailing , */
|
|
4000 errbuf[STRLEN(errbuf) - 1] = NUL;
|
|
4001 save_arg = arg;
|
|
4002 arg = errbuf;
|
|
4003 }
|
|
4004 /*
|
|
4005 * Remove '>' before 'dir' and 'bdir', for
|
|
4006 * backwards compatibility with version 3.0
|
|
4007 */
|
|
4008 else if ( *arg == '>'
|
|
4009 && (varp == (char_u *)&p_dir
|
|
4010 || varp == (char_u *)&p_bdir))
|
|
4011 {
|
|
4012 ++arg;
|
|
4013 }
|
|
4014
|
|
4015 /* When setting the local value of a global
|
|
4016 * option, the old value may be the global value. */
|
|
4017 if ((int)options[opt_idx].indir >= PV_BOTH
|
|
4018 && (opt_flags & OPT_LOCAL))
|
|
4019 origval = *(char_u **)get_varp(
|
|
4020 &options[opt_idx]);
|
|
4021 else
|
|
4022 origval = oldval;
|
|
4023
|
|
4024 /*
|
|
4025 * Copy the new string into allocated memory.
|
|
4026 * Can't use set_string_option_direct(), because
|
|
4027 * we need to remove the backslashes.
|
|
4028 */
|
|
4029 /* get a bit too much */
|
|
4030 newlen = (unsigned)STRLEN(arg) + 1;
|
|
4031 if (adding || prepending || removing)
|
|
4032 newlen += (unsigned)STRLEN(origval) + 1;
|
|
4033 newval = alloc(newlen);
|
|
4034 if (newval == NULL) /* out of mem, don't change */
|
|
4035 break;
|
|
4036 s = newval;
|
|
4037
|
|
4038 /*
|
|
4039 * Copy the string, skip over escaped chars.
|
|
4040 * For MS-DOS and WIN32 backslashes before normal
|
|
4041 * file name characters are not removed, and keep
|
|
4042 * backslash at start, for "\\machine\path", but
|
|
4043 * do remove it for "\\\\machine\\path".
|
|
4044 * The reverse is found in ExpandOldSetting().
|
|
4045 */
|
|
4046 while (*arg && !vim_iswhite(*arg))
|
|
4047 {
|
|
4048 if (*arg == '\\' && arg[1] != NUL
|
|
4049 #ifdef BACKSLASH_IN_FILENAME
|
|
4050 && !((flags & P_EXPAND)
|
|
4051 && vim_isfilec(arg[1])
|
|
4052 && (arg[1] != '\\'
|
|
4053 || (s == newval
|
|
4054 && arg[2] != '\\')))
|
|
4055 #endif
|
|
4056 )
|
|
4057 ++arg; /* remove backslash */
|
|
4058 #ifdef FEAT_MBYTE
|
|
4059 if (has_mbyte
|
|
4060 && (i = (*mb_ptr2len_check)(arg)) > 1)
|
|
4061 {
|
|
4062 /* copy multibyte char */
|
|
4063 mch_memmove(s, arg, (size_t)i);
|
|
4064 arg += i;
|
|
4065 s += i;
|
|
4066 }
|
|
4067 else
|
|
4068 #endif
|
|
4069 *s++ = *arg++;
|
|
4070 }
|
|
4071 *s = NUL;
|
|
4072
|
|
4073 /*
|
|
4074 * Expand environment variables and ~.
|
|
4075 * Don't do it when adding without inserting a
|
|
4076 * comma.
|
|
4077 */
|
|
4078 if (!(adding || prepending || removing)
|
|
4079 || (flags & P_COMMA))
|
|
4080 {
|
|
4081 s = option_expand(opt_idx, newval);
|
|
4082 if (s != NULL)
|
|
4083 {
|
|
4084 vim_free(newval);
|
|
4085 newlen = (unsigned)STRLEN(s) + 1;
|
|
4086 if (adding || prepending || removing)
|
|
4087 newlen += (unsigned)STRLEN(origval) + 1;
|
|
4088 newval = alloc(newlen);
|
|
4089 if (newval == NULL)
|
|
4090 break;
|
|
4091 STRCPY(newval, s);
|
|
4092 }
|
|
4093 }
|
|
4094
|
|
4095 /* locate newval[] in origval[] when removing it
|
|
4096 * and when adding to avoid duplicates */
|
|
4097 i = 0; /* init for GCC */
|
|
4098 if (removing || (flags & P_NODUP))
|
|
4099 {
|
|
4100 i = (int)STRLEN(newval);
|
|
4101 bs = 0;
|
|
4102 for (s = origval; *s; ++s)
|
|
4103 {
|
|
4104 if ((!(flags & P_COMMA)
|
|
4105 || s == origval
|
|
4106 || (s[-1] == ',' && !(bs & 1)))
|
|
4107 && STRNCMP(s, newval, i) == 0
|
|
4108 && (!(flags & P_COMMA)
|
|
4109 || s[i] == ','
|
|
4110 || s[i] == NUL))
|
|
4111 break;
|
|
4112 /* Count backspaces. Only a comma with an
|
|
4113 * even number of backspaces before it is
|
|
4114 * recognized as a separator */
|
|
4115 if (s > origval && s[-1] == '\\')
|
|
4116 ++bs;
|
|
4117 else
|
|
4118 bs = 0;
|
|
4119 }
|
|
4120
|
|
4121 /* do not add if already there */
|
|
4122 if ((adding || prepending) && *s)
|
|
4123 {
|
|
4124 prepending = FALSE;
|
|
4125 adding = FALSE;
|
|
4126 STRCPY(newval, origval);
|
|
4127 }
|
|
4128 }
|
|
4129
|
|
4130 /* concatenate the two strings; add a ',' if
|
|
4131 * needed */
|
|
4132 if (adding || prepending)
|
|
4133 {
|
|
4134 comma = ((flags & P_COMMA) && *origval != NUL
|
|
4135 && *newval != NUL);
|
|
4136 if (adding)
|
|
4137 {
|
|
4138 i = (int)STRLEN(origval);
|
|
4139 mch_memmove(newval + i + comma, newval,
|
|
4140 STRLEN(newval) + 1);
|
|
4141 mch_memmove(newval, origval, (size_t)i);
|
|
4142 }
|
|
4143 else
|
|
4144 {
|
|
4145 i = (int)STRLEN(newval);
|
|
4146 mch_memmove(newval + i + comma, origval,
|
|
4147 STRLEN(origval) + 1);
|
|
4148 }
|
|
4149 if (comma)
|
|
4150 newval[i] = ',';
|
|
4151 }
|
|
4152
|
|
4153 /* Remove newval[] from origval[]. (Note: "i" has
|
|
4154 * been set above and is used here). */
|
|
4155 if (removing)
|
|
4156 {
|
|
4157 STRCPY(newval, origval);
|
|
4158 if (*s)
|
|
4159 {
|
|
4160 /* may need to remove a comma */
|
|
4161 if (flags & P_COMMA)
|
|
4162 {
|
|
4163 if (s == origval)
|
|
4164 {
|
|
4165 /* include comma after string */
|
|
4166 if (s[i] == ',')
|
|
4167 ++i;
|
|
4168 }
|
|
4169 else
|
|
4170 {
|
|
4171 /* include comma before string */
|
|
4172 --s;
|
|
4173 ++i;
|
|
4174 }
|
|
4175 }
|
|
4176 mch_memmove(newval + (s - origval), s + i,
|
|
4177 STRLEN(s + i) + 1);
|
|
4178 }
|
|
4179 }
|
|
4180
|
|
4181 if (flags & P_FLAGLIST)
|
|
4182 {
|
|
4183 /* Remove flags that appear twice. */
|
|
4184 for (s = newval; *s; ++s)
|
|
4185 if ((!(flags & P_COMMA) || *s != ',')
|
|
4186 && vim_strchr(s + 1, *s) != NULL)
|
|
4187 {
|
|
4188 STRCPY(s, s + 1);
|
|
4189 --s;
|
|
4190 }
|
|
4191 }
|
|
4192
|
|
4193 if (save_arg != NULL) /* number for 'whichwrap' */
|
|
4194 arg = save_arg;
|
|
4195 new_value_alloced = TRUE;
|
|
4196 }
|
|
4197
|
|
4198 /* Set the new value. */
|
|
4199 *(char_u **)(varp) = newval;
|
|
4200
|
|
4201 /* Handle side effects, and set the global value for
|
|
4202 * ":set" on local options. */
|
|
4203 errmsg = did_set_string_option(opt_idx, (char_u **)varp,
|
|
4204 new_value_alloced, oldval, errbuf, opt_flags);
|
|
4205
|
|
4206 /* If error detected, print the error message. */
|
|
4207 if (errmsg != NULL)
|
|
4208 goto skip;
|
|
4209 }
|
|
4210 else /* key code option */
|
|
4211 {
|
|
4212 char_u *p;
|
|
4213
|
|
4214 if (nextchar == '&')
|
|
4215 {
|
|
4216 if (add_termcap_entry(key_name, TRUE) == FAIL)
|
|
4217 errmsg = (char_u *)N_("E522: Not found in termcap");
|
|
4218 }
|
|
4219 else
|
|
4220 {
|
|
4221 ++arg; /* jump to after the '=' or ':' */
|
|
4222 for (p = arg; *p && !vim_iswhite(*p); ++p)
|
|
4223 if (*p == '\\' && p[1] != NUL)
|
|
4224 ++p;
|
|
4225 nextchar = *p;
|
|
4226 *p = NUL;
|
|
4227 add_termcode(key_name, arg, FALSE);
|
|
4228 *p = nextchar;
|
|
4229 }
|
|
4230 if (full_screen)
|
|
4231 ttest(FALSE);
|
|
4232 redraw_all_later(CLEAR);
|
|
4233 }
|
|
4234 }
|
|
4235 if (opt_idx >= 0)
|
|
4236 options[opt_idx].flags |= P_WAS_SET;
|
|
4237 }
|
|
4238
|
|
4239 skip:
|
|
4240 /*
|
|
4241 * Advance to next argument.
|
|
4242 * - skip until a blank found, taking care of backslashes
|
|
4243 * - skip blanks
|
|
4244 * - skip one "=val" argument (for hidden options ":set gfn =xx")
|
|
4245 */
|
|
4246 for (i = 0; i < 2 ; ++i)
|
|
4247 {
|
|
4248 while (*arg != NUL && !vim_iswhite(*arg))
|
|
4249 if (*arg++ == '\\' && *arg != NUL)
|
|
4250 ++arg;
|
|
4251 arg = skipwhite(arg);
|
|
4252 if (*arg != '=')
|
|
4253 break;
|
|
4254 }
|
|
4255 }
|
|
4256
|
|
4257 if (errmsg != NULL)
|
|
4258 {
|
|
4259 STRNCPY(IObuff, _(errmsg), IOSIZE - 1);
|
|
4260 IObuff[IOSIZE - 1] = NUL;
|
|
4261 i = STRLEN(IObuff) + 2;
|
|
4262 if (i + (arg - startarg) < IOSIZE)
|
|
4263 {
|
|
4264 /* append the argument with the error */
|
|
4265 STRCAT(IObuff, ": ");
|
|
4266 mch_memmove(IObuff + i, startarg, (arg - startarg));
|
|
4267 IObuff[i + (arg - startarg)] = NUL;
|
|
4268 }
|
|
4269 /* make sure all characters are printable */
|
|
4270 trans_characters(IObuff, IOSIZE);
|
|
4271
|
|
4272 ++no_wait_return; /* wait_return done later */
|
|
4273 emsg(IObuff); /* show error highlighted */
|
|
4274 --no_wait_return;
|
|
4275
|
|
4276 return FAIL;
|
|
4277 }
|
|
4278
|
|
4279 arg = skipwhite(arg);
|
|
4280 }
|
|
4281
|
168
|
4282 theend:
|
|
4283 if (silent_mode && did_show)
|
|
4284 {
|
|
4285 /* After displaying option values in silent mode. */
|
|
4286 silent_mode = FALSE;
|
|
4287 info_message = TRUE; /* use mch_msg(), not mch_errmsg() */
|
|
4288 msg_putchar('\n');
|
|
4289 cursor_on(); /* msg_start() switches it off */
|
|
4290 out_flush();
|
|
4291 silent_mode = TRUE;
|
|
4292 info_message = FALSE; /* use mch_msg(), not mch_errmsg() */
|
|
4293 }
|
|
4294
|
7
|
4295 return OK;
|
|
4296 }
|
|
4297
|
|
4298 static char_u *
|
|
4299 illegal_char(errbuf, c)
|
|
4300 char_u *errbuf;
|
|
4301 int c;
|
|
4302 {
|
|
4303 if (errbuf == NULL)
|
|
4304 return (char_u *)"";
|
|
4305 sprintf((char *)errbuf, _("E539: Illegal character <%s>"),
|
274
|
4306 (char *)transchar(c));
|
7
|
4307 return errbuf;
|
|
4308 }
|
|
4309
|
|
4310 /*
|
|
4311 * Convert a key name or string into a key value.
|
|
4312 * Used for 'wildchar' and 'cedit' options.
|
|
4313 */
|
|
4314 static int
|
|
4315 string_to_key(arg)
|
|
4316 char_u *arg;
|
|
4317 {
|
|
4318 if (*arg == '<')
|
|
4319 return find_key_option(arg + 1);
|
|
4320 if (*arg == '^')
|
|
4321 return Ctrl_chr(arg[1]);
|
|
4322 return *arg;
|
|
4323 }
|
|
4324
|
|
4325 #ifdef FEAT_CMDWIN
|
|
4326 /*
|
|
4327 * Check value of 'cedit' and set cedit_key.
|
|
4328 * Returns NULL if value is OK, error message otherwise.
|
|
4329 */
|
|
4330 static char_u *
|
|
4331 check_cedit()
|
|
4332 {
|
|
4333 int n;
|
|
4334
|
|
4335 if (*p_cedit == NUL)
|
|
4336 cedit_key = -1;
|
|
4337 else
|
|
4338 {
|
|
4339 n = string_to_key(p_cedit);
|
|
4340 if (vim_isprintc(n))
|
|
4341 return e_invarg;
|
|
4342 cedit_key = n;
|
|
4343 }
|
|
4344 return NULL;
|
|
4345 }
|
|
4346 #endif
|
|
4347
|
|
4348 #ifdef FEAT_TITLE
|
|
4349 /*
|
|
4350 * When changing 'title', 'titlestring', 'icon' or 'iconstring', call
|
|
4351 * maketitle() to create and display it.
|
|
4352 * When switching the title or icon off, call mch_restore_title() to get
|
|
4353 * the old value back.
|
|
4354 */
|
|
4355 static void
|
|
4356 did_set_title(icon)
|
|
4357 int icon; /* Did set icon instead of title */
|
|
4358 {
|
|
4359 if (starting != NO_SCREEN
|
|
4360 #ifdef FEAT_GUI
|
|
4361 && !gui.starting
|
|
4362 #endif
|
|
4363 )
|
|
4364 {
|
|
4365 maketitle();
|
|
4366 if (icon)
|
|
4367 {
|
|
4368 if (!p_icon)
|
|
4369 mch_restore_title(2);
|
|
4370 }
|
|
4371 else
|
|
4372 {
|
|
4373 if (!p_title)
|
|
4374 mch_restore_title(1);
|
|
4375 }
|
|
4376 }
|
|
4377 }
|
|
4378 #endif
|
|
4379
|
|
4380 /*
|
|
4381 * set_options_bin - called when 'bin' changes value.
|
|
4382 */
|
|
4383 void
|
|
4384 set_options_bin(oldval, newval, opt_flags)
|
|
4385 int oldval;
|
|
4386 int newval;
|
|
4387 int opt_flags; /* OPT_LOCAL and/or OPT_GLOBAL */
|
|
4388 {
|
|
4389 /*
|
|
4390 * The option values that are changed when 'bin' changes are
|
|
4391 * copied when 'bin is set and restored when 'bin' is reset.
|
|
4392 */
|
|
4393 if (newval)
|
|
4394 {
|
|
4395 if (!oldval) /* switched on */
|
|
4396 {
|
|
4397 if (!(opt_flags & OPT_GLOBAL))
|
|
4398 {
|
|
4399 curbuf->b_p_tw_nobin = curbuf->b_p_tw;
|
|
4400 curbuf->b_p_wm_nobin = curbuf->b_p_wm;
|
|
4401 curbuf->b_p_ml_nobin = curbuf->b_p_ml;
|
|
4402 curbuf->b_p_et_nobin = curbuf->b_p_et;
|
|
4403 }
|
|
4404 if (!(opt_flags & OPT_LOCAL))
|
|
4405 {
|
|
4406 p_tw_nobin = p_tw;
|
|
4407 p_wm_nobin = p_wm;
|
|
4408 p_ml_nobin = p_ml;
|
|
4409 p_et_nobin = p_et;
|
|
4410 }
|
|
4411 }
|
|
4412
|
|
4413 if (!(opt_flags & OPT_GLOBAL))
|
|
4414 {
|
|
4415 curbuf->b_p_tw = 0; /* no automatic line wrap */
|
|
4416 curbuf->b_p_wm = 0; /* no automatic line wrap */
|
|
4417 curbuf->b_p_ml = 0; /* no modelines */
|
|
4418 curbuf->b_p_et = 0; /* no expandtab */
|
|
4419 }
|
|
4420 if (!(opt_flags & OPT_LOCAL))
|
|
4421 {
|
|
4422 p_tw = 0;
|
|
4423 p_wm = 0;
|
|
4424 p_ml = FALSE;
|
|
4425 p_et = FALSE;
|
|
4426 p_bin = TRUE; /* needed when called for the "-b" argument */
|
|
4427 }
|
|
4428 }
|
|
4429 else if (oldval) /* switched off */
|
|
4430 {
|
|
4431 if (!(opt_flags & OPT_GLOBAL))
|
|
4432 {
|
|
4433 curbuf->b_p_tw = curbuf->b_p_tw_nobin;
|
|
4434 curbuf->b_p_wm = curbuf->b_p_wm_nobin;
|
|
4435 curbuf->b_p_ml = curbuf->b_p_ml_nobin;
|
|
4436 curbuf->b_p_et = curbuf->b_p_et_nobin;
|
|
4437 }
|
|
4438 if (!(opt_flags & OPT_LOCAL))
|
|
4439 {
|
|
4440 p_tw = p_tw_nobin;
|
|
4441 p_wm = p_wm_nobin;
|
|
4442 p_ml = p_ml_nobin;
|
|
4443 p_et = p_et_nobin;
|
|
4444 }
|
|
4445 }
|
|
4446 }
|
|
4447
|
|
4448 #ifdef FEAT_VIMINFO
|
|
4449 /*
|
|
4450 * Find the parameter represented by the given character (eg ', :, ", or /),
|
|
4451 * and return its associated value in the 'viminfo' string.
|
|
4452 * Only works for number parameters, not for 'r' or 'n'.
|
23
|
4453 * If the parameter is not specified in the string or there is no following
|
|
4454 * number, return -1.
|
7
|
4455 */
|
|
4456 int
|
|
4457 get_viminfo_parameter(type)
|
|
4458 int type;
|
|
4459 {
|
|
4460 char_u *p;
|
|
4461
|
|
4462 p = find_viminfo_parameter(type);
|
|
4463 if (p != NULL && VIM_ISDIGIT(*p))
|
|
4464 return atoi((char *)p);
|
|
4465 return -1;
|
|
4466 }
|
|
4467
|
|
4468 /*
|
|
4469 * Find the parameter represented by the given character (eg ''', ':', '"', or
|
|
4470 * '/') in the 'viminfo' option and return a pointer to the string after it.
|
|
4471 * Return NULL if the parameter is not specified in the string.
|
|
4472 */
|
|
4473 char_u *
|
|
4474 find_viminfo_parameter(type)
|
|
4475 int type;
|
|
4476 {
|
|
4477 char_u *p;
|
|
4478
|
|
4479 for (p = p_viminfo; *p; ++p)
|
|
4480 {
|
|
4481 if (*p == type)
|
|
4482 return p + 1;
|
|
4483 if (*p == 'n') /* 'n' is always the last one */
|
|
4484 break;
|
|
4485 p = vim_strchr(p, ','); /* skip until next ',' */
|
|
4486 if (p == NULL) /* hit the end without finding parameter */
|
|
4487 break;
|
|
4488 }
|
|
4489 return NULL;
|
|
4490 }
|
|
4491 #endif
|
|
4492
|
|
4493 /*
|
|
4494 * Expand environment variables for some string options.
|
|
4495 * These string options cannot be indirect!
|
|
4496 * If "val" is NULL expand the current value of the option.
|
|
4497 * Return pointer to NameBuff, or NULL when not expanded.
|
|
4498 */
|
|
4499 static char_u *
|
|
4500 option_expand(opt_idx, val)
|
|
4501 int opt_idx;
|
|
4502 char_u *val;
|
|
4503 {
|
|
4504 /* if option doesn't need expansion nothing to do */
|
|
4505 if (!(options[opt_idx].flags & P_EXPAND) || options[opt_idx].var == NULL)
|
|
4506 return NULL;
|
|
4507
|
|
4508 /* If val is longer than MAXPATHL no meaningful expansion can be done,
|
|
4509 * expand_env() would truncate the string. */
|
|
4510 if (val != NULL && STRLEN(val) > MAXPATHL)
|
|
4511 return NULL;
|
|
4512
|
|
4513 if (val == NULL)
|
|
4514 val = *(char_u **)options[opt_idx].var;
|
|
4515
|
|
4516 /*
|
|
4517 * Expanding this with NameBuff, expand_env() must not be passed IObuff.
|
|
4518 * Escape spaces when expanding 'tags', they are used to separate file
|
|
4519 * names.
|
|
4520 */
|
|
4521 expand_env_esc(val, NameBuff, MAXPATHL,
|
|
4522 (char_u **)options[opt_idx].var == &p_tags);
|
|
4523 if (STRCMP(NameBuff, val) == 0) /* they are the same */
|
|
4524 return NULL;
|
|
4525
|
|
4526 return NameBuff;
|
|
4527 }
|
|
4528
|
|
4529 /*
|
|
4530 * After setting various option values: recompute variables that depend on
|
|
4531 * option values.
|
|
4532 */
|
|
4533 static void
|
|
4534 didset_options()
|
|
4535 {
|
|
4536 /* initialize the table for 'iskeyword' et.al. */
|
|
4537 (void)init_chartab();
|
|
4538
|
|
4539 (void)opt_strings_flags(p_cmp, p_cmp_values, &cmp_flags, TRUE);
|
|
4540 (void)opt_strings_flags(p_bkc, p_bkc_values, &bkc_flags, TRUE);
|
|
4541 #ifdef FEAT_SESSION
|
|
4542 (void)opt_strings_flags(p_ssop, p_ssop_values, &ssop_flags, TRUE);
|
|
4543 (void)opt_strings_flags(p_vop, p_ssop_values, &vop_flags, TRUE);
|
|
4544 #endif
|
|
4545 #ifdef FEAT_FOLDING
|
|
4546 (void)opt_strings_flags(p_fdo, p_fdo_values, &fdo_flags, TRUE);
|
|
4547 #endif
|
|
4548 (void)opt_strings_flags(p_dy, p_dy_values, &dy_flags, TRUE);
|
|
4549 #ifdef FEAT_VIRTUALEDIT
|
|
4550 (void)opt_strings_flags(p_ve, p_ve_values, &ve_flags, TRUE);
|
|
4551 #endif
|
|
4552 #if defined(FEAT_MOUSE) && (defined(UNIX) || defined(VMS))
|
|
4553 (void)opt_strings_flags(p_ttym, p_ttym_values, &ttym_flags, FALSE);
|
|
4554 #endif
|
|
4555 #if defined(FEAT_TOOLBAR) && !defined(FEAT_GUI_W32)
|
|
4556 (void)opt_strings_flags(p_toolbar, p_toolbar_values, &toolbar_flags, TRUE);
|
|
4557 #endif
|
|
4558 #if defined(FEAT_TOOLBAR) && defined(FEAT_GUI_GTK) && defined(HAVE_GTK2)
|
|
4559 (void)opt_strings_flags(p_tbis, p_tbis_values, &tbis_flags, FALSE);
|
|
4560 #endif
|
|
4561 #ifdef FEAT_CMDWIN
|
|
4562 /* set cedit_key */
|
|
4563 (void)check_cedit();
|
|
4564 #endif
|
|
4565 }
|
|
4566
|
|
4567 /*
|
|
4568 * Check for string options that are NULL (normally only termcap options).
|
|
4569 */
|
|
4570 void
|
|
4571 check_options()
|
|
4572 {
|
|
4573 int opt_idx;
|
|
4574
|
|
4575 for (opt_idx = 0; options[opt_idx].fullname != NULL; opt_idx++)
|
|
4576 if ((options[opt_idx].flags & P_STRING) && options[opt_idx].var != NULL)
|
|
4577 check_string_option((char_u **)get_varp(&(options[opt_idx])));
|
|
4578 }
|
|
4579
|
|
4580 /*
|
|
4581 * Check string options in a buffer for NULL value.
|
|
4582 */
|
|
4583 void
|
|
4584 check_buf_options(buf)
|
|
4585 buf_T *buf;
|
|
4586 {
|
|
4587 #if defined(FEAT_QUICKFIX)
|
|
4588 check_string_option(&buf->b_p_bh);
|
|
4589 check_string_option(&buf->b_p_bt);
|
|
4590 #endif
|
|
4591 #ifdef FEAT_MBYTE
|
|
4592 check_string_option(&buf->b_p_fenc);
|
|
4593 #endif
|
|
4594 check_string_option(&buf->b_p_ff);
|
|
4595 #ifdef FEAT_FIND_ID
|
|
4596 check_string_option(&buf->b_p_def);
|
|
4597 check_string_option(&buf->b_p_inc);
|
|
4598 # ifdef FEAT_EVAL
|
|
4599 check_string_option(&buf->b_p_inex);
|
|
4600 # endif
|
|
4601 #endif
|
|
4602 #if defined(FEAT_CINDENT) && defined(FEAT_EVAL)
|
|
4603 check_string_option(&buf->b_p_inde);
|
|
4604 check_string_option(&buf->b_p_indk);
|
|
4605 #endif
|
|
4606 #ifdef FEAT_CRYPT
|
|
4607 check_string_option(&buf->b_p_key);
|
|
4608 #endif
|
|
4609 check_string_option(&buf->b_p_kp);
|
|
4610 check_string_option(&buf->b_p_mps);
|
|
4611 check_string_option(&buf->b_p_fo);
|
41
|
4612 check_string_option(&buf->b_p_flp);
|
7
|
4613 check_string_option(&buf->b_p_isk);
|
|
4614 #ifdef FEAT_COMMENTS
|
|
4615 check_string_option(&buf->b_p_com);
|
|
4616 #endif
|
|
4617 #ifdef FEAT_FOLDING
|
|
4618 check_string_option(&buf->b_p_cms);
|
|
4619 #endif
|
|
4620 check_string_option(&buf->b_p_nf);
|
12
|
4621 #ifdef FEAT_TEXTOBJ
|
|
4622 check_string_option(&buf->b_p_qe);
|
|
4623 #endif
|
7
|
4624 #ifdef FEAT_SYN_HL
|
|
4625 check_string_option(&buf->b_p_syn);
|
314
|
4626 check_string_option(&buf->b_p_spf);
|
221
|
4627 check_string_option(&buf->b_p_spl);
|
7
|
4628 #endif
|
|
4629 #ifdef FEAT_SEARCHPATH
|
|
4630 check_string_option(&buf->b_p_sua);
|
|
4631 #endif
|
|
4632 #ifdef FEAT_CINDENT
|
|
4633 check_string_option(&buf->b_p_cink);
|
|
4634 check_string_option(&buf->b_p_cino);
|
|
4635 #endif
|
|
4636 #ifdef FEAT_AUTOCMD
|
|
4637 check_string_option(&buf->b_p_ft);
|
|
4638 #endif
|
|
4639 #ifdef FEAT_OSFILETYPE
|
|
4640 check_string_option(&buf->b_p_oft);
|
|
4641 #endif
|
|
4642 #if defined(FEAT_SMARTINDENT) || defined(FEAT_CINDENT)
|
|
4643 check_string_option(&buf->b_p_cinw);
|
|
4644 #endif
|
|
4645 #ifdef FEAT_INS_EXPAND
|
|
4646 check_string_option(&buf->b_p_cpt);
|
|
4647 #endif
|
12
|
4648 #ifdef FEAT_COMPL_FUNC
|
|
4649 check_string_option(&buf->b_p_cfu);
|
|
4650 #endif
|
7
|
4651 #ifdef FEAT_KEYMAP
|
|
4652 check_string_option(&buf->b_p_keymap);
|
|
4653 #endif
|
|
4654 #ifdef FEAT_QUICKFIX
|
|
4655 check_string_option(&buf->b_p_gp);
|
|
4656 check_string_option(&buf->b_p_mp);
|
|
4657 check_string_option(&buf->b_p_efm);
|
|
4658 #endif
|
|
4659 check_string_option(&buf->b_p_ep);
|
|
4660 check_string_option(&buf->b_p_path);
|
|
4661 check_string_option(&buf->b_p_tags);
|
|
4662 #ifdef FEAT_INS_EXPAND
|
|
4663 check_string_option(&buf->b_p_dict);
|
|
4664 check_string_option(&buf->b_p_tsr);
|
|
4665 #endif
|
|
4666 }
|
|
4667
|
|
4668 /*
|
|
4669 * Free the string allocated for an option.
|
|
4670 * Checks for the string being empty_option. This may happen if we're out of
|
|
4671 * memory, vim_strsave() returned NULL, which was replaced by empty_option by
|
|
4672 * check_options().
|
|
4673 * Does NOT check for P_ALLOCED flag!
|
|
4674 */
|
|
4675 void
|
|
4676 free_string_option(p)
|
|
4677 char_u *p;
|
|
4678 {
|
|
4679 if (p != empty_option)
|
|
4680 vim_free(p);
|
|
4681 }
|
|
4682
|
|
4683 void
|
|
4684 clear_string_option(pp)
|
|
4685 char_u **pp;
|
|
4686 {
|
|
4687 if (*pp != empty_option)
|
|
4688 vim_free(*pp);
|
|
4689 *pp = empty_option;
|
|
4690 }
|
|
4691
|
|
4692 static void
|
|
4693 check_string_option(pp)
|
|
4694 char_u **pp;
|
|
4695 {
|
|
4696 if (*pp == NULL)
|
|
4697 *pp = empty_option;
|
|
4698 }
|
|
4699
|
|
4700 /*
|
|
4701 * Mark a terminal option as allocated, found by a pointer into term_strings[].
|
|
4702 */
|
|
4703 void
|
|
4704 set_term_option_alloced(p)
|
|
4705 char_u **p;
|
|
4706 {
|
|
4707 int opt_idx;
|
|
4708
|
|
4709 for (opt_idx = 1; options[opt_idx].fullname != NULL; opt_idx++)
|
|
4710 if (options[opt_idx].var == (char_u *)p)
|
|
4711 {
|
|
4712 options[opt_idx].flags |= P_ALLOCED;
|
|
4713 return;
|
|
4714 }
|
|
4715 return; /* cannot happen: didn't find it! */
|
|
4716 }
|
|
4717
|
|
4718 /*
|
|
4719 * Set a string option to a new value (without checking the effect).
|
|
4720 * The string is copied into allocated memory.
|
|
4721 * if ("opt_idx" == -1) "name" is used, otherwise "opt_idx" is used.
|
|
4722 */
|
|
4723 void
|
|
4724 set_string_option_direct(name, opt_idx, val, opt_flags)
|
|
4725 char_u *name;
|
|
4726 int opt_idx;
|
|
4727 char_u *val;
|
|
4728 int opt_flags; /* OPT_FREE, OPT_LOCAL and/or OPT_GLOBAL */
|
|
4729 {
|
|
4730 char_u *s;
|
|
4731 char_u **varp;
|
|
4732 int both = (opt_flags & (OPT_LOCAL | OPT_GLOBAL)) == 0;
|
|
4733
|
|
4734 if (opt_idx == -1) /* use name */
|
|
4735 {
|
|
4736 opt_idx = findoption(name);
|
|
4737 if (opt_idx == -1) /* not found (should not happen) */
|
|
4738 return;
|
|
4739 }
|
|
4740
|
|
4741 if (options[opt_idx].var == NULL) /* can't set hidden option */
|
|
4742 return;
|
|
4743
|
|
4744 s = vim_strsave(val);
|
|
4745 if (s != NULL)
|
|
4746 {
|
|
4747 varp = (char_u **)get_varp_scope(&(options[opt_idx]),
|
|
4748 both ? OPT_LOCAL : opt_flags);
|
|
4749 if ((opt_flags & OPT_FREE) && (options[opt_idx].flags & P_ALLOCED))
|
|
4750 free_string_option(*varp);
|
|
4751 *varp = s;
|
|
4752
|
|
4753 /* For buffer/window local option may also set the global value. */
|
|
4754 if (both)
|
|
4755 set_string_option_global(opt_idx, varp);
|
|
4756
|
|
4757 options[opt_idx].flags |= P_ALLOCED;
|
|
4758
|
|
4759 /* When setting both values of a global option with a local value,
|
|
4760 * make the local value empty, so that the global value is used. */
|
|
4761 if ((int)options[opt_idx].indir >= PV_BOTH && both)
|
|
4762 {
|
|
4763 free_string_option(*varp);
|
|
4764 *varp = empty_option;
|
|
4765 }
|
|
4766 }
|
|
4767 }
|
|
4768
|
|
4769 /*
|
|
4770 * Set global value for string option when it's a local option.
|
|
4771 */
|
|
4772 static void
|
|
4773 set_string_option_global(opt_idx, varp)
|
|
4774 int opt_idx; /* option index */
|
|
4775 char_u **varp; /* pointer to option variable */
|
|
4776 {
|
|
4777 char_u **p, *s;
|
|
4778
|
|
4779 /* the global value is always allocated */
|
|
4780 if (options[opt_idx].var == VAR_WIN)
|
|
4781 p = (char_u **)GLOBAL_WO(varp);
|
|
4782 else
|
|
4783 p = (char_u **)options[opt_idx].var;
|
|
4784 if (options[opt_idx].indir != PV_NONE
|
|
4785 && p != varp
|
|
4786 && (s = vim_strsave(*varp)) != NULL)
|
|
4787 {
|
|
4788 free_string_option(*p);
|
|
4789 *p = s;
|
|
4790 }
|
|
4791 }
|
|
4792
|
|
4793 /*
|
|
4794 * Set a string option to a new value, and handle the effects.
|
|
4795 */
|
|
4796 static void
|
|
4797 set_string_option(opt_idx, value, opt_flags)
|
|
4798 int opt_idx;
|
|
4799 char_u *value;
|
|
4800 int opt_flags; /* OPT_LOCAL and/or OPT_GLOBAL */
|
|
4801 {
|
|
4802 char_u *s;
|
|
4803 char_u **varp;
|
|
4804 char_u *oldval;
|
|
4805
|
|
4806 if (options[opt_idx].var == NULL) /* don't set hidden option */
|
|
4807 return;
|
|
4808
|
|
4809 s = vim_strsave(value);
|
|
4810 if (s != NULL)
|
|
4811 {
|
|
4812 varp = (char_u **)get_varp_scope(&(options[opt_idx]),
|
|
4813 (opt_flags & (OPT_LOCAL | OPT_GLOBAL)) == 0
|
|
4814 ? ((int)options[opt_idx].indir >= PV_BOTH
|
|
4815 ? OPT_GLOBAL : OPT_LOCAL)
|
|
4816 : opt_flags);
|
|
4817 oldval = *varp;
|
|
4818 *varp = s;
|
|
4819 options[opt_idx].flags |= P_WAS_SET;
|
|
4820 (void)did_set_string_option(opt_idx, varp, TRUE, oldval, NULL,
|
|
4821 opt_flags);
|
|
4822 }
|
|
4823 }
|
|
4824
|
|
4825 /*
|
|
4826 * Handle string options that need some action to perform when changed.
|
|
4827 * Returns NULL for success, or an error message for an error.
|
|
4828 */
|
|
4829 static char_u *
|
|
4830 did_set_string_option(opt_idx, varp, new_value_alloced, oldval, errbuf,
|
|
4831 opt_flags)
|
|
4832 int opt_idx; /* index in options[] table */
|
|
4833 char_u **varp; /* pointer to the option variable */
|
|
4834 int new_value_alloced; /* new value was allocated */
|
|
4835 char_u *oldval; /* previous value of the option */
|
|
4836 char_u *errbuf; /* buffer for errors, or NULL */
|
|
4837 int opt_flags; /* OPT_LOCAL and/or OPT_GLOBAL */
|
|
4838 {
|
|
4839 char_u *errmsg = NULL;
|
|
4840 char_u *s, *p;
|
|
4841 int did_chartab = FALSE;
|
|
4842 char_u **gvarp;
|
24
|
4843 int free_oldval = (options[opt_idx].flags & P_ALLOCED);
|
7
|
4844
|
|
4845 /* Get the global option to compare with, otherwise we would have to check
|
|
4846 * two values for all local options. */
|
|
4847 gvarp = (char_u **)get_varp_scope(&(options[opt_idx]), OPT_GLOBAL);
|
|
4848
|
|
4849 /* Disallow changing some options from secure mode */
|
|
4850 if ((secure
|
|
4851 #ifdef HAVE_SANDBOX
|
|
4852 || sandbox != 0
|
|
4853 #endif
|
|
4854 ) && (options[opt_idx].flags & P_SECURE))
|
|
4855 {
|
|
4856 errmsg = e_secure;
|
|
4857 }
|
|
4858
|
36
|
4859 /* Check for a "normal" file name in some options. Disallow a path
|
|
4860 * separator (slash and/or backslash), wildcards and characters that are
|
|
4861 * often illegal in a file name. */
|
|
4862 else if ((options[opt_idx].flags & P_NFNAME)
|
39
|
4863 && vim_strpbrk(*varp, (char_u *)"/\\*?[|<>") != NULL)
|
36
|
4864 {
|
|
4865 errmsg = e_invarg;
|
|
4866 }
|
|
4867
|
7
|
4868 /* 'term' */
|
|
4869 else if (varp == &T_NAME)
|
|
4870 {
|
|
4871 if (T_NAME[0] == NUL)
|
|
4872 errmsg = (char_u *)N_("E529: Cannot set 'term' to empty string");
|
|
4873 #ifdef FEAT_GUI
|
|
4874 if (gui.in_use)
|
|
4875 errmsg = (char_u *)N_("E530: Cannot change term in GUI");
|
|
4876 else if (term_is_gui(T_NAME))
|
|
4877 errmsg = (char_u *)N_("E531: Use \":gui\" to start the GUI");
|
|
4878 #endif
|
|
4879 else if (set_termname(T_NAME) == FAIL)
|
|
4880 errmsg = (char_u *)N_("E522: Not found in termcap");
|
|
4881 else
|
|
4882 /* Screen colors may have changed. */
|
|
4883 redraw_later_clear();
|
|
4884 }
|
|
4885
|
|
4886 /* 'backupcopy' */
|
|
4887 else if (varp == &p_bkc)
|
|
4888 {
|
|
4889 if (opt_strings_flags(p_bkc, p_bkc_values, &bkc_flags, TRUE) != OK)
|
|
4890 errmsg = e_invarg;
|
|
4891 if (((bkc_flags & BKC_AUTO) != 0)
|
|
4892 + ((bkc_flags & BKC_YES) != 0)
|
|
4893 + ((bkc_flags & BKC_NO) != 0) != 1)
|
|
4894 {
|
|
4895 /* Must have exactly one of "auto", "yes" and "no". */
|
|
4896 (void)opt_strings_flags(oldval, p_bkc_values, &bkc_flags, TRUE);
|
|
4897 errmsg = e_invarg;
|
|
4898 }
|
|
4899 }
|
|
4900
|
|
4901 /* 'backupext' and 'patchmode' */
|
|
4902 else if (varp == &p_bex || varp == &p_pm)
|
|
4903 {
|
|
4904 if (STRCMP(*p_bex == '.' ? p_bex + 1 : p_bex,
|
|
4905 *p_pm == '.' ? p_pm + 1 : p_pm) == 0)
|
|
4906 errmsg = (char_u *)N_("E589: 'backupext' and 'patchmode' are equal");
|
|
4907 }
|
|
4908
|
|
4909 /*
|
|
4910 * 'isident', 'iskeyword', 'isprint or 'isfname' option: refill chartab[]
|
|
4911 * If the new option is invalid, use old value. 'lisp' option: refill
|
|
4912 * chartab[] for '-' char
|
|
4913 */
|
|
4914 else if ( varp == &p_isi
|
|
4915 || varp == &(curbuf->b_p_isk)
|
|
4916 || varp == &p_isp
|
|
4917 || varp == &p_isf)
|
|
4918 {
|
|
4919 if (init_chartab() == FAIL)
|
|
4920 {
|
|
4921 did_chartab = TRUE; /* need to restore it below */
|
|
4922 errmsg = e_invarg; /* error in value */
|
|
4923 }
|
|
4924 }
|
|
4925
|
|
4926 /* 'helpfile' */
|
|
4927 else if (varp == &p_hf)
|
|
4928 {
|
|
4929 /* May compute new values for $VIM and $VIMRUNTIME */
|
|
4930 if (didset_vim)
|
|
4931 {
|
|
4932 vim_setenv((char_u *)"VIM", (char_u *)"");
|
|
4933 didset_vim = FALSE;
|
|
4934 }
|
|
4935 if (didset_vimruntime)
|
|
4936 {
|
|
4937 vim_setenv((char_u *)"VIMRUNTIME", (char_u *)"");
|
|
4938 didset_vimruntime = FALSE;
|
|
4939 }
|
|
4940 }
|
|
4941
|
|
4942 #ifdef FEAT_MULTI_LANG
|
|
4943 /* 'helplang' */
|
|
4944 else if (varp == &p_hlg)
|
|
4945 {
|
|
4946 /* Check for "", "ab", "ab,cd", etc. */
|
|
4947 for (s = p_hlg; *s != NUL; s += 3)
|
|
4948 {
|
|
4949 if (s[1] == NUL || ((s[2] != ',' || s[3] == NUL) && s[2] != NUL))
|
|
4950 {
|
|
4951 errmsg = e_invarg;
|
|
4952 break;
|
|
4953 }
|
|
4954 if (s[2] == NUL)
|
|
4955 break;
|
|
4956 }
|
|
4957 }
|
|
4958 #endif
|
|
4959
|
|
4960 /* 'highlight' */
|
|
4961 else if (varp == &p_hl)
|
|
4962 {
|
|
4963 if (highlight_changed() == FAIL)
|
|
4964 errmsg = e_invarg; /* invalid flags */
|
|
4965 }
|
|
4966
|
|
4967 /* 'nrformats' */
|
|
4968 else if (gvarp == &p_nf)
|
|
4969 {
|
|
4970 if (check_opt_strings(*varp, p_nf_values, TRUE) != OK)
|
|
4971 errmsg = e_invarg;
|
|
4972 }
|
|
4973
|
|
4974 #ifdef FEAT_SESSION
|
|
4975 /* 'sessionoptions' */
|
|
4976 else if (varp == &p_ssop)
|
|
4977 {
|
|
4978 if (opt_strings_flags(p_ssop, p_ssop_values, &ssop_flags, TRUE) != OK)
|
|
4979 errmsg = e_invarg;
|
|
4980 if ((ssop_flags & SSOP_CURDIR) && (ssop_flags & SSOP_SESDIR))
|
|
4981 {
|
|
4982 /* Don't allow both "sesdir" and "curdir". */
|
|
4983 (void)opt_strings_flags(oldval, p_ssop_values, &ssop_flags, TRUE);
|
|
4984 errmsg = e_invarg;
|
|
4985 }
|
|
4986 }
|
|
4987 /* 'viewoptions' */
|
|
4988 else if (varp == &p_vop)
|
|
4989 {
|
|
4990 if (opt_strings_flags(p_vop, p_ssop_values, &vop_flags, TRUE) != OK)
|
|
4991 errmsg = e_invarg;
|
|
4992 }
|
|
4993 #endif
|
|
4994
|
|
4995 /* 'scrollopt' */
|
|
4996 #ifdef FEAT_SCROLLBIND
|
|
4997 else if (varp == &p_sbo)
|
|
4998 {
|
|
4999 if (check_opt_strings(p_sbo, p_scbopt_values, TRUE) != OK)
|
|
5000 errmsg = e_invarg;
|
|
5001 }
|
|
5002 #endif
|
|
5003
|
|
5004 /* 'ambiwidth' */
|
|
5005 #ifdef FEAT_MBYTE
|
|
5006 else if (varp == &p_ambw)
|
|
5007 {
|
|
5008 if (check_opt_strings(p_ambw, p_ambw_values, FALSE) != OK)
|
|
5009 errmsg = e_invarg;
|
|
5010 }
|
|
5011 #endif
|
|
5012
|
|
5013 /* 'background' */
|
|
5014 else if (varp == &p_bg)
|
|
5015 {
|
|
5016 if (check_opt_strings(p_bg, p_bg_values, FALSE) == OK)
|
|
5017 {
|
|
5018 #ifdef FEAT_EVAL
|
|
5019 int dark = (*p_bg == 'd');
|
|
5020 #endif
|
|
5021
|
|
5022 init_highlight(FALSE, FALSE);
|
|
5023
|
|
5024 #ifdef FEAT_EVAL
|
|
5025 if (dark != (*p_bg == 'd')
|
|
5026 && get_var_value((char_u *)"g:colors_name") != NULL)
|
|
5027 {
|
|
5028 /* The color scheme must have set 'background' back to another
|
|
5029 * value, that's not what we want here. Disable the color
|
|
5030 * scheme and set the colors again. */
|
148
|
5031 do_unlet((char_u *)"g:colors_name", TRUE);
|
7
|
5032 free_string_option(p_bg);
|
|
5033 p_bg = vim_strsave((char_u *)(dark ? "dark" : "light"));
|
|
5034 check_string_option(&p_bg);
|
|
5035 init_highlight(FALSE, FALSE);
|
|
5036 }
|
|
5037 #endif
|
|
5038 }
|
|
5039 else
|
|
5040 errmsg = e_invarg;
|
|
5041 }
|
|
5042
|
|
5043 /* 'wildmode' */
|
|
5044 else if (varp == &p_wim)
|
|
5045 {
|
|
5046 if (check_opt_wim() == FAIL)
|
|
5047 errmsg = e_invarg;
|
|
5048 }
|
|
5049
|
40
|
5050 #ifdef FEAT_CMDL_COMPL
|
|
5051 /* 'wildoptions' */
|
|
5052 else if (varp == &p_wop)
|
|
5053 {
|
|
5054 if (check_opt_strings(p_wop, p_wop_values, TRUE) != OK)
|
|
5055 errmsg = e_invarg;
|
|
5056 }
|
|
5057 #endif
|
|
5058
|
7
|
5059 #ifdef FEAT_WAK
|
|
5060 /* 'winaltkeys' */
|
|
5061 else if (varp == &p_wak)
|
|
5062 {
|
|
5063 if (*p_wak == NUL
|
|
5064 || check_opt_strings(p_wak, p_wak_values, FALSE) != OK)
|
|
5065 errmsg = e_invarg;
|
|
5066 # ifdef FEAT_MENU
|
|
5067 # ifdef FEAT_GUI_MOTIF
|
|
5068 else if (gui.in_use)
|
|
5069 gui_motif_set_mnemonics(p_wak[0] == 'y' || p_wak[0] == 'm');
|
|
5070 # else
|
|
5071 # ifdef FEAT_GUI_GTK
|
|
5072 else if (gui.in_use)
|
|
5073 gui_gtk_set_mnemonics(p_wak[0] == 'y' || p_wak[0] == 'm');
|
|
5074 # endif
|
|
5075 # endif
|
|
5076 # endif
|
|
5077 }
|
|
5078 #endif
|
|
5079
|
|
5080 #ifdef FEAT_AUTOCMD
|
|
5081 /* 'eventignore' */
|
|
5082 else if (varp == &p_ei)
|
|
5083 {
|
|
5084 if (check_ei() == FAIL)
|
|
5085 errmsg = e_invarg;
|
|
5086 }
|
|
5087 #endif
|
|
5088
|
|
5089 #ifdef FEAT_MBYTE
|
|
5090 /* 'encoding' and 'fileencoding' */
|
|
5091 else if (varp == &p_enc || gvarp == &p_fenc || varp == &p_tenc)
|
|
5092 {
|
|
5093 if (gvarp == &p_fenc)
|
|
5094 {
|
|
5095 if (!curbuf->b_p_ma)
|
|
5096 errmsg = e_modifiable;
|
|
5097 else if (vim_strchr(*varp, ',') != NULL)
|
|
5098 /* No comma allowed in 'fileencoding'; catches confusing it
|
|
5099 * with 'fileencodings'. */
|
|
5100 errmsg = e_invarg;
|
39
|
5101 else
|
|
5102 {
|
7
|
5103 # ifdef FEAT_TITLE
|
|
5104 /* May show a "+" in the title now. */
|
|
5105 need_maketitle = TRUE;
|
|
5106 # endif
|
39
|
5107 /* Add 'fileencoding' to the swap file. */
|
|
5108 ml_setflags(curbuf);
|
|
5109 }
|
7
|
5110 }
|
|
5111 if (errmsg == NULL)
|
|
5112 {
|
|
5113 /* canonize the value, so that STRCMP() can be used on it */
|
|
5114 p = enc_canonize(*varp);
|
|
5115 if (p != NULL)
|
|
5116 {
|
|
5117 vim_free(*varp);
|
|
5118 *varp = p;
|
|
5119 }
|
|
5120 if (varp == &p_enc)
|
|
5121 {
|
|
5122 errmsg = mb_init();
|
|
5123 # ifdef FEAT_TITLE
|
|
5124 need_maketitle = TRUE;
|
|
5125 # endif
|
|
5126 }
|
|
5127 }
|
|
5128
|
|
5129 # if defined(FEAT_GUI_GTK) && defined(HAVE_GTK2)
|
|
5130 if (errmsg == NULL && varp == &p_tenc && gui.in_use)
|
|
5131 {
|
|
5132 /* GTK+ 2 uses only a single encoding, and that is UTF-8. */
|
|
5133 if (STRCMP(p_tenc, "utf-8") != 0)
|
|
5134 errmsg = (char_u *)N_("E617: Cannot be changed in the GTK+ 2 GUI");
|
|
5135 }
|
|
5136 # endif
|
|
5137
|
|
5138 if (errmsg == NULL)
|
|
5139 {
|
|
5140 # ifdef FEAT_KEYMAP
|
|
5141 /* When 'keymap' is used and 'encoding' changes, reload the keymap
|
|
5142 * (with another encoding). */
|
|
5143 if (varp == &p_enc && *curbuf->b_p_keymap != NUL)
|
|
5144 (void)keymap_init();
|
|
5145 # endif
|
|
5146
|
|
5147 /* When 'termencoding' is not empty and 'encoding' changes or when
|
|
5148 * 'termencoding' changes, need to setup for keyboard input and
|
|
5149 * display output conversion. */
|
|
5150 if (((varp == &p_enc && *p_tenc != NUL) || varp == &p_tenc))
|
|
5151 {
|
|
5152 convert_setup(&input_conv, p_tenc, p_enc);
|
|
5153 convert_setup(&output_conv, p_enc, p_tenc);
|
|
5154 }
|
170
|
5155
|
|
5156 # if defined(WIN3264) && defined(FEAT_MBYTE)
|
|
5157 /* $HOME may have characters in active code page. */
|
|
5158 if (varp == &p_enc)
|
|
5159 init_homedir();
|
|
5160 # endif
|
7
|
5161 }
|
|
5162 }
|
|
5163 #endif
|
|
5164
|
|
5165 #if defined(FEAT_POSTSCRIPT)
|
|
5166 else if (varp == &p_penc)
|
|
5167 {
|
|
5168 /* Canonize printencoding if VIM standard one */
|
|
5169 p = enc_canonize(p_penc);
|
|
5170 if (p != NULL)
|
|
5171 {
|
|
5172 vim_free(p_penc);
|
|
5173 p_penc = p;
|
|
5174 }
|
|
5175 else
|
|
5176 {
|
|
5177 /* Ensure lower case and '-' for '_' */
|
|
5178 for (s = p_penc; *s != NUL; s++)
|
|
5179 {
|
|
5180 if (*s == '_')
|
|
5181 *s = '-';
|
|
5182 else
|
|
5183 *s = TOLOWER_ASC(*s);
|
|
5184 }
|
|
5185 }
|
|
5186 }
|
|
5187 #endif
|
|
5188
|
11
|
5189 #if defined(FEAT_XIM) && ( defined(FEAT_GUI_GTK) || defined(FEAT_GUI_KDE) )
|
7
|
5190 else if (varp == &p_imak)
|
|
5191 {
|
|
5192 if (gui.in_use && !im_xim_isvalid_imactivate())
|
|
5193 errmsg = e_invarg;
|
|
5194 }
|
|
5195 #endif
|
|
5196
|
|
5197 #ifdef FEAT_KEYMAP
|
|
5198 else if (varp == &curbuf->b_p_keymap)
|
|
5199 {
|
|
5200 /* load or unload key mapping tables */
|
|
5201 errmsg = keymap_init();
|
|
5202
|
|
5203 /* When successfully installed a new keymap switch on using it. */
|
|
5204 if (*curbuf->b_p_keymap != NUL && errmsg == NULL)
|
|
5205 {
|
|
5206 curbuf->b_p_iminsert = B_IMODE_LMAP;
|
|
5207 if (curbuf->b_p_imsearch != B_IMODE_USE_INSERT)
|
|
5208 curbuf->b_p_imsearch = B_IMODE_LMAP;
|
|
5209 set_iminsert_global();
|
|
5210 set_imsearch_global();
|
|
5211 # ifdef FEAT_WINDOWS
|
|
5212 status_redraw_curbuf();
|
|
5213 # endif
|
|
5214 }
|
|
5215 }
|
|
5216 #endif
|
|
5217
|
|
5218 /* 'fileformat' */
|
|
5219 else if (gvarp == &p_ff)
|
|
5220 {
|
|
5221 if (!curbuf->b_p_ma && !(opt_flags & OPT_GLOBAL))
|
|
5222 errmsg = e_modifiable;
|
|
5223 else if (check_opt_strings(*varp, p_ff_values, FALSE) != OK)
|
|
5224 errmsg = e_invarg;
|
|
5225 else
|
|
5226 {
|
|
5227 /* may also change 'textmode' */
|
|
5228 if (get_fileformat(curbuf) == EOL_DOS)
|
|
5229 curbuf->b_p_tx = TRUE;
|
|
5230 else
|
|
5231 curbuf->b_p_tx = FALSE;
|
|
5232 #ifdef FEAT_TITLE
|
|
5233 need_maketitle = TRUE;
|
|
5234 #endif
|
39
|
5235 /* update flag in swap file */
|
|
5236 ml_setflags(curbuf);
|
7
|
5237 }
|
|
5238 }
|
|
5239
|
|
5240 /* 'fileformats' */
|
|
5241 else if (varp == &p_ffs)
|
|
5242 {
|
|
5243 if (check_opt_strings(p_ffs, p_ff_values, TRUE) != OK)
|
|
5244 errmsg = e_invarg;
|
|
5245 else
|
|
5246 {
|
|
5247 /* also change 'textauto' */
|
|
5248 if (*p_ffs == NUL)
|
|
5249 p_ta = FALSE;
|
|
5250 else
|
|
5251 p_ta = TRUE;
|
|
5252 }
|
|
5253 }
|
|
5254
|
|
5255 #if defined(FEAT_CRYPT) && defined(FEAT_CMDHIST)
|
|
5256 /* 'cryptkey' */
|
|
5257 else if (gvarp == &p_key)
|
|
5258 {
|
|
5259 /* Make sure the ":set" command doesn't show the new value in the
|
|
5260 * history. */
|
|
5261 remove_key_from_history();
|
|
5262 }
|
|
5263 #endif
|
|
5264
|
|
5265 /* 'matchpairs' */
|
|
5266 else if (gvarp == &p_mps)
|
|
5267 {
|
|
5268 /* Check for "x:y,x:y" */
|
|
5269 for (p = *varp; *p != NUL; p += 4)
|
|
5270 {
|
|
5271 if (p[1] != ':' || p[2] == NUL || (p[3] != NUL && p[3] != ','))
|
|
5272 {
|
|
5273 errmsg = e_invarg;
|
|
5274 break;
|
|
5275 }
|
|
5276 if (p[3] == NUL)
|
|
5277 break;
|
|
5278 }
|
|
5279 }
|
|
5280
|
|
5281 #ifdef FEAT_COMMENTS
|
|
5282 /* 'comments' */
|
|
5283 else if (gvarp == &p_com)
|
|
5284 {
|
|
5285 for (s = *varp; *s; )
|
|
5286 {
|
|
5287 while (*s && *s != ':')
|
|
5288 {
|
|
5289 if (vim_strchr((char_u *)COM_ALL, *s) == NULL
|
|
5290 && !VIM_ISDIGIT(*s) && *s != '-')
|
|
5291 {
|
|
5292 errmsg = illegal_char(errbuf, *s);
|
|
5293 break;
|
|
5294 }
|
|
5295 ++s;
|
|
5296 }
|
|
5297 if (*s++ == NUL)
|
|
5298 errmsg = (char_u *)N_("E524: Missing colon");
|
|
5299 else if (*s == ',' || *s == NUL)
|
|
5300 errmsg = (char_u *)N_("E525: Zero length string");
|
|
5301 if (errmsg != NULL)
|
|
5302 break;
|
|
5303 while (*s && *s != ',')
|
|
5304 {
|
|
5305 if (*s == '\\' && s[1] != NUL)
|
|
5306 ++s;
|
|
5307 ++s;
|
|
5308 }
|
|
5309 s = skip_to_option_part(s);
|
|
5310 }
|
|
5311 }
|
|
5312 #endif
|
|
5313
|
|
5314 /* 'listchars' */
|
|
5315 else if (varp == &p_lcs)
|
|
5316 {
|
|
5317 errmsg = set_chars_option(varp);
|
|
5318 }
|
|
5319
|
|
5320 #if defined(FEAT_WINDOWS) || defined(FEAT_FOLDING)
|
|
5321 /* 'fillchars' */
|
|
5322 else if (varp == &p_fcs)
|
|
5323 {
|
|
5324 errmsg = set_chars_option(varp);
|
|
5325 }
|
|
5326 #endif
|
|
5327
|
|
5328 #ifdef FEAT_CMDWIN
|
|
5329 /* 'cedit' */
|
|
5330 else if (varp == &p_cedit)
|
|
5331 {
|
|
5332 errmsg = check_cedit();
|
|
5333 }
|
|
5334 #endif
|
|
5335
|
294
|
5336 /* 'verbosefile' */
|
|
5337 else if (varp == &p_vfile)
|
|
5338 {
|
|
5339 verbose_stop();
|
|
5340 if (*p_vfile != NUL && verbose_open() == FAIL)
|
|
5341 errmsg = e_invarg;
|
|
5342 }
|
|
5343
|
7
|
5344 #ifdef FEAT_VIMINFO
|
|
5345 /* 'viminfo' */
|
|
5346 else if (varp == &p_viminfo)
|
|
5347 {
|
|
5348 for (s = p_viminfo; *s;)
|
|
5349 {
|
|
5350 /* Check it's a valid character */
|
|
5351 if (vim_strchr((char_u *)"!\"%'/:<@cfhnrs", *s) == NULL)
|
|
5352 {
|
|
5353 errmsg = illegal_char(errbuf, *s);
|
|
5354 break;
|
|
5355 }
|
|
5356 if (*s == 'n') /* name is always last one */
|
|
5357 {
|
|
5358 break;
|
|
5359 }
|
|
5360 else if (*s == 'r') /* skip until next ',' */
|
|
5361 {
|
|
5362 while (*++s && *s != ',')
|
|
5363 ;
|
|
5364 }
|
23
|
5365 else if (*s == '%')
|
|
5366 {
|
|
5367 /* optional number */
|
|
5368 while (vim_isdigit(*++s))
|
|
5369 ;
|
|
5370 }
|
|
5371 else if (*s == '!' || *s == 'h' || *s == 'c')
|
7
|
5372 ++s; /* no extra chars */
|
|
5373 else /* must have a number */
|
|
5374 {
|
|
5375 while (vim_isdigit(*++s))
|
|
5376 ;
|
|
5377
|
|
5378 if (!VIM_ISDIGIT(*(s - 1)))
|
|
5379 {
|
|
5380 if (errbuf != NULL)
|
|
5381 {
|
133
|
5382 sprintf((char *)errbuf,
|
|
5383 _("E526: Missing number after <%s>"),
|
7
|
5384 transchar_byte(*(s - 1)));
|
|
5385 errmsg = errbuf;
|
|
5386 }
|
|
5387 else
|
|
5388 errmsg = (char_u *)"";
|
|
5389 break;
|
|
5390 }
|
|
5391 }
|
|
5392 if (*s == ',')
|
|
5393 ++s;
|
|
5394 else if (*s)
|
|
5395 {
|
|
5396 if (errbuf != NULL)
|
|
5397 errmsg = (char_u *)N_("E527: Missing comma");
|
|
5398 else
|
|
5399 errmsg = (char_u *)"";
|
|
5400 break;
|
|
5401 }
|
|
5402 }
|
|
5403 if (*p_viminfo && errmsg == NULL && get_viminfo_parameter('\'') < 0)
|
|
5404 errmsg = (char_u *)N_("E528: Must specify a ' value");
|
|
5405 }
|
|
5406 #endif /* FEAT_VIMINFO */
|
|
5407
|
|
5408 /* terminal options */
|
|
5409 else if (istermoption(&options[opt_idx]) && full_screen)
|
|
5410 {
|
|
5411 /* ":set t_Co=0" and ":set t_Co=1" do ":set t_Co=" */
|
|
5412 if (varp == &T_CCO)
|
|
5413 {
|
|
5414 t_colors = atoi((char *)T_CCO);
|
|
5415 if (t_colors <= 1)
|
|
5416 {
|
|
5417 if (new_value_alloced)
|
|
5418 vim_free(T_CCO);
|
|
5419 T_CCO = empty_option;
|
|
5420 }
|
|
5421 /* We now have a different color setup, initialize it again. */
|
|
5422 init_highlight(TRUE, FALSE);
|
|
5423 }
|
|
5424 ttest(FALSE);
|
|
5425 if (varp == &T_ME)
|
|
5426 {
|
|
5427 out_str(T_ME);
|
|
5428 redraw_later(CLEAR);
|
|
5429 #if defined(MSDOS) || (defined(WIN3264) && !defined(FEAT_GUI_W32))
|
|
5430 /* Since t_me has been set, this probably means that the user
|
|
5431 * wants to use this as default colors. Need to reset default
|
|
5432 * background/foreground colors. */
|
|
5433 mch_set_normal_colors();
|
|
5434 #endif
|
|
5435 }
|
|
5436 }
|
|
5437
|
|
5438 #ifdef FEAT_LINEBREAK
|
|
5439 /* 'showbreak' */
|
|
5440 else if (varp == &p_sbr)
|
|
5441 {
|
|
5442 for (s = p_sbr; *s; )
|
|
5443 {
|
|
5444 if (ptr2cells(s) != 1)
|
|
5445 errmsg = (char_u *)N_("E595: contains unprintable or wide character");
|
39
|
5446 mb_ptr_adv(s);
|
7
|
5447 }
|
|
5448 }
|
|
5449 #endif
|
|
5450
|
|
5451 #ifdef FEAT_GUI
|
|
5452 /* 'guifont' */
|
|
5453 else if (varp == &p_guifont)
|
|
5454 {
|
|
5455 if (gui.in_use)
|
|
5456 {
|
|
5457 p = p_guifont;
|
11
|
5458 # if defined(FEAT_GUI_GTK) || defined(FEAT_GUI_KDE)
|
7
|
5459 /*
|
|
5460 * Put up a font dialog and let the user select a new value.
|
|
5461 * If this is cancelled go back to the old value but don't
|
|
5462 * give an error message.
|
|
5463 */
|
|
5464 if (STRCMP(p, "*") == 0)
|
|
5465 {
|
|
5466 p = gui_mch_font_dialog(oldval);
|
|
5467
|
|
5468 if (new_value_alloced)
|
|
5469 free_string_option(p_guifont);
|
|
5470
|
|
5471 p_guifont = (p != NULL) ? p : vim_strsave(oldval);
|
|
5472 new_value_alloced = TRUE;
|
|
5473 }
|
|
5474 # endif
|
|
5475 if (p != NULL && gui_init_font(p_guifont, FALSE) != OK)
|
|
5476 {
|
|
5477 # if defined(FEAT_GUI_MSWIN) || defined(FEAT_GUI_PHOTON)
|
|
5478 if (STRCMP(p_guifont, "*") == 0)
|
|
5479 {
|
|
5480 /* Dialog was cancelled: Keep the old value without giving
|
|
5481 * an error message. */
|
|
5482 if (new_value_alloced)
|
|
5483 free_string_option(p_guifont);
|
|
5484 p_guifont = vim_strsave(oldval);
|
|
5485 new_value_alloced = TRUE;
|
|
5486 }
|
|
5487 else
|
|
5488 # endif
|
|
5489 errmsg = (char_u *)N_("E596: Invalid font(s)");
|
|
5490 }
|
|
5491 }
|
|
5492 }
|
|
5493 # ifdef FEAT_XFONTSET
|
|
5494 else if (varp == &p_guifontset)
|
|
5495 {
|
|
5496 if (STRCMP(p_guifontset, "*") == 0)
|
|
5497 errmsg = (char_u *)N_("E597: can't select fontset");
|
|
5498 else if (gui.in_use && gui_init_font(p_guifontset, TRUE) != OK)
|
|
5499 errmsg = (char_u *)N_("E598: Invalid fontset");
|
|
5500 }
|
|
5501 # endif
|
|
5502 # ifdef FEAT_MBYTE
|
|
5503 else if (varp == &p_guifontwide)
|
|
5504 {
|
|
5505 if (STRCMP(p_guifontwide, "*") == 0)
|
|
5506 errmsg = (char_u *)N_("E533: can't select wide font");
|
|
5507 else if (gui_get_wide_font() == FAIL)
|
|
5508 errmsg = (char_u *)N_("E534: Invalid wide font");
|
|
5509 }
|
|
5510 # endif
|
|
5511 #endif
|
|
5512
|
|
5513 #ifdef CURSOR_SHAPE
|
|
5514 /* 'guicursor' */
|
|
5515 else if (varp == &p_guicursor)
|
|
5516 errmsg = parse_shape_opt(SHAPE_CURSOR);
|
|
5517 #endif
|
|
5518
|
|
5519 #ifdef FEAT_MOUSESHAPE
|
|
5520 /* 'mouseshape' */
|
|
5521 else if (varp == &p_mouseshape)
|
|
5522 {
|
|
5523 errmsg = parse_shape_opt(SHAPE_MOUSE);
|
|
5524 update_mouseshape(-1);
|
|
5525 }
|
|
5526 #endif
|
|
5527
|
|
5528 #ifdef FEAT_PRINTER
|
|
5529 else if (varp == &p_popt)
|
21
|
5530 errmsg = parse_list_options(p_popt, printer_opts,
|
|
5531 OPT_PRINT_NUM_OPTIONS);
|
15
|
5532
|
16
|
5533 # if defined(FEAT_MBYTE) && defined(FEAT_POSTSCRIPT)
|
15
|
5534 else if (varp == &p_pmfn)
|
21
|
5535 errmsg = parse_list_options(p_pmfn, mbfont_opts,
|
|
5536 OPT_MBFONT_NUM_OPTIONS);
|
15
|
5537 # endif
|
7
|
5538 #endif
|
|
5539
|
|
5540 #ifdef FEAT_LANGMAP
|
|
5541 /* 'langmap' */
|
|
5542 else if (varp == &p_langmap)
|
|
5543 langmap_set();
|
|
5544 #endif
|
|
5545
|
|
5546 #ifdef FEAT_LINEBREAK
|
|
5547 /* 'breakat' */
|
|
5548 else if (varp == &p_breakat)
|
|
5549 fill_breakat_flags();
|
|
5550 #endif
|
|
5551
|
|
5552 #ifdef FEAT_TITLE
|
|
5553 /* 'titlestring' and 'iconstring' */
|
|
5554 else if (varp == &p_titlestring || varp == &p_iconstring)
|
|
5555 {
|
|
5556 # ifdef FEAT_STL_OPT
|
|
5557 int flagval = (varp == &p_titlestring) ? STL_IN_TITLE : STL_IN_ICON;
|
|
5558
|
|
5559 /* NULL => statusline syntax */
|
|
5560 if (vim_strchr(*varp, '%') && check_stl_option(*varp) == NULL)
|
|
5561 stl_syntax |= flagval;
|
|
5562 else
|
|
5563 stl_syntax &= ~flagval;
|
|
5564 # endif
|
|
5565 did_set_title(varp == &p_iconstring);
|
|
5566
|
|
5567 }
|
|
5568 #endif
|
|
5569
|
|
5570 #ifdef FEAT_GUI
|
|
5571 /* 'guioptions' */
|
|
5572 else if (varp == &p_go)
|
|
5573 gui_init_which_components(oldval);
|
|
5574 #endif
|
|
5575
|
|
5576 #if defined(FEAT_MOUSE_TTY) && (defined(UNIX) || defined(VMS))
|
|
5577 /* 'ttymouse' */
|
|
5578 else if (varp == &p_ttym)
|
|
5579 {
|
190
|
5580 /* Switch the mouse off before changing the escape sequences used for
|
|
5581 * that. */
|
|
5582 mch_setmouse(FALSE);
|
7
|
5583 if (opt_strings_flags(p_ttym, p_ttym_values, &ttym_flags, FALSE) != OK)
|
|
5584 errmsg = e_invarg;
|
|
5585 else
|
|
5586 check_mouse_termcode();
|
227
|
5587 if (termcap_active)
|
|
5588 setmouse(); /* may switch it on again */
|
7
|
5589 }
|
|
5590 #endif
|
|
5591
|
|
5592 #ifdef FEAT_VISUAL
|
|
5593 /* 'selection' */
|
|
5594 else if (varp == &p_sel)
|
|
5595 {
|
|
5596 if (*p_sel == NUL
|
|
5597 || check_opt_strings(p_sel, p_sel_values, FALSE) != OK)
|
|
5598 errmsg = e_invarg;
|
|
5599 }
|
|
5600
|
|
5601 /* 'selectmode' */
|
|
5602 else if (varp == &p_slm)
|
|
5603 {
|
|
5604 if (check_opt_strings(p_slm, p_slm_values, TRUE) != OK)
|
|
5605 errmsg = e_invarg;
|
|
5606 }
|
|
5607 #endif
|
|
5608
|
|
5609 #ifdef FEAT_BROWSE
|
|
5610 /* 'browsedir' */
|
|
5611 else if (varp == &p_bsdir)
|
|
5612 {
|
|
5613 if (check_opt_strings(p_bsdir, p_bsdir_values, FALSE) != OK
|
|
5614 && !mch_isdir(p_bsdir))
|
|
5615 errmsg = e_invarg;
|
|
5616 }
|
|
5617 #endif
|
|
5618
|
|
5619 #ifdef FEAT_VISUAL
|
|
5620 /* 'keymodel' */
|
|
5621 else if (varp == &p_km)
|
|
5622 {
|
|
5623 if (check_opt_strings(p_km, p_km_values, TRUE) != OK)
|
|
5624 errmsg = e_invarg;
|
|
5625 else
|
|
5626 {
|
|
5627 km_stopsel = (vim_strchr(p_km, 'o') != NULL);
|
|
5628 km_startsel = (vim_strchr(p_km, 'a') != NULL);
|
|
5629 }
|
|
5630 }
|
|
5631 #endif
|
|
5632
|
|
5633 /* 'mousemodel' */
|
|
5634 else if (varp == &p_mousem)
|
|
5635 {
|
|
5636 if (check_opt_strings(p_mousem, p_mousem_values, FALSE) != OK)
|
|
5637 errmsg = e_invarg;
|
|
5638 #if defined(FEAT_GUI_MOTIF) && defined(FEAT_MENU) && (XmVersion <= 1002)
|
|
5639 else if (*p_mousem != *oldval)
|
|
5640 /* Changed from "extend" to "popup" or "popup_setpos" or vv: need
|
|
5641 * to create or delete the popup menus. */
|
|
5642 gui_motif_update_mousemodel(root_menu);
|
|
5643 #endif
|
|
5644 }
|
|
5645
|
|
5646 /* 'switchbuf' */
|
|
5647 else if (varp == &p_swb)
|
|
5648 {
|
|
5649 if (check_opt_strings(p_swb, p_swb_values, TRUE) != OK)
|
|
5650 errmsg = e_invarg;
|
|
5651 }
|
|
5652
|
|
5653 /* 'debug' */
|
|
5654 else if (varp == &p_debug)
|
|
5655 {
|
|
5656 if (check_opt_strings(p_debug, p_debug_values, FALSE) != OK)
|
|
5657 errmsg = e_invarg;
|
|
5658 }
|
|
5659
|
|
5660 /* 'display' */
|
|
5661 else if (varp == &p_dy)
|
|
5662 {
|
|
5663 if (opt_strings_flags(p_dy, p_dy_values, &dy_flags, TRUE) != OK)
|
|
5664 errmsg = e_invarg;
|
|
5665 else
|
|
5666 (void)init_chartab();
|
|
5667
|
|
5668 }
|
|
5669
|
|
5670 #ifdef FEAT_VERTSPLIT
|
|
5671 /* 'eadirection' */
|
|
5672 else if (varp == &p_ead)
|
|
5673 {
|
|
5674 if (check_opt_strings(p_ead, p_ead_values, FALSE) != OK)
|
|
5675 errmsg = e_invarg;
|
|
5676 }
|
|
5677 #endif
|
|
5678
|
|
5679 #ifdef FEAT_CLIPBOARD
|
|
5680 /* 'clipboard' */
|
|
5681 else if (varp == &p_cb)
|
|
5682 errmsg = check_clipboard_option();
|
|
5683 #endif
|
|
5684
|
221
|
5685 #ifdef FEAT_SYN_HL
|
258
|
5686 /* When 'spelllang' is set and there is a window for this buffer in which
|
|
5687 * 'spell' is set load the wordlists. */
|
221
|
5688 else if (varp == &(curbuf->b_p_spl))
|
|
5689 {
|
258
|
5690 win_T *wp;
|
|
5691
|
|
5692 FOR_ALL_WINDOWS(wp)
|
|
5693 if (wp->w_buffer == curbuf && wp->w_p_spell)
|
|
5694 {
|
|
5695 errmsg = did_set_spelllang(curbuf);
|
|
5696 # ifdef FEAT_WINDOWS
|
|
5697 break;
|
|
5698 # endif
|
|
5699 }
|
221
|
5700 }
|
|
5701 #endif
|
|
5702
|
7
|
5703 #ifdef FEAT_AUTOCMD
|
|
5704 # ifdef FEAT_SYN_HL
|
|
5705 /* When 'syntax' is set, load the syntax of that name */
|
|
5706 else if (varp == &(curbuf->b_p_syn))
|
|
5707 {
|
|
5708 apply_autocmds(EVENT_SYNTAX, curbuf->b_p_syn,
|
|
5709 curbuf->b_fname, TRUE, curbuf);
|
|
5710 }
|
|
5711 # endif
|
|
5712
|
|
5713 /* When 'filetype' is set, trigger the FileType autocommands of that name */
|
|
5714 else if (varp == &(curbuf->b_p_ft))
|
|
5715 {
|
|
5716 did_filetype = TRUE;
|
|
5717 apply_autocmds(EVENT_FILETYPE, curbuf->b_p_ft,
|
|
5718 curbuf->b_fname, TRUE, curbuf);
|
|
5719 }
|
|
5720 #endif
|
|
5721
|
|
5722 #ifdef FEAT_QUICKFIX
|
|
5723 /* When 'bufhidden' is set, check for valid value. */
|
|
5724 else if (gvarp == &p_bh)
|
|
5725 {
|
|
5726 if (check_opt_strings(curbuf->b_p_bh, p_bufhidden_values, FALSE) != OK)
|
|
5727 errmsg = e_invarg;
|
|
5728 }
|
|
5729
|
|
5730 /* When 'buftype' is set, check for valid value. */
|
|
5731 else if (gvarp == &p_bt)
|
|
5732 {
|
|
5733 if (check_opt_strings(curbuf->b_p_bt, p_buftype_values, FALSE) != OK)
|
|
5734 errmsg = e_invarg;
|
|
5735 else
|
|
5736 {
|
|
5737 # ifdef FEAT_WINDOWS
|
|
5738 if (curwin->w_status_height)
|
|
5739 {
|
|
5740 curwin->w_redr_status = TRUE;
|
|
5741 redraw_later(VALID);
|
|
5742 }
|
|
5743 # endif
|
|
5744 curbuf->b_help = (curbuf->b_p_bt[0] == 'h');
|
|
5745 }
|
|
5746 }
|
|
5747 #endif
|
|
5748
|
|
5749 #ifdef FEAT_STL_OPT
|
|
5750 /* 'statusline' or 'rulerformat' */
|
40
|
5751 else if (gvarp == &p_stl || varp == &p_ruf)
|
7
|
5752 {
|
|
5753 int wid;
|
|
5754
|
|
5755 if (varp == &p_ruf) /* reset ru_wid first */
|
|
5756 ru_wid = 0;
|
|
5757 s = *varp;
|
|
5758 if (varp == &p_ruf && *s == '%')
|
|
5759 {
|
|
5760 /* set ru_wid if 'ruf' starts with "%99(" */
|
|
5761 if (*++s == '-') /* ignore a '-' */
|
|
5762 s++;
|
|
5763 wid = getdigits(&s);
|
|
5764 if (wid && *s == '(' && (errmsg = check_stl_option(p_ruf)) == NULL)
|
|
5765 ru_wid = wid;
|
|
5766 else
|
|
5767 errmsg = check_stl_option(p_ruf);
|
|
5768 }
|
|
5769 else
|
|
5770 errmsg = check_stl_option(s);
|
40
|
5771 if (varp == &p_ruf && errmsg == NULL)
|
7
|
5772 comp_col();
|
|
5773 }
|
|
5774 #endif
|
|
5775
|
|
5776 #ifdef FEAT_INS_EXPAND
|
|
5777 /* check if it is a valid value for 'complete' -- Acevedo */
|
|
5778 else if (gvarp == &p_cpt)
|
|
5779 {
|
|
5780 for (s = *varp; *s;)
|
|
5781 {
|
|
5782 while(*s == ',' || *s == ' ')
|
|
5783 s++;
|
|
5784 if (!*s)
|
|
5785 break;
|
|
5786 if (vim_strchr((char_u *)".wbuksid]tU", *s) == NULL)
|
|
5787 {
|
|
5788 errmsg = illegal_char(errbuf, *s);
|
|
5789 break;
|
|
5790 }
|
|
5791 if (*++s != NUL && *s != ',' && *s != ' ')
|
|
5792 {
|
|
5793 if (s[-1] == 'k' || s[-1] == 's')
|
|
5794 {
|
|
5795 /* skip optional filename after 'k' and 's' */
|
|
5796 while (*s && *s != ',' && *s != ' ')
|
|
5797 {
|
|
5798 if (*s == '\\')
|
|
5799 ++s;
|
|
5800 ++s;
|
|
5801 }
|
|
5802 }
|
|
5803 else
|
|
5804 {
|
|
5805 if (errbuf != NULL)
|
|
5806 {
|
|
5807 sprintf((char *)errbuf,
|
|
5808 _("E535: Illegal character after <%c>"),
|
|
5809 *--s);
|
|
5810 errmsg = errbuf;
|
|
5811 }
|
|
5812 else
|
|
5813 errmsg = (char_u *)"";
|
|
5814 break;
|
|
5815 }
|
|
5816 }
|
|
5817 }
|
|
5818 }
|
|
5819 #endif /* FEAT_INS_EXPAND */
|
|
5820
|
|
5821
|
|
5822 #if defined(FEAT_TOOLBAR) && !defined(FEAT_GUI_W32)
|
|
5823 else if (varp == &p_toolbar)
|
|
5824 {
|
|
5825 if (opt_strings_flags(p_toolbar, p_toolbar_values,
|
|
5826 &toolbar_flags, TRUE) != OK)
|
|
5827 errmsg = e_invarg;
|
|
5828 else
|
|
5829 {
|
|
5830 out_flush();
|
|
5831 gui_mch_show_toolbar((toolbar_flags &
|
|
5832 (TOOLBAR_TEXT | TOOLBAR_ICONS)) != 0);
|
|
5833 }
|
|
5834 }
|
|
5835 #endif
|
|
5836
|
|
5837 #if defined(FEAT_TOOLBAR) && defined(FEAT_GUI_GTK) && defined(HAVE_GTK2)
|
|
5838 /* 'toolbariconsize': GTK+ 2 only */
|
|
5839 else if (varp == &p_tbis)
|
|
5840 {
|
|
5841 if (opt_strings_flags(p_tbis, p_tbis_values, &tbis_flags, FALSE) != OK)
|
|
5842 errmsg = e_invarg;
|
|
5843 else
|
|
5844 {
|
|
5845 out_flush();
|
|
5846 gui_mch_show_toolbar((toolbar_flags &
|
|
5847 (TOOLBAR_TEXT | TOOLBAR_ICONS)) != 0);
|
|
5848 }
|
|
5849 }
|
|
5850 #endif
|
|
5851
|
|
5852 /* 'pastetoggle': translate key codes like in a mapping */
|
|
5853 else if (varp == &p_pt)
|
|
5854 {
|
|
5855 if (*p_pt)
|
|
5856 {
|
|
5857 (void)replace_termcodes(p_pt, &p, TRUE, TRUE);
|
|
5858 if (p != NULL)
|
|
5859 {
|
|
5860 if (new_value_alloced)
|
|
5861 free_string_option(p_pt);
|
|
5862 p_pt = p;
|
|
5863 new_value_alloced = TRUE;
|
|
5864 }
|
|
5865 }
|
|
5866 }
|
|
5867
|
|
5868 /* 'backspace' */
|
|
5869 else if (varp == &p_bs)
|
|
5870 {
|
|
5871 if (VIM_ISDIGIT(*p_bs))
|
|
5872 {
|
|
5873 if (*p_bs >'2' || p_bs[1] != NUL)
|
|
5874 errmsg = e_invarg;
|
|
5875 }
|
|
5876 else if (check_opt_strings(p_bs, p_bs_values, TRUE) != OK)
|
|
5877 errmsg = e_invarg;
|
|
5878 }
|
|
5879
|
|
5880 /* 'casemap' */
|
|
5881 else if (varp == &p_cmp)
|
|
5882 {
|
|
5883 if (opt_strings_flags(p_cmp, p_cmp_values, &cmp_flags, TRUE) != OK)
|
|
5884 errmsg = e_invarg;
|
|
5885 }
|
|
5886
|
|
5887 #ifdef FEAT_DIFF
|
|
5888 /* 'diffopt' */
|
|
5889 else if (varp == &p_dip)
|
|
5890 {
|
|
5891 if (diffopt_changed() == FAIL)
|
|
5892 errmsg = e_invarg;
|
|
5893 }
|
|
5894 #endif
|
|
5895
|
|
5896 #ifdef FEAT_FOLDING
|
|
5897 /* 'foldmethod' */
|
|
5898 else if (gvarp == &curwin->w_allbuf_opt.wo_fdm)
|
|
5899 {
|
|
5900 if (check_opt_strings(*varp, p_fdm_values, FALSE) != OK
|
|
5901 || *curwin->w_p_fdm == NUL)
|
|
5902 errmsg = e_invarg;
|
|
5903 else
|
|
5904 foldUpdateAll(curwin);
|
|
5905 }
|
|
5906 # ifdef FEAT_EVAL
|
|
5907 /* 'foldexpr' */
|
|
5908 else if (varp == &curwin->w_p_fde)
|
|
5909 {
|
|
5910 if (foldmethodIsExpr(curwin))
|
|
5911 foldUpdateAll(curwin);
|
|
5912 }
|
|
5913 # endif
|
|
5914 /* 'foldmarker' */
|
|
5915 else if (gvarp == &curwin->w_allbuf_opt.wo_fmr)
|
|
5916 {
|
|
5917 p = vim_strchr(*varp, ',');
|
|
5918 if (p == NULL)
|
|
5919 errmsg = (char_u *)N_("E536: comma required");
|
|
5920 else if (p == *varp || p[1] == NUL)
|
|
5921 errmsg = e_invarg;
|
|
5922 else if (foldmethodIsMarker(curwin))
|
|
5923 foldUpdateAll(curwin);
|
|
5924 }
|
|
5925 /* 'commentstring' */
|
|
5926 else if (gvarp == &p_cms)
|
|
5927 {
|
|
5928 if (**varp != NUL && strstr((char *)*varp, "%s") == NULL)
|
|
5929 errmsg = (char_u *)N_("E537: 'commentstring' must be empty or contain %s");
|
|
5930 }
|
|
5931 /* 'foldopen' */
|
|
5932 else if (varp == &p_fdo)
|
|
5933 {
|
|
5934 if (opt_strings_flags(p_fdo, p_fdo_values, &fdo_flags, TRUE) != OK)
|
|
5935 errmsg = e_invarg;
|
|
5936 }
|
|
5937 /* 'foldclose' */
|
|
5938 else if (varp == &p_fcl)
|
|
5939 {
|
|
5940 if (check_opt_strings(p_fcl, p_fcl_values, TRUE) != OK)
|
|
5941 errmsg = e_invarg;
|
|
5942 }
|
|
5943 #endif
|
|
5944
|
|
5945 #ifdef FEAT_VIRTUALEDIT
|
|
5946 /* 'virtualedit' */
|
|
5947 else if (varp == &p_ve)
|
|
5948 {
|
|
5949 if (opt_strings_flags(p_ve, p_ve_values, &ve_flags, TRUE) != OK)
|
|
5950 errmsg = e_invarg;
|
|
5951 else if (STRCMP(p_ve, oldval) != 0)
|
|
5952 {
|
|
5953 /* Recompute cursor position in case the new 've' setting
|
|
5954 * changes something. */
|
|
5955 validate_virtcol();
|
|
5956 coladvance(curwin->w_virtcol);
|
|
5957 }
|
|
5958 }
|
|
5959 #endif
|
|
5960
|
|
5961 #if defined(FEAT_CSCOPE) && defined(FEAT_QUICKFIX)
|
|
5962 else if (varp == &p_csqf)
|
|
5963 {
|
|
5964 if (p_csqf != NULL)
|
|
5965 {
|
|
5966 p = p_csqf;
|
|
5967 while (*p != NUL)
|
|
5968 {
|
|
5969 if (vim_strchr((char_u *)CSQF_CMDS, *p) == NULL
|
|
5970 || p[1] == NUL
|
|
5971 || vim_strchr((char_u *)CSQF_FLAGS, p[1]) == NULL
|
|
5972 || (p[2] != NUL && p[2] != ','))
|
|
5973 {
|
|
5974 errmsg = e_invarg;
|
|
5975 break;
|
|
5976 }
|
|
5977 else if (p[2] == NUL)
|
|
5978 break;
|
|
5979 else
|
|
5980 p += 3;
|
|
5981 }
|
|
5982 }
|
|
5983 }
|
|
5984 #endif
|
|
5985
|
|
5986 /* Options that are a list of flags. */
|
|
5987 else
|
|
5988 {
|
|
5989 p = NULL;
|
|
5990 if (varp == &p_ww)
|
|
5991 p = (char_u *)WW_ALL;
|
|
5992 if (varp == &p_shm)
|
|
5993 p = (char_u *)SHM_ALL;
|
|
5994 else if (varp == &(p_cpo))
|
|
5995 p = (char_u *)CPO_ALL;
|
|
5996 else if (varp == &(curbuf->b_p_fo))
|
|
5997 p = (char_u *)FO_ALL;
|
|
5998 else if (varp == &p_mouse)
|
|
5999 {
|
|
6000 #ifdef FEAT_MOUSE
|
|
6001 p = (char_u *)MOUSE_ALL;
|
|
6002 #else
|
|
6003 if (*p_mouse != NUL)
|
|
6004 errmsg = (char_u *)N_("E538: No mouse support");
|
|
6005 #endif
|
|
6006 }
|
|
6007 #if defined(FEAT_GUI)
|
|
6008 else if (varp == &p_go)
|
|
6009 p = (char_u *)GO_ALL;
|
|
6010 #endif
|
|
6011 if (p != NULL)
|
|
6012 {
|
|
6013 for (s = *varp; *s; ++s)
|
|
6014 if (vim_strchr(p, *s) == NULL)
|
|
6015 {
|
|
6016 errmsg = illegal_char(errbuf, *s);
|
|
6017 break;
|
|
6018 }
|
|
6019 }
|
|
6020 }
|
|
6021
|
|
6022 /*
|
|
6023 * If error detected, restore the previous value.
|
|
6024 */
|
|
6025 if (errmsg != NULL)
|
|
6026 {
|
|
6027 if (new_value_alloced)
|
|
6028 free_string_option(*varp);
|
|
6029 *varp = oldval;
|
|
6030 /*
|
|
6031 * When resetting some values, need to act on it.
|
|
6032 */
|
|
6033 if (did_chartab)
|
|
6034 (void)init_chartab();
|
|
6035 if (varp == &p_hl)
|
|
6036 (void)highlight_changed();
|
|
6037 }
|
|
6038 else
|
|
6039 {
|
|
6040 #ifdef FEAT_EVAL
|
|
6041 /* Remember where the option was set. */
|
|
6042 options[opt_idx].scriptID = current_SID;
|
|
6043 #endif
|
|
6044 /*
|
|
6045 * Free string options that are in allocated memory.
|
24
|
6046 * Use "free_oldval", because recursiveness may change the flags under
|
|
6047 * our fingers (esp. init_highlight()).
|
7
|
6048 */
|
24
|
6049 if (free_oldval)
|
7
|
6050 free_string_option(oldval);
|
|
6051 if (new_value_alloced)
|
|
6052 options[opt_idx].flags |= P_ALLOCED;
|
|
6053 else
|
|
6054 options[opt_idx].flags &= ~P_ALLOCED;
|
|
6055
|
|
6056 if ((opt_flags & (OPT_LOCAL | OPT_GLOBAL)) == 0
|
|
6057 && (int)options[opt_idx].indir >= PV_BOTH)
|
|
6058 {
|
|
6059 /* global option with local value set to use global value; free
|
|
6060 * the local value and make it empty */
|
|
6061 p = get_varp_scope(&(options[opt_idx]), OPT_LOCAL);
|
|
6062 free_string_option(*(char_u **)p);
|
|
6063 *(char_u **)p = empty_option;
|
|
6064 }
|
|
6065
|
|
6066 /* May set global value for local option. */
|
|
6067 else if (!(opt_flags & OPT_LOCAL) && opt_flags != OPT_GLOBAL)
|
|
6068 set_string_option_global(opt_idx, varp);
|
|
6069 }
|
|
6070
|
|
6071 #ifdef FEAT_MOUSE
|
|
6072 if (varp == &p_mouse)
|
|
6073 {
|
|
6074 # ifdef FEAT_MOUSE_TTY
|
|
6075 if (*p_mouse == NUL)
|
|
6076 mch_setmouse(FALSE); /* switch mouse off */
|
|
6077 else
|
|
6078 # endif
|
|
6079 setmouse(); /* in case 'mouse' changed */
|
|
6080 }
|
|
6081 #endif
|
|
6082
|
|
6083 if (curwin->w_curswant != MAXCOL)
|
|
6084 curwin->w_set_curswant = TRUE; /* in case 'showbreak' changed */
|
|
6085 check_redraw(options[opt_idx].flags);
|
|
6086
|
|
6087 return errmsg;
|
|
6088 }
|
|
6089
|
|
6090 /*
|
|
6091 * Handle setting 'listchars' or 'fillchars'.
|
|
6092 * Returns error message, NULL if it's OK.
|
|
6093 */
|
|
6094 static char_u *
|
|
6095 set_chars_option(varp)
|
|
6096 char_u **varp;
|
|
6097 {
|
|
6098 int round, i, len, entries;
|
|
6099 char_u *p, *s;
|
|
6100 int c1, c2 = 0;
|
|
6101 struct charstab
|
|
6102 {
|
|
6103 int *cp;
|
|
6104 char *name;
|
|
6105 };
|
|
6106 #if defined(FEAT_WINDOWS) || defined(FEAT_FOLDING)
|
|
6107 static struct charstab filltab[] =
|
|
6108 {
|
|
6109 {&fill_stl, "stl"},
|
|
6110 {&fill_stlnc, "stlnc"},
|
|
6111 {&fill_vert, "vert"},
|
|
6112 {&fill_fold, "fold"},
|
|
6113 {&fill_diff, "diff"},
|
|
6114 };
|
|
6115 #endif
|
|
6116 static struct charstab lcstab[] =
|
|
6117 {
|
|
6118 {&lcs_eol, "eol"},
|
|
6119 {&lcs_ext, "extends"},
|
12
|
6120 {&lcs_nbsp, "nbsp"},
|
7
|
6121 {&lcs_prec, "precedes"},
|
|
6122 {&lcs_tab2, "tab"},
|
|
6123 {&lcs_trail, "trail"},
|
|
6124 };
|
|
6125 struct charstab *tab;
|
|
6126
|
|
6127 #if defined(FEAT_WINDOWS) || defined(FEAT_FOLDING)
|
|
6128 if (varp == &p_lcs)
|
|
6129 #endif
|
|
6130 {
|
|
6131 tab = lcstab;
|
|
6132 entries = sizeof(lcstab) / sizeof(struct charstab);
|
|
6133 }
|
|
6134 #if defined(FEAT_WINDOWS) || defined(FEAT_FOLDING)
|
|
6135 else
|
|
6136 {
|
|
6137 tab = filltab;
|
|
6138 entries = sizeof(filltab) / sizeof(struct charstab);
|
|
6139 }
|
|
6140 #endif
|
|
6141
|
|
6142 /* first round: check for valid value, second round: assign values */
|
|
6143 for (round = 0; round <= 1; ++round)
|
|
6144 {
|
|
6145 if (round)
|
|
6146 {
|
|
6147 /* After checking that the value is valid: set defaults: space for
|
|
6148 * 'fillchars', NUL for 'listchars' */
|
|
6149 for (i = 0; i < entries; ++i)
|
|
6150 *(tab[i].cp) = (varp == &p_lcs ? NUL : ' ');
|
|
6151 if (varp == &p_lcs)
|
|
6152 lcs_tab1 = NUL;
|
|
6153 #if defined(FEAT_WINDOWS) || defined(FEAT_FOLDING)
|
|
6154 else
|
|
6155 fill_diff = '-';
|
|
6156 #endif
|
|
6157 }
|
|
6158 p = *varp;
|
|
6159 while (*p)
|
|
6160 {
|
|
6161 for (i = 0; i < entries; ++i)
|
|
6162 {
|
|
6163 len = (int)STRLEN(tab[i].name);
|
|
6164 if (STRNCMP(p, tab[i].name, len) == 0
|
|
6165 && p[len] == ':'
|
|
6166 && p[len + 1] != NUL)
|
|
6167 {
|
|
6168 s = p + len + 1;
|
|
6169 #ifdef FEAT_MBYTE
|
|
6170 c1 = mb_ptr2char_adv(&s);
|
|
6171 #else
|
|
6172 c1 = *s++;
|
|
6173 #endif
|
|
6174 if (tab[i].cp == &lcs_tab2)
|
|
6175 {
|
|
6176 if (*s == NUL)
|
|
6177 continue;
|
|
6178 #ifdef FEAT_MBYTE
|
|
6179 c2 = mb_ptr2char_adv(&s);
|
|
6180 #else
|
|
6181 c2 = *s++;
|
|
6182 #endif
|
|
6183 }
|
|
6184 if (*s == ',' || *s == NUL)
|
|
6185 {
|
|
6186 if (round)
|
|
6187 {
|
|
6188 if (tab[i].cp == &lcs_tab2)
|
|
6189 {
|
|
6190 lcs_tab1 = c1;
|
|
6191 lcs_tab2 = c2;
|
|
6192 }
|
|
6193 else
|
|
6194 *(tab[i].cp) = c1;
|
|
6195
|
|
6196 }
|
|
6197 p = s;
|
|
6198 break;
|
|
6199 }
|
|
6200 }
|
|
6201 }
|
|
6202
|
|
6203 if (i == entries)
|
|
6204 return e_invarg;
|
|
6205 if (*p == ',')
|
|
6206 ++p;
|
|
6207 }
|
|
6208 }
|
|
6209
|
|
6210 return NULL; /* no error */
|
|
6211 }
|
|
6212
|
|
6213 #ifdef FEAT_STL_OPT
|
|
6214 /*
|
|
6215 * Check validity of options with the 'statusline' format.
|
|
6216 * Return error message or NULL.
|
|
6217 */
|
|
6218 char_u *
|
|
6219 check_stl_option(s)
|
|
6220 char_u *s;
|
|
6221 {
|
|
6222 int itemcnt = 0;
|
|
6223 int groupdepth = 0;
|
|
6224 static char_u errbuf[80];
|
|
6225
|
|
6226 while (*s && itemcnt < STL_MAX_ITEM)
|
|
6227 {
|
|
6228 /* Check for valid keys after % sequences */
|
|
6229 while (*s && *s != '%')
|
|
6230 s++;
|
|
6231 if (!*s)
|
|
6232 break;
|
|
6233 s++;
|
|
6234 if (*s != '%' && *s != ')')
|
|
6235 ++itemcnt;
|
|
6236 if (*s == '%' || *s == STL_TRUNCMARK || *s == STL_MIDDLEMARK)
|
|
6237 {
|
|
6238 s++;
|
|
6239 continue;
|
|
6240 }
|
|
6241 if (*s == ')')
|
|
6242 {
|
|
6243 s++;
|
|
6244 if (--groupdepth < 0)
|
|
6245 break;
|
|
6246 continue;
|
|
6247 }
|
|
6248 if (*s == '-')
|
|
6249 s++;
|
|
6250 while (VIM_ISDIGIT(*s))
|
|
6251 s++;
|
|
6252 if (*s == STL_HIGHLIGHT)
|
|
6253 continue;
|
|
6254 if (*s == '.')
|
|
6255 {
|
|
6256 s++;
|
|
6257 while (*s && VIM_ISDIGIT(*s))
|
|
6258 s++;
|
|
6259 }
|
|
6260 if (*s == '(')
|
|
6261 {
|
|
6262 groupdepth++;
|
|
6263 continue;
|
|
6264 }
|
|
6265 if (vim_strchr(STL_ALL, *s) == NULL)
|
|
6266 {
|
|
6267 return illegal_char(errbuf, *s);
|
|
6268 }
|
|
6269 if (*s == '{')
|
|
6270 {
|
|
6271 s++;
|
|
6272 while (*s != '}' && *s)
|
|
6273 s++;
|
|
6274 if (*s != '}')
|
|
6275 return (char_u *)N_("E540: Unclosed expression sequence");
|
|
6276 }
|
|
6277 }
|
|
6278 if (itemcnt >= STL_MAX_ITEM)
|
|
6279 return (char_u *)N_("E541: too many items");
|
|
6280 if (groupdepth != 0)
|
|
6281 return (char_u *)N_("E542: unbalanced groups");
|
|
6282 return NULL;
|
|
6283 }
|
|
6284 #endif
|
|
6285
|
|
6286 #ifdef FEAT_CLIPBOARD
|
|
6287 /*
|
|
6288 * Extract the items in the 'clipboard' option and set global values.
|
|
6289 */
|
|
6290 static char_u *
|
|
6291 check_clipboard_option()
|
|
6292 {
|
|
6293 int new_unnamed = FALSE;
|
|
6294 int new_autoselect = FALSE;
|
|
6295 int new_autoselectml = FALSE;
|
|
6296 regprog_T *new_exclude_prog = NULL;
|
|
6297 char_u *errmsg = NULL;
|
|
6298 char_u *p;
|
|
6299
|
|
6300 for (p = p_cb; *p != NUL; )
|
|
6301 {
|
|
6302 if (STRNCMP(p, "unnamed", 7) == 0 && (p[7] == ',' || p[7] == NUL))
|
|
6303 {
|
|
6304 new_unnamed = TRUE;
|
|
6305 p += 7;
|
|
6306 }
|
|
6307 else if (STRNCMP(p, "autoselect", 10) == 0
|
|
6308 && (p[10] == ',' || p[10] == NUL))
|
|
6309 {
|
|
6310 new_autoselect = TRUE;
|
|
6311 p += 10;
|
|
6312 }
|
|
6313 else if (STRNCMP(p, "autoselectml", 12) == 0
|
|
6314 && (p[12] == ',' || p[12] == NUL))
|
|
6315 {
|
|
6316 new_autoselectml = TRUE;
|
|
6317 p += 12;
|
|
6318 }
|
|
6319 else if (STRNCMP(p, "exclude:", 8) == 0 && new_exclude_prog == NULL)
|
|
6320 {
|
|
6321 p += 8;
|
|
6322 new_exclude_prog = vim_regcomp(p, RE_MAGIC);
|
|
6323 if (new_exclude_prog == NULL)
|
|
6324 errmsg = e_invarg;
|
|
6325 break;
|
|
6326 }
|
|
6327 else
|
|
6328 {
|
|
6329 errmsg = e_invarg;
|
|
6330 break;
|
|
6331 }
|
|
6332 if (*p == ',')
|
|
6333 ++p;
|
|
6334 }
|
|
6335 if (errmsg == NULL)
|
|
6336 {
|
|
6337 clip_unnamed = new_unnamed;
|
|
6338 clip_autoselect = new_autoselect;
|
|
6339 clip_autoselectml = new_autoselectml;
|
|
6340 vim_free(clip_exclude_prog);
|
|
6341 clip_exclude_prog = new_exclude_prog;
|
|
6342 }
|
|
6343 else
|
|
6344 vim_free(new_exclude_prog);
|
|
6345
|
|
6346 return errmsg;
|
|
6347 }
|
|
6348 #endif
|
|
6349
|
|
6350 /*
|
|
6351 * Set the value of a boolean option, and take care of side effects.
|
|
6352 * Returns NULL for success, or an error message for an error.
|
|
6353 */
|
|
6354 static char_u *
|
|
6355 set_bool_option(opt_idx, varp, value, opt_flags)
|
|
6356 int opt_idx; /* index in options[] table */
|
|
6357 char_u *varp; /* pointer to the option variable */
|
|
6358 int value; /* new value */
|
|
6359 int opt_flags; /* OPT_LOCAL and/or OPT_GLOBAL */
|
|
6360 {
|
|
6361 int old_value = *(int *)varp;
|
|
6362
|
|
6363 #ifdef FEAT_GUI
|
|
6364 need_mouse_correct = TRUE;
|
|
6365 #endif
|
|
6366
|
|
6367 /* Disallow changing some options from secure mode */
|
|
6368 if ((secure
|
|
6369 #ifdef HAVE_SANDBOX
|
|
6370 || sandbox != 0
|
|
6371 #endif
|
|
6372 ) && (options[opt_idx].flags & P_SECURE))
|
|
6373 return e_secure;
|
|
6374
|
|
6375 *(int *)varp = value; /* set the new value */
|
|
6376 #ifdef FEAT_EVAL
|
|
6377 /* Remember where the option was set. */
|
|
6378 options[opt_idx].scriptID = current_SID;
|
|
6379 #endif
|
|
6380
|
|
6381 /* May set global value for local option. */
|
|
6382 if ((opt_flags & (OPT_LOCAL | OPT_GLOBAL)) == 0)
|
|
6383 *(int *)get_varp_scope(&(options[opt_idx]), OPT_GLOBAL) = value;
|
|
6384
|
|
6385 /*
|
|
6386 * Handle side effects of changing a bool option.
|
|
6387 */
|
|
6388
|
|
6389 /* 'compatible' */
|
|
6390 if ((int *)varp == &p_cp)
|
|
6391 {
|
|
6392 compatible_set();
|
|
6393 }
|
|
6394
|
|
6395 /* when 'readonly' is reset globally, also reset readonlymode */
|
|
6396 else if ((int *)varp == &curbuf->b_p_ro)
|
|
6397 {
|
|
6398 if (!curbuf->b_p_ro && (opt_flags & OPT_LOCAL) == 0)
|
|
6399 readonlymode = FALSE;
|
|
6400 #ifdef FEAT_TITLE
|
|
6401 need_maketitle = TRUE;
|
|
6402 #endif
|
|
6403 }
|
|
6404
|
|
6405 #ifdef FEAT_TITLE
|
|
6406 /* when 'modifiable' is changed, redraw the window title */
|
|
6407 else if ((int *)varp == &curbuf->b_p_ma)
|
|
6408 need_maketitle = TRUE;
|
|
6409 /* when 'endofline' is changed, redraw the window title */
|
|
6410 else if ((int *)varp == &curbuf->b_p_eol)
|
|
6411 need_maketitle = TRUE;
|
|
6412 #endif
|
|
6413
|
|
6414 /* when 'bin' is set also set some other options */
|
|
6415 else if ((int *)varp == &curbuf->b_p_bin)
|
|
6416 {
|
|
6417 set_options_bin(old_value, curbuf->b_p_bin, opt_flags);
|
|
6418 #ifdef FEAT_TITLE
|
|
6419 need_maketitle = TRUE;
|
|
6420 #endif
|
|
6421 }
|
|
6422
|
|
6423 #ifdef FEAT_AUTOCMD
|
|
6424 /* when 'buflisted' changes, trigger autocommands */
|
|
6425 else if ((int *)varp == &curbuf->b_p_bl && old_value != curbuf->b_p_bl)
|
|
6426 {
|
|
6427 apply_autocmds(curbuf->b_p_bl ? EVENT_BUFADD : EVENT_BUFDELETE,
|
|
6428 NULL, NULL, TRUE, curbuf);
|
|
6429 }
|
|
6430 #endif
|
|
6431
|
|
6432 /* when 'swf' is set, create swapfile, when reset remove swapfile */
|
|
6433 else if ((int *)varp == &curbuf->b_p_swf)
|
|
6434 {
|
|
6435 if (curbuf->b_p_swf && p_uc)
|
|
6436 ml_open_file(curbuf); /* create the swap file */
|
|
6437 else
|
|
6438 mf_close_file(curbuf, TRUE); /* remove the swap file */
|
|
6439 }
|
|
6440
|
|
6441 /* when 'terse' is set change 'shortmess' */
|
|
6442 else if ((int *)varp == &p_terse)
|
|
6443 {
|
|
6444 char_u *p;
|
|
6445
|
|
6446 p = vim_strchr(p_shm, SHM_SEARCH);
|
|
6447
|
|
6448 /* insert 's' in p_shm */
|
|
6449 if (p_terse && p == NULL)
|
|
6450 {
|
|
6451 STRCPY(IObuff, p_shm);
|
|
6452 STRCAT(IObuff, "s");
|
|
6453 set_string_option_direct((char_u *)"shm", -1, IObuff, OPT_FREE);
|
|
6454 }
|
|
6455 /* remove 's' from p_shm */
|
|
6456 else if (!p_terse && p != NULL)
|
|
6457 mch_memmove(p, p + 1, STRLEN(p));
|
|
6458 }
|
|
6459
|
|
6460 /* when 'paste' is set or reset also change other options */
|
|
6461 else if ((int *)varp == &p_paste)
|
|
6462 {
|
|
6463 paste_option_changed();
|
|
6464 }
|
|
6465
|
|
6466 /* when 'insertmode' is set from an autocommand need to do work here */
|
|
6467 else if ((int *)varp == &p_im)
|
|
6468 {
|
|
6469 if (p_im)
|
|
6470 {
|
|
6471 if ((State & INSERT) == 0)
|
|
6472 need_start_insertmode = TRUE;
|
|
6473 stop_insert_mode = FALSE;
|
|
6474 }
|
|
6475 else
|
|
6476 {
|
|
6477 need_start_insertmode = FALSE;
|
|
6478 stop_insert_mode = TRUE;
|
|
6479 if (p_smd && restart_edit != 0)
|
|
6480 clear_cmdline = TRUE; /* remove "(insert)" */
|
|
6481 restart_edit = 0;
|
|
6482 }
|
|
6483 }
|
|
6484
|
|
6485 /* when 'ignorecase' is set or reset and 'hlsearch' is set, redraw */
|
|
6486 else if ((int *)varp == &p_ic && p_hls)
|
|
6487 {
|
|
6488 redraw_all_later(NOT_VALID);
|
|
6489 }
|
|
6490
|
|
6491 #ifdef FEAT_SEARCH_EXTRA
|
|
6492 /* when 'hlsearch' is set or reset: reset no_hlsearch */
|
|
6493 else if ((int *)varp == &p_hls)
|
|
6494 {
|
|
6495 no_hlsearch = FALSE;
|
|
6496 }
|
|
6497 #endif
|
|
6498
|
|
6499 #ifdef FEAT_SCROLLBIND
|
|
6500 /* when 'scrollbind' is set: snapshot the current position to avoid a jump
|
|
6501 * at the end of normal_cmd() */
|
|
6502 else if ((int *)varp == &curwin->w_p_scb)
|
|
6503 {
|
|
6504 if (curwin->w_p_scb)
|
|
6505 do_check_scrollbind(FALSE);
|
|
6506 }
|
|
6507 #endif
|
|
6508
|
|
6509 #if defined(FEAT_WINDOWS) && defined(FEAT_QUICKFIX)
|
|
6510 /* There can be only one window with 'previewwindow' set. */
|
|
6511 else if ((int *)varp == &curwin->w_p_pvw)
|
|
6512 {
|
|
6513 if (curwin->w_p_pvw)
|
|
6514 {
|
|
6515 win_T *win;
|
|
6516
|
|
6517 for (win = firstwin; win != NULL; win = win->w_next)
|
|
6518 if (win->w_p_pvw && win != curwin)
|
|
6519 {
|
|
6520 curwin->w_p_pvw = FALSE;
|
|
6521 return (char_u *)N_("E590: A preview window already exists");
|
|
6522 }
|
|
6523 }
|
|
6524 }
|
|
6525 #endif
|
|
6526
|
|
6527 /* when 'textmode' is set or reset also change 'fileformat' */
|
|
6528 else if ((int *)varp == &curbuf->b_p_tx)
|
|
6529 {
|
|
6530 set_fileformat(curbuf->b_p_tx ? EOL_DOS : EOL_UNIX, opt_flags);
|
|
6531 }
|
|
6532
|
|
6533 /* when 'textauto' is set or reset also change 'fileformats' */
|
|
6534 else if ((int *)varp == &p_ta)
|
|
6535 {
|
|
6536 set_string_option_direct((char_u *)"ffs", -1,
|
|
6537 p_ta ? (char_u *)DFLT_FFS_VIM : (char_u *)"",
|
|
6538 OPT_FREE | opt_flags);
|
|
6539 }
|
|
6540
|
|
6541 /*
|
|
6542 * When 'lisp' option changes include/exclude '-' in
|
|
6543 * keyword characters.
|
|
6544 */
|
|
6545 #ifdef FEAT_LISP
|
|
6546 else if (varp == (char_u *)&(curbuf->b_p_lisp))
|
|
6547 {
|
|
6548 (void)buf_init_chartab(curbuf, FALSE); /* ignore errors */
|
|
6549 }
|
|
6550 #endif
|
|
6551
|
|
6552 #ifdef FEAT_TITLE
|
|
6553 /* when 'title' changed, may need to change the title; same for 'icon' */
|
|
6554 else if ((int *)varp == &p_title)
|
|
6555 {
|
|
6556 did_set_title(FALSE);
|
|
6557 }
|
|
6558
|
|
6559 else if ((int *)varp == &p_icon)
|
|
6560 {
|
|
6561 did_set_title(TRUE);
|
|
6562 }
|
|
6563 #endif
|
|
6564
|
|
6565 else if ((int *)varp == &curbuf->b_changed)
|
|
6566 {
|
|
6567 if (!value)
|
|
6568 save_file_ff(curbuf); /* Buffer is unchanged */
|
|
6569 #ifdef FEAT_TITLE
|
|
6570 need_maketitle = TRUE;
|
|
6571 #endif
|
|
6572 #ifdef FEAT_AUTOCMD
|
|
6573 modified_was_set = value;
|
|
6574 #endif
|
|
6575 }
|
|
6576
|
|
6577 #ifdef BACKSLASH_IN_FILENAME
|
|
6578 else if ((int *)varp == &p_ssl)
|
|
6579 {
|
|
6580 if (p_ssl)
|
|
6581 {
|
|
6582 psepc = '/';
|
|
6583 psepcN = '\\';
|
|
6584 pseps[0] = '/';
|
|
6585 psepsN[0] = '\\';
|
|
6586 }
|
|
6587 else
|
|
6588 {
|
|
6589 psepc = '\\';
|
|
6590 psepcN = '/';
|
|
6591 pseps[0] = '\\';
|
|
6592 psepsN[0] = '/';
|
|
6593 }
|
|
6594
|
|
6595 /* need to adjust the file name arguments and buffer names. */
|
|
6596 buflist_slash_adjust();
|
|
6597 alist_slash_adjust();
|
|
6598 # ifdef FEAT_EVAL
|
|
6599 scriptnames_slash_adjust();
|
|
6600 # endif
|
|
6601 }
|
|
6602 #endif
|
|
6603
|
|
6604 /* If 'wrap' is set, set w_leftcol to zero. */
|
|
6605 else if ((int *)varp == &curwin->w_p_wrap)
|
|
6606 {
|
|
6607 if (curwin->w_p_wrap)
|
|
6608 curwin->w_leftcol = 0;
|
|
6609 }
|
|
6610
|
|
6611 #ifdef FEAT_WINDOWS
|
|
6612 else if ((int *)varp == &p_ea)
|
|
6613 {
|
|
6614 if (p_ea && !old_value)
|
|
6615 win_equal(curwin, FALSE, 0);
|
|
6616 }
|
|
6617 #endif
|
|
6618
|
|
6619 else if ((int *)varp == &p_wiv)
|
|
6620 {
|
|
6621 /*
|
|
6622 * When 'weirdinvert' changed, set/reset 't_xs'.
|
|
6623 * Then set 'weirdinvert' according to value of 't_xs'.
|
|
6624 */
|
|
6625 if (p_wiv && !old_value)
|
|
6626 T_XS = (char_u *)"y";
|
|
6627 else if (!p_wiv && old_value)
|
|
6628 T_XS = empty_option;
|
|
6629 p_wiv = (*T_XS != NUL);
|
|
6630 }
|
|
6631
|
190
|
6632 #ifdef FEAT_BEVAL
|
7
|
6633 else if ((int *)varp == &p_beval)
|
|
6634 {
|
|
6635 if (p_beval == TRUE)
|
|
6636 gui_mch_enable_beval_area(balloonEval);
|
|
6637 else
|
|
6638 gui_mch_disable_beval_area(balloonEval);
|
|
6639 }
|
|
6640
|
190
|
6641 # if defined(FEAT_NETBEANS_INTG) || defined(FEAT_SUN_WORKSHOP)
|
7
|
6642 else if ((int *)varp == &p_acd)
|
|
6643 {
|
|
6644 if (p_acd && curbuf->b_ffname != NULL
|
|
6645 && vim_chdirfile(curbuf->b_ffname) == OK)
|
|
6646 shorten_fnames(TRUE);
|
|
6647 }
|
190
|
6648 # endif
|
7
|
6649 #endif
|
|
6650
|
|
6651 #ifdef FEAT_DIFF
|
|
6652 /* 'diff' */
|
|
6653 else if ((int *)varp == &curwin->w_p_diff)
|
|
6654 {
|
16
|
6655 /* May add or remove the buffer from the list of diff buffers. */
|
|
6656 diff_buf_adjust(curwin);
|
|
6657 # ifdef FEAT_FOLDING
|
7
|
6658 if (foldmethodIsDiff(curwin))
|
|
6659 foldUpdateAll(curwin);
|
16
|
6660 # endif
|
7
|
6661 }
|
|
6662 #endif
|
|
6663
|
|
6664 #ifdef USE_IM_CONTROL
|
|
6665 /* 'imdisable' */
|
|
6666 else if ((int *)varp == &p_imdisable)
|
|
6667 {
|
|
6668 /* Only de-activate it here, it will be enabled when changing mode. */
|
|
6669 if (p_imdisable)
|
|
6670 im_set_active(FALSE);
|
|
6671 }
|
|
6672 #endif
|
|
6673
|
258
|
6674 #ifdef FEAT_SYN_HL
|
|
6675 /* 'spell' */
|
|
6676 else if ((int *)varp == &curwin->w_p_spell)
|
|
6677 {
|
|
6678 if (curwin->w_p_spell)
|
|
6679 {
|
|
6680 char_u *errmsg = did_set_spelllang(curbuf);
|
320
|
6681
|
258
|
6682 if (errmsg != NULL)
|
|
6683 EMSG(_(errmsg));
|
|
6684 }
|
|
6685 }
|
|
6686 #endif
|
|
6687
|
7
|
6688 #ifdef FEAT_FKMAP
|
|
6689 else if ((int *)varp == &p_altkeymap)
|
|
6690 {
|
|
6691 if (old_value != p_altkeymap)
|
|
6692 {
|
|
6693 if (!p_altkeymap)
|
|
6694 {
|
|
6695 p_hkmap = p_fkmap;
|
|
6696 p_fkmap = 0;
|
|
6697 }
|
|
6698 else
|
|
6699 {
|
|
6700 p_fkmap = p_hkmap;
|
|
6701 p_hkmap = 0;
|
|
6702 }
|
|
6703 (void)init_chartab();
|
|
6704 }
|
|
6705 }
|
|
6706
|
|
6707 /*
|
|
6708 * In case some second language keymapping options have changed, check
|
|
6709 * and correct the setting in a consistent way.
|
|
6710 */
|
|
6711
|
|
6712 /*
|
|
6713 * If hkmap or fkmap are set, reset Arabic keymapping.
|
|
6714 */
|
|
6715 if ((p_hkmap || p_fkmap) && p_altkeymap)
|
|
6716 {
|
|
6717 p_altkeymap = p_fkmap;
|
|
6718 # ifdef FEAT_ARABIC
|
|
6719 curwin->w_p_arab = FALSE;
|
|
6720 # endif
|
|
6721 (void)init_chartab();
|
|
6722 }
|
|
6723
|
|
6724 /*
|
|
6725 * If hkmap set, reset Farsi keymapping.
|
|
6726 */
|
|
6727 if (p_hkmap && p_altkeymap)
|
|
6728 {
|
|
6729 p_altkeymap = 0;
|
|
6730 p_fkmap = 0;
|
|
6731 # ifdef FEAT_ARABIC
|
|
6732 curwin->w_p_arab = FALSE;
|
|
6733 # endif
|
|
6734 (void)init_chartab();
|
|
6735 }
|
|
6736
|
|
6737 /*
|
|
6738 * If fkmap set, reset Hebrew keymapping.
|
|
6739 */
|
|
6740 if (p_fkmap && !p_altkeymap)
|
|
6741 {
|
|
6742 p_altkeymap = 1;
|
|
6743 p_hkmap = 0;
|
|
6744 # ifdef FEAT_ARABIC
|
|
6745 curwin->w_p_arab = FALSE;
|
|
6746 # endif
|
|
6747 (void)init_chartab();
|
|
6748 }
|
|
6749 #endif
|
|
6750
|
|
6751 #ifdef FEAT_ARABIC
|
|
6752 if ((int *)varp == &curwin->w_p_arab)
|
|
6753 {
|
|
6754 if (curwin->w_p_arab)
|
|
6755 {
|
|
6756 /*
|
|
6757 * 'arabic' is set, handle various sub-settings.
|
|
6758 */
|
|
6759 if (!p_tbidi)
|
|
6760 {
|
|
6761 /* set rightleft mode */
|
|
6762 if (!curwin->w_p_rl)
|
|
6763 {
|
|
6764 curwin->w_p_rl = TRUE;
|
|
6765 changed_window_setting();
|
|
6766 }
|
|
6767
|
|
6768 /* Enable Arabic shaping (major part of what Arabic requires) */
|
|
6769 if (!p_arshape)
|
|
6770 {
|
|
6771 p_arshape = TRUE;
|
|
6772 redraw_later_clear();
|
|
6773 }
|
|
6774 }
|
|
6775
|
|
6776 /* Arabic requires a utf-8 encoding, inform the user if its not
|
|
6777 * set. */
|
|
6778 if (STRCMP(p_enc, "utf-8") != 0)
|
16
|
6779 {
|
|
6780 msg_source(hl_attr(HLF_W));
|
7
|
6781 MSG_ATTR(_("W17: Arabic requires UTF-8, do ':set encoding=utf-8'"),
|
|
6782 hl_attr(HLF_W));
|
16
|
6783 }
|
7
|
6784
|
|
6785 # ifdef FEAT_MBYTE
|
|
6786 /* set 'delcombine' */
|
|
6787 p_deco = TRUE;
|
|
6788 # endif
|
|
6789
|
|
6790 # ifdef FEAT_KEYMAP
|
|
6791 /* Force-set the necessary keymap for arabic */
|
|
6792 set_option_value((char_u *)"keymap", 0L, (char_u *)"arabic",
|
|
6793 OPT_LOCAL);
|
|
6794 # endif
|
|
6795 # ifdef FEAT_FKMAP
|
|
6796 p_altkeymap = 0;
|
|
6797 p_hkmap = 0;
|
|
6798 p_fkmap = 0;
|
|
6799 (void)init_chartab();
|
|
6800 # endif
|
|
6801 }
|
|
6802 else
|
|
6803 {
|
|
6804 /*
|
|
6805 * 'arabic' is reset, handle various sub-settings.
|
|
6806 */
|
|
6807 if (!p_tbidi)
|
|
6808 {
|
|
6809 /* reset rightleft mode */
|
|
6810 if (curwin->w_p_rl)
|
|
6811 {
|
|
6812 curwin->w_p_rl = FALSE;
|
|
6813 changed_window_setting();
|
|
6814 }
|
|
6815
|
|
6816 /* 'arabicshape' isn't reset, it is a global option and
|
|
6817 * another window may still need it "on". */
|
|
6818 }
|
|
6819
|
|
6820 /* 'delcombine' isn't reset, it is a global option and another
|
|
6821 * window may still want it "on". */
|
|
6822
|
|
6823 # ifdef FEAT_KEYMAP
|
|
6824 /* Revert to the default keymap */
|
|
6825 curbuf->b_p_iminsert = B_IMODE_NONE;
|
|
6826 curbuf->b_p_imsearch = B_IMODE_USE_INSERT;
|
|
6827 # endif
|
|
6828 }
|
|
6829 }
|
|
6830 #endif
|
|
6831
|
|
6832 /*
|
|
6833 * End of handling side effects for bool options.
|
|
6834 */
|
|
6835
|
|
6836 options[opt_idx].flags |= P_WAS_SET;
|
|
6837
|
|
6838 comp_col(); /* in case 'ruler' or 'showcmd' changed */
|
|
6839 if (curwin->w_curswant != MAXCOL)
|
|
6840 curwin->w_set_curswant = TRUE; /* in case 'list' changed */
|
|
6841 check_redraw(options[opt_idx].flags);
|
|
6842
|
|
6843 return NULL;
|
|
6844 }
|
|
6845
|
|
6846 /*
|
|
6847 * Set the value of a number option, and take care of side effects.
|
|
6848 * Returns NULL for success, or an error message for an error.
|
|
6849 */
|
|
6850 static char_u *
|
274
|
6851 set_num_option(opt_idx, varp, value, errbuf, errbuflen, opt_flags)
|
7
|
6852 int opt_idx; /* index in options[] table */
|
|
6853 char_u *varp; /* pointer to the option variable */
|
|
6854 long value; /* new value */
|
|
6855 char_u *errbuf; /* buffer for error messages */
|
274
|
6856 size_t errbuflen; /* length of "errbuf" */
|
7
|
6857 int opt_flags; /* OPT_LOCAL, OPT_GLOBAL and
|
|
6858 OPT_MODELINE */
|
|
6859 {
|
|
6860 char_u *errmsg = NULL;
|
|
6861 long old_value = *(long *)varp;
|
|
6862 long old_Rows = Rows; /* remember old Rows */
|
|
6863 long old_Columns = Columns; /* remember old Columns */
|
|
6864 long *pp = (long *)varp;
|
|
6865
|
|
6866 #ifdef FEAT_GUI
|
|
6867 need_mouse_correct = TRUE;
|
|
6868 #endif
|
|
6869
|
|
6870 *pp = value;
|
|
6871 #ifdef FEAT_EVAL
|
|
6872 /* Remember where the option was set. */
|
|
6873 options[opt_idx].scriptID = current_SID;
|
|
6874 #endif
|
|
6875
|
|
6876 if (curbuf->b_p_sw <= 0)
|
|
6877 {
|
|
6878 errmsg = e_positive;
|
|
6879 curbuf->b_p_sw = curbuf->b_p_ts;
|
|
6880 }
|
|
6881
|
|
6882 /*
|
|
6883 * Number options that need some action when changed
|
|
6884 */
|
|
6885 #ifdef FEAT_WINDOWS
|
|
6886 if (pp == &p_wh || pp == &p_hh)
|
|
6887 {
|
|
6888 if (p_wh < 1)
|
|
6889 {
|
|
6890 errmsg = e_positive;
|
|
6891 p_wh = 1;
|
|
6892 }
|
|
6893 if (p_wmh > p_wh)
|
|
6894 {
|
|
6895 errmsg = e_winheight;
|
|
6896 p_wh = p_wmh;
|
|
6897 }
|
|
6898 if (p_hh < 0)
|
|
6899 {
|
|
6900 errmsg = e_positive;
|
|
6901 p_hh = 0;
|
|
6902 }
|
|
6903
|
|
6904 /* Change window height NOW */
|
|
6905 if (lastwin != firstwin)
|
|
6906 {
|
|
6907 if (pp == &p_wh && curwin->w_height < p_wh)
|
|
6908 win_setheight((int)p_wh);
|
|
6909 if (pp == &p_hh && curbuf->b_help && curwin->w_height < p_hh)
|
|
6910 win_setheight((int)p_hh);
|
|
6911 }
|
|
6912 }
|
|
6913
|
|
6914 /* 'winminheight' */
|
|
6915 else if (pp == &p_wmh)
|
|
6916 {
|
|
6917 if (p_wmh < 0)
|
|
6918 {
|
|
6919 errmsg = e_positive;
|
|
6920 p_wmh = 0;
|
|
6921 }
|
|
6922 if (p_wmh > p_wh)
|
|
6923 {
|
|
6924 errmsg = e_winheight;
|
|
6925 p_wmh = p_wh;
|
|
6926 }
|
|
6927 win_setminheight();
|
|
6928 }
|
|
6929
|
|
6930 # ifdef FEAT_VERTSPLIT
|
13
|
6931 else if (pp == &p_wiw)
|
7
|
6932 {
|
|
6933 if (p_wiw < 1)
|
|
6934 {
|
|
6935 errmsg = e_positive;
|
|
6936 p_wiw = 1;
|
|
6937 }
|
|
6938 if (p_wmw > p_wiw)
|
|
6939 {
|
|
6940 errmsg = e_winwidth;
|
|
6941 p_wiw = p_wmw;
|
|
6942 }
|
|
6943
|
|
6944 /* Change window width NOW */
|
|
6945 if (lastwin != firstwin && curwin->w_width < p_wiw)
|
|
6946 win_setwidth((int)p_wiw);
|
|
6947 }
|
|
6948
|
|
6949 /* 'winminwidth' */
|
|
6950 else if (pp == &p_wmw)
|
|
6951 {
|
|
6952 if (p_wmw < 0)
|
|
6953 {
|
|
6954 errmsg = e_positive;
|
|
6955 p_wmw = 0;
|
|
6956 }
|
|
6957 if (p_wmw > p_wiw)
|
|
6958 {
|
|
6959 errmsg = e_winwidth;
|
|
6960 p_wmw = p_wiw;
|
|
6961 }
|
|
6962 win_setminheight();
|
|
6963 }
|
|
6964 # endif
|
|
6965
|
|
6966 #endif
|
|
6967
|
|
6968 #ifdef FEAT_WINDOWS
|
|
6969 /* (re)set last window status line */
|
|
6970 else if (pp == &p_ls)
|
|
6971 {
|
|
6972 last_status(FALSE);
|
|
6973 }
|
|
6974 #endif
|
|
6975
|
|
6976 #ifdef FEAT_GUI
|
|
6977 else if (pp == &p_linespace)
|
|
6978 {
|
|
6979 if (gui.in_use && gui_mch_adjust_charsize() == OK)
|
|
6980 gui_set_shellsize(FALSE, FALSE);
|
|
6981 }
|
|
6982 #endif
|
|
6983
|
|
6984 #ifdef FEAT_FOLDING
|
|
6985 /* 'foldlevel' */
|
|
6986 else if (pp == &curwin->w_p_fdl)
|
|
6987 {
|
|
6988 if (curwin->w_p_fdl < 0)
|
|
6989 curwin->w_p_fdl = 0;
|
|
6990 newFoldLevel();
|
|
6991 }
|
|
6992
|
|
6993 /* 'foldminlevel' */
|
|
6994 else if (pp == &curwin->w_p_fml)
|
|
6995 {
|
|
6996 foldUpdateAll(curwin);
|
|
6997 }
|
|
6998
|
|
6999 /* 'foldnestmax' */
|
|
7000 else if (pp == &curwin->w_p_fdn)
|
|
7001 {
|
|
7002 if (foldmethodIsSyntax(curwin) || foldmethodIsIndent(curwin))
|
|
7003 foldUpdateAll(curwin);
|
|
7004 }
|
|
7005
|
|
7006 /* 'foldcolumn' */
|
|
7007 else if (pp == &curwin->w_p_fdc)
|
|
7008 {
|
|
7009 if (curwin->w_p_fdc < 0)
|
|
7010 {
|
|
7011 errmsg = e_positive;
|
|
7012 curwin->w_p_fdc = 0;
|
|
7013 }
|
|
7014 else if (curwin->w_p_fdc > 12)
|
|
7015 {
|
|
7016 errmsg = e_invarg;
|
|
7017 curwin->w_p_fdc = 12;
|
|
7018 }
|
|
7019 }
|
|
7020
|
|
7021 /* 'shiftwidth' or 'tabstop' */
|
|
7022 else if (pp == &curbuf->b_p_sw || pp == &curbuf->b_p_ts)
|
|
7023 {
|
|
7024 if (foldmethodIsIndent(curwin))
|
|
7025 foldUpdateAll(curwin);
|
|
7026 }
|
|
7027 #endif /* FEAT_FOLDING */
|
|
7028
|
|
7029 else if (pp == &curbuf->b_p_iminsert)
|
|
7030 {
|
|
7031 if (curbuf->b_p_iminsert < 0 || curbuf->b_p_iminsert > B_IMODE_LAST)
|
|
7032 {
|
|
7033 errmsg = e_invarg;
|
|
7034 curbuf->b_p_iminsert = B_IMODE_NONE;
|
|
7035 }
|
|
7036 p_iminsert = curbuf->b_p_iminsert;
|
|
7037 if (termcap_active) /* don't do this in the alternate screen */
|
|
7038 showmode();
|
|
7039 #if defined(FEAT_WINDOWS) && defined(FEAT_KEYMAP)
|
|
7040 /* Show/unshow value of 'keymap' in status lines. */
|
|
7041 status_redraw_curbuf();
|
|
7042 #endif
|
|
7043 }
|
|
7044
|
164
|
7045 else if (pp == &p_window)
|
|
7046 {
|
|
7047 if (p_window < 1)
|
|
7048 p_window = 1;
|
|
7049 else if (p_window >= Rows)
|
|
7050 p_window = Rows - 1;
|
|
7051 }
|
|
7052
|
7
|
7053 else if (pp == &curbuf->b_p_imsearch)
|
|
7054 {
|
|
7055 if (curbuf->b_p_imsearch < -1 || curbuf->b_p_imsearch > B_IMODE_LAST)
|
|
7056 {
|
|
7057 errmsg = e_invarg;
|
|
7058 curbuf->b_p_imsearch = B_IMODE_NONE;
|
|
7059 }
|
|
7060 p_imsearch = curbuf->b_p_imsearch;
|
|
7061 }
|
|
7062
|
|
7063 #ifdef FEAT_TITLE
|
|
7064 /* if 'titlelen' has changed, redraw the title */
|
|
7065 else if (pp == &p_titlelen)
|
|
7066 {
|
|
7067 if (p_titlelen < 0)
|
|
7068 {
|
|
7069 errmsg = e_positive;
|
|
7070 p_titlelen = 85;
|
|
7071 }
|
|
7072 if (starting != NO_SCREEN && old_value != p_titlelen)
|
|
7073 need_maketitle = TRUE;
|
|
7074 }
|
|
7075 #endif
|
|
7076
|
|
7077 /* if p_ch changed value, change the command line height */
|
|
7078 else if (pp == &p_ch)
|
|
7079 {
|
|
7080 if (p_ch < 1)
|
|
7081 {
|
|
7082 errmsg = e_positive;
|
|
7083 p_ch = 1;
|
|
7084 }
|
|
7085
|
|
7086 /* Only compute the new window layout when startup has been
|
|
7087 * completed. Otherwise the frame sizes may be wrong. */
|
|
7088 if (p_ch != old_value && full_screen
|
|
7089 #ifdef FEAT_GUI
|
|
7090 && !gui.starting
|
|
7091 #endif
|
|
7092 )
|
|
7093 command_height(old_value);
|
|
7094 }
|
|
7095
|
|
7096 /* when 'updatecount' changes from zero to non-zero, open swap files */
|
|
7097 else if (pp == &p_uc)
|
|
7098 {
|
|
7099 if (p_uc < 0)
|
|
7100 {
|
|
7101 errmsg = e_positive;
|
|
7102 p_uc = 100;
|
|
7103 }
|
|
7104 if (p_uc && !old_value)
|
|
7105 ml_open_files();
|
|
7106 }
|
16
|
7107 #ifdef MZSCHEME_GUI_THREADS
|
14
|
7108 else if (pp == &p_mzq)
|
|
7109 mzvim_reset_timer();
|
|
7110 #endif
|
7
|
7111
|
|
7112 /* sync undo before 'undolevels' changes */
|
|
7113 else if (pp == &p_ul)
|
|
7114 {
|
|
7115 /* use the old value, otherwise u_sync() may not work properly */
|
|
7116 p_ul = old_value;
|
|
7117 u_sync();
|
|
7118 p_ul = value;
|
|
7119 }
|
|
7120
|
13
|
7121 #ifdef FEAT_LINEBREAK
|
|
7122 /* 'numberwidth' must be positive */
|
|
7123 else if (pp == &curwin->w_p_nuw)
|
|
7124 {
|
|
7125 if (curwin->w_p_nuw < 1)
|
|
7126 {
|
|
7127 errmsg = e_positive;
|
|
7128 curwin->w_p_nuw = 1;
|
|
7129 }
|
|
7130 if (curwin->w_p_nuw > 10)
|
|
7131 {
|
|
7132 errmsg = e_invarg;
|
|
7133 curwin->w_p_nuw = 10;
|
|
7134 }
|
|
7135 curwin->w_nrwidth_line_count = 0;
|
|
7136 }
|
|
7137 #endif
|
|
7138
|
7
|
7139 /*
|
|
7140 * Check the bounds for numeric options here
|
|
7141 */
|
|
7142 if (Rows < min_rows() && full_screen)
|
|
7143 {
|
|
7144 if (errbuf != NULL)
|
|
7145 {
|
274
|
7146 vim_snprintf((char *)errbuf, errbuflen,
|
|
7147 _("E593: Need at least %d lines"), min_rows());
|
7
|
7148 errmsg = errbuf;
|
|
7149 }
|
|
7150 Rows = min_rows();
|
|
7151 }
|
|
7152 if (Columns < MIN_COLUMNS && full_screen)
|
|
7153 {
|
|
7154 if (errbuf != NULL)
|
|
7155 {
|
274
|
7156 vim_snprintf((char *)errbuf, errbuflen,
|
|
7157 _("E594: Need at least %d columns"), MIN_COLUMNS);
|
7
|
7158 errmsg = errbuf;
|
|
7159 }
|
|
7160 Columns = MIN_COLUMNS;
|
|
7161 }
|
|
7162
|
|
7163 #ifdef DJGPP
|
|
7164 /* avoid a crash by checking for a too large value of 'columns' */
|
|
7165 if (old_Columns != Columns && full_screen && term_console)
|
|
7166 mch_check_columns();
|
|
7167 #endif
|
|
7168
|
|
7169 /*
|
|
7170 * If the screen (shell) height has been changed, assume it is the
|
|
7171 * physical screenheight.
|
|
7172 */
|
|
7173 if (old_Rows != Rows || old_Columns != Columns)
|
|
7174 {
|
|
7175 /* Changing the screen size is not allowed while updating the screen. */
|
|
7176 if (updating_screen)
|
|
7177 *pp = old_value;
|
|
7178 else if (full_screen
|
|
7179 #ifdef FEAT_GUI
|
|
7180 && !gui.starting
|
|
7181 #endif
|
|
7182 )
|
|
7183 set_shellsize((int)Columns, (int)Rows, TRUE);
|
|
7184 else
|
|
7185 {
|
|
7186 /* Postpone the resizing; check the size and cmdline position for
|
|
7187 * messages. */
|
|
7188 check_shellsize();
|
|
7189 if (cmdline_row > Rows - p_ch && Rows > p_ch)
|
|
7190 cmdline_row = Rows - p_ch;
|
|
7191 }
|
164
|
7192 if (p_window >= Rows)
|
|
7193 p_window = Rows - 1;
|
7
|
7194 }
|
|
7195
|
|
7196 if (curbuf->b_p_sts < 0)
|
|
7197 {
|
|
7198 errmsg = e_positive;
|
|
7199 curbuf->b_p_sts = 0;
|
|
7200 }
|
|
7201 if (curbuf->b_p_ts <= 0)
|
|
7202 {
|
|
7203 errmsg = e_positive;
|
|
7204 curbuf->b_p_ts = 8;
|
|
7205 }
|
|
7206 if (curbuf->b_p_tw < 0)
|
|
7207 {
|
|
7208 errmsg = e_positive;
|
|
7209 curbuf->b_p_tw = 0;
|
|
7210 }
|
|
7211 if (p_tm < 0)
|
|
7212 {
|
|
7213 errmsg = e_positive;
|
|
7214 p_tm = 0;
|
|
7215 }
|
|
7216 if ((curwin->w_p_scr <= 0
|
|
7217 || (curwin->w_p_scr > curwin->w_height
|
|
7218 && curwin->w_height > 0))
|
|
7219 && full_screen)
|
|
7220 {
|
|
7221 if (pp == &(curwin->w_p_scr))
|
|
7222 {
|
|
7223 if (curwin->w_p_scr != 0)
|
|
7224 errmsg = e_scroll;
|
|
7225 win_comp_scroll(curwin);
|
|
7226 }
|
|
7227 /* If 'scroll' became invalid because of a side effect silently adjust
|
|
7228 * it. */
|
|
7229 else if (curwin->w_p_scr <= 0)
|
|
7230 curwin->w_p_scr = 1;
|
|
7231 else /* curwin->w_p_scr > curwin->w_height */
|
|
7232 curwin->w_p_scr = curwin->w_height;
|
|
7233 }
|
|
7234 if (p_report < 0)
|
|
7235 {
|
|
7236 errmsg = e_positive;
|
|
7237 p_report = 1;
|
|
7238 }
|
|
7239 if ((p_sj < 0 || p_sj >= Rows) && full_screen)
|
|
7240 {
|
|
7241 if (Rows != old_Rows) /* Rows changed, just adjust p_sj */
|
|
7242 p_sj = Rows / 2;
|
|
7243 else
|
|
7244 {
|
|
7245 errmsg = e_scroll;
|
|
7246 p_sj = 1;
|
|
7247 }
|
|
7248 }
|
|
7249 if (p_so < 0 && full_screen)
|
|
7250 {
|
|
7251 errmsg = e_scroll;
|
|
7252 p_so = 0;
|
|
7253 }
|
|
7254 if (p_siso < 0 && full_screen)
|
|
7255 {
|
|
7256 errmsg = e_positive;
|
|
7257 p_siso = 0;
|
|
7258 }
|
|
7259 #ifdef FEAT_CMDWIN
|
|
7260 if (p_cwh < 1)
|
|
7261 {
|
|
7262 errmsg = e_positive;
|
|
7263 p_cwh = 1;
|
|
7264 }
|
|
7265 #endif
|
|
7266 if (p_ut < 0)
|
|
7267 {
|
|
7268 errmsg = e_positive;
|
|
7269 p_ut = 2000;
|
|
7270 }
|
|
7271 if (p_ss < 0)
|
|
7272 {
|
|
7273 errmsg = e_positive;
|
|
7274 p_ss = 0;
|
|
7275 }
|
|
7276
|
|
7277 /* May set global value for local option. */
|
|
7278 if ((opt_flags & (OPT_LOCAL | OPT_GLOBAL)) == 0)
|
|
7279 *(long *)get_varp_scope(&(options[opt_idx]), OPT_GLOBAL) = *pp;
|
|
7280
|
|
7281 options[opt_idx].flags |= P_WAS_SET;
|
|
7282
|
|
7283 comp_col(); /* in case 'columns' or 'ls' changed */
|
|
7284 if (curwin->w_curswant != MAXCOL)
|
|
7285 curwin->w_set_curswant = TRUE; /* in case 'tabstop' changed */
|
|
7286 check_redraw(options[opt_idx].flags);
|
|
7287
|
|
7288 return errmsg;
|
|
7289 }
|
|
7290
|
|
7291 /*
|
|
7292 * Called after an option changed: check if something needs to be redrawn.
|
|
7293 */
|
|
7294 static void
|
|
7295 check_redraw(flags)
|
|
7296 long_u flags;
|
|
7297 {
|
|
7298 /* Careful: P_RCLR and P_RALL are a combination of other P_ flags */
|
|
7299 int clear = (flags & P_RCLR) == P_RCLR;
|
|
7300 int all = ((flags & P_RALL) == P_RALL || clear);
|
|
7301
|
|
7302 #ifdef FEAT_WINDOWS
|
|
7303 if ((flags & P_RSTAT) || all) /* mark all status lines dirty */
|
|
7304 status_redraw_all();
|
|
7305 #endif
|
|
7306
|
|
7307 if ((flags & P_RBUF) || (flags & P_RWIN) || all)
|
|
7308 changed_window_setting();
|
|
7309 if (flags & P_RBUF)
|
|
7310 redraw_curbuf_later(NOT_VALID);
|
|
7311 if (clear)
|
|
7312 redraw_all_later(CLEAR);
|
|
7313 else if (all)
|
|
7314 redraw_all_later(NOT_VALID);
|
|
7315 }
|
|
7316
|
|
7317 /*
|
|
7318 * Find index for option 'arg'.
|
|
7319 * Return -1 if not found.
|
|
7320 */
|
|
7321 static int
|
|
7322 findoption(arg)
|
|
7323 char_u *arg;
|
|
7324 {
|
|
7325 int opt_idx;
|
|
7326 char *s, *p;
|
|
7327 static short quick_tab[27] = {0, 0}; /* quick access table */
|
|
7328 int is_term_opt;
|
|
7329
|
|
7330 /*
|
|
7331 * For first call: Initialize the quick-access table.
|
|
7332 * It contains the index for the first option that starts with a certain
|
|
7333 * letter. There are 26 letters, plus the first "t_" option.
|
|
7334 */
|
|
7335 if (quick_tab[1] == 0)
|
|
7336 {
|
|
7337 p = options[0].fullname;
|
|
7338 for (opt_idx = 1; (s = options[opt_idx].fullname) != NULL; opt_idx++)
|
|
7339 {
|
|
7340 if (s[0] != p[0])
|
|
7341 {
|
|
7342 if (s[0] == 't' && s[1] == '_')
|
|
7343 quick_tab[26] = opt_idx;
|
|
7344 else
|
|
7345 quick_tab[CharOrdLow(s[0])] = opt_idx;
|
|
7346 }
|
|
7347 p = s;
|
|
7348 }
|
|
7349 }
|
|
7350
|
|
7351 /*
|
|
7352 * Check for name starting with an illegal character.
|
|
7353 */
|
|
7354 #ifdef EBCDIC
|
|
7355 if (!islower(arg[0]))
|
|
7356 #else
|
|
7357 if (arg[0] < 'a' || arg[0] > 'z')
|
|
7358 #endif
|
|
7359 return -1;
|
|
7360
|
|
7361 is_term_opt = (arg[0] == 't' && arg[1] == '_');
|
|
7362 if (is_term_opt)
|
|
7363 opt_idx = quick_tab[26];
|
|
7364 else
|
|
7365 opt_idx = quick_tab[CharOrdLow(arg[0])];
|
|
7366 for ( ; (s = options[opt_idx].fullname) != NULL; opt_idx++)
|
|
7367 {
|
|
7368 if (STRCMP(arg, s) == 0) /* match full name */
|
|
7369 break;
|
|
7370 }
|
|
7371 if (s == NULL && !is_term_opt)
|
|
7372 {
|
|
7373 opt_idx = quick_tab[CharOrdLow(arg[0])];
|
|
7374 for ( ; options[opt_idx].fullname != NULL; opt_idx++)
|
|
7375 {
|
|
7376 s = options[opt_idx].shortname;
|
|
7377 if (s != NULL && STRCMP(arg, s) == 0) /* match short name */
|
|
7378 break;
|
|
7379 s = NULL;
|
|
7380 }
|
|
7381 }
|
|
7382 if (s == NULL)
|
|
7383 opt_idx = -1;
|
|
7384 return opt_idx;
|
|
7385 }
|
|
7386
|
14
|
7387 #if defined(FEAT_EVAL) || defined(FEAT_TCL) || defined(FEAT_MZSCHEME)
|
7
|
7388 /*
|
|
7389 * Get the value for an option.
|
|
7390 *
|
|
7391 * Returns:
|
|
7392 * Number or Toggle option: 1, *numval gets value.
|
|
7393 * String option: 0, *stringval gets allocated string.
|
|
7394 * Hidden Number or Toggle option: -1.
|
|
7395 * hidden String option: -2.
|
|
7396 * unknown option: -3.
|
|
7397 */
|
|
7398 int
|
|
7399 get_option_value(name, numval, stringval, opt_flags)
|
|
7400 char_u *name;
|
|
7401 long *numval;
|
|
7402 char_u **stringval; /* NULL when only checking existance */
|
|
7403 int opt_flags;
|
|
7404 {
|
|
7405 int opt_idx;
|
|
7406 char_u *varp;
|
|
7407
|
|
7408 opt_idx = findoption(name);
|
|
7409 if (opt_idx < 0) /* unknown option */
|
|
7410 return -3;
|
|
7411
|
|
7412 varp = get_varp_scope(&(options[opt_idx]), opt_flags);
|
|
7413
|
|
7414 if (options[opt_idx].flags & P_STRING)
|
|
7415 {
|
|
7416 if (varp == NULL) /* hidden option */
|
|
7417 return -2;
|
|
7418 if (stringval != NULL)
|
|
7419 {
|
|
7420 #ifdef FEAT_CRYPT
|
|
7421 /* never return the value of the crypt key */
|
|
7422 if ((char_u **)varp == &curbuf->b_p_key)
|
|
7423 *stringval = vim_strsave((char_u *)"*****");
|
|
7424 else
|
|
7425 #endif
|
|
7426 *stringval = vim_strsave(*(char_u **)(varp));
|
|
7427 }
|
|
7428 return 0;
|
|
7429 }
|
|
7430
|
|
7431 if (varp == NULL) /* hidden option */
|
|
7432 return -1;
|
|
7433 if (options[opt_idx].flags & P_NUM)
|
|
7434 *numval = *(long *)varp;
|
|
7435 else
|
|
7436 {
|
|
7437 /* Special case: 'modified' is b_changed, but we also want to consider
|
|
7438 * it set when 'ff' or 'fenc' changed. */
|
|
7439 if ((int *)varp == &curbuf->b_changed)
|
|
7440 *numval = curbufIsChanged();
|
|
7441 else
|
|
7442 *numval = *(int *)varp;
|
|
7443 }
|
|
7444 return 1;
|
|
7445 }
|
|
7446 #endif
|
|
7447
|
|
7448 /*
|
|
7449 * Set the value of option "name".
|
|
7450 * Use "string" for string options, use "number" for other options.
|
|
7451 */
|
|
7452 void
|
|
7453 set_option_value(name, number, string, opt_flags)
|
|
7454 char_u *name;
|
|
7455 long number;
|
|
7456 char_u *string;
|
|
7457 int opt_flags; /* OPT_LOCAL or 0 (both) */
|
|
7458 {
|
|
7459 int opt_idx;
|
|
7460 char_u *varp;
|
|
7461 int flags;
|
|
7462
|
|
7463 opt_idx = findoption(name);
|
|
7464 if (opt_idx == -1)
|
|
7465 EMSG2(_("E355: Unknown option: %s"), name);
|
|
7466 else
|
|
7467 {
|
|
7468 flags = options[opt_idx].flags;
|
|
7469 #ifdef HAVE_SANDBOX
|
|
7470 /* Disallow changing some options in the sandbox */
|
|
7471 if (sandbox > 0 && (flags & P_SECURE))
|
|
7472 EMSG(_(e_sandbox));
|
|
7473 else
|
|
7474 #endif
|
|
7475 if (flags & P_STRING)
|
|
7476 set_string_option(opt_idx, string, opt_flags);
|
|
7477 else
|
|
7478 {
|
|
7479 varp = get_varp(&options[opt_idx]);
|
|
7480 if (varp != NULL) /* hidden option is not changed */
|
|
7481 {
|
|
7482 if (flags & P_NUM)
|
274
|
7483 (void)set_num_option(opt_idx, varp, number,
|
|
7484 NULL, 0, opt_flags);
|
7
|
7485 else
|
|
7486 (void)set_bool_option(opt_idx, varp, (int)number, opt_flags);
|
|
7487 }
|
|
7488 }
|
|
7489 }
|
|
7490 }
|
|
7491
|
|
7492 /*
|
|
7493 * Get the terminal code for a terminal option.
|
|
7494 * Returns NULL when not found.
|
|
7495 */
|
|
7496 char_u *
|
|
7497 get_term_code(tname)
|
|
7498 char_u *tname;
|
|
7499 {
|
|
7500 int opt_idx;
|
|
7501 char_u *varp;
|
|
7502
|
|
7503 if (tname[0] != 't' || tname[1] != '_' ||
|
|
7504 tname[2] == NUL || tname[3] == NUL)
|
|
7505 return NULL;
|
|
7506 if ((opt_idx = findoption(tname)) >= 0)
|
|
7507 {
|
|
7508 varp = get_varp(&(options[opt_idx]));
|
|
7509 if (varp != NULL)
|
|
7510 varp = *(char_u **)(varp);
|
|
7511 return varp;
|
|
7512 }
|
|
7513 return find_termcode(tname + 2);
|
|
7514 }
|
|
7515
|
|
7516 char_u *
|
|
7517 get_highlight_default()
|
|
7518 {
|
|
7519 int i;
|
|
7520
|
|
7521 i = findoption((char_u *)"hl");
|
|
7522 if (i >= 0)
|
|
7523 return options[i].def_val[VI_DEFAULT];
|
|
7524 return (char_u *)NULL;
|
|
7525 }
|
|
7526
|
39
|
7527 #if defined(FEAT_MBYTE) || defined(PROTO)
|
|
7528 char_u *
|
|
7529 get_encoding_default()
|
|
7530 {
|
|
7531 int i;
|
|
7532
|
|
7533 i = findoption((char_u *)"enc");
|
|
7534 if (i >= 0)
|
|
7535 return options[i].def_val[VI_DEFAULT];
|
|
7536 return (char_u *)NULL;
|
|
7537 }
|
|
7538 #endif
|
|
7539
|
7
|
7540 /*
|
|
7541 * Translate a string like "t_xx", "<t_xx>" or "<S-Tab>" to a key number.
|
|
7542 */
|
|
7543 static int
|
|
7544 find_key_option(arg)
|
|
7545 char_u *arg;
|
|
7546 {
|
|
7547 int key;
|
|
7548 int modifiers;
|
|
7549
|
|
7550 /*
|
|
7551 * Don't use get_special_key_code() for t_xx, we don't want it to call
|
|
7552 * add_termcap_entry().
|
|
7553 */
|
|
7554 if (arg[0] == 't' && arg[1] == '_' && arg[2] && arg[3])
|
|
7555 key = TERMCAP2KEY(arg[2], arg[3]);
|
|
7556 else
|
|
7557 {
|
|
7558 --arg; /* put arg at the '<' */
|
|
7559 modifiers = 0;
|
|
7560 key = find_special_key(&arg, &modifiers, TRUE);
|
|
7561 if (modifiers) /* can't handle modifiers here */
|
|
7562 key = 0;
|
|
7563 }
|
|
7564 return key;
|
|
7565 }
|
|
7566
|
|
7567 /*
|
|
7568 * if 'all' == 0: show changed options
|
|
7569 * if 'all' == 1: show all normal options
|
|
7570 * if 'all' == 2: show all terminal options
|
|
7571 */
|
|
7572 static void
|
|
7573 showoptions(all, opt_flags)
|
|
7574 int all;
|
|
7575 int opt_flags; /* OPT_LOCAL and/or OPT_GLOBAL */
|
|
7576 {
|
|
7577 struct vimoption *p;
|
|
7578 int col;
|
|
7579 int isterm;
|
|
7580 char_u *varp;
|
|
7581 struct vimoption **items;
|
|
7582 int item_count;
|
|
7583 int run;
|
|
7584 int row, rows;
|
|
7585 int cols;
|
|
7586 int i;
|
|
7587 int len;
|
|
7588
|
|
7589 #define INC 20
|
|
7590 #define GAP 3
|
|
7591
|
|
7592 items = (struct vimoption **)alloc((unsigned)(sizeof(struct vimoption *) *
|
|
7593 PARAM_COUNT));
|
|
7594 if (items == NULL)
|
|
7595 return;
|
|
7596
|
|
7597 /* Highlight title */
|
|
7598 if (all == 2)
|
|
7599 MSG_PUTS_TITLE(_("\n--- Terminal codes ---"));
|
|
7600 else if (opt_flags & OPT_GLOBAL)
|
|
7601 MSG_PUTS_TITLE(_("\n--- Global option values ---"));
|
|
7602 else if (opt_flags & OPT_LOCAL)
|
|
7603 MSG_PUTS_TITLE(_("\n--- Local option values ---"));
|
|
7604 else
|
|
7605 MSG_PUTS_TITLE(_("\n--- Options ---"));
|
|
7606
|
|
7607 /*
|
|
7608 * do the loop two times:
|
|
7609 * 1. display the short items
|
|
7610 * 2. display the long items (only strings and numbers)
|
|
7611 */
|
|
7612 for (run = 1; run <= 2 && !got_int; ++run)
|
|
7613 {
|
|
7614 /*
|
|
7615 * collect the items in items[]
|
|
7616 */
|
|
7617 item_count = 0;
|
|
7618 for (p = &options[0]; p->fullname != NULL; p++)
|
|
7619 {
|
|
7620 varp = NULL;
|
|
7621 isterm = istermoption(p);
|
|
7622 if (opt_flags != 0)
|
|
7623 {
|
|
7624 if (p->indir != PV_NONE && !isterm)
|
|
7625 varp = get_varp_scope(p, opt_flags);
|
|
7626 }
|
|
7627 else
|
|
7628 varp = get_varp(p);
|
|
7629 if (varp != NULL
|
|
7630 && ((all == 2 && isterm)
|
|
7631 || (all == 1 && !isterm)
|
|
7632 || (all == 0 && !optval_default(p, varp))))
|
|
7633 {
|
|
7634 if (p->flags & P_BOOL)
|
|
7635 len = 1; /* a toggle option fits always */
|
|
7636 else
|
|
7637 {
|
|
7638 option_value2string(p, opt_flags);
|
|
7639 len = (int)STRLEN(p->fullname) + vim_strsize(NameBuff) + 1;
|
|
7640 }
|
|
7641 if ((len <= INC - GAP && run == 1) ||
|
|
7642 (len > INC - GAP && run == 2))
|
|
7643 items[item_count++] = p;
|
|
7644 }
|
|
7645 }
|
|
7646
|
|
7647 /*
|
|
7648 * display the items
|
|
7649 */
|
|
7650 if (run == 1)
|
|
7651 {
|
|
7652 cols = (Columns + GAP - 3) / INC;
|
|
7653 if (cols == 0)
|
|
7654 cols = 1;
|
|
7655 rows = (item_count + cols - 1) / cols;
|
|
7656 }
|
|
7657 else /* run == 2 */
|
|
7658 rows = item_count;
|
|
7659 for (row = 0; row < rows && !got_int; ++row)
|
|
7660 {
|
|
7661 msg_putchar('\n'); /* go to next line */
|
|
7662 if (got_int) /* 'q' typed in more */
|
|
7663 break;
|
|
7664 col = 0;
|
|
7665 for (i = row; i < item_count; i += rows)
|
|
7666 {
|
|
7667 msg_col = col; /* make columns */
|
|
7668 showoneopt(items[i], opt_flags);
|
|
7669 col += INC;
|
|
7670 }
|
|
7671 out_flush();
|
|
7672 ui_breakcheck();
|
|
7673 }
|
|
7674 }
|
|
7675 vim_free(items);
|
|
7676 }
|
|
7677
|
|
7678 /*
|
|
7679 * Return TRUE if option "p" has its default value.
|
|
7680 */
|
|
7681 static int
|
|
7682 optval_default(p, varp)
|
|
7683 struct vimoption *p;
|
|
7684 char_u *varp;
|
|
7685 {
|
|
7686 int dvi;
|
|
7687
|
|
7688 if (varp == NULL)
|
|
7689 return TRUE; /* hidden option is always at default */
|
|
7690 dvi = ((p->flags & P_VI_DEF) || p_cp) ? VI_DEFAULT : VIM_DEFAULT;
|
|
7691 if (p->flags & P_NUM)
|
|
7692 return (*(long *)varp == (long)p->def_val[dvi]);
|
|
7693 if (p->flags & P_BOOL)
|
|
7694 /* the cast to long is required for Manx C */
|
|
7695 return (*(int *)varp == (int)(long)p->def_val[dvi]);
|
|
7696 /* P_STRING */
|
|
7697 return (STRCMP(*(char_u **)varp, p->def_val[dvi]) == 0);
|
|
7698 }
|
|
7699
|
|
7700 /*
|
|
7701 * showoneopt: show the value of one option
|
|
7702 * must not be called with a hidden option!
|
|
7703 */
|
|
7704 static void
|
|
7705 showoneopt(p, opt_flags)
|
|
7706 struct vimoption *p;
|
|
7707 int opt_flags; /* OPT_LOCAL or OPT_GLOBAL */
|
|
7708 {
|
168
|
7709 char_u *varp;
|
|
7710 int save_silent = silent_mode;
|
|
7711
|
|
7712 silent_mode = FALSE;
|
|
7713 info_message = TRUE; /* use mch_msg(), not mch_errmsg() */
|
7
|
7714
|
|
7715 varp = get_varp_scope(p, opt_flags);
|
|
7716
|
|
7717 /* for 'modified' we also need to check if 'ff' or 'fenc' changed. */
|
|
7718 if ((p->flags & P_BOOL) && ((int *)varp == &curbuf->b_changed
|
|
7719 ? !curbufIsChanged() : !*(int *)varp))
|
|
7720 MSG_PUTS("no");
|
|
7721 else if ((p->flags & P_BOOL) && *(int *)varp < 0)
|
|
7722 MSG_PUTS("--");
|
|
7723 else
|
|
7724 MSG_PUTS(" ");
|
|
7725 MSG_PUTS(p->fullname);
|
|
7726 if (!(p->flags & P_BOOL))
|
|
7727 {
|
|
7728 msg_putchar('=');
|
|
7729 /* put value string in NameBuff */
|
|
7730 option_value2string(p, opt_flags);
|
|
7731 msg_outtrans(NameBuff);
|
|
7732 }
|
168
|
7733
|
|
7734 silent_mode = save_silent;
|
|
7735 info_message = FALSE;
|
7
|
7736 }
|
|
7737
|
|
7738 /*
|
|
7739 * Write modified options as ":set" commands to a file.
|
|
7740 *
|
|
7741 * There are three values for "opt_flags":
|
|
7742 * OPT_GLOBAL: Write global option values and fresh values of
|
|
7743 * buffer-local options (used for start of a session
|
|
7744 * file).
|
|
7745 * OPT_GLOBAL + OPT_LOCAL: Idem, add fresh values of window-local options for
|
|
7746 * curwin (used for a vimrc file).
|
|
7747 * OPT_LOCAL: Write buffer-local option values for curbuf, fresh
|
|
7748 * and local values for window-local options of
|
|
7749 * curwin. Local values are also written when at the
|
|
7750 * default value, because a modeline or autocommand
|
|
7751 * may have set them when doing ":edit file" and the
|
|
7752 * user has set them back at the default or fresh
|
|
7753 * value.
|
|
7754 * When "local_only" is TRUE, don't write fresh
|
|
7755 * values, only local values (for ":mkview").
|
|
7756 * (fresh value = value used for a new buffer or window for a local option).
|
|
7757 *
|
|
7758 * Return FAIL on error, OK otherwise.
|
|
7759 */
|
|
7760 int
|
|
7761 makeset(fd, opt_flags, local_only)
|
|
7762 FILE *fd;
|
|
7763 int opt_flags;
|
|
7764 int local_only;
|
|
7765 {
|
|
7766 struct vimoption *p;
|
|
7767 char_u *varp; /* currently used value */
|
|
7768 char_u *varp_fresh; /* local value */
|
|
7769 char_u *varp_local = NULL; /* fresh value */
|
|
7770 char *cmd;
|
|
7771 int round;
|
|
7772
|
|
7773 /*
|
|
7774 * The options that don't have a default (terminal name, columns, lines)
|
|
7775 * are never written. Terminal options are also not written.
|
|
7776 */
|
|
7777 for (p = &options[0]; !istermoption(p); p++)
|
|
7778 if (!(p->flags & P_NO_MKRC) && !istermoption(p))
|
|
7779 {
|
|
7780 /* skip global option when only doing locals */
|
|
7781 if (p->indir == PV_NONE && !(opt_flags & OPT_GLOBAL))
|
|
7782 continue;
|
|
7783
|
|
7784 /* Do not store options like 'bufhidden' and 'syntax' in a vimrc
|
|
7785 * file, they are always buffer-specific. */
|
|
7786 if ((opt_flags & OPT_GLOBAL) && (p->flags & P_NOGLOB))
|
|
7787 continue;
|
|
7788
|
|
7789 /* Global values are only written when not at the default value. */
|
|
7790 varp = get_varp_scope(p, opt_flags);
|
|
7791 if ((opt_flags & OPT_GLOBAL) && optval_default(p, varp))
|
|
7792 continue;
|
|
7793
|
|
7794 round = 2;
|
|
7795 if (p->indir != PV_NONE)
|
|
7796 {
|
|
7797 if (p->var == VAR_WIN)
|
|
7798 {
|
|
7799 /* skip window-local option when only doing globals */
|
|
7800 if (!(opt_flags & OPT_LOCAL))
|
|
7801 continue;
|
|
7802 /* When fresh value of window-local option is not at the
|
|
7803 * default, need to write it too. */
|
|
7804 if (!(opt_flags & OPT_GLOBAL) && !local_only)
|
|
7805 {
|
|
7806 varp_fresh = get_varp_scope(p, OPT_GLOBAL);
|
|
7807 if (!optval_default(p, varp_fresh))
|
|
7808 {
|
|
7809 round = 1;
|
|
7810 varp_local = varp;
|
|
7811 varp = varp_fresh;
|
|
7812 }
|
|
7813 }
|
|
7814 }
|
|
7815 }
|
|
7816
|
|
7817 /* Round 1: fresh value for window-local options.
|
|
7818 * Round 2: other values */
|
|
7819 for ( ; round <= 2; varp = varp_local, ++round)
|
|
7820 {
|
|
7821 if (round == 1 || (opt_flags & OPT_GLOBAL))
|
|
7822 cmd = "set";
|
|
7823 else
|
|
7824 cmd = "setlocal";
|
|
7825
|
|
7826 if (p->flags & P_BOOL)
|
|
7827 {
|
|
7828 if (put_setbool(fd, cmd, p->fullname, *(int *)varp) == FAIL)
|
|
7829 return FAIL;
|
|
7830 }
|
|
7831 else if (p->flags & P_NUM)
|
|
7832 {
|
|
7833 if (put_setnum(fd, cmd, p->fullname, (long *)varp) == FAIL)
|
|
7834 return FAIL;
|
|
7835 }
|
|
7836 else /* P_STRING */
|
|
7837 {
|
|
7838 /* Don't set 'syntax' and 'filetype' again if the value is
|
|
7839 * already right, avoids reloading the syntax file. */
|
|
7840 if (p->indir == PV_SYN || p->indir == PV_FT)
|
|
7841 {
|
|
7842 if (fprintf(fd, "if &%s != '%s'", p->fullname,
|
|
7843 *(char_u **)(varp)) < 0
|
|
7844 || put_eol(fd) < 0)
|
|
7845 return FAIL;
|
|
7846 }
|
|
7847 if (put_setstring(fd, cmd, p->fullname, (char_u **)varp,
|
|
7848 (p->flags & P_EXPAND) != 0) == FAIL)
|
|
7849 return FAIL;
|
|
7850 if (p->indir == PV_SYN || p->indir == PV_FT)
|
|
7851 {
|
|
7852 if (put_line(fd, "endif") == FAIL)
|
|
7853 return FAIL;
|
|
7854 }
|
|
7855 }
|
|
7856 }
|
|
7857 }
|
|
7858 return OK;
|
|
7859 }
|
|
7860
|
|
7861 #if defined(FEAT_FOLDING) || defined(PROTO)
|
|
7862 /*
|
|
7863 * Generate set commands for the local fold options only. Used when
|
|
7864 * 'sessionoptions' or 'viewoptions' contains "folds" but not "options".
|
|
7865 */
|
|
7866 int
|
|
7867 makefoldset(fd)
|
|
7868 FILE *fd;
|
|
7869 {
|
|
7870 if (put_setstring(fd, "setlocal", "fdm", &curwin->w_p_fdm, FALSE) == FAIL
|
|
7871 # ifdef FEAT_EVAL
|
|
7872 || put_setstring(fd, "setlocal", "fde", &curwin->w_p_fde, FALSE)
|
|
7873 == FAIL
|
|
7874 # endif
|
|
7875 || put_setstring(fd, "setlocal", "fmr", &curwin->w_p_fmr, FALSE)
|
|
7876 == FAIL
|
|
7877 || put_setstring(fd, "setlocal", "fdi", &curwin->w_p_fdi, FALSE)
|
|
7878 == FAIL
|
|
7879 || put_setnum(fd, "setlocal", "fdl", &curwin->w_p_fdl) == FAIL
|
|
7880 || put_setnum(fd, "setlocal", "fml", &curwin->w_p_fml) == FAIL
|
|
7881 || put_setnum(fd, "setlocal", "fdn", &curwin->w_p_fdn) == FAIL
|
|
7882 || put_setbool(fd, "setlocal", "fen", curwin->w_p_fen) == FAIL
|
|
7883 )
|
|
7884 return FAIL;
|
|
7885
|
|
7886 return OK;
|
|
7887 }
|
|
7888 #endif
|
|
7889
|
|
7890 static int
|
|
7891 put_setstring(fd, cmd, name, valuep, expand)
|
|
7892 FILE *fd;
|
|
7893 char *cmd;
|
|
7894 char *name;
|
|
7895 char_u **valuep;
|
|
7896 int expand;
|
|
7897 {
|
|
7898 char_u *s;
|
|
7899 char_u buf[MAXPATHL];
|
|
7900
|
|
7901 if (fprintf(fd, "%s %s=", cmd, name) < 0)
|
|
7902 return FAIL;
|
|
7903 if (*valuep != NULL)
|
|
7904 {
|
|
7905 /* Output 'pastetoggle' as key names. For other
|
|
7906 * options some characters have to be escaped with
|
|
7907 * CTRL-V or backslash */
|
|
7908 if (valuep == &p_pt)
|
|
7909 {
|
|
7910 s = *valuep;
|
|
7911 while (*s != NUL)
|
|
7912 if (fputs((char *)str2special(&s, FALSE), fd) < 0)
|
|
7913 return FAIL;
|
|
7914 }
|
|
7915 else if (expand)
|
|
7916 {
|
|
7917 home_replace(NULL, *valuep, buf, MAXPATHL, FALSE);
|
|
7918 if (put_escstr(fd, buf, 2) == FAIL)
|
|
7919 return FAIL;
|
|
7920 }
|
|
7921 else if (put_escstr(fd, *valuep, 2) == FAIL)
|
|
7922 return FAIL;
|
|
7923 }
|
|
7924 if (put_eol(fd) < 0)
|
|
7925 return FAIL;
|
|
7926 return OK;
|
|
7927 }
|
|
7928
|
|
7929 static int
|
|
7930 put_setnum(fd, cmd, name, valuep)
|
|
7931 FILE *fd;
|
|
7932 char *cmd;
|
|
7933 char *name;
|
|
7934 long *valuep;
|
|
7935 {
|
|
7936 long wc;
|
|
7937
|
|
7938 if (fprintf(fd, "%s %s=", cmd, name) < 0)
|
|
7939 return FAIL;
|
|
7940 if (wc_use_keyname((char_u *)valuep, &wc))
|
|
7941 {
|
|
7942 /* print 'wildchar' and 'wildcharm' as a key name */
|
|
7943 if (fputs((char *)get_special_key_name((int)wc, 0), fd) < 0)
|
|
7944 return FAIL;
|
|
7945 }
|
|
7946 else if (fprintf(fd, "%ld", *valuep) < 0)
|
|
7947 return FAIL;
|
|
7948 if (put_eol(fd) < 0)
|
|
7949 return FAIL;
|
|
7950 return OK;
|
|
7951 }
|
|
7952
|
|
7953 static int
|
|
7954 put_setbool(fd, cmd, name, value)
|
|
7955 FILE *fd;
|
|
7956 char *cmd;
|
|
7957 char *name;
|
|
7958 int value;
|
|
7959 {
|
|
7960 if (fprintf(fd, "%s %s%s", cmd, value ? "" : "no", name) < 0
|
|
7961 || put_eol(fd) < 0)
|
|
7962 return FAIL;
|
|
7963 return OK;
|
|
7964 }
|
|
7965
|
|
7966 /*
|
|
7967 * Clear all the terminal options.
|
|
7968 * If the option has been allocated, free the memory.
|
|
7969 * Terminal options are never hidden or indirect.
|
|
7970 */
|
|
7971 void
|
|
7972 clear_termoptions()
|
|
7973 {
|
|
7974 struct vimoption *p;
|
|
7975
|
|
7976 /*
|
|
7977 * Reset a few things before clearing the old options. This may cause
|
|
7978 * outputting a few things that the terminal doesn't understand, but the
|
|
7979 * screen will be cleared later, so this is OK.
|
|
7980 */
|
|
7981 #ifdef FEAT_MOUSE_TTY
|
|
7982 mch_setmouse(FALSE); /* switch mouse off */
|
|
7983 #endif
|
|
7984 #ifdef FEAT_TITLE
|
|
7985 mch_restore_title(3); /* restore window titles */
|
|
7986 #endif
|
|
7987 #if defined(FEAT_XCLIPBOARD) && defined(FEAT_GUI)
|
|
7988 /* When starting the GUI close the display opened for the clipboard.
|
|
7989 * After restoring the title, because that will need the display. */
|
|
7990 if (gui.starting)
|
|
7991 clear_xterm_clip();
|
|
7992 #endif
|
|
7993 #ifdef WIN3264
|
|
7994 /*
|
|
7995 * Check if this is allowed now.
|
|
7996 */
|
|
7997 if (can_end_termcap_mode(FALSE) == TRUE)
|
|
7998 #endif
|
|
7999 stoptermcap(); /* stop termcap mode */
|
|
8000
|
|
8001 for (p = &options[0]; p->fullname != NULL; p++)
|
|
8002 if (istermoption(p))
|
|
8003 {
|
|
8004 if (p->flags & P_ALLOCED)
|
|
8005 free_string_option(*(char_u **)(p->var));
|
|
8006 if (p->flags & P_DEF_ALLOCED)
|
|
8007 free_string_option(p->def_val[VI_DEFAULT]);
|
|
8008 *(char_u **)(p->var) = empty_option;
|
|
8009 p->def_val[VI_DEFAULT] = empty_option;
|
|
8010 p->flags &= ~(P_ALLOCED|P_DEF_ALLOCED);
|
|
8011 }
|
|
8012 clear_termcodes();
|
|
8013 }
|
|
8014
|
|
8015 /*
|
|
8016 * Set the terminal option defaults to the current value.
|
|
8017 * Used after setting the terminal name.
|
|
8018 */
|
|
8019 void
|
|
8020 set_term_defaults()
|
|
8021 {
|
|
8022 struct vimoption *p;
|
|
8023
|
|
8024 for (p = &options[0]; p->fullname != NULL; p++)
|
|
8025 {
|
|
8026 if (istermoption(p) && p->def_val[VI_DEFAULT] != *(char_u **)(p->var))
|
|
8027 {
|
|
8028 if (p->flags & P_DEF_ALLOCED)
|
|
8029 {
|
|
8030 free_string_option(p->def_val[VI_DEFAULT]);
|
|
8031 p->flags &= ~P_DEF_ALLOCED;
|
|
8032 }
|
|
8033 p->def_val[VI_DEFAULT] = *(char_u **)(p->var);
|
|
8034 if (p->flags & P_ALLOCED)
|
|
8035 {
|
|
8036 p->flags |= P_DEF_ALLOCED;
|
|
8037 p->flags &= ~P_ALLOCED; /* don't free the value now */
|
|
8038 }
|
|
8039 }
|
|
8040 }
|
|
8041 }
|
|
8042
|
|
8043 /*
|
|
8044 * return TRUE if 'p' starts with 't_'
|
|
8045 */
|
|
8046 static int
|
|
8047 istermoption(p)
|
|
8048 struct vimoption *p;
|
|
8049 {
|
|
8050 return (p->fullname[0] == 't' && p->fullname[1] == '_');
|
|
8051 }
|
|
8052
|
|
8053 /*
|
|
8054 * Compute columns for ruler and shown command. 'sc_col' is also used to
|
|
8055 * decide what the maximum length of a message on the status line can be.
|
|
8056 * If there is a status line for the last window, 'sc_col' is independent
|
|
8057 * of 'ru_col'.
|
|
8058 */
|
|
8059
|
|
8060 #define COL_RULER 17 /* columns needed by standard ruler */
|
|
8061
|
|
8062 void
|
|
8063 comp_col()
|
|
8064 {
|
|
8065 #if defined(FEAT_CMDL_INFO) && defined(FEAT_WINDOWS)
|
|
8066 int last_has_status = (p_ls == 2 || (p_ls == 1 && firstwin != lastwin));
|
|
8067
|
|
8068 sc_col = 0;
|
|
8069 ru_col = 0;
|
|
8070 if (p_ru)
|
|
8071 {
|
|
8072 #ifdef FEAT_STL_OPT
|
|
8073 ru_col = (ru_wid ? ru_wid : COL_RULER) + 1;
|
|
8074 #else
|
|
8075 ru_col = COL_RULER + 1;
|
|
8076 #endif
|
|
8077 /* no last status line, adjust sc_col */
|
|
8078 if (!last_has_status)
|
|
8079 sc_col = ru_col;
|
|
8080 }
|
|
8081 if (p_sc)
|
|
8082 {
|
|
8083 sc_col += SHOWCMD_COLS;
|
|
8084 if (!p_ru || last_has_status) /* no need for separating space */
|
|
8085 ++sc_col;
|
|
8086 }
|
|
8087 sc_col = Columns - sc_col;
|
|
8088 ru_col = Columns - ru_col;
|
|
8089 if (sc_col <= 0) /* screen too narrow, will become a mess */
|
|
8090 sc_col = 1;
|
|
8091 if (ru_col <= 0)
|
|
8092 ru_col = 1;
|
|
8093 #else
|
|
8094 sc_col = Columns;
|
|
8095 ru_col = Columns;
|
|
8096 #endif
|
|
8097 }
|
|
8098
|
|
8099 /*
|
|
8100 * Get pointer to option variable, depending on local or global scope.
|
|
8101 */
|
|
8102 static char_u *
|
|
8103 get_varp_scope(p, opt_flags)
|
|
8104 struct vimoption *p;
|
|
8105 int opt_flags;
|
|
8106 {
|
|
8107 if ((opt_flags & OPT_GLOBAL) && p->indir != PV_NONE)
|
|
8108 {
|
|
8109 if (p->var == VAR_WIN)
|
|
8110 return (char_u *)GLOBAL_WO(get_varp(p));
|
|
8111 return p->var;
|
|
8112 }
|
|
8113 if ((opt_flags & OPT_LOCAL) && (int)p->indir >= PV_BOTH)
|
|
8114 {
|
|
8115 switch ((int)p->indir)
|
|
8116 {
|
|
8117 #ifdef FEAT_QUICKFIX
|
|
8118 case OPT_BOTH(PV_GP): return (char_u *)&(curbuf->b_p_gp);
|
|
8119 case OPT_BOTH(PV_MP): return (char_u *)&(curbuf->b_p_mp);
|
|
8120 case OPT_BOTH(PV_EFM): return (char_u *)&(curbuf->b_p_efm);
|
|
8121 #endif
|
|
8122 case OPT_BOTH(PV_EP): return (char_u *)&(curbuf->b_p_ep);
|
|
8123 case OPT_BOTH(PV_KP): return (char_u *)&(curbuf->b_p_kp);
|
|
8124 case OPT_BOTH(PV_PATH): return (char_u *)&(curbuf->b_p_path);
|
|
8125 case OPT_BOTH(PV_AR): return (char_u *)&(curbuf->b_p_ar);
|
|
8126 case OPT_BOTH(PV_TAGS): return (char_u *)&(curbuf->b_p_tags);
|
|
8127 #ifdef FEAT_FIND_ID
|
|
8128 case OPT_BOTH(PV_DEF): return (char_u *)&(curbuf->b_p_def);
|
|
8129 case OPT_BOTH(PV_INC): return (char_u *)&(curbuf->b_p_inc);
|
|
8130 #endif
|
|
8131 #ifdef FEAT_INS_EXPAND
|
|
8132 case OPT_BOTH(PV_DICT): return (char_u *)&(curbuf->b_p_dict);
|
|
8133 case OPT_BOTH(PV_TSR): return (char_u *)&(curbuf->b_p_tsr);
|
|
8134 #endif
|
40
|
8135 #ifdef FEAT_STL_OPT
|
|
8136 case OPT_BOTH(PV_STL): return (char_u *)&(curwin->w_p_stl);
|
|
8137 #endif
|
7
|
8138 }
|
|
8139 return NULL; /* "cannot happen" */
|
|
8140 }
|
|
8141 return get_varp(p);
|
|
8142 }
|
|
8143
|
|
8144 /*
|
|
8145 * Get pointer to option variable.
|
|
8146 */
|
|
8147 static char_u *
|
|
8148 get_varp(p)
|
|
8149 struct vimoption *p;
|
|
8150 {
|
|
8151 /* hidden option, always return NULL */
|
|
8152 if (p->var == NULL)
|
|
8153 return NULL;
|
|
8154
|
|
8155 switch ((int)p->indir)
|
|
8156 {
|
|
8157 case PV_NONE: return p->var;
|
|
8158
|
|
8159 /* global option with local value: use local value if it's been set */
|
|
8160 case OPT_BOTH(PV_EP): return *curbuf->b_p_ep != NUL
|
|
8161 ? (char_u *)&curbuf->b_p_ep : p->var;
|
|
8162 case OPT_BOTH(PV_KP): return *curbuf->b_p_kp != NUL
|
|
8163 ? (char_u *)&curbuf->b_p_kp : p->var;
|
|
8164 case OPT_BOTH(PV_PATH): return *curbuf->b_p_path != NUL
|
|
8165 ? (char_u *)&(curbuf->b_p_path) : p->var;
|
|
8166 case OPT_BOTH(PV_AR): return curbuf->b_p_ar >= 0
|
|
8167 ? (char_u *)&(curbuf->b_p_ar) : p->var;
|
|
8168 case OPT_BOTH(PV_TAGS): return *curbuf->b_p_tags != NUL
|
|
8169 ? (char_u *)&(curbuf->b_p_tags) : p->var;
|
|
8170 #ifdef FEAT_FIND_ID
|
|
8171 case OPT_BOTH(PV_DEF): return *curbuf->b_p_def != NUL
|
|
8172 ? (char_u *)&(curbuf->b_p_def) : p->var;
|
|
8173 case OPT_BOTH(PV_INC): return *curbuf->b_p_inc != NUL
|
|
8174 ? (char_u *)&(curbuf->b_p_inc) : p->var;
|
|
8175 #endif
|
|
8176 #ifdef FEAT_INS_EXPAND
|
|
8177 case OPT_BOTH(PV_DICT): return *curbuf->b_p_dict != NUL
|
|
8178 ? (char_u *)&(curbuf->b_p_dict) : p->var;
|
|
8179 case OPT_BOTH(PV_TSR): return *curbuf->b_p_tsr != NUL
|
|
8180 ? (char_u *)&(curbuf->b_p_tsr) : p->var;
|
|
8181 #endif
|
|
8182 #ifdef FEAT_QUICKFIX
|
|
8183 case OPT_BOTH(PV_GP): return *curbuf->b_p_gp != NUL
|
|
8184 ? (char_u *)&(curbuf->b_p_gp) : p->var;
|
|
8185 case OPT_BOTH(PV_MP): return *curbuf->b_p_mp != NUL
|
|
8186 ? (char_u *)&(curbuf->b_p_mp) : p->var;
|
|
8187 case OPT_BOTH(PV_EFM): return *curbuf->b_p_efm != NUL
|
|
8188 ? (char_u *)&(curbuf->b_p_efm) : p->var;
|
|
8189 #endif
|
40
|
8190 #ifdef FEAT_STL_OPT
|
|
8191 case OPT_BOTH(PV_STL): return *curwin->w_p_stl != NUL
|
|
8192 ? (char_u *)&(curwin->w_p_stl) : p->var;
|
|
8193 #endif
|
7
|
8194
|
|
8195 #ifdef FEAT_ARABIC
|
|
8196 case PV_ARAB: return (char_u *)&(curwin->w_p_arab);
|
|
8197 #endif
|
|
8198 case PV_LIST: return (char_u *)&(curwin->w_p_list);
|
221
|
8199 #ifdef FEAT_SYN_HL
|
|
8200 case PV_SPELL: return (char_u *)&(curwin->w_p_spell);
|
|
8201 #endif
|
7
|
8202 #ifdef FEAT_DIFF
|
|
8203 case PV_DIFF: return (char_u *)&(curwin->w_p_diff);
|
|
8204 #endif
|
|
8205 #ifdef FEAT_FOLDING
|
|
8206 case PV_FDC: return (char_u *)&(curwin->w_p_fdc);
|
|
8207 case PV_FEN: return (char_u *)&(curwin->w_p_fen);
|
|
8208 case PV_FDI: return (char_u *)&(curwin->w_p_fdi);
|
|
8209 case PV_FDL: return (char_u *)&(curwin->w_p_fdl);
|
|
8210 case PV_FDM: return (char_u *)&(curwin->w_p_fdm);
|
|
8211 case PV_FML: return (char_u *)&(curwin->w_p_fml);
|
|
8212 case PV_FDN: return (char_u *)&(curwin->w_p_fdn);
|
|
8213 # ifdef FEAT_EVAL
|
|
8214 case PV_FDE: return (char_u *)&(curwin->w_p_fde);
|
|
8215 case PV_FDT: return (char_u *)&(curwin->w_p_fdt);
|
|
8216 # endif
|
|
8217 case PV_FMR: return (char_u *)&(curwin->w_p_fmr);
|
|
8218 #endif
|
|
8219 case PV_NU: return (char_u *)&(curwin->w_p_nu);
|
13
|
8220 #ifdef FEAT_LINEBREAK
|
|
8221 case PV_NUW: return (char_u *)&(curwin->w_p_nuw);
|
|
8222 #endif
|
7
|
8223 #if defined(FEAT_WINDOWS)
|
|
8224 case PV_WFH: return (char_u *)&(curwin->w_p_wfh);
|
|
8225 #endif
|
|
8226 #if defined(FEAT_WINDOWS) && defined(FEAT_QUICKFIX)
|
|
8227 case PV_PVW: return (char_u *)&(curwin->w_p_pvw);
|
|
8228 #endif
|
|
8229 #ifdef FEAT_RIGHTLEFT
|
|
8230 case PV_RL: return (char_u *)&(curwin->w_p_rl);
|
|
8231 case PV_RLC: return (char_u *)&(curwin->w_p_rlc);
|
|
8232 #endif
|
|
8233 case PV_SCROLL: return (char_u *)&(curwin->w_p_scr);
|
|
8234 case PV_WRAP: return (char_u *)&(curwin->w_p_wrap);
|
|
8235 #ifdef FEAT_LINEBREAK
|
|
8236 case PV_LBR: return (char_u *)&(curwin->w_p_lbr);
|
|
8237 #endif
|
|
8238 #ifdef FEAT_SCROLLBIND
|
|
8239 case PV_SCBIND: return (char_u *)&(curwin->w_p_scb);
|
|
8240 #endif
|
|
8241
|
|
8242 case PV_AI: return (char_u *)&(curbuf->b_p_ai);
|
|
8243 case PV_BIN: return (char_u *)&(curbuf->b_p_bin);
|
|
8244 #ifdef FEAT_MBYTE
|
|
8245 case PV_BOMB: return (char_u *)&(curbuf->b_p_bomb);
|
|
8246 #endif
|
|
8247 #if defined(FEAT_QUICKFIX)
|
|
8248 case PV_BH: return (char_u *)&(curbuf->b_p_bh);
|
|
8249 case PV_BT: return (char_u *)&(curbuf->b_p_bt);
|
|
8250 #endif
|
|
8251 case PV_BL: return (char_u *)&(curbuf->b_p_bl);
|
|
8252 case PV_CI: return (char_u *)&(curbuf->b_p_ci);
|
|
8253 #ifdef FEAT_CINDENT
|
|
8254 case PV_CIN: return (char_u *)&(curbuf->b_p_cin);
|
|
8255 case PV_CINK: return (char_u *)&(curbuf->b_p_cink);
|
|
8256 case PV_CINO: return (char_u *)&(curbuf->b_p_cino);
|
|
8257 #endif
|
|
8258 #if defined(FEAT_SMARTINDENT) || defined(FEAT_CINDENT)
|
|
8259 case PV_CINW: return (char_u *)&(curbuf->b_p_cinw);
|
|
8260 #endif
|
|
8261 #ifdef FEAT_COMMENTS
|
|
8262 case PV_COM: return (char_u *)&(curbuf->b_p_com);
|
|
8263 #endif
|
|
8264 #ifdef FEAT_FOLDING
|
|
8265 case PV_CMS: return (char_u *)&(curbuf->b_p_cms);
|
|
8266 #endif
|
|
8267 #ifdef FEAT_INS_EXPAND
|
|
8268 case PV_CPT: return (char_u *)&(curbuf->b_p_cpt);
|
|
8269 #endif
|
12
|
8270 #ifdef FEAT_COMPL_FUNC
|
|
8271 case PV_CFU: return (char_u *)&(curbuf->b_p_cfu);
|
|
8272 #endif
|
7
|
8273 case PV_EOL: return (char_u *)&(curbuf->b_p_eol);
|
|
8274 case PV_ET: return (char_u *)&(curbuf->b_p_et);
|
|
8275 #ifdef FEAT_MBYTE
|
|
8276 case PV_FENC: return (char_u *)&(curbuf->b_p_fenc);
|
|
8277 #endif
|
|
8278 case PV_FF: return (char_u *)&(curbuf->b_p_ff);
|
|
8279 #ifdef FEAT_AUTOCMD
|
|
8280 case PV_FT: return (char_u *)&(curbuf->b_p_ft);
|
|
8281 #endif
|
|
8282 case PV_FO: return (char_u *)&(curbuf->b_p_fo);
|
41
|
8283 case PV_FLP: return (char_u *)&(curbuf->b_p_flp);
|
7
|
8284 case PV_IMI: return (char_u *)&(curbuf->b_p_iminsert);
|
|
8285 case PV_IMS: return (char_u *)&(curbuf->b_p_imsearch);
|
|
8286 case PV_INF: return (char_u *)&(curbuf->b_p_inf);
|
|
8287 case PV_ISK: return (char_u *)&(curbuf->b_p_isk);
|
|
8288 #ifdef FEAT_FIND_ID
|
|
8289 # ifdef FEAT_EVAL
|
|
8290 case PV_INEX: return (char_u *)&(curbuf->b_p_inex);
|
|
8291 # endif
|
|
8292 #endif
|
|
8293 #if defined(FEAT_CINDENT) && defined(FEAT_EVAL)
|
|
8294 case PV_INDE: return (char_u *)&(curbuf->b_p_inde);
|
|
8295 case PV_INDK: return (char_u *)&(curbuf->b_p_indk);
|
|
8296 #endif
|
|
8297 #ifdef FEAT_CRYPT
|
|
8298 case PV_KEY: return (char_u *)&(curbuf->b_p_key);
|
|
8299 #endif
|
|
8300 #ifdef FEAT_LISP
|
|
8301 case PV_LISP: return (char_u *)&(curbuf->b_p_lisp);
|
|
8302 #endif
|
|
8303 case PV_ML: return (char_u *)&(curbuf->b_p_ml);
|
|
8304 case PV_MPS: return (char_u *)&(curbuf->b_p_mps);
|
|
8305 case PV_MA: return (char_u *)&(curbuf->b_p_ma);
|
|
8306 case PV_MOD: return (char_u *)&(curbuf->b_changed);
|
|
8307 case PV_NF: return (char_u *)&(curbuf->b_p_nf);
|
|
8308 #ifdef FEAT_OSFILETYPE
|
|
8309 case PV_OFT: return (char_u *)&(curbuf->b_p_oft);
|
|
8310 #endif
|
|
8311 case PV_PI: return (char_u *)&(curbuf->b_p_pi);
|
12
|
8312 #ifdef FEAT_TEXTOBJ
|
|
8313 case PV_QE: return (char_u *)&(curbuf->b_p_qe);
|
|
8314 #endif
|
7
|
8315 case PV_RO: return (char_u *)&(curbuf->b_p_ro);
|
|
8316 #ifdef FEAT_SMARTINDENT
|
|
8317 case PV_SI: return (char_u *)&(curbuf->b_p_si);
|
|
8318 #endif
|
|
8319 #ifndef SHORT_FNAME
|
|
8320 case PV_SN: return (char_u *)&(curbuf->b_p_sn);
|
|
8321 #endif
|
|
8322 case PV_STS: return (char_u *)&(curbuf->b_p_sts);
|
|
8323 #ifdef FEAT_SEARCHPATH
|
|
8324 case PV_SUA: return (char_u *)&(curbuf->b_p_sua);
|
|
8325 #endif
|
|
8326 case PV_SWF: return (char_u *)&(curbuf->b_p_swf);
|
|
8327 #ifdef FEAT_SYN_HL
|
|
8328 case PV_SYN: return (char_u *)&(curbuf->b_p_syn);
|
314
|
8329 case PV_SPF: return (char_u *)&(curbuf->b_p_spf);
|
221
|
8330 case PV_SPL: return (char_u *)&(curbuf->b_p_spl);
|
7
|
8331 #endif
|
|
8332 case PV_SW: return (char_u *)&(curbuf->b_p_sw);
|
|
8333 case PV_TS: return (char_u *)&(curbuf->b_p_ts);
|
|
8334 case PV_TW: return (char_u *)&(curbuf->b_p_tw);
|
|
8335 case PV_TX: return (char_u *)&(curbuf->b_p_tx);
|
|
8336 case PV_WM: return (char_u *)&(curbuf->b_p_wm);
|
|
8337 #ifdef FEAT_KEYMAP
|
|
8338 case PV_KMAP: return (char_u *)&(curbuf->b_p_keymap);
|
|
8339 #endif
|
|
8340 default: EMSG(_("E356: get_varp ERROR"));
|
|
8341 }
|
|
8342 /* always return a valid pointer to avoid a crash! */
|
|
8343 return (char_u *)&(curbuf->b_p_wm);
|
|
8344 }
|
|
8345
|
|
8346 /*
|
|
8347 * Get the value of 'equalprg', either the buffer-local one or the global one.
|
|
8348 */
|
|
8349 char_u *
|
|
8350 get_equalprg()
|
|
8351 {
|
|
8352 if (*curbuf->b_p_ep == NUL)
|
|
8353 return p_ep;
|
|
8354 return curbuf->b_p_ep;
|
|
8355 }
|
|
8356
|
|
8357 #if defined(FEAT_WINDOWS) || defined(PROTO)
|
|
8358 /*
|
|
8359 * Copy options from one window to another.
|
|
8360 * Used when splitting a window.
|
|
8361 */
|
|
8362 void
|
|
8363 win_copy_options(wp_from, wp_to)
|
|
8364 win_T *wp_from;
|
|
8365 win_T *wp_to;
|
|
8366 {
|
|
8367 copy_winopt(&wp_from->w_onebuf_opt, &wp_to->w_onebuf_opt);
|
|
8368 copy_winopt(&wp_from->w_allbuf_opt, &wp_to->w_allbuf_opt);
|
|
8369 # ifdef FEAT_RIGHTLEFT
|
|
8370 # ifdef FEAT_FKMAP
|
|
8371 /* Is this right? */
|
|
8372 wp_to->w_farsi = wp_from->w_farsi;
|
|
8373 # endif
|
|
8374 # endif
|
|
8375 }
|
|
8376 #endif
|
|
8377
|
|
8378 /*
|
|
8379 * Copy the options from one winopt_T to another.
|
|
8380 * Doesn't free the old option values in "to", use clear_winopt() for that.
|
|
8381 * The 'scroll' option is not copied, because it depends on the window height.
|
|
8382 * The 'previewwindow' option is reset, there can be only one preview window.
|
|
8383 */
|
|
8384 void
|
|
8385 copy_winopt(from, to)
|
|
8386 winopt_T *from;
|
|
8387 winopt_T *to;
|
|
8388 {
|
|
8389 #ifdef FEAT_ARABIC
|
|
8390 to->wo_arab = from->wo_arab;
|
|
8391 #endif
|
|
8392 to->wo_list = from->wo_list;
|
|
8393 to->wo_nu = from->wo_nu;
|
13
|
8394 #ifdef FEAT_LINEBREAK
|
|
8395 to->wo_nuw = from->wo_nuw;
|
|
8396 #endif
|
7
|
8397 #ifdef FEAT_RIGHTLEFT
|
|
8398 to->wo_rl = from->wo_rl;
|
|
8399 to->wo_rlc = vim_strsave(from->wo_rlc);
|
|
8400 #endif
|
40
|
8401 #ifdef FEAT_STL_OPT
|
|
8402 to->wo_stl = vim_strsave(from->wo_stl);
|
|
8403 #endif
|
7
|
8404 to->wo_wrap = from->wo_wrap;
|
|
8405 #ifdef FEAT_LINEBREAK
|
|
8406 to->wo_lbr = from->wo_lbr;
|
|
8407 #endif
|
|
8408 #ifdef FEAT_SCROLLBIND
|
|
8409 to->wo_scb = from->wo_scb;
|
|
8410 #endif
|
221
|
8411 #ifdef FEAT_SYN_HL
|
|
8412 to->wo_spell = from->wo_spell;
|
|
8413 #endif
|
7
|
8414 #ifdef FEAT_DIFF
|
|
8415 to->wo_diff = from->wo_diff;
|
|
8416 #endif
|
|
8417 #ifdef FEAT_FOLDING
|
|
8418 to->wo_fdc = from->wo_fdc;
|
|
8419 to->wo_fen = from->wo_fen;
|
|
8420 to->wo_fdi = vim_strsave(from->wo_fdi);
|
|
8421 to->wo_fml = from->wo_fml;
|
|
8422 to->wo_fdl = from->wo_fdl;
|
|
8423 to->wo_fdm = vim_strsave(from->wo_fdm);
|
|
8424 to->wo_fdn = from->wo_fdn;
|
|
8425 # ifdef FEAT_EVAL
|
|
8426 to->wo_fde = vim_strsave(from->wo_fde);
|
|
8427 to->wo_fdt = vim_strsave(from->wo_fdt);
|
|
8428 # endif
|
|
8429 to->wo_fmr = vim_strsave(from->wo_fmr);
|
|
8430 #endif
|
|
8431 check_winopt(to); /* don't want NULL pointers */
|
|
8432 }
|
|
8433
|
|
8434 /*
|
|
8435 * Check string options in a window for a NULL value.
|
|
8436 */
|
|
8437 void
|
|
8438 check_win_options(win)
|
|
8439 win_T *win;
|
|
8440 {
|
|
8441 check_winopt(&win->w_onebuf_opt);
|
|
8442 check_winopt(&win->w_allbuf_opt);
|
|
8443 }
|
|
8444
|
|
8445 /*
|
|
8446 * Check for NULL pointers in a winopt_T and replace them with empty_option.
|
|
8447 */
|
|
8448 /*ARGSUSED*/
|
|
8449 void
|
|
8450 check_winopt(wop)
|
|
8451 winopt_T *wop;
|
|
8452 {
|
|
8453 #ifdef FEAT_FOLDING
|
|
8454 check_string_option(&wop->wo_fdi);
|
|
8455 check_string_option(&wop->wo_fdm);
|
|
8456 # ifdef FEAT_EVAL
|
|
8457 check_string_option(&wop->wo_fde);
|
|
8458 check_string_option(&wop->wo_fdt);
|
|
8459 # endif
|
|
8460 check_string_option(&wop->wo_fmr);
|
|
8461 #endif
|
|
8462 #ifdef FEAT_RIGHTLEFT
|
|
8463 check_string_option(&wop->wo_rlc);
|
|
8464 #endif
|
40
|
8465 #ifdef FEAT_STL_OPT
|
|
8466 check_string_option(&wop->wo_stl);
|
|
8467 #endif
|
7
|
8468 }
|
|
8469
|
|
8470 /*
|
|
8471 * Free the allocated memory inside a winopt_T.
|
|
8472 */
|
|
8473 /*ARGSUSED*/
|
|
8474 void
|
|
8475 clear_winopt(wop)
|
|
8476 winopt_T *wop;
|
|
8477 {
|
|
8478 #ifdef FEAT_FOLDING
|
|
8479 clear_string_option(&wop->wo_fdi);
|
|
8480 clear_string_option(&wop->wo_fdm);
|
|
8481 # ifdef FEAT_EVAL
|
|
8482 clear_string_option(&wop->wo_fde);
|
|
8483 clear_string_option(&wop->wo_fdt);
|
|
8484 # endif
|
|
8485 clear_string_option(&wop->wo_fmr);
|
|
8486 #endif
|
|
8487 #ifdef FEAT_RIGHTLEFT
|
|
8488 clear_string_option(&wop->wo_rlc);
|
|
8489 #endif
|
40
|
8490 #ifdef FEAT_STL_OPT
|
|
8491 clear_string_option(&wop->wo_stl);
|
|
8492 #endif
|
7
|
8493 }
|
|
8494
|
|
8495 /*
|
|
8496 * Copy global option values to local options for one buffer.
|
|
8497 * Used when creating a new buffer and sometimes when entering a buffer.
|
|
8498 * flags:
|
|
8499 * BCO_ENTER We will enter the buf buffer.
|
|
8500 * BCO_ALWAYS Always copy the options, but only set b_p_initialized when
|
|
8501 * appropriate.
|
|
8502 * BCO_NOHELP Don't copy the values to a help buffer.
|
|
8503 */
|
|
8504 void
|
|
8505 buf_copy_options(buf, flags)
|
|
8506 buf_T *buf;
|
|
8507 int flags;
|
|
8508 {
|
|
8509 int should_copy = TRUE;
|
|
8510 char_u *save_p_isk = NULL; /* init for GCC */
|
|
8511 int dont_do_help;
|
|
8512 int did_isk = FALSE;
|
|
8513
|
|
8514 /*
|
|
8515 * Don't do anything of the buffer is invalid.
|
|
8516 */
|
|
8517 if (buf == NULL || !buf_valid(buf))
|
|
8518 return;
|
|
8519
|
|
8520 /*
|
|
8521 * Skip this when the option defaults have not been set yet. Happens when
|
|
8522 * main() allocates the first buffer.
|
|
8523 */
|
|
8524 if (p_cpo != NULL)
|
|
8525 {
|
|
8526 /*
|
|
8527 * Always copy when entering and 'cpo' contains 'S'.
|
|
8528 * Don't copy when already initialized.
|
|
8529 * Don't copy when 'cpo' contains 's' and not entering.
|
|
8530 * 'S' BCO_ENTER initialized 's' should_copy
|
|
8531 * yes yes X X TRUE
|
|
8532 * yes no yes X FALSE
|
|
8533 * no X yes X FALSE
|
|
8534 * X no no yes FALSE
|
|
8535 * X no no no TRUE
|
|
8536 * no yes no X TRUE
|
|
8537 */
|
|
8538 if ((vim_strchr(p_cpo, CPO_BUFOPTGLOB) == NULL || !(flags & BCO_ENTER))
|
|
8539 && (buf->b_p_initialized
|
|
8540 || (!(flags & BCO_ENTER)
|
|
8541 && vim_strchr(p_cpo, CPO_BUFOPT) != NULL)))
|
|
8542 should_copy = FALSE;
|
|
8543
|
|
8544 if (should_copy || (flags & BCO_ALWAYS))
|
|
8545 {
|
|
8546 /* Don't copy the options specific to a help buffer when
|
|
8547 * BCO_NOHELP is given or the options were initialized already
|
|
8548 * (jumping back to a help file with CTRL-T or CTRL-O) */
|
|
8549 dont_do_help = ((flags & BCO_NOHELP) && buf->b_help)
|
|
8550 || buf->b_p_initialized;
|
|
8551 if (dont_do_help) /* don't free b_p_isk */
|
|
8552 {
|
|
8553 save_p_isk = buf->b_p_isk;
|
|
8554 buf->b_p_isk = NULL;
|
|
8555 }
|
|
8556 /*
|
|
8557 * Always free the allocated strings.
|
|
8558 * If not already initialized, set 'readonly' and copy 'fileformat'.
|
|
8559 */
|
|
8560 if (!buf->b_p_initialized)
|
|
8561 {
|
|
8562 free_buf_options(buf, TRUE);
|
|
8563 buf->b_p_ro = FALSE; /* don't copy readonly */
|
|
8564 buf->b_p_tx = p_tx;
|
|
8565 #ifdef FEAT_MBYTE
|
|
8566 buf->b_p_fenc = vim_strsave(p_fenc);
|
|
8567 #endif
|
|
8568 buf->b_p_ff = vim_strsave(p_ff);
|
|
8569 #if defined(FEAT_QUICKFIX)
|
|
8570 buf->b_p_bh = empty_option;
|
|
8571 buf->b_p_bt = empty_option;
|
|
8572 #endif
|
|
8573 }
|
|
8574 else
|
|
8575 free_buf_options(buf, FALSE);
|
|
8576
|
|
8577 buf->b_p_ai = p_ai;
|
|
8578 buf->b_p_ai_nopaste = p_ai_nopaste;
|
|
8579 buf->b_p_sw = p_sw;
|
|
8580 buf->b_p_tw = p_tw;
|
|
8581 buf->b_p_tw_nopaste = p_tw_nopaste;
|
|
8582 buf->b_p_tw_nobin = p_tw_nobin;
|
|
8583 buf->b_p_wm = p_wm;
|
|
8584 buf->b_p_wm_nopaste = p_wm_nopaste;
|
|
8585 buf->b_p_wm_nobin = p_wm_nobin;
|
|
8586 buf->b_p_bin = p_bin;
|
|
8587 buf->b_p_et = p_et;
|
|
8588 buf->b_p_et_nobin = p_et_nobin;
|
|
8589 buf->b_p_ml = p_ml;
|
|
8590 buf->b_p_ml_nobin = p_ml_nobin;
|
|
8591 buf->b_p_inf = p_inf;
|
|
8592 buf->b_p_swf = p_swf;
|
|
8593 #ifdef FEAT_INS_EXPAND
|
|
8594 buf->b_p_cpt = vim_strsave(p_cpt);
|
|
8595 #endif
|
12
|
8596 #ifdef FEAT_COMPL_FUNC
|
|
8597 buf->b_p_cfu = vim_strsave(p_cfu);
|
|
8598 #endif
|
7
|
8599 buf->b_p_sts = p_sts;
|
|
8600 buf->b_p_sts_nopaste = p_sts_nopaste;
|
|
8601 #ifndef SHORT_FNAME
|
|
8602 buf->b_p_sn = p_sn;
|
|
8603 #endif
|
|
8604 #ifdef FEAT_COMMENTS
|
|
8605 buf->b_p_com = vim_strsave(p_com);
|
|
8606 #endif
|
|
8607 #ifdef FEAT_FOLDING
|
|
8608 buf->b_p_cms = vim_strsave(p_cms);
|
|
8609 #endif
|
|
8610 buf->b_p_fo = vim_strsave(p_fo);
|
41
|
8611 buf->b_p_flp = vim_strsave(p_flp);
|
7
|
8612 buf->b_p_nf = vim_strsave(p_nf);
|
|
8613 buf->b_p_mps = vim_strsave(p_mps);
|
|
8614 #ifdef FEAT_SMARTINDENT
|
|
8615 buf->b_p_si = p_si;
|
|
8616 #endif
|
|
8617 buf->b_p_ci = p_ci;
|
|
8618 #ifdef FEAT_CINDENT
|
|
8619 buf->b_p_cin = p_cin;
|
|
8620 buf->b_p_cink = vim_strsave(p_cink);
|
|
8621 buf->b_p_cino = vim_strsave(p_cino);
|
|
8622 #endif
|
|
8623 #ifdef FEAT_AUTOCMD
|
|
8624 /* Don't copy 'filetype', it must be detected */
|
|
8625 buf->b_p_ft = empty_option;
|
|
8626 #endif
|
|
8627 #ifdef FEAT_OSFILETYPE
|
|
8628 buf->b_p_oft = vim_strsave(p_oft);
|
|
8629 #endif
|
|
8630 buf->b_p_pi = p_pi;
|
|
8631 #if defined(FEAT_SMARTINDENT) || defined(FEAT_CINDENT)
|
|
8632 buf->b_p_cinw = vim_strsave(p_cinw);
|
|
8633 #endif
|
|
8634 #ifdef FEAT_LISP
|
|
8635 buf->b_p_lisp = p_lisp;
|
|
8636 #endif
|
|
8637 #ifdef FEAT_SYN_HL
|
|
8638 /* Don't copy 'syntax', it must be set */
|
|
8639 buf->b_p_syn = empty_option;
|
314
|
8640 buf->b_p_spf = vim_strsave(p_spf);
|
221
|
8641 buf->b_p_spl = vim_strsave(p_spl);
|
7
|
8642 #endif
|
|
8643 #if defined(FEAT_CINDENT) && defined(FEAT_EVAL)
|
|
8644 buf->b_p_inde = vim_strsave(p_inde);
|
|
8645 buf->b_p_indk = vim_strsave(p_indk);
|
|
8646 #endif
|
|
8647 #ifdef FEAT_CRYPT
|
|
8648 buf->b_p_key = vim_strsave(p_key);
|
|
8649 #endif
|
|
8650 #ifdef FEAT_SEARCHPATH
|
|
8651 buf->b_p_sua = vim_strsave(p_sua);
|
|
8652 #endif
|
|
8653 #ifdef FEAT_KEYMAP
|
|
8654 buf->b_p_keymap = vim_strsave(p_keymap);
|
|
8655 buf->b_kmap_state |= KEYMAP_INIT;
|
|
8656 #endif
|
|
8657 /* This isn't really an option, but copying the langmap and IME
|
|
8658 * state from the current buffer is better than resetting it. */
|
|
8659 buf->b_p_iminsert = p_iminsert;
|
|
8660 buf->b_p_imsearch = p_imsearch;
|
|
8661
|
|
8662 /* options that are normally global but also have a local value
|
|
8663 * are not copied, start using the global value */
|
|
8664 buf->b_p_ar = -1;
|
|
8665 #ifdef FEAT_QUICKFIX
|
|
8666 buf->b_p_gp = empty_option;
|
|
8667 buf->b_p_mp = empty_option;
|
|
8668 buf->b_p_efm = empty_option;
|
|
8669 #endif
|
|
8670 buf->b_p_ep = empty_option;
|
|
8671 buf->b_p_kp = empty_option;
|
|
8672 buf->b_p_path = empty_option;
|
|
8673 buf->b_p_tags = empty_option;
|
|
8674 #ifdef FEAT_FIND_ID
|
|
8675 buf->b_p_def = empty_option;
|
|
8676 buf->b_p_inc = empty_option;
|
|
8677 # ifdef FEAT_EVAL
|
|
8678 buf->b_p_inex = vim_strsave(p_inex);
|
|
8679 # endif
|
|
8680 #endif
|
|
8681 #ifdef FEAT_INS_EXPAND
|
|
8682 buf->b_p_dict = empty_option;
|
|
8683 buf->b_p_tsr = empty_option;
|
|
8684 #endif
|
12
|
8685 #ifdef FEAT_TEXTOBJ
|
|
8686 buf->b_p_qe = vim_strsave(p_qe);
|
|
8687 #endif
|
7
|
8688
|
|
8689 /*
|
|
8690 * Don't copy the options set by ex_help(), use the saved values,
|
|
8691 * when going from a help buffer to a non-help buffer.
|
|
8692 * Don't touch these at all when BCO_NOHELP is used and going from
|
|
8693 * or to a help buffer.
|
|
8694 */
|
|
8695 if (dont_do_help)
|
|
8696 buf->b_p_isk = save_p_isk;
|
|
8697 else
|
|
8698 {
|
|
8699 buf->b_p_isk = vim_strsave(p_isk);
|
|
8700 did_isk = TRUE;
|
|
8701 buf->b_p_ts = p_ts;
|
|
8702 buf->b_help = FALSE;
|
|
8703 #ifdef FEAT_QUICKFIX
|
|
8704 if (buf->b_p_bt[0] == 'h')
|
|
8705 clear_string_option(&buf->b_p_bt);
|
|
8706 #endif
|
|
8707 buf->b_p_ma = p_ma;
|
|
8708 }
|
|
8709 }
|
|
8710
|
|
8711 /*
|
|
8712 * When the options should be copied (ignoring BCO_ALWAYS), set the
|
|
8713 * flag that indicates that the options have been initialized.
|
|
8714 */
|
|
8715 if (should_copy)
|
|
8716 buf->b_p_initialized = TRUE;
|
|
8717 }
|
|
8718
|
|
8719 check_buf_options(buf); /* make sure we don't have NULLs */
|
|
8720 if (did_isk)
|
|
8721 (void)buf_init_chartab(buf, FALSE);
|
|
8722 }
|
|
8723
|
|
8724 /*
|
|
8725 * Reset the 'modifiable' option and its default value.
|
|
8726 */
|
|
8727 void
|
|
8728 reset_modifiable()
|
|
8729 {
|
|
8730 int opt_idx;
|
|
8731
|
|
8732 curbuf->b_p_ma = FALSE;
|
|
8733 p_ma = FALSE;
|
|
8734 opt_idx = findoption((char_u *)"ma");
|
|
8735 options[opt_idx].def_val[VI_DEFAULT] = FALSE;
|
|
8736 }
|
|
8737
|
|
8738 /*
|
|
8739 * Set the global value for 'iminsert' to the local value.
|
|
8740 */
|
|
8741 void
|
|
8742 set_iminsert_global()
|
|
8743 {
|
|
8744 p_iminsert = curbuf->b_p_iminsert;
|
|
8745 }
|
|
8746
|
|
8747 /*
|
|
8748 * Set the global value for 'imsearch' to the local value.
|
|
8749 */
|
|
8750 void
|
|
8751 set_imsearch_global()
|
|
8752 {
|
|
8753 p_imsearch = curbuf->b_p_imsearch;
|
|
8754 }
|
|
8755
|
|
8756 #if defined(FEAT_CMDL_COMPL) || defined(PROTO)
|
|
8757 static int expand_option_idx = -1;
|
|
8758 static char_u expand_option_name[5] = {'t', '_', NUL, NUL, NUL};
|
|
8759 static int expand_option_flags = 0;
|
|
8760
|
|
8761 void
|
|
8762 set_context_in_set_cmd(xp, arg, opt_flags)
|
|
8763 expand_T *xp;
|
|
8764 char_u *arg;
|
|
8765 int opt_flags; /* OPT_GLOBAL and/or OPT_LOCAL */
|
|
8766 {
|
|
8767 int nextchar;
|
|
8768 long_u flags = 0; /* init for GCC */
|
|
8769 int opt_idx = 0; /* init for GCC */
|
|
8770 char_u *p;
|
|
8771 char_u *s;
|
|
8772 int is_term_option = FALSE;
|
|
8773 int key;
|
|
8774
|
|
8775 expand_option_flags = opt_flags;
|
|
8776
|
|
8777 xp->xp_context = EXPAND_SETTINGS;
|
|
8778 if (*arg == NUL)
|
|
8779 {
|
|
8780 xp->xp_pattern = arg;
|
|
8781 return;
|
|
8782 }
|
|
8783 p = arg + STRLEN(arg) - 1;
|
|
8784 if (*p == ' ' && *(p - 1) != '\\')
|
|
8785 {
|
|
8786 xp->xp_pattern = p + 1;
|
|
8787 return;
|
|
8788 }
|
|
8789 while (p > arg)
|
|
8790 {
|
|
8791 s = p;
|
|
8792 /* count number of backslashes before ' ' or ',' */
|
|
8793 if (*p == ' ' || *p == ',')
|
|
8794 {
|
|
8795 while (s > arg && *(s - 1) == '\\')
|
|
8796 --s;
|
|
8797 }
|
|
8798 /* break at a space with an even number of backslashes */
|
|
8799 if (*p == ' ' && ((p - s) & 1) == 0)
|
|
8800 {
|
|
8801 ++p;
|
|
8802 break;
|
|
8803 }
|
|
8804 --p;
|
|
8805 }
|
|
8806 if (STRNCMP(p, "no", 2) == 0)
|
|
8807 {
|
|
8808 xp->xp_context = EXPAND_BOOL_SETTINGS;
|
|
8809 p += 2;
|
|
8810 }
|
|
8811 if (STRNCMP(p, "inv", 3) == 0)
|
|
8812 {
|
|
8813 xp->xp_context = EXPAND_BOOL_SETTINGS;
|
|
8814 p += 3;
|
|
8815 }
|
|
8816 xp->xp_pattern = arg = p;
|
|
8817 if (*arg == '<')
|
|
8818 {
|
|
8819 while (*p != '>')
|
|
8820 if (*p++ == NUL) /* expand terminal option name */
|
|
8821 return;
|
|
8822 key = get_special_key_code(arg + 1);
|
|
8823 if (key == 0) /* unknown name */
|
|
8824 {
|
|
8825 xp->xp_context = EXPAND_NOTHING;
|
|
8826 return;
|
|
8827 }
|
|
8828 nextchar = *++p;
|
|
8829 is_term_option = TRUE;
|
|
8830 expand_option_name[2] = KEY2TERMCAP0(key);
|
|
8831 expand_option_name[3] = KEY2TERMCAP1(key);
|
|
8832 }
|
|
8833 else
|
|
8834 {
|
|
8835 if (p[0] == 't' && p[1] == '_')
|
|
8836 {
|
|
8837 p += 2;
|
|
8838 if (*p != NUL)
|
|
8839 ++p;
|
|
8840 if (*p == NUL)
|
|
8841 return; /* expand option name */
|
|
8842 nextchar = *++p;
|
|
8843 is_term_option = TRUE;
|
|
8844 expand_option_name[2] = p[-2];
|
|
8845 expand_option_name[3] = p[-1];
|
|
8846 }
|
|
8847 else
|
|
8848 {
|
|
8849 /* Allow * wildcard */
|
|
8850 while (ASCII_ISALNUM(*p) || *p == '_' || *p == '*')
|
|
8851 p++;
|
|
8852 if (*p == NUL)
|
|
8853 return;
|
|
8854 nextchar = *p;
|
|
8855 *p = NUL;
|
|
8856 opt_idx = findoption(arg);
|
|
8857 *p = nextchar;
|
|
8858 if (opt_idx == -1 || options[opt_idx].var == NULL)
|
|
8859 {
|
|
8860 xp->xp_context = EXPAND_NOTHING;
|
|
8861 return;
|
|
8862 }
|
|
8863 flags = options[opt_idx].flags;
|
|
8864 if (flags & P_BOOL)
|
|
8865 {
|
|
8866 xp->xp_context = EXPAND_NOTHING;
|
|
8867 return;
|
|
8868 }
|
|
8869 }
|
|
8870 }
|
|
8871 /* handle "-=" and "+=" */
|
|
8872 if ((nextchar == '-' || nextchar == '+' || nextchar == '^') && p[1] == '=')
|
|
8873 {
|
|
8874 ++p;
|
|
8875 nextchar = '=';
|
|
8876 }
|
|
8877 if ((nextchar != '=' && nextchar != ':')
|
|
8878 || xp->xp_context == EXPAND_BOOL_SETTINGS)
|
|
8879 {
|
|
8880 xp->xp_context = EXPAND_UNSUCCESSFUL;
|
|
8881 return;
|
|
8882 }
|
|
8883 if (xp->xp_context != EXPAND_BOOL_SETTINGS && p[1] == NUL)
|
|
8884 {
|
|
8885 xp->xp_context = EXPAND_OLD_SETTING;
|
|
8886 if (is_term_option)
|
|
8887 expand_option_idx = -1;
|
|
8888 else
|
|
8889 expand_option_idx = opt_idx;
|
|
8890 xp->xp_pattern = p + 1;
|
|
8891 return;
|
|
8892 }
|
|
8893 xp->xp_context = EXPAND_NOTHING;
|
|
8894 if (is_term_option || (flags & P_NUM))
|
|
8895 return;
|
|
8896
|
|
8897 xp->xp_pattern = p + 1;
|
|
8898
|
|
8899 if (flags & P_EXPAND)
|
|
8900 {
|
|
8901 p = options[opt_idx].var;
|
|
8902 if (p == (char_u *)&p_bdir
|
|
8903 || p == (char_u *)&p_dir
|
|
8904 || p == (char_u *)&p_path
|
|
8905 || p == (char_u *)&p_rtp
|
|
8906 #ifdef FEAT_SEARCHPATH
|
|
8907 || p == (char_u *)&p_cdpath
|
|
8908 #endif
|
|
8909 #ifdef FEAT_SESSION
|
|
8910 || p == (char_u *)&p_vdir
|
|
8911 #endif
|
|
8912 )
|
|
8913 {
|
|
8914 xp->xp_context = EXPAND_DIRECTORIES;
|
|
8915 if (p == (char_u *)&p_path
|
|
8916 #ifdef FEAT_SEARCHPATH
|
|
8917 || p == (char_u *)&p_cdpath
|
|
8918 #endif
|
|
8919 )
|
|
8920 xp->xp_backslash = XP_BS_THREE;
|
|
8921 else
|
|
8922 xp->xp_backslash = XP_BS_ONE;
|
|
8923 }
|
|
8924 else
|
|
8925 {
|
|
8926 xp->xp_context = EXPAND_FILES;
|
|
8927 /* for 'tags' need three backslashes for a space */
|
|
8928 if (p == (char_u *)&p_tags)
|
|
8929 xp->xp_backslash = XP_BS_THREE;
|
|
8930 else
|
|
8931 xp->xp_backslash = XP_BS_ONE;
|
|
8932 }
|
|
8933 }
|
|
8934
|
|
8935 /* For an option that is a list of file names, find the start of the
|
|
8936 * last file name. */
|
|
8937 for (p = arg + STRLEN(arg) - 1; p > xp->xp_pattern; --p)
|
|
8938 {
|
|
8939 /* count number of backslashes before ' ' or ',' */
|
|
8940 if (*p == ' ' || *p == ',')
|
|
8941 {
|
|
8942 s = p;
|
|
8943 while (s > xp->xp_pattern && *(s - 1) == '\\')
|
|
8944 --s;
|
|
8945 if ((*p == ' ' && (xp->xp_backslash == XP_BS_THREE && (p - s) < 3))
|
|
8946 || (*p == ',' && (flags & P_COMMA) && ((p - s) & 1) == 0))
|
|
8947 {
|
|
8948 xp->xp_pattern = p + 1;
|
|
8949 break;
|
|
8950 }
|
|
8951 }
|
|
8952 }
|
|
8953
|
|
8954 return;
|
|
8955 }
|
|
8956
|
|
8957 int
|
|
8958 ExpandSettings(xp, regmatch, num_file, file)
|
|
8959 expand_T *xp;
|
|
8960 regmatch_T *regmatch;
|
|
8961 int *num_file;
|
|
8962 char_u ***file;
|
|
8963 {
|
|
8964 int num_normal = 0; /* Nr of matching non-term-code settings */
|
|
8965 int num_term = 0; /* Nr of matching terminal code settings */
|
|
8966 int opt_idx;
|
|
8967 int match;
|
|
8968 int count = 0;
|
|
8969 char_u *str;
|
|
8970 int loop;
|
|
8971 int is_term_opt;
|
|
8972 char_u name_buf[MAX_KEY_NAME_LEN];
|
|
8973 static char *(names[]) = {"all", "termcap"};
|
|
8974 int ic = regmatch->rm_ic; /* remember the ignore-case flag */
|
|
8975
|
|
8976 /* do this loop twice:
|
|
8977 * loop == 0: count the number of matching options
|
|
8978 * loop == 1: copy the matching options into allocated memory
|
|
8979 */
|
|
8980 for (loop = 0; loop <= 1; ++loop)
|
|
8981 {
|
|
8982 regmatch->rm_ic = ic;
|
|
8983 if (xp->xp_context != EXPAND_BOOL_SETTINGS)
|
|
8984 {
|
|
8985 for (match = 0; match < sizeof(names) / sizeof(char *); ++match)
|
|
8986 if (vim_regexec(regmatch, (char_u *)names[match], (colnr_T)0))
|
|
8987 {
|
|
8988 if (loop == 0)
|
|
8989 num_normal++;
|
|
8990 else
|
|
8991 (*file)[count++] = vim_strsave((char_u *)names[match]);
|
|
8992 }
|
|
8993 }
|
|
8994 for (opt_idx = 0; (str = (char_u *)options[opt_idx].fullname) != NULL;
|
|
8995 opt_idx++)
|
|
8996 {
|
|
8997 if (options[opt_idx].var == NULL)
|
|
8998 continue;
|
|
8999 if (xp->xp_context == EXPAND_BOOL_SETTINGS
|
|
9000 && !(options[opt_idx].flags & P_BOOL))
|
|
9001 continue;
|
|
9002 is_term_opt = istermoption(&options[opt_idx]);
|
|
9003 if (is_term_opt && num_normal > 0)
|
|
9004 continue;
|
|
9005 match = FALSE;
|
|
9006 if (vim_regexec(regmatch, str, (colnr_T)0)
|
|
9007 || (options[opt_idx].shortname != NULL
|
|
9008 && vim_regexec(regmatch,
|
|
9009 (char_u *)options[opt_idx].shortname, (colnr_T)0)))
|
|
9010 match = TRUE;
|
|
9011 else if (is_term_opt)
|
|
9012 {
|
|
9013 name_buf[0] = '<';
|
|
9014 name_buf[1] = 't';
|
|
9015 name_buf[2] = '_';
|
|
9016 name_buf[3] = str[2];
|
|
9017 name_buf[4] = str[3];
|
|
9018 name_buf[5] = '>';
|
|
9019 name_buf[6] = NUL;
|
|
9020 if (vim_regexec(regmatch, name_buf, (colnr_T)0))
|
|
9021 {
|
|
9022 match = TRUE;
|
|
9023 str = name_buf;
|
|
9024 }
|
|
9025 }
|
|
9026 if (match)
|
|
9027 {
|
|
9028 if (loop == 0)
|
|
9029 {
|
|
9030 if (is_term_opt)
|
|
9031 num_term++;
|
|
9032 else
|
|
9033 num_normal++;
|
|
9034 }
|
|
9035 else
|
|
9036 (*file)[count++] = vim_strsave(str);
|
|
9037 }
|
|
9038 }
|
|
9039 /*
|
|
9040 * Check terminal key codes, these are not in the option table
|
|
9041 */
|
|
9042 if (xp->xp_context != EXPAND_BOOL_SETTINGS && num_normal == 0)
|
|
9043 {
|
|
9044 for (opt_idx = 0; (str = get_termcode(opt_idx)) != NULL; opt_idx++)
|
|
9045 {
|
|
9046 if (!isprint(str[0]) || !isprint(str[1]))
|
|
9047 continue;
|
|
9048
|
|
9049 name_buf[0] = 't';
|
|
9050 name_buf[1] = '_';
|
|
9051 name_buf[2] = str[0];
|
|
9052 name_buf[3] = str[1];
|
|
9053 name_buf[4] = NUL;
|
|
9054
|
|
9055 match = FALSE;
|
|
9056 if (vim_regexec(regmatch, name_buf, (colnr_T)0))
|
|
9057 match = TRUE;
|
|
9058 else
|
|
9059 {
|
|
9060 name_buf[0] = '<';
|
|
9061 name_buf[1] = 't';
|
|
9062 name_buf[2] = '_';
|
|
9063 name_buf[3] = str[0];
|
|
9064 name_buf[4] = str[1];
|
|
9065 name_buf[5] = '>';
|
|
9066 name_buf[6] = NUL;
|
|
9067
|
|
9068 if (vim_regexec(regmatch, name_buf, (colnr_T)0))
|
|
9069 match = TRUE;
|
|
9070 }
|
|
9071 if (match)
|
|
9072 {
|
|
9073 if (loop == 0)
|
|
9074 num_term++;
|
|
9075 else
|
|
9076 (*file)[count++] = vim_strsave(name_buf);
|
|
9077 }
|
|
9078 }
|
|
9079
|
|
9080 /*
|
|
9081 * Check special key names.
|
|
9082 */
|
|
9083 regmatch->rm_ic = TRUE; /* ignore case here */
|
|
9084 for (opt_idx = 0; (str = get_key_name(opt_idx)) != NULL; opt_idx++)
|
|
9085 {
|
|
9086 name_buf[0] = '<';
|
|
9087 STRCPY(name_buf + 1, str);
|
|
9088 STRCAT(name_buf, ">");
|
|
9089
|
|
9090 if (vim_regexec(regmatch, name_buf, (colnr_T)0))
|
|
9091 {
|
|
9092 if (loop == 0)
|
|
9093 num_term++;
|
|
9094 else
|
|
9095 (*file)[count++] = vim_strsave(name_buf);
|
|
9096 }
|
|
9097 }
|
|
9098 }
|
|
9099 if (loop == 0)
|
|
9100 {
|
|
9101 if (num_normal > 0)
|
|
9102 *num_file = num_normal;
|
|
9103 else if (num_term > 0)
|
|
9104 *num_file = num_term;
|
|
9105 else
|
|
9106 return OK;
|
|
9107 *file = (char_u **)alloc((unsigned)(*num_file * sizeof(char_u *)));
|
|
9108 if (*file == NULL)
|
|
9109 {
|
|
9110 *file = (char_u **)"";
|
|
9111 return FAIL;
|
|
9112 }
|
|
9113 }
|
|
9114 }
|
|
9115 return OK;
|
|
9116 }
|
|
9117
|
|
9118 int
|
|
9119 ExpandOldSetting(num_file, file)
|
|
9120 int *num_file;
|
|
9121 char_u ***file;
|
|
9122 {
|
|
9123 char_u *var = NULL; /* init for GCC */
|
|
9124 char_u *buf;
|
|
9125
|
|
9126 *num_file = 0;
|
|
9127 *file = (char_u **)alloc((unsigned)sizeof(char_u *));
|
|
9128 if (*file == NULL)
|
|
9129 return FAIL;
|
|
9130
|
|
9131 /*
|
|
9132 * For a terminal key code expand_option_idx is < 0.
|
|
9133 */
|
|
9134 if (expand_option_idx < 0)
|
|
9135 {
|
|
9136 var = find_termcode(expand_option_name + 2);
|
|
9137 if (var == NULL)
|
|
9138 expand_option_idx = findoption(expand_option_name);
|
|
9139 }
|
|
9140
|
|
9141 if (expand_option_idx >= 0)
|
|
9142 {
|
|
9143 /* put string of option value in NameBuff */
|
|
9144 option_value2string(&options[expand_option_idx], expand_option_flags);
|
|
9145 var = NameBuff;
|
|
9146 }
|
|
9147 else if (var == NULL)
|
|
9148 var = (char_u *)"";
|
|
9149
|
|
9150 /* A backslash is required before some characters. This is the reverse of
|
|
9151 * what happens in do_set(). */
|
|
9152 buf = vim_strsave_escaped(var, escape_chars);
|
|
9153
|
|
9154 if (buf == NULL)
|
|
9155 {
|
|
9156 vim_free(*file);
|
|
9157 *file = NULL;
|
|
9158 return FAIL;
|
|
9159 }
|
|
9160
|
|
9161 #ifdef BACKSLASH_IN_FILENAME
|
|
9162 /* For MS-Windows et al. we don't double backslashes at the start and
|
|
9163 * before a file name character. */
|
39
|
9164 for (var = buf; *var != NUL; mb_ptr_adv(var))
|
7
|
9165 if (var[0] == '\\' && var[1] == '\\'
|
|
9166 && expand_option_idx >= 0
|
|
9167 && (options[expand_option_idx].flags & P_EXPAND)
|
|
9168 && vim_isfilec(var[2])
|
|
9169 && (var[2] != '\\' || (var == buf && var[4] != '\\')))
|
|
9170 mch_memmove(var, var + 1, STRLEN(var));
|
|
9171 #endif
|
|
9172
|
|
9173 *file[0] = buf;
|
|
9174 *num_file = 1;
|
|
9175 return OK;
|
|
9176 }
|
|
9177 #endif
|
|
9178
|
|
9179 /*
|
|
9180 * Get the value for the numeric or string option *opp in a nice format into
|
|
9181 * NameBuff[]. Must not be called with a hidden option!
|
|
9182 */
|
|
9183 static void
|
|
9184 option_value2string(opp, opt_flags)
|
|
9185 struct vimoption *opp;
|
|
9186 int opt_flags; /* OPT_GLOBAL and/or OPT_LOCAL */
|
|
9187 {
|
|
9188 char_u *varp;
|
|
9189
|
|
9190 varp = get_varp_scope(opp, opt_flags);
|
|
9191
|
|
9192 if (opp->flags & P_NUM)
|
|
9193 {
|
|
9194 long wc = 0;
|
|
9195
|
|
9196 if (wc_use_keyname(varp, &wc))
|
|
9197 STRCPY(NameBuff, get_special_key_name((int)wc, 0));
|
|
9198 else if (wc != 0)
|
|
9199 STRCPY(NameBuff, transchar((int)wc));
|
|
9200 else
|
|
9201 sprintf((char *)NameBuff, "%ld", *(long *)varp);
|
|
9202 }
|
|
9203 else /* P_STRING */
|
|
9204 {
|
|
9205 varp = *(char_u **)(varp);
|
|
9206 if (varp == NULL) /* just in case */
|
|
9207 NameBuff[0] = NUL;
|
|
9208 #ifdef FEAT_CRYPT
|
|
9209 /* don't show the actual value of 'key', only that it's set */
|
|
9210 if (opp->var == (char_u *)&p_key && *varp)
|
|
9211 STRCPY(NameBuff, "*****");
|
|
9212 #endif
|
|
9213 else if (opp->flags & P_EXPAND)
|
|
9214 home_replace(NULL, varp, NameBuff, MAXPATHL, FALSE);
|
|
9215 /* Translate 'pastetoggle' into special key names */
|
|
9216 else if ((char_u **)opp->var == &p_pt)
|
|
9217 str2specialbuf(p_pt, NameBuff, MAXPATHL);
|
|
9218 else
|
|
9219 STRNCPY(NameBuff, varp, MAXPATHL);
|
|
9220 }
|
|
9221 }
|
|
9222
|
|
9223 /*
|
|
9224 * Return TRUE if "varp" points to 'wildchar' or 'wildcharm' and it can be
|
|
9225 * printed as a keyname.
|
|
9226 * "*wcp" is set to the value of the option if it's 'wildchar' or 'wildcharm'.
|
|
9227 */
|
|
9228 static int
|
|
9229 wc_use_keyname(varp, wcp)
|
|
9230 char_u *varp;
|
|
9231 long *wcp;
|
|
9232 {
|
|
9233 if (((long *)varp == &p_wc) || ((long *)varp == &p_wcm))
|
|
9234 {
|
|
9235 *wcp = *(long *)varp;
|
|
9236 if (IS_SPECIAL(*wcp) || find_special_key_in_table((int)*wcp) >= 0)
|
|
9237 return TRUE;
|
|
9238 }
|
|
9239 return FALSE;
|
|
9240 }
|
|
9241
|
|
9242 #ifdef FEAT_LANGMAP
|
|
9243 /*
|
|
9244 * Any character has an equivalent character. This is used for keyboards that
|
|
9245 * have a special language mode that sends characters above 128 (although
|
|
9246 * other characters can be translated too).
|
|
9247 */
|
|
9248
|
|
9249 /*
|
|
9250 * char_u langmap_mapchar[256];
|
|
9251 * Normally maps each of the 128 upper chars to an <128 ascii char; used to
|
|
9252 * "translate" native lang chars in normal mode or some cases of
|
|
9253 * insert mode without having to tediously switch lang mode back&forth.
|
|
9254 */
|
|
9255
|
|
9256 static void
|
|
9257 langmap_init()
|
|
9258 {
|
|
9259 int i;
|
|
9260
|
|
9261 for (i = 0; i < 256; i++) /* we init with a-one-to one map */
|
|
9262 langmap_mapchar[i] = i;
|
|
9263 }
|
|
9264
|
|
9265 /*
|
|
9266 * Called when langmap option is set; the language map can be
|
|
9267 * changed at any time!
|
|
9268 */
|
|
9269 static void
|
|
9270 langmap_set()
|
|
9271 {
|
|
9272 char_u *p;
|
|
9273 char_u *p2;
|
|
9274 int from, to;
|
|
9275
|
|
9276 langmap_init(); /* back to one-to-one map first */
|
|
9277
|
|
9278 for (p = p_langmap; p[0] != NUL; )
|
|
9279 {
|
39
|
9280 for (p2 = p; p2[0] != NUL && p2[0] != ',' && p2[0] != ';';
|
|
9281 mb_ptr_adv(p2))
|
7
|
9282 {
|
|
9283 if (p2[0] == '\\' && p2[1] != NUL)
|
|
9284 ++p2;
|
|
9285 }
|
|
9286 if (p2[0] == ';')
|
|
9287 ++p2; /* abcd;ABCD form, p2 points to A */
|
|
9288 else
|
|
9289 p2 = NULL; /* aAbBcCdD form, p2 is NULL */
|
|
9290 while (p[0])
|
|
9291 {
|
|
9292 if (p[0] == '\\' && p[1] != NUL)
|
|
9293 ++p;
|
|
9294 #ifdef FEAT_MBYTE
|
|
9295 from = (*mb_ptr2char)(p);
|
|
9296 #else
|
|
9297 from = p[0];
|
|
9298 #endif
|
|
9299 if (p2 == NULL)
|
|
9300 {
|
39
|
9301 mb_ptr_adv(p);
|
7
|
9302 if (p[0] == '\\')
|
|
9303 ++p;
|
|
9304 #ifdef FEAT_MBYTE
|
|
9305 to = (*mb_ptr2char)(p);
|
|
9306 #else
|
|
9307 to = p[0];
|
|
9308 #endif
|
|
9309 }
|
|
9310 else
|
|
9311 {
|
|
9312 if (p2[0] == '\\')
|
|
9313 ++p2;
|
|
9314 #ifdef FEAT_MBYTE
|
|
9315 to = (*mb_ptr2char)(p2);
|
|
9316 #else
|
|
9317 to = p2[0];
|
|
9318 #endif
|
|
9319 }
|
|
9320 if (to == NUL)
|
|
9321 {
|
|
9322 EMSG2(_("E357: 'langmap': Matching character missing for %s"),
|
|
9323 transchar(from));
|
|
9324 return;
|
|
9325 }
|
|
9326 langmap_mapchar[from & 255] = to;
|
|
9327
|
|
9328 /* Advance to next pair */
|
39
|
9329 mb_ptr_adv(p);
|
7
|
9330 if (p2 == NULL)
|
|
9331 {
|
|
9332 if (p[0] == ',')
|
|
9333 {
|
|
9334 ++p;
|
|
9335 break;
|
|
9336 }
|
|
9337 }
|
|
9338 else
|
|
9339 {
|
39
|
9340 mb_ptr_adv(p2);
|
7
|
9341 if (*p == ';')
|
|
9342 {
|
|
9343 p = p2;
|
|
9344 if (p[0] != NUL)
|
|
9345 {
|
|
9346 if (p[0] != ',')
|
|
9347 {
|
|
9348 EMSG2(_("E358: 'langmap': Extra characters after semicolon: %s"), p);
|
|
9349 return;
|
|
9350 }
|
|
9351 ++p;
|
|
9352 }
|
|
9353 break;
|
|
9354 }
|
|
9355 }
|
|
9356 }
|
|
9357 }
|
|
9358 }
|
|
9359 #endif
|
|
9360
|
|
9361 /*
|
|
9362 * Return TRUE if format option 'x' is in effect.
|
|
9363 * Take care of no formatting when 'paste' is set.
|
|
9364 */
|
|
9365 int
|
|
9366 has_format_option(x)
|
|
9367 int x;
|
|
9368 {
|
|
9369 if (p_paste)
|
|
9370 return FALSE;
|
|
9371 return (vim_strchr(curbuf->b_p_fo, x) != NULL);
|
|
9372 }
|
|
9373
|
|
9374 /*
|
|
9375 * Return TRUE if "x" is present in 'shortmess' option, or
|
|
9376 * 'shortmess' contains 'a' and "x" is present in SHM_A.
|
|
9377 */
|
|
9378 int
|
|
9379 shortmess(x)
|
|
9380 int x;
|
|
9381 {
|
|
9382 return ( vim_strchr(p_shm, x) != NULL
|
|
9383 || (vim_strchr(p_shm, 'a') != NULL
|
|
9384 && vim_strchr((char_u *)SHM_A, x) != NULL));
|
|
9385 }
|
|
9386
|
|
9387 /*
|
|
9388 * paste_option_changed() - Called after p_paste was set or reset.
|
|
9389 */
|
|
9390 static void
|
|
9391 paste_option_changed()
|
|
9392 {
|
|
9393 static int old_p_paste = FALSE;
|
|
9394 static int save_sm = 0;
|
|
9395 #ifdef FEAT_CMDL_INFO
|
|
9396 static int save_ru = 0;
|
|
9397 #endif
|
|
9398 #ifdef FEAT_RIGHTLEFT
|
|
9399 static int save_ri = 0;
|
|
9400 static int save_hkmap = 0;
|
|
9401 #endif
|
|
9402 buf_T *buf;
|
|
9403
|
|
9404 if (p_paste)
|
|
9405 {
|
|
9406 /*
|
|
9407 * Paste switched from off to on.
|
|
9408 * Save the current values, so they can be restored later.
|
|
9409 */
|
|
9410 if (!old_p_paste)
|
|
9411 {
|
|
9412 /* save options for each buffer */
|
|
9413 for (buf = firstbuf; buf != NULL; buf = buf->b_next)
|
|
9414 {
|
|
9415 buf->b_p_tw_nopaste = buf->b_p_tw;
|
|
9416 buf->b_p_wm_nopaste = buf->b_p_wm;
|
|
9417 buf->b_p_sts_nopaste = buf->b_p_sts;
|
|
9418 buf->b_p_ai_nopaste = buf->b_p_ai;
|
|
9419 }
|
|
9420
|
|
9421 /* save global options */
|
|
9422 save_sm = p_sm;
|
|
9423 #ifdef FEAT_CMDL_INFO
|
|
9424 save_ru = p_ru;
|
|
9425 #endif
|
|
9426 #ifdef FEAT_RIGHTLEFT
|
|
9427 save_ri = p_ri;
|
|
9428 save_hkmap = p_hkmap;
|
|
9429 #endif
|
|
9430 /* save global values for local buffer options */
|
|
9431 p_tw_nopaste = p_tw;
|
|
9432 p_wm_nopaste = p_wm;
|
|
9433 p_sts_nopaste = p_sts;
|
|
9434 p_ai_nopaste = p_ai;
|
|
9435 }
|
|
9436
|
|
9437 /*
|
|
9438 * Always set the option values, also when 'paste' is set when it is
|
|
9439 * already on.
|
|
9440 */
|
|
9441 /* set options for each buffer */
|
|
9442 for (buf = firstbuf; buf != NULL; buf = buf->b_next)
|
|
9443 {
|
|
9444 buf->b_p_tw = 0; /* textwidth is 0 */
|
|
9445 buf->b_p_wm = 0; /* wrapmargin is 0 */
|
|
9446 buf->b_p_sts = 0; /* softtabstop is 0 */
|
|
9447 buf->b_p_ai = 0; /* no auto-indent */
|
|
9448 }
|
|
9449
|
|
9450 /* set global options */
|
|
9451 p_sm = 0; /* no showmatch */
|
|
9452 #ifdef FEAT_CMDL_INFO
|
|
9453 # ifdef FEAT_WINDOWS
|
|
9454 if (p_ru)
|
|
9455 status_redraw_all(); /* redraw to remove the ruler */
|
|
9456 # endif
|
|
9457 p_ru = 0; /* no ruler */
|
|
9458 #endif
|
|
9459 #ifdef FEAT_RIGHTLEFT
|
|
9460 p_ri = 0; /* no reverse insert */
|
|
9461 p_hkmap = 0; /* no Hebrew keyboard */
|
|
9462 #endif
|
|
9463 /* set global values for local buffer options */
|
|
9464 p_tw = 0;
|
|
9465 p_wm = 0;
|
|
9466 p_sts = 0;
|
|
9467 p_ai = 0;
|
|
9468 }
|
|
9469
|
|
9470 /*
|
|
9471 * Paste switched from on to off: Restore saved values.
|
|
9472 */
|
|
9473 else if (old_p_paste)
|
|
9474 {
|
|
9475 /* restore options for each buffer */
|
|
9476 for (buf = firstbuf; buf != NULL; buf = buf->b_next)
|
|
9477 {
|
|
9478 buf->b_p_tw = buf->b_p_tw_nopaste;
|
|
9479 buf->b_p_wm = buf->b_p_wm_nopaste;
|
|
9480 buf->b_p_sts = buf->b_p_sts_nopaste;
|
|
9481 buf->b_p_ai = buf->b_p_ai_nopaste;
|
|
9482 }
|
|
9483
|
|
9484 /* restore global options */
|
|
9485 p_sm = save_sm;
|
|
9486 #ifdef FEAT_CMDL_INFO
|
|
9487 # ifdef FEAT_WINDOWS
|
|
9488 if (p_ru != save_ru)
|
|
9489 status_redraw_all(); /* redraw to draw the ruler */
|
|
9490 # endif
|
|
9491 p_ru = save_ru;
|
|
9492 #endif
|
|
9493 #ifdef FEAT_RIGHTLEFT
|
|
9494 p_ri = save_ri;
|
|
9495 p_hkmap = save_hkmap;
|
|
9496 #endif
|
|
9497 /* set global values for local buffer options */
|
|
9498 p_tw = p_tw_nopaste;
|
|
9499 p_wm = p_wm_nopaste;
|
|
9500 p_sts = p_sts_nopaste;
|
|
9501 p_ai = p_ai_nopaste;
|
|
9502 }
|
|
9503
|
|
9504 old_p_paste = p_paste;
|
|
9505 }
|
|
9506
|
|
9507 /*
|
|
9508 * vimrc_found() - Called when a ".vimrc" or "VIMINIT" has been found.
|
|
9509 *
|
|
9510 * Reset 'compatible' and set the values for options that didn't get set yet
|
|
9511 * to the Vim defaults.
|
|
9512 * Don't do this if the 'compatible' option has been set or reset before.
|
|
9513 */
|
|
9514 void
|
|
9515 vimrc_found()
|
|
9516 {
|
|
9517 int opt_idx;
|
|
9518
|
|
9519 if (!option_was_set((char_u *)"cp"))
|
|
9520 {
|
|
9521 p_cp = FALSE;
|
|
9522 for (opt_idx = 0; !istermoption(&options[opt_idx]); opt_idx++)
|
|
9523 if (!(options[opt_idx].flags & (P_WAS_SET|P_VI_DEF)))
|
|
9524 set_option_default(opt_idx, OPT_FREE, FALSE);
|
|
9525 didset_options();
|
|
9526 }
|
|
9527 }
|
|
9528
|
|
9529 /*
|
|
9530 * Set 'compatible' on or off. Called for "-C" and "-N" command line arg.
|
|
9531 */
|
|
9532 void
|
|
9533 change_compatible(on)
|
|
9534 int on;
|
|
9535 {
|
|
9536 if (p_cp != on)
|
|
9537 {
|
|
9538 p_cp = on;
|
|
9539 compatible_set();
|
|
9540 }
|
|
9541 options[findoption((char_u *)"cp")].flags |= P_WAS_SET;
|
|
9542 }
|
|
9543
|
|
9544 /*
|
|
9545 * Return TRUE when option "name" has been set.
|
|
9546 */
|
|
9547 int
|
|
9548 option_was_set(name)
|
|
9549 char_u *name;
|
|
9550 {
|
|
9551 int idx;
|
|
9552
|
|
9553 idx = findoption(name);
|
|
9554 if (idx < 0) /* unknown option */
|
|
9555 return FALSE;
|
|
9556 if (options[idx].flags & P_WAS_SET)
|
|
9557 return TRUE;
|
|
9558 return FALSE;
|
|
9559 }
|
|
9560
|
|
9561 /*
|
|
9562 * compatible_set() - Called when 'compatible' has been set or unset.
|
|
9563 *
|
|
9564 * When 'compatible' set: Set all relevant options (those that have the P_VIM)
|
|
9565 * flag) to a Vi compatible value.
|
|
9566 * When 'compatible' is unset: Set all options that have a different default
|
|
9567 * for Vim (without the P_VI_DEF flag) to that default.
|
|
9568 */
|
|
9569 static void
|
|
9570 compatible_set()
|
|
9571 {
|
|
9572 int opt_idx;
|
|
9573
|
|
9574 for (opt_idx = 0; !istermoption(&options[opt_idx]); opt_idx++)
|
|
9575 if ( ((options[opt_idx].flags & P_VIM) && p_cp)
|
|
9576 || (!(options[opt_idx].flags & P_VI_DEF) && !p_cp))
|
|
9577 set_option_default(opt_idx, OPT_FREE, p_cp);
|
|
9578 didset_options();
|
|
9579 }
|
|
9580
|
|
9581 #ifdef FEAT_LINEBREAK
|
|
9582
|
|
9583 # if defined(__BORLANDC__) && (__BORLANDC__ < 0x500)
|
|
9584 /* Borland C++ screws up loop optimisation here (negri) */
|
133
|
9585 #pragma option -O-l
|
7
|
9586 # endif
|
|
9587
|
|
9588 /*
|
|
9589 * fill_breakat_flags() -- called when 'breakat' changes value.
|
|
9590 */
|
|
9591 static void
|
|
9592 fill_breakat_flags()
|
|
9593 {
|
|
9594 char_u *c;
|
|
9595 int i;
|
|
9596
|
|
9597 for (i = 0; i < 256; i++)
|
|
9598 breakat_flags[i] = FALSE;
|
|
9599
|
|
9600 if (p_breakat != NULL)
|
|
9601 for (c = p_breakat; *c; c++)
|
|
9602 breakat_flags[*c] = TRUE;
|
|
9603 }
|
|
9604
|
|
9605 # if defined(__BORLANDC__) && (__BORLANDC__ < 0x500)
|
133
|
9606 #pragma option -O.l
|
7
|
9607 # endif
|
|
9608
|
|
9609 #endif
|
|
9610
|
|
9611 /*
|
|
9612 * Check an option that can be a range of string values.
|
|
9613 *
|
|
9614 * Return OK for correct value, FAIL otherwise.
|
|
9615 * Empty is always OK.
|
|
9616 */
|
|
9617 static int
|
|
9618 check_opt_strings(val, values, list)
|
|
9619 char_u *val;
|
|
9620 char **values;
|
|
9621 int list; /* when TRUE: accept a list of values */
|
|
9622 {
|
|
9623 return opt_strings_flags(val, values, NULL, list);
|
|
9624 }
|
|
9625
|
|
9626 /*
|
|
9627 * Handle an option that can be a range of string values.
|
|
9628 * Set a flag in "*flagp" for each string present.
|
|
9629 *
|
|
9630 * Return OK for correct value, FAIL otherwise.
|
|
9631 * Empty is always OK.
|
|
9632 */
|
|
9633 static int
|
|
9634 opt_strings_flags(val, values, flagp, list)
|
|
9635 char_u *val; /* new value */
|
|
9636 char **values; /* array of valid string values */
|
|
9637 unsigned *flagp;
|
|
9638 int list; /* when TRUE: accept a list of values */
|
|
9639 {
|
|
9640 int i;
|
|
9641 int len;
|
|
9642 unsigned new_flags = 0;
|
|
9643
|
|
9644 while (*val)
|
|
9645 {
|
|
9646 for (i = 0; ; ++i)
|
|
9647 {
|
|
9648 if (values[i] == NULL) /* val not found in values[] */
|
|
9649 return FAIL;
|
|
9650
|
|
9651 len = (int)STRLEN(values[i]);
|
|
9652 if (STRNCMP(values[i], val, len) == 0
|
|
9653 && ((list && val[len] == ',') || val[len] == NUL))
|
|
9654 {
|
|
9655 val += len + (val[len] == ',');
|
|
9656 new_flags |= (1 << i);
|
|
9657 break; /* check next item in val list */
|
|
9658 }
|
|
9659 }
|
|
9660 }
|
|
9661 if (flagp != NULL)
|
|
9662 *flagp = new_flags;
|
|
9663
|
|
9664 return OK;
|
|
9665 }
|
|
9666
|
|
9667 /*
|
|
9668 * Read the 'wildmode' option, fill wim_flags[].
|
|
9669 */
|
|
9670 static int
|
|
9671 check_opt_wim()
|
|
9672 {
|
|
9673 char_u new_wim_flags[4];
|
|
9674 char_u *p;
|
|
9675 int i;
|
|
9676 int idx = 0;
|
|
9677
|
|
9678 for (i = 0; i < 4; ++i)
|
|
9679 new_wim_flags[i] = 0;
|
|
9680
|
|
9681 for (p = p_wim; *p; ++p)
|
|
9682 {
|
|
9683 for (i = 0; ASCII_ISALPHA(p[i]); ++i)
|
|
9684 ;
|
|
9685 if (p[i] != NUL && p[i] != ',' && p[i] != ':')
|
|
9686 return FAIL;
|
|
9687 if (i == 7 && STRNCMP(p, "longest", 7) == 0)
|
|
9688 new_wim_flags[idx] |= WIM_LONGEST;
|
|
9689 else if (i == 4 && STRNCMP(p, "full", 4) == 0)
|
|
9690 new_wim_flags[idx] |= WIM_FULL;
|
|
9691 else if (i == 4 && STRNCMP(p, "list", 4) == 0)
|
|
9692 new_wim_flags[idx] |= WIM_LIST;
|
|
9693 else
|
|
9694 return FAIL;
|
|
9695 p += i;
|
|
9696 if (*p == NUL)
|
|
9697 break;
|
|
9698 if (*p == ',')
|
|
9699 {
|
|
9700 if (idx == 3)
|
|
9701 return FAIL;
|
|
9702 ++idx;
|
|
9703 }
|
|
9704 }
|
|
9705
|
|
9706 /* fill remaining entries with last flag */
|
|
9707 while (idx < 3)
|
|
9708 {
|
|
9709 new_wim_flags[idx + 1] = new_wim_flags[idx];
|
|
9710 ++idx;
|
|
9711 }
|
|
9712
|
|
9713 /* only when there are no errors, wim_flags[] is changed */
|
|
9714 for (i = 0; i < 4; ++i)
|
|
9715 wim_flags[i] = new_wim_flags[i];
|
|
9716 return OK;
|
|
9717 }
|
|
9718
|
|
9719 /*
|
|
9720 * Check if backspacing over something is allowed.
|
|
9721 */
|
|
9722 int
|
|
9723 can_bs(what)
|
|
9724 int what; /* BS_INDENT, BS_EOL or BS_START */
|
|
9725 {
|
|
9726 switch (*p_bs)
|
|
9727 {
|
|
9728 case '2': return TRUE;
|
|
9729 case '1': return (what != BS_START);
|
|
9730 case '0': return FALSE;
|
|
9731 }
|
|
9732 return vim_strchr(p_bs, what) != NULL;
|
|
9733 }
|
|
9734
|
|
9735 /*
|
|
9736 * Save the current values of 'fileformat' and 'fileencoding', so that we know
|
|
9737 * the file must be considered changed when the value is different.
|
|
9738 */
|
|
9739 void
|
|
9740 save_file_ff(buf)
|
|
9741 buf_T *buf;
|
|
9742 {
|
|
9743 buf->b_start_ffc = *buf->b_p_ff;
|
|
9744 buf->b_start_eol = buf->b_p_eol;
|
|
9745 #ifdef FEAT_MBYTE
|
|
9746 /* Only use free/alloc when necessary, they take time. */
|
|
9747 if (buf->b_start_fenc == NULL
|
|
9748 || STRCMP(buf->b_start_fenc, buf->b_p_fenc) != 0)
|
|
9749 {
|
|
9750 vim_free(buf->b_start_fenc);
|
|
9751 buf->b_start_fenc = vim_strsave(buf->b_p_fenc);
|
|
9752 }
|
|
9753 #endif
|
|
9754 }
|
|
9755
|
|
9756 /*
|
|
9757 * Return TRUE if 'fileformat' and/or 'fileencoding' has a different value
|
|
9758 * from when editing started (save_file_ff() called).
|
|
9759 * Also when 'endofline' was changed and 'binary' is set.
|
|
9760 * Don't consider a new, empty buffer to be changed.
|
|
9761 */
|
|
9762 int
|
|
9763 file_ff_differs(buf)
|
|
9764 buf_T *buf;
|
|
9765 {
|
|
9766 if ((buf->b_flags & BF_NEW)
|
|
9767 && buf->b_ml.ml_line_count == 1
|
|
9768 && *ml_get_buf(buf, (linenr_T)1, FALSE) == NUL)
|
|
9769 return FALSE;
|
|
9770 if (buf->b_start_ffc != *buf->b_p_ff)
|
|
9771 return TRUE;
|
|
9772 if (buf->b_p_bin && buf->b_start_eol != buf->b_p_eol)
|
|
9773 return TRUE;
|
|
9774 #ifdef FEAT_MBYTE
|
|
9775 if (buf->b_start_fenc == NULL)
|
|
9776 return (*buf->b_p_fenc != NUL);
|
|
9777 return (STRCMP(buf->b_start_fenc, buf->b_p_fenc) != 0);
|
|
9778 #else
|
|
9779 return FALSE;
|
|
9780 #endif
|
|
9781 }
|
|
9782
|
|
9783 /*
|
|
9784 * return OK if "p" is a valid fileformat name, FAIL otherwise.
|
|
9785 */
|
|
9786 int
|
|
9787 check_ff_value(p)
|
|
9788 char_u *p;
|
|
9789 {
|
|
9790 return check_opt_strings(p, p_ff_values, FALSE);
|
|
9791 }
|