Mercurial > vim
annotate src/option.c @ 2275:e4d849f4df03 vim73
Remove the old and not well supported GTK 1 code. (James Vega)
author | Bram Moolenaar <bram@vim.org> |
---|---|
date | Fri, 25 Jun 2010 05:37:59 +0200 |
parents | 2b33a7678e7b |
children | ccda151dde4e |
rev | line source |
---|---|
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. | |
692 | 41 * PV_WIN is added: window-local option |
42 * PV_BUF is added: buffer-local option | |
7 | 43 * PV_BOTH is added: global option which also has a local value. |
44 */ | |
45 #define PV_BOTH 0x1000 | |
692 | 46 #define PV_WIN 0x2000 |
47 #define PV_BUF 0x4000 | |
694 | 48 #define PV_MASK 0x0fff |
692 | 49 #define OPT_WIN(x) (idopt_T)(PV_WIN + (int)(x)) |
50 #define OPT_BUF(x) (idopt_T)(PV_BUF + (int)(x)) | |
7 | 51 #define OPT_BOTH(x) (idopt_T)(PV_BOTH + (int)(x)) |
52 | |
692 | 53 /* |
694 | 54 * Definition of the PV_ values for buffer-local options. |
55 * The BV_ values are defined in option.h. | |
692 | 56 */ |
57 #define PV_AI OPT_BUF(BV_AI) | |
58 #define PV_AR OPT_BOTH(OPT_BUF(BV_AR)) | |
694 | 59 #ifdef FEAT_QUICKFIX |
692 | 60 # define PV_BH OPT_BUF(BV_BH) |
694 | 61 # define PV_BT OPT_BUF(BV_BT) |
62 # define PV_EFM OPT_BOTH(OPT_BUF(BV_EFM)) | |
63 # define PV_GP OPT_BOTH(OPT_BUF(BV_GP)) | |
64 # define PV_MP OPT_BOTH(OPT_BUF(BV_MP)) | |
692 | 65 #endif |
66 #define PV_BIN OPT_BUF(BV_BIN) | |
67 #define PV_BL OPT_BUF(BV_BL) | |
694 | 68 #ifdef FEAT_MBYTE |
69 # define PV_BOMB OPT_BUF(BV_BOMB) | |
70 #endif | |
71 #define PV_CI OPT_BUF(BV_CI) | |
72 #ifdef FEAT_CINDENT | |
73 # define PV_CIN OPT_BUF(BV_CIN) | |
74 # define PV_CINK OPT_BUF(BV_CINK) | |
75 # define PV_CINO OPT_BUF(BV_CINO) | |
76 #endif | |
77 #if defined(FEAT_SMARTINDENT) || defined(FEAT_CINDENT) | |
78 # define PV_CINW OPT_BUF(BV_CINW) | |
79 #endif | |
2180
f60a0c9cbe6c
Add the blowfish encryption patch from Mohsin Ahmed. Needs more work.
Bram Moolenaar <bram@vim.org>
parents:
2178
diff
changeset
|
80 #define PV_CM OPT_BUF(BV_CM) |
694 | 81 #ifdef FEAT_FOLDING |
82 # define PV_CMS OPT_BUF(BV_CMS) | |
83 #endif | |
84 #ifdef FEAT_COMMENTS | |
85 # define PV_COM OPT_BUF(BV_COM) | |
86 #endif | |
87 #ifdef FEAT_INS_EXPAND | |
88 # define PV_CPT OPT_BUF(BV_CPT) | |
89 # define PV_DICT OPT_BOTH(OPT_BUF(BV_DICT)) | |
90 # define PV_TSR OPT_BOTH(OPT_BUF(BV_TSR)) | |
91 #endif | |
92 #ifdef FEAT_COMPL_FUNC | |
93 # define PV_CFU OPT_BUF(BV_CFU) | |
94 #endif | |
95 #ifdef FEAT_FIND_ID | |
96 # define PV_DEF OPT_BOTH(OPT_BUF(BV_DEF)) | |
97 # define PV_INC OPT_BOTH(OPT_BUF(BV_INC)) | |
98 #endif | |
99 #define PV_EOL OPT_BUF(BV_EOL) | |
100 #define PV_EP OPT_BOTH(OPT_BUF(BV_EP)) | |
101 #define PV_ET OPT_BUF(BV_ET) | |
102 #ifdef FEAT_MBYTE | |
103 # define PV_FENC OPT_BUF(BV_FENC) | |
104 #endif | |
790 | 105 #if defined(FEAT_BEVAL) && defined(FEAT_EVAL) |
106 # define PV_BEXPR OPT_BOTH(OPT_BUF(BV_BEXPR)) | |
107 #endif | |
694 | 108 #ifdef FEAT_EVAL |
109 # define PV_FEX OPT_BUF(BV_FEX) | |
110 #endif | |
111 #define PV_FF OPT_BUF(BV_FF) | |
112 #define PV_FLP OPT_BUF(BV_FLP) | |
113 #define PV_FO OPT_BUF(BV_FO) | |
114 #ifdef FEAT_AUTOCMD | |
115 # define PV_FT OPT_BUF(BV_FT) | |
116 #endif | |
117 #define PV_IMI OPT_BUF(BV_IMI) | |
118 #define PV_IMS OPT_BUF(BV_IMS) | |
119 #if defined(FEAT_CINDENT) && defined(FEAT_EVAL) | |
120 # define PV_INDE OPT_BUF(BV_INDE) | |
121 # define PV_INDK OPT_BUF(BV_INDK) | |
122 #endif | |
123 #if defined(FEAT_FIND_ID) && defined(FEAT_EVAL) | |
124 # define PV_INEX OPT_BUF(BV_INEX) | |
125 #endif | |
126 #define PV_INF OPT_BUF(BV_INF) | |
127 #define PV_ISK OPT_BUF(BV_ISK) | |
128 #ifdef FEAT_CRYPT | |
129 # define PV_KEY OPT_BUF(BV_KEY) | |
130 #endif | |
131 #ifdef FEAT_KEYMAP | |
132 # define PV_KMAP OPT_BUF(BV_KMAP) | |
133 #endif | |
134 #define PV_KP OPT_BOTH(OPT_BUF(BV_KP)) | |
135 #ifdef FEAT_LISP | |
136 # define PV_LISP OPT_BUF(BV_LISP) | |
137 #endif | |
138 #define PV_MA OPT_BUF(BV_MA) | |
139 #define PV_ML OPT_BUF(BV_ML) | |
140 #define PV_MOD OPT_BUF(BV_MOD) | |
141 #define PV_MPS OPT_BUF(BV_MPS) | |
142 #define PV_NF OPT_BUF(BV_NF) | |
143 #ifdef FEAT_OSFILETYPE | |
144 # define PV_OFT OPT_BUF(BV_OFT) | |
145 #endif | |
146 #ifdef FEAT_COMPL_FUNC | |
147 # define PV_OFU OPT_BUF(BV_OFU) | |
148 #endif | |
149 #define PV_PATH OPT_BOTH(OPT_BUF(BV_PATH)) | |
150 #define PV_PI OPT_BUF(BV_PI) | |
151 #ifdef FEAT_TEXTOBJ | |
152 # define PV_QE OPT_BUF(BV_QE) | |
153 #endif | |
154 #define PV_RO OPT_BUF(BV_RO) | |
155 #ifdef FEAT_SMARTINDENT | |
156 # define PV_SI OPT_BUF(BV_SI) | |
157 #endif | |
158 #ifndef SHORT_FNAME | |
159 # define PV_SN OPT_BUF(BV_SN) | |
160 #endif | |
161 #ifdef FEAT_SYN_HL | |
162 # define PV_SMC OPT_BUF(BV_SMC) | |
744 | 163 # define PV_SYN OPT_BUF(BV_SYN) |
164 #endif | |
165 #ifdef FEAT_SPELL | |
694 | 166 # define PV_SPC OPT_BUF(BV_SPC) |
167 # define PV_SPF OPT_BUF(BV_SPF) | |
168 # define PV_SPL OPT_BUF(BV_SPL) | |
169 #endif | |
170 #define PV_STS OPT_BUF(BV_STS) | |
171 #ifdef FEAT_SEARCHPATH | |
172 # define PV_SUA OPT_BUF(BV_SUA) | |
173 #endif | |
174 #define PV_SW OPT_BUF(BV_SW) | |
175 #define PV_SWF OPT_BUF(BV_SWF) | |
176 #define PV_TAGS OPT_BOTH(OPT_BUF(BV_TAGS)) | |
177 #define PV_TS OPT_BUF(BV_TS) | |
178 #define PV_TW OPT_BUF(BV_TW) | |
179 #define PV_TX OPT_BUF(BV_TX) | |
2214
f8222d1f9a73
Included patch for persistent undo. Lots of changes and added test.
Bram Moolenaar <bram@vim.org>
parents:
2184
diff
changeset
|
180 #ifdef FEAT_PERSISTENT_UNDO |
f8222d1f9a73
Included patch for persistent undo. Lots of changes and added test.
Bram Moolenaar <bram@vim.org>
parents:
2184
diff
changeset
|
181 # define PV_UDF OPT_BUF(BV_UDF) |
f8222d1f9a73
Included patch for persistent undo. Lots of changes and added test.
Bram Moolenaar <bram@vim.org>
parents:
2184
diff
changeset
|
182 #endif |
694 | 183 #define PV_WM OPT_BUF(BV_WM) |
692 | 184 |
185 /* | |
694 | 186 * Definition of the PV_ values for window-local options. |
187 * The WV_ values are defined in option.h. | |
692 | 188 */ |
189 #define PV_LIST OPT_WIN(WV_LIST) | |
190 #ifdef FEAT_ARABIC | |
191 # define PV_ARAB OPT_WIN(WV_ARAB) | |
192 #endif | |
694 | 193 #ifdef FEAT_DIFF |
194 # define PV_DIFF OPT_WIN(WV_DIFF) | |
195 #endif | |
196 #ifdef FEAT_FOLDING | |
197 # define PV_FDC OPT_WIN(WV_FDC) | |
198 # define PV_FEN OPT_WIN(WV_FEN) | |
199 # define PV_FDI OPT_WIN(WV_FDI) | |
200 # define PV_FDL OPT_WIN(WV_FDL) | |
201 # define PV_FDM OPT_WIN(WV_FDM) | |
202 # define PV_FML OPT_WIN(WV_FML) | |
203 # define PV_FDN OPT_WIN(WV_FDN) | |
204 # ifdef FEAT_EVAL | |
205 # define PV_FDE OPT_WIN(WV_FDE) | |
206 # define PV_FDT OPT_WIN(WV_FDT) | |
207 # endif | |
208 # define PV_FMR OPT_WIN(WV_FMR) | |
209 #endif | |
210 #ifdef FEAT_LINEBREAK | |
211 # define PV_LBR OPT_WIN(WV_LBR) | |
212 #endif | |
213 #define PV_NU OPT_WIN(WV_NU) | |
2178
c6f1aa1e9f32
Add 'relativenumber' patch from Markus Heidelberg.
Bram Moolenaar <bram@vim.org>
parents:
2144
diff
changeset
|
214 #define PV_RNU OPT_WIN(WV_RNU) |
694 | 215 #ifdef FEAT_LINEBREAK |
216 # define PV_NUW OPT_WIN(WV_NUW) | |
217 #endif | |
218 #if defined(FEAT_WINDOWS) && defined(FEAT_QUICKFIX) | |
219 # define PV_PVW OPT_WIN(WV_PVW) | |
220 #endif | |
221 #ifdef FEAT_RIGHTLEFT | |
222 # define PV_RL OPT_WIN(WV_RL) | |
223 # define PV_RLC OPT_WIN(WV_RLC) | |
224 #endif | |
225 #ifdef FEAT_SCROLLBIND | |
226 # define PV_SCBIND OPT_WIN(WV_SCBIND) | |
227 #endif | |
228 #define PV_SCROLL OPT_WIN(WV_SCROLL) | |
744 | 229 #ifdef FEAT_SPELL |
230 # define PV_SPELL OPT_WIN(WV_SPELL) | |
231 #endif | |
694 | 232 #ifdef FEAT_SYN_HL |
744 | 233 # define PV_CUC OPT_WIN(WV_CUC) |
234 # define PV_CUL OPT_WIN(WV_CUL) | |
694 | 235 #endif |
236 #ifdef FEAT_STL_OPT | |
237 # define PV_STL OPT_BOTH(OPT_WIN(WV_STL)) | |
238 #endif | |
239 #ifdef FEAT_WINDOWS | |
240 # define PV_WFH OPT_WIN(WV_WFH) | |
241 #endif | |
782 | 242 #ifdef FEAT_VERTSPLIT |
243 # define PV_WFW OPT_WIN(WV_WFW) | |
244 #endif | |
694 | 245 #define PV_WRAP OPT_WIN(WV_WRAP) |
2250
1bac28a53fae
Add the conceal patch from Vince Negri.
Bram Moolenaar <bram@vim.org>
parents:
2248
diff
changeset
|
246 #ifdef FEAT_CURSORBIND |
1bac28a53fae
Add the conceal patch from Vince Negri.
Bram Moolenaar <bram@vim.org>
parents:
2248
diff
changeset
|
247 # define PV_CRBIND OPT_WIN(WV_CRBIND) |
1bac28a53fae
Add the conceal patch from Vince Negri.
Bram Moolenaar <bram@vim.org>
parents:
2248
diff
changeset
|
248 #endif |
1bac28a53fae
Add the conceal patch from Vince Negri.
Bram Moolenaar <bram@vim.org>
parents:
2248
diff
changeset
|
249 #ifdef FEAT_CONCEAL |
1bac28a53fae
Add the conceal patch from Vince Negri.
Bram Moolenaar <bram@vim.org>
parents:
2248
diff
changeset
|
250 # define PV_CONCEAL OPT_WIN(WV_CONCEAL) |
1bac28a53fae
Add the conceal patch from Vince Negri.
Bram Moolenaar <bram@vim.org>
parents:
2248
diff
changeset
|
251 #endif |
694 | 252 |
253 /* WV_ and BV_ values get typecasted to this for the "indir" field */ | |
7 | 254 typedef enum |
255 { | |
1601 | 256 PV_NONE = 0, |
257 PV_MAXVAL = 0xffff /* to avoid warnings for value out of range */ | |
7 | 258 } idopt_T; |
259 | |
260 /* | |
261 * Options local to a window have a value local to a buffer and global to all | |
262 * buffers. Indicate this by setting "var" to VAR_WIN. | |
263 */ | |
264 #define VAR_WIN ((char_u *)-1) | |
265 | |
266 /* | |
790 | 267 * These are the global values for options which are also local to a buffer. |
7 | 268 * Only to be used in option.c! |
269 */ | |
270 static int p_ai; | |
271 static int p_bin; | |
272 #ifdef FEAT_MBYTE | |
273 static int p_bomb; | |
274 #endif | |
275 #if defined(FEAT_QUICKFIX) | |
276 static char_u *p_bh; | |
277 static char_u *p_bt; | |
278 #endif | |
279 static int p_bl; | |
280 static int p_ci; | |
281 #ifdef FEAT_CINDENT | |
282 static int p_cin; | |
283 static char_u *p_cink; | |
284 static char_u *p_cino; | |
285 #endif | |
286 #if defined(FEAT_SMARTINDENT) || defined(FEAT_CINDENT) | |
287 static char_u *p_cinw; | |
288 #endif | |
2184
5028c4d6d825
Fixed encryption big/little endian test.
Bram Moolenaar <bram@vim.org>
parents:
2180
diff
changeset
|
289 #ifdef FEAT_CRYPT |
2180
f60a0c9cbe6c
Add the blowfish encryption patch from Mohsin Ahmed. Needs more work.
Bram Moolenaar <bram@vim.org>
parents:
2178
diff
changeset
|
290 static long p_cm; |
2184
5028c4d6d825
Fixed encryption big/little endian test.
Bram Moolenaar <bram@vim.org>
parents:
2180
diff
changeset
|
291 #endif |
7 | 292 #ifdef FEAT_COMMENTS |
293 static char_u *p_com; | |
294 #endif | |
295 #ifdef FEAT_FOLDING | |
296 static char_u *p_cms; | |
297 #endif | |
298 #ifdef FEAT_INS_EXPAND | |
299 static char_u *p_cpt; | |
300 #endif | |
12 | 301 #ifdef FEAT_COMPL_FUNC |
302 static char_u *p_cfu; | |
502 | 303 static char_u *p_ofu; |
12 | 304 #endif |
7 | 305 static int p_eol; |
306 static int p_et; | |
307 #ifdef FEAT_MBYTE | |
308 static char_u *p_fenc; | |
309 #endif | |
310 static char_u *p_ff; | |
311 static char_u *p_fo; | |
41 | 312 static char_u *p_flp; |
7 | 313 #ifdef FEAT_AUTOCMD |
314 static char_u *p_ft; | |
315 #endif | |
316 static long p_iminsert; | |
317 static long p_imsearch; | |
318 #if defined(FEAT_FIND_ID) && defined(FEAT_EVAL) | |
319 static char_u *p_inex; | |
320 #endif | |
321 #if defined(FEAT_CINDENT) && defined(FEAT_EVAL) | |
322 static char_u *p_inde; | |
323 static char_u *p_indk; | |
324 #endif | |
667 | 325 #if defined(FEAT_EVAL) |
326 static char_u *p_fex; | |
327 #endif | |
7 | 328 static int p_inf; |
329 static char_u *p_isk; | |
330 #ifdef FEAT_CRYPT | |
331 static char_u *p_key; | |
332 #endif | |
333 #ifdef FEAT_LISP | |
334 static int p_lisp; | |
335 #endif | |
336 static int p_ml; | |
337 static int p_ma; | |
338 static int p_mod; | |
339 static char_u *p_mps; | |
340 static char_u *p_nf; | |
341 #ifdef FEAT_OSFILETYPE | |
342 static char_u *p_oft; | |
343 #endif | |
344 static int p_pi; | |
12 | 345 #ifdef FEAT_TEXTOBJ |
346 static char_u *p_qe; | |
347 #endif | |
7 | 348 static int p_ro; |
349 #ifdef FEAT_SMARTINDENT | |
350 static int p_si; | |
351 #endif | |
352 #ifndef SHORT_FNAME | |
353 static int p_sn; | |
354 #endif | |
355 static long p_sts; | |
356 #if defined(FEAT_SEARCHPATH) | |
357 static char_u *p_sua; | |
358 #endif | |
359 static long p_sw; | |
360 static int p_swf; | |
361 #ifdef FEAT_SYN_HL | |
410 | 362 static long p_smc; |
7 | 363 static char_u *p_syn; |
744 | 364 #endif |
365 #ifdef FEAT_SPELL | |
386 | 366 static char_u *p_spc; |
314 | 367 static char_u *p_spf; |
221 | 368 static char_u *p_spl; |
7 | 369 #endif |
370 static long p_ts; | |
371 static long p_tw; | |
372 static int p_tx; | |
2214
f8222d1f9a73
Included patch for persistent undo. Lots of changes and added test.
Bram Moolenaar <bram@vim.org>
parents:
2184
diff
changeset
|
373 #ifdef FEAT_PERSISTENT_UNDO |
f8222d1f9a73
Included patch for persistent undo. Lots of changes and added test.
Bram Moolenaar <bram@vim.org>
parents:
2184
diff
changeset
|
374 static int p_udf; |
f8222d1f9a73
Included patch for persistent undo. Lots of changes and added test.
Bram Moolenaar <bram@vim.org>
parents:
2184
diff
changeset
|
375 #endif |
7 | 376 static long p_wm; |
377 #ifdef FEAT_KEYMAP | |
378 static char_u *p_keymap; | |
379 #endif | |
380 | |
381 /* Saved values for when 'bin' is set. */ | |
382 static int p_et_nobin; | |
383 static int p_ml_nobin; | |
384 static long p_tw_nobin; | |
385 static long p_wm_nobin; | |
386 | |
387 /* Saved values for when 'paste' is set */ | |
388 static long p_tw_nopaste; | |
389 static long p_wm_nopaste; | |
390 static long p_sts_nopaste; | |
391 static int p_ai_nopaste; | |
392 | |
393 struct vimoption | |
394 { | |
395 char *fullname; /* full option name */ | |
396 char *shortname; /* permissible abbreviation */ | |
397 long_u flags; /* see below */ | |
398 char_u *var; /* global option: pointer to variable; | |
399 * window-local option: VAR_WIN; | |
400 * buffer-local option: global value */ | |
401 idopt_T indir; /* global option: PV_NONE; | |
402 * local option: indirect option index */ | |
403 char_u *def_val[2]; /* default values for variable (vi and vim) */ | |
404 #ifdef FEAT_EVAL | |
405 scid_T scriptID; /* script in which the option was last set */ | |
1883 | 406 # define SCRIPTID_INIT , 0 |
407 #else | |
408 # define SCRIPTID_INIT | |
7 | 409 #endif |
410 }; | |
411 | |
412 #define VI_DEFAULT 0 /* def_val[VI_DEFAULT] is Vi default value */ | |
413 #define VIM_DEFAULT 1 /* def_val[VIM_DEFAULT] is Vim default value */ | |
414 | |
415 /* | |
416 * Flags | |
417 */ | |
418 #define P_BOOL 0x01 /* the option is boolean */ | |
419 #define P_NUM 0x02 /* the option is numeric */ | |
420 #define P_STRING 0x04 /* the option is a string */ | |
421 #define P_ALLOCED 0x08 /* the string option is in allocated memory, | |
1941 | 422 must use free_string_option() when |
423 assigning new value. Not set if default is | |
424 the same. */ | |
7 | 425 #define P_EXPAND 0x10 /* environment expansion. NOTE: P_EXPAND can |
426 never be used for local or hidden options! */ | |
427 #define P_NODEFAULT 0x40 /* don't set to default value */ | |
428 #define P_DEF_ALLOCED 0x80 /* default value is in allocated memory, must | |
429 use vim_free() when assigning new value */ | |
430 #define P_WAS_SET 0x100 /* option has been set/reset */ | |
431 #define P_NO_MKRC 0x200 /* don't include in :mkvimrc output */ | |
432 #define P_VI_DEF 0x400 /* Use Vi default for Vim */ | |
433 #define P_VIM 0x800 /* Vim option, reset when 'cp' set */ | |
434 | |
435 /* when option changed, what to display: */ | |
436 #define P_RSTAT 0x1000 /* redraw status lines */ | |
437 #define P_RWIN 0x2000 /* redraw current window */ | |
438 #define P_RBUF 0x4000 /* redraw current buffer */ | |
439 #define P_RALL 0x6000 /* redraw all windows */ | |
440 #define P_RCLR 0x7000 /* clear and redraw all */ | |
441 | |
442 #define P_COMMA 0x8000 /* comma separated list */ | |
443 #define P_NODUP 0x10000L/* don't allow duplicate strings */ | |
444 #define P_FLAGLIST 0x20000L/* list of single-char flags */ | |
445 | |
446 #define P_SECURE 0x40000L/* cannot change in modeline or secure mode */ | |
447 #define P_GETTEXT 0x80000L/* expand default value with _() */ | |
448 #define P_NOGLOB 0x100000L/* do not use local value for global vimrc */ | |
36 | 449 #define P_NFNAME 0x200000L/* only normal file name chars allowed */ |
634 | 450 #define P_INSECURE 0x400000L/* option was set from a modeline */ |
1384 | 451 #define P_PRI_MKRC 0x800000L/* priority for :mkvimrc (setting option has |
452 side effects) */ | |
7 | 453 |
714 | 454 #define ISK_LATIN1 (char_u *)"@,48-57,_,192-255" |
455 | |
819 | 456 /* 'isprint' for latin1 is also used for MS-Windows cp1252, where 0x80 is used |
457 * for the currency sign. */ | |
719 | 458 #if defined(MSDOS) || defined(MSWIN) || defined(OS2) |
818 | 459 # define ISP_LATIN1 (char_u *)"@,~-255" |
719 | 460 #else |
461 # define ISP_LATIN1 (char_u *)"@,161-255" | |
462 #endif | |
463 | |
810 | 464 /* The 16 bit MS-DOS version is low on space, make the string as short as |
465 * possible when compiling with few features. */ | |
466 #if defined(FEAT_DIFF) || defined(FEAT_FOLDING) || defined(FEAT_SPELL) \ | |
467 || defined(FEAT_VERTSPLIT) || defined(FEAT_CLIPBOARD) \ | |
2250
1bac28a53fae
Add the conceal patch from Vince Negri.
Bram Moolenaar <bram@vim.org>
parents:
2248
diff
changeset
|
468 || defined(FEAT_INS_EXPAND) || defined(FEAT_SYN_HL) || defined(FEAT_CONCEAL) |
1bac28a53fae
Add the conceal patch from Vince Negri.
Bram Moolenaar <bram@vim.org>
parents:
2248
diff
changeset
|
469 # define HIGHLIGHT_INIT "8:SpecialKey,@:NonText,d:Directory,e:ErrorMsg,i:IncSearch,l:Search,m:MoreMsg,M:ModeMsg,n:LineNr,r:Question,s:StatusLine,S:StatusLineNC,c:VertSplit,t:Title,v:Visual,V:VisualNOS,w:WarningMsg,W:WildMenu,f:Folded,F:FoldColumn,A:DiffAdd,C:DiffChange,D:DiffDelete,T:DiffText,>:SignColumn,-:Conceal,B:SpellBad,P:SpellCap,R:SpellRare,L:SpellLocal,+:Pmenu,=:PmenuSel,x:PmenuSbar,X:PmenuThumb,*:TabLine,#:TabLineSel,_:TabLineFill,!:CursorColumn,.:CursorLine" |
810 | 470 #else |
471 # define HIGHLIGHT_INIT "8:SpecialKey,@:NonText,d:Directory,e:ErrorMsg,i:IncSearch,l:Search,m:MoreMsg,M:ModeMsg,n:LineNr,r:Question,s:StatusLine,S:StatusLineNC,t:Title,v:Visual,w:WarningMsg,W:WildMenu,>:SignColumn,*:TabLine,#:TabLineSel,_:TabLineFill" | |
472 #endif | |
473 | |
7 | 474 /* |
475 * options[] is initialized here. | |
476 * The order of the options MUST be alphabetic for ":set all" and findoption(). | |
477 * All option names MUST start with a lowercase letter (for findoption()). | |
478 * Exception: "t_" options are at the end. | |
479 * The options with a NULL variable are 'hidden': a set command for them is | |
480 * ignored and they are not printed. | |
481 */ | |
482 static struct vimoption | |
483 #ifdef FEAT_GUI_W16 | |
484 _far | |
485 #endif | |
486 options[] = | |
487 { | |
488 {"aleph", "al", P_NUM|P_VI_DEF, | |
489 #ifdef FEAT_RIGHTLEFT | |
490 (char_u *)&p_aleph, PV_NONE, | |
491 #else | |
492 (char_u *)NULL, PV_NONE, | |
493 #endif | |
494 { | |
495 #if (defined(MSDOS) || defined(WIN3264) || defined(OS2)) && !defined(FEAT_GUI_W32) | |
496 (char_u *)128L, | |
497 #else | |
498 (char_u *)224L, | |
499 #endif | |
1883 | 500 (char_u *)0L} SCRIPTID_INIT}, |
7 | 501 {"antialias", "anti", P_BOOL|P_VI_DEF|P_VIM|P_RCLR, |
502 #if defined(FEAT_GUI) && defined(MACOS_X) | |
503 (char_u *)&p_antialias, PV_NONE, | |
504 {(char_u *)FALSE, (char_u *)FALSE} | |
505 #else | |
506 (char_u *)NULL, PV_NONE, | |
507 {(char_u *)FALSE, (char_u *)FALSE} | |
508 #endif | |
1883 | 509 SCRIPTID_INIT}, |
7 | 510 {"arabic", "arab", P_BOOL|P_VI_DEF|P_VIM, |
511 #ifdef FEAT_ARABIC | |
512 (char_u *)VAR_WIN, PV_ARAB, | |
513 #else | |
514 (char_u *)NULL, PV_NONE, | |
515 #endif | |
1883 | 516 {(char_u *)FALSE, (char_u *)0L} SCRIPTID_INIT}, |
7 | 517 {"arabicshape", "arshape", P_BOOL|P_VI_DEF|P_VIM|P_RCLR, |
518 #ifdef FEAT_ARABIC | |
519 (char_u *)&p_arshape, PV_NONE, | |
520 #else | |
521 (char_u *)NULL, PV_NONE, | |
522 #endif | |
1883 | 523 {(char_u *)TRUE, (char_u *)0L} SCRIPTID_INIT}, |
7 | 524 {"allowrevins", "ari", P_BOOL|P_VI_DEF|P_VIM, |
525 #ifdef FEAT_RIGHTLEFT | |
526 (char_u *)&p_ari, PV_NONE, | |
527 #else | |
528 (char_u *)NULL, PV_NONE, | |
529 #endif | |
1883 | 530 {(char_u *)FALSE, (char_u *)0L} SCRIPTID_INIT}, |
7 | 531 {"altkeymap", "akm", P_BOOL|P_VI_DEF, |
532 #ifdef FEAT_FKMAP | |
533 (char_u *)&p_altkeymap, PV_NONE, | |
534 #else | |
535 (char_u *)NULL, PV_NONE, | |
536 #endif | |
1883 | 537 {(char_u *)FALSE, (char_u *)0L} SCRIPTID_INIT}, |
7 | 538 {"ambiwidth", "ambw", P_STRING|P_VI_DEF|P_RCLR, |
539 #if defined(FEAT_MBYTE) | |
540 (char_u *)&p_ambw, PV_NONE, | |
541 {(char_u *)"single", (char_u *)0L} | |
542 #else | |
543 (char_u *)NULL, PV_NONE, | |
544 {(char_u *)0L, (char_u *)0L} | |
545 #endif | |
1883 | 546 SCRIPTID_INIT}, |
820 | 547 #ifdef FEAT_AUTOCHDIR |
7 | 548 {"autochdir", "acd", P_BOOL|P_VI_DEF, |
549 (char_u *)&p_acd, PV_NONE, | |
1883 | 550 {(char_u *)FALSE, (char_u *)0L} SCRIPTID_INIT}, |
7 | 551 #endif |
552 {"autoindent", "ai", P_BOOL|P_VI_DEF, | |
553 (char_u *)&p_ai, PV_AI, | |
1883 | 554 {(char_u *)FALSE, (char_u *)0L} SCRIPTID_INIT}, |
7 | 555 {"autoprint", "ap", P_BOOL|P_VI_DEF, |
556 (char_u *)NULL, PV_NONE, | |
1883 | 557 {(char_u *)FALSE, (char_u *)0L} SCRIPTID_INIT}, |
7 | 558 {"autoread", "ar", P_BOOL|P_VI_DEF, |
692 | 559 (char_u *)&p_ar, PV_AR, |
1883 | 560 {(char_u *)FALSE, (char_u *)0L} SCRIPTID_INIT}, |
7 | 561 {"autowrite", "aw", P_BOOL|P_VI_DEF, |
562 (char_u *)&p_aw, PV_NONE, | |
1883 | 563 {(char_u *)FALSE, (char_u *)0L} SCRIPTID_INIT}, |
7 | 564 {"autowriteall","awa", P_BOOL|P_VI_DEF, |
565 (char_u *)&p_awa, PV_NONE, | |
1883 | 566 {(char_u *)FALSE, (char_u *)0L} SCRIPTID_INIT}, |
7 | 567 {"background", "bg", P_STRING|P_VI_DEF|P_RCLR, |
568 (char_u *)&p_bg, PV_NONE, | |
569 { | |
570 #if (defined(MSDOS) || defined(OS2) || defined(WIN3264)) && !defined(FEAT_GUI) | |
571 (char_u *)"dark", | |
572 #else | |
573 (char_u *)"light", | |
574 #endif | |
1883 | 575 (char_u *)0L} SCRIPTID_INIT}, |
7 | 576 {"backspace", "bs", P_STRING|P_VI_DEF|P_VIM|P_COMMA|P_NODUP, |
577 (char_u *)&p_bs, PV_NONE, | |
1883 | 578 {(char_u *)"", (char_u *)0L} SCRIPTID_INIT}, |
7 | 579 {"backup", "bk", P_BOOL|P_VI_DEF|P_VIM, |
580 (char_u *)&p_bk, PV_NONE, | |
1883 | 581 {(char_u *)FALSE, (char_u *)0L} SCRIPTID_INIT}, |
7 | 582 {"backupcopy", "bkc", P_STRING|P_VIM|P_COMMA|P_NODUP, |
583 (char_u *)&p_bkc, PV_NONE, | |
584 #ifdef UNIX | |
585 {(char_u *)"yes", (char_u *)"auto"} | |
586 #else | |
587 {(char_u *)"auto", (char_u *)"auto"} | |
588 #endif | |
1883 | 589 SCRIPTID_INIT}, |
7 | 590 {"backupdir", "bdir", P_STRING|P_EXPAND|P_VI_DEF|P_COMMA|P_NODUP|P_SECURE, |
591 (char_u *)&p_bdir, PV_NONE, | |
1883 | 592 {(char_u *)DFLT_BDIR, (char_u *)0L} SCRIPTID_INIT}, |
36 | 593 {"backupext", "bex", P_STRING|P_VI_DEF|P_NFNAME, |
7 | 594 (char_u *)&p_bex, PV_NONE, |
595 { | |
596 #ifdef VMS | |
597 (char_u *)"_", | |
598 #else | |
599 (char_u *)"~", | |
600 #endif | |
1883 | 601 (char_u *)0L} SCRIPTID_INIT}, |
7 | 602 {"backupskip", "bsk", P_STRING|P_VI_DEF|P_COMMA, |
603 #ifdef FEAT_WILDIGN | |
604 (char_u *)&p_bsk, PV_NONE, | |
605 {(char_u *)"", (char_u *)0L} | |
606 #else | |
607 (char_u *)NULL, PV_NONE, | |
608 {(char_u *)0L, (char_u *)0L} | |
609 #endif | |
1883 | 610 SCRIPTID_INIT}, |
7 | 611 #ifdef FEAT_BEVAL |
612 {"balloondelay","bdlay",P_NUM|P_VI_DEF, | |
613 (char_u *)&p_bdlay, PV_NONE, | |
1883 | 614 {(char_u *)600L, (char_u *)0L} SCRIPTID_INIT}, |
7 | 615 {"ballooneval", "beval",P_BOOL|P_VI_DEF|P_NO_MKRC, |
616 (char_u *)&p_beval, PV_NONE, | |
1883 | 617 {(char_u *)FALSE, (char_u *)0L} SCRIPTID_INIT}, |
190 | 618 # ifdef FEAT_EVAL |
786 | 619 {"balloonexpr", "bexpr", P_STRING|P_ALLOCED|P_VI_DEF|P_VIM, |
790 | 620 (char_u *)&p_bexpr, PV_BEXPR, |
1883 | 621 {(char_u *)"", (char_u *)0L} SCRIPTID_INIT}, |
190 | 622 # endif |
7 | 623 #endif |
624 {"beautify", "bf", P_BOOL|P_VI_DEF, | |
625 (char_u *)NULL, PV_NONE, | |
1883 | 626 {(char_u *)FALSE, (char_u *)0L} SCRIPTID_INIT}, |
7 | 627 {"binary", "bin", P_BOOL|P_VI_DEF|P_RSTAT, |
628 (char_u *)&p_bin, PV_BIN, | |
1883 | 629 {(char_u *)FALSE, (char_u *)0L} SCRIPTID_INIT}, |
7 | 630 {"bioskey", "biosk",P_BOOL|P_VI_DEF, |
631 #ifdef MSDOS | |
632 (char_u *)&p_biosk, PV_NONE, | |
633 #else | |
634 (char_u *)NULL, PV_NONE, | |
635 #endif | |
1883 | 636 {(char_u *)TRUE, (char_u *)0L} SCRIPTID_INIT}, |
7 | 637 {"bomb", NULL, P_BOOL|P_NO_MKRC|P_VI_DEF|P_RSTAT, |
638 #ifdef FEAT_MBYTE | |
639 (char_u *)&p_bomb, PV_BOMB, | |
640 #else | |
641 (char_u *)NULL, PV_NONE, | |
642 #endif | |
1883 | 643 {(char_u *)FALSE, (char_u *)0L} SCRIPTID_INIT}, |
7 | 644 {"breakat", "brk", P_STRING|P_VI_DEF|P_RALL|P_FLAGLIST, |
645 #ifdef FEAT_LINEBREAK | |
646 (char_u *)&p_breakat, PV_NONE, | |
647 {(char_u *)" \t!@*-+;:,./?", (char_u *)0L} | |
648 #else | |
649 (char_u *)NULL, PV_NONE, | |
650 {(char_u *)0L, (char_u *)0L} | |
651 #endif | |
1883 | 652 SCRIPTID_INIT}, |
7 | 653 {"browsedir", "bsdir",P_STRING|P_VI_DEF, |
654 #ifdef FEAT_BROWSE | |
655 (char_u *)&p_bsdir, PV_NONE, | |
656 {(char_u *)"last", (char_u *)0L} | |
657 #else | |
658 (char_u *)NULL, PV_NONE, | |
659 {(char_u *)0L, (char_u *)0L} | |
660 #endif | |
1883 | 661 SCRIPTID_INIT}, |
7 | 662 {"bufhidden", "bh", P_STRING|P_ALLOCED|P_VI_DEF|P_NOGLOB, |
663 #if defined(FEAT_QUICKFIX) | |
664 (char_u *)&p_bh, PV_BH, | |
665 {(char_u *)"", (char_u *)0L} | |
666 #else | |
667 (char_u *)NULL, PV_NONE, | |
668 {(char_u *)0L, (char_u *)0L} | |
669 #endif | |
1883 | 670 SCRIPTID_INIT}, |
7 | 671 {"buflisted", "bl", P_BOOL|P_VI_DEF|P_NOGLOB, |
672 (char_u *)&p_bl, PV_BL, | |
673 {(char_u *)1L, (char_u *)0L} | |
1883 | 674 SCRIPTID_INIT}, |
7 | 675 {"buftype", "bt", P_STRING|P_ALLOCED|P_VI_DEF|P_NOGLOB, |
676 #if defined(FEAT_QUICKFIX) | |
677 (char_u *)&p_bt, PV_BT, | |
678 {(char_u *)"", (char_u *)0L} | |
679 #else | |
680 (char_u *)NULL, PV_NONE, | |
681 {(char_u *)0L, (char_u *)0L} | |
682 #endif | |
1883 | 683 SCRIPTID_INIT}, |
7 | 684 {"casemap", "cmp", P_STRING|P_VI_DEF|P_COMMA|P_NODUP, |
805 | 685 #ifdef FEAT_MBYTE |
7 | 686 (char_u *)&p_cmp, PV_NONE, |
687 {(char_u *)"internal,keepascii", (char_u *)0L} | |
805 | 688 #else |
689 (char_u *)NULL, PV_NONE, | |
690 {(char_u *)0L, (char_u *)0L} | |
691 #endif | |
1883 | 692 SCRIPTID_INIT}, |
7 | 693 {"cdpath", "cd", P_STRING|P_EXPAND|P_VI_DEF|P_COMMA|P_NODUP, |
694 #ifdef FEAT_SEARCHPATH | |
695 (char_u *)&p_cdpath, PV_NONE, | |
696 {(char_u *)",,", (char_u *)0L} | |
697 #else | |
698 (char_u *)NULL, PV_NONE, | |
699 {(char_u *)0L, (char_u *)0L} | |
700 #endif | |
1883 | 701 SCRIPTID_INIT}, |
7 | 702 {"cedit", NULL, P_STRING, |
703 #ifdef FEAT_CMDWIN | |
704 (char_u *)&p_cedit, PV_NONE, | |
705 {(char_u *)"", (char_u *)CTRL_F_STR} | |
706 #else | |
707 (char_u *)NULL, PV_NONE, | |
708 {(char_u *)0L, (char_u *)0L} | |
709 #endif | |
1883 | 710 SCRIPTID_INIT}, |
7 | 711 {"charconvert", "ccv", P_STRING|P_VI_DEF|P_SECURE, |
712 #if defined(FEAT_MBYTE) && defined(FEAT_EVAL) | |
713 (char_u *)&p_ccv, PV_NONE, | |
714 {(char_u *)"", (char_u *)0L} | |
715 #else | |
716 (char_u *)NULL, PV_NONE, | |
717 {(char_u *)0L, (char_u *)0L} | |
718 #endif | |
1883 | 719 SCRIPTID_INIT}, |
7 | 720 {"cindent", "cin", P_BOOL|P_VI_DEF|P_VIM, |
721 #ifdef FEAT_CINDENT | |
722 (char_u *)&p_cin, PV_CIN, | |
723 #else | |
724 (char_u *)NULL, PV_NONE, | |
725 #endif | |
1883 | 726 {(char_u *)FALSE, (char_u *)0L} SCRIPTID_INIT}, |
7 | 727 {"cinkeys", "cink", P_STRING|P_ALLOCED|P_VI_DEF|P_COMMA|P_NODUP, |
728 #ifdef FEAT_CINDENT | |
729 (char_u *)&p_cink, PV_CINK, | |
730 {(char_u *)"0{,0},0),:,0#,!^F,o,O,e", (char_u *)0L} | |
731 #else | |
732 (char_u *)NULL, PV_NONE, | |
733 {(char_u *)0L, (char_u *)0L} | |
734 #endif | |
1883 | 735 SCRIPTID_INIT}, |
7 | 736 {"cinoptions", "cino", P_STRING|P_ALLOCED|P_VI_DEF|P_COMMA|P_NODUP, |
737 #ifdef FEAT_CINDENT | |
738 (char_u *)&p_cino, PV_CINO, | |
739 #else | |
740 (char_u *)NULL, PV_NONE, | |
741 #endif | |
1883 | 742 {(char_u *)"", (char_u *)0L} SCRIPTID_INIT}, |
7 | 743 {"cinwords", "cinw", P_STRING|P_ALLOCED|P_VI_DEF|P_COMMA|P_NODUP, |
744 #if defined(FEAT_SMARTINDENT) || defined(FEAT_CINDENT) | |
745 (char_u *)&p_cinw, PV_CINW, | |
746 {(char_u *)"if,else,while,do,for,switch", | |
747 (char_u *)0L} | |
748 #else | |
749 (char_u *)NULL, PV_NONE, | |
750 {(char_u *)0L, (char_u *)0L} | |
751 #endif | |
1883 | 752 SCRIPTID_INIT}, |
7 | 753 {"clipboard", "cb", P_STRING|P_VI_DEF|P_COMMA|P_NODUP, |
754 #ifdef FEAT_CLIPBOARD | |
755 (char_u *)&p_cb, PV_NONE, | |
756 # ifdef FEAT_XCLIPBOARD | |
757 {(char_u *)"autoselect,exclude:cons\\|linux", | |
758 (char_u *)0L} | |
759 # else | |
760 {(char_u *)"", (char_u *)0L} | |
761 # endif | |
762 #else | |
763 (char_u *)NULL, PV_NONE, | |
764 {(char_u *)"", (char_u *)0L} | |
765 #endif | |
1883 | 766 SCRIPTID_INIT}, |
7 | 767 {"cmdheight", "ch", P_NUM|P_VI_DEF|P_RALL, |
768 (char_u *)&p_ch, PV_NONE, | |
1883 | 769 {(char_u *)1L, (char_u *)0L} SCRIPTID_INIT}, |
7 | 770 {"cmdwinheight", "cwh", P_NUM|P_VI_DEF, |
771 #ifdef FEAT_CMDWIN | |
772 (char_u *)&p_cwh, PV_NONE, | |
773 #else | |
774 (char_u *)NULL, PV_NONE, | |
775 #endif | |
1883 | 776 {(char_u *)7L, (char_u *)0L} SCRIPTID_INIT}, |
7 | 777 {"columns", "co", P_NUM|P_NODEFAULT|P_NO_MKRC|P_VI_DEF|P_RCLR, |
778 (char_u *)&Columns, PV_NONE, | |
1883 | 779 {(char_u *)80L, (char_u *)0L} SCRIPTID_INIT}, |
7 | 780 {"comments", "com", P_STRING|P_ALLOCED|P_VI_DEF|P_COMMA|P_NODUP, |
781 #ifdef FEAT_COMMENTS | |
782 (char_u *)&p_com, PV_COM, | |
783 {(char_u *)"s1:/*,mb:*,ex:*/,://,b:#,:%,:XCOMM,n:>,fb:-", | |
784 (char_u *)0L} | |
785 #else | |
786 (char_u *)NULL, PV_NONE, | |
787 {(char_u *)0L, (char_u *)0L} | |
788 #endif | |
1883 | 789 SCRIPTID_INIT}, |
7 | 790 {"commentstring", "cms", P_STRING|P_ALLOCED|P_VI_DEF, |
791 #ifdef FEAT_FOLDING | |
792 (char_u *)&p_cms, PV_CMS, | |
793 {(char_u *)"/*%s*/", (char_u *)0L} | |
794 #else | |
795 (char_u *)NULL, PV_NONE, | |
796 {(char_u *)0L, (char_u *)0L} | |
797 #endif | |
1883 | 798 SCRIPTID_INIT}, |
1384 | 799 /* P_PRI_MKRC isn't needed here, optval_default() |
800 * always returns TRUE for 'compatible' */ | |
7 | 801 {"compatible", "cp", P_BOOL|P_RALL, |
802 (char_u *)&p_cp, PV_NONE, | |
1883 | 803 {(char_u *)TRUE, (char_u *)FALSE} SCRIPTID_INIT}, |
7 | 804 {"complete", "cpt", P_STRING|P_ALLOCED|P_VI_DEF|P_COMMA|P_NODUP, |
805 #ifdef FEAT_INS_EXPAND | |
806 (char_u *)&p_cpt, PV_CPT, | |
807 {(char_u *)".,w,b,u,t,i", (char_u *)0L} | |
808 #else | |
809 (char_u *)NULL, PV_NONE, | |
810 {(char_u *)0L, (char_u *)0L} | |
811 #endif | |
1883 | 812 SCRIPTID_INIT}, |
2250
1bac28a53fae
Add the conceal patch from Vince Negri.
Bram Moolenaar <bram@vim.org>
parents:
2248
diff
changeset
|
813 {"conceallevel","conc", P_NUM|P_RWIN|P_VI_DEF, |
1bac28a53fae
Add the conceal patch from Vince Negri.
Bram Moolenaar <bram@vim.org>
parents:
2248
diff
changeset
|
814 #ifdef FEAT_CONCEAL |
1bac28a53fae
Add the conceal patch from Vince Negri.
Bram Moolenaar <bram@vim.org>
parents:
2248
diff
changeset
|
815 (char_u *)VAR_WIN, PV_CONCEAL, |
1bac28a53fae
Add the conceal patch from Vince Negri.
Bram Moolenaar <bram@vim.org>
parents:
2248
diff
changeset
|
816 #else |
1bac28a53fae
Add the conceal patch from Vince Negri.
Bram Moolenaar <bram@vim.org>
parents:
2248
diff
changeset
|
817 (char_u *)NULL, PV_NONE, |
1bac28a53fae
Add the conceal patch from Vince Negri.
Bram Moolenaar <bram@vim.org>
parents:
2248
diff
changeset
|
818 #endif |
1bac28a53fae
Add the conceal patch from Vince Negri.
Bram Moolenaar <bram@vim.org>
parents:
2248
diff
changeset
|
819 {(char_u *)0L, (char_u *)0L} |
1bac28a53fae
Add the conceal patch from Vince Negri.
Bram Moolenaar <bram@vim.org>
parents:
2248
diff
changeset
|
820 SCRIPTID_INIT}, |
12 | 821 {"completefunc", "cfu", P_STRING|P_ALLOCED|P_VI_DEF|P_SECURE, |
822 #ifdef FEAT_COMPL_FUNC | |
823 (char_u *)&p_cfu, PV_CFU, | |
824 {(char_u *)"", (char_u *)0L} | |
825 #else | |
826 (char_u *)NULL, PV_NONE, | |
827 {(char_u *)0L, (char_u *)0L} | |
828 #endif | |
1883 | 829 SCRIPTID_INIT}, |
540 | 830 {"completeopt", "cot", P_STRING|P_VI_DEF|P_COMMA|P_NODUP, |
831 #ifdef FEAT_INS_EXPAND | |
832 (char_u *)&p_cot, PV_NONE, | |
731 | 833 {(char_u *)"menu,preview", (char_u *)0L} |
540 | 834 #else |
835 (char_u *)NULL, PV_NONE, | |
836 {(char_u *)0L, (char_u *)0L} | |
837 #endif | |
1883 | 838 SCRIPTID_INIT}, |
7 | 839 {"confirm", "cf", P_BOOL|P_VI_DEF, |
840 #if defined(FEAT_GUI_DIALOG) || defined(FEAT_CON_DIALOG) | |
841 (char_u *)&p_confirm, PV_NONE, | |
842 #else | |
843 (char_u *)NULL, PV_NONE, | |
844 #endif | |
1883 | 845 {(char_u *)FALSE, (char_u *)0L} SCRIPTID_INIT}, |
7 | 846 {"conskey", "consk",P_BOOL|P_VI_DEF, |
847 #ifdef MSDOS | |
848 (char_u *)&p_consk, PV_NONE, | |
849 #else | |
850 (char_u *)NULL, PV_NONE, | |
851 #endif | |
1883 | 852 {(char_u *)FALSE, (char_u *)0L} SCRIPTID_INIT}, |
7 | 853 {"copyindent", "ci", P_BOOL|P_VI_DEF|P_VIM, |
854 (char_u *)&p_ci, PV_CI, | |
1883 | 855 {(char_u *)FALSE, (char_u *)0L} SCRIPTID_INIT}, |
7 | 856 {"cpoptions", "cpo", P_STRING|P_VIM|P_RALL|P_FLAGLIST, |
857 (char_u *)&p_cpo, PV_NONE, | |
1883 | 858 {(char_u *)CPO_VI, (char_u *)CPO_VIM} |
859 SCRIPTID_INIT}, | |
2180
f60a0c9cbe6c
Add the blowfish encryption patch from Mohsin Ahmed. Needs more work.
Bram Moolenaar <bram@vim.org>
parents:
2178
diff
changeset
|
860 {"cryptmethod", "cm", P_NUM|P_VI_DEF|P_VIM, |
2184
5028c4d6d825
Fixed encryption big/little endian test.
Bram Moolenaar <bram@vim.org>
parents:
2180
diff
changeset
|
861 #ifdef FEAT_CRYPT |
2180
f60a0c9cbe6c
Add the blowfish encryption patch from Mohsin Ahmed. Needs more work.
Bram Moolenaar <bram@vim.org>
parents:
2178
diff
changeset
|
862 (char_u *)&p_cm, PV_CM, |
2184
5028c4d6d825
Fixed encryption big/little endian test.
Bram Moolenaar <bram@vim.org>
parents:
2180
diff
changeset
|
863 #else |
5028c4d6d825
Fixed encryption big/little endian test.
Bram Moolenaar <bram@vim.org>
parents:
2180
diff
changeset
|
864 (char_u *)NULL, PV_NONE, |
5028c4d6d825
Fixed encryption big/little endian test.
Bram Moolenaar <bram@vim.org>
parents:
2180
diff
changeset
|
865 #endif |
2180
f60a0c9cbe6c
Add the blowfish encryption patch from Mohsin Ahmed. Needs more work.
Bram Moolenaar <bram@vim.org>
parents:
2178
diff
changeset
|
866 {(char_u *)0L, (char_u *)0L} SCRIPTID_INIT}, |
7 | 867 {"cscopepathcomp", "cspc", P_NUM|P_VI_DEF|P_VIM, |
868 #ifdef FEAT_CSCOPE | |
869 (char_u *)&p_cspc, PV_NONE, | |
870 #else | |
871 (char_u *)NULL, PV_NONE, | |
872 #endif | |
1883 | 873 {(char_u *)0L, (char_u *)0L} SCRIPTID_INIT}, |
7 | 874 {"cscopeprg", "csprg", P_STRING|P_EXPAND|P_VI_DEF|P_SECURE, |
875 #ifdef FEAT_CSCOPE | |
876 (char_u *)&p_csprg, PV_NONE, | |
877 {(char_u *)"cscope", (char_u *)0L} | |
878 #else | |
879 (char_u *)NULL, PV_NONE, | |
880 {(char_u *)0L, (char_u *)0L} | |
881 #endif | |
1883 | 882 SCRIPTID_INIT}, |
7 | 883 {"cscopequickfix", "csqf", P_STRING|P_VI_DEF|P_COMMA|P_NODUP, |
884 #if defined(FEAT_CSCOPE) && defined(FEAT_QUICKFIX) | |
885 (char_u *)&p_csqf, PV_NONE, | |
886 {(char_u *)"", (char_u *)0L} | |
887 #else | |
888 (char_u *)NULL, PV_NONE, | |
889 {(char_u *)0L, (char_u *)0L} | |
890 #endif | |
1883 | 891 SCRIPTID_INIT}, |
7 | 892 {"cscopetag", "cst", P_BOOL|P_VI_DEF|P_VIM, |
893 #ifdef FEAT_CSCOPE | |
894 (char_u *)&p_cst, PV_NONE, | |
895 #else | |
896 (char_u *)NULL, PV_NONE, | |
897 #endif | |
1883 | 898 {(char_u *)0L, (char_u *)0L} SCRIPTID_INIT}, |
7 | 899 {"cscopetagorder", "csto", P_NUM|P_VI_DEF|P_VIM, |
900 #ifdef FEAT_CSCOPE | |
901 (char_u *)&p_csto, PV_NONE, | |
902 #else | |
903 (char_u *)NULL, PV_NONE, | |
904 #endif | |
1883 | 905 {(char_u *)0L, (char_u *)0L} SCRIPTID_INIT}, |
7 | 906 {"cscopeverbose", "csverb", P_BOOL|P_VI_DEF|P_VIM, |
907 #ifdef FEAT_CSCOPE | |
908 (char_u *)&p_csverbose, PV_NONE, | |
909 #else | |
910 (char_u *)NULL, PV_NONE, | |
911 #endif | |
1883 | 912 {(char_u *)0L, (char_u *)0L} SCRIPTID_INIT}, |
2250
1bac28a53fae
Add the conceal patch from Vince Negri.
Bram Moolenaar <bram@vim.org>
parents:
2248
diff
changeset
|
913 {"cursorbind", "crb", P_BOOL|P_VI_DEF, |
1bac28a53fae
Add the conceal patch from Vince Negri.
Bram Moolenaar <bram@vim.org>
parents:
2248
diff
changeset
|
914 #ifdef FEAT_CURSORBIND |
1bac28a53fae
Add the conceal patch from Vince Negri.
Bram Moolenaar <bram@vim.org>
parents:
2248
diff
changeset
|
915 (char_u *)VAR_WIN, PV_CRBIND, |
1bac28a53fae
Add the conceal patch from Vince Negri.
Bram Moolenaar <bram@vim.org>
parents:
2248
diff
changeset
|
916 #else |
1bac28a53fae
Add the conceal patch from Vince Negri.
Bram Moolenaar <bram@vim.org>
parents:
2248
diff
changeset
|
917 (char_u *)NULL, PV_NONE, |
1bac28a53fae
Add the conceal patch from Vince Negri.
Bram Moolenaar <bram@vim.org>
parents:
2248
diff
changeset
|
918 #endif |
1bac28a53fae
Add the conceal patch from Vince Negri.
Bram Moolenaar <bram@vim.org>
parents:
2248
diff
changeset
|
919 {(char_u *)FALSE, (char_u *)0L} SCRIPTID_INIT}, |
744 | 920 {"cursorcolumn", "cuc", P_BOOL|P_VI_DEF|P_RWIN, |
921 #ifdef FEAT_SYN_HL | |
922 (char_u *)VAR_WIN, PV_CUC, | |
923 #else | |
924 (char_u *)NULL, PV_NONE, | |
925 #endif | |
1883 | 926 {(char_u *)FALSE, (char_u *)0L} SCRIPTID_INIT}, |
744 | 927 {"cursorline", "cul", P_BOOL|P_VI_DEF|P_RWIN, |
928 #ifdef FEAT_SYN_HL | |
929 (char_u *)VAR_WIN, PV_CUL, | |
930 #else | |
931 (char_u *)NULL, PV_NONE, | |
932 #endif | |
1883 | 933 {(char_u *)FALSE, (char_u *)0L} SCRIPTID_INIT}, |
7 | 934 {"debug", NULL, P_STRING|P_VI_DEF, |
935 (char_u *)&p_debug, PV_NONE, | |
1883 | 936 {(char_u *)"", (char_u *)0L} SCRIPTID_INIT}, |
7 | 937 {"define", "def", P_STRING|P_ALLOCED|P_VI_DEF, |
938 #ifdef FEAT_FIND_ID | |
694 | 939 (char_u *)&p_def, PV_DEF, |
22 | 940 {(char_u *)"^\\s*#\\s*define", (char_u *)0L} |
7 | 941 #else |
942 (char_u *)NULL, PV_NONE, | |
943 {(char_u *)NULL, (char_u *)0L} | |
944 #endif | |
1883 | 945 SCRIPTID_INIT}, |
7 | 946 {"delcombine", "deco", P_BOOL|P_VI_DEF|P_VIM, |
947 #ifdef FEAT_MBYTE | |
948 (char_u *)&p_deco, PV_NONE, | |
949 #else | |
950 (char_u *)NULL, PV_NONE, | |
951 #endif | |
1883 | 952 {(char_u *)FALSE, (char_u *)0L} SCRIPTID_INIT}, |
7 | 953 {"dictionary", "dict", P_STRING|P_EXPAND|P_VI_DEF|P_COMMA|P_NODUP, |
954 #ifdef FEAT_INS_EXPAND | |
694 | 955 (char_u *)&p_dict, PV_DICT, |
7 | 956 #else |
957 (char_u *)NULL, PV_NONE, | |
958 #endif | |
1883 | 959 {(char_u *)"", (char_u *)0L} SCRIPTID_INIT}, |
7 | 960 {"diff", NULL, P_BOOL|P_VI_DEF|P_RWIN|P_NOGLOB, |
961 #ifdef FEAT_DIFF | |
962 (char_u *)VAR_WIN, PV_DIFF, | |
963 #else | |
964 (char_u *)NULL, PV_NONE, | |
965 #endif | |
1883 | 966 {(char_u *)FALSE, (char_u *)0L} SCRIPTID_INIT}, |
7 | 967 {"diffexpr", "dex", P_STRING|P_VI_DEF|P_SECURE, |
968 #if defined(FEAT_DIFF) && defined(FEAT_EVAL) | |
969 (char_u *)&p_dex, PV_NONE, | |
970 {(char_u *)"", (char_u *)0L} | |
971 #else | |
972 (char_u *)NULL, PV_NONE, | |
973 {(char_u *)0L, (char_u *)0L} | |
974 #endif | |
1883 | 975 SCRIPTID_INIT}, |
7 | 976 {"diffopt", "dip", P_STRING|P_ALLOCED|P_VI_DEF|P_RWIN|P_COMMA|P_NODUP, |
977 #ifdef FEAT_DIFF | |
978 (char_u *)&p_dip, PV_NONE, | |
979 {(char_u *)"filler", (char_u *)NULL} | |
980 #else | |
981 (char_u *)NULL, PV_NONE, | |
982 {(char_u *)"", (char_u *)NULL} | |
983 #endif | |
1883 | 984 SCRIPTID_INIT}, |
7 | 985 {"digraph", "dg", P_BOOL|P_VI_DEF|P_VIM, |
986 #ifdef FEAT_DIGRAPHS | |
987 (char_u *)&p_dg, PV_NONE, | |
988 #else | |
989 (char_u *)NULL, PV_NONE, | |
990 #endif | |
1883 | 991 {(char_u *)FALSE, (char_u *)0L} SCRIPTID_INIT}, |
7 | 992 {"directory", "dir", P_STRING|P_EXPAND|P_VI_DEF|P_COMMA|P_NODUP|P_SECURE, |
993 (char_u *)&p_dir, PV_NONE, | |
1883 | 994 {(char_u *)DFLT_DIR, (char_u *)0L} SCRIPTID_INIT}, |
7 | 995 {"display", "dy", P_STRING|P_VI_DEF|P_COMMA|P_RALL|P_NODUP, |
996 (char_u *)&p_dy, PV_NONE, | |
1883 | 997 {(char_u *)"", (char_u *)0L} SCRIPTID_INIT}, |
7 | 998 {"eadirection", "ead", P_STRING|P_VI_DEF, |
999 #ifdef FEAT_VERTSPLIT | |
1000 (char_u *)&p_ead, PV_NONE, | |
1001 {(char_u *)"both", (char_u *)0L} | |
1002 #else | |
1003 (char_u *)NULL, PV_NONE, | |
1004 {(char_u *)NULL, (char_u *)0L} | |
1005 #endif | |
1883 | 1006 SCRIPTID_INIT}, |
7 | 1007 {"edcompatible","ed", P_BOOL|P_VI_DEF, |
1008 (char_u *)&p_ed, PV_NONE, | |
1883 | 1009 {(char_u *)FALSE, (char_u *)0L} SCRIPTID_INIT}, |
7 | 1010 {"encoding", "enc", P_STRING|P_VI_DEF|P_RCLR, |
1011 #ifdef FEAT_MBYTE | |
1012 (char_u *)&p_enc, PV_NONE, | |
1013 {(char_u *)ENC_DFLT, (char_u *)0L} | |
1014 #else | |
1015 (char_u *)NULL, PV_NONE, | |
1016 {(char_u *)0L, (char_u *)0L} | |
1017 #endif | |
1883 | 1018 SCRIPTID_INIT}, |
7 | 1019 {"endofline", "eol", P_BOOL|P_NO_MKRC|P_VI_DEF|P_RSTAT, |
1020 (char_u *)&p_eol, PV_EOL, | |
1883 | 1021 {(char_u *)TRUE, (char_u *)0L} SCRIPTID_INIT}, |
7 | 1022 {"equalalways", "ea", P_BOOL|P_VI_DEF|P_RALL, |
1023 (char_u *)&p_ea, PV_NONE, | |
1883 | 1024 {(char_u *)TRUE, (char_u *)0L} SCRIPTID_INIT}, |
7 | 1025 {"equalprg", "ep", P_STRING|P_EXPAND|P_VI_DEF|P_SECURE, |
694 | 1026 (char_u *)&p_ep, PV_EP, |
1883 | 1027 {(char_u *)"", (char_u *)0L} SCRIPTID_INIT}, |
7 | 1028 {"errorbells", "eb", P_BOOL|P_VI_DEF, |
1029 (char_u *)&p_eb, PV_NONE, | |
1883 | 1030 {(char_u *)FALSE, (char_u *)0L} SCRIPTID_INIT}, |
7 | 1031 {"errorfile", "ef", P_STRING|P_EXPAND|P_VI_DEF|P_SECURE, |
1032 #ifdef FEAT_QUICKFIX | |
1033 (char_u *)&p_ef, PV_NONE, | |
1034 {(char_u *)DFLT_ERRORFILE, (char_u *)0L} | |
1035 #else | |
1036 (char_u *)NULL, PV_NONE, | |
1037 {(char_u *)NULL, (char_u *)0L} | |
1038 #endif | |
1883 | 1039 SCRIPTID_INIT}, |
7 | 1040 {"errorformat", "efm", P_STRING|P_VI_DEF|P_COMMA|P_NODUP, |
1041 #ifdef FEAT_QUICKFIX | |
694 | 1042 (char_u *)&p_efm, PV_EFM, |
1883 | 1043 {(char_u *)DFLT_EFM, (char_u *)0L} |
7 | 1044 #else |
1045 (char_u *)NULL, PV_NONE, | |
1046 {(char_u *)NULL, (char_u *)0L} | |
1047 #endif | |
1883 | 1048 SCRIPTID_INIT}, |
7 | 1049 {"esckeys", "ek", P_BOOL|P_VIM, |
1050 (char_u *)&p_ek, PV_NONE, | |
1883 | 1051 {(char_u *)FALSE, (char_u *)TRUE} SCRIPTID_INIT}, |
7 | 1052 {"eventignore", "ei", P_STRING|P_VI_DEF|P_COMMA|P_NODUP, |
1053 #ifdef FEAT_AUTOCMD | |
1054 (char_u *)&p_ei, PV_NONE, | |
1055 #else | |
1056 (char_u *)NULL, PV_NONE, | |
1057 #endif | |
1883 | 1058 {(char_u *)"", (char_u *)0L} SCRIPTID_INIT}, |
7 | 1059 {"expandtab", "et", P_BOOL|P_VI_DEF|P_VIM, |
1060 (char_u *)&p_et, PV_ET, | |
1883 | 1061 {(char_u *)FALSE, (char_u *)0L} SCRIPTID_INIT}, |
7 | 1062 {"exrc", "ex", P_BOOL|P_VI_DEF|P_SECURE, |
1063 (char_u *)&p_exrc, PV_NONE, | |
1883 | 1064 {(char_u *)FALSE, (char_u *)0L} SCRIPTID_INIT}, |
7 | 1065 {"fileencoding","fenc", P_STRING|P_ALLOCED|P_VI_DEF|P_RSTAT|P_RBUF|P_NO_MKRC, |
1066 #ifdef FEAT_MBYTE | |
1067 (char_u *)&p_fenc, PV_FENC, | |
1068 {(char_u *)"", (char_u *)0L} | |
1069 #else | |
1070 (char_u *)NULL, PV_NONE, | |
1071 {(char_u *)0L, (char_u *)0L} | |
1072 #endif | |
1883 | 1073 SCRIPTID_INIT}, |
7 | 1074 {"fileencodings","fencs", P_STRING|P_VI_DEF|P_COMMA, |
1075 #ifdef FEAT_MBYTE | |
1076 (char_u *)&p_fencs, PV_NONE, | |
1077 {(char_u *)"ucs-bom", (char_u *)0L} | |
1078 #else | |
1079 (char_u *)NULL, PV_NONE, | |
1080 {(char_u *)0L, (char_u *)0L} | |
1081 #endif | |
1883 | 1082 SCRIPTID_INIT}, |
7 | 1083 {"fileformat", "ff", P_STRING|P_ALLOCED|P_VI_DEF|P_RSTAT|P_NO_MKRC, |
1084 (char_u *)&p_ff, PV_FF, | |
1883 | 1085 {(char_u *)DFLT_FF, (char_u *)0L} SCRIPTID_INIT}, |
7 | 1086 {"fileformats", "ffs", P_STRING|P_VIM|P_COMMA|P_NODUP, |
1087 (char_u *)&p_ffs, PV_NONE, | |
1883 | 1088 {(char_u *)DFLT_FFS_VI, (char_u *)DFLT_FFS_VIM} |
1089 SCRIPTID_INIT}, | |
36 | 1090 {"filetype", "ft", P_STRING|P_ALLOCED|P_VI_DEF|P_NOGLOB|P_NFNAME, |
7 | 1091 #ifdef FEAT_AUTOCMD |
1092 (char_u *)&p_ft, PV_FT, | |
1093 {(char_u *)"", (char_u *)0L} | |
1094 #else | |
1095 (char_u *)NULL, PV_NONE, | |
1096 {(char_u *)0L, (char_u *)0L} | |
1097 #endif | |
1883 | 1098 SCRIPTID_INIT}, |
7 | 1099 {"fillchars", "fcs", P_STRING|P_VI_DEF|P_RALL|P_COMMA|P_NODUP, |
1100 #if defined(FEAT_WINDOWS) || defined(FEAT_FOLDING) | |
1101 (char_u *)&p_fcs, PV_NONE, | |
1102 {(char_u *)"vert:|,fold:-", (char_u *)0L} | |
1103 #else | |
1104 (char_u *)NULL, PV_NONE, | |
1105 {(char_u *)"", (char_u *)0L} | |
1106 #endif | |
1883 | 1107 SCRIPTID_INIT}, |
7 | 1108 {"fkmap", "fk", P_BOOL|P_VI_DEF, |
1109 #ifdef FEAT_FKMAP | |
1110 (char_u *)&p_fkmap, PV_NONE, | |
1111 #else | |
1112 (char_u *)NULL, PV_NONE, | |
1113 #endif | |
1883 | 1114 {(char_u *)FALSE, (char_u *)0L} SCRIPTID_INIT}, |
7 | 1115 {"flash", "fl", P_BOOL|P_VI_DEF, |
1116 (char_u *)NULL, PV_NONE, | |
1883 | 1117 {(char_u *)FALSE, (char_u *)0L} SCRIPTID_INIT}, |
7 | 1118 #ifdef FEAT_FOLDING |
1119 {"foldclose", "fcl", P_STRING|P_VI_DEF|P_COMMA|P_NODUP|P_RWIN, | |
1120 (char_u *)&p_fcl, PV_NONE, | |
1883 | 1121 {(char_u *)"", (char_u *)0L} SCRIPTID_INIT}, |
7 | 1122 {"foldcolumn", "fdc", P_NUM|P_VI_DEF|P_RWIN, |
1123 (char_u *)VAR_WIN, PV_FDC, | |
1883 | 1124 {(char_u *)FALSE, (char_u *)0L} SCRIPTID_INIT}, |
7 | 1125 {"foldenable", "fen", P_BOOL|P_VI_DEF|P_RWIN, |
1126 (char_u *)VAR_WIN, PV_FEN, | |
1883 | 1127 {(char_u *)TRUE, (char_u *)0L} SCRIPTID_INIT}, |
7 | 1128 {"foldexpr", "fde", P_STRING|P_ALLOCED|P_VIM|P_VI_DEF|P_RWIN, |
1129 # ifdef FEAT_EVAL | |
1130 (char_u *)VAR_WIN, PV_FDE, | |
1131 {(char_u *)"0", (char_u *)NULL} | |
1132 # else | |
1133 (char_u *)NULL, PV_NONE, | |
1134 {(char_u *)NULL, (char_u *)0L} | |
1135 # endif | |
1883 | 1136 SCRIPTID_INIT}, |
7 | 1137 {"foldignore", "fdi", P_STRING|P_ALLOCED|P_VIM|P_VI_DEF|P_RWIN, |
1138 (char_u *)VAR_WIN, PV_FDI, | |
1883 | 1139 {(char_u *)"#", (char_u *)NULL} SCRIPTID_INIT}, |
7 | 1140 {"foldlevel", "fdl", P_NUM|P_VI_DEF|P_RWIN, |
1141 (char_u *)VAR_WIN, PV_FDL, | |
1883 | 1142 {(char_u *)0L, (char_u *)0L} SCRIPTID_INIT}, |
7 | 1143 {"foldlevelstart","fdls", P_NUM|P_VI_DEF, |
1144 (char_u *)&p_fdls, PV_NONE, | |
1883 | 1145 {(char_u *)-1L, (char_u *)0L} SCRIPTID_INIT}, |
7 | 1146 {"foldmarker", "fmr", P_STRING|P_ALLOCED|P_VIM|P_VI_DEF| |
1147 P_RWIN|P_COMMA|P_NODUP, | |
1148 (char_u *)VAR_WIN, PV_FMR, | |
1883 | 1149 {(char_u *)"{{{,}}}", (char_u *)NULL} |
1150 SCRIPTID_INIT}, | |
7 | 1151 {"foldmethod", "fdm", P_STRING|P_ALLOCED|P_VIM|P_VI_DEF|P_RWIN, |
1152 (char_u *)VAR_WIN, PV_FDM, | |
1883 | 1153 {(char_u *)"manual", (char_u *)NULL} SCRIPTID_INIT}, |
7 | 1154 {"foldminlines","fml", P_NUM|P_VI_DEF|P_RWIN, |
1155 (char_u *)VAR_WIN, PV_FML, | |
1883 | 1156 {(char_u *)1L, (char_u *)0L} SCRIPTID_INIT}, |
7 | 1157 {"foldnestmax", "fdn", P_NUM|P_VI_DEF|P_RWIN, |
1158 (char_u *)VAR_WIN, PV_FDN, | |
1883 | 1159 {(char_u *)20L, (char_u *)0L} SCRIPTID_INIT}, |
7 | 1160 {"foldopen", "fdo", P_STRING|P_VI_DEF|P_COMMA|P_NODUP, |
1161 (char_u *)&p_fdo, PV_NONE, | |
1162 {(char_u *)"block,hor,mark,percent,quickfix,search,tag,undo", | |
1883 | 1163 (char_u *)0L} SCRIPTID_INIT}, |
7 | 1164 {"foldtext", "fdt", P_STRING|P_ALLOCED|P_VIM|P_VI_DEF|P_RWIN, |
1165 # ifdef FEAT_EVAL | |
1166 (char_u *)VAR_WIN, PV_FDT, | |
1167 {(char_u *)"foldtext()", (char_u *)NULL} | |
29 | 1168 # else |
7 | 1169 (char_u *)NULL, PV_NONE, |
1170 {(char_u *)NULL, (char_u *)0L} | |
29 | 1171 # endif |
1883 | 1172 SCRIPTID_INIT}, |
7 | 1173 #endif |
667 | 1174 {"formatexpr", "fex", P_STRING|P_ALLOCED|P_VI_DEF|P_VIM, |
694 | 1175 #ifdef FEAT_EVAL |
667 | 1176 (char_u *)&p_fex, PV_FEX, |
1177 {(char_u *)"", (char_u *)0L} | |
1178 #else | |
1179 (char_u *)NULL, PV_NONE, | |
1180 {(char_u *)0L, (char_u *)0L} | |
1181 #endif | |
1883 | 1182 SCRIPTID_INIT}, |
7 | 1183 {"formatoptions","fo", P_STRING|P_ALLOCED|P_VIM|P_FLAGLIST, |
1184 (char_u *)&p_fo, PV_FO, | |
1883 | 1185 {(char_u *)DFLT_FO_VI, (char_u *)DFLT_FO_VIM} |
1186 SCRIPTID_INIT}, | |
41 | 1187 {"formatlistpat","flp", P_STRING|P_ALLOCED|P_VI_DEF, |
1188 (char_u *)&p_flp, PV_FLP, | |
1883 | 1189 {(char_u *)"^\\s*\\d\\+[\\]:.)}\\t ]\\s*", |
1190 (char_u *)0L} SCRIPTID_INIT}, | |
7 | 1191 {"formatprg", "fp", P_STRING|P_EXPAND|P_VI_DEF|P_SECURE, |
1192 (char_u *)&p_fp, PV_NONE, | |
1883 | 1193 {(char_u *)"", (char_u *)0L} SCRIPTID_INIT}, |
36 | 1194 {"fsync", "fs", P_BOOL|P_SECURE|P_VI_DEF, |
1195 #ifdef HAVE_FSYNC | |
1196 (char_u *)&p_fs, PV_NONE, | |
1197 {(char_u *)TRUE, (char_u *)0L} | |
1198 #else | |
1199 (char_u *)NULL, PV_NONE, | |
1200 {(char_u *)FALSE, (char_u *)0L} | |
1201 #endif | |
1883 | 1202 SCRIPTID_INIT}, |
7 | 1203 {"gdefault", "gd", P_BOOL|P_VI_DEF|P_VIM, |
1204 (char_u *)&p_gd, PV_NONE, | |
1883 | 1205 {(char_u *)FALSE, (char_u *)0L} SCRIPTID_INIT}, |
7 | 1206 {"graphic", "gr", P_BOOL|P_VI_DEF, |
1207 (char_u *)NULL, PV_NONE, | |
1883 | 1208 {(char_u *)FALSE, (char_u *)0L} SCRIPTID_INIT}, |
7 | 1209 {"grepformat", "gfm", P_STRING|P_VI_DEF|P_COMMA|P_NODUP, |
1210 #ifdef FEAT_QUICKFIX | |
1211 (char_u *)&p_gefm, PV_NONE, | |
1883 | 1212 {(char_u *)DFLT_GREPFORMAT, (char_u *)0L} |
7 | 1213 #else |
1214 (char_u *)NULL, PV_NONE, | |
1215 {(char_u *)NULL, (char_u *)0L} | |
1216 #endif | |
1883 | 1217 SCRIPTID_INIT}, |
7 | 1218 {"grepprg", "gp", P_STRING|P_EXPAND|P_VI_DEF|P_SECURE, |
1219 #ifdef FEAT_QUICKFIX | |
694 | 1220 (char_u *)&p_gp, PV_GP, |
7 | 1221 { |
1222 # ifdef WIN3264 | |
1223 /* may be changed to "grep -n" in os_win32.c */ | |
1224 (char_u *)"findstr /n", | |
1225 # else | |
1226 # ifdef UNIX | |
1227 /* Add an extra file name so that grep will always | |
1228 * insert a file name in the match line. */ | |
1229 (char_u *)"grep -n $* /dev/null", | |
1230 # else | |
1231 # ifdef VMS | |
1232 (char_u *)"SEARCH/NUMBERS ", | |
1233 # else | |
1234 (char_u *)"grep -n ", | |
1883 | 1235 # endif |
1236 # endif | |
7 | 1237 # endif |
1883 | 1238 (char_u *)0L} |
7 | 1239 #else |
1240 (char_u *)NULL, PV_NONE, | |
1241 {(char_u *)NULL, (char_u *)0L} | |
1242 #endif | |
1883 | 1243 SCRIPTID_INIT}, |
7 | 1244 {"guicursor", "gcr", P_STRING|P_VI_DEF|P_COMMA|P_NODUP, |
1245 #ifdef CURSOR_SHAPE | |
1246 (char_u *)&p_guicursor, PV_NONE, | |
1247 { | |
1248 # ifdef FEAT_GUI | |
1249 (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", | |
1250 # else /* MSDOS or Win32 console */ | |
1251 (char_u *)"n-v-c:block,o:hor50,i-ci:hor15,r-cr:hor30,sm:block", | |
1252 # endif | |
1253 (char_u *)0L} | |
1254 #else | |
1255 (char_u *)NULL, PV_NONE, | |
1256 {(char_u *)NULL, (char_u *)0L} | |
1257 #endif | |
1883 | 1258 SCRIPTID_INIT}, |
7 | 1259 {"guifont", "gfn", P_STRING|P_VI_DEF|P_RCLR|P_COMMA|P_NODUP, |
1260 #ifdef FEAT_GUI | |
1261 (char_u *)&p_guifont, PV_NONE, | |
1262 {(char_u *)"", (char_u *)0L} | |
1263 #else | |
1264 (char_u *)NULL, PV_NONE, | |
1265 {(char_u *)NULL, (char_u *)0L} | |
1266 #endif | |
1883 | 1267 SCRIPTID_INIT}, |
7 | 1268 {"guifontset", "gfs", P_STRING|P_VI_DEF|P_RCLR|P_COMMA, |
1269 #if defined(FEAT_GUI) && defined(FEAT_XFONTSET) | |
1270 (char_u *)&p_guifontset, PV_NONE, | |
1271 {(char_u *)"", (char_u *)0L} | |
1272 #else | |
1273 (char_u *)NULL, PV_NONE, | |
1274 {(char_u *)NULL, (char_u *)0L} | |
1275 #endif | |
1883 | 1276 SCRIPTID_INIT}, |
7 | 1277 {"guifontwide", "gfw", P_STRING|P_VI_DEF|P_RCLR|P_COMMA|P_NODUP, |
1278 #if defined(FEAT_GUI) && defined(FEAT_MBYTE) | |
1279 (char_u *)&p_guifontwide, PV_NONE, | |
1280 {(char_u *)"", (char_u *)0L} | |
1281 #else | |
1282 (char_u *)NULL, PV_NONE, | |
1283 {(char_u *)NULL, (char_u *)0L} | |
1284 #endif | |
1883 | 1285 SCRIPTID_INIT}, |
7 | 1286 {"guiheadroom", "ghr", P_NUM|P_VI_DEF, |
574 | 1287 #if defined(FEAT_GUI_GTK) || defined(FEAT_GUI_X11) |
7 | 1288 (char_u *)&p_ghr, PV_NONE, |
1289 #else | |
1290 (char_u *)NULL, PV_NONE, | |
1291 #endif | |
1883 | 1292 {(char_u *)50L, (char_u *)0L} SCRIPTID_INIT}, |
7 | 1293 {"guioptions", "go", P_STRING|P_VI_DEF|P_RALL|P_FLAGLIST, |
574 | 1294 #if defined(FEAT_GUI) |
7 | 1295 (char_u *)&p_go, PV_NONE, |
1296 # if defined(UNIX) && !defined(MACOS) | |
685 | 1297 {(char_u *)"aegimrLtT", (char_u *)0L} |
7 | 1298 # else |
685 | 1299 {(char_u *)"egmrLtT", (char_u *)0L} |
7 | 1300 # endif |
1301 #else | |
1302 (char_u *)NULL, PV_NONE, | |
1303 {(char_u *)NULL, (char_u *)0L} | |
1304 #endif | |
1883 | 1305 SCRIPTID_INIT}, |
7 | 1306 {"guipty", NULL, P_BOOL|P_VI_DEF, |
1307 #if defined(FEAT_GUI) | |
1308 (char_u *)&p_guipty, PV_NONE, | |
1309 #else | |
1310 (char_u *)NULL, PV_NONE, | |
1311 #endif | |
1883 | 1312 {(char_u *)TRUE, (char_u *)0L} SCRIPTID_INIT}, |
827 | 1313 {"guitablabel", "gtl", P_STRING|P_VI_DEF|P_RWIN, |
688 | 1314 #if defined(FEAT_GUI_TABLINE) |
1315 (char_u *)&p_gtl, PV_NONE, | |
1316 {(char_u *)"", (char_u *)0L} | |
1317 #else | |
1318 (char_u *)NULL, PV_NONE, | |
1319 {(char_u *)NULL, (char_u *)0L} | |
1320 #endif | |
1883 | 1321 SCRIPTID_INIT}, |
842 | 1322 {"guitabtooltip", "gtt", P_STRING|P_VI_DEF|P_RWIN, |
839 | 1323 #if defined(FEAT_GUI_TABLINE) |
1324 (char_u *)&p_gtt, PV_NONE, | |
1325 {(char_u *)"", (char_u *)0L} | |
1326 #else | |
1327 (char_u *)NULL, PV_NONE, | |
1328 {(char_u *)NULL, (char_u *)0L} | |
1329 #endif | |
1883 | 1330 SCRIPTID_INIT}, |
7 | 1331 {"hardtabs", "ht", P_NUM|P_VI_DEF, |
1332 (char_u *)NULL, PV_NONE, | |
1883 | 1333 {(char_u *)0L, (char_u *)0L} SCRIPTID_INIT}, |
7 | 1334 {"helpfile", "hf", P_STRING|P_EXPAND|P_VI_DEF|P_SECURE, |
1335 (char_u *)&p_hf, PV_NONE, | |
1883 | 1336 {(char_u *)DFLT_HELPFILE, (char_u *)0L} |
1337 SCRIPTID_INIT}, | |
7 | 1338 {"helpheight", "hh", P_NUM|P_VI_DEF, |
1339 #ifdef FEAT_WINDOWS | |
1340 (char_u *)&p_hh, PV_NONE, | |
1341 #else | |
1342 (char_u *)NULL, PV_NONE, | |
1343 #endif | |
1883 | 1344 {(char_u *)20L, (char_u *)0L} SCRIPTID_INIT}, |
7 | 1345 {"helplang", "hlg", P_STRING|P_VI_DEF|P_COMMA, |
1346 #ifdef FEAT_MULTI_LANG | |
1347 (char_u *)&p_hlg, PV_NONE, | |
1348 {(char_u *)"", (char_u *)0L} | |
1349 #else | |
1350 (char_u *)NULL, PV_NONE, | |
1351 {(char_u *)0L, (char_u *)0L} | |
1352 #endif | |
1883 | 1353 SCRIPTID_INIT}, |
7 | 1354 {"hidden", "hid", P_BOOL|P_VI_DEF, |
1355 (char_u *)&p_hid, PV_NONE, | |
1883 | 1356 {(char_u *)FALSE, (char_u *)0L} SCRIPTID_INIT}, |
7 | 1357 {"highlight", "hl", P_STRING|P_VI_DEF|P_RCLR|P_COMMA|P_NODUP, |
1358 (char_u *)&p_hl, PV_NONE, | |
1883 | 1359 {(char_u *)HIGHLIGHT_INIT, (char_u *)0L} |
1360 SCRIPTID_INIT}, | |
7 | 1361 {"history", "hi", P_NUM|P_VIM, |
1362 (char_u *)&p_hi, PV_NONE, | |
1883 | 1363 {(char_u *)0L, (char_u *)20L} SCRIPTID_INIT}, |
7 | 1364 {"hkmap", "hk", P_BOOL|P_VI_DEF|P_VIM, |
1365 #ifdef FEAT_RIGHTLEFT | |
1366 (char_u *)&p_hkmap, PV_NONE, | |
1367 #else | |
1368 (char_u *)NULL, PV_NONE, | |
1369 #endif | |
1883 | 1370 {(char_u *)FALSE, (char_u *)0L} SCRIPTID_INIT}, |
7 | 1371 {"hkmapp", "hkp", P_BOOL|P_VI_DEF|P_VIM, |
1372 #ifdef FEAT_RIGHTLEFT | |
1373 (char_u *)&p_hkmapp, PV_NONE, | |
1374 #else | |
1375 (char_u *)NULL, PV_NONE, | |
1376 #endif | |
1883 | 1377 {(char_u *)FALSE, (char_u *)0L} SCRIPTID_INIT}, |
7 | 1378 {"hlsearch", "hls", P_BOOL|P_VI_DEF|P_VIM|P_RALL, |
1379 (char_u *)&p_hls, PV_NONE, | |
1883 | 1380 {(char_u *)FALSE, (char_u *)0L} SCRIPTID_INIT}, |
7 | 1381 {"icon", NULL, P_BOOL|P_VI_DEF, |
1382 #ifdef FEAT_TITLE | |
1383 (char_u *)&p_icon, PV_NONE, | |
1384 #else | |
1385 (char_u *)NULL, PV_NONE, | |
1386 #endif | |
1883 | 1387 {(char_u *)FALSE, (char_u *)0L} SCRIPTID_INIT}, |
7 | 1388 {"iconstring", NULL, P_STRING|P_VI_DEF, |
1389 #ifdef FEAT_TITLE | |
1390 (char_u *)&p_iconstring, PV_NONE, | |
1391 #else | |
1392 (char_u *)NULL, PV_NONE, | |
1393 #endif | |
1883 | 1394 {(char_u *)"", (char_u *)0L} SCRIPTID_INIT}, |
7 | 1395 {"ignorecase", "ic", P_BOOL|P_VI_DEF, |
1396 (char_u *)&p_ic, PV_NONE, | |
1883 | 1397 {(char_u *)FALSE, (char_u *)0L} SCRIPTID_INIT}, |
7 | 1398 {"imactivatekey","imak",P_STRING|P_VI_DEF, |
574 | 1399 #if defined(FEAT_XIM) && defined(FEAT_GUI_GTK) |
7 | 1400 (char_u *)&p_imak, PV_NONE, |
1401 #else | |
1402 (char_u *)NULL, PV_NONE, | |
1403 #endif | |
1883 | 1404 {(char_u *)"", (char_u *)0L} SCRIPTID_INIT}, |
7 | 1405 {"imcmdline", "imc", P_BOOL|P_VI_DEF, |
1406 #ifdef USE_IM_CONTROL | |
1407 (char_u *)&p_imcmdline, PV_NONE, | |
1408 #else | |
1409 (char_u *)NULL, PV_NONE, | |
1410 #endif | |
1883 | 1411 {(char_u *)FALSE, (char_u *)0L} SCRIPTID_INIT}, |
7 | 1412 {"imdisable", "imd", P_BOOL|P_VI_DEF, |
1413 #ifdef USE_IM_CONTROL | |
1414 (char_u *)&p_imdisable, PV_NONE, | |
1415 #else | |
1416 (char_u *)NULL, PV_NONE, | |
1417 #endif | |
1418 #ifdef __sgi | |
1419 {(char_u *)TRUE, (char_u *)0L} | |
1420 #else | |
1421 {(char_u *)FALSE, (char_u *)0L} | |
1422 #endif | |
1883 | 1423 SCRIPTID_INIT}, |
7 | 1424 {"iminsert", "imi", P_NUM|P_VI_DEF, |
1425 (char_u *)&p_iminsert, PV_IMI, | |
1426 #ifdef B_IMODE_IM | |
1427 {(char_u *)B_IMODE_IM, (char_u *)0L} | |
1428 #else | |
1429 {(char_u *)B_IMODE_NONE, (char_u *)0L} | |
1430 #endif | |
1883 | 1431 SCRIPTID_INIT}, |
7 | 1432 {"imsearch", "ims", P_NUM|P_VI_DEF, |
1433 (char_u *)&p_imsearch, PV_IMS, | |
1434 #ifdef B_IMODE_IM | |
1435 {(char_u *)B_IMODE_IM, (char_u *)0L} | |
1436 #else | |
1437 {(char_u *)B_IMODE_NONE, (char_u *)0L} | |
1438 #endif | |
1883 | 1439 SCRIPTID_INIT}, |
7 | 1440 {"include", "inc", P_STRING|P_ALLOCED|P_VI_DEF, |
1441 #ifdef FEAT_FIND_ID | |
694 | 1442 (char_u *)&p_inc, PV_INC, |
7 | 1443 {(char_u *)"^\\s*#\\s*include", (char_u *)0L} |
1444 #else | |
1445 (char_u *)NULL, PV_NONE, | |
1446 {(char_u *)0L, (char_u *)0L} | |
1447 #endif | |
1883 | 1448 SCRIPTID_INIT}, |
7 | 1449 {"includeexpr", "inex", P_STRING|P_ALLOCED|P_VI_DEF, |
1450 #if defined(FEAT_FIND_ID) && defined(FEAT_EVAL) | |
1451 (char_u *)&p_inex, PV_INEX, | |
1452 {(char_u *)"", (char_u *)0L} | |
1453 #else | |
1454 (char_u *)NULL, PV_NONE, | |
1455 {(char_u *)0L, (char_u *)0L} | |
1456 #endif | |
1883 | 1457 SCRIPTID_INIT}, |
7 | 1458 {"incsearch", "is", P_BOOL|P_VI_DEF|P_VIM, |
1459 (char_u *)&p_is, PV_NONE, | |
1883 | 1460 {(char_u *)FALSE, (char_u *)0L} SCRIPTID_INIT}, |
7 | 1461 {"indentexpr", "inde", P_STRING|P_ALLOCED|P_VI_DEF|P_VIM, |
1462 #if defined(FEAT_CINDENT) && defined(FEAT_EVAL) | |
1463 (char_u *)&p_inde, PV_INDE, | |
1464 {(char_u *)"", (char_u *)0L} | |
1465 #else | |
1466 (char_u *)NULL, PV_NONE, | |
1467 {(char_u *)0L, (char_u *)0L} | |
1468 #endif | |
1883 | 1469 SCRIPTID_INIT}, |
7 | 1470 {"indentkeys", "indk", P_STRING|P_ALLOCED|P_VI_DEF|P_COMMA|P_NODUP, |
1471 #if defined(FEAT_CINDENT) && defined(FEAT_EVAL) | |
1472 (char_u *)&p_indk, PV_INDK, | |
1473 {(char_u *)"0{,0},:,0#,!^F,o,O,e", (char_u *)0L} | |
1474 #else | |
1475 (char_u *)NULL, PV_NONE, | |
1476 {(char_u *)0L, (char_u *)0L} | |
1477 #endif | |
1883 | 1478 SCRIPTID_INIT}, |
7 | 1479 {"infercase", "inf", P_BOOL|P_VI_DEF, |
1480 (char_u *)&p_inf, PV_INF, | |
1883 | 1481 {(char_u *)FALSE, (char_u *)0L} SCRIPTID_INIT}, |
7 | 1482 {"insertmode", "im", P_BOOL|P_VI_DEF|P_VIM, |
1483 (char_u *)&p_im, PV_NONE, | |
1883 | 1484 {(char_u *)FALSE, (char_u *)0L} SCRIPTID_INIT}, |
7 | 1485 {"isfname", "isf", P_STRING|P_VI_DEF|P_COMMA|P_NODUP, |
1486 (char_u *)&p_isf, PV_NONE, | |
1487 { | |
1488 #ifdef BACKSLASH_IN_FILENAME | |
1489 /* Excluded are: & and ^ are special in cmd.exe | |
1490 * ( and ) are used in text separating fnames */ | |
1491 (char_u *)"@,48-57,/,\\,.,-,_,+,,,#,$,%,{,},[,],:,@-@,!,~,=", | |
1492 #else | |
1493 # ifdef AMIGA | |
1494 (char_u *)"@,48-57,/,.,-,_,+,,,$,:", | |
1495 # else | |
1496 # ifdef VMS | |
1497 (char_u *)"@,48-57,/,.,-,_,+,,,#,$,%,<,>,[,],:,;,~", | |
1498 # else /* UNIX et al. */ | |
1499 # ifdef EBCDIC | |
1500 (char_u *)"@,240-249,/,.,-,_,+,,,#,$,%,~,=", | |
1501 # else | |
1502 (char_u *)"@,48-57,/,.,-,_,+,,,#,$,%,~,=", | |
1503 # endif | |
1504 # endif | |
1505 # endif | |
1506 #endif | |
1883 | 1507 (char_u *)0L} SCRIPTID_INIT}, |
7 | 1508 {"isident", "isi", P_STRING|P_VI_DEF|P_COMMA|P_NODUP, |
1509 (char_u *)&p_isi, PV_NONE, | |
1510 { | |
1511 #if defined(MSDOS) || defined(MSWIN) || defined(OS2) | |
1512 (char_u *)"@,48-57,_,128-167,224-235", | |
1513 #else | |
1514 # ifdef EBCDIC | |
1515 /* TODO: EBCDIC Check this! @ == isalpha()*/ | |
1516 (char_u *)"@,240-249,_,66-73,81-89,98-105," | |
1517 "112-120,128,140-142,156,158,172," | |
1518 "174,186,191,203-207,219-225,235-239," | |
1519 "251-254", | |
1520 # else | |
1521 (char_u *)"@,48-57,_,192-255", | |
1522 # endif | |
1523 #endif | |
1883 | 1524 (char_u *)0L} SCRIPTID_INIT}, |
7 | 1525 {"iskeyword", "isk", P_STRING|P_ALLOCED|P_VIM|P_COMMA|P_NODUP, |
1526 (char_u *)&p_isk, PV_ISK, | |
1527 { | |
1528 #ifdef EBCDIC | |
1529 (char_u *)"@,240-249,_", | |
1530 /* TODO: EBCDIC Check this! @ == isalpha()*/ | |
1531 (char_u *)"@,240-249,_,66-73,81-89,98-105," | |
1532 "112-120,128,140-142,156,158,172," | |
1533 "174,186,191,203-207,219-225,235-239," | |
1534 "251-254", | |
1535 #else | |
1536 (char_u *)"@,48-57,_", | |
1537 # if defined(MSDOS) || defined(MSWIN) || defined(OS2) | |
1538 (char_u *)"@,48-57,_,128-167,224-235" | |
1539 # else | |
714 | 1540 ISK_LATIN1 |
7 | 1541 # endif |
1542 #endif | |
1883 | 1543 } SCRIPTID_INIT}, |
7 | 1544 {"isprint", "isp", P_STRING|P_VI_DEF|P_RALL|P_COMMA|P_NODUP, |
1545 (char_u *)&p_isp, PV_NONE, | |
1546 { | |
36 | 1547 #if defined(MSDOS) || defined(MSWIN) || defined(OS2) \ |
1548 || (defined(MACOS) && !defined(MACOS_X)) \ | |
7 | 1549 || defined(VMS) |
1550 (char_u *)"@,~-255", | |
1551 #else | |
1552 # ifdef EBCDIC | |
1553 /* all chars above 63 are printable */ | |
1554 (char_u *)"63-255", | |
1555 # else | |
719 | 1556 ISP_LATIN1, |
7 | 1557 # endif |
1558 #endif | |
1883 | 1559 (char_u *)0L} SCRIPTID_INIT}, |
7 | 1560 {"joinspaces", "js", P_BOOL|P_VI_DEF|P_VIM, |
1561 (char_u *)&p_js, PV_NONE, | |
1883 | 1562 {(char_u *)TRUE, (char_u *)0L} SCRIPTID_INIT}, |
7 | 1563 {"key", NULL, P_STRING|P_ALLOCED|P_VI_DEF|P_NO_MKRC, |
1564 #ifdef FEAT_CRYPT | |
1565 (char_u *)&p_key, PV_KEY, | |
1566 {(char_u *)"", (char_u *)0L} | |
1567 #else | |
1568 (char_u *)NULL, PV_NONE, | |
1569 {(char_u *)0L, (char_u *)0L} | |
1570 #endif | |
1883 | 1571 SCRIPTID_INIT}, |
1384 | 1572 {"keymap", "kmp", P_STRING|P_ALLOCED|P_VI_DEF|P_RBUF|P_RSTAT|P_NFNAME|P_PRI_MKRC, |
7 | 1573 #ifdef FEAT_KEYMAP |
1574 (char_u *)&p_keymap, PV_KMAP, | |
1575 {(char_u *)"", (char_u *)0L} | |
1576 #else | |
1577 (char_u *)NULL, PV_NONE, | |
1578 {(char_u *)"", (char_u *)0L} | |
1579 #endif | |
1883 | 1580 SCRIPTID_INIT}, |
7 | 1581 {"keymodel", "km", P_STRING|P_VI_DEF|P_COMMA|P_NODUP, |
1582 #ifdef FEAT_VISUAL | |
1583 (char_u *)&p_km, PV_NONE, | |
1584 #else | |
1585 (char_u *)NULL, PV_NONE, | |
1586 #endif | |
1883 | 1587 {(char_u *)"", (char_u *)0L} SCRIPTID_INIT}, |
7 | 1588 {"keywordprg", "kp", P_STRING|P_EXPAND|P_VI_DEF|P_SECURE, |
694 | 1589 (char_u *)&p_kp, PV_KP, |
7 | 1590 { |
1591 #if defined(MSDOS) || defined(MSWIN) | |
1592 (char_u *)":help", | |
1593 #else | |
1594 #ifdef VMS | |
1595 (char_u *)"help", | |
1596 #else | |
1597 # if defined(OS2) | |
1598 (char_u *)"view /", | |
1599 # else | |
1600 # ifdef USEMAN_S | |
1601 (char_u *)"man -s", | |
1602 # else | |
1603 (char_u *)"man", | |
1604 # endif | |
1605 # endif | |
1606 #endif | |
1607 #endif | |
1883 | 1608 (char_u *)0L} SCRIPTID_INIT}, |
7 | 1609 {"langmap", "lmap", P_STRING|P_VI_DEF|P_COMMA|P_NODUP, |
1610 #ifdef FEAT_LANGMAP | |
1611 (char_u *)&p_langmap, PV_NONE, | |
1612 {(char_u *)"", /* unmatched } */ | |
1613 #else | |
1614 (char_u *)NULL, PV_NONE, | |
1615 {(char_u *)NULL, | |
1616 #endif | |
1883 | 1617 (char_u *)0L} SCRIPTID_INIT}, |
36 | 1618 {"langmenu", "lm", P_STRING|P_VI_DEF|P_NFNAME, |
7 | 1619 #if defined(FEAT_MENU) && defined(FEAT_MULTI_LANG) |
1620 (char_u *)&p_lm, PV_NONE, | |
1621 #else | |
1622 (char_u *)NULL, PV_NONE, | |
1623 #endif | |
1883 | 1624 {(char_u *)"", (char_u *)0L} SCRIPTID_INIT}, |
7 | 1625 {"laststatus", "ls", P_NUM|P_VI_DEF|P_RALL, |
1626 #ifdef FEAT_WINDOWS | |
1627 (char_u *)&p_ls, PV_NONE, | |
1628 #else | |
1629 (char_u *)NULL, PV_NONE, | |
1630 #endif | |
1883 | 1631 {(char_u *)1L, (char_u *)0L} SCRIPTID_INIT}, |
7 | 1632 {"lazyredraw", "lz", P_BOOL|P_VI_DEF, |
1633 (char_u *)&p_lz, PV_NONE, | |
1883 | 1634 {(char_u *)FALSE, (char_u *)0L} SCRIPTID_INIT}, |
7 | 1635 {"linebreak", "lbr", P_BOOL|P_VI_DEF|P_RWIN, |
1636 #ifdef FEAT_LINEBREAK | |
1637 (char_u *)VAR_WIN, PV_LBR, | |
1638 #else | |
1639 (char_u *)NULL, PV_NONE, | |
1640 #endif | |
1883 | 1641 {(char_u *)FALSE, (char_u *)0L} SCRIPTID_INIT}, |
7 | 1642 {"lines", NULL, P_NUM|P_NODEFAULT|P_NO_MKRC|P_VI_DEF|P_RCLR, |
1643 (char_u *)&Rows, PV_NONE, | |
1644 { | |
1645 #if defined(MSDOS) || defined(WIN3264) || defined(OS2) | |
1646 (char_u *)25L, | |
1647 #else | |
1648 (char_u *)24L, | |
1649 #endif | |
1883 | 1650 (char_u *)0L} SCRIPTID_INIT}, |
7 | 1651 {"linespace", "lsp", P_NUM|P_VI_DEF|P_RCLR, |
1652 #ifdef FEAT_GUI | |
1653 (char_u *)&p_linespace, PV_NONE, | |
1654 #else | |
1655 (char_u *)NULL, PV_NONE, | |
1656 #endif | |
1657 #ifdef FEAT_GUI_W32 | |
1658 {(char_u *)1L, (char_u *)0L} | |
1659 #else | |
1660 {(char_u *)0L, (char_u *)0L} | |
1661 #endif | |
1883 | 1662 SCRIPTID_INIT}, |
7 | 1663 {"lisp", NULL, P_BOOL|P_VI_DEF, |
1664 #ifdef FEAT_LISP | |
1665 (char_u *)&p_lisp, PV_LISP, | |
1666 #else | |
1667 (char_u *)NULL, PV_NONE, | |
1668 #endif | |
1883 | 1669 {(char_u *)FALSE, (char_u *)0L} SCRIPTID_INIT}, |
7 | 1670 {"lispwords", "lw", P_STRING|P_VI_DEF|P_COMMA|P_NODUP, |
1671 #ifdef FEAT_LISP | |
1672 (char_u *)&p_lispwords, PV_NONE, | |
1673 {(char_u *)LISPWORD_VALUE, (char_u *)0L} | |
1674 #else | |
1675 (char_u *)NULL, PV_NONE, | |
1676 {(char_u *)"", (char_u *)0L} | |
1677 #endif | |
1883 | 1678 SCRIPTID_INIT}, |
7 | 1679 {"list", NULL, P_BOOL|P_VI_DEF|P_RWIN, |
1680 (char_u *)VAR_WIN, PV_LIST, | |
1883 | 1681 {(char_u *)FALSE, (char_u *)0L} SCRIPTID_INIT}, |
7 | 1682 {"listchars", "lcs", P_STRING|P_VI_DEF|P_RALL|P_COMMA|P_NODUP, |
1683 (char_u *)&p_lcs, PV_NONE, | |
1883 | 1684 {(char_u *)"eol:$", (char_u *)0L} SCRIPTID_INIT}, |
7 | 1685 {"loadplugins", "lpl", P_BOOL|P_VI_DEF, |
1686 (char_u *)&p_lpl, PV_NONE, | |
1883 | 1687 {(char_u *)TRUE, (char_u *)0L} SCRIPTID_INIT}, |
842 | 1688 #ifdef FEAT_GUI_MAC |
1689 {"macatsui", NULL, P_BOOL|P_VI_DEF|P_RCLR, | |
1690 (char_u *)&p_macatsui, PV_NONE, | |
1883 | 1691 {(char_u *)TRUE, (char_u *)0L} SCRIPTID_INIT}, |
842 | 1692 #endif |
7 | 1693 {"magic", NULL, P_BOOL|P_VI_DEF, |
1694 (char_u *)&p_magic, PV_NONE, | |
1883 | 1695 {(char_u *)TRUE, (char_u *)0L} SCRIPTID_INIT}, |
634 | 1696 {"makeef", "mef", P_STRING|P_EXPAND|P_VI_DEF|P_SECURE, |
7 | 1697 #ifdef FEAT_QUICKFIX |
1698 (char_u *)&p_mef, PV_NONE, | |
1699 {(char_u *)"", (char_u *)0L} | |
1700 #else | |
1701 (char_u *)NULL, PV_NONE, | |
1702 {(char_u *)NULL, (char_u *)0L} | |
1703 #endif | |
1883 | 1704 SCRIPTID_INIT}, |
7 | 1705 {"makeprg", "mp", P_STRING|P_EXPAND|P_VI_DEF|P_SECURE, |
1706 #ifdef FEAT_QUICKFIX | |
694 | 1707 (char_u *)&p_mp, PV_MP, |
7 | 1708 # ifdef VMS |
1709 {(char_u *)"MMS", (char_u *)0L} | |
1710 # else | |
1711 {(char_u *)"make", (char_u *)0L} | |
1712 # endif | |
1713 #else | |
1714 (char_u *)NULL, PV_NONE, | |
1715 {(char_u *)NULL, (char_u *)0L} | |
1716 #endif | |
1883 | 1717 SCRIPTID_INIT}, |
7 | 1718 {"matchpairs", "mps", P_STRING|P_ALLOCED|P_VI_DEF|P_COMMA|P_NODUP, |
1719 (char_u *)&p_mps, PV_MPS, | |
1883 | 1720 {(char_u *)"(:),{:},[:]", (char_u *)0L} |
1721 SCRIPTID_INIT}, | |
7 | 1722 {"matchtime", "mat", P_NUM|P_VI_DEF, |
1723 (char_u *)&p_mat, PV_NONE, | |
1883 | 1724 {(char_u *)5L, (char_u *)0L} SCRIPTID_INIT}, |
714 | 1725 {"maxcombine", "mco", P_NUM|P_VI_DEF, |
1726 #ifdef FEAT_MBYTE | |
1727 (char_u *)&p_mco, PV_NONE, | |
1728 #else | |
1729 (char_u *)NULL, PV_NONE, | |
1730 #endif | |
1883 | 1731 {(char_u *)2, (char_u *)0L} SCRIPTID_INIT}, |
7 | 1732 {"maxfuncdepth", "mfd", P_NUM|P_VI_DEF, |
1733 #ifdef FEAT_EVAL | |
1734 (char_u *)&p_mfd, PV_NONE, | |
1735 #else | |
1736 (char_u *)NULL, PV_NONE, | |
1737 #endif | |
1883 | 1738 {(char_u *)100L, (char_u *)0L} SCRIPTID_INIT}, |
7 | 1739 {"maxmapdepth", "mmd", P_NUM|P_VI_DEF, |
1740 (char_u *)&p_mmd, PV_NONE, | |
1883 | 1741 {(char_u *)1000L, (char_u *)0L} SCRIPTID_INIT}, |
7 | 1742 {"maxmem", "mm", P_NUM|P_VI_DEF, |
1743 (char_u *)&p_mm, PV_NONE, | |
1883 | 1744 {(char_u *)DFLT_MAXMEM, (char_u *)0L} |
1745 SCRIPTID_INIT}, | |
190 | 1746 {"maxmempattern","mmp", P_NUM|P_VI_DEF, |
1747 (char_u *)&p_mmp, PV_NONE, | |
1883 | 1748 {(char_u *)1000L, (char_u *)0L} SCRIPTID_INIT}, |
7 | 1749 {"maxmemtot", "mmt", P_NUM|P_VI_DEF, |
1750 (char_u *)&p_mmt, PV_NONE, | |
1883 | 1751 {(char_u *)DFLT_MAXMEMTOT, (char_u *)0L} |
1752 SCRIPTID_INIT}, | |
7 | 1753 {"menuitems", "mis", P_NUM|P_VI_DEF, |
1754 #ifdef FEAT_MENU | |
1755 (char_u *)&p_mis, PV_NONE, | |
1756 #else | |
1757 (char_u *)NULL, PV_NONE, | |
1758 #endif | |
1883 | 1759 {(char_u *)25L, (char_u *)0L} SCRIPTID_INIT}, |
7 | 1760 {"mesg", NULL, P_BOOL|P_VI_DEF, |
1761 (char_u *)NULL, PV_NONE, | |
1883 | 1762 {(char_u *)FALSE, (char_u *)0L} SCRIPTID_INIT}, |
484 | 1763 {"mkspellmem", "msm", P_STRING|P_VI_DEF|P_EXPAND|P_SECURE, |
744 | 1764 #ifdef FEAT_SPELL |
484 | 1765 (char_u *)&p_msm, PV_NONE, |
1766 {(char_u *)"460000,2000,500", (char_u *)0L} | |
1767 #else | |
1768 (char_u *)NULL, PV_NONE, | |
1769 {(char_u *)0L, (char_u *)0L} | |
1770 #endif | |
1883 | 1771 SCRIPTID_INIT}, |
7 | 1772 {"modeline", "ml", P_BOOL|P_VIM, |
1773 (char_u *)&p_ml, PV_ML, | |
1883 | 1774 {(char_u *)FALSE, (char_u *)TRUE} SCRIPTID_INIT}, |
7 | 1775 {"modelines", "mls", P_NUM|P_VI_DEF, |
1776 (char_u *)&p_mls, PV_NONE, | |
1883 | 1777 {(char_u *)5L, (char_u *)0L} SCRIPTID_INIT}, |
7 | 1778 {"modifiable", "ma", P_BOOL|P_VI_DEF|P_NOGLOB, |
1779 (char_u *)&p_ma, PV_MA, | |
1883 | 1780 {(char_u *)TRUE, (char_u *)0L} SCRIPTID_INIT}, |
7 | 1781 {"modified", "mod", P_BOOL|P_NO_MKRC|P_VI_DEF|P_RSTAT, |
1782 (char_u *)&p_mod, PV_MOD, | |
1883 | 1783 {(char_u *)FALSE, (char_u *)0L} SCRIPTID_INIT}, |
7 | 1784 {"more", NULL, P_BOOL|P_VIM, |
1785 (char_u *)&p_more, PV_NONE, | |
1883 | 1786 {(char_u *)FALSE, (char_u *)TRUE} SCRIPTID_INIT}, |
7 | 1787 {"mouse", NULL, P_STRING|P_VI_DEF|P_FLAGLIST, |
1788 (char_u *)&p_mouse, PV_NONE, | |
1789 { | |
1790 #if defined(MSDOS) || defined(WIN3264) | |
1791 (char_u *)"a", | |
1792 #else | |
1793 (char_u *)"", | |
1794 #endif | |
1883 | 1795 (char_u *)0L} SCRIPTID_INIT}, |
7 | 1796 {"mousefocus", "mousef", P_BOOL|P_VI_DEF, |
1797 #ifdef FEAT_GUI | |
1798 (char_u *)&p_mousef, PV_NONE, | |
1799 #else | |
1800 (char_u *)NULL, PV_NONE, | |
1801 #endif | |
1883 | 1802 {(char_u *)FALSE, (char_u *)0L} SCRIPTID_INIT}, |
7 | 1803 {"mousehide", "mh", P_BOOL|P_VI_DEF, |
1804 #ifdef FEAT_GUI | |
1805 (char_u *)&p_mh, PV_NONE, | |
1806 #else | |
1807 (char_u *)NULL, PV_NONE, | |
1808 #endif | |
1883 | 1809 {(char_u *)TRUE, (char_u *)0L} SCRIPTID_INIT}, |
7 | 1810 {"mousemodel", "mousem", P_STRING|P_VI_DEF, |
1811 (char_u *)&p_mousem, PV_NONE, | |
1812 { | |
1813 #if defined(MSDOS) || defined(MSWIN) | |
1814 (char_u *)"popup", | |
1815 #else | |
1816 # if defined(MACOS) | |
1817 (char_u *)"popup_setpos", | |
1818 # else | |
1819 (char_u *)"extend", | |
1820 # endif | |
1821 #endif | |
1883 | 1822 (char_u *)0L} SCRIPTID_INIT}, |
7 | 1823 {"mouseshape", "mouses", P_STRING|P_VI_DEF|P_COMMA|P_NODUP, |
1824 #ifdef FEAT_MOUSESHAPE | |
1825 (char_u *)&p_mouseshape, PV_NONE, | |
1826 {(char_u *)"i-r:beam,s:updown,sd:udsizing,vs:leftright,vd:lrsizing,m:no,ml:up-arrow,v:rightup-arrow", (char_u *)0L} | |
1827 #else | |
1828 (char_u *)NULL, PV_NONE, | |
1829 {(char_u *)NULL, (char_u *)0L} | |
1830 #endif | |
1883 | 1831 SCRIPTID_INIT}, |
7 | 1832 {"mousetime", "mouset", P_NUM|P_VI_DEF, |
1833 (char_u *)&p_mouset, PV_NONE, | |
1883 | 1834 {(char_u *)500L, (char_u *)0L} SCRIPTID_INIT}, |
14 | 1835 {"mzquantum", "mzq", P_NUM, |
1836 #ifdef FEAT_MZSCHEME | |
1837 (char_u *)&p_mzq, PV_NONE, | |
1838 #else | |
1839 (char_u *)NULL, PV_NONE, | |
1840 #endif | |
1883 | 1841 {(char_u *)100L, (char_u *)100L} SCRIPTID_INIT}, |
7 | 1842 {"novice", NULL, P_BOOL|P_VI_DEF, |
1843 (char_u *)NULL, PV_NONE, | |
1883 | 1844 {(char_u *)FALSE, (char_u *)0L} SCRIPTID_INIT}, |
7 | 1845 {"nrformats", "nf", P_STRING|P_ALLOCED|P_VI_DEF|P_COMMA|P_NODUP, |
1846 (char_u *)&p_nf, PV_NF, | |
1883 | 1847 {(char_u *)"octal,hex", (char_u *)0L} |
1848 SCRIPTID_INIT}, | |
7 | 1849 {"number", "nu", P_BOOL|P_VI_DEF|P_RWIN, |
1850 (char_u *)VAR_WIN, PV_NU, | |
1883 | 1851 {(char_u *)FALSE, (char_u *)0L} SCRIPTID_INIT}, |
13 | 1852 {"numberwidth", "nuw", P_NUM|P_RWIN|P_VIM, |
1853 #ifdef FEAT_LINEBREAK | |
1854 (char_u *)VAR_WIN, PV_NUW, | |
1855 #else | |
1856 (char_u *)NULL, PV_NONE, | |
1857 #endif | |
1883 | 1858 {(char_u *)8L, (char_u *)4L} SCRIPTID_INIT}, |
523 | 1859 {"omnifunc", "ofu", P_STRING|P_ALLOCED|P_VI_DEF|P_SECURE, |
502 | 1860 #ifdef FEAT_COMPL_FUNC |
1861 (char_u *)&p_ofu, PV_OFU, | |
1862 {(char_u *)"", (char_u *)0L} | |
1863 #else | |
1864 (char_u *)NULL, PV_NONE, | |
1865 {(char_u *)0L, (char_u *)0L} | |
1866 #endif | |
1883 | 1867 SCRIPTID_INIT}, |
7 | 1868 {"open", NULL, P_BOOL|P_VI_DEF, |
1869 (char_u *)NULL, PV_NONE, | |
1883 | 1870 {(char_u *)FALSE, (char_u *)0L} SCRIPTID_INIT}, |
1004 | 1871 {"opendevice", "odev", P_BOOL|P_VI_DEF, |
1872 #if defined(MSDOS) || defined(MSWIN) || defined(OS2) | |
1873 (char_u *)&p_odev, PV_NONE, | |
1874 #else | |
1875 (char_u *)NULL, PV_NONE, | |
1876 #endif | |
1877 {(char_u *)FALSE, (char_u *)FALSE} | |
1883 | 1878 SCRIPTID_INIT}, |
593 | 1879 {"operatorfunc", "opfunc", P_STRING|P_VI_DEF|P_SECURE, |
1880 (char_u *)&p_opfunc, PV_NONE, | |
1883 | 1881 {(char_u *)"", (char_u *)0L} SCRIPTID_INIT}, |
7 | 1882 {"optimize", "opt", P_BOOL|P_VI_DEF, |
1883 (char_u *)NULL, PV_NONE, | |
1883 | 1884 {(char_u *)FALSE, (char_u *)0L} SCRIPTID_INIT}, |
7 | 1885 {"osfiletype", "oft", P_STRING|P_ALLOCED|P_VI_DEF, |
1886 #ifdef FEAT_OSFILETYPE | |
1887 (char_u *)&p_oft, PV_OFT, | |
1888 {(char_u *)DFLT_OFT, (char_u *)0L} | |
1889 #else | |
1890 (char_u *)NULL, PV_NONE, | |
1891 {(char_u *)0L, (char_u *)0L} | |
1892 #endif | |
1883 | 1893 SCRIPTID_INIT}, |
7 | 1894 {"paragraphs", "para", P_STRING|P_VI_DEF, |
1895 (char_u *)&p_para, PV_NONE, | |
1564 | 1896 {(char_u *)"IPLPPPQPP TPHPLIPpLpItpplpipbp", |
1883 | 1897 (char_u *)0L} SCRIPTID_INIT}, |
1384 | 1898 {"paste", NULL, P_BOOL|P_VI_DEF|P_PRI_MKRC, |
7 | 1899 (char_u *)&p_paste, PV_NONE, |
1883 | 1900 {(char_u *)FALSE, (char_u *)0L} SCRIPTID_INIT}, |
7 | 1901 {"pastetoggle", "pt", P_STRING|P_VI_DEF, |
1902 (char_u *)&p_pt, PV_NONE, | |
1883 | 1903 {(char_u *)"", (char_u *)0L} SCRIPTID_INIT}, |
7 | 1904 {"patchexpr", "pex", P_STRING|P_VI_DEF|P_SECURE, |
1905 #if defined(FEAT_DIFF) && defined(FEAT_EVAL) | |
1906 (char_u *)&p_pex, PV_NONE, | |
1907 {(char_u *)"", (char_u *)0L} | |
1908 #else | |
1909 (char_u *)NULL, PV_NONE, | |
1910 {(char_u *)0L, (char_u *)0L} | |
1911 #endif | |
1883 | 1912 SCRIPTID_INIT}, |
36 | 1913 {"patchmode", "pm", P_STRING|P_VI_DEF|P_NFNAME, |
7 | 1914 (char_u *)&p_pm, PV_NONE, |
1883 | 1915 {(char_u *)"", (char_u *)0L} SCRIPTID_INIT}, |
7 | 1916 {"path", "pa", P_STRING|P_EXPAND|P_VI_DEF|P_COMMA|P_NODUP, |
694 | 1917 (char_u *)&p_path, PV_PATH, |
7 | 1918 { |
1919 #if defined AMIGA || defined MSDOS || defined MSWIN | |
1920 (char_u *)".,,", | |
1921 #else | |
1922 # if defined(__EMX__) | |
1923 (char_u *)".,/emx/include,,", | |
1924 # else /* Unix, probably */ | |
1925 (char_u *)".,/usr/include,,", | |
1926 # endif | |
1927 #endif | |
1883 | 1928 (char_u *)0L} SCRIPTID_INIT}, |
7 | 1929 {"preserveindent", "pi", P_BOOL|P_VI_DEF|P_VIM, |
1930 (char_u *)&p_pi, PV_PI, | |
1883 | 1931 {(char_u *)FALSE, (char_u *)0L} SCRIPTID_INIT}, |
13 | 1932 {"previewheight", "pvh", P_NUM|P_VI_DEF, |
7 | 1933 #if defined(FEAT_WINDOWS) && defined(FEAT_QUICKFIX) |
1934 (char_u *)&p_pvh, PV_NONE, | |
1935 #else | |
1936 (char_u *)NULL, PV_NONE, | |
1937 #endif | |
1883 | 1938 {(char_u *)12L, (char_u *)0L} SCRIPTID_INIT}, |
7 | 1939 {"previewwindow", "pvw", P_BOOL|P_VI_DEF|P_RSTAT|P_NOGLOB, |
1940 #if defined(FEAT_WINDOWS) && defined(FEAT_QUICKFIX) | |
1941 (char_u *)VAR_WIN, PV_PVW, | |
1942 #else | |
1943 (char_u *)NULL, PV_NONE, | |
1944 #endif | |
1883 | 1945 {(char_u *)FALSE, (char_u *)0L} SCRIPTID_INIT}, |
36 | 1946 {"printdevice", "pdev", P_STRING|P_VI_DEF|P_SECURE, |
7 | 1947 #ifdef FEAT_PRINTER |
1948 (char_u *)&p_pdev, PV_NONE, | |
1949 {(char_u *)"", (char_u *)0L} | |
1950 #else | |
1951 (char_u *)NULL, PV_NONE, | |
1952 {(char_u *)NULL, (char_u *)0L} | |
1953 #endif | |
1883 | 1954 SCRIPTID_INIT}, |
7 | 1955 {"printencoding", "penc", P_STRING|P_VI_DEF, |
1956 #ifdef FEAT_POSTSCRIPT | |
1957 (char_u *)&p_penc, PV_NONE, | |
1958 {(char_u *)"", (char_u *)0L} | |
1959 #else | |
1960 (char_u *)NULL, PV_NONE, | |
1961 {(char_u *)NULL, (char_u *)0L} | |
1962 #endif | |
1883 | 1963 SCRIPTID_INIT}, |
7 | 1964 {"printexpr", "pexpr", P_STRING|P_VI_DEF, |
1965 #ifdef FEAT_POSTSCRIPT | |
1966 (char_u *)&p_pexpr, PV_NONE, | |
1967 {(char_u *)"", (char_u *)0L} | |
1968 #else | |
1969 (char_u *)NULL, PV_NONE, | |
1970 {(char_u *)NULL, (char_u *)0L} | |
1971 #endif | |
1883 | 1972 SCRIPTID_INIT}, |
7 | 1973 {"printfont", "pfn", P_STRING|P_VI_DEF, |
1974 #ifdef FEAT_PRINTER | |
1975 (char_u *)&p_pfn, PV_NONE, | |
1976 { | |
1977 # ifdef MSWIN | |
1978 (char_u *)"Courier_New:h10", | |
1979 # else | |
1980 (char_u *)"courier", | |
1981 # endif | |
1982 (char_u *)0L} | |
1983 #else | |
1984 (char_u *)NULL, PV_NONE, | |
1985 {(char_u *)NULL, (char_u *)0L} | |
1986 #endif | |
1883 | 1987 SCRIPTID_INIT}, |
7 | 1988 {"printheader", "pheader", P_STRING|P_VI_DEF|P_GETTEXT, |
1989 #ifdef FEAT_PRINTER | |
1990 (char_u *)&p_header, PV_NONE, | |
1991 {(char_u *)N_("%<%f%h%m%=Page %N"), (char_u *)0L} | |
1992 #else | |
1993 (char_u *)NULL, PV_NONE, | |
1994 {(char_u *)NULL, (char_u *)0L} | |
1995 #endif | |
1883 | 1996 SCRIPTID_INIT}, |
15 | 1997 {"printmbcharset", "pmbcs", P_STRING|P_VI_DEF, |
1998 #if defined(FEAT_POSTSCRIPT) && defined(FEAT_MBYTE) | |
1999 (char_u *)&p_pmcs, PV_NONE, | |
2000 {(char_u *)"", (char_u *)0L} | |
2001 #else | |
2002 (char_u *)NULL, PV_NONE, | |
2003 {(char_u *)NULL, (char_u *)0L} | |
2004 #endif | |
1883 | 2005 SCRIPTID_INIT}, |
15 | 2006 {"printmbfont", "pmbfn", P_STRING|P_VI_DEF, |
2007 #if defined(FEAT_POSTSCRIPT) && defined(FEAT_MBYTE) | |
2008 (char_u *)&p_pmfn, PV_NONE, | |
2009 {(char_u *)"", (char_u *)0L} | |
2010 #else | |
2011 (char_u *)NULL, PV_NONE, | |
2012 {(char_u *)NULL, (char_u *)0L} | |
2013 #endif | |
1883 | 2014 SCRIPTID_INIT}, |
7 | 2015 {"printoptions", "popt", P_STRING|P_VI_DEF|P_COMMA|P_NODUP, |
2016 #ifdef FEAT_PRINTER | |
2017 (char_u *)&p_popt, PV_NONE, | |
2018 {(char_u *)"", (char_u *)0L} | |
2019 #else | |
2020 (char_u *)NULL, PV_NONE, | |
2021 {(char_u *)NULL, (char_u *)0L} | |
2022 #endif | |
1883 | 2023 SCRIPTID_INIT}, |
7 | 2024 {"prompt", NULL, P_BOOL|P_VI_DEF, |
168 | 2025 (char_u *)&p_prompt, PV_NONE, |
1883 | 2026 {(char_u *)TRUE, (char_u *)0L} SCRIPTID_INIT}, |
767 | 2027 {"pumheight", "ph", P_NUM|P_VI_DEF, |
2028 #ifdef FEAT_INS_EXPAND | |
2029 (char_u *)&p_ph, PV_NONE, | |
2030 #else | |
2031 (char_u *)NULL, PV_NONE, | |
2032 #endif | |
1883 | 2033 {(char_u *)0L, (char_u *)0L} SCRIPTID_INIT}, |
12 | 2034 {"quoteescape", "qe", P_STRING|P_ALLOCED|P_VI_DEF, |
2035 #ifdef FEAT_TEXTOBJ | |
2036 (char_u *)&p_qe, PV_QE, | |
2037 {(char_u *)"\\", (char_u *)0L} | |
2038 #else | |
2039 (char_u *)NULL, PV_NONE, | |
2040 {(char_u *)NULL, (char_u *)0L} | |
2041 #endif | |
1883 | 2042 SCRIPTID_INIT}, |
7 | 2043 {"readonly", "ro", P_BOOL|P_VI_DEF|P_RSTAT|P_NOGLOB, |
2044 (char_u *)&p_ro, PV_RO, | |
1883 | 2045 {(char_u *)FALSE, (char_u *)0L} SCRIPTID_INIT}, |
7 | 2046 {"redraw", NULL, P_BOOL|P_VI_DEF, |
2047 (char_u *)NULL, PV_NONE, | |
1883 | 2048 {(char_u *)FALSE, (char_u *)0L} SCRIPTID_INIT}, |
1521 | 2049 {"redrawtime", "rdt", P_NUM|P_VI_DEF, |
2050 #ifdef FEAT_RELTIME | |
2051 (char_u *)&p_rdt, PV_NONE, | |
2052 #else | |
2053 (char_u *)NULL, PV_NONE, | |
2054 #endif | |
1883 | 2055 {(char_u *)2000L, (char_u *)0L} SCRIPTID_INIT}, |
2178
c6f1aa1e9f32
Add 'relativenumber' patch from Markus Heidelberg.
Bram Moolenaar <bram@vim.org>
parents:
2144
diff
changeset
|
2056 {"relativenumber", "rnu", P_BOOL|P_VI_DEF|P_RWIN, |
c6f1aa1e9f32
Add 'relativenumber' patch from Markus Heidelberg.
Bram Moolenaar <bram@vim.org>
parents:
2144
diff
changeset
|
2057 (char_u *)VAR_WIN, PV_RNU, |
c6f1aa1e9f32
Add 'relativenumber' patch from Markus Heidelberg.
Bram Moolenaar <bram@vim.org>
parents:
2144
diff
changeset
|
2058 {(char_u *)FALSE, (char_u *)0L} SCRIPTID_INIT}, |
7 | 2059 {"remap", NULL, P_BOOL|P_VI_DEF, |
2060 (char_u *)&p_remap, PV_NONE, | |
1883 | 2061 {(char_u *)TRUE, (char_u *)0L} SCRIPTID_INIT}, |
7 | 2062 {"report", NULL, P_NUM|P_VI_DEF, |
2063 (char_u *)&p_report, PV_NONE, | |
1883 | 2064 {(char_u *)2L, (char_u *)0L} SCRIPTID_INIT}, |
7 | 2065 {"restorescreen", "rs", P_BOOL|P_VI_DEF, |
2066 #ifdef WIN3264 | |
2067 (char_u *)&p_rs, PV_NONE, | |
2068 #else | |
2069 (char_u *)NULL, PV_NONE, | |
2070 #endif | |
1883 | 2071 {(char_u *)TRUE, (char_u *)0L} SCRIPTID_INIT}, |
7 | 2072 {"revins", "ri", P_BOOL|P_VI_DEF|P_VIM, |
2073 #ifdef FEAT_RIGHTLEFT | |
2074 (char_u *)&p_ri, PV_NONE, | |
2075 #else | |
2076 (char_u *)NULL, PV_NONE, | |
2077 #endif | |
1883 | 2078 {(char_u *)FALSE, (char_u *)0L} SCRIPTID_INIT}, |
7 | 2079 {"rightleft", "rl", P_BOOL|P_VI_DEF|P_RWIN, |
2080 #ifdef FEAT_RIGHTLEFT | |
2081 (char_u *)VAR_WIN, PV_RL, | |
2082 #else | |
2083 (char_u *)NULL, PV_NONE, | |
2084 #endif | |
1883 | 2085 {(char_u *)FALSE, (char_u *)0L} SCRIPTID_INIT}, |
7 | 2086 {"rightleftcmd", "rlc", P_STRING|P_ALLOCED|P_VI_DEF|P_RWIN, |
2087 #ifdef FEAT_RIGHTLEFT | |
2088 (char_u *)VAR_WIN, PV_RLC, | |
2089 {(char_u *)"search", (char_u *)NULL} | |
2090 #else | |
2091 (char_u *)NULL, PV_NONE, | |
2092 {(char_u *)NULL, (char_u *)0L} | |
2093 #endif | |
1883 | 2094 SCRIPTID_INIT}, |
7 | 2095 {"ruler", "ru", P_BOOL|P_VI_DEF|P_VIM|P_RSTAT, |
2096 #ifdef FEAT_CMDL_INFO | |
2097 (char_u *)&p_ru, PV_NONE, | |
2098 #else | |
2099 (char_u *)NULL, PV_NONE, | |
2100 #endif | |
1883 | 2101 {(char_u *)FALSE, (char_u *)0L} SCRIPTID_INIT}, |
7 | 2102 {"rulerformat", "ruf", P_STRING|P_VI_DEF|P_ALLOCED|P_RSTAT, |
2103 #ifdef FEAT_STL_OPT | |
2104 (char_u *)&p_ruf, PV_NONE, | |
2105 #else | |
2106 (char_u *)NULL, PV_NONE, | |
2107 #endif | |
1883 | 2108 {(char_u *)"", (char_u *)0L} SCRIPTID_INIT}, |
7 | 2109 {"runtimepath", "rtp", P_STRING|P_VI_DEF|P_EXPAND|P_COMMA|P_NODUP|P_SECURE, |
2110 (char_u *)&p_rtp, PV_NONE, | |
1883 | 2111 {(char_u *)DFLT_RUNTIMEPATH, (char_u *)0L} |
2112 SCRIPTID_INIT}, | |
7 | 2113 {"scroll", "scr", P_NUM|P_NO_MKRC|P_VI_DEF, |
2114 (char_u *)VAR_WIN, PV_SCROLL, | |
1883 | 2115 {(char_u *)12L, (char_u *)0L} SCRIPTID_INIT}, |
7 | 2116 {"scrollbind", "scb", P_BOOL|P_VI_DEF, |
2117 #ifdef FEAT_SCROLLBIND | |
2118 (char_u *)VAR_WIN, PV_SCBIND, | |
2119 #else | |
2120 (char_u *)NULL, PV_NONE, | |
2121 #endif | |
1883 | 2122 {(char_u *)FALSE, (char_u *)0L} SCRIPTID_INIT}, |
7 | 2123 {"scrolljump", "sj", P_NUM|P_VI_DEF|P_VIM, |
2124 (char_u *)&p_sj, PV_NONE, | |
1883 | 2125 {(char_u *)1L, (char_u *)0L} SCRIPTID_INIT}, |
7 | 2126 {"scrolloff", "so", P_NUM|P_VI_DEF|P_VIM|P_RALL, |
2127 (char_u *)&p_so, PV_NONE, | |
1883 | 2128 {(char_u *)0L, (char_u *)0L} SCRIPTID_INIT}, |
7 | 2129 {"scrollopt", "sbo", P_STRING|P_VI_DEF|P_COMMA|P_NODUP, |
2130 #ifdef FEAT_SCROLLBIND | |
2131 (char_u *)&p_sbo, PV_NONE, | |
2132 {(char_u *)"ver,jump", (char_u *)0L} | |
2133 #else | |
2134 (char_u *)NULL, PV_NONE, | |
2135 {(char_u *)0L, (char_u *)0L} | |
2136 #endif | |
1883 | 2137 SCRIPTID_INIT}, |
7 | 2138 {"sections", "sect", P_STRING|P_VI_DEF, |
2139 (char_u *)&p_sections, PV_NONE, | |
1883 | 2140 {(char_u *)"SHNHH HUnhsh", (char_u *)0L} |
2141 SCRIPTID_INIT}, | |
7 | 2142 {"secure", NULL, P_BOOL|P_VI_DEF|P_SECURE, |
2143 (char_u *)&p_secure, PV_NONE, | |
1883 | 2144 {(char_u *)FALSE, (char_u *)0L} SCRIPTID_INIT}, |
7 | 2145 {"selection", "sel", P_STRING|P_VI_DEF, |
2146 #ifdef FEAT_VISUAL | |
2147 (char_u *)&p_sel, PV_NONE, | |
2148 #else | |
2149 (char_u *)NULL, PV_NONE, | |
2150 #endif | |
1883 | 2151 {(char_u *)"inclusive", (char_u *)0L} |
2152 SCRIPTID_INIT}, | |
7 | 2153 {"selectmode", "slm", P_STRING|P_VI_DEF|P_COMMA|P_NODUP, |
2154 #ifdef FEAT_VISUAL | |
2155 (char_u *)&p_slm, PV_NONE, | |
2156 #else | |
2157 (char_u *)NULL, PV_NONE, | |
2158 #endif | |
1883 | 2159 {(char_u *)"", (char_u *)0L} SCRIPTID_INIT}, |
7 | 2160 {"sessionoptions", "ssop", P_STRING|P_VI_DEF|P_COMMA|P_NODUP, |
2161 #ifdef FEAT_SESSION | |
2162 (char_u *)&p_ssop, PV_NONE, | |
828 | 2163 {(char_u *)"blank,buffers,curdir,folds,help,options,tabpages,winsize", |
7 | 2164 (char_u *)0L} |
2165 #else | |
2166 (char_u *)NULL, PV_NONE, | |
2167 {(char_u *)0L, (char_u *)0L} | |
2168 #endif | |
1883 | 2169 SCRIPTID_INIT}, |
7 | 2170 {"shell", "sh", P_STRING|P_EXPAND|P_VI_DEF|P_SECURE, |
2171 (char_u *)&p_sh, PV_NONE, | |
2172 { | |
2173 #ifdef VMS | |
2174 (char_u *)"-", | |
2175 #else | |
2176 # if defined(MSDOS) | |
2177 (char_u *)"command", | |
2178 # else | |
2179 # if defined(WIN16) | |
2180 (char_u *)"command.com", | |
2181 # else | |
2182 # if defined(WIN3264) | |
2183 (char_u *)"", /* set in set_init_1() */ | |
2184 # else | |
2185 # if defined(OS2) | |
2186 (char_u *)"cmd.exe", | |
2187 # else | |
2188 # if defined(ARCHIE) | |
2189 (char_u *)"gos", | |
2190 # else | |
2191 (char_u *)"sh", | |
2192 # endif | |
2193 # endif | |
2194 # endif | |
2195 # endif | |
2196 # endif | |
2197 #endif /* VMS */ | |
1883 | 2198 (char_u *)0L} SCRIPTID_INIT}, |
7 | 2199 {"shellcmdflag","shcf", P_STRING|P_VI_DEF|P_SECURE, |
2200 (char_u *)&p_shcf, PV_NONE, | |
2201 { | |
2202 #if defined(MSDOS) || defined(MSWIN) | |
2203 (char_u *)"/c", | |
2204 #else | |
2205 # if defined(OS2) | |
2206 (char_u *)"/c", | |
2207 # else | |
2208 (char_u *)"-c", | |
2209 # endif | |
2210 #endif | |
1883 | 2211 (char_u *)0L} SCRIPTID_INIT}, |
7 | 2212 {"shellpipe", "sp", P_STRING|P_VI_DEF|P_SECURE, |
2213 #ifdef FEAT_QUICKFIX | |
2214 (char_u *)&p_sp, PV_NONE, | |
2215 { | |
2216 #if defined(UNIX) || defined(OS2) | |
2217 # ifdef ARCHIE | |
2218 (char_u *)"2>", | |
2219 # else | |
2220 (char_u *)"| tee", | |
2221 # endif | |
2222 #else | |
2223 (char_u *)">", | |
2224 #endif | |
2225 (char_u *)0L} | |
2226 #else | |
2227 (char_u *)NULL, PV_NONE, | |
2228 {(char_u *)0L, (char_u *)0L} | |
2229 #endif | |
1883 | 2230 SCRIPTID_INIT}, |
7 | 2231 {"shellquote", "shq", P_STRING|P_VI_DEF|P_SECURE, |
2232 (char_u *)&p_shq, PV_NONE, | |
1883 | 2233 {(char_u *)"", (char_u *)0L} SCRIPTID_INIT}, |
7 | 2234 {"shellredir", "srr", P_STRING|P_VI_DEF|P_SECURE, |
2235 (char_u *)&p_srr, PV_NONE, | |
1883 | 2236 {(char_u *)">", (char_u *)0L} SCRIPTID_INIT}, |
7 | 2237 {"shellslash", "ssl", P_BOOL|P_VI_DEF, |
2238 #ifdef BACKSLASH_IN_FILENAME | |
2239 (char_u *)&p_ssl, PV_NONE, | |
2240 #else | |
2241 (char_u *)NULL, PV_NONE, | |
2242 #endif | |
1883 | 2243 {(char_u *)FALSE, (char_u *)0L} SCRIPTID_INIT}, |
168 | 2244 {"shelltemp", "stmp", P_BOOL, |
2245 (char_u *)&p_stmp, PV_NONE, | |
1883 | 2246 {(char_u *)FALSE, (char_u *)TRUE} SCRIPTID_INIT}, |
7 | 2247 {"shelltype", "st", P_NUM|P_VI_DEF, |
2248 #ifdef AMIGA | |
2249 (char_u *)&p_st, PV_NONE, | |
2250 #else | |
2251 (char_u *)NULL, PV_NONE, | |
2252 #endif | |
1883 | 2253 {(char_u *)0L, (char_u *)0L} SCRIPTID_INIT}, |
7 | 2254 {"shellxquote", "sxq", P_STRING|P_VI_DEF|P_SECURE, |
2255 (char_u *)&p_sxq, PV_NONE, | |
2256 { | |
2257 #if defined(UNIX) && defined(USE_SYSTEM) && !defined(__EMX__) | |
2258 (char_u *)"\"", | |
2259 #else | |
2260 (char_u *)"", | |
2261 #endif | |
1883 | 2262 (char_u *)0L} SCRIPTID_INIT}, |
7 | 2263 {"shiftround", "sr", P_BOOL|P_VI_DEF|P_VIM, |
2264 (char_u *)&p_sr, PV_NONE, | |
1883 | 2265 {(char_u *)FALSE, (char_u *)0L} SCRIPTID_INIT}, |
7 | 2266 {"shiftwidth", "sw", P_NUM|P_VI_DEF, |
2267 (char_u *)&p_sw, PV_SW, | |
1883 | 2268 {(char_u *)8L, (char_u *)0L} SCRIPTID_INIT}, |
7 | 2269 {"shortmess", "shm", P_STRING|P_VIM|P_FLAGLIST, |
2270 (char_u *)&p_shm, PV_NONE, | |
1883 | 2271 {(char_u *)"", (char_u *)"filnxtToO"} |
2272 SCRIPTID_INIT}, | |
7 | 2273 {"shortname", "sn", P_BOOL|P_VI_DEF, |
2274 #ifdef SHORT_FNAME | |
2275 (char_u *)NULL, PV_NONE, | |
2276 #else | |
2277 (char_u *)&p_sn, PV_SN, | |
2278 #endif | |
1883 | 2279 {(char_u *)FALSE, (char_u *)0L} SCRIPTID_INIT}, |
7 | 2280 {"showbreak", "sbr", P_STRING|P_VI_DEF|P_RALL, |
2281 #ifdef FEAT_LINEBREAK | |
2282 (char_u *)&p_sbr, PV_NONE, | |
2283 #else | |
2284 (char_u *)NULL, PV_NONE, | |
2285 #endif | |
1883 | 2286 {(char_u *)"", (char_u *)0L} SCRIPTID_INIT}, |
7 | 2287 {"showcmd", "sc", P_BOOL|P_VIM, |
2288 #ifdef FEAT_CMDL_INFO | |
2289 (char_u *)&p_sc, PV_NONE, | |
2290 #else | |
2291 (char_u *)NULL, PV_NONE, | |
2292 #endif | |
2293 {(char_u *)FALSE, | |
2294 #ifdef UNIX | |
2295 (char_u *)FALSE | |
2296 #else | |
2297 (char_u *)TRUE | |
2298 #endif | |
1883 | 2299 } SCRIPTID_INIT}, |
7 | 2300 {"showfulltag", "sft", P_BOOL|P_VI_DEF, |
2301 (char_u *)&p_sft, PV_NONE, | |
1883 | 2302 {(char_u *)FALSE, (char_u *)0L} SCRIPTID_INIT}, |
7 | 2303 {"showmatch", "sm", P_BOOL|P_VI_DEF, |
2304 (char_u *)&p_sm, PV_NONE, | |
1883 | 2305 {(char_u *)FALSE, (char_u *)0L} SCRIPTID_INIT}, |
7 | 2306 {"showmode", "smd", P_BOOL|P_VIM, |
2307 (char_u *)&p_smd, PV_NONE, | |
1883 | 2308 {(char_u *)FALSE, (char_u *)TRUE} SCRIPTID_INIT}, |
677 | 2309 {"showtabline", "stal", P_NUM|P_VI_DEF|P_RALL, |
2310 #ifdef FEAT_WINDOWS | |
2311 (char_u *)&p_stal, PV_NONE, | |
2312 #else | |
2313 (char_u *)NULL, PV_NONE, | |
2314 #endif | |
1883 | 2315 {(char_u *)1L, (char_u *)0L} SCRIPTID_INIT}, |
7 | 2316 {"sidescroll", "ss", P_NUM|P_VI_DEF, |
2317 (char_u *)&p_ss, PV_NONE, | |
1883 | 2318 {(char_u *)0L, (char_u *)0L} SCRIPTID_INIT}, |
7 | 2319 {"sidescrolloff", "siso", P_NUM|P_VI_DEF|P_VIM|P_RBUF, |
2320 (char_u *)&p_siso, PV_NONE, | |
1883 | 2321 {(char_u *)0L, (char_u *)0L} SCRIPTID_INIT}, |
7 | 2322 {"slowopen", "slow", P_BOOL|P_VI_DEF, |
2323 (char_u *)NULL, PV_NONE, | |
1883 | 2324 {(char_u *)FALSE, (char_u *)0L} SCRIPTID_INIT}, |
7 | 2325 {"smartcase", "scs", P_BOOL|P_VI_DEF|P_VIM, |
2326 (char_u *)&p_scs, PV_NONE, | |
1883 | 2327 {(char_u *)FALSE, (char_u *)0L} SCRIPTID_INIT}, |
7 | 2328 {"smartindent", "si", P_BOOL|P_VI_DEF|P_VIM, |
2329 #ifdef FEAT_SMARTINDENT | |
2330 (char_u *)&p_si, PV_SI, | |
2331 #else | |
2332 (char_u *)NULL, PV_NONE, | |
2333 #endif | |
1883 | 2334 {(char_u *)FALSE, (char_u *)0L} SCRIPTID_INIT}, |
7 | 2335 {"smarttab", "sta", P_BOOL|P_VI_DEF|P_VIM, |
2336 (char_u *)&p_sta, PV_NONE, | |
1883 | 2337 {(char_u *)FALSE, (char_u *)0L} SCRIPTID_INIT}, |
7 | 2338 {"softtabstop", "sts", P_NUM|P_VI_DEF|P_VIM, |
2339 (char_u *)&p_sts, PV_STS, | |
1883 | 2340 {(char_u *)0L, (char_u *)0L} SCRIPTID_INIT}, |
7 | 2341 {"sourceany", NULL, P_BOOL|P_VI_DEF, |
2342 (char_u *)NULL, PV_NONE, | |
1883 | 2343 {(char_u *)FALSE, (char_u *)0L} SCRIPTID_INIT}, |
221 | 2344 {"spell", NULL, P_BOOL|P_VI_DEF|P_RWIN, |
744 | 2345 #ifdef FEAT_SPELL |
221 | 2346 (char_u *)VAR_WIN, PV_SPELL, |
2347 #else | |
2348 (char_u *)NULL, PV_NONE, | |
2349 #endif | |
1883 | 2350 {(char_u *)FALSE, (char_u *)0L} SCRIPTID_INIT}, |
477 | 2351 {"spellcapcheck", "spc", P_STRING|P_ALLOCED|P_VI_DEF|P_RBUF, |
744 | 2352 #ifdef FEAT_SPELL |
386 | 2353 (char_u *)&p_spc, PV_SPC, |
389 | 2354 {(char_u *)"[.?!]\\_[\\])'\" ]\\+", (char_u *)0L} |
386 | 2355 #else |
2356 (char_u *)NULL, PV_NONE, | |
2357 {(char_u *)0L, (char_u *)0L} | |
2358 #endif | |
1883 | 2359 SCRIPTID_INIT}, |
386 | 2360 {"spellfile", "spf", P_STRING|P_EXPAND|P_ALLOCED|P_VI_DEF|P_SECURE|P_COMMA, |
744 | 2361 #ifdef FEAT_SPELL |
314 | 2362 (char_u *)&p_spf, PV_SPF, |
2363 {(char_u *)"", (char_u *)0L} | |
2364 #else | |
2365 (char_u *)NULL, PV_NONE, | |
2366 {(char_u *)0L, (char_u *)0L} | |
2367 #endif | |
1883 | 2368 SCRIPTID_INIT}, |
374 | 2369 {"spelllang", "spl", P_STRING|P_ALLOCED|P_VI_DEF|P_COMMA|P_RBUF|P_EXPAND, |
744 | 2370 #ifdef FEAT_SPELL |
221 | 2371 (char_u *)&p_spl, PV_SPL, |
314 | 2372 {(char_u *)"en", (char_u *)0L} |
221 | 2373 #else |
2374 (char_u *)NULL, PV_NONE, | |
2375 {(char_u *)0L, (char_u *)0L} | |
2376 #endif | |
1883 | 2377 SCRIPTID_INIT}, |
875 | 2378 {"spellsuggest", "sps", P_STRING|P_VI_DEF|P_EXPAND|P_SECURE|P_COMMA, |
744 | 2379 #ifdef FEAT_SPELL |
344 | 2380 (char_u *)&p_sps, PV_NONE, |
2381 {(char_u *)"best", (char_u *)0L} | |
2382 #else | |
2383 (char_u *)NULL, PV_NONE, | |
2384 {(char_u *)0L, (char_u *)0L} | |
2385 #endif | |
1883 | 2386 SCRIPTID_INIT}, |
7 | 2387 {"splitbelow", "sb", P_BOOL|P_VI_DEF, |
2388 #ifdef FEAT_WINDOWS | |
2389 (char_u *)&p_sb, PV_NONE, | |
2390 #else | |
2391 (char_u *)NULL, PV_NONE, | |
2392 #endif | |
1883 | 2393 {(char_u *)FALSE, (char_u *)0L} SCRIPTID_INIT}, |
7 | 2394 {"splitright", "spr", P_BOOL|P_VI_DEF, |
2395 #ifdef FEAT_VERTSPLIT | |
2396 (char_u *)&p_spr, PV_NONE, | |
2397 #else | |
2398 (char_u *)NULL, PV_NONE, | |
2399 #endif | |
1883 | 2400 {(char_u *)FALSE, (char_u *)0L} SCRIPTID_INIT}, |
7 | 2401 {"startofline", "sol", P_BOOL|P_VI_DEF|P_VIM, |
2402 (char_u *)&p_sol, PV_NONE, | |
1883 | 2403 {(char_u *)TRUE, (char_u *)0L} SCRIPTID_INIT}, |
7 | 2404 {"statusline" ,"stl", P_STRING|P_VI_DEF|P_ALLOCED|P_RSTAT, |
2405 #ifdef FEAT_STL_OPT | |
694 | 2406 (char_u *)&p_stl, PV_STL, |
7 | 2407 #else |
2408 (char_u *)NULL, PV_NONE, | |
2409 #endif | |
1883 | 2410 {(char_u *)"", (char_u *)0L} SCRIPTID_INIT}, |
7 | 2411 {"suffixes", "su", P_STRING|P_VI_DEF|P_COMMA|P_NODUP, |
2412 (char_u *)&p_su, PV_NONE, | |
2413 {(char_u *)".bak,~,.o,.h,.info,.swp,.obj", | |
1883 | 2414 (char_u *)0L} SCRIPTID_INIT}, |
7 | 2415 {"suffixesadd", "sua", P_STRING|P_VI_DEF|P_ALLOCED|P_COMMA|P_NODUP, |
694 | 2416 #ifdef FEAT_SEARCHPATH |
7 | 2417 (char_u *)&p_sua, PV_SUA, |
2418 {(char_u *)"", (char_u *)0L} | |
2419 #else | |
2420 (char_u *)NULL, PV_NONE, | |
2421 {(char_u *)0L, (char_u *)0L} | |
2422 #endif | |
1883 | 2423 SCRIPTID_INIT}, |
7 | 2424 {"swapfile", "swf", P_BOOL|P_VI_DEF|P_RSTAT, |
2425 (char_u *)&p_swf, PV_SWF, | |
1883 | 2426 {(char_u *)TRUE, (char_u *)0L} SCRIPTID_INIT}, |
7 | 2427 {"swapsync", "sws", P_STRING|P_VI_DEF, |
2428 (char_u *)&p_sws, PV_NONE, | |
1883 | 2429 {(char_u *)"fsync", (char_u *)0L} SCRIPTID_INIT}, |
7 | 2430 {"switchbuf", "swb", P_STRING|P_VI_DEF|P_COMMA|P_NODUP, |
2431 (char_u *)&p_swb, PV_NONE, | |
1883 | 2432 {(char_u *)"", (char_u *)0L} SCRIPTID_INIT}, |
410 | 2433 {"synmaxcol", "smc", P_NUM|P_VI_DEF|P_RBUF, |
2434 #ifdef FEAT_SYN_HL | |
2435 (char_u *)&p_smc, PV_SMC, | |
2436 {(char_u *)3000L, (char_u *)0L} | |
2437 #else | |
2438 (char_u *)NULL, PV_NONE, | |
2439 {(char_u *)0L, (char_u *)0L} | |
2440 #endif | |
1883 | 2441 SCRIPTID_INIT}, |
36 | 2442 {"syntax", "syn", P_STRING|P_ALLOCED|P_VI_DEF|P_NOGLOB|P_NFNAME, |
7 | 2443 #ifdef FEAT_SYN_HL |
2444 (char_u *)&p_syn, PV_SYN, | |
2445 {(char_u *)"", (char_u *)0L} | |
2446 #else | |
2447 (char_u *)NULL, PV_NONE, | |
2448 {(char_u *)0L, (char_u *)0L} | |
2449 #endif | |
1883 | 2450 SCRIPTID_INIT}, |
677 | 2451 {"tabline", "tal", P_STRING|P_VI_DEF|P_RALL, |
2452 #ifdef FEAT_STL_OPT | |
670 | 2453 (char_u *)&p_tal, PV_NONE, |
2454 #else | |
2455 (char_u *)NULL, PV_NONE, | |
2456 #endif | |
1883 | 2457 {(char_u *)"", (char_u *)0L} SCRIPTID_INIT}, |
699 | 2458 {"tabpagemax", "tpm", P_NUM|P_VI_DEF, |
2459 #ifdef FEAT_WINDOWS | |
2460 (char_u *)&p_tpm, PV_NONE, | |
2461 #else | |
2462 (char_u *)NULL, PV_NONE, | |
2463 #endif | |
1883 | 2464 {(char_u *)10L, (char_u *)0L} SCRIPTID_INIT}, |
7 | 2465 {"tabstop", "ts", P_NUM|P_VI_DEF|P_RBUF, |
2466 (char_u *)&p_ts, PV_TS, | |
1883 | 2467 {(char_u *)8L, (char_u *)0L} SCRIPTID_INIT}, |
7 | 2468 {"tagbsearch", "tbs", P_BOOL|P_VI_DEF, |
2469 (char_u *)&p_tbs, PV_NONE, | |
2470 #ifdef VMS /* binary searching doesn't appear to work on VMS */ | |
2471 {(char_u *)0L, (char_u *)0L} | |
2472 #else | |
2473 {(char_u *)TRUE, (char_u *)0L} | |
2474 #endif | |
1883 | 2475 SCRIPTID_INIT}, |
7 | 2476 {"taglength", "tl", P_NUM|P_VI_DEF, |
2477 (char_u *)&p_tl, PV_NONE, | |
1883 | 2478 {(char_u *)0L, (char_u *)0L} SCRIPTID_INIT}, |
7 | 2479 {"tagrelative", "tr", P_BOOL|P_VIM, |
2480 (char_u *)&p_tr, PV_NONE, | |
1883 | 2481 {(char_u *)FALSE, (char_u *)TRUE} SCRIPTID_INIT}, |
7 | 2482 {"tags", "tag", P_STRING|P_EXPAND|P_VI_DEF|P_COMMA|P_NODUP, |
694 | 2483 (char_u *)&p_tags, PV_TAGS, |
7 | 2484 { |
2485 #if defined(FEAT_EMACS_TAGS) && !defined(CASE_INSENSITIVE_FILENAME) | |
2486 (char_u *)"./tags,./TAGS,tags,TAGS", | |
2487 #else | |
2488 (char_u *)"./tags,tags", | |
2489 #endif | |
1883 | 2490 (char_u *)0L} SCRIPTID_INIT}, |
7 | 2491 {"tagstack", "tgst", P_BOOL|P_VI_DEF, |
2492 (char_u *)&p_tgst, PV_NONE, | |
1883 | 2493 {(char_u *)TRUE, (char_u *)0L} SCRIPTID_INIT}, |
7 | 2494 {"term", NULL, P_STRING|P_EXPAND|P_NODEFAULT|P_NO_MKRC|P_VI_DEF|P_RALL, |
2495 (char_u *)&T_NAME, PV_NONE, | |
1883 | 2496 {(char_u *)"", (char_u *)0L} SCRIPTID_INIT}, |
7 | 2497 {"termbidi", "tbidi", P_BOOL|P_VI_DEF, |
2498 #ifdef FEAT_ARABIC | |
2499 (char_u *)&p_tbidi, PV_NONE, | |
2500 #else | |
2501 (char_u *)NULL, PV_NONE, | |
2502 #endif | |
1883 | 2503 {(char_u *)FALSE, (char_u *)0L} SCRIPTID_INIT}, |
7 | 2504 {"termencoding", "tenc", P_STRING|P_VI_DEF|P_RCLR, |
2505 #ifdef FEAT_MBYTE | |
2506 (char_u *)&p_tenc, PV_NONE, | |
2507 {(char_u *)"", (char_u *)0L} | |
2508 #else | |
2509 (char_u *)NULL, PV_NONE, | |
2510 {(char_u *)0L, (char_u *)0L} | |
2511 #endif | |
1883 | 2512 SCRIPTID_INIT}, |
7 | 2513 {"terse", NULL, P_BOOL|P_VI_DEF, |
2514 (char_u *)&p_terse, PV_NONE, | |
1883 | 2515 {(char_u *)FALSE, (char_u *)0L} SCRIPTID_INIT}, |
7 | 2516 {"textauto", "ta", P_BOOL|P_VIM, |
2517 (char_u *)&p_ta, PV_NONE, | |
1883 | 2518 {(char_u *)DFLT_TEXTAUTO, (char_u *)TRUE} |
2519 SCRIPTID_INIT}, | |
7 | 2520 {"textmode", "tx", P_BOOL|P_VI_DEF|P_NO_MKRC, |
2521 (char_u *)&p_tx, PV_TX, | |
2522 { | |
2523 #ifdef USE_CRNL | |
2524 (char_u *)TRUE, | |
2525 #else | |
2526 (char_u *)FALSE, | |
2527 #endif | |
1883 | 2528 (char_u *)0L} SCRIPTID_INIT}, |
7 | 2529 {"textwidth", "tw", P_NUM|P_VI_DEF|P_VIM, |
2530 (char_u *)&p_tw, PV_TW, | |
1883 | 2531 {(char_u *)0L, (char_u *)0L} SCRIPTID_INIT}, |
7 | 2532 {"thesaurus", "tsr", P_STRING|P_EXPAND|P_VI_DEF|P_COMMA|P_NODUP, |
2533 #ifdef FEAT_INS_EXPAND | |
694 | 2534 (char_u *)&p_tsr, PV_TSR, |
7 | 2535 #else |
2536 (char_u *)NULL, PV_NONE, | |
2537 #endif | |
1883 | 2538 {(char_u *)"", (char_u *)0L} SCRIPTID_INIT}, |
7 | 2539 {"tildeop", "top", P_BOOL|P_VI_DEF|P_VIM, |
2540 (char_u *)&p_to, PV_NONE, | |
1883 | 2541 {(char_u *)FALSE, (char_u *)0L} SCRIPTID_INIT}, |
7 | 2542 {"timeout", "to", P_BOOL|P_VI_DEF, |
2543 (char_u *)&p_timeout, PV_NONE, | |
1883 | 2544 {(char_u *)TRUE, (char_u *)0L} SCRIPTID_INIT}, |
7 | 2545 {"timeoutlen", "tm", P_NUM|P_VI_DEF, |
2546 (char_u *)&p_tm, PV_NONE, | |
1883 | 2547 {(char_u *)1000L, (char_u *)0L} SCRIPTID_INIT}, |
7 | 2548 {"title", NULL, P_BOOL|P_VI_DEF, |
2549 #ifdef FEAT_TITLE | |
2550 (char_u *)&p_title, PV_NONE, | |
2551 #else | |
2552 (char_u *)NULL, PV_NONE, | |
2553 #endif | |
1883 | 2554 {(char_u *)FALSE, (char_u *)0L} SCRIPTID_INIT}, |
7 | 2555 {"titlelen", NULL, P_NUM|P_VI_DEF, |
2556 #ifdef FEAT_TITLE | |
2557 (char_u *)&p_titlelen, PV_NONE, | |
2558 #else | |
2559 (char_u *)NULL, PV_NONE, | |
2560 #endif | |
1883 | 2561 {(char_u *)85L, (char_u *)0L} SCRIPTID_INIT}, |
667 | 2562 {"titleold", NULL, P_STRING|P_VI_DEF|P_GETTEXT|P_SECURE|P_NO_MKRC, |
7 | 2563 #ifdef FEAT_TITLE |
2564 (char_u *)&p_titleold, PV_NONE, | |
2565 {(char_u *)N_("Thanks for flying Vim"), | |
2566 (char_u *)0L} | |
2567 #else | |
2568 (char_u *)NULL, PV_NONE, | |
2569 {(char_u *)0L, (char_u *)0L} | |
2570 #endif | |
1883 | 2571 SCRIPTID_INIT}, |
7 | 2572 {"titlestring", NULL, P_STRING|P_VI_DEF, |
2573 #ifdef FEAT_TITLE | |
2574 (char_u *)&p_titlestring, PV_NONE, | |
2575 #else | |
2576 (char_u *)NULL, PV_NONE, | |
2577 #endif | |
1883 | 2578 {(char_u *)"", (char_u *)0L} SCRIPTID_INIT}, |
7 | 2579 #if defined(FEAT_TOOLBAR) && !defined(FEAT_GUI_W32) |
2580 {"toolbar", "tb", P_STRING|P_COMMA|P_VI_DEF|P_NODUP, | |
2581 (char_u *)&p_toolbar, PV_NONE, | |
1883 | 2582 {(char_u *)"icons,tooltips", (char_u *)0L} |
2583 SCRIPTID_INIT}, | |
7 | 2584 #endif |
2275
e4d849f4df03
Remove the old and not well supported GTK 1 code. (James Vega)
Bram Moolenaar <bram@vim.org>
parents:
2271
diff
changeset
|
2585 #if defined(FEAT_TOOLBAR) && defined(FEAT_GUI_GTK) |
7 | 2586 {"toolbariconsize", "tbis", P_STRING|P_VI_DEF, |
2587 (char_u *)&p_tbis, PV_NONE, | |
1883 | 2588 {(char_u *)"small", (char_u *)0L} SCRIPTID_INIT}, |
7 | 2589 #endif |
2590 {"ttimeout", NULL, P_BOOL|P_VI_DEF|P_VIM, | |
2591 (char_u *)&p_ttimeout, PV_NONE, | |
1883 | 2592 {(char_u *)FALSE, (char_u *)0L} SCRIPTID_INIT}, |
7 | 2593 {"ttimeoutlen", "ttm", P_NUM|P_VI_DEF, |
2594 (char_u *)&p_ttm, PV_NONE, | |
1883 | 2595 {(char_u *)-1L, (char_u *)0L} SCRIPTID_INIT}, |
7 | 2596 {"ttybuiltin", "tbi", P_BOOL|P_VI_DEF, |
2597 (char_u *)&p_tbi, PV_NONE, | |
1883 | 2598 {(char_u *)TRUE, (char_u *)0L} SCRIPTID_INIT}, |
7 | 2599 {"ttyfast", "tf", P_BOOL|P_NO_MKRC|P_VI_DEF, |
2600 (char_u *)&p_tf, PV_NONE, | |
1883 | 2601 {(char_u *)FALSE, (char_u *)0L} SCRIPTID_INIT}, |
7 | 2602 {"ttymouse", "ttym", P_STRING|P_NODEFAULT|P_NO_MKRC|P_VI_DEF, |
2603 #if defined(FEAT_MOUSE) && (defined(UNIX) || defined(VMS)) | |
2604 (char_u *)&p_ttym, PV_NONE, | |
2605 #else | |
2606 (char_u *)NULL, PV_NONE, | |
2607 #endif | |
1883 | 2608 {(char_u *)"", (char_u *)0L} SCRIPTID_INIT}, |
7 | 2609 {"ttyscroll", "tsl", P_NUM|P_VI_DEF, |
2610 (char_u *)&p_ttyscroll, PV_NONE, | |
1883 | 2611 {(char_u *)999L, (char_u *)0L} SCRIPTID_INIT}, |
7 | 2612 {"ttytype", "tty", P_STRING|P_EXPAND|P_NODEFAULT|P_NO_MKRC|P_VI_DEF|P_RALL, |
2613 (char_u *)&T_NAME, PV_NONE, | |
1883 | 2614 {(char_u *)"", (char_u *)0L} SCRIPTID_INIT}, |
2214
f8222d1f9a73
Included patch for persistent undo. Lots of changes and added test.
Bram Moolenaar <bram@vim.org>
parents:
2184
diff
changeset
|
2615 {"undodir", "udir", P_STRING|P_EXPAND|P_COMMA|P_NODUP|P_SECURE|P_VI_DEF, |
f8222d1f9a73
Included patch for persistent undo. Lots of changes and added test.
Bram Moolenaar <bram@vim.org>
parents:
2184
diff
changeset
|
2616 #ifdef FEAT_PERSISTENT_UNDO |
f8222d1f9a73
Included patch for persistent undo. Lots of changes and added test.
Bram Moolenaar <bram@vim.org>
parents:
2184
diff
changeset
|
2617 (char_u *)&p_udir, PV_NONE, |
f8222d1f9a73
Included patch for persistent undo. Lots of changes and added test.
Bram Moolenaar <bram@vim.org>
parents:
2184
diff
changeset
|
2618 {(char_u *)".", (char_u *)0L} |
f8222d1f9a73
Included patch for persistent undo. Lots of changes and added test.
Bram Moolenaar <bram@vim.org>
parents:
2184
diff
changeset
|
2619 #else |
f8222d1f9a73
Included patch for persistent undo. Lots of changes and added test.
Bram Moolenaar <bram@vim.org>
parents:
2184
diff
changeset
|
2620 (char_u *)NULL, PV_NONE, |
f8222d1f9a73
Included patch for persistent undo. Lots of changes and added test.
Bram Moolenaar <bram@vim.org>
parents:
2184
diff
changeset
|
2621 {(char_u *)0L, (char_u *)0L} |
f8222d1f9a73
Included patch for persistent undo. Lots of changes and added test.
Bram Moolenaar <bram@vim.org>
parents:
2184
diff
changeset
|
2622 #endif |
f8222d1f9a73
Included patch for persistent undo. Lots of changes and added test.
Bram Moolenaar <bram@vim.org>
parents:
2184
diff
changeset
|
2623 SCRIPTID_INIT}, |
f8222d1f9a73
Included patch for persistent undo. Lots of changes and added test.
Bram Moolenaar <bram@vim.org>
parents:
2184
diff
changeset
|
2624 {"undofile", "udf", P_BOOL|P_VI_DEF|P_VIM, |
f8222d1f9a73
Included patch for persistent undo. Lots of changes and added test.
Bram Moolenaar <bram@vim.org>
parents:
2184
diff
changeset
|
2625 #ifdef FEAT_PERSISTENT_UNDO |
f8222d1f9a73
Included patch for persistent undo. Lots of changes and added test.
Bram Moolenaar <bram@vim.org>
parents:
2184
diff
changeset
|
2626 (char_u *)&p_udf, PV_UDF, |
f8222d1f9a73
Included patch for persistent undo. Lots of changes and added test.
Bram Moolenaar <bram@vim.org>
parents:
2184
diff
changeset
|
2627 #else |
f8222d1f9a73
Included patch for persistent undo. Lots of changes and added test.
Bram Moolenaar <bram@vim.org>
parents:
2184
diff
changeset
|
2628 (char_u *)NULL, PV_NONE, |
f8222d1f9a73
Included patch for persistent undo. Lots of changes and added test.
Bram Moolenaar <bram@vim.org>
parents:
2184
diff
changeset
|
2629 #endif |
f8222d1f9a73
Included patch for persistent undo. Lots of changes and added test.
Bram Moolenaar <bram@vim.org>
parents:
2184
diff
changeset
|
2630 {(char_u *)FALSE, (char_u *)0L} SCRIPTID_INIT}, |
7 | 2631 {"undolevels", "ul", P_NUM|P_VI_DEF, |
2632 (char_u *)&p_ul, PV_NONE, | |
2633 { | |
2634 #if defined(UNIX) || defined(WIN3264) || defined(OS2) || defined(VMS) | |
2635 (char_u *)1000L, | |
2636 #else | |
2637 (char_u *)100L, | |
2638 #endif | |
1883 | 2639 (char_u *)0L} SCRIPTID_INIT}, |
7 | 2640 {"updatecount", "uc", P_NUM|P_VI_DEF, |
2641 (char_u *)&p_uc, PV_NONE, | |
1883 | 2642 {(char_u *)200L, (char_u *)0L} SCRIPTID_INIT}, |
7 | 2643 {"updatetime", "ut", P_NUM|P_VI_DEF, |
2644 (char_u *)&p_ut, PV_NONE, | |
1883 | 2645 {(char_u *)4000L, (char_u *)0L} SCRIPTID_INIT}, |
7 | 2646 {"verbose", "vbs", P_NUM|P_VI_DEF, |
2647 (char_u *)&p_verbose, PV_NONE, | |
1883 | 2648 {(char_u *)0L, (char_u *)0L} SCRIPTID_INIT}, |
294 | 2649 {"verbosefile", "vfile", P_STRING|P_EXPAND|P_VI_DEF|P_SECURE, |
2650 (char_u *)&p_vfile, PV_NONE, | |
1883 | 2651 {(char_u *)"", (char_u *)0L} SCRIPTID_INIT}, |
7 | 2652 {"viewdir", "vdir", P_STRING|P_EXPAND|P_VI_DEF|P_SECURE, |
2653 #ifdef FEAT_SESSION | |
2654 (char_u *)&p_vdir, PV_NONE, | |
2655 {(char_u *)DFLT_VDIR, (char_u *)0L} | |
2656 #else | |
2657 (char_u *)NULL, PV_NONE, | |
2658 {(char_u *)0L, (char_u *)0L} | |
2659 #endif | |
1883 | 2660 SCRIPTID_INIT}, |
7 | 2661 {"viewoptions", "vop", P_STRING|P_VI_DEF|P_COMMA|P_NODUP, |
2662 #ifdef FEAT_SESSION | |
2663 (char_u *)&p_vop, PV_NONE, | |
2664 {(char_u *)"folds,options,cursor", (char_u *)0L} | |
2665 #else | |
2666 (char_u *)NULL, PV_NONE, | |
2667 {(char_u *)0L, (char_u *)0L} | |
2668 #endif | |
1883 | 2669 SCRIPTID_INIT}, |
7 | 2670 {"viminfo", "vi", P_STRING|P_COMMA|P_NODUP|P_SECURE, |
2671 #ifdef FEAT_VIMINFO | |
2672 (char_u *)&p_viminfo, PV_NONE, | |
2673 #if defined(MSDOS) || defined(MSWIN) || defined(OS2) | |
1733 | 2674 {(char_u *)"", (char_u *)"'100,<50,s10,h,rA:,rB:"} |
7 | 2675 #else |
2676 # ifdef AMIGA | |
2677 {(char_u *)"", | |
1733 | 2678 (char_u *)"'100,<50,s10,h,rdf0:,rdf1:,rdf2:"} |
7 | 2679 # else |
1733 | 2680 {(char_u *)"", (char_u *)"'100,<50,s10,h"} |
7 | 2681 # endif |
2682 #endif | |
2683 #else | |
2684 (char_u *)NULL, PV_NONE, | |
2685 {(char_u *)0L, (char_u *)0L} | |
2686 #endif | |
1883 | 2687 SCRIPTID_INIT}, |
7 | 2688 {"virtualedit", "ve", P_STRING|P_COMMA|P_NODUP|P_VI_DEF|P_VIM, |
2689 #ifdef FEAT_VIRTUALEDIT | |
2690 (char_u *)&p_ve, PV_NONE, | |
2691 {(char_u *)"", (char_u *)""} | |
2692 #else | |
2693 (char_u *)NULL, PV_NONE, | |
2694 {(char_u *)0L, (char_u *)0L} | |
2695 #endif | |
1883 | 2696 SCRIPTID_INIT}, |
7 | 2697 {"visualbell", "vb", P_BOOL|P_VI_DEF, |
2698 (char_u *)&p_vb, PV_NONE, | |
1883 | 2699 {(char_u *)FALSE, (char_u *)0L} SCRIPTID_INIT}, |
7 | 2700 {"w300", NULL, P_NUM|P_VI_DEF, |
2701 (char_u *)NULL, PV_NONE, | |
1883 | 2702 {(char_u *)0L, (char_u *)0L} SCRIPTID_INIT}, |
7 | 2703 {"w1200", NULL, P_NUM|P_VI_DEF, |
2704 (char_u *)NULL, PV_NONE, | |
1883 | 2705 {(char_u *)0L, (char_u *)0L} SCRIPTID_INIT}, |
7 | 2706 {"w9600", NULL, P_NUM|P_VI_DEF, |
2707 (char_u *)NULL, PV_NONE, | |
1883 | 2708 {(char_u *)0L, (char_u *)0L} SCRIPTID_INIT}, |
7 | 2709 {"warn", NULL, P_BOOL|P_VI_DEF, |
2710 (char_u *)&p_warn, PV_NONE, | |
1883 | 2711 {(char_u *)TRUE, (char_u *)0L} SCRIPTID_INIT}, |
7 | 2712 {"weirdinvert", "wiv", P_BOOL|P_VI_DEF|P_RCLR, |
2713 (char_u *)&p_wiv, PV_NONE, | |
1883 | 2714 {(char_u *)FALSE, (char_u *)0L} SCRIPTID_INIT}, |
7 | 2715 {"whichwrap", "ww", P_STRING|P_VIM|P_COMMA|P_FLAGLIST, |
2716 (char_u *)&p_ww, PV_NONE, | |
1883 | 2717 {(char_u *)"", (char_u *)"b,s"} SCRIPTID_INIT}, |
7 | 2718 {"wildchar", "wc", P_NUM|P_VIM, |
2719 (char_u *)&p_wc, PV_NONE, | |
1883 | 2720 {(char_u *)(long)Ctrl_E, (char_u *)(long)TAB} |
2721 SCRIPTID_INIT}, | |
7 | 2722 {"wildcharm", "wcm", P_NUM|P_VI_DEF, |
2723 (char_u *)&p_wcm, PV_NONE, | |
1883 | 2724 {(char_u *)0L, (char_u *)0L} SCRIPTID_INIT}, |
7 | 2725 {"wildignore", "wig", P_STRING|P_VI_DEF|P_COMMA|P_NODUP, |
2726 #ifdef FEAT_WILDIGN | |
2727 (char_u *)&p_wig, PV_NONE, | |
2728 #else | |
2729 (char_u *)NULL, PV_NONE, | |
2730 #endif | |
1883 | 2731 {(char_u *)"", (char_u *)0L} SCRIPTID_INIT}, |
7 | 2732 {"wildmenu", "wmnu", P_BOOL|P_VI_DEF, |
2733 #ifdef FEAT_WILDMENU | |
2734 (char_u *)&p_wmnu, PV_NONE, | |
2735 #else | |
2736 (char_u *)NULL, PV_NONE, | |
2737 #endif | |
1883 | 2738 {(char_u *)FALSE, (char_u *)0L} SCRIPTID_INIT}, |
7 | 2739 {"wildmode", "wim", P_STRING|P_VI_DEF|P_COMMA|P_NODUP, |
2740 (char_u *)&p_wim, PV_NONE, | |
1883 | 2741 {(char_u *)"full", (char_u *)0L} SCRIPTID_INIT}, |
40 | 2742 {"wildoptions", "wop", P_STRING|P_VI_DEF, |
2743 #ifdef FEAT_CMDL_COMPL | |
2744 (char_u *)&p_wop, PV_NONE, | |
2745 {(char_u *)"", (char_u *)0L} | |
2746 #else | |
2747 (char_u *)NULL, PV_NONE, | |
2748 {(char_u *)NULL, (char_u *)0L} | |
2749 #endif | |
1883 | 2750 SCRIPTID_INIT}, |
7 | 2751 {"winaltkeys", "wak", P_STRING|P_VI_DEF, |
2752 #ifdef FEAT_WAK | |
2753 (char_u *)&p_wak, PV_NONE, | |
2754 {(char_u *)"menu", (char_u *)0L} | |
2755 #else | |
2756 (char_u *)NULL, PV_NONE, | |
2757 {(char_u *)NULL, (char_u *)0L} | |
2758 #endif | |
1883 | 2759 SCRIPTID_INIT}, |
7 | 2760 {"window", "wi", P_NUM|P_VI_DEF, |
164 | 2761 (char_u *)&p_window, PV_NONE, |
1883 | 2762 {(char_u *)0L, (char_u *)0L} SCRIPTID_INIT}, |
7 | 2763 {"winheight", "wh", P_NUM|P_VI_DEF, |
2764 #ifdef FEAT_WINDOWS | |
2765 (char_u *)&p_wh, PV_NONE, | |
2766 #else | |
2767 (char_u *)NULL, PV_NONE, | |
2768 #endif | |
1883 | 2769 {(char_u *)1L, (char_u *)0L} SCRIPTID_INIT}, |
7 | 2770 {"winfixheight", "wfh", P_BOOL|P_VI_DEF|P_RSTAT, |
694 | 2771 #ifdef FEAT_WINDOWS |
7 | 2772 (char_u *)VAR_WIN, PV_WFH, |
2773 #else | |
2774 (char_u *)NULL, PV_NONE, | |
2775 #endif | |
1883 | 2776 {(char_u *)FALSE, (char_u *)0L} SCRIPTID_INIT}, |
782 | 2777 {"winfixwidth", "wfw", P_BOOL|P_VI_DEF|P_RSTAT, |
2778 #ifdef FEAT_VERTSPLIT | |
2779 (char_u *)VAR_WIN, PV_WFW, | |
2780 #else | |
2781 (char_u *)NULL, PV_NONE, | |
2782 #endif | |
1883 | 2783 {(char_u *)FALSE, (char_u *)0L} SCRIPTID_INIT}, |
7 | 2784 {"winminheight", "wmh", P_NUM|P_VI_DEF, |
2785 #ifdef FEAT_WINDOWS | |
2786 (char_u *)&p_wmh, PV_NONE, | |
2787 #else | |
2788 (char_u *)NULL, PV_NONE, | |
2789 #endif | |
1883 | 2790 {(char_u *)1L, (char_u *)0L} SCRIPTID_INIT}, |
7 | 2791 {"winminwidth", "wmw", P_NUM|P_VI_DEF, |
2792 #ifdef FEAT_VERTSPLIT | |
2793 (char_u *)&p_wmw, PV_NONE, | |
2794 #else | |
2795 (char_u *)NULL, PV_NONE, | |
2796 #endif | |
1883 | 2797 {(char_u *)1L, (char_u *)0L} SCRIPTID_INIT}, |
7 | 2798 {"winwidth", "wiw", P_NUM|P_VI_DEF, |
2799 #ifdef FEAT_VERTSPLIT | |
2800 (char_u *)&p_wiw, PV_NONE, | |
2801 #else | |
2802 (char_u *)NULL, PV_NONE, | |
2803 #endif | |
1883 | 2804 {(char_u *)20L, (char_u *)0L} SCRIPTID_INIT}, |
7 | 2805 {"wrap", NULL, P_BOOL|P_VI_DEF|P_RWIN, |
2806 (char_u *)VAR_WIN, PV_WRAP, | |
1883 | 2807 {(char_u *)TRUE, (char_u *)0L} SCRIPTID_INIT}, |
7 | 2808 {"wrapmargin", "wm", P_NUM|P_VI_DEF, |
2809 (char_u *)&p_wm, PV_WM, | |
1883 | 2810 {(char_u *)0L, (char_u *)0L} SCRIPTID_INIT}, |
7 | 2811 {"wrapscan", "ws", P_BOOL|P_VI_DEF, |
2812 (char_u *)&p_ws, PV_NONE, | |
1883 | 2813 {(char_u *)TRUE, (char_u *)0L} SCRIPTID_INIT}, |
7 | 2814 {"write", NULL, P_BOOL|P_VI_DEF, |
2815 (char_u *)&p_write, PV_NONE, | |
1883 | 2816 {(char_u *)TRUE, (char_u *)0L} SCRIPTID_INIT}, |
7 | 2817 {"writeany", "wa", P_BOOL|P_VI_DEF, |
2818 (char_u *)&p_wa, PV_NONE, | |
1883 | 2819 {(char_u *)FALSE, (char_u *)0L} SCRIPTID_INIT}, |
7 | 2820 {"writebackup", "wb", P_BOOL|P_VI_DEF|P_VIM, |
2821 (char_u *)&p_wb, PV_NONE, | |
2822 { | |
2823 #ifdef FEAT_WRITEBACKUP | |
2824 (char_u *)TRUE, | |
2825 #else | |
2826 (char_u *)FALSE, | |
2827 #endif | |
1883 | 2828 (char_u *)0L} SCRIPTID_INIT}, |
7 | 2829 {"writedelay", "wd", P_NUM|P_VI_DEF, |
2830 (char_u *)&p_wd, PV_NONE, | |
1883 | 2831 {(char_u *)0L, (char_u *)0L} SCRIPTID_INIT}, |
7 | 2832 |
2833 /* terminal output codes */ | |
36 | 2834 #define p_term(sss, vvv) {sss, NULL, P_STRING|P_VI_DEF|P_RALL|P_SECURE, \ |
7 | 2835 (char_u *)&vvv, PV_NONE, \ |
1883 | 2836 {(char_u *)"", (char_u *)0L} SCRIPTID_INIT}, |
7 | 2837 |
2838 p_term("t_AB", T_CAB) | |
2839 p_term("t_AF", T_CAF) | |
2840 p_term("t_AL", T_CAL) | |
2841 p_term("t_al", T_AL) | |
2842 p_term("t_bc", T_BC) | |
2843 p_term("t_cd", T_CD) | |
2844 p_term("t_ce", T_CE) | |
2845 p_term("t_cl", T_CL) | |
2846 p_term("t_cm", T_CM) | |
2847 p_term("t_Co", T_CCO) | |
2848 p_term("t_CS", T_CCS) | |
2849 p_term("t_cs", T_CS) | |
2850 #ifdef FEAT_VERTSPLIT | |
2851 p_term("t_CV", T_CSV) | |
2852 #endif | |
2853 p_term("t_ut", T_UT) | |
2854 p_term("t_da", T_DA) | |
2855 p_term("t_db", T_DB) | |
2856 p_term("t_DL", T_CDL) | |
2857 p_term("t_dl", T_DL) | |
2858 p_term("t_fs", T_FS) | |
2859 p_term("t_IE", T_CIE) | |
2860 p_term("t_IS", T_CIS) | |
2861 p_term("t_ke", T_KE) | |
2862 p_term("t_ks", T_KS) | |
2863 p_term("t_le", T_LE) | |
2864 p_term("t_mb", T_MB) | |
2865 p_term("t_md", T_MD) | |
2866 p_term("t_me", T_ME) | |
2867 p_term("t_mr", T_MR) | |
2868 p_term("t_ms", T_MS) | |
2869 p_term("t_nd", T_ND) | |
2870 p_term("t_op", T_OP) | |
2871 p_term("t_RI", T_CRI) | |
2872 p_term("t_RV", T_CRV) | |
2873 p_term("t_Sb", T_CSB) | |
2874 p_term("t_Sf", T_CSF) | |
2875 p_term("t_se", T_SE) | |
2876 p_term("t_so", T_SO) | |
2877 p_term("t_sr", T_SR) | |
2878 p_term("t_ts", T_TS) | |
2879 p_term("t_te", T_TE) | |
2880 p_term("t_ti", T_TI) | |
2881 p_term("t_ue", T_UE) | |
2882 p_term("t_us", T_US) | |
2883 p_term("t_vb", T_VB) | |
2884 p_term("t_ve", T_VE) | |
2885 p_term("t_vi", T_VI) | |
2886 p_term("t_vs", T_VS) | |
2887 p_term("t_WP", T_CWP) | |
2888 p_term("t_WS", T_CWS) | |
36 | 2889 p_term("t_SI", T_CSI) |
2890 p_term("t_EI", T_CEI) | |
7 | 2891 p_term("t_xs", T_XS) |
2892 p_term("t_ZH", T_CZH) | |
2893 p_term("t_ZR", T_CZR) | |
2894 | |
2895 /* terminal key codes are not in here */ | |
2896 | |
1883 | 2897 /* end marker */ |
2898 {NULL, NULL, 0, NULL, PV_NONE, {NULL, NULL} SCRIPTID_INIT} | |
7 | 2899 }; |
2900 | |
2901 #define PARAM_COUNT (sizeof(options) / sizeof(struct vimoption)) | |
2902 | |
2903 #ifdef FEAT_MBYTE | |
2904 static char *(p_ambw_values[]) = {"single", "double", NULL}; | |
2905 #endif | |
2906 static char *(p_bg_values[]) = {"light", "dark", NULL}; | |
2907 static char *(p_nf_values[]) = {"octal", "hex", "alpha", NULL}; | |
2908 static char *(p_ff_values[]) = {FF_UNIX, FF_DOS, FF_MAC, NULL}; | |
40 | 2909 #ifdef FEAT_CMDL_COMPL |
2910 static char *(p_wop_values[]) = {"tagfile", NULL}; | |
2911 #endif | |
7 | 2912 #ifdef FEAT_WAK |
2913 static char *(p_wak_values[]) = {"yes", "menu", "no", NULL}; | |
2914 #endif | |
2915 static char *(p_mousem_values[]) = {"extend", "popup", "popup_setpos", "mac", NULL}; | |
2916 #ifdef FEAT_VISUAL | |
2917 static char *(p_sel_values[]) = {"inclusive", "exclusive", "old", NULL}; | |
2918 static char *(p_slm_values[]) = {"mouse", "key", "cmd", NULL}; | |
2919 #endif | |
2920 #ifdef FEAT_VISUAL | |
2921 static char *(p_km_values[]) = {"startsel", "stopsel", NULL}; | |
2922 #endif | |
2923 #ifdef FEAT_BROWSE | |
2924 static char *(p_bsdir_values[]) = {"current", "last", "buffer", NULL}; | |
2925 #endif | |
2926 #ifdef FEAT_SCROLLBIND | |
2927 static char *(p_scbopt_values[]) = {"ver", "hor", "jump", NULL}; | |
2928 #endif | |
839 | 2929 static char *(p_debug_values[]) = {"msg", "throw", "beep", NULL}; |
7 | 2930 #ifdef FEAT_VERTSPLIT |
2931 static char *(p_ead_values[]) = {"both", "ver", "hor", NULL}; | |
2932 #endif | |
2933 #if defined(FEAT_QUICKFIX) | |
17 | 2934 # ifdef FEAT_AUTOCMD |
2935 static char *(p_buftype_values[]) = {"nofile", "nowrite", "quickfix", "help", "acwrite", NULL}; | |
2936 # else | |
7 | 2937 static char *(p_buftype_values[]) = {"nofile", "nowrite", "quickfix", "help", NULL}; |
17 | 2938 # endif |
7 | 2939 static char *(p_bufhidden_values[]) = {"hide", "unload", "delete", "wipe", NULL}; |
2940 #endif | |
2941 static char *(p_bs_values[]) = {"indent", "eol", "start", NULL}; | |
2942 #ifdef FEAT_FOLDING | |
2943 static char *(p_fdm_values[]) = {"manual", "expr", "marker", "indent", "syntax", | |
540 | 2944 # ifdef FEAT_DIFF |
7 | 2945 "diff", |
540 | 2946 # endif |
7 | 2947 NULL}; |
2948 static char *(p_fcl_values[]) = {"all", NULL}; | |
2949 #endif | |
540 | 2950 #ifdef FEAT_INS_EXPAND |
731 | 2951 static char *(p_cot_values[]) = {"menu", "menuone", "longest", "preview", NULL}; |
540 | 2952 #endif |
7 | 2953 |
2954 static void set_option_default __ARGS((int, int opt_flags, int compatible)); | |
2955 static void set_options_default __ARGS((int opt_flags)); | |
671 | 2956 static char_u *term_bg_default __ARGS((void)); |
634 | 2957 static void did_set_option __ARGS((int opt_idx, int opt_flags, int new_value)); |
7 | 2958 static char_u *illegal_char __ARGS((char_u *, int)); |
2959 static int string_to_key __ARGS((char_u *arg)); | |
2960 #ifdef FEAT_CMDWIN | |
2961 static char_u *check_cedit __ARGS((void)); | |
2962 #endif | |
2963 #ifdef FEAT_TITLE | |
2964 static void did_set_title __ARGS((int icon)); | |
2965 #endif | |
2966 static char_u *option_expand __ARGS((int opt_idx, char_u *val)); | |
2967 static void didset_options __ARGS((void)); | |
2968 static void check_string_option __ARGS((char_u **pp)); | |
681 | 2969 #if defined(FEAT_EVAL) || defined(PROTO) |
2970 static long_u *insecure_flag __ARGS((int opt_idx, int opt_flags)); | |
2971 #else | |
2972 # define insecure_flag(opt_idx, opt_flags) (&options[opt_idx].flags) | |
2973 #endif | |
7 | 2974 static void set_string_option_global __ARGS((int opt_idx, char_u **varp)); |
2975 static void set_string_option __ARGS((int opt_idx, char_u *value, int opt_flags)); | |
2976 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)); | |
2977 static char_u *set_chars_option __ARGS((char_u **varp)); | |
2978 #ifdef FEAT_CLIPBOARD | |
2979 static char_u *check_clipboard_option __ARGS((void)); | |
2980 #endif | |
744 | 2981 #ifdef FEAT_SPELL |
2250
1bac28a53fae
Add the conceal patch from Vince Negri.
Bram Moolenaar <bram@vim.org>
parents:
2248
diff
changeset
|
2982 static char_u *compile_cap_prog __ARGS((synblock_T *synblock)); |
386 | 2983 #endif |
694 | 2984 #ifdef FEAT_EVAL |
2985 static void set_option_scriptID_idx __ARGS((int opt_idx, int opt_flags, int id)); | |
2986 #endif | |
7 | 2987 static char_u *set_bool_option __ARGS((int opt_idx, char_u *varp, int value, int opt_flags)); |
274 | 2988 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 | 2989 static void check_redraw __ARGS((long_u flags)); |
2990 static int findoption __ARGS((char_u *)); | |
2991 static int find_key_option __ARGS((char_u *)); | |
2992 static void showoptions __ARGS((int all, int opt_flags)); | |
2993 static int optval_default __ARGS((struct vimoption *, char_u *varp)); | |
2994 static void showoneopt __ARGS((struct vimoption *, int opt_flags)); | |
2995 static int put_setstring __ARGS((FILE *fd, char *cmd, char *name, char_u **valuep, int expand)); | |
2996 static int put_setnum __ARGS((FILE *fd, char *cmd, char *name, long *valuep)); | |
2997 static int put_setbool __ARGS((FILE *fd, char *cmd, char *name, int value)); | |
2998 static int istermoption __ARGS((struct vimoption *)); | |
2999 static char_u *get_varp_scope __ARGS((struct vimoption *p, int opt_flags)); | |
3000 static char_u *get_varp __ARGS((struct vimoption *)); | |
3001 static void option_value2string __ARGS((struct vimoption *, int opt_flags)); | |
3002 static int wc_use_keyname __ARGS((char_u *varp, long *wcp)); | |
3003 #ifdef FEAT_LANGMAP | |
3004 static void langmap_init __ARGS((void)); | |
3005 static void langmap_set __ARGS((void)); | |
3006 #endif | |
3007 static void paste_option_changed __ARGS((void)); | |
3008 static void compatible_set __ARGS((void)); | |
3009 #ifdef FEAT_LINEBREAK | |
3010 static void fill_breakat_flags __ARGS((void)); | |
3011 #endif | |
3012 static int opt_strings_flags __ARGS((char_u *val, char **values, unsigned *flagp, int list)); | |
3013 static int check_opt_strings __ARGS((char_u *val, char **values, int)); | |
3014 static int check_opt_wim __ARGS((void)); | |
3015 | |
3016 /* | |
3017 * Initialize the options, first part. | |
3018 * | |
3019 * Called only once from main(), just after creating the first buffer. | |
3020 */ | |
3021 void | |
3022 set_init_1() | |
3023 { | |
3024 char_u *p; | |
3025 int opt_idx; | |
835 | 3026 long_u n; |
7 | 3027 |
3028 #ifdef FEAT_LANGMAP | |
3029 langmap_init(); | |
3030 #endif | |
3031 | |
3032 /* Be Vi compatible by default */ | |
3033 p_cp = TRUE; | |
3034 | |
164 | 3035 /* Use POSIX compatibility when $VIM_POSIX is set. */ |
3036 if (mch_getenv((char_u *)"VIM_POSIX") != NULL) | |
168 | 3037 { |
164 | 3038 set_string_default("cpo", (char_u *)CPO_ALL); |
168 | 3039 set_string_default("shm", (char_u *)"A"); |
3040 } | |
164 | 3041 |
7 | 3042 /* |
3043 * Find default value for 'shell' option. | |
161 | 3044 * Don't use it if it is empty. |
7 | 3045 */ |
161 | 3046 if (((p = mch_getenv((char_u *)"SHELL")) != NULL && *p != NUL) |
7 | 3047 #if defined(MSDOS) || defined(MSWIN) || defined(OS2) |
3048 # ifdef __EMX__ | |
161 | 3049 || ((p = mch_getenv((char_u *)"EMXSHELL")) != NULL && *p != NUL) |
7 | 3050 # endif |
161 | 3051 || ((p = mch_getenv((char_u *)"COMSPEC")) != NULL && *p != NUL) |
7 | 3052 # ifdef WIN3264 |
161 | 3053 || ((p = default_shell()) != NULL && *p != NUL) |
7 | 3054 # endif |
3055 #endif | |
161 | 3056 ) |
7 | 3057 set_string_default("sh", p); |
3058 | |
3059 #ifdef FEAT_WILDIGN | |
3060 /* | |
3061 * Set the default for 'backupskip' to include environment variables for | |
3062 * temp files. | |
3063 */ | |
3064 { | |
3065 # ifdef UNIX | |
3066 static char *(names[4]) = {"", "TMPDIR", "TEMP", "TMP"}; | |
3067 # else | |
3068 static char *(names[3]) = {"TMPDIR", "TEMP", "TMP"}; | |
3069 # endif | |
170 | 3070 int len; |
3071 garray_T ga; | |
3072 int mustfree; | |
7 | 3073 |
3074 ga_init2(&ga, 1, 100); | |
3075 for (n = 0; n < (long)(sizeof(names) / sizeof(char *)); ++n) | |
3076 { | |
170 | 3077 mustfree = FALSE; |
7 | 3078 # ifdef UNIX |
3079 if (*names[n] == NUL) | |
3080 p = (char_u *)"/tmp"; | |
3081 else | |
3082 # endif | |
170 | 3083 p = vim_getenv((char_u *)names[n], &mustfree); |
7 | 3084 if (p != NULL && *p != NUL) |
3085 { | |
3086 /* First time count the NUL, otherwise count the ','. */ | |
835 | 3087 len = (int)STRLEN(p) + 3; |
7 | 3088 if (ga_grow(&ga, len) == OK) |
3089 { | |
3090 if (ga.ga_len > 0) | |
3091 STRCAT(ga.ga_data, ","); | |
3092 STRCAT(ga.ga_data, p); | |
3093 add_pathsep(ga.ga_data); | |
3094 STRCAT(ga.ga_data, "*"); | |
3095 ga.ga_len += len; | |
3096 } | |
3097 } | |
170 | 3098 if (mustfree) |
3099 vim_free(p); | |
7 | 3100 } |
3101 if (ga.ga_data != NULL) | |
3102 { | |
3103 set_string_default("bsk", ga.ga_data); | |
3104 vim_free(ga.ga_data); | |
3105 } | |
3106 } | |
3107 #endif | |
3108 | |
3109 /* | |
3110 * 'maxmemtot' and 'maxmem' may have to be adjusted for available memory | |
3111 */ | |
3112 opt_idx = findoption((char_u *)"maxmemtot"); | |
838 | 3113 if (opt_idx >= 0) |
3114 { | |
7 | 3115 #if !defined(HAVE_AVAIL_MEM) && !defined(HAVE_TOTAL_MEM) |
838 | 3116 if (options[opt_idx].def_val[VI_DEFAULT] == (char_u *)0L) |
3117 #endif | |
3118 { | |
7 | 3119 #ifdef HAVE_AVAIL_MEM |
838 | 3120 /* Use amount of memory available at this moment. */ |
3121 n = (mch_avail_mem(FALSE) >> 11); | |
7 | 3122 #else |
3123 # ifdef HAVE_TOTAL_MEM | |
838 | 3124 /* Use amount of memory available to Vim. */ |
1110 | 3125 n = (mch_total_mem(FALSE) >> 1); |
7 | 3126 # else |
838 | 3127 n = (0x7fffffff >> 11); |
7 | 3128 # endif |
3129 #endif | |
3130 options[opt_idx].def_val[VI_DEFAULT] = (char_u *)n; | |
838 | 3131 opt_idx = findoption((char_u *)"maxmem"); |
3132 if (opt_idx >= 0) | |
3133 { | |
3134 #if !defined(HAVE_AVAIL_MEM) && !defined(HAVE_TOTAL_MEM) | |
3135 if ((long)options[opt_idx].def_val[VI_DEFAULT] > n | |
3136 || (long)options[opt_idx].def_val[VI_DEFAULT] == 0L) | |
3137 #endif | |
3138 options[opt_idx].def_val[VI_DEFAULT] = (char_u *)n; | |
3139 } | |
3140 } | |
7 | 3141 } |
3142 | |
3143 #ifdef FEAT_GUI_W32 | |
3144 /* force 'shortname' for Win32s */ | |
3145 if (gui_is_win32s()) | |
838 | 3146 { |
3147 opt_idx = findoption((char_u *)"shortname"); | |
3148 if (opt_idx >= 0) | |
3149 options[opt_idx].def_val[VI_DEFAULT] = (char_u *)TRUE; | |
3150 } | |
7 | 3151 #endif |
3152 | |
3153 #ifdef FEAT_SEARCHPATH | |
3154 { | |
3155 char_u *cdpath; | |
3156 char_u *buf; | |
3157 int i; | |
3158 int j; | |
170 | 3159 int mustfree = FALSE; |
7 | 3160 |
3161 /* Initialize the 'cdpath' option's default value. */ | |
170 | 3162 cdpath = vim_getenv((char_u *)"CDPATH", &mustfree); |
7 | 3163 if (cdpath != NULL) |
3164 { | |
3165 buf = alloc((unsigned)((STRLEN(cdpath) << 1) + 2)); | |
3166 if (buf != NULL) | |
3167 { | |
3168 buf[0] = ','; /* start with ",", current dir first */ | |
3169 j = 1; | |
3170 for (i = 0; cdpath[i] != NUL; ++i) | |
3171 { | |
3172 if (vim_ispathlistsep(cdpath[i])) | |
3173 buf[j++] = ','; | |
3174 else | |
3175 { | |
3176 if (cdpath[i] == ' ' || cdpath[i] == ',') | |
3177 buf[j++] = '\\'; | |
3178 buf[j++] = cdpath[i]; | |
3179 } | |
3180 } | |
3181 buf[j] = NUL; | |
3182 opt_idx = findoption((char_u *)"cdpath"); | |
838 | 3183 if (opt_idx >= 0) |
3184 { | |
3185 options[opt_idx].def_val[VI_DEFAULT] = buf; | |
3186 options[opt_idx].flags |= P_DEF_ALLOCED; | |
3187 } | |
7 | 3188 } |
170 | 3189 if (mustfree) |
3190 vim_free(cdpath); | |
7 | 3191 } |
3192 } | |
3193 #endif | |
3194 | |
3195 #if defined(FEAT_POSTSCRIPT) && (defined(MSWIN) || defined(OS2) || defined(VMS) || defined(EBCDIC) || defined(MAC) || defined(hpux)) | |
3196 /* Set print encoding on platforms that don't default to latin1 */ | |
3197 set_string_default("penc", | |
3198 # if defined(MSWIN) || defined(OS2) | |
3199 (char_u *)"cp1252" | |
3200 # else | |
3201 # ifdef VMS | |
3202 (char_u *)"dec-mcs" | |
3203 # else | |
3204 # ifdef EBCDIC | |
3205 (char_u *)"ebcdic-uk" | |
3206 # else | |
3207 # ifdef MAC | |
3208 (char_u *)"mac-roman" | |
3209 # else /* HPUX */ | |
3210 (char_u *)"hp-roman8" | |
3211 # endif | |
3212 # endif | |
3213 # endif | |
3214 # endif | |
3215 ); | |
3216 #endif | |
3217 | |
3218 #ifdef FEAT_POSTSCRIPT | |
3219 /* 'printexpr' must be allocated to be able to evaluate it. */ | |
3220 set_string_default("pexpr", | |
8 | 3221 # if defined(MSWIN) || defined(MSDOS) || defined(OS2) |
3222 (char_u *)"system('copy' . ' ' . v:fname_in . (&printdevice == '' ? ' LPT1:' : (' \"' . &printdevice . '\"'))) . delete(v:fname_in)" | |
7 | 3223 # else |
3224 # ifdef VMS | |
3225 (char_u *)"system('print/delete' . (&printdevice == '' ? '' : ' /queue=' . &printdevice) . ' ' . v:fname_in)" | |
3226 | |
3227 # else | |
3228 (char_u *)"system('lpr' . (&printdevice == '' ? '' : ' -P' . &printdevice) . ' ' . v:fname_in) . delete(v:fname_in) + v:shell_error" | |
3229 # endif | |
3230 # endif | |
3231 ); | |
3232 #endif | |
3233 | |
3234 /* | |
3235 * Set all the options (except the terminal options) to their default | |
3236 * value. Also set the global value for local options. | |
3237 */ | |
3238 set_options_default(0); | |
3239 | |
3240 #ifdef FEAT_GUI | |
3241 if (found_reverse_arg) | |
3242 set_option_value((char_u *)"bg", 0L, (char_u *)"dark", 0); | |
3243 #endif | |
3244 | |
3245 curbuf->b_p_initialized = TRUE; | |
3246 curbuf->b_p_ar = -1; /* no local 'autoread' value */ | |
3247 check_buf_options(curbuf); | |
3248 check_win_options(curwin); | |
3249 check_options(); | |
3250 | |
3251 /* Must be before option_expand(), because that one needs vim_isIDc() */ | |
3252 didset_options(); | |
3253 | |
744 | 3254 #ifdef FEAT_SPELL |
227 | 3255 /* Use the current chartab for the generic chartab. */ |
3256 init_spell_chartab(); | |
3257 #endif | |
3258 | |
7 | 3259 #ifdef FEAT_LINEBREAK |
3260 /* | |
3261 * initialize the table for 'breakat'. | |
3262 */ | |
3263 fill_breakat_flags(); | |
3264 #endif | |
3265 | |
3266 /* | |
3267 * Expand environment variables and things like "~" for the defaults. | |
3268 * If option_expand() returns non-NULL the variable is expanded. This can | |
3269 * only happen for non-indirect options. | |
3270 * Also set the default to the expanded value, so ":set" does not list | |
3271 * them. | |
3272 * Don't set the P_ALLOCED flag, because we don't want to free the | |
3273 * default. | |
3274 */ | |
3275 for (opt_idx = 0; !istermoption(&options[opt_idx]); opt_idx++) | |
3276 { | |
3277 if ((options[opt_idx].flags & P_GETTEXT) | |
3278 && options[opt_idx].var != NULL) | |
3279 p = (char_u *)_(*(char **)options[opt_idx].var); | |
3280 else | |
3281 p = option_expand(opt_idx, NULL); | |
3282 if (p != NULL && (p = vim_strsave(p)) != NULL) | |
3283 { | |
3284 *(char_u **)options[opt_idx].var = p; | |
3285 /* VIMEXP | |
3286 * Defaults for all expanded options are currently the same for Vi | |
3287 * and Vim. When this changes, add some code here! Also need to | |
3288 * split P_DEF_ALLOCED in two. | |
3289 */ | |
3290 if (options[opt_idx].flags & P_DEF_ALLOCED) | |
3291 vim_free(options[opt_idx].def_val[VI_DEFAULT]); | |
3292 options[opt_idx].def_val[VI_DEFAULT] = p; | |
3293 options[opt_idx].flags |= P_DEF_ALLOCED; | |
3294 } | |
3295 } | |
3296 | |
3297 /* Initialize the highlight_attr[] table. */ | |
3298 highlight_changed(); | |
3299 | |
3300 save_file_ff(curbuf); /* Buffer is unchanged */ | |
3301 | |
3302 /* Parse default for 'wildmode' */ | |
3303 check_opt_wim(); | |
3304 | |
3305 #if defined(FEAT_ARABIC) | |
3306 /* Detect use of mlterm. | |
3307 * Mlterm is a terminal emulator akin to xterm that has some special | |
3308 * abilities (bidi namely). | |
3309 * NOTE: mlterm's author is being asked to 'set' a variable | |
3310 * instead of an environment variable due to inheritance. | |
3311 */ | |
3312 if (mch_getenv((char_u *)"MLTERM") != NULL) | |
3313 set_option_value((char_u *)"tbidi", 1L, NULL, 0); | |
3314 #endif | |
3315 | |
3316 #if defined(FEAT_WINDOWS) || defined(FEAT_FOLDING) | |
3317 /* Parse default for 'fillchars'. */ | |
3318 (void)set_chars_option(&p_fcs); | |
3319 #endif | |
3320 | |
3321 #ifdef FEAT_CLIPBOARD | |
3322 /* Parse default for 'clipboard' */ | |
3323 (void)check_clipboard_option(); | |
3324 #endif | |
3325 | |
3326 #ifdef FEAT_MBYTE | |
3327 # if defined(WIN3264) && defined(FEAT_GETTEXT) | |
3328 /* | |
3329 * If $LANG isn't set, try to get a good value for it. This makes the | |
3330 * right language be used automatically. Don't do this for English. | |
3331 */ | |
3332 if (mch_getenv((char_u *)"LANG") == NULL) | |
3333 { | |
3334 char buf[20]; | |
3335 | |
3336 /* Could use LOCALE_SISO639LANGNAME, but it's not in Win95. | |
3337 * LOCALE_SABBREVLANGNAME gives us three letters, like "enu", we use | |
3338 * only the first two. */ | |
3339 n = GetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_SABBREVLANGNAME, | |
3340 (LPTSTR)buf, 20); | |
3341 if (n >= 2 && STRNICMP(buf, "en", 2) != 0) | |
3342 { | |
3343 /* There are a few exceptions (probably more) */ | |
3344 if (STRNICMP(buf, "cht", 3) == 0 || STRNICMP(buf, "zht", 3) == 0) | |
3345 STRCPY(buf, "zh_TW"); | |
3346 else if (STRNICMP(buf, "chs", 3) == 0 | |
3347 || STRNICMP(buf, "zhc", 3) == 0) | |
3348 STRCPY(buf, "zh_CN"); | |
3349 else if (STRNICMP(buf, "jp", 2) == 0) | |
3350 STRCPY(buf, "ja"); | |
3351 else | |
3352 buf[2] = NUL; /* truncate to two-letter code */ | |
3353 vim_setenv("LANG", buf); | |
3354 } | |
3355 } | |
168 | 3356 # else |
767 | 3357 # ifdef MACOS_CONVERT |
1622 | 3358 /* Moved to os_mac_conv.c to avoid dependency problems. */ |
3359 mac_lang_init(); | |
168 | 3360 # endif |
7 | 3361 # endif |
3362 | |
3363 /* enc_locale() will try to find the encoding of the current locale. */ | |
3364 p = enc_locale(); | |
3365 if (p != NULL) | |
3366 { | |
3367 char_u *save_enc; | |
3368 | |
3369 /* Try setting 'encoding' and check if the value is valid. | |
3370 * If not, go back to the default "latin1". */ | |
3371 save_enc = p_enc; | |
3372 p_enc = p; | |
1080 | 3373 if (STRCMP(p_enc, "gb18030") == 0) |
3374 { | |
3375 /* We don't support "gb18030", but "cp936" is a good substitute | |
3376 * for practical purposes, thus use that. It's not an alias to | |
3377 * still support conversion between gb18030 and utf-8. */ | |
3378 p_enc = vim_strsave((char_u *)"cp936"); | |
3379 vim_free(p); | |
3380 } | |
7 | 3381 if (mb_init() == NULL) |
3382 { | |
3383 opt_idx = findoption((char_u *)"encoding"); | |
838 | 3384 if (opt_idx >= 0) |
3385 { | |
3386 options[opt_idx].def_val[VI_DEFAULT] = p_enc; | |
3387 options[opt_idx].flags |= P_DEF_ALLOCED; | |
3388 } | |
7 | 3389 |
24 | 3390 #if defined(MSDOS) || defined(MSWIN) || defined(OS2) || defined(MACOS) \ |
3391 || defined(VMS) | |
3392 if (STRCMP(p_enc, "latin1") == 0 | |
3393 # ifdef FEAT_MBYTE | |
3394 || enc_utf8 | |
3395 # endif | |
3396 ) | |
3397 { | |
714 | 3398 /* Adjust the default for 'isprint' and 'iskeyword' to match |
3399 * latin1. Also set the defaults for when 'nocompatible' is | |
3400 * set. */ | |
24 | 3401 set_string_option_direct((char_u *)"isp", -1, |
719 | 3402 ISP_LATIN1, OPT_FREE, SID_NONE); |
714 | 3403 set_string_option_direct((char_u *)"isk", -1, |
3404 ISK_LATIN1, OPT_FREE, SID_NONE); | |
3405 opt_idx = findoption((char_u *)"isp"); | |
838 | 3406 if (opt_idx >= 0) |
3407 options[opt_idx].def_val[VIM_DEFAULT] = ISP_LATIN1; | |
714 | 3408 opt_idx = findoption((char_u *)"isk"); |
838 | 3409 if (opt_idx >= 0) |
3410 options[opt_idx].def_val[VIM_DEFAULT] = ISK_LATIN1; | |
24 | 3411 (void)init_chartab(); |
3412 } | |
3413 #endif | |
3414 | |
7 | 3415 # if defined(WIN3264) && !defined(FEAT_GUI) |
3416 /* Win32 console: When GetACP() returns a different value from | |
3417 * GetConsoleCP() set 'termencoding'. */ | |
3418 if (GetACP() != GetConsoleCP()) | |
3419 { | |
3420 char buf[50]; | |
3421 | |
3422 sprintf(buf, "cp%ld", (long)GetConsoleCP()); | |
3423 p_tenc = vim_strsave((char_u *)buf); | |
3424 if (p_tenc != NULL) | |
3425 { | |
3426 opt_idx = findoption((char_u *)"termencoding"); | |
838 | 3427 if (opt_idx >= 0) |
3428 { | |
3429 options[opt_idx].def_val[VI_DEFAULT] = p_tenc; | |
3430 options[opt_idx].flags |= P_DEF_ALLOCED; | |
3431 } | |
7 | 3432 convert_setup(&input_conv, p_tenc, p_enc); |
3433 convert_setup(&output_conv, p_enc, p_tenc); | |
3434 } | |
3435 else | |
3436 p_tenc = empty_option; | |
3437 } | |
3438 # endif | |
170 | 3439 # if defined(WIN3264) && defined(FEAT_MBYTE) |
3440 /* $HOME may have characters in active code page. */ | |
3441 init_homedir(); | |
3442 # endif | |
7 | 3443 } |
3444 else | |
3445 { | |
3446 vim_free(p_enc); | |
3447 p_enc = save_enc; | |
3448 } | |
3449 } | |
3450 #endif | |
3451 | |
3452 #ifdef FEAT_MULTI_LANG | |
3453 /* Set the default for 'helplang'. */ | |
3454 set_helplang_default(get_mess_lang()); | |
3455 #endif | |
3456 } | |
3457 | |
3458 /* | |
3459 * Set an option to its default value. | |
3460 * This does not take care of side effects! | |
3461 */ | |
3462 static void | |
3463 set_option_default(opt_idx, opt_flags, compatible) | |
3464 int opt_idx; | |
3465 int opt_flags; /* OPT_FREE, OPT_LOCAL and/or OPT_GLOBAL */ | |
3466 int compatible; /* use Vi default value */ | |
3467 { | |
3468 char_u *varp; /* pointer to variable for current option */ | |
3469 int dvi; /* index in def_val[] */ | |
3470 long_u flags; | |
681 | 3471 long_u *flagsp; |
7 | 3472 int both = (opt_flags & (OPT_LOCAL | OPT_GLOBAL)) == 0; |
3473 | |
3474 varp = get_varp_scope(&(options[opt_idx]), both ? OPT_LOCAL : opt_flags); | |
3475 flags = options[opt_idx].flags; | |
320 | 3476 if (varp != NULL) /* skip hidden option, nothing to do for it */ |
7 | 3477 { |
3478 dvi = ((flags & P_VI_DEF) || compatible) ? VI_DEFAULT : VIM_DEFAULT; | |
3479 if (flags & P_STRING) | |
3480 { | |
3481 /* Use set_string_option_direct() for local options to handle | |
3482 * freeing and allocating the value. */ | |
3483 if (options[opt_idx].indir != PV_NONE) | |
3484 set_string_option_direct(NULL, opt_idx, | |
694 | 3485 options[opt_idx].def_val[dvi], opt_flags, 0); |
7 | 3486 else |
3487 { | |
3488 if ((opt_flags & OPT_FREE) && (flags & P_ALLOCED)) | |
3489 free_string_option(*(char_u **)(varp)); | |
3490 *(char_u **)varp = options[opt_idx].def_val[dvi]; | |
3491 options[opt_idx].flags &= ~P_ALLOCED; | |
3492 } | |
3493 } | |
3494 else if (flags & P_NUM) | |
3495 { | |
1017 | 3496 if (options[opt_idx].indir == PV_SCROLL) |
7 | 3497 win_comp_scroll(curwin); |
3498 else | |
3499 { | |
840 | 3500 *(long *)varp = (long)(long_i)options[opt_idx].def_val[dvi]; |
7 | 3501 /* May also set global value for local option. */ |
3502 if (both) | |
3503 *(long *)get_varp_scope(&(options[opt_idx]), OPT_GLOBAL) = | |
3504 *(long *)varp; | |
3505 } | |
3506 } | |
3507 else /* P_BOOL */ | |
3508 { | |
840 | 3509 /* the cast to long is required for Manx C, long_i is needed for |
3510 * MSVC */ | |
3511 *(int *)varp = (int)(long)(long_i)options[opt_idx].def_val[dvi]; | |
1111 | 3512 #ifdef UNIX |
3513 /* 'modeline' defaults to off for root */ | |
3514 if (options[opt_idx].indir == PV_ML && getuid() == ROOT_UID) | |
3515 *(int *)varp = FALSE; | |
3516 #endif | |
7 | 3517 /* May also set global value for local option. */ |
3518 if (both) | |
3519 *(int *)get_varp_scope(&(options[opt_idx]), OPT_GLOBAL) = | |
3520 *(int *)varp; | |
3521 } | |
634 | 3522 |
681 | 3523 /* The default value is not insecure. */ |
3524 flagsp = insecure_flag(opt_idx, opt_flags); | |
3525 *flagsp = *flagsp & ~P_INSECURE; | |
7 | 3526 } |
3527 | |
3528 #ifdef FEAT_EVAL | |
694 | 3529 set_option_scriptID_idx(opt_idx, opt_flags, current_SID); |
7 | 3530 #endif |
3531 } | |
3532 | |
3533 /* | |
3534 * Set all options (except terminal options) to their default value. | |
3535 */ | |
3536 static void | |
3537 set_options_default(opt_flags) | |
3538 int opt_flags; /* OPT_FREE, OPT_LOCAL and/or OPT_GLOBAL */ | |
3539 { | |
3540 int i; | |
3541 #ifdef FEAT_WINDOWS | |
3542 win_T *wp; | |
671 | 3543 tabpage_T *tp; |
7 | 3544 #endif |
3545 | |
3546 for (i = 0; !istermoption(&options[i]); i++) | |
3547 if (!(options[i].flags & P_NODEFAULT)) | |
3548 set_option_default(i, opt_flags, p_cp); | |
3549 | |
3550 #ifdef FEAT_WINDOWS | |
3551 /* The 'scroll' option must be computed for all windows. */ | |
671 | 3552 FOR_ALL_TAB_WINDOWS(tp, wp) |
7 | 3553 win_comp_scroll(wp); |
3554 #else | |
3555 win_comp_scroll(curwin); | |
3556 #endif | |
3557 } | |
3558 | |
3559 /* | |
3560 * Set the Vi-default value of a string option. | |
3561 * Used for 'sh', 'backupskip' and 'term'. | |
3562 */ | |
3563 void | |
3564 set_string_default(name, val) | |
3565 char *name; | |
3566 char_u *val; | |
3567 { | |
3568 char_u *p; | |
3569 int opt_idx; | |
3570 | |
3571 p = vim_strsave(val); | |
3572 if (p != NULL) /* we don't want a NULL */ | |
3573 { | |
3574 opt_idx = findoption((char_u *)name); | |
838 | 3575 if (opt_idx >= 0) |
3576 { | |
3577 if (options[opt_idx].flags & P_DEF_ALLOCED) | |
3578 vim_free(options[opt_idx].def_val[VI_DEFAULT]); | |
3579 options[opt_idx].def_val[VI_DEFAULT] = p; | |
3580 options[opt_idx].flags |= P_DEF_ALLOCED; | |
3581 } | |
7 | 3582 } |
3583 } | |
3584 | |
3585 /* | |
3586 * Set the Vi-default value of a number option. | |
3587 * Used for 'lines' and 'columns'. | |
3588 */ | |
3589 void | |
3590 set_number_default(name, val) | |
3591 char *name; | |
3592 long val; | |
3593 { | |
838 | 3594 int opt_idx; |
3595 | |
3596 opt_idx = findoption((char_u *)name); | |
3597 if (opt_idx >= 0) | |
840 | 3598 options[opt_idx].def_val[VI_DEFAULT] = (char_u *)(long_i)val; |
7 | 3599 } |
3600 | |
359 | 3601 #if defined(EXITFREE) || defined(PROTO) |
3602 /* | |
3603 * Free all options. | |
3604 */ | |
3605 void | |
3606 free_all_options() | |
3607 { | |
3608 int i; | |
3609 | |
3610 for (i = 0; !istermoption(&options[i]); i++) | |
3611 { | |
3612 if (options[i].indir == PV_NONE) | |
3613 { | |
3614 /* global option: free value and default value. */ | |
3615 if (options[i].flags & P_ALLOCED && options[i].var != NULL) | |
3616 free_string_option(*(char_u **)options[i].var); | |
3617 if (options[i].flags & P_DEF_ALLOCED) | |
3618 free_string_option(options[i].def_val[VI_DEFAULT]); | |
3619 } | |
3620 else if (options[i].var != VAR_WIN | |
3621 && (options[i].flags & P_STRING)) | |
3622 /* buffer-local option: free global value */ | |
3623 free_string_option(*(char_u **)options[i].var); | |
3624 } | |
3625 } | |
3626 #endif | |
3627 | |
3628 | |
7 | 3629 /* |
3630 * Initialize the options, part two: After getting Rows and Columns and | |
3631 * setting 'term'. | |
3632 */ | |
3633 void | |
3634 set_init_2() | |
3635 { | |
164 | 3636 int idx; |
3637 | |
7 | 3638 /* |
3639 * 'scroll' defaults to half the window height. Note that this default is | |
3640 * wrong when the window height changes. | |
3641 */ | |
836 | 3642 set_number_default("scroll", (long)((long_u)Rows >> 1)); |
168 | 3643 idx = findoption((char_u *)"scroll"); |
838 | 3644 if (idx >= 0 && !(options[idx].flags & P_WAS_SET)) |
168 | 3645 set_option_default(idx, OPT_LOCAL, p_cp); |
7 | 3646 comp_col(); |
3647 | |
164 | 3648 /* |
3649 * 'window' is only for backwards compatibility with Vi. | |
3650 * Default is Rows - 1. | |
3651 */ | |
857 | 3652 if (!option_was_set((char_u *)"window")) |
164 | 3653 p_window = Rows - 1; |
3654 set_number_default("window", Rows - 1); | |
3655 | |
671 | 3656 /* For DOS console the default is always black. */ |
7 | 3657 #if !((defined(MSDOS) || defined(OS2) || defined(WIN3264)) && !defined(FEAT_GUI)) |
671 | 3658 /* |
3659 * If 'background' wasn't set by the user, try guessing the value, | |
3660 * depending on the terminal name. Only need to check for terminals | |
3661 * with a dark background, that can handle color. | |
3662 */ | |
3663 idx = findoption((char_u *)"bg"); | |
838 | 3664 if (idx >= 0 && !(options[idx].flags & P_WAS_SET) |
3665 && *term_bg_default() == 'd') | |
671 | 3666 { |
694 | 3667 set_string_option_direct(NULL, idx, (char_u *)"dark", OPT_FREE, 0); |
671 | 3668 /* don't mark it as set, when starting the GUI it may be |
3669 * changed again */ | |
3670 options[idx].flags &= ~P_WAS_SET; | |
7 | 3671 } |
3672 #endif | |
440 | 3673 |
3674 #ifdef CURSOR_SHAPE | |
3675 parse_shape_opt(SHAPE_CURSOR); /* set cursor shapes from 'guicursor' */ | |
3676 #endif | |
3677 #ifdef FEAT_MOUSESHAPE | |
3678 parse_shape_opt(SHAPE_MOUSE); /* set mouse shapes from 'mouseshape' */ | |
3679 #endif | |
3680 #ifdef FEAT_PRINTER | |
3681 (void)parse_printoptions(); /* parse 'printoptions' default value */ | |
3682 #endif | |
7 | 3683 } |
3684 | |
3685 /* | |
671 | 3686 * Return "dark" or "light" depending on the kind of terminal. |
3687 * This is just guessing! Recognized are: | |
3688 * "linux" Linux console | |
3689 * "screen.linux" Linux console with screen | |
3690 * "cygwin" Cygwin shell | |
3691 * "putty" Putty program | |
3692 * We also check the COLORFGBG environment variable, which is set by | |
3693 * rxvt and derivatives. This variable contains either two or three | |
3694 * values separated by semicolons; we want the last value in either | |
3695 * case. If this value is 0-6 or 8, our background is dark. | |
3696 */ | |
3697 static char_u * | |
3698 term_bg_default() | |
3699 { | |
3700 #if defined(MSDOS) || defined(OS2) || defined(WIN3264) | |
3701 /* DOS console nearly always black */ | |
3702 return (char_u *)"dark"; | |
3703 #else | |
677 | 3704 char_u *p; |
3705 | |
671 | 3706 if (STRCMP(T_NAME, "linux") == 0 |
3707 || STRCMP(T_NAME, "screen.linux") == 0 | |
3708 || STRCMP(T_NAME, "cygwin") == 0 | |
3709 || STRCMP(T_NAME, "putty") == 0 | |
3710 || ((p = mch_getenv((char_u *)"COLORFGBG")) != NULL | |
3711 && (p = vim_strrchr(p, ';')) != NULL | |
3712 && ((p[1] >= '0' && p[1] <= '6') || p[1] == '8') | |
3713 && p[2] == NUL)) | |
3714 return (char_u *)"dark"; | |
3715 return (char_u *)"light"; | |
3716 #endif | |
3717 } | |
3718 | |
3719 /* | |
7 | 3720 * Initialize the options, part three: After reading the .vimrc |
3721 */ | |
3722 void | |
3723 set_init_3() | |
3724 { | |
3725 #if defined(UNIX) || defined(OS2) || defined(WIN3264) | |
3726 /* | |
3727 * Set 'shellpipe' and 'shellredir', depending on the 'shell' option. | |
3728 * This is done after other initializations, where 'shell' might have been | |
3729 * set, but only if they have not been set before. | |
3730 */ | |
3731 char_u *p; | |
3732 int idx_srr; | |
3733 int do_srr; | |
3734 #ifdef FEAT_QUICKFIX | |
3735 int idx_sp; | |
3736 int do_sp; | |
3737 #endif | |
3738 | |
3739 idx_srr = findoption((char_u *)"srr"); | |
838 | 3740 if (idx_srr < 0) |
3741 do_srr = FALSE; | |
3742 else | |
3743 do_srr = !(options[idx_srr].flags & P_WAS_SET); | |
7 | 3744 #ifdef FEAT_QUICKFIX |
3745 idx_sp = findoption((char_u *)"sp"); | |
838 | 3746 if (idx_sp < 0) |
3747 do_sp = FALSE; | |
3748 else | |
3749 do_sp = !(options[idx_sp].flags & P_WAS_SET); | |
7 | 3750 #endif |
3751 | |
3752 /* | |
3753 * Isolate the name of the shell: | |
3754 * - Skip beyond any path. E.g., "/usr/bin/csh -f" -> "csh -f". | |
3755 * - Remove any argument. E.g., "csh -f" -> "csh". | |
2135
7aee5e68548a
updated for version 7.2.417
Bram Moolenaar <bram@zimbu.org>
parents:
2086
diff
changeset
|
3756 * But don't allow a space in the path, so that this works: |
7aee5e68548a
updated for version 7.2.417
Bram Moolenaar <bram@zimbu.org>
parents:
2086
diff
changeset
|
3757 * "/usr/bin/csh --rcfile ~/.cshrc" |
7aee5e68548a
updated for version 7.2.417
Bram Moolenaar <bram@zimbu.org>
parents:
2086
diff
changeset
|
3758 * But don't do that for Windows, it's common to have a space in the path. |
7 | 3759 */ |
2135
7aee5e68548a
updated for version 7.2.417
Bram Moolenaar <bram@zimbu.org>
parents:
2086
diff
changeset
|
3760 #ifdef WIN3264 |
7 | 3761 p = gettail(p_sh); |
3762 p = vim_strnsave(p, (int)(skiptowhite(p) - p)); | |
2135
7aee5e68548a
updated for version 7.2.417
Bram Moolenaar <bram@zimbu.org>
parents:
2086
diff
changeset
|
3763 #else |
7aee5e68548a
updated for version 7.2.417
Bram Moolenaar <bram@zimbu.org>
parents:
2086
diff
changeset
|
3764 p = skiptowhite(p_sh); |
7aee5e68548a
updated for version 7.2.417
Bram Moolenaar <bram@zimbu.org>
parents:
2086
diff
changeset
|
3765 if (*p == NUL) |
7aee5e68548a
updated for version 7.2.417
Bram Moolenaar <bram@zimbu.org>
parents:
2086
diff
changeset
|
3766 { |
7aee5e68548a
updated for version 7.2.417
Bram Moolenaar <bram@zimbu.org>
parents:
2086
diff
changeset
|
3767 /* No white space, use the tail. */ |
7aee5e68548a
updated for version 7.2.417
Bram Moolenaar <bram@zimbu.org>
parents:
2086
diff
changeset
|
3768 p = vim_strsave(gettail(p_sh)); |
7aee5e68548a
updated for version 7.2.417
Bram Moolenaar <bram@zimbu.org>
parents:
2086
diff
changeset
|
3769 } |
7aee5e68548a
updated for version 7.2.417
Bram Moolenaar <bram@zimbu.org>
parents:
2086
diff
changeset
|
3770 else |
7aee5e68548a
updated for version 7.2.417
Bram Moolenaar <bram@zimbu.org>
parents:
2086
diff
changeset
|
3771 { |
7aee5e68548a
updated for version 7.2.417
Bram Moolenaar <bram@zimbu.org>
parents:
2086
diff
changeset
|
3772 char_u *p1, *p2; |
7aee5e68548a
updated for version 7.2.417
Bram Moolenaar <bram@zimbu.org>
parents:
2086
diff
changeset
|
3773 |
7aee5e68548a
updated for version 7.2.417
Bram Moolenaar <bram@zimbu.org>
parents:
2086
diff
changeset
|
3774 /* Find the last path separator before the space. */ |
7aee5e68548a
updated for version 7.2.417
Bram Moolenaar <bram@zimbu.org>
parents:
2086
diff
changeset
|
3775 p1 = p_sh; |
7aee5e68548a
updated for version 7.2.417
Bram Moolenaar <bram@zimbu.org>
parents:
2086
diff
changeset
|
3776 for (p2 = p_sh; p2 < p; mb_ptr_adv(p2)) |
7aee5e68548a
updated for version 7.2.417
Bram Moolenaar <bram@zimbu.org>
parents:
2086
diff
changeset
|
3777 if (vim_ispathsep(*p2)) |
7aee5e68548a
updated for version 7.2.417
Bram Moolenaar <bram@zimbu.org>
parents:
2086
diff
changeset
|
3778 p1 = p2 + 1; |
7aee5e68548a
updated for version 7.2.417
Bram Moolenaar <bram@zimbu.org>
parents:
2086
diff
changeset
|
3779 p = vim_strnsave(p1, (int)(p - p1)); |
7aee5e68548a
updated for version 7.2.417
Bram Moolenaar <bram@zimbu.org>
parents:
2086
diff
changeset
|
3780 } |
7aee5e68548a
updated for version 7.2.417
Bram Moolenaar <bram@zimbu.org>
parents:
2086
diff
changeset
|
3781 #endif |
7 | 3782 if (p != NULL) |
3783 { | |
3784 /* | |
3785 * Default for p_sp is "| tee", for p_srr is ">". | |
3786 * For known shells it is changed here to include stderr. | |
3787 */ | |
3788 if ( fnamecmp(p, "csh") == 0 | |
3789 || fnamecmp(p, "tcsh") == 0 | |
3790 # if defined(OS2) || defined(WIN3264) /* also check with .exe extension */ | |
3791 || fnamecmp(p, "csh.exe") == 0 | |
3792 || fnamecmp(p, "tcsh.exe") == 0 | |
3793 # endif | |
3794 ) | |
3795 { | |
3796 #if defined(FEAT_QUICKFIX) | |
3797 if (do_sp) | |
3798 { | |
3799 # ifdef WIN3264 | |
3800 p_sp = (char_u *)">&"; | |
3801 # else | |
3802 p_sp = (char_u *)"|& tee"; | |
3803 # endif | |
3804 options[idx_sp].def_val[VI_DEFAULT] = p_sp; | |
3805 } | |
3806 #endif | |
3807 if (do_srr) | |
3808 { | |
3809 p_srr = (char_u *)">&"; | |
3810 options[idx_srr].def_val[VI_DEFAULT] = p_srr; | |
3811 } | |
3812 } | |
3813 else | |
3814 # ifndef OS2 /* Always use bourne shell style redirection if we reach this */ | |
3815 if ( fnamecmp(p, "sh") == 0 | |
3816 || fnamecmp(p, "ksh") == 0 | |
3817 || fnamecmp(p, "zsh") == 0 | |
836 | 3818 || fnamecmp(p, "zsh-beta") == 0 |
7 | 3819 || fnamecmp(p, "bash") == 0 |
3820 # ifdef WIN3264 | |
3821 || fnamecmp(p, "cmd") == 0 | |
3822 || fnamecmp(p, "sh.exe") == 0 | |
3823 || fnamecmp(p, "ksh.exe") == 0 | |
3824 || fnamecmp(p, "zsh.exe") == 0 | |
836 | 3825 || fnamecmp(p, "zsh-beta.exe") == 0 |
7 | 3826 || fnamecmp(p, "bash.exe") == 0 |
3827 || fnamecmp(p, "cmd.exe") == 0 | |
3828 # endif | |
3829 ) | |
3830 # endif | |
3831 { | |
3832 #if defined(FEAT_QUICKFIX) | |
3833 if (do_sp) | |
3834 { | |
3835 # ifdef WIN3264 | |
3836 p_sp = (char_u *)">%s 2>&1"; | |
3837 # else | |
3838 p_sp = (char_u *)"2>&1| tee"; | |
3839 # endif | |
3840 options[idx_sp].def_val[VI_DEFAULT] = p_sp; | |
3841 } | |
3842 #endif | |
3843 if (do_srr) | |
3844 { | |
3845 p_srr = (char_u *)">%s 2>&1"; | |
3846 options[idx_srr].def_val[VI_DEFAULT] = p_srr; | |
3847 } | |
3848 } | |
3849 vim_free(p); | |
3850 } | |
3851 #endif | |
3852 | |
3853 #if defined(MSDOS) || defined(WIN3264) || defined(OS2) | |
3854 /* | |
3855 * Set 'shellcmdflag and 'shellquote' depending on the 'shell' option. | |
3856 * This is done after other initializations, where 'shell' might have been | |
3857 * set, but only if they have not been set before. Default for p_shcf is | |
3858 * "/c", for p_shq is "". For "sh" like shells it is changed here to | |
3859 * "-c" and "\"", but not for DJGPP, because it starts the shell without | |
3860 * command.com. And for Win32 we need to set p_sxq instead. | |
3861 */ | |
10 | 3862 if (strstr((char *)gettail(p_sh), "sh") != NULL) |
7 | 3863 { |
3864 int idx3; | |
3865 | |
3866 idx3 = findoption((char_u *)"shcf"); | |
838 | 3867 if (idx3 >= 0 && !(options[idx3].flags & P_WAS_SET)) |
7 | 3868 { |
3869 p_shcf = (char_u *)"-c"; | |
3870 options[idx3].def_val[VI_DEFAULT] = p_shcf; | |
3871 } | |
3872 | |
3873 # ifndef DJGPP | |
3874 # ifdef WIN3264 | |
3875 /* Somehow Win32 requires the quotes around the redirection too */ | |
3876 idx3 = findoption((char_u *)"sxq"); | |
838 | 3877 if (idx3 >= 0 && !(options[idx3].flags & P_WAS_SET)) |
7 | 3878 { |
3879 p_sxq = (char_u *)"\""; | |
3880 options[idx3].def_val[VI_DEFAULT] = p_sxq; | |
3881 } | |
3882 # else | |
3883 idx3 = findoption((char_u *)"shq"); | |
838 | 3884 if (idx3 >= 0 && !(options[idx3].flags & P_WAS_SET)) |
7 | 3885 { |
3886 p_shq = (char_u *)"\""; | |
3887 options[idx3].def_val[VI_DEFAULT] = p_shq; | |
3888 } | |
3889 # endif | |
3890 # endif | |
3891 } | |
3892 #endif | |
3893 | |
3894 #ifdef FEAT_TITLE | |
3895 set_title_defaults(); | |
3896 #endif | |
3897 } | |
3898 | |
3899 #if defined(FEAT_MULTI_LANG) || defined(PROTO) | |
3900 /* | |
3901 * When 'helplang' is still at its default value, set it to "lang". | |
3902 * Only the first two characters of "lang" are used. | |
3903 */ | |
3904 void | |
3905 set_helplang_default(lang) | |
3906 char_u *lang; | |
3907 { | |
3908 int idx; | |
3909 | |
3910 if (lang == NULL || STRLEN(lang) < 2) /* safety check */ | |
3911 return; | |
3912 idx = findoption((char_u *)"hlg"); | |
838 | 3913 if (idx >= 0 && !(options[idx].flags & P_WAS_SET)) |
7 | 3914 { |
3915 if (options[idx].flags & P_ALLOCED) | |
3916 free_string_option(p_hlg); | |
3917 p_hlg = vim_strsave(lang); | |
3918 if (p_hlg == NULL) | |
3919 p_hlg = empty_option; | |
3920 else | |
18 | 3921 { |
3922 /* zh_CN becomes "cn", zh_TW becomes "tw". */ | |
3923 if (STRNICMP(p_hlg, "zh_", 3) == 0 && STRLEN(p_hlg) >= 5) | |
3924 { | |
3925 p_hlg[0] = TOLOWER_ASC(p_hlg[3]); | |
3926 p_hlg[1] = TOLOWER_ASC(p_hlg[4]); | |
3927 } | |
7 | 3928 p_hlg[2] = NUL; |
18 | 3929 } |
7 | 3930 options[idx].flags |= P_ALLOCED; |
3931 } | |
3932 } | |
3933 #endif | |
3934 | |
3935 #ifdef FEAT_GUI | |
3936 static char_u *gui_bg_default __ARGS((void)); | |
3937 | |
3938 static char_u * | |
3939 gui_bg_default() | |
3940 { | |
3941 if (gui_get_lightness(gui.back_pixel) < 127) | |
3942 return (char_u *)"dark"; | |
3943 return (char_u *)"light"; | |
3944 } | |
3945 | |
3946 /* | |
3947 * Option initializations that can only be done after opening the GUI window. | |
3948 */ | |
3949 void | |
3950 init_gui_options() | |
3951 { | |
3952 /* Set the 'background' option according to the lightness of the | |
3953 * background color, unless the user has set it already. */ | |
3954 if (!option_was_set((char_u *)"bg") && STRCMP(p_bg, gui_bg_default()) != 0) | |
3955 { | |
3956 set_option_value((char_u *)"bg", 0L, gui_bg_default(), 0); | |
3957 highlight_changed(); | |
3958 } | |
3959 } | |
3960 #endif | |
3961 | |
3962 #ifdef FEAT_TITLE | |
3963 /* | |
3964 * 'title' and 'icon' only default to true if they have not been set or reset | |
3965 * in .vimrc and we can read the old value. | |
3966 * When 'title' and 'icon' have been reset in .vimrc, we won't even check if | |
3967 * they can be reset. This reduces startup time when using X on a remote | |
3968 * machine. | |
3969 */ | |
3970 void | |
3971 set_title_defaults() | |
3972 { | |
3973 int idx1; | |
3974 long val; | |
3975 | |
3976 /* | |
3977 * If GUI is (going to be) used, we can always set the window title and | |
3978 * icon name. Saves a bit of time, because the X11 display server does | |
3979 * not need to be contacted. | |
3980 */ | |
3981 idx1 = findoption((char_u *)"title"); | |
838 | 3982 if (idx1 >= 0 && !(options[idx1].flags & P_WAS_SET)) |
7 | 3983 { |
3984 #ifdef FEAT_GUI | |
3985 if (gui.starting || gui.in_use) | |
3986 val = TRUE; | |
3987 else | |
3988 #endif | |
3989 val = mch_can_restore_title(); | |
840 | 3990 options[idx1].def_val[VI_DEFAULT] = (char_u *)(long_i)val; |
7 | 3991 p_title = val; |
3992 } | |
3993 idx1 = findoption((char_u *)"icon"); | |
838 | 3994 if (idx1 >= 0 && !(options[idx1].flags & P_WAS_SET)) |
7 | 3995 { |
3996 #ifdef FEAT_GUI | |
3997 if (gui.starting || gui.in_use) | |
3998 val = TRUE; | |
3999 else | |
4000 #endif | |
4001 val = mch_can_restore_icon(); | |
840 | 4002 options[idx1].def_val[VI_DEFAULT] = (char_u *)(long_i)val; |
7 | 4003 p_icon = val; |
4004 } | |
4005 } | |
4006 #endif | |
4007 | |
4008 /* | |
4009 * Parse 'arg' for option settings. | |
4010 * | |
4011 * 'arg' may be IObuff, but only when no errors can be present and option | |
4012 * does not need to be expanded with option_expand(). | |
4013 * "opt_flags": | |
4014 * 0 for ":set" | |
717 | 4015 * OPT_GLOBAL for ":setglobal" |
4016 * OPT_LOCAL for ":setlocal" and a modeline | |
7 | 4017 * OPT_MODELINE for a modeline |
717 | 4018 * OPT_WINONLY to only set window-local options |
4019 * OPT_NOWIN to skip setting window-local options | |
7 | 4020 * |
4021 * returns FAIL if an error is detected, OK otherwise | |
4022 */ | |
4023 int | |
4024 do_set(arg, opt_flags) | |
4025 char_u *arg; /* option string (may be written to!) */ | |
4026 int opt_flags; | |
4027 { | |
4028 int opt_idx; | |
4029 char_u *errmsg; | |
4030 char_u errbuf[80]; | |
4031 char_u *startarg; | |
4032 int prefix; /* 1: nothing, 0: "no", 2: "inv" in front of name */ | |
4033 int nextchar; /* next non-white char after option name */ | |
4034 int afterchar; /* character just after option name */ | |
4035 int len; | |
4036 int i; | |
4037 long value; | |
4038 int key; | |
4039 long_u flags; /* flags for current option */ | |
4040 char_u *varp = NULL; /* pointer to variable for current option */ | |
4041 int did_show = FALSE; /* already showed one value */ | |
4042 int adding; /* "opt+=arg" */ | |
4043 int prepending; /* "opt^=arg" */ | |
4044 int removing; /* "opt-=arg" */ | |
4045 int cp_val = 0; | |
4046 char_u key_name[2]; | |
4047 | |
4048 if (*arg == NUL) | |
4049 { | |
4050 showoptions(0, opt_flags); | |
168 | 4051 did_show = TRUE; |
4052 goto theend; | |
7 | 4053 } |
4054 | |
4055 while (*arg != NUL) /* loop to process all options */ | |
4056 { | |
4057 errmsg = NULL; | |
4058 startarg = arg; /* remember for error message */ | |
4059 | |
36 | 4060 if (STRNCMP(arg, "all", 3) == 0 && !isalpha(arg[3]) |
4061 && !(opt_flags & OPT_MODELINE)) | |
7 | 4062 { |
4063 /* | |
4064 * ":set all" show all options. | |
4065 * ":set all&" set all options to their default value. | |
4066 */ | |
4067 arg += 3; | |
4068 if (*arg == '&') | |
4069 { | |
4070 ++arg; | |
4071 /* Only for :set command set global value of local options. */ | |
4072 set_options_default(OPT_FREE | opt_flags); | |
4073 } | |
4074 else | |
168 | 4075 { |
7 | 4076 showoptions(1, opt_flags); |
168 | 4077 did_show = TRUE; |
4078 } | |
7 | 4079 } |
36 | 4080 else if (STRNCMP(arg, "termcap", 7) == 0 && !(opt_flags & OPT_MODELINE)) |
7 | 4081 { |
4082 showoptions(2, opt_flags); | |
4083 show_termcodes(); | |
168 | 4084 did_show = TRUE; |
7 | 4085 arg += 7; |
4086 } | |
4087 else | |
4088 { | |
4089 prefix = 1; | |
1911 | 4090 if (STRNCMP(arg, "no", 2) == 0 && STRNCMP(arg, "novice", 6) != 0) |
7 | 4091 { |
4092 prefix = 0; | |
4093 arg += 2; | |
4094 } | |
4095 else if (STRNCMP(arg, "inv", 3) == 0) | |
4096 { | |
4097 prefix = 2; | |
4098 arg += 3; | |
4099 } | |
4100 | |
4101 /* find end of name */ | |
4102 key = 0; | |
4103 if (*arg == '<') | |
4104 { | |
4105 nextchar = 0; | |
4106 opt_idx = -1; | |
4107 /* look out for <t_>;> */ | |
4108 if (arg[1] == 't' && arg[2] == '_' && arg[3] && arg[4]) | |
4109 len = 5; | |
4110 else | |
4111 { | |
4112 len = 1; | |
4113 while (arg[len] != NUL && arg[len] != '>') | |
4114 ++len; | |
4115 } | |
4116 if (arg[len] != '>') | |
4117 { | |
4118 errmsg = e_invarg; | |
4119 goto skip; | |
4120 } | |
4121 arg[len] = NUL; /* put NUL after name */ | |
4122 if (arg[1] == 't' && arg[2] == '_') /* could be term code */ | |
4123 opt_idx = findoption(arg + 1); | |
4124 arg[len++] = '>'; /* restore '>' */ | |
4125 if (opt_idx == -1) | |
4126 key = find_key_option(arg + 1); | |
4127 } | |
4128 else | |
4129 { | |
4130 len = 0; | |
4131 /* | |
4132 * The two characters after "t_" may not be alphanumeric. | |
4133 */ | |
4134 if (arg[0] == 't' && arg[1] == '_' && arg[2] && arg[3]) | |
4135 len = 4; | |
4136 else | |
4137 while (ASCII_ISALNUM(arg[len]) || arg[len] == '_') | |
4138 ++len; | |
4139 nextchar = arg[len]; | |
4140 arg[len] = NUL; /* put NUL after name */ | |
4141 opt_idx = findoption(arg); | |
4142 arg[len] = nextchar; /* restore nextchar */ | |
4143 if (opt_idx == -1) | |
4144 key = find_key_option(arg); | |
4145 } | |
4146 | |
4147 /* remember character after option name */ | |
4148 afterchar = arg[len]; | |
4149 | |
4150 /* skip white space, allow ":set ai ?" */ | |
4151 while (vim_iswhite(arg[len])) | |
4152 ++len; | |
4153 | |
4154 adding = FALSE; | |
4155 prepending = FALSE; | |
4156 removing = FALSE; | |
4157 if (arg[len] != NUL && arg[len + 1] == '=') | |
4158 { | |
4159 if (arg[len] == '+') | |
4160 { | |
4161 adding = TRUE; /* "+=" */ | |
4162 ++len; | |
4163 } | |
4164 else if (arg[len] == '^') | |
4165 { | |
4166 prepending = TRUE; /* "^=" */ | |
4167 ++len; | |
4168 } | |
4169 else if (arg[len] == '-') | |
4170 { | |
4171 removing = TRUE; /* "-=" */ | |
4172 ++len; | |
4173 } | |
4174 } | |
4175 nextchar = arg[len]; | |
4176 | |
4177 if (opt_idx == -1 && key == 0) /* found a mismatch: skip */ | |
4178 { | |
4179 errmsg = (char_u *)N_("E518: Unknown option"); | |
4180 goto skip; | |
4181 } | |
4182 | |
4183 if (opt_idx >= 0) | |
4184 { | |
4185 if (options[opt_idx].var == NULL) /* hidden option: skip */ | |
4186 { | |
4187 /* Only give an error message when requesting the value of | |
4188 * a hidden option, ignore setting it. */ | |
4189 if (vim_strchr((char_u *)"=:!&<", nextchar) == NULL | |
4190 && (!(options[opt_idx].flags & P_BOOL) | |
4191 || nextchar == '?')) | |
4192 errmsg = (char_u *)N_("E519: Option not supported"); | |
4193 goto skip; | |
4194 } | |
4195 | |
4196 flags = options[opt_idx].flags; | |
4197 varp = get_varp_scope(&(options[opt_idx]), opt_flags); | |
4198 } | |
4199 else | |
4200 { | |
4201 flags = P_STRING; | |
4202 if (key < 0) | |
4203 { | |
4204 key_name[0] = KEY2TERMCAP0(key); | |
4205 key_name[1] = KEY2TERMCAP1(key); | |
4206 } | |
4207 else | |
4208 { | |
4209 key_name[0] = KS_KEY; | |
4210 key_name[1] = (key & 0xff); | |
4211 } | |
4212 } | |
4213 | |
634 | 4214 /* Skip all options that are not window-local (used when showing |
4215 * an already loaded buffer in a window). */ | |
4216 if ((opt_flags & OPT_WINONLY) | |
4217 && (opt_idx < 0 || options[opt_idx].var != VAR_WIN)) | |
4218 goto skip; | |
4219 | |
717 | 4220 /* Skip all options that are window-local (used for :vimgrep). */ |
4221 if ((opt_flags & OPT_NOWIN) && opt_idx >= 0 | |
4222 && options[opt_idx].var == VAR_WIN) | |
4223 goto skip; | |
4224 | |
1807 | 4225 /* Disallow changing some options from modelines. */ |
4226 if (opt_flags & OPT_MODELINE) | |
7 | 4227 { |
1807 | 4228 if (flags & P_SECURE) |
4229 { | |
4230 errmsg = (char_u *)_("E520: Not allowed in a modeline"); | |
4231 goto skip; | |
4232 } | |
1810 | 4233 #ifdef FEAT_DIFF |
1807 | 4234 /* In diff mode some options are overruled. This avoids that |
4235 * 'foldmethod' becomes "marker" instead of "diff" and that | |
4236 * "wrap" gets set. */ | |
4237 if (curwin->w_p_diff | |
4238 && (options[opt_idx].indir == PV_FDM | |
4239 || options[opt_idx].indir == PV_WRAP)) | |
4240 goto skip; | |
1810 | 4241 #endif |
7 | 4242 } |
4243 | |
4244 #ifdef HAVE_SANDBOX | |
4245 /* Disallow changing some options in the sandbox */ | |
634 | 4246 if (sandbox != 0 && (flags & P_SECURE)) |
7 | 4247 { |
4248 errmsg = (char_u *)_(e_sandbox); | |
4249 goto skip; | |
4250 } | |
4251 #endif | |
4252 | |
4253 if (vim_strchr((char_u *)"?=:!&<", nextchar) != NULL) | |
4254 { | |
4255 arg += len; | |
4256 cp_val = p_cp; | |
4257 if (nextchar == '&' && arg[1] == 'v' && arg[2] == 'i') | |
4258 { | |
4259 if (arg[3] == 'm') /* "opt&vim": set to Vim default */ | |
4260 { | |
4261 cp_val = FALSE; | |
4262 arg += 3; | |
4263 } | |
4264 else /* "opt&vi": set to Vi default */ | |
4265 { | |
4266 cp_val = TRUE; | |
4267 arg += 2; | |
4268 } | |
4269 } | |
4270 if (vim_strchr((char_u *)"?!&<", nextchar) != NULL | |
4271 && arg[1] != NUL && !vim_iswhite(arg[1])) | |
4272 { | |
4273 errmsg = e_trailing; | |
4274 goto skip; | |
4275 } | |
4276 } | |
4277 | |
4278 /* | |
4279 * allow '=' and ':' as MSDOS command.com allows only one | |
4280 * '=' character per "set" command line. grrr. (jw) | |
4281 */ | |
4282 if (nextchar == '?' | |
4283 || (prefix == 1 | |
4284 && vim_strchr((char_u *)"=:&<", nextchar) == NULL | |
4285 && !(flags & P_BOOL))) | |
4286 { | |
4287 /* | |
4288 * print value | |
4289 */ | |
4290 if (did_show) | |
4291 msg_putchar('\n'); /* cursor below last one */ | |
4292 else | |
4293 { | |
4294 gotocmdline(TRUE); /* cursor at status line */ | |
4295 did_show = TRUE; /* remember that we did a line */ | |
4296 } | |
4297 if (opt_idx >= 0) | |
4298 { | |
4299 showoneopt(&options[opt_idx], opt_flags); | |
4300 #ifdef FEAT_EVAL | |
4301 if (p_verbose > 0) | |
694 | 4302 { |
4303 /* Mention where the option was last set. */ | |
4304 if (varp == options[opt_idx].var) | |
4305 last_set_msg(options[opt_idx].scriptID); | |
4306 else if ((int)options[opt_idx].indir & PV_WIN) | |
4307 last_set_msg(curwin->w_p_scriptID[ | |
4308 (int)options[opt_idx].indir & PV_MASK]); | |
4309 else if ((int)options[opt_idx].indir & PV_BUF) | |
4310 last_set_msg(curbuf->b_p_scriptID[ | |
4311 (int)options[opt_idx].indir & PV_MASK]); | |
4312 } | |
7 | 4313 #endif |
4314 } | |
4315 else | |
4316 { | |
4317 char_u *p; | |
4318 | |
4319 p = find_termcode(key_name); | |
4320 if (p == NULL) | |
4321 { | |
4322 errmsg = (char_u *)N_("E518: Unknown option"); | |
4323 goto skip; | |
4324 } | |
4325 else | |
4326 (void)show_one_termcode(key_name, p, TRUE); | |
4327 } | |
4328 if (nextchar != '?' | |
4329 && nextchar != NUL && !vim_iswhite(afterchar)) | |
4330 errmsg = e_trailing; | |
4331 } | |
4332 else | |
4333 { | |
4334 if (flags & P_BOOL) /* boolean */ | |
4335 { | |
4336 if (nextchar == '=' || nextchar == ':') | |
4337 { | |
4338 errmsg = e_invarg; | |
4339 goto skip; | |
4340 } | |
4341 | |
4342 /* | |
4343 * ":set opt!": invert | |
4344 * ":set opt&": reset to default value | |
4345 * ":set opt<": reset to global value | |
4346 */ | |
4347 if (nextchar == '!') | |
4348 value = *(int *)(varp) ^ 1; | |
4349 else if (nextchar == '&') | |
840 | 4350 value = (int)(long)(long_i)options[opt_idx].def_val[ |
7 | 4351 ((flags & P_VI_DEF) || cp_val) |
4352 ? VI_DEFAULT : VIM_DEFAULT]; | |
4353 else if (nextchar == '<') | |
4354 { | |
4355 /* For 'autoread' -1 means to use global value. */ | |
4356 if ((int *)varp == &curbuf->b_p_ar | |
4357 && opt_flags == OPT_LOCAL) | |
4358 value = -1; | |
4359 else | |
4360 value = *(int *)get_varp_scope(&(options[opt_idx]), | |
4361 OPT_GLOBAL); | |
4362 } | |
4363 else | |
4364 { | |
4365 /* | |
4366 * ":set invopt": invert | |
4367 * ":set opt" or ":set noopt": set or reset | |
4368 */ | |
4369 if (nextchar != NUL && !vim_iswhite(afterchar)) | |
4370 { | |
4371 errmsg = e_trailing; | |
4372 goto skip; | |
4373 } | |
4374 if (prefix == 2) /* inv */ | |
4375 value = *(int *)(varp) ^ 1; | |
4376 else | |
4377 value = prefix; | |
4378 } | |
4379 | |
4380 errmsg = set_bool_option(opt_idx, varp, (int)value, | |
4381 opt_flags); | |
4382 } | |
4383 else /* numeric or string */ | |
4384 { | |
4385 if (vim_strchr((char_u *)"=:&<", nextchar) == NULL | |
4386 || prefix != 1) | |
4387 { | |
4388 errmsg = e_invarg; | |
4389 goto skip; | |
4390 } | |
4391 | |
4392 if (flags & P_NUM) /* numeric */ | |
4393 { | |
4394 /* | |
4395 * Different ways to set a number option: | |
4396 * & set to default value | |
4397 * < set to global value | |
4398 * <xx> accept special key codes for 'wildchar' | |
4399 * c accept any non-digit for 'wildchar' | |
4400 * [-]0-9 set number | |
4401 * other error | |
4402 */ | |
4403 ++arg; | |
4404 if (nextchar == '&') | |
840 | 4405 value = (long)(long_i)options[opt_idx].def_val[ |
7 | 4406 ((flags & P_VI_DEF) || cp_val) |
4407 ? VI_DEFAULT : VIM_DEFAULT]; | |
4408 else if (nextchar == '<') | |
4409 value = *(long *)get_varp_scope(&(options[opt_idx]), | |
4410 OPT_GLOBAL); | |
4411 else if (((long *)varp == &p_wc | |
4412 || (long *)varp == &p_wcm) | |
4413 && (*arg == '<' | |
4414 || *arg == '^' | |
4415 || ((!arg[1] || vim_iswhite(arg[1])) | |
4416 && !VIM_ISDIGIT(*arg)))) | |
4417 { | |
4418 value = string_to_key(arg); | |
4419 if (value == 0 && (long *)varp != &p_wcm) | |
4420 { | |
4421 errmsg = e_invarg; | |
4422 goto skip; | |
4423 } | |
4424 } | |
4425 /* allow negative numbers (for 'undolevels') */ | |
4426 else if (*arg == '-' || VIM_ISDIGIT(*arg)) | |
4427 { | |
4428 i = 0; | |
4429 if (*arg == '-') | |
4430 i = 1; | |
4431 #ifdef HAVE_STRTOL | |
4432 value = strtol((char *)arg, NULL, 0); | |
4433 if (arg[i] == '0' && TOLOWER_ASC(arg[i + 1]) == 'x') | |
4434 i += 2; | |
4435 #else | |
4436 value = atol((char *)arg); | |
4437 #endif | |
4438 while (VIM_ISDIGIT(arg[i])) | |
4439 ++i; | |
4440 if (arg[i] != NUL && !vim_iswhite(arg[i])) | |
4441 { | |
4442 errmsg = e_invarg; | |
4443 goto skip; | |
4444 } | |
4445 } | |
4446 else | |
4447 { | |
4448 errmsg = (char_u *)N_("E521: Number required after ="); | |
4449 goto skip; | |
4450 } | |
4451 | |
4452 if (adding) | |
4453 value = *(long *)varp + value; | |
4454 if (prepending) | |
4455 value = *(long *)varp * value; | |
4456 if (removing) | |
4457 value = *(long *)varp - value; | |
4458 errmsg = set_num_option(opt_idx, varp, value, | |
274 | 4459 errbuf, sizeof(errbuf), opt_flags); |
7 | 4460 } |
4461 else if (opt_idx >= 0) /* string */ | |
4462 { | |
4463 char_u *save_arg = NULL; | |
4464 char_u *s = NULL; | |
4465 char_u *oldval; /* previous value if *varp */ | |
4466 char_u *newval; | |
4467 char_u *origval; | |
4468 unsigned newlen; | |
4469 int comma; | |
4470 int bs; | |
4471 int new_value_alloced; /* new string option | |
4472 was allocated */ | |
4473 | |
4474 /* When using ":set opt=val" for a global option | |
4475 * with a local value the local value will be | |
4476 * reset, use the global value here. */ | |
4477 if ((opt_flags & (OPT_LOCAL | OPT_GLOBAL)) == 0 | |
692 | 4478 && ((int)options[opt_idx].indir & PV_BOTH)) |
7 | 4479 varp = options[opt_idx].var; |
4480 | |
4481 /* The old value is kept until we are sure that the | |
4482 * new value is valid. */ | |
4483 oldval = *(char_u **)varp; | |
4484 if (nextchar == '&') /* set to default val */ | |
4485 { | |
4486 newval = options[opt_idx].def_val[ | |
4487 ((flags & P_VI_DEF) || cp_val) | |
4488 ? VI_DEFAULT : VIM_DEFAULT]; | |
4489 if ((char_u **)varp == &p_bg) | |
4490 { | |
4491 /* guess the value of 'background' */ | |
4492 #ifdef FEAT_GUI | |
4493 if (gui.in_use) | |
4494 newval = gui_bg_default(); | |
4495 else | |
4496 #endif | |
671 | 4497 newval = term_bg_default(); |
7 | 4498 } |
4499 | |
4500 /* expand environment variables and ~ (since the | |
4501 * default value was already expanded, only | |
4502 * required when an environment variable was set | |
4503 * later */ | |
4504 if (newval == NULL) | |
4505 newval = empty_option; | |
4506 else | |
4507 { | |
4508 s = option_expand(opt_idx, newval); | |
4509 if (s == NULL) | |
4510 s = newval; | |
4511 newval = vim_strsave(s); | |
4512 } | |
4513 new_value_alloced = TRUE; | |
4514 } | |
4515 else if (nextchar == '<') /* set to global val */ | |
4516 { | |
4517 newval = vim_strsave(*(char_u **)get_varp_scope( | |
4518 &(options[opt_idx]), OPT_GLOBAL)); | |
4519 new_value_alloced = TRUE; | |
4520 } | |
4521 else | |
4522 { | |
4523 ++arg; /* jump to after the '=' or ':' */ | |
4524 | |
4525 /* | |
4526 * Set 'keywordprg' to ":help" if an empty | |
4527 * value was passed to :set by the user. | |
4528 * Misuse errbuf[] for the resulting string. | |
4529 */ | |
4530 if (varp == (char_u *)&p_kp | |
4531 && (*arg == NUL || *arg == ' ')) | |
4532 { | |
4533 STRCPY(errbuf, ":help"); | |
4534 save_arg = arg; | |
4535 arg = errbuf; | |
4536 } | |
4537 /* | |
4538 * Convert 'whichwrap' number to string, for | |
4539 * backwards compatibility with Vim 3.0. | |
4540 * Misuse errbuf[] for the resulting string. | |
4541 */ | |
4542 else if (varp == (char_u *)&p_ww | |
4543 && VIM_ISDIGIT(*arg)) | |
4544 { | |
4545 *errbuf = NUL; | |
4546 i = getdigits(&arg); | |
4547 if (i & 1) | |
4548 STRCAT(errbuf, "b,"); | |
4549 if (i & 2) | |
4550 STRCAT(errbuf, "s,"); | |
4551 if (i & 4) | |
4552 STRCAT(errbuf, "h,l,"); | |
4553 if (i & 8) | |
4554 STRCAT(errbuf, "<,>,"); | |
4555 if (i & 16) | |
4556 STRCAT(errbuf, "[,],"); | |
4557 if (*errbuf != NUL) /* remove trailing , */ | |
4558 errbuf[STRLEN(errbuf) - 1] = NUL; | |
4559 save_arg = arg; | |
4560 arg = errbuf; | |
4561 } | |
4562 /* | |
4563 * Remove '>' before 'dir' and 'bdir', for | |
4564 * backwards compatibility with version 3.0 | |
4565 */ | |
4566 else if ( *arg == '>' | |
4567 && (varp == (char_u *)&p_dir | |
4568 || varp == (char_u *)&p_bdir)) | |
4569 { | |
4570 ++arg; | |
4571 } | |
4572 | |
4573 /* When setting the local value of a global | |
4574 * option, the old value may be the global value. */ | |
692 | 4575 if (((int)options[opt_idx].indir & PV_BOTH) |
7 | 4576 && (opt_flags & OPT_LOCAL)) |
4577 origval = *(char_u **)get_varp( | |
4578 &options[opt_idx]); | |
4579 else | |
4580 origval = oldval; | |
4581 | |
4582 /* | |
4583 * Copy the new string into allocated memory. | |
4584 * Can't use set_string_option_direct(), because | |
4585 * we need to remove the backslashes. | |
4586 */ | |
4587 /* get a bit too much */ | |
4588 newlen = (unsigned)STRLEN(arg) + 1; | |
4589 if (adding || prepending || removing) | |
4590 newlen += (unsigned)STRLEN(origval) + 1; | |
4591 newval = alloc(newlen); | |
4592 if (newval == NULL) /* out of mem, don't change */ | |
4593 break; | |
4594 s = newval; | |
4595 | |
4596 /* | |
4597 * Copy the string, skip over escaped chars. | |
4598 * For MS-DOS and WIN32 backslashes before normal | |
4599 * file name characters are not removed, and keep | |
4600 * backslash at start, for "\\machine\path", but | |
4601 * do remove it for "\\\\machine\\path". | |
4602 * The reverse is found in ExpandOldSetting(). | |
4603 */ | |
4604 while (*arg && !vim_iswhite(*arg)) | |
4605 { | |
4606 if (*arg == '\\' && arg[1] != NUL | |
4607 #ifdef BACKSLASH_IN_FILENAME | |
4608 && !((flags & P_EXPAND) | |
4609 && vim_isfilec(arg[1]) | |
4610 && (arg[1] != '\\' | |
4611 || (s == newval | |
4612 && arg[2] != '\\'))) | |
4613 #endif | |
4614 ) | |
4615 ++arg; /* remove backslash */ | |
4616 #ifdef FEAT_MBYTE | |
4617 if (has_mbyte | |
474 | 4618 && (i = (*mb_ptr2len)(arg)) > 1) |
7 | 4619 { |
4620 /* copy multibyte char */ | |
4621 mch_memmove(s, arg, (size_t)i); | |
4622 arg += i; | |
4623 s += i; | |
4624 } | |
4625 else | |
4626 #endif | |
4627 *s++ = *arg++; | |
4628 } | |
4629 *s = NUL; | |
4630 | |
4631 /* | |
4632 * Expand environment variables and ~. | |
4633 * Don't do it when adding without inserting a | |
4634 * comma. | |
4635 */ | |
4636 if (!(adding || prepending || removing) | |
4637 || (flags & P_COMMA)) | |
4638 { | |
4639 s = option_expand(opt_idx, newval); | |
4640 if (s != NULL) | |
4641 { | |
4642 vim_free(newval); | |
4643 newlen = (unsigned)STRLEN(s) + 1; | |
4644 if (adding || prepending || removing) | |
4645 newlen += (unsigned)STRLEN(origval) + 1; | |
4646 newval = alloc(newlen); | |
4647 if (newval == NULL) | |
4648 break; | |
4649 STRCPY(newval, s); | |
4650 } | |
4651 } | |
4652 | |
4653 /* locate newval[] in origval[] when removing it | |
4654 * and when adding to avoid duplicates */ | |
4655 i = 0; /* init for GCC */ | |
4656 if (removing || (flags & P_NODUP)) | |
4657 { | |
4658 i = (int)STRLEN(newval); | |
4659 bs = 0; | |
4660 for (s = origval; *s; ++s) | |
4661 { | |
4662 if ((!(flags & P_COMMA) | |
4663 || s == origval | |
4664 || (s[-1] == ',' && !(bs & 1))) | |
4665 && STRNCMP(s, newval, i) == 0 | |
4666 && (!(flags & P_COMMA) | |
4667 || s[i] == ',' | |
4668 || s[i] == NUL)) | |
4669 break; | |
4670 /* Count backspaces. Only a comma with an | |
4671 * even number of backspaces before it is | |
4672 * recognized as a separator */ | |
4673 if (s > origval && s[-1] == '\\') | |
4674 ++bs; | |
4675 else | |
4676 bs = 0; | |
4677 } | |
4678 | |
4679 /* do not add if already there */ | |
4680 if ((adding || prepending) && *s) | |
4681 { | |
4682 prepending = FALSE; | |
4683 adding = FALSE; | |
4684 STRCPY(newval, origval); | |
4685 } | |
4686 } | |
4687 | |
4688 /* concatenate the two strings; add a ',' if | |
4689 * needed */ | |
4690 if (adding || prepending) | |
4691 { | |
4692 comma = ((flags & P_COMMA) && *origval != NUL | |
4693 && *newval != NUL); | |
4694 if (adding) | |
4695 { | |
4696 i = (int)STRLEN(origval); | |
4697 mch_memmove(newval + i + comma, newval, | |
4698 STRLEN(newval) + 1); | |
4699 mch_memmove(newval, origval, (size_t)i); | |
4700 } | |
4701 else | |
4702 { | |
4703 i = (int)STRLEN(newval); | |
1622 | 4704 STRMOVE(newval + i + comma, origval); |
7 | 4705 } |
4706 if (comma) | |
4707 newval[i] = ','; | |
4708 } | |
4709 | |
4710 /* Remove newval[] from origval[]. (Note: "i" has | |
4711 * been set above and is used here). */ | |
4712 if (removing) | |
4713 { | |
4714 STRCPY(newval, origval); | |
4715 if (*s) | |
4716 { | |
4717 /* may need to remove a comma */ | |
4718 if (flags & P_COMMA) | |
4719 { | |
4720 if (s == origval) | |
4721 { | |
4722 /* include comma after string */ | |
4723 if (s[i] == ',') | |
4724 ++i; | |
4725 } | |
4726 else | |
4727 { | |
4728 /* include comma before string */ | |
4729 --s; | |
4730 ++i; | |
4731 } | |
4732 } | |
1622 | 4733 STRMOVE(newval + (s - origval), s + i); |
7 | 4734 } |
4735 } | |
4736 | |
4737 if (flags & P_FLAGLIST) | |
4738 { | |
4739 /* Remove flags that appear twice. */ | |
4740 for (s = newval; *s; ++s) | |
4741 if ((!(flags & P_COMMA) || *s != ',') | |
4742 && vim_strchr(s + 1, *s) != NULL) | |
4743 { | |
1622 | 4744 STRMOVE(s, s + 1); |
7 | 4745 --s; |
4746 } | |
4747 } | |
4748 | |
4749 if (save_arg != NULL) /* number for 'whichwrap' */ | |
4750 arg = save_arg; | |
4751 new_value_alloced = TRUE; | |
4752 } | |
4753 | |
4754 /* Set the new value. */ | |
4755 *(char_u **)(varp) = newval; | |
4756 | |
4757 /* Handle side effects, and set the global value for | |
4758 * ":set" on local options. */ | |
4759 errmsg = did_set_string_option(opt_idx, (char_u **)varp, | |
4760 new_value_alloced, oldval, errbuf, opt_flags); | |
4761 | |
4762 /* If error detected, print the error message. */ | |
4763 if (errmsg != NULL) | |
4764 goto skip; | |
4765 } | |
4766 else /* key code option */ | |
4767 { | |
4768 char_u *p; | |
4769 | |
4770 if (nextchar == '&') | |
4771 { | |
4772 if (add_termcap_entry(key_name, TRUE) == FAIL) | |
4773 errmsg = (char_u *)N_("E522: Not found in termcap"); | |
4774 } | |
4775 else | |
4776 { | |
4777 ++arg; /* jump to after the '=' or ':' */ | |
4778 for (p = arg; *p && !vim_iswhite(*p); ++p) | |
4779 if (*p == '\\' && p[1] != NUL) | |
4780 ++p; | |
4781 nextchar = *p; | |
4782 *p = NUL; | |
4783 add_termcode(key_name, arg, FALSE); | |
4784 *p = nextchar; | |
4785 } | |
4786 if (full_screen) | |
4787 ttest(FALSE); | |
4788 redraw_all_later(CLEAR); | |
4789 } | |
4790 } | |
634 | 4791 |
7 | 4792 if (opt_idx >= 0) |
634 | 4793 did_set_option(opt_idx, opt_flags, |
4794 !prepending && !adding && !removing); | |
7 | 4795 } |
4796 | |
4797 skip: | |
4798 /* | |
4799 * Advance to next argument. | |
4800 * - skip until a blank found, taking care of backslashes | |
4801 * - skip blanks | |
4802 * - skip one "=val" argument (for hidden options ":set gfn =xx") | |
4803 */ | |
4804 for (i = 0; i < 2 ; ++i) | |
4805 { | |
4806 while (*arg != NUL && !vim_iswhite(*arg)) | |
4807 if (*arg++ == '\\' && *arg != NUL) | |
4808 ++arg; | |
4809 arg = skipwhite(arg); | |
4810 if (*arg != '=') | |
4811 break; | |
4812 } | |
4813 } | |
4814 | |
4815 if (errmsg != NULL) | |
4816 { | |
419 | 4817 vim_strncpy(IObuff, (char_u *)_(errmsg), IOSIZE - 1); |
835 | 4818 i = (int)STRLEN(IObuff) + 2; |
7 | 4819 if (i + (arg - startarg) < IOSIZE) |
4820 { | |
4821 /* append the argument with the error */ | |
4822 STRCAT(IObuff, ": "); | |
4823 mch_memmove(IObuff + i, startarg, (arg - startarg)); | |
4824 IObuff[i + (arg - startarg)] = NUL; | |
4825 } | |
4826 /* make sure all characters are printable */ | |
4827 trans_characters(IObuff, IOSIZE); | |
4828 | |
4829 ++no_wait_return; /* wait_return done later */ | |
4830 emsg(IObuff); /* show error highlighted */ | |
4831 --no_wait_return; | |
4832 | |
4833 return FAIL; | |
4834 } | |
4835 | |
4836 arg = skipwhite(arg); | |
4837 } | |
4838 | |
168 | 4839 theend: |
4840 if (silent_mode && did_show) | |
4841 { | |
4842 /* After displaying option values in silent mode. */ | |
4843 silent_mode = FALSE; | |
4844 info_message = TRUE; /* use mch_msg(), not mch_errmsg() */ | |
4845 msg_putchar('\n'); | |
4846 cursor_on(); /* msg_start() switches it off */ | |
4847 out_flush(); | |
4848 silent_mode = TRUE; | |
4849 info_message = FALSE; /* use mch_msg(), not mch_errmsg() */ | |
4850 } | |
4851 | |
7 | 4852 return OK; |
4853 } | |
4854 | |
634 | 4855 /* |
4856 * Call this when an option has been given a new value through a user command. | |
4857 * Sets the P_WAS_SET flag and takes care of the P_INSECURE flag. | |
4858 */ | |
4859 static void | |
4860 did_set_option(opt_idx, opt_flags, new_value) | |
4861 int opt_idx; | |
4862 int opt_flags; /* possibly with OPT_MODELINE */ | |
4863 int new_value; /* value was replaced completely */ | |
4864 { | |
681 | 4865 long_u *p; |
4866 | |
634 | 4867 options[opt_idx].flags |= P_WAS_SET; |
4868 | |
4869 /* When an option is set in the sandbox, from a modeline or in secure mode | |
4870 * set the P_INSECURE flag. Otherwise, if a new value is stored reset the | |
681 | 4871 * flag. */ |
4872 p = insecure_flag(opt_idx, opt_flags); | |
634 | 4873 if (secure |
4874 #ifdef HAVE_SANDBOX | |
4875 || sandbox != 0 | |
4876 #endif | |
4877 || (opt_flags & OPT_MODELINE)) | |
681 | 4878 *p = *p | P_INSECURE; |
4879 else if (new_value) | |
4880 *p = *p & ~P_INSECURE; | |
634 | 4881 } |
4882 | |
7 | 4883 static char_u * |
4884 illegal_char(errbuf, c) | |
4885 char_u *errbuf; | |
4886 int c; | |
4887 { | |
4888 if (errbuf == NULL) | |
4889 return (char_u *)""; | |
4890 sprintf((char *)errbuf, _("E539: Illegal character <%s>"), | |
274 | 4891 (char *)transchar(c)); |
7 | 4892 return errbuf; |
4893 } | |
4894 | |
4895 /* | |
4896 * Convert a key name or string into a key value. | |
4897 * Used for 'wildchar' and 'cedit' options. | |
4898 */ | |
4899 static int | |
4900 string_to_key(arg) | |
4901 char_u *arg; | |
4902 { | |
4903 if (*arg == '<') | |
4904 return find_key_option(arg + 1); | |
4905 if (*arg == '^') | |
4906 return Ctrl_chr(arg[1]); | |
4907 return *arg; | |
4908 } | |
4909 | |
4910 #ifdef FEAT_CMDWIN | |
4911 /* | |
4912 * Check value of 'cedit' and set cedit_key. | |
4913 * Returns NULL if value is OK, error message otherwise. | |
4914 */ | |
4915 static char_u * | |
4916 check_cedit() | |
4917 { | |
4918 int n; | |
4919 | |
4920 if (*p_cedit == NUL) | |
4921 cedit_key = -1; | |
4922 else | |
4923 { | |
4924 n = string_to_key(p_cedit); | |
4925 if (vim_isprintc(n)) | |
4926 return e_invarg; | |
4927 cedit_key = n; | |
4928 } | |
4929 return NULL; | |
4930 } | |
4931 #endif | |
4932 | |
4933 #ifdef FEAT_TITLE | |
4934 /* | |
4935 * When changing 'title', 'titlestring', 'icon' or 'iconstring', call | |
4936 * maketitle() to create and display it. | |
4937 * When switching the title or icon off, call mch_restore_title() to get | |
4938 * the old value back. | |
4939 */ | |
4940 static void | |
4941 did_set_title(icon) | |
4942 int icon; /* Did set icon instead of title */ | |
4943 { | |
4944 if (starting != NO_SCREEN | |
4945 #ifdef FEAT_GUI | |
4946 && !gui.starting | |
4947 #endif | |
4948 ) | |
4949 { | |
4950 maketitle(); | |
4951 if (icon) | |
4952 { | |
4953 if (!p_icon) | |
4954 mch_restore_title(2); | |
4955 } | |
4956 else | |
4957 { | |
4958 if (!p_title) | |
4959 mch_restore_title(1); | |
4960 } | |
4961 } | |
4962 } | |
4963 #endif | |
4964 | |
4965 /* | |
4966 * set_options_bin - called when 'bin' changes value. | |
4967 */ | |
4968 void | |
4969 set_options_bin(oldval, newval, opt_flags) | |
4970 int oldval; | |
4971 int newval; | |
4972 int opt_flags; /* OPT_LOCAL and/or OPT_GLOBAL */ | |
4973 { | |
4974 /* | |
4975 * The option values that are changed when 'bin' changes are | |
4976 * copied when 'bin is set and restored when 'bin' is reset. | |
4977 */ | |
4978 if (newval) | |
4979 { | |
4980 if (!oldval) /* switched on */ | |
4981 { | |
4982 if (!(opt_flags & OPT_GLOBAL)) | |
4983 { | |
4984 curbuf->b_p_tw_nobin = curbuf->b_p_tw; | |
4985 curbuf->b_p_wm_nobin = curbuf->b_p_wm; | |
4986 curbuf->b_p_ml_nobin = curbuf->b_p_ml; | |
4987 curbuf->b_p_et_nobin = curbuf->b_p_et; | |
4988 } | |
4989 if (!(opt_flags & OPT_LOCAL)) | |
4990 { | |
4991 p_tw_nobin = p_tw; | |
4992 p_wm_nobin = p_wm; | |
4993 p_ml_nobin = p_ml; | |
4994 p_et_nobin = p_et; | |
4995 } | |
4996 } | |
4997 | |
4998 if (!(opt_flags & OPT_GLOBAL)) | |
4999 { | |
5000 curbuf->b_p_tw = 0; /* no automatic line wrap */ | |
5001 curbuf->b_p_wm = 0; /* no automatic line wrap */ | |
5002 curbuf->b_p_ml = 0; /* no modelines */ | |
5003 curbuf->b_p_et = 0; /* no expandtab */ | |
5004 } | |
5005 if (!(opt_flags & OPT_LOCAL)) | |
5006 { | |
5007 p_tw = 0; | |
5008 p_wm = 0; | |
5009 p_ml = FALSE; | |
5010 p_et = FALSE; | |
5011 p_bin = TRUE; /* needed when called for the "-b" argument */ | |
5012 } | |
5013 } | |
5014 else if (oldval) /* switched off */ | |
5015 { | |
5016 if (!(opt_flags & OPT_GLOBAL)) | |
5017 { | |
5018 curbuf->b_p_tw = curbuf->b_p_tw_nobin; | |
5019 curbuf->b_p_wm = curbuf->b_p_wm_nobin; | |
5020 curbuf->b_p_ml = curbuf->b_p_ml_nobin; | |
5021 curbuf->b_p_et = curbuf->b_p_et_nobin; | |
5022 } | |
5023 if (!(opt_flags & OPT_LOCAL)) | |
5024 { | |
5025 p_tw = p_tw_nobin; | |
5026 p_wm = p_wm_nobin; | |
5027 p_ml = p_ml_nobin; | |
5028 p_et = p_et_nobin; | |
5029 } | |
5030 } | |
5031 } | |
5032 | |
5033 #ifdef FEAT_VIMINFO | |
5034 /* | |
5035 * Find the parameter represented by the given character (eg ', :, ", or /), | |
5036 * and return its associated value in the 'viminfo' string. | |
5037 * Only works for number parameters, not for 'r' or 'n'. | |
23 | 5038 * If the parameter is not specified in the string or there is no following |
5039 * number, return -1. | |
7 | 5040 */ |
5041 int | |
5042 get_viminfo_parameter(type) | |
5043 int type; | |
5044 { | |
5045 char_u *p; | |
5046 | |
5047 p = find_viminfo_parameter(type); | |
5048 if (p != NULL && VIM_ISDIGIT(*p)) | |
5049 return atoi((char *)p); | |
5050 return -1; | |
5051 } | |
5052 | |
5053 /* | |
5054 * Find the parameter represented by the given character (eg ''', ':', '"', or | |
5055 * '/') in the 'viminfo' option and return a pointer to the string after it. | |
5056 * Return NULL if the parameter is not specified in the string. | |
5057 */ | |
5058 char_u * | |
5059 find_viminfo_parameter(type) | |
5060 int type; | |
5061 { | |
5062 char_u *p; | |
5063 | |
5064 for (p = p_viminfo; *p; ++p) | |
5065 { | |
5066 if (*p == type) | |
5067 return p + 1; | |
5068 if (*p == 'n') /* 'n' is always the last one */ | |
5069 break; | |
5070 p = vim_strchr(p, ','); /* skip until next ',' */ | |
5071 if (p == NULL) /* hit the end without finding parameter */ | |
5072 break; | |
5073 } | |
5074 return NULL; | |
5075 } | |
5076 #endif | |
5077 | |
5078 /* | |
5079 * Expand environment variables for some string options. | |
5080 * These string options cannot be indirect! | |
5081 * If "val" is NULL expand the current value of the option. | |
5082 * Return pointer to NameBuff, or NULL when not expanded. | |
5083 */ | |
5084 static char_u * | |
5085 option_expand(opt_idx, val) | |
5086 int opt_idx; | |
5087 char_u *val; | |
5088 { | |
5089 /* if option doesn't need expansion nothing to do */ | |
5090 if (!(options[opt_idx].flags & P_EXPAND) || options[opt_idx].var == NULL) | |
5091 return NULL; | |
5092 | |
5093 /* If val is longer than MAXPATHL no meaningful expansion can be done, | |
5094 * expand_env() would truncate the string. */ | |
5095 if (val != NULL && STRLEN(val) > MAXPATHL) | |
5096 return NULL; | |
5097 | |
5098 if (val == NULL) | |
5099 val = *(char_u **)options[opt_idx].var; | |
5100 | |
5101 /* | |
5102 * Expanding this with NameBuff, expand_env() must not be passed IObuff. | |
5103 * Escape spaces when expanding 'tags', they are used to separate file | |
5104 * names. | |
374 | 5105 * For 'spellsuggest' expand after "file:". |
7 | 5106 */ |
5107 expand_env_esc(val, NameBuff, MAXPATHL, | |
1408 | 5108 (char_u **)options[opt_idx].var == &p_tags, FALSE, |
744 | 5109 #ifdef FEAT_SPELL |
374 | 5110 (char_u **)options[opt_idx].var == &p_sps ? (char_u *)"file:" : |
5111 #endif | |
5112 NULL); | |
7 | 5113 if (STRCMP(NameBuff, val) == 0) /* they are the same */ |
5114 return NULL; | |
5115 | |
5116 return NameBuff; | |
5117 } | |
5118 | |
5119 /* | |
5120 * After setting various option values: recompute variables that depend on | |
5121 * option values. | |
5122 */ | |
5123 static void | |
5124 didset_options() | |
5125 { | |
5126 /* initialize the table for 'iskeyword' et.al. */ | |
5127 (void)init_chartab(); | |
5128 | |
805 | 5129 #ifdef FEAT_MBYTE |
7 | 5130 (void)opt_strings_flags(p_cmp, p_cmp_values, &cmp_flags, TRUE); |
805 | 5131 #endif |
7 | 5132 (void)opt_strings_flags(p_bkc, p_bkc_values, &bkc_flags, TRUE); |
5133 #ifdef FEAT_SESSION | |
5134 (void)opt_strings_flags(p_ssop, p_ssop_values, &ssop_flags, TRUE); | |
5135 (void)opt_strings_flags(p_vop, p_ssop_values, &vop_flags, TRUE); | |
5136 #endif | |
5137 #ifdef FEAT_FOLDING | |
5138 (void)opt_strings_flags(p_fdo, p_fdo_values, &fdo_flags, TRUE); | |
5139 #endif | |
5140 (void)opt_strings_flags(p_dy, p_dy_values, &dy_flags, TRUE); | |
5141 #ifdef FEAT_VIRTUALEDIT | |
5142 (void)opt_strings_flags(p_ve, p_ve_values, &ve_flags, TRUE); | |
5143 #endif | |
5144 #if defined(FEAT_MOUSE) && (defined(UNIX) || defined(VMS)) | |
5145 (void)opt_strings_flags(p_ttym, p_ttym_values, &ttym_flags, FALSE); | |
5146 #endif | |
744 | 5147 #ifdef FEAT_SPELL |
484 | 5148 (void)spell_check_msm(); |
374 | 5149 (void)spell_check_sps(); |
2250
1bac28a53fae
Add the conceal patch from Vince Negri.
Bram Moolenaar <bram@vim.org>
parents:
2248
diff
changeset
|
5150 (void)compile_cap_prog(curwin->w_s); |
344 | 5151 #endif |
7 | 5152 #if defined(FEAT_TOOLBAR) && !defined(FEAT_GUI_W32) |
5153 (void)opt_strings_flags(p_toolbar, p_toolbar_values, &toolbar_flags, TRUE); | |
5154 #endif | |
2275
e4d849f4df03
Remove the old and not well supported GTK 1 code. (James Vega)
Bram Moolenaar <bram@vim.org>
parents:
2271
diff
changeset
|
5155 #if defined(FEAT_TOOLBAR) && defined(FEAT_GUI_GTK) |
7 | 5156 (void)opt_strings_flags(p_tbis, p_tbis_values, &tbis_flags, FALSE); |
5157 #endif | |
5158 #ifdef FEAT_CMDWIN | |
5159 /* set cedit_key */ | |
5160 (void)check_cedit(); | |
5161 #endif | |
5162 } | |
5163 | |
5164 /* | |
5165 * Check for string options that are NULL (normally only termcap options). | |
5166 */ | |
5167 void | |
5168 check_options() | |
5169 { | |
5170 int opt_idx; | |
5171 | |
5172 for (opt_idx = 0; options[opt_idx].fullname != NULL; opt_idx++) | |
5173 if ((options[opt_idx].flags & P_STRING) && options[opt_idx].var != NULL) | |
5174 check_string_option((char_u **)get_varp(&(options[opt_idx]))); | |
5175 } | |
5176 | |
5177 /* | |
5178 * Check string options in a buffer for NULL value. | |
5179 */ | |
5180 void | |
5181 check_buf_options(buf) | |
5182 buf_T *buf; | |
5183 { | |
5184 #if defined(FEAT_QUICKFIX) | |
5185 check_string_option(&buf->b_p_bh); | |
5186 check_string_option(&buf->b_p_bt); | |
5187 #endif | |
5188 #ifdef FEAT_MBYTE | |
5189 check_string_option(&buf->b_p_fenc); | |
5190 #endif | |
5191 check_string_option(&buf->b_p_ff); | |
5192 #ifdef FEAT_FIND_ID | |
5193 check_string_option(&buf->b_p_def); | |
5194 check_string_option(&buf->b_p_inc); | |
5195 # ifdef FEAT_EVAL | |
5196 check_string_option(&buf->b_p_inex); | |
5197 # endif | |
5198 #endif | |
5199 #if defined(FEAT_CINDENT) && defined(FEAT_EVAL) | |
5200 check_string_option(&buf->b_p_inde); | |
5201 check_string_option(&buf->b_p_indk); | |
5202 #endif | |
790 | 5203 #if defined(FEAT_BEVAL) && defined(FEAT_EVAL) |
5204 check_string_option(&buf->b_p_bexpr); | |
5205 #endif | |
667 | 5206 #if defined(FEAT_EVAL) |
5207 check_string_option(&buf->b_p_fex); | |
5208 #endif | |
7 | 5209 #ifdef FEAT_CRYPT |
5210 check_string_option(&buf->b_p_key); | |
5211 #endif | |
5212 check_string_option(&buf->b_p_kp); | |
5213 check_string_option(&buf->b_p_mps); | |
5214 check_string_option(&buf->b_p_fo); | |
41 | 5215 check_string_option(&buf->b_p_flp); |
7 | 5216 check_string_option(&buf->b_p_isk); |
5217 #ifdef FEAT_COMMENTS | |
5218 check_string_option(&buf->b_p_com); | |
5219 #endif | |
5220 #ifdef FEAT_FOLDING | |
5221 check_string_option(&buf->b_p_cms); | |
5222 #endif | |
5223 check_string_option(&buf->b_p_nf); | |
12 | 5224 #ifdef FEAT_TEXTOBJ |
5225 check_string_option(&buf->b_p_qe); | |
5226 #endif | |
7 | 5227 #ifdef FEAT_SYN_HL |
5228 check_string_option(&buf->b_p_syn); | |
744 | 5229 #endif |
5230 #ifdef FEAT_SPELL | |
2250
1bac28a53fae
Add the conceal patch from Vince Negri.
Bram Moolenaar <bram@vim.org>
parents:
2248
diff
changeset
|
5231 check_string_option(&buf->b_s.b_p_spc); |
1bac28a53fae
Add the conceal patch from Vince Negri.
Bram Moolenaar <bram@vim.org>
parents:
2248
diff
changeset
|
5232 check_string_option(&buf->b_s.b_p_spf); |
1bac28a53fae
Add the conceal patch from Vince Negri.
Bram Moolenaar <bram@vim.org>
parents:
2248
diff
changeset
|
5233 check_string_option(&buf->b_s.b_p_spl); |
7 | 5234 #endif |
5235 #ifdef FEAT_SEARCHPATH | |
5236 check_string_option(&buf->b_p_sua); | |
5237 #endif | |
5238 #ifdef FEAT_CINDENT | |
5239 check_string_option(&buf->b_p_cink); | |
5240 check_string_option(&buf->b_p_cino); | |
5241 #endif | |
5242 #ifdef FEAT_AUTOCMD | |
5243 check_string_option(&buf->b_p_ft); | |
5244 #endif | |
5245 #ifdef FEAT_OSFILETYPE | |
5246 check_string_option(&buf->b_p_oft); | |
5247 #endif | |
5248 #if defined(FEAT_SMARTINDENT) || defined(FEAT_CINDENT) | |
5249 check_string_option(&buf->b_p_cinw); | |
5250 #endif | |
5251 #ifdef FEAT_INS_EXPAND | |
5252 check_string_option(&buf->b_p_cpt); | |
5253 #endif | |
12 | 5254 #ifdef FEAT_COMPL_FUNC |
5255 check_string_option(&buf->b_p_cfu); | |
502 | 5256 check_string_option(&buf->b_p_ofu); |
12 | 5257 #endif |
7 | 5258 #ifdef FEAT_KEYMAP |
5259 check_string_option(&buf->b_p_keymap); | |
5260 #endif | |
5261 #ifdef FEAT_QUICKFIX | |
5262 check_string_option(&buf->b_p_gp); | |
5263 check_string_option(&buf->b_p_mp); | |
5264 check_string_option(&buf->b_p_efm); | |
5265 #endif | |
5266 check_string_option(&buf->b_p_ep); | |
5267 check_string_option(&buf->b_p_path); | |
5268 check_string_option(&buf->b_p_tags); | |
5269 #ifdef FEAT_INS_EXPAND | |
5270 check_string_option(&buf->b_p_dict); | |
5271 check_string_option(&buf->b_p_tsr); | |
5272 #endif | |
5273 } | |
5274 | |
5275 /* | |
5276 * Free the string allocated for an option. | |
5277 * Checks for the string being empty_option. This may happen if we're out of | |
5278 * memory, vim_strsave() returned NULL, which was replaced by empty_option by | |
5279 * check_options(). | |
5280 * Does NOT check for P_ALLOCED flag! | |
5281 */ | |
5282 void | |
5283 free_string_option(p) | |
5284 char_u *p; | |
5285 { | |
5286 if (p != empty_option) | |
5287 vim_free(p); | |
5288 } | |
5289 | |
5290 void | |
5291 clear_string_option(pp) | |
5292 char_u **pp; | |
5293 { | |
5294 if (*pp != empty_option) | |
5295 vim_free(*pp); | |
5296 *pp = empty_option; | |
5297 } | |
5298 | |
5299 static void | |
5300 check_string_option(pp) | |
5301 char_u **pp; | |
5302 { | |
5303 if (*pp == NULL) | |
5304 *pp = empty_option; | |
5305 } | |
5306 | |
5307 /* | |
5308 * Mark a terminal option as allocated, found by a pointer into term_strings[]. | |
5309 */ | |
5310 void | |
5311 set_term_option_alloced(p) | |
5312 char_u **p; | |
5313 { | |
5314 int opt_idx; | |
5315 | |
5316 for (opt_idx = 1; options[opt_idx].fullname != NULL; opt_idx++) | |
5317 if (options[opt_idx].var == (char_u *)p) | |
5318 { | |
5319 options[opt_idx].flags |= P_ALLOCED; | |
5320 return; | |
5321 } | |
5322 return; /* cannot happen: didn't find it! */ | |
5323 } | |
5324 | |
634 | 5325 #if defined(FEAT_EVAL) || defined(PROTO) |
5326 /* | |
5327 * Return TRUE when option "opt" was set from a modeline or in secure mode. | |
5328 * Return FALSE when it wasn't. | |
5329 * Return -1 for an unknown option. | |
5330 */ | |
5331 int | |
681 | 5332 was_set_insecurely(opt, opt_flags) |
5333 char_u *opt; | |
5334 int opt_flags; | |
634 | 5335 { |
5336 int idx = findoption(opt); | |
681 | 5337 long_u *flagp; |
634 | 5338 |
5339 if (idx >= 0) | |
681 | 5340 { |
5341 flagp = insecure_flag(idx, opt_flags); | |
5342 return (*flagp & P_INSECURE) != 0; | |
5343 } | |
634 | 5344 EMSG2(_(e_intern2), "was_set_insecurely()"); |
5345 return -1; | |
5346 } | |
681 | 5347 |
5348 /* | |
5349 * Get a pointer to the flags used for the P_INSECURE flag of option | |
5350 * "opt_idx". For some local options a local flags field is used. | |
5351 */ | |
5352 static long_u * | |
5353 insecure_flag(opt_idx, opt_flags) | |
5354 int opt_idx; | |
5355 int opt_flags; | |
5356 { | |
5357 if (opt_flags & OPT_LOCAL) | |
5358 switch ((int)options[opt_idx].indir) | |
5359 { | |
5360 #ifdef FEAT_STL_OPT | |
694 | 5361 case PV_STL: return &curwin->w_p_stl_flags; |
681 | 5362 #endif |
5363 #ifdef FEAT_EVAL | |
885 | 5364 # ifdef FEAT_FOLDING |
694 | 5365 case PV_FDE: return &curwin->w_p_fde_flags; |
5366 case PV_FDT: return &curwin->w_p_fdt_flags; | |
885 | 5367 # endif |
790 | 5368 # ifdef FEAT_BEVAL |
5369 case PV_BEXPR: return &curbuf->b_p_bexpr_flags; | |
5370 # endif | |
681 | 5371 # if defined(FEAT_CINDENT) |
694 | 5372 case PV_INDE: return &curbuf->b_p_inde_flags; |
681 | 5373 # endif |
694 | 5374 case PV_FEX: return &curbuf->b_p_fex_flags; |
681 | 5375 # ifdef FEAT_FIND_ID |
694 | 5376 case PV_INEX: return &curbuf->b_p_inex_flags; |
681 | 5377 # endif |
5378 #endif | |
5379 } | |
5380 | |
5381 /* Nothing special, return global flags field. */ | |
5382 return &options[opt_idx].flags; | |
5383 } | |
634 | 5384 #endif |
5385 | |
1805 | 5386 #ifdef FEAT_TITLE |
5387 static void redraw_titles __ARGS((void)); | |
5388 | |
5389 /* | |
5390 * Redraw the window title and/or tab page text later. | |
5391 */ | |
5392 static void redraw_titles() | |
5393 { | |
5394 need_maketitle = TRUE; | |
5395 # ifdef FEAT_WINDOWS | |
5396 redraw_tabline = TRUE; | |
5397 # endif | |
5398 } | |
5399 #endif | |
5400 | |
7 | 5401 /* |
5402 * Set a string option to a new value (without checking the effect). | |
5403 * The string is copied into allocated memory. | |
5404 * if ("opt_idx" == -1) "name" is used, otherwise "opt_idx" is used. | |
694 | 5405 * When "set_sid" is zero set the scriptID to current_SID. When "set_sid" is |
1157 | 5406 * SID_NONE don't set the scriptID. Otherwise set the scriptID to "set_sid". |
7 | 5407 */ |
5408 void | |
694 | 5409 set_string_option_direct(name, opt_idx, val, opt_flags, set_sid) |
7 | 5410 char_u *name; |
5411 int opt_idx; | |
5412 char_u *val; | |
5413 int opt_flags; /* OPT_FREE, OPT_LOCAL and/or OPT_GLOBAL */ | |
1877 | 5414 int set_sid UNUSED; |
7 | 5415 { |
5416 char_u *s; | |
5417 char_u **varp; | |
5418 int both = (opt_flags & (OPT_LOCAL | OPT_GLOBAL)) == 0; | |
944 | 5419 int idx = opt_idx; |
5420 | |
5421 if (idx == -1) /* use name */ | |
5422 { | |
5423 idx = findoption(name); | |
5424 if (idx < 0) /* not found (should not happen) */ | |
694 | 5425 { |
5426 EMSG2(_(e_intern2), "set_string_option_direct()"); | |
7 | 5427 return; |
694 | 5428 } |
7 | 5429 } |
5430 | |
944 | 5431 if (options[idx].var == NULL) /* can't set hidden option */ |
7 | 5432 return; |
5433 | |
5434 s = vim_strsave(val); | |
5435 if (s != NULL) | |
5436 { | |
944 | 5437 varp = (char_u **)get_varp_scope(&(options[idx]), |
7 | 5438 both ? OPT_LOCAL : opt_flags); |
944 | 5439 if ((opt_flags & OPT_FREE) && (options[idx].flags & P_ALLOCED)) |
7 | 5440 free_string_option(*varp); |
5441 *varp = s; | |
5442 | |
5443 /* For buffer/window local option may also set the global value. */ | |
5444 if (both) | |
944 | 5445 set_string_option_global(idx, varp); |
5446 | |
5447 options[idx].flags |= P_ALLOCED; | |
7 | 5448 |
5449 /* When setting both values of a global option with a local value, | |
5450 * make the local value empty, so that the global value is used. */ | |
944 | 5451 if (((int)options[idx].indir & PV_BOTH) && both) |
7 | 5452 { |
5453 free_string_option(*varp); | |
5454 *varp = empty_option; | |
5455 } | |
694 | 5456 # ifdef FEAT_EVAL |
5457 if (set_sid != SID_NONE) | |
944 | 5458 set_option_scriptID_idx(idx, opt_flags, |
694 | 5459 set_sid == 0 ? current_SID : set_sid); |
5460 # endif | |
7 | 5461 } |
5462 } | |
5463 | |
5464 /* | |
5465 * Set global value for string option when it's a local option. | |
5466 */ | |
5467 static void | |
5468 set_string_option_global(opt_idx, varp) | |
5469 int opt_idx; /* option index */ | |
5470 char_u **varp; /* pointer to option variable */ | |
5471 { | |
5472 char_u **p, *s; | |
5473 | |
5474 /* the global value is always allocated */ | |
5475 if (options[opt_idx].var == VAR_WIN) | |
5476 p = (char_u **)GLOBAL_WO(varp); | |
5477 else | |
5478 p = (char_u **)options[opt_idx].var; | |
5479 if (options[opt_idx].indir != PV_NONE | |
5480 && p != varp | |
5481 && (s = vim_strsave(*varp)) != NULL) | |
5482 { | |
5483 free_string_option(*p); | |
5484 *p = s; | |
5485 } | |
5486 } | |
5487 | |
5488 /* | |
5489 * Set a string option to a new value, and handle the effects. | |
5490 */ | |
5491 static void | |
5492 set_string_option(opt_idx, value, opt_flags) | |
5493 int opt_idx; | |
5494 char_u *value; | |
5495 int opt_flags; /* OPT_LOCAL and/or OPT_GLOBAL */ | |
5496 { | |
5497 char_u *s; | |
5498 char_u **varp; | |
5499 char_u *oldval; | |
5500 | |
5501 if (options[opt_idx].var == NULL) /* don't set hidden option */ | |
5502 return; | |
5503 | |
5504 s = vim_strsave(value); | |
5505 if (s != NULL) | |
5506 { | |
5507 varp = (char_u **)get_varp_scope(&(options[opt_idx]), | |
5508 (opt_flags & (OPT_LOCAL | OPT_GLOBAL)) == 0 | |
692 | 5509 ? (((int)options[opt_idx].indir & PV_BOTH) |
7 | 5510 ? OPT_GLOBAL : OPT_LOCAL) |
5511 : opt_flags); | |
5512 oldval = *varp; | |
5513 *varp = s; | |
634 | 5514 if (did_set_string_option(opt_idx, varp, TRUE, oldval, NULL, |
5515 opt_flags) == NULL) | |
5516 did_set_option(opt_idx, opt_flags, TRUE); | |
7 | 5517 } |
5518 } | |
5519 | |
5520 /* | |
5521 * Handle string options that need some action to perform when changed. | |
5522 * Returns NULL for success, or an error message for an error. | |
5523 */ | |
5524 static char_u * | |
5525 did_set_string_option(opt_idx, varp, new_value_alloced, oldval, errbuf, | |
5526 opt_flags) | |
5527 int opt_idx; /* index in options[] table */ | |
5528 char_u **varp; /* pointer to the option variable */ | |
5529 int new_value_alloced; /* new value was allocated */ | |
5530 char_u *oldval; /* previous value of the option */ | |
5531 char_u *errbuf; /* buffer for errors, or NULL */ | |
5532 int opt_flags; /* OPT_LOCAL and/or OPT_GLOBAL */ | |
5533 { | |
5534 char_u *errmsg = NULL; | |
5535 char_u *s, *p; | |
5536 int did_chartab = FALSE; | |
5537 char_u **gvarp; | |
835 | 5538 long_u free_oldval = (options[opt_idx].flags & P_ALLOCED); |
1801 | 5539 #ifdef FEAT_GUI |
5540 /* set when changing an option that only requires a redraw in the GUI */ | |
5541 int redraw_gui_only = FALSE; | |
5542 #endif | |
7 | 5543 |
5544 /* Get the global option to compare with, otherwise we would have to check | |
5545 * two values for all local options. */ | |
5546 gvarp = (char_u **)get_varp_scope(&(options[opt_idx]), OPT_GLOBAL); | |
5547 | |
5548 /* Disallow changing some options from secure mode */ | |
5549 if ((secure | |
5550 #ifdef HAVE_SANDBOX | |
5551 || sandbox != 0 | |
5552 #endif | |
5553 ) && (options[opt_idx].flags & P_SECURE)) | |
5554 { | |
5555 errmsg = e_secure; | |
5556 } | |
5557 | |
36 | 5558 /* Check for a "normal" file name in some options. Disallow a path |
5559 * separator (slash and/or backslash), wildcards and characters that are | |
5560 * often illegal in a file name. */ | |
5561 else if ((options[opt_idx].flags & P_NFNAME) | |
39 | 5562 && vim_strpbrk(*varp, (char_u *)"/\\*?[|<>") != NULL) |
36 | 5563 { |
5564 errmsg = e_invarg; | |
5565 } | |
5566 | |
7 | 5567 /* 'term' */ |
5568 else if (varp == &T_NAME) | |
5569 { | |
5570 if (T_NAME[0] == NUL) | |
5571 errmsg = (char_u *)N_("E529: Cannot set 'term' to empty string"); | |
5572 #ifdef FEAT_GUI | |
5573 if (gui.in_use) | |
5574 errmsg = (char_u *)N_("E530: Cannot change term in GUI"); | |
5575 else if (term_is_gui(T_NAME)) | |
5576 errmsg = (char_u *)N_("E531: Use \":gui\" to start the GUI"); | |
5577 #endif | |
5578 else if (set_termname(T_NAME) == FAIL) | |
5579 errmsg = (char_u *)N_("E522: Not found in termcap"); | |
5580 else | |
5581 /* Screen colors may have changed. */ | |
5582 redraw_later_clear(); | |
5583 } | |
5584 | |
5585 /* 'backupcopy' */ | |
5586 else if (varp == &p_bkc) | |
5587 { | |
5588 if (opt_strings_flags(p_bkc, p_bkc_values, &bkc_flags, TRUE) != OK) | |
5589 errmsg = e_invarg; | |
5590 if (((bkc_flags & BKC_AUTO) != 0) | |
5591 + ((bkc_flags & BKC_YES) != 0) | |
5592 + ((bkc_flags & BKC_NO) != 0) != 1) | |
5593 { | |
5594 /* Must have exactly one of "auto", "yes" and "no". */ | |
5595 (void)opt_strings_flags(oldval, p_bkc_values, &bkc_flags, TRUE); | |
5596 errmsg = e_invarg; | |
5597 } | |
5598 } | |
5599 | |
5600 /* 'backupext' and 'patchmode' */ | |
5601 else if (varp == &p_bex || varp == &p_pm) | |
5602 { | |
5603 if (STRCMP(*p_bex == '.' ? p_bex + 1 : p_bex, | |
5604 *p_pm == '.' ? p_pm + 1 : p_pm) == 0) | |
5605 errmsg = (char_u *)N_("E589: 'backupext' and 'patchmode' are equal"); | |
5606 } | |
5607 | |
5608 /* | |
5609 * 'isident', 'iskeyword', 'isprint or 'isfname' option: refill chartab[] | |
5610 * If the new option is invalid, use old value. 'lisp' option: refill | |
5611 * chartab[] for '-' char | |
5612 */ | |
5613 else if ( varp == &p_isi | |
5614 || varp == &(curbuf->b_p_isk) | |
5615 || varp == &p_isp | |
5616 || varp == &p_isf) | |
5617 { | |
5618 if (init_chartab() == FAIL) | |
5619 { | |
5620 did_chartab = TRUE; /* need to restore it below */ | |
5621 errmsg = e_invarg; /* error in value */ | |
5622 } | |
5623 } | |
5624 | |
5625 /* 'helpfile' */ | |
5626 else if (varp == &p_hf) | |
5627 { | |
5628 /* May compute new values for $VIM and $VIMRUNTIME */ | |
5629 if (didset_vim) | |
5630 { | |
5631 vim_setenv((char_u *)"VIM", (char_u *)""); | |
5632 didset_vim = FALSE; | |
5633 } | |
5634 if (didset_vimruntime) | |
5635 { | |
5636 vim_setenv((char_u *)"VIMRUNTIME", (char_u *)""); | |
5637 didset_vimruntime = FALSE; | |
5638 } | |
5639 } | |
5640 | |
5641 #ifdef FEAT_MULTI_LANG | |
5642 /* 'helplang' */ | |
5643 else if (varp == &p_hlg) | |
5644 { | |
5645 /* Check for "", "ab", "ab,cd", etc. */ | |
5646 for (s = p_hlg; *s != NUL; s += 3) | |
5647 { | |
5648 if (s[1] == NUL || ((s[2] != ',' || s[3] == NUL) && s[2] != NUL)) | |
5649 { | |
5650 errmsg = e_invarg; | |
5651 break; | |
5652 } | |
5653 if (s[2] == NUL) | |
5654 break; | |
5655 } | |
5656 } | |
5657 #endif | |
5658 | |
5659 /* 'highlight' */ | |
5660 else if (varp == &p_hl) | |
5661 { | |
5662 if (highlight_changed() == FAIL) | |
5663 errmsg = e_invarg; /* invalid flags */ | |
5664 } | |
5665 | |
5666 /* 'nrformats' */ | |
5667 else if (gvarp == &p_nf) | |
5668 { | |
5669 if (check_opt_strings(*varp, p_nf_values, TRUE) != OK) | |
5670 errmsg = e_invarg; | |
5671 } | |
5672 | |
5673 #ifdef FEAT_SESSION | |
5674 /* 'sessionoptions' */ | |
5675 else if (varp == &p_ssop) | |
5676 { | |
5677 if (opt_strings_flags(p_ssop, p_ssop_values, &ssop_flags, TRUE) != OK) | |
5678 errmsg = e_invarg; | |
5679 if ((ssop_flags & SSOP_CURDIR) && (ssop_flags & SSOP_SESDIR)) | |
5680 { | |
5681 /* Don't allow both "sesdir" and "curdir". */ | |
5682 (void)opt_strings_flags(oldval, p_ssop_values, &ssop_flags, TRUE); | |
5683 errmsg = e_invarg; | |
5684 } | |
5685 } | |
5686 /* 'viewoptions' */ | |
5687 else if (varp == &p_vop) | |
5688 { | |
5689 if (opt_strings_flags(p_vop, p_ssop_values, &vop_flags, TRUE) != OK) | |
5690 errmsg = e_invarg; | |
5691 } | |
5692 #endif | |
5693 | |
5694 /* 'scrollopt' */ | |
5695 #ifdef FEAT_SCROLLBIND | |
5696 else if (varp == &p_sbo) | |
5697 { | |
5698 if (check_opt_strings(p_sbo, p_scbopt_values, TRUE) != OK) | |
5699 errmsg = e_invarg; | |
5700 } | |
5701 #endif | |
5702 | |
5703 /* 'ambiwidth' */ | |
5704 #ifdef FEAT_MBYTE | |
5705 else if (varp == &p_ambw) | |
5706 { | |
5707 if (check_opt_strings(p_ambw, p_ambw_values, FALSE) != OK) | |
5708 errmsg = e_invarg; | |
5709 } | |
5710 #endif | |
5711 | |
5712 /* 'background' */ | |
5713 else if (varp == &p_bg) | |
5714 { | |
5715 if (check_opt_strings(p_bg, p_bg_values, FALSE) == OK) | |
5716 { | |
5717 #ifdef FEAT_EVAL | |
5718 int dark = (*p_bg == 'd'); | |
5719 #endif | |
5720 | |
5721 init_highlight(FALSE, FALSE); | |
5722 | |
5723 #ifdef FEAT_EVAL | |
5724 if (dark != (*p_bg == 'd') | |
5725 && get_var_value((char_u *)"g:colors_name") != NULL) | |
5726 { | |
5727 /* The color scheme must have set 'background' back to another | |
5728 * value, that's not what we want here. Disable the color | |
5729 * scheme and set the colors again. */ | |
148 | 5730 do_unlet((char_u *)"g:colors_name", TRUE); |
7 | 5731 free_string_option(p_bg); |
5732 p_bg = vim_strsave((char_u *)(dark ? "dark" : "light")); | |
5733 check_string_option(&p_bg); | |
5734 init_highlight(FALSE, FALSE); | |
5735 } | |
5736 #endif | |
5737 } | |
5738 else | |
5739 errmsg = e_invarg; | |
5740 } | |
5741 | |
5742 /* 'wildmode' */ | |
5743 else if (varp == &p_wim) | |
5744 { | |
5745 if (check_opt_wim() == FAIL) | |
5746 errmsg = e_invarg; | |
5747 } | |
5748 | |
40 | 5749 #ifdef FEAT_CMDL_COMPL |
5750 /* 'wildoptions' */ | |
5751 else if (varp == &p_wop) | |
5752 { | |
5753 if (check_opt_strings(p_wop, p_wop_values, TRUE) != OK) | |
5754 errmsg = e_invarg; | |
5755 } | |
5756 #endif | |
5757 | |
7 | 5758 #ifdef FEAT_WAK |
5759 /* 'winaltkeys' */ | |
5760 else if (varp == &p_wak) | |
5761 { | |
5762 if (*p_wak == NUL | |
5763 || check_opt_strings(p_wak, p_wak_values, FALSE) != OK) | |
5764 errmsg = e_invarg; | |
5765 # ifdef FEAT_MENU | |
5766 # ifdef FEAT_GUI_MOTIF | |
5767 else if (gui.in_use) | |
5768 gui_motif_set_mnemonics(p_wak[0] == 'y' || p_wak[0] == 'm'); | |
5769 # else | |
5770 # ifdef FEAT_GUI_GTK | |
5771 else if (gui.in_use) | |
5772 gui_gtk_set_mnemonics(p_wak[0] == 'y' || p_wak[0] == 'm'); | |
5773 # endif | |
5774 # endif | |
5775 # endif | |
5776 } | |
5777 #endif | |
5778 | |
5779 #ifdef FEAT_AUTOCMD | |
5780 /* 'eventignore' */ | |
5781 else if (varp == &p_ei) | |
5782 { | |
5783 if (check_ei() == FAIL) | |
5784 errmsg = e_invarg; | |
5785 } | |
5786 #endif | |
5787 | |
5788 #ifdef FEAT_MBYTE | |
5789 /* 'encoding' and 'fileencoding' */ | |
5790 else if (varp == &p_enc || gvarp == &p_fenc || varp == &p_tenc) | |
5791 { | |
5792 if (gvarp == &p_fenc) | |
5793 { | |
1535 | 5794 if (!curbuf->b_p_ma && opt_flags != OPT_GLOBAL) |
7 | 5795 errmsg = e_modifiable; |
5796 else if (vim_strchr(*varp, ',') != NULL) | |
5797 /* No comma allowed in 'fileencoding'; catches confusing it | |
5798 * with 'fileencodings'. */ | |
5799 errmsg = e_invarg; | |
39 | 5800 else |
5801 { | |
7 | 5802 # ifdef FEAT_TITLE |
5803 /* May show a "+" in the title now. */ | |
1805 | 5804 redraw_titles(); |
7 | 5805 # endif |
39 | 5806 /* Add 'fileencoding' to the swap file. */ |
5807 ml_setflags(curbuf); | |
5808 } | |
7 | 5809 } |
5810 if (errmsg == NULL) | |
5811 { | |
5812 /* canonize the value, so that STRCMP() can be used on it */ | |
5813 p = enc_canonize(*varp); | |
5814 if (p != NULL) | |
5815 { | |
5816 vim_free(*varp); | |
5817 *varp = p; | |
5818 } | |
5819 if (varp == &p_enc) | |
5820 { | |
5821 errmsg = mb_init(); | |
5822 # ifdef FEAT_TITLE | |
1805 | 5823 redraw_titles(); |
7 | 5824 # endif |
5825 } | |
5826 } | |
5827 | |
2275
e4d849f4df03
Remove the old and not well supported GTK 1 code. (James Vega)
Bram Moolenaar <bram@vim.org>
parents:
2271
diff
changeset
|
5828 # if defined(FEAT_GUI_GTK) |
7 | 5829 if (errmsg == NULL && varp == &p_tenc && gui.in_use) |
5830 { | |
5831 /* GTK+ 2 uses only a single encoding, and that is UTF-8. */ | |
5832 if (STRCMP(p_tenc, "utf-8") != 0) | |
5833 errmsg = (char_u *)N_("E617: Cannot be changed in the GTK+ 2 GUI"); | |
5834 } | |
5835 # endif | |
5836 | |
5837 if (errmsg == NULL) | |
5838 { | |
5839 # ifdef FEAT_KEYMAP | |
5840 /* When 'keymap' is used and 'encoding' changes, reload the keymap | |
5841 * (with another encoding). */ | |
5842 if (varp == &p_enc && *curbuf->b_p_keymap != NUL) | |
5843 (void)keymap_init(); | |
5844 # endif | |
5845 | |
5846 /* When 'termencoding' is not empty and 'encoding' changes or when | |
5847 * 'termencoding' changes, need to setup for keyboard input and | |
5848 * display output conversion. */ | |
5849 if (((varp == &p_enc && *p_tenc != NUL) || varp == &p_tenc)) | |
5850 { | |
5851 convert_setup(&input_conv, p_tenc, p_enc); | |
5852 convert_setup(&output_conv, p_enc, p_tenc); | |
5853 } | |
170 | 5854 |
5855 # if defined(WIN3264) && defined(FEAT_MBYTE) | |
5856 /* $HOME may have characters in active code page. */ | |
5857 if (varp == &p_enc) | |
5858 init_homedir(); | |
5859 # endif | |
7 | 5860 } |
5861 } | |
5862 #endif | |
5863 | |
5864 #if defined(FEAT_POSTSCRIPT) | |
5865 else if (varp == &p_penc) | |
5866 { | |
5867 /* Canonize printencoding if VIM standard one */ | |
5868 p = enc_canonize(p_penc); | |
5869 if (p != NULL) | |
5870 { | |
5871 vim_free(p_penc); | |
5872 p_penc = p; | |
5873 } | |
5874 else | |
5875 { | |
5876 /* Ensure lower case and '-' for '_' */ | |
5877 for (s = p_penc; *s != NUL; s++) | |
5878 { | |
5879 if (*s == '_') | |
5880 *s = '-'; | |
5881 else | |
5882 *s = TOLOWER_ASC(*s); | |
5883 } | |
5884 } | |
5885 } | |
5886 #endif | |
5887 | |
574 | 5888 #if defined(FEAT_XIM) && defined(FEAT_GUI_GTK) |
7 | 5889 else if (varp == &p_imak) |
5890 { | |
5891 if (gui.in_use && !im_xim_isvalid_imactivate()) | |
5892 errmsg = e_invarg; | |
5893 } | |
5894 #endif | |
5895 | |
5896 #ifdef FEAT_KEYMAP | |
5897 else if (varp == &curbuf->b_p_keymap) | |
5898 { | |
5899 /* load or unload key mapping tables */ | |
5900 errmsg = keymap_init(); | |
5901 | |
1833 | 5902 if (errmsg == NULL) |
5903 { | |
5904 if (*curbuf->b_p_keymap != NUL) | |
5905 { | |
5906 /* Installed a new keymap, switch on using it. */ | |
5907 curbuf->b_p_iminsert = B_IMODE_LMAP; | |
5908 if (curbuf->b_p_imsearch != B_IMODE_USE_INSERT) | |
5909 curbuf->b_p_imsearch = B_IMODE_LMAP; | |
5910 } | |
5911 else | |
5912 { | |
5913 /* Cleared the keymap, may reset 'iminsert' and 'imsearch'. */ | |
5914 if (curbuf->b_p_iminsert == B_IMODE_LMAP) | |
5915 curbuf->b_p_iminsert = B_IMODE_NONE; | |
5916 if (curbuf->b_p_imsearch == B_IMODE_LMAP) | |
5917 curbuf->b_p_imsearch = B_IMODE_USE_INSERT; | |
5918 } | |
5919 if ((opt_flags & OPT_LOCAL) == 0) | |
5920 { | |
5921 set_iminsert_global(); | |
5922 set_imsearch_global(); | |
5923 } | |
7 | 5924 # ifdef FEAT_WINDOWS |
5925 status_redraw_curbuf(); | |
5926 # endif | |
5927 } | |
5928 } | |
5929 #endif | |
5930 | |
5931 /* 'fileformat' */ | |
5932 else if (gvarp == &p_ff) | |
5933 { | |
5934 if (!curbuf->b_p_ma && !(opt_flags & OPT_GLOBAL)) | |
5935 errmsg = e_modifiable; | |
5936 else if (check_opt_strings(*varp, p_ff_values, FALSE) != OK) | |
5937 errmsg = e_invarg; | |
5938 else | |
5939 { | |
5940 /* may also change 'textmode' */ | |
5941 if (get_fileformat(curbuf) == EOL_DOS) | |
5942 curbuf->b_p_tx = TRUE; | |
5943 else | |
5944 curbuf->b_p_tx = FALSE; | |
5945 #ifdef FEAT_TITLE | |
1805 | 5946 redraw_titles(); |
7 | 5947 #endif |
39 | 5948 /* update flag in swap file */ |
5949 ml_setflags(curbuf); | |
2073
5bedef935ce3
updated for version 7.2.357
Bram Moolenaar <bram@zimbu.org>
parents:
2060
diff
changeset
|
5950 /* Redraw needed when switching to/from "mac": a CR in the text |
5bedef935ce3
updated for version 7.2.357
Bram Moolenaar <bram@zimbu.org>
parents:
2060
diff
changeset
|
5951 * will be displayed differently. */ |
5bedef935ce3
updated for version 7.2.357
Bram Moolenaar <bram@zimbu.org>
parents:
2060
diff
changeset
|
5952 if (get_fileformat(curbuf) == EOL_MAC || *oldval == 'm') |
5bedef935ce3
updated for version 7.2.357
Bram Moolenaar <bram@zimbu.org>
parents:
2060
diff
changeset
|
5953 redraw_curbuf_later(NOT_VALID); |
7 | 5954 } |
5955 } | |
5956 | |
5957 /* 'fileformats' */ | |
5958 else if (varp == &p_ffs) | |
5959 { | |
5960 if (check_opt_strings(p_ffs, p_ff_values, TRUE) != OK) | |
5961 errmsg = e_invarg; | |
5962 else | |
5963 { | |
5964 /* also change 'textauto' */ | |
5965 if (*p_ffs == NUL) | |
5966 p_ta = FALSE; | |
5967 else | |
5968 p_ta = TRUE; | |
5969 } | |
5970 } | |
5971 | |
2267 | 5972 #if defined(FEAT_CRYPT) |
7 | 5973 /* 'cryptkey' */ |
5974 else if (gvarp == &p_key) | |
5975 { | |
2267 | 5976 # if defined(FEAT_CMDHIST) |
7 | 5977 /* Make sure the ":set" command doesn't show the new value in the |
5978 * history. */ | |
5979 remove_key_from_history(); | |
2267 | 5980 # endif |
5981 if (STRCMP(curbuf->b_p_key, oldval) != 0) | |
5982 /* Need to update the swapfile. */ | |
5983 ml_set_crypt_key(curbuf, oldval, curbuf->b_p_cm); | |
7 | 5984 } |
5985 #endif | |
5986 | |
5987 /* 'matchpairs' */ | |
5988 else if (gvarp == &p_mps) | |
5989 { | |
5990 /* Check for "x:y,x:y" */ | |
5991 for (p = *varp; *p != NUL; p += 4) | |
5992 { | |
5993 if (p[1] != ':' || p[2] == NUL || (p[3] != NUL && p[3] != ',')) | |
5994 { | |
5995 errmsg = e_invarg; | |
5996 break; | |
5997 } | |
5998 if (p[3] == NUL) | |
5999 break; | |
6000 } | |
6001 } | |
6002 | |
6003 #ifdef FEAT_COMMENTS | |
6004 /* 'comments' */ | |
6005 else if (gvarp == &p_com) | |
6006 { | |
6007 for (s = *varp; *s; ) | |
6008 { | |
6009 while (*s && *s != ':') | |
6010 { | |
6011 if (vim_strchr((char_u *)COM_ALL, *s) == NULL | |
6012 && !VIM_ISDIGIT(*s) && *s != '-') | |
6013 { | |
6014 errmsg = illegal_char(errbuf, *s); | |
6015 break; | |
6016 } | |
6017 ++s; | |
6018 } | |
6019 if (*s++ == NUL) | |
6020 errmsg = (char_u *)N_("E524: Missing colon"); | |
6021 else if (*s == ',' || *s == NUL) | |
6022 errmsg = (char_u *)N_("E525: Zero length string"); | |
6023 if (errmsg != NULL) | |
6024 break; | |
6025 while (*s && *s != ',') | |
6026 { | |
6027 if (*s == '\\' && s[1] != NUL) | |
6028 ++s; | |
6029 ++s; | |
6030 } | |
6031 s = skip_to_option_part(s); | |
6032 } | |
6033 } | |
6034 #endif | |
6035 | |
6036 /* 'listchars' */ | |
6037 else if (varp == &p_lcs) | |
6038 { | |
6039 errmsg = set_chars_option(varp); | |
6040 } | |
6041 | |
6042 #if defined(FEAT_WINDOWS) || defined(FEAT_FOLDING) | |
6043 /* 'fillchars' */ | |
6044 else if (varp == &p_fcs) | |
6045 { | |
6046 errmsg = set_chars_option(varp); | |
6047 } | |
6048 #endif | |
6049 | |
6050 #ifdef FEAT_CMDWIN | |
6051 /* 'cedit' */ | |
6052 else if (varp == &p_cedit) | |
6053 { | |
6054 errmsg = check_cedit(); | |
6055 } | |
6056 #endif | |
6057 | |
294 | 6058 /* 'verbosefile' */ |
6059 else if (varp == &p_vfile) | |
6060 { | |
6061 verbose_stop(); | |
6062 if (*p_vfile != NUL && verbose_open() == FAIL) | |
6063 errmsg = e_invarg; | |
6064 } | |
6065 | |
7 | 6066 #ifdef FEAT_VIMINFO |
6067 /* 'viminfo' */ | |
6068 else if (varp == &p_viminfo) | |
6069 { | |
6070 for (s = p_viminfo; *s;) | |
6071 { | |
6072 /* Check it's a valid character */ | |
6073 if (vim_strchr((char_u *)"!\"%'/:<@cfhnrs", *s) == NULL) | |
6074 { | |
6075 errmsg = illegal_char(errbuf, *s); | |
6076 break; | |
6077 } | |
6078 if (*s == 'n') /* name is always last one */ | |
6079 { | |
6080 break; | |
6081 } | |
6082 else if (*s == 'r') /* skip until next ',' */ | |
6083 { | |
6084 while (*++s && *s != ',') | |
6085 ; | |
6086 } | |
23 | 6087 else if (*s == '%') |
6088 { | |
6089 /* optional number */ | |
6090 while (vim_isdigit(*++s)) | |
6091 ; | |
6092 } | |
6093 else if (*s == '!' || *s == 'h' || *s == 'c') | |
7 | 6094 ++s; /* no extra chars */ |
6095 else /* must have a number */ | |
6096 { | |
6097 while (vim_isdigit(*++s)) | |
6098 ; | |
6099 | |
6100 if (!VIM_ISDIGIT(*(s - 1))) | |
6101 { | |
6102 if (errbuf != NULL) | |
6103 { | |
133 | 6104 sprintf((char *)errbuf, |
6105 _("E526: Missing number after <%s>"), | |
7 | 6106 transchar_byte(*(s - 1))); |
6107 errmsg = errbuf; | |
6108 } | |
6109 else | |
6110 errmsg = (char_u *)""; | |
6111 break; | |
6112 } | |
6113 } | |
6114 if (*s == ',') | |
6115 ++s; | |
6116 else if (*s) | |
6117 { | |
6118 if (errbuf != NULL) | |
6119 errmsg = (char_u *)N_("E527: Missing comma"); | |
6120 else | |
6121 errmsg = (char_u *)""; | |
6122 break; | |
6123 } | |
6124 } | |
6125 if (*p_viminfo && errmsg == NULL && get_viminfo_parameter('\'') < 0) | |
6126 errmsg = (char_u *)N_("E528: Must specify a ' value"); | |
6127 } | |
6128 #endif /* FEAT_VIMINFO */ | |
6129 | |
6130 /* terminal options */ | |
6131 else if (istermoption(&options[opt_idx]) && full_screen) | |
6132 { | |
6133 /* ":set t_Co=0" and ":set t_Co=1" do ":set t_Co=" */ | |
6134 if (varp == &T_CCO) | |
6135 { | |
1846 | 6136 int colors = atoi((char *)T_CCO); |
6137 | |
6138 /* Only reinitialize colors if t_Co value has really changed to | |
6139 * avoid expensive reload of colorscheme if t_Co is set to the | |
6140 * same value multiple times. */ | |
6141 if (colors != t_colors) | |
6142 { | |
6143 t_colors = colors; | |
6144 if (t_colors <= 1) | |
6145 { | |
6146 if (new_value_alloced) | |
6147 vim_free(T_CCO); | |
6148 T_CCO = empty_option; | |
6149 } | |
6150 /* We now have a different color setup, initialize it again. */ | |
6151 init_highlight(TRUE, FALSE); | |
6152 } | |
7 | 6153 } |
6154 ttest(FALSE); | |
6155 if (varp == &T_ME) | |
6156 { | |
6157 out_str(T_ME); | |
6158 redraw_later(CLEAR); | |
6159 #if defined(MSDOS) || (defined(WIN3264) && !defined(FEAT_GUI_W32)) | |
6160 /* Since t_me has been set, this probably means that the user | |
6161 * wants to use this as default colors. Need to reset default | |
6162 * background/foreground colors. */ | |
6163 mch_set_normal_colors(); | |
6164 #endif | |
6165 } | |
6166 } | |
6167 | |
6168 #ifdef FEAT_LINEBREAK | |
6169 /* 'showbreak' */ | |
6170 else if (varp == &p_sbr) | |
6171 { | |
6172 for (s = p_sbr; *s; ) | |
6173 { | |
6174 if (ptr2cells(s) != 1) | |
6175 errmsg = (char_u *)N_("E595: contains unprintable or wide character"); | |
39 | 6176 mb_ptr_adv(s); |
7 | 6177 } |
6178 } | |
6179 #endif | |
6180 | |
6181 #ifdef FEAT_GUI | |
6182 /* 'guifont' */ | |
6183 else if (varp == &p_guifont) | |
6184 { | |
6185 if (gui.in_use) | |
6186 { | |
6187 p = p_guifont; | |
574 | 6188 # if defined(FEAT_GUI_GTK) |
7 | 6189 /* |
6190 * Put up a font dialog and let the user select a new value. | |
6191 * If this is cancelled go back to the old value but don't | |
6192 * give an error message. | |
6193 */ | |
6194 if (STRCMP(p, "*") == 0) | |
6195 { | |
6196 p = gui_mch_font_dialog(oldval); | |
6197 | |
6198 if (new_value_alloced) | |
6199 free_string_option(p_guifont); | |
6200 | |
6201 p_guifont = (p != NULL) ? p : vim_strsave(oldval); | |
6202 new_value_alloced = TRUE; | |
6203 } | |
6204 # endif | |
6205 if (p != NULL && gui_init_font(p_guifont, FALSE) != OK) | |
6206 { | |
6207 # if defined(FEAT_GUI_MSWIN) || defined(FEAT_GUI_PHOTON) | |
6208 if (STRCMP(p_guifont, "*") == 0) | |
6209 { | |
6210 /* Dialog was cancelled: Keep the old value without giving | |
6211 * an error message. */ | |
6212 if (new_value_alloced) | |
6213 free_string_option(p_guifont); | |
6214 p_guifont = vim_strsave(oldval); | |
6215 new_value_alloced = TRUE; | |
6216 } | |
6217 else | |
6218 # endif | |
6219 errmsg = (char_u *)N_("E596: Invalid font(s)"); | |
6220 } | |
6221 } | |
1801 | 6222 redraw_gui_only = TRUE; |
7 | 6223 } |
6224 # ifdef FEAT_XFONTSET | |
6225 else if (varp == &p_guifontset) | |
6226 { | |
6227 if (STRCMP(p_guifontset, "*") == 0) | |
6228 errmsg = (char_u *)N_("E597: can't select fontset"); | |
6229 else if (gui.in_use && gui_init_font(p_guifontset, TRUE) != OK) | |
6230 errmsg = (char_u *)N_("E598: Invalid fontset"); | |
1801 | 6231 redraw_gui_only = TRUE; |
7 | 6232 } |
6233 # endif | |
6234 # ifdef FEAT_MBYTE | |
6235 else if (varp == &p_guifontwide) | |
6236 { | |
6237 if (STRCMP(p_guifontwide, "*") == 0) | |
6238 errmsg = (char_u *)N_("E533: can't select wide font"); | |
6239 else if (gui_get_wide_font() == FAIL) | |
6240 errmsg = (char_u *)N_("E534: Invalid wide font"); | |
1801 | 6241 redraw_gui_only = TRUE; |
7 | 6242 } |
6243 # endif | |
6244 #endif | |
6245 | |
6246 #ifdef CURSOR_SHAPE | |
6247 /* 'guicursor' */ | |
6248 else if (varp == &p_guicursor) | |
6249 errmsg = parse_shape_opt(SHAPE_CURSOR); | |
6250 #endif | |
6251 | |
6252 #ifdef FEAT_MOUSESHAPE | |
6253 /* 'mouseshape' */ | |
6254 else if (varp == &p_mouseshape) | |
6255 { | |
6256 errmsg = parse_shape_opt(SHAPE_MOUSE); | |
6257 update_mouseshape(-1); | |
6258 } | |
6259 #endif | |
6260 | |
6261 #ifdef FEAT_PRINTER | |
6262 else if (varp == &p_popt) | |
440 | 6263 errmsg = parse_printoptions(); |
16 | 6264 # if defined(FEAT_MBYTE) && defined(FEAT_POSTSCRIPT) |
15 | 6265 else if (varp == &p_pmfn) |
440 | 6266 errmsg = parse_printmbfont(); |
15 | 6267 # endif |
7 | 6268 #endif |
6269 | |
6270 #ifdef FEAT_LANGMAP | |
6271 /* 'langmap' */ | |
6272 else if (varp == &p_langmap) | |
6273 langmap_set(); | |
6274 #endif | |
6275 | |
6276 #ifdef FEAT_LINEBREAK | |
6277 /* 'breakat' */ | |
6278 else if (varp == &p_breakat) | |
6279 fill_breakat_flags(); | |
6280 #endif | |
6281 | |
6282 #ifdef FEAT_TITLE | |
6283 /* 'titlestring' and 'iconstring' */ | |
6284 else if (varp == &p_titlestring || varp == &p_iconstring) | |
6285 { | |
6286 # ifdef FEAT_STL_OPT | |
6287 int flagval = (varp == &p_titlestring) ? STL_IN_TITLE : STL_IN_ICON; | |
6288 | |
6289 /* NULL => statusline syntax */ | |
6290 if (vim_strchr(*varp, '%') && check_stl_option(*varp) == NULL) | |
6291 stl_syntax |= flagval; | |
6292 else | |
6293 stl_syntax &= ~flagval; | |
6294 # endif | |
6295 did_set_title(varp == &p_iconstring); | |
6296 | |
6297 } | |
6298 #endif | |
6299 | |
6300 #ifdef FEAT_GUI | |
6301 /* 'guioptions' */ | |
6302 else if (varp == &p_go) | |
1801 | 6303 { |
7 | 6304 gui_init_which_components(oldval); |
1801 | 6305 redraw_gui_only = TRUE; |
6306 } | |
7 | 6307 #endif |
6308 | |
688 | 6309 #if defined(FEAT_GUI_TABLINE) |
6310 /* 'guitablabel' */ | |
6311 else if (varp == &p_gtl) | |
1801 | 6312 { |
827 | 6313 redraw_tabline = TRUE; |
1801 | 6314 redraw_gui_only = TRUE; |
6315 } | |
6316 /* 'guitabtooltip' */ | |
6317 else if (varp == &p_gtt) | |
6318 { | |
6319 redraw_gui_only = TRUE; | |
6320 } | |
688 | 6321 #endif |
6322 | |
7 | 6323 #if defined(FEAT_MOUSE_TTY) && (defined(UNIX) || defined(VMS)) |
6324 /* 'ttymouse' */ | |
6325 else if (varp == &p_ttym) | |
6326 { | |
190 | 6327 /* Switch the mouse off before changing the escape sequences used for |
6328 * that. */ | |
6329 mch_setmouse(FALSE); | |
7 | 6330 if (opt_strings_flags(p_ttym, p_ttym_values, &ttym_flags, FALSE) != OK) |
6331 errmsg = e_invarg; | |
6332 else | |
6333 check_mouse_termcode(); | |
227 | 6334 if (termcap_active) |
6335 setmouse(); /* may switch it on again */ | |
7 | 6336 } |
6337 #endif | |
6338 | |
6339 #ifdef FEAT_VISUAL | |
6340 /* 'selection' */ | |
6341 else if (varp == &p_sel) | |
6342 { | |
6343 if (*p_sel == NUL | |
6344 || check_opt_strings(p_sel, p_sel_values, FALSE) != OK) | |
6345 errmsg = e_invarg; | |
6346 } | |
6347 | |
6348 /* 'selectmode' */ | |
6349 else if (varp == &p_slm) | |
6350 { | |
6351 if (check_opt_strings(p_slm, p_slm_values, TRUE) != OK) | |
6352 errmsg = e_invarg; | |
6353 } | |
6354 #endif | |
6355 | |
6356 #ifdef FEAT_BROWSE | |
6357 /* 'browsedir' */ | |
6358 else if (varp == &p_bsdir) | |
6359 { | |
6360 if (check_opt_strings(p_bsdir, p_bsdir_values, FALSE) != OK | |
6361 && !mch_isdir(p_bsdir)) | |
6362 errmsg = e_invarg; | |
6363 } | |
6364 #endif | |
6365 | |
6366 #ifdef FEAT_VISUAL | |
6367 /* 'keymodel' */ | |
6368 else if (varp == &p_km) | |
6369 { | |
6370 if (check_opt_strings(p_km, p_km_values, TRUE) != OK) | |
6371 errmsg = e_invarg; | |
6372 else | |
6373 { | |
6374 km_stopsel = (vim_strchr(p_km, 'o') != NULL); | |
6375 km_startsel = (vim_strchr(p_km, 'a') != NULL); | |
6376 } | |
6377 } | |
6378 #endif | |
6379 | |
6380 /* 'mousemodel' */ | |
6381 else if (varp == &p_mousem) | |
6382 { | |
6383 if (check_opt_strings(p_mousem, p_mousem_values, FALSE) != OK) | |
6384 errmsg = e_invarg; | |
6385 #if defined(FEAT_GUI_MOTIF) && defined(FEAT_MENU) && (XmVersion <= 1002) | |
6386 else if (*p_mousem != *oldval) | |
6387 /* Changed from "extend" to "popup" or "popup_setpos" or vv: need | |
6388 * to create or delete the popup menus. */ | |
6389 gui_motif_update_mousemodel(root_menu); | |
6390 #endif | |
6391 } | |
6392 | |
6393 /* 'switchbuf' */ | |
6394 else if (varp == &p_swb) | |
6395 { | |
1622 | 6396 if (opt_strings_flags(p_swb, p_swb_values, &swb_flags, TRUE) != OK) |
7 | 6397 errmsg = e_invarg; |
6398 } | |
6399 | |
6400 /* 'debug' */ | |
6401 else if (varp == &p_debug) | |
6402 { | |
839 | 6403 if (check_opt_strings(p_debug, p_debug_values, TRUE) != OK) |
7 | 6404 errmsg = e_invarg; |
6405 } | |
6406 | |
6407 /* 'display' */ | |
6408 else if (varp == &p_dy) | |
6409 { | |
6410 if (opt_strings_flags(p_dy, p_dy_values, &dy_flags, TRUE) != OK) | |
6411 errmsg = e_invarg; | |
6412 else | |
6413 (void)init_chartab(); | |
6414 | |
6415 } | |
6416 | |
6417 #ifdef FEAT_VERTSPLIT | |
6418 /* 'eadirection' */ | |
6419 else if (varp == &p_ead) | |
6420 { | |
6421 if (check_opt_strings(p_ead, p_ead_values, FALSE) != OK) | |
6422 errmsg = e_invarg; | |
6423 } | |
6424 #endif | |
6425 | |
6426 #ifdef FEAT_CLIPBOARD | |
6427 /* 'clipboard' */ | |
6428 else if (varp == &p_cb) | |
6429 errmsg = check_clipboard_option(); | |
6430 #endif | |
6431 | |
744 | 6432 #ifdef FEAT_SPELL |
323 | 6433 /* When 'spelllang' or 'spellfile' is set and there is a window for this |
6434 * buffer in which 'spell' is set load the wordlists. */ | |
2250
1bac28a53fae
Add the conceal patch from Vince Negri.
Bram Moolenaar <bram@vim.org>
parents:
2248
diff
changeset
|
6435 else if (varp == &(curbuf->b_s.b_p_spl) || varp == &(curbuf->b_s.b_p_spf)) |
221 | 6436 { |
258 | 6437 win_T *wp; |
323 | 6438 int l; |
6439 | |
2250
1bac28a53fae
Add the conceal patch from Vince Negri.
Bram Moolenaar <bram@vim.org>
parents:
2248
diff
changeset
|
6440 if (varp == &(curbuf->b_s.b_p_spf)) |
1bac28a53fae
Add the conceal patch from Vince Negri.
Bram Moolenaar <bram@vim.org>
parents:
2248
diff
changeset
|
6441 { |
1bac28a53fae
Add the conceal patch from Vince Negri.
Bram Moolenaar <bram@vim.org>
parents:
2248
diff
changeset
|
6442 l = (int)STRLEN(curbuf->b_s.b_p_spf); |
1bac28a53fae
Add the conceal patch from Vince Negri.
Bram Moolenaar <bram@vim.org>
parents:
2248
diff
changeset
|
6443 if (l > 0 && (l < 4 || STRCMP(curbuf->b_s.b_p_spf + l - 4, |
323 | 6444 ".add") != 0)) |
6445 errmsg = e_invarg; | |
6446 } | |
6447 | |
6448 if (errmsg == NULL) | |
6449 { | |
6450 FOR_ALL_WINDOWS(wp) | |
6451 if (wp->w_buffer == curbuf && wp->w_p_spell) | |
6452 { | |
2250
1bac28a53fae
Add the conceal patch from Vince Negri.
Bram Moolenaar <bram@vim.org>
parents:
2248
diff
changeset
|
6453 errmsg = did_set_spelllang(wp); |
258 | 6454 # ifdef FEAT_WINDOWS |
323 | 6455 break; |
258 | 6456 # endif |
323 | 6457 } |
6458 } | |
221 | 6459 } |
386 | 6460 /* When 'spellcapcheck' is set compile the regexp program. */ |
2250
1bac28a53fae
Add the conceal patch from Vince Negri.
Bram Moolenaar <bram@vim.org>
parents:
2248
diff
changeset
|
6461 else if (varp == &(curwin->w_s->b_p_spc)) |
1bac28a53fae
Add the conceal patch from Vince Negri.
Bram Moolenaar <bram@vim.org>
parents:
2248
diff
changeset
|
6462 { |
1bac28a53fae
Add the conceal patch from Vince Negri.
Bram Moolenaar <bram@vim.org>
parents:
2248
diff
changeset
|
6463 errmsg = compile_cap_prog(curwin->w_s); |
386 | 6464 } |
344 | 6465 /* 'spellsuggest' */ |
6466 else if (varp == &p_sps) | |
6467 { | |
374 | 6468 if (spell_check_sps() != OK) |
344 | 6469 errmsg = e_invarg; |
6470 } | |
484 | 6471 /* 'mkspellmem' */ |
6472 else if (varp == &p_msm) | |
6473 { | |
6474 if (spell_check_msm() != OK) | |
6475 errmsg = e_invarg; | |
6476 } | |
221 | 6477 #endif |
6478 | |
7 | 6479 #ifdef FEAT_QUICKFIX |
6480 /* When 'bufhidden' is set, check for valid value. */ | |
6481 else if (gvarp == &p_bh) | |
6482 { | |
6483 if (check_opt_strings(curbuf->b_p_bh, p_bufhidden_values, FALSE) != OK) | |
6484 errmsg = e_invarg; | |
6485 } | |
6486 | |
6487 /* When 'buftype' is set, check for valid value. */ | |
6488 else if (gvarp == &p_bt) | |
6489 { | |
6490 if (check_opt_strings(curbuf->b_p_bt, p_buftype_values, FALSE) != OK) | |
6491 errmsg = e_invarg; | |
6492 else | |
6493 { | |
6494 # ifdef FEAT_WINDOWS | |
6495 if (curwin->w_status_height) | |
6496 { | |
6497 curwin->w_redr_status = TRUE; | |
6498 redraw_later(VALID); | |
6499 } | |
6500 # endif | |
6501 curbuf->b_help = (curbuf->b_p_bt[0] == 'h'); | |
2060
1da25369227b
updated for version 7.2.345
Bram Moolenaar <bram@zimbu.org>
parents:
1958
diff
changeset
|
6502 # ifdef FEAT_TITLE |
1da25369227b
updated for version 7.2.345
Bram Moolenaar <bram@zimbu.org>
parents:
1958
diff
changeset
|
6503 redraw_titles(); |
1da25369227b
updated for version 7.2.345
Bram Moolenaar <bram@zimbu.org>
parents:
1958
diff
changeset
|
6504 # endif |
7 | 6505 } |
6506 } | |
6507 #endif | |
6508 | |
6509 #ifdef FEAT_STL_OPT | |
6510 /* 'statusline' or 'rulerformat' */ | |
40 | 6511 else if (gvarp == &p_stl || varp == &p_ruf) |
7 | 6512 { |
6513 int wid; | |
6514 | |
6515 if (varp == &p_ruf) /* reset ru_wid first */ | |
6516 ru_wid = 0; | |
6517 s = *varp; | |
6518 if (varp == &p_ruf && *s == '%') | |
6519 { | |
6520 /* set ru_wid if 'ruf' starts with "%99(" */ | |
6521 if (*++s == '-') /* ignore a '-' */ | |
6522 s++; | |
6523 wid = getdigits(&s); | |
6524 if (wid && *s == '(' && (errmsg = check_stl_option(p_ruf)) == NULL) | |
6525 ru_wid = wid; | |
6526 else | |
6527 errmsg = check_stl_option(p_ruf); | |
6528 } | |
917 | 6529 /* check 'statusline' only if it doesn't start with "%!" */ |
1382 | 6530 else if (varp == &p_ruf || s[0] != '%' || s[1] != '!') |
7 | 6531 errmsg = check_stl_option(s); |
40 | 6532 if (varp == &p_ruf && errmsg == NULL) |
7 | 6533 comp_col(); |
6534 } | |
6535 #endif | |
6536 | |
6537 #ifdef FEAT_INS_EXPAND | |
6538 /* check if it is a valid value for 'complete' -- Acevedo */ | |
6539 else if (gvarp == &p_cpt) | |
6540 { | |
6541 for (s = *varp; *s;) | |
6542 { | |
6543 while(*s == ',' || *s == ' ') | |
6544 s++; | |
6545 if (!*s) | |
6546 break; | |
6547 if (vim_strchr((char_u *)".wbuksid]tU", *s) == NULL) | |
6548 { | |
6549 errmsg = illegal_char(errbuf, *s); | |
6550 break; | |
6551 } | |
6552 if (*++s != NUL && *s != ',' && *s != ' ') | |
6553 { | |
6554 if (s[-1] == 'k' || s[-1] == 's') | |
6555 { | |
6556 /* skip optional filename after 'k' and 's' */ | |
6557 while (*s && *s != ',' && *s != ' ') | |
6558 { | |
6559 if (*s == '\\') | |
6560 ++s; | |
6561 ++s; | |
6562 } | |
6563 } | |
6564 else | |
6565 { | |
6566 if (errbuf != NULL) | |
6567 { | |
6568 sprintf((char *)errbuf, | |
6569 _("E535: Illegal character after <%c>"), | |
6570 *--s); | |
6571 errmsg = errbuf; | |
6572 } | |
6573 else | |
6574 errmsg = (char_u *)""; | |
6575 break; | |
6576 } | |
6577 } | |
6578 } | |
6579 } | |
540 | 6580 |
6581 /* 'completeopt' */ | |
6582 else if (varp == &p_cot) | |
6583 { | |
6584 if (check_opt_strings(p_cot, p_cot_values, TRUE) != OK) | |
6585 errmsg = e_invarg; | |
6586 } | |
7 | 6587 #endif /* FEAT_INS_EXPAND */ |
6588 | |
6589 | |
6590 #if defined(FEAT_TOOLBAR) && !defined(FEAT_GUI_W32) | |
6591 else if (varp == &p_toolbar) | |
6592 { | |
6593 if (opt_strings_flags(p_toolbar, p_toolbar_values, | |
6594 &toolbar_flags, TRUE) != OK) | |
6595 errmsg = e_invarg; | |
6596 else | |
6597 { | |
6598 out_flush(); | |
6599 gui_mch_show_toolbar((toolbar_flags & | |
6600 (TOOLBAR_TEXT | TOOLBAR_ICONS)) != 0); | |
6601 } | |
6602 } | |
6603 #endif | |
6604 | |
2275
e4d849f4df03
Remove the old and not well supported GTK 1 code. (James Vega)
Bram Moolenaar <bram@vim.org>
parents:
2271
diff
changeset
|
6605 #if defined(FEAT_TOOLBAR) && defined(FEAT_GUI_GTK) |
7 | 6606 /* 'toolbariconsize': GTK+ 2 only */ |
6607 else if (varp == &p_tbis) | |
6608 { | |
6609 if (opt_strings_flags(p_tbis, p_tbis_values, &tbis_flags, FALSE) != OK) | |
6610 errmsg = e_invarg; | |
6611 else | |
6612 { | |
6613 out_flush(); | |
6614 gui_mch_show_toolbar((toolbar_flags & | |
6615 (TOOLBAR_TEXT | TOOLBAR_ICONS)) != 0); | |
6616 } | |
6617 } | |
6618 #endif | |
6619 | |
6620 /* 'pastetoggle': translate key codes like in a mapping */ | |
6621 else if (varp == &p_pt) | |
6622 { | |
6623 if (*p_pt) | |
6624 { | |
859 | 6625 (void)replace_termcodes(p_pt, &p, TRUE, TRUE, FALSE); |
7 | 6626 if (p != NULL) |
6627 { | |
6628 if (new_value_alloced) | |
6629 free_string_option(p_pt); | |
6630 p_pt = p; | |
6631 new_value_alloced = TRUE; | |
6632 } | |
6633 } | |
6634 } | |
6635 | |
6636 /* 'backspace' */ | |
6637 else if (varp == &p_bs) | |
6638 { | |
6639 if (VIM_ISDIGIT(*p_bs)) | |
6640 { | |
6641 if (*p_bs >'2' || p_bs[1] != NUL) | |
6642 errmsg = e_invarg; | |
6643 } | |
6644 else if (check_opt_strings(p_bs, p_bs_values, TRUE) != OK) | |
6645 errmsg = e_invarg; | |
6646 } | |
6647 | |
805 | 6648 #ifdef FEAT_MBYTE |
7 | 6649 /* 'casemap' */ |
6650 else if (varp == &p_cmp) | |
6651 { | |
6652 if (opt_strings_flags(p_cmp, p_cmp_values, &cmp_flags, TRUE) != OK) | |
6653 errmsg = e_invarg; | |
6654 } | |
805 | 6655 #endif |
7 | 6656 |
6657 #ifdef FEAT_DIFF | |
6658 /* 'diffopt' */ | |
6659 else if (varp == &p_dip) | |
6660 { | |
6661 if (diffopt_changed() == FAIL) | |
6662 errmsg = e_invarg; | |
6663 } | |
6664 #endif | |
6665 | |
6666 #ifdef FEAT_FOLDING | |
6667 /* 'foldmethod' */ | |
6668 else if (gvarp == &curwin->w_allbuf_opt.wo_fdm) | |
6669 { | |
6670 if (check_opt_strings(*varp, p_fdm_values, FALSE) != OK | |
6671 || *curwin->w_p_fdm == NUL) | |
6672 errmsg = e_invarg; | |
6673 else | |
2086
c11845a465ae
updated for version 7.2.370
Bram Moolenaar <bram@zimbu.org>
parents:
2073
diff
changeset
|
6674 { |
7 | 6675 foldUpdateAll(curwin); |
2086
c11845a465ae
updated for version 7.2.370
Bram Moolenaar <bram@zimbu.org>
parents:
2073
diff
changeset
|
6676 if (foldmethodIsDiff(curwin)) |
c11845a465ae
updated for version 7.2.370
Bram Moolenaar <bram@zimbu.org>
parents:
2073
diff
changeset
|
6677 newFoldLevel(); |
c11845a465ae
updated for version 7.2.370
Bram Moolenaar <bram@zimbu.org>
parents:
2073
diff
changeset
|
6678 } |
7 | 6679 } |
6680 # ifdef FEAT_EVAL | |
6681 /* 'foldexpr' */ | |
6682 else if (varp == &curwin->w_p_fde) | |
6683 { | |
6684 if (foldmethodIsExpr(curwin)) | |
6685 foldUpdateAll(curwin); | |
6686 } | |
6687 # endif | |
6688 /* 'foldmarker' */ | |
6689 else if (gvarp == &curwin->w_allbuf_opt.wo_fmr) | |
6690 { | |
6691 p = vim_strchr(*varp, ','); | |
6692 if (p == NULL) | |
6693 errmsg = (char_u *)N_("E536: comma required"); | |
6694 else if (p == *varp || p[1] == NUL) | |
6695 errmsg = e_invarg; | |
6696 else if (foldmethodIsMarker(curwin)) | |
6697 foldUpdateAll(curwin); | |
6698 } | |
6699 /* 'commentstring' */ | |
6700 else if (gvarp == &p_cms) | |
6701 { | |
6702 if (**varp != NUL && strstr((char *)*varp, "%s") == NULL) | |
6703 errmsg = (char_u *)N_("E537: 'commentstring' must be empty or contain %s"); | |
6704 } | |
6705 /* 'foldopen' */ | |
6706 else if (varp == &p_fdo) | |
6707 { | |
6708 if (opt_strings_flags(p_fdo, p_fdo_values, &fdo_flags, TRUE) != OK) | |
6709 errmsg = e_invarg; | |
6710 } | |
6711 /* 'foldclose' */ | |
6712 else if (varp == &p_fcl) | |
6713 { | |
6714 if (check_opt_strings(p_fcl, p_fcl_values, TRUE) != OK) | |
6715 errmsg = e_invarg; | |
6716 } | |
828 | 6717 /* 'foldignore' */ |
6718 else if (gvarp == &curwin->w_allbuf_opt.wo_fdi) | |
6719 { | |
6720 if (foldmethodIsIndent(curwin)) | |
6721 foldUpdateAll(curwin); | |
6722 } | |
7 | 6723 #endif |
6724 | |
6725 #ifdef FEAT_VIRTUALEDIT | |
6726 /* 'virtualedit' */ | |
6727 else if (varp == &p_ve) | |
6728 { | |
6729 if (opt_strings_flags(p_ve, p_ve_values, &ve_flags, TRUE) != OK) | |
6730 errmsg = e_invarg; | |
6731 else if (STRCMP(p_ve, oldval) != 0) | |
6732 { | |
6733 /* Recompute cursor position in case the new 've' setting | |
6734 * changes something. */ | |
6735 validate_virtcol(); | |
6736 coladvance(curwin->w_virtcol); | |
6737 } | |
6738 } | |
6739 #endif | |
6740 | |
6741 #if defined(FEAT_CSCOPE) && defined(FEAT_QUICKFIX) | |
6742 else if (varp == &p_csqf) | |
6743 { | |
6744 if (p_csqf != NULL) | |
6745 { | |
6746 p = p_csqf; | |
6747 while (*p != NUL) | |
6748 { | |
6749 if (vim_strchr((char_u *)CSQF_CMDS, *p) == NULL | |
6750 || p[1] == NUL | |
6751 || vim_strchr((char_u *)CSQF_FLAGS, p[1]) == NULL | |
6752 || (p[2] != NUL && p[2] != ',')) | |
6753 { | |
6754 errmsg = e_invarg; | |
6755 break; | |
6756 } | |
6757 else if (p[2] == NUL) | |
6758 break; | |
6759 else | |
6760 p += 3; | |
6761 } | |
6762 } | |
6763 } | |
6764 #endif | |
6765 | |
6766 /* Options that are a list of flags. */ | |
6767 else | |
6768 { | |
6769 p = NULL; | |
6770 if (varp == &p_ww) | |
6771 p = (char_u *)WW_ALL; | |
6772 if (varp == &p_shm) | |
6773 p = (char_u *)SHM_ALL; | |
6774 else if (varp == &(p_cpo)) | |
6775 p = (char_u *)CPO_ALL; | |
6776 else if (varp == &(curbuf->b_p_fo)) | |
6777 p = (char_u *)FO_ALL; | |
6778 else if (varp == &p_mouse) | |
6779 { | |
6780 #ifdef FEAT_MOUSE | |
6781 p = (char_u *)MOUSE_ALL; | |
6782 #else | |
6783 if (*p_mouse != NUL) | |
6784 errmsg = (char_u *)N_("E538: No mouse support"); | |
6785 #endif | |
6786 } | |
6787 #if defined(FEAT_GUI) | |
6788 else if (varp == &p_go) | |
6789 p = (char_u *)GO_ALL; | |
6790 #endif | |
6791 if (p != NULL) | |
6792 { | |
6793 for (s = *varp; *s; ++s) | |
6794 if (vim_strchr(p, *s) == NULL) | |
6795 { | |
6796 errmsg = illegal_char(errbuf, *s); | |
6797 break; | |
6798 } | |
6799 } | |
6800 } | |
6801 | |
6802 /* | |
6803 * If error detected, restore the previous value. | |
6804 */ | |
6805 if (errmsg != NULL) | |
6806 { | |
6807 if (new_value_alloced) | |
6808 free_string_option(*varp); | |
6809 *varp = oldval; | |
6810 /* | |
6811 * When resetting some values, need to act on it. | |
6812 */ | |
6813 if (did_chartab) | |
6814 (void)init_chartab(); | |
6815 if (varp == &p_hl) | |
6816 (void)highlight_changed(); | |
6817 } | |
6818 else | |
6819 { | |
6820 #ifdef FEAT_EVAL | |
6821 /* Remember where the option was set. */ | |
694 | 6822 set_option_scriptID_idx(opt_idx, opt_flags, current_SID); |
7 | 6823 #endif |
6824 /* | |
6825 * Free string options that are in allocated memory. | |
24 | 6826 * Use "free_oldval", because recursiveness may change the flags under |
6827 * our fingers (esp. init_highlight()). | |
7 | 6828 */ |
24 | 6829 if (free_oldval) |
7 | 6830 free_string_option(oldval); |
6831 if (new_value_alloced) | |
6832 options[opt_idx].flags |= P_ALLOCED; | |
6833 else | |
6834 options[opt_idx].flags &= ~P_ALLOCED; | |
6835 | |
6836 if ((opt_flags & (OPT_LOCAL | OPT_GLOBAL)) == 0 | |
692 | 6837 && ((int)options[opt_idx].indir & PV_BOTH)) |
7 | 6838 { |
6839 /* global option with local value set to use global value; free | |
6840 * the local value and make it empty */ | |
6841 p = get_varp_scope(&(options[opt_idx]), OPT_LOCAL); | |
6842 free_string_option(*(char_u **)p); | |
6843 *(char_u **)p = empty_option; | |
6844 } | |
6845 | |
6846 /* May set global value for local option. */ | |
6847 else if (!(opt_flags & OPT_LOCAL) && opt_flags != OPT_GLOBAL) | |
6848 set_string_option_global(opt_idx, varp); | |
480 | 6849 |
6850 #ifdef FEAT_AUTOCMD | |
6851 /* | |
6852 * Trigger the autocommand only after setting the flags. | |
6853 */ | |
6854 # ifdef FEAT_SYN_HL | |
6855 /* When 'syntax' is set, load the syntax of that name */ | |
6856 if (varp == &(curbuf->b_p_syn)) | |
6857 { | |
6858 apply_autocmds(EVENT_SYNTAX, curbuf->b_p_syn, | |
6859 curbuf->b_fname, TRUE, curbuf); | |
6860 } | |
6861 # endif | |
6862 else if (varp == &(curbuf->b_p_ft)) | |
6863 { | |
6864 /* 'filetype' is set, trigger the FileType autocommand */ | |
6865 did_filetype = TRUE; | |
6866 apply_autocmds(EVENT_FILETYPE, curbuf->b_p_ft, | |
6867 curbuf->b_fname, TRUE, curbuf); | |
6868 } | |
6869 #endif | |
744 | 6870 #ifdef FEAT_SPELL |
2250
1bac28a53fae
Add the conceal patch from Vince Negri.
Bram Moolenaar <bram@vim.org>
parents:
2248
diff
changeset
|
6871 if (varp == &(curwin->w_s->b_p_spl)) |
480 | 6872 { |
6873 char_u fname[200]; | |
6874 | |
6875 /* | |
6876 * Source the spell/LANG.vim in 'runtimepath'. | |
6877 * They could set 'spellcapcheck' depending on the language. | |
6878 * Use the first name in 'spelllang' up to '_region' or | |
6879 * '.encoding'. | |
6880 */ | |
2250
1bac28a53fae
Add the conceal patch from Vince Negri.
Bram Moolenaar <bram@vim.org>
parents:
2248
diff
changeset
|
6881 for (p = curwin->w_s->b_p_spl; *p != NUL; ++p) |
480 | 6882 if (vim_strchr((char_u *)"_.,", *p) != NULL) |
6883 break; | |
6884 vim_snprintf((char *)fname, 200, "spell/%.*s.vim", | |
2250
1bac28a53fae
Add the conceal patch from Vince Negri.
Bram Moolenaar <bram@vim.org>
parents:
2248
diff
changeset
|
6885 (int)(p - curwin->w_s->b_p_spl), curwin->w_s->b_p_spl); |
480 | 6886 source_runtime(fname, TRUE); |
6887 } | |
6888 #endif | |
7 | 6889 } |
6890 | |
6891 #ifdef FEAT_MOUSE | |
6892 if (varp == &p_mouse) | |
6893 { | |
6894 # ifdef FEAT_MOUSE_TTY | |
6895 if (*p_mouse == NUL) | |
6896 mch_setmouse(FALSE); /* switch mouse off */ | |
6897 else | |
6898 # endif | |
6899 setmouse(); /* in case 'mouse' changed */ | |
6900 } | |
6901 #endif | |
6902 | |
6903 if (curwin->w_curswant != MAXCOL) | |
6904 curwin->w_set_curswant = TRUE; /* in case 'showbreak' changed */ | |
1801 | 6905 #ifdef FEAT_GUI |
6906 /* check redraw when it's not a GUI option or the GUI is active. */ | |
6907 if (!redraw_gui_only || gui.in_use) | |
6908 #endif | |
6909 check_redraw(options[opt_idx].flags); | |
7 | 6910 |
6911 return errmsg; | |
6912 } | |
6913 | |
6914 /* | |
6915 * Handle setting 'listchars' or 'fillchars'. | |
6916 * Returns error message, NULL if it's OK. | |
6917 */ | |
6918 static char_u * | |
6919 set_chars_option(varp) | |
6920 char_u **varp; | |
6921 { | |
6922 int round, i, len, entries; | |
6923 char_u *p, *s; | |
6924 int c1, c2 = 0; | |
6925 struct charstab | |
6926 { | |
6927 int *cp; | |
6928 char *name; | |
6929 }; | |
6930 #if defined(FEAT_WINDOWS) || defined(FEAT_FOLDING) | |
6931 static struct charstab filltab[] = | |
6932 { | |
6933 {&fill_stl, "stl"}, | |
6934 {&fill_stlnc, "stlnc"}, | |
6935 {&fill_vert, "vert"}, | |
6936 {&fill_fold, "fold"}, | |
6937 {&fill_diff, "diff"}, | |
6938 }; | |
6939 #endif | |
6940 static struct charstab lcstab[] = | |
6941 { | |
6942 {&lcs_eol, "eol"}, | |
6943 {&lcs_ext, "extends"}, | |
12 | 6944 {&lcs_nbsp, "nbsp"}, |
7 | 6945 {&lcs_prec, "precedes"}, |
6946 {&lcs_tab2, "tab"}, | |
6947 {&lcs_trail, "trail"}, | |
2250
1bac28a53fae
Add the conceal patch from Vince Negri.
Bram Moolenaar <bram@vim.org>
parents:
2248
diff
changeset
|
6948 #ifdef FEAT_CONCEAL |
1bac28a53fae
Add the conceal patch from Vince Negri.
Bram Moolenaar <bram@vim.org>
parents:
2248
diff
changeset
|
6949 {&lcs_conceal, "conceal"}, |
1bac28a53fae
Add the conceal patch from Vince Negri.
Bram Moolenaar <bram@vim.org>
parents:
2248
diff
changeset
|
6950 #else |
1bac28a53fae
Add the conceal patch from Vince Negri.
Bram Moolenaar <bram@vim.org>
parents:
2248
diff
changeset
|
6951 {NULL, "conceal"}, |
1bac28a53fae
Add the conceal patch from Vince Negri.
Bram Moolenaar <bram@vim.org>
parents:
2248
diff
changeset
|
6952 #endif |
7 | 6953 }; |
6954 struct charstab *tab; | |
6955 | |
6956 #if defined(FEAT_WINDOWS) || defined(FEAT_FOLDING) | |
6957 if (varp == &p_lcs) | |
6958 #endif | |
6959 { | |
6960 tab = lcstab; | |
6961 entries = sizeof(lcstab) / sizeof(struct charstab); | |
6962 } | |
6963 #if defined(FEAT_WINDOWS) || defined(FEAT_FOLDING) | |
6964 else | |
6965 { | |
6966 tab = filltab; | |
6967 entries = sizeof(filltab) / sizeof(struct charstab); | |
6968 } | |
6969 #endif | |
6970 | |
6971 /* first round: check for valid value, second round: assign values */ | |
6972 for (round = 0; round <= 1; ++round) | |
6973 { | |
2250
1bac28a53fae
Add the conceal patch from Vince Negri.
Bram Moolenaar <bram@vim.org>
parents:
2248
diff
changeset
|
6974 if (round > 0) |
7 | 6975 { |
6976 /* After checking that the value is valid: set defaults: space for | |
6977 * 'fillchars', NUL for 'listchars' */ | |
6978 for (i = 0; i < entries; ++i) | |
2250
1bac28a53fae
Add the conceal patch from Vince Negri.
Bram Moolenaar <bram@vim.org>
parents:
2248
diff
changeset
|
6979 if (tab[i].cp != NULL) |
1bac28a53fae
Add the conceal patch from Vince Negri.
Bram Moolenaar <bram@vim.org>
parents:
2248
diff
changeset
|
6980 *(tab[i].cp) = (varp == &p_lcs ? NUL : ' '); |
7 | 6981 if (varp == &p_lcs) |
6982 lcs_tab1 = NUL; | |
6983 #if defined(FEAT_WINDOWS) || defined(FEAT_FOLDING) | |
6984 else | |
6985 fill_diff = '-'; | |
6986 #endif | |
6987 } | |
6988 p = *varp; | |
6989 while (*p) | |
6990 { | |
6991 for (i = 0; i < entries; ++i) | |
6992 { | |
6993 len = (int)STRLEN(tab[i].name); | |
6994 if (STRNCMP(p, tab[i].name, len) == 0 | |
6995 && p[len] == ':' | |
6996 && p[len + 1] != NUL) | |
6997 { | |
6998 s = p + len + 1; | |
6999 #ifdef FEAT_MBYTE | |
7000 c1 = mb_ptr2char_adv(&s); | |
819 | 7001 if (mb_char2cells(c1) > 1) |
7002 continue; | |
7 | 7003 #else |
7004 c1 = *s++; | |
7005 #endif | |
7006 if (tab[i].cp == &lcs_tab2) | |
7007 { | |
7008 if (*s == NUL) | |
7009 continue; | |
7010 #ifdef FEAT_MBYTE | |
7011 c2 = mb_ptr2char_adv(&s); | |
819 | 7012 if (mb_char2cells(c2) > 1) |
7013 continue; | |
7 | 7014 #else |
7015 c2 = *s++; | |
7016 #endif | |
7017 } | |
7018 if (*s == ',' || *s == NUL) | |
7019 { | |
7020 if (round) | |
7021 { | |
7022 if (tab[i].cp == &lcs_tab2) | |
7023 { | |
7024 lcs_tab1 = c1; | |
7025 lcs_tab2 = c2; | |
7026 } | |
2250
1bac28a53fae
Add the conceal patch from Vince Negri.
Bram Moolenaar <bram@vim.org>
parents:
2248
diff
changeset
|
7027 else if (tab[i].cp != NULL) |
7 | 7028 *(tab[i].cp) = c1; |
7029 | |
7030 } | |
7031 p = s; | |
7032 break; | |
7033 } | |
7034 } | |
7035 } | |
7036 | |
7037 if (i == entries) | |
7038 return e_invarg; | |
7039 if (*p == ',') | |
7040 ++p; | |
7041 } | |
7042 } | |
7043 | |
7044 return NULL; /* no error */ | |
7045 } | |
7046 | |
7047 #ifdef FEAT_STL_OPT | |
7048 /* | |
7049 * Check validity of options with the 'statusline' format. | |
7050 * Return error message or NULL. | |
7051 */ | |
7052 char_u * | |
7053 check_stl_option(s) | |
7054 char_u *s; | |
7055 { | |
7056 int itemcnt = 0; | |
7057 int groupdepth = 0; | |
7058 static char_u errbuf[80]; | |
7059 | |
7060 while (*s && itemcnt < STL_MAX_ITEM) | |
7061 { | |
7062 /* Check for valid keys after % sequences */ | |
7063 while (*s && *s != '%') | |
7064 s++; | |
7065 if (!*s) | |
7066 break; | |
7067 s++; | |
7068 if (*s != '%' && *s != ')') | |
7069 ++itemcnt; | |
7070 if (*s == '%' || *s == STL_TRUNCMARK || *s == STL_MIDDLEMARK) | |
7071 { | |
7072 s++; | |
7073 continue; | |
7074 } | |
7075 if (*s == ')') | |
7076 { | |
7077 s++; | |
7078 if (--groupdepth < 0) | |
7079 break; | |
7080 continue; | |
7081 } | |
7082 if (*s == '-') | |
7083 s++; | |
7084 while (VIM_ISDIGIT(*s)) | |
7085 s++; | |
680 | 7086 if (*s == STL_USER_HL) |
7 | 7087 continue; |
7088 if (*s == '.') | |
7089 { | |
7090 s++; | |
7091 while (*s && VIM_ISDIGIT(*s)) | |
7092 s++; | |
7093 } | |
7094 if (*s == '(') | |
7095 { | |
7096 groupdepth++; | |
7097 continue; | |
7098 } | |
7099 if (vim_strchr(STL_ALL, *s) == NULL) | |
7100 { | |
7101 return illegal_char(errbuf, *s); | |
7102 } | |
7103 if (*s == '{') | |
7104 { | |
7105 s++; | |
7106 while (*s != '}' && *s) | |
7107 s++; | |
7108 if (*s != '}') | |
7109 return (char_u *)N_("E540: Unclosed expression sequence"); | |
7110 } | |
7111 } | |
7112 if (itemcnt >= STL_MAX_ITEM) | |
7113 return (char_u *)N_("E541: too many items"); | |
7114 if (groupdepth != 0) | |
7115 return (char_u *)N_("E542: unbalanced groups"); | |
7116 return NULL; | |
7117 } | |
7118 #endif | |
7119 | |
7120 #ifdef FEAT_CLIPBOARD | |
7121 /* | |
7122 * Extract the items in the 'clipboard' option and set global values. | |
7123 */ | |
7124 static char_u * | |
7125 check_clipboard_option() | |
7126 { | |
7127 int new_unnamed = FALSE; | |
7128 int new_autoselect = FALSE; | |
7129 int new_autoselectml = FALSE; | |
1904 | 7130 int new_html = FALSE; |
7 | 7131 regprog_T *new_exclude_prog = NULL; |
7132 char_u *errmsg = NULL; | |
7133 char_u *p; | |
7134 | |
7135 for (p = p_cb; *p != NUL; ) | |
7136 { | |
7137 if (STRNCMP(p, "unnamed", 7) == 0 && (p[7] == ',' || p[7] == NUL)) | |
7138 { | |
7139 new_unnamed = TRUE; | |
7140 p += 7; | |
7141 } | |
7142 else if (STRNCMP(p, "autoselect", 10) == 0 | |
7143 && (p[10] == ',' || p[10] == NUL)) | |
7144 { | |
7145 new_autoselect = TRUE; | |
7146 p += 10; | |
7147 } | |
7148 else if (STRNCMP(p, "autoselectml", 12) == 0 | |
7149 && (p[12] == ',' || p[12] == NUL)) | |
7150 { | |
7151 new_autoselectml = TRUE; | |
7152 p += 12; | |
7153 } | |
1904 | 7154 else if (STRNCMP(p, "html", 4) == 0 && (p[4] == ',' || p[4] == NUL)) |
7155 { | |
7156 new_html = TRUE; | |
7157 p += 4; | |
7158 } | |
7 | 7159 else if (STRNCMP(p, "exclude:", 8) == 0 && new_exclude_prog == NULL) |
7160 { | |
7161 p += 8; | |
7162 new_exclude_prog = vim_regcomp(p, RE_MAGIC); | |
7163 if (new_exclude_prog == NULL) | |
7164 errmsg = e_invarg; | |
7165 break; | |
7166 } | |
7167 else | |
7168 { | |
7169 errmsg = e_invarg; | |
7170 break; | |
7171 } | |
7172 if (*p == ',') | |
7173 ++p; | |
7174 } | |
7175 if (errmsg == NULL) | |
7176 { | |
7177 clip_unnamed = new_unnamed; | |
7178 clip_autoselect = new_autoselect; | |
7179 clip_autoselectml = new_autoselectml; | |
1904 | 7180 clip_html = new_html; |
7 | 7181 vim_free(clip_exclude_prog); |
7182 clip_exclude_prog = new_exclude_prog; | |
2248 | 7183 #ifdef FEAT_GUI_GTK |
7184 if (gui.in_use) | |
7185 { | |
7186 gui_gtk_set_selection_targets(); | |
7187 gui_gtk_set_dnd_targets(); | |
7188 } | |
7189 #endif | |
7 | 7190 } |
7191 else | |
7192 vim_free(new_exclude_prog); | |
7193 | |
7194 return errmsg; | |
7195 } | |
7196 #endif | |
7197 | |
744 | 7198 #ifdef FEAT_SPELL |
386 | 7199 /* |
7200 * Set curbuf->b_cap_prog to the regexp program for 'spellcapcheck'. | |
7201 * Return error message when failed, NULL when OK. | |
7202 */ | |
7203 static char_u * | |
2250
1bac28a53fae
Add the conceal patch from Vince Negri.
Bram Moolenaar <bram@vim.org>
parents:
2248
diff
changeset
|
7204 compile_cap_prog(synblock) |
1bac28a53fae
Add the conceal patch from Vince Negri.
Bram Moolenaar <bram@vim.org>
parents:
2248
diff
changeset
|
7205 synblock_T *synblock; |
1bac28a53fae
Add the conceal patch from Vince Negri.
Bram Moolenaar <bram@vim.org>
parents:
2248
diff
changeset
|
7206 { |
1bac28a53fae
Add the conceal patch from Vince Negri.
Bram Moolenaar <bram@vim.org>
parents:
2248
diff
changeset
|
7207 regprog_T *rp = synblock->b_cap_prog; |
582 | 7208 char_u *re; |
389 | 7209 |
2250
1bac28a53fae
Add the conceal patch from Vince Negri.
Bram Moolenaar <bram@vim.org>
parents:
2248
diff
changeset
|
7210 if (*synblock->b_p_spc == NUL) |
1bac28a53fae
Add the conceal patch from Vince Negri.
Bram Moolenaar <bram@vim.org>
parents:
2248
diff
changeset
|
7211 synblock->b_cap_prog = NULL; |
582 | 7212 else |
7213 { | |
7214 /* Prepend a ^ so that we only match at one column */ | |
2250
1bac28a53fae
Add the conceal patch from Vince Negri.
Bram Moolenaar <bram@vim.org>
parents:
2248
diff
changeset
|
7215 re = concat_str((char_u *)"^", synblock->b_p_spc); |
582 | 7216 if (re != NULL) |
7217 { | |
2250
1bac28a53fae
Add the conceal patch from Vince Negri.
Bram Moolenaar <bram@vim.org>
parents:
2248
diff
changeset
|
7218 synblock->b_cap_prog = vim_regcomp(re, RE_MAGIC); |
1bac28a53fae
Add the conceal patch from Vince Negri.
Bram Moolenaar <bram@vim.org>
parents:
2248
diff
changeset
|
7219 if (synblock->b_cap_prog == NULL) |
1bac28a53fae
Add the conceal patch from Vince Negri.
Bram Moolenaar <bram@vim.org>
parents:
2248
diff
changeset
|
7220 { |
1bac28a53fae
Add the conceal patch from Vince Negri.
Bram Moolenaar <bram@vim.org>
parents:
2248
diff
changeset
|
7221 synblock->b_cap_prog = rp; /* restore the previous program */ |
582 | 7222 return e_invarg; |
7223 } | |
7224 vim_free(re); | |
7225 } | |
386 | 7226 } |
7227 | |
7228 vim_free(rp); | |
7229 return NULL; | |
7230 } | |
7231 #endif | |
7232 | |
681 | 7233 #if defined(FEAT_EVAL) || defined(PROTO) |
7234 /* | |
694 | 7235 * Set the scriptID for an option, taking care of setting the buffer- or |
7236 * window-local value. | |
681 | 7237 */ |
694 | 7238 static void |
7239 set_option_scriptID_idx(opt_idx, opt_flags, id) | |
7240 int opt_idx; | |
7241 int opt_flags; | |
7242 int id; | |
7243 { | |
7244 int both = (opt_flags & (OPT_LOCAL | OPT_GLOBAL)) == 0; | |
7245 int indir = (int)options[opt_idx].indir; | |
7246 | |
7247 /* Remember where the option was set. For local options need to do that | |
7248 * in the buffer or window structure. */ | |
7249 if (both || (opt_flags & OPT_GLOBAL) || (indir & (PV_BUF|PV_WIN)) == 0) | |
681 | 7250 options[opt_idx].scriptID = id; |
694 | 7251 if (both || (opt_flags & OPT_LOCAL)) |
7252 { | |
7253 if (indir & PV_BUF) | |
7254 curbuf->b_p_scriptID[indir & PV_MASK] = id; | |
7255 else if (indir & PV_WIN) | |
7256 curwin->w_p_scriptID[indir & PV_MASK] = id; | |
7257 } | |
681 | 7258 } |
7259 #endif | |
7260 | |
7 | 7261 /* |
7262 * Set the value of a boolean option, and take care of side effects. | |
7263 * Returns NULL for success, or an error message for an error. | |
7264 */ | |
7265 static char_u * | |
7266 set_bool_option(opt_idx, varp, value, opt_flags) | |
7267 int opt_idx; /* index in options[] table */ | |
7268 char_u *varp; /* pointer to the option variable */ | |
7269 int value; /* new value */ | |
7270 int opt_flags; /* OPT_LOCAL and/or OPT_GLOBAL */ | |
7271 { | |
7272 int old_value = *(int *)varp; | |
7273 | |
7274 /* Disallow changing some options from secure mode */ | |
7275 if ((secure | |
7276 #ifdef HAVE_SANDBOX | |
7277 || sandbox != 0 | |
7278 #endif | |
7279 ) && (options[opt_idx].flags & P_SECURE)) | |
7280 return e_secure; | |
7281 | |
7282 *(int *)varp = value; /* set the new value */ | |
7283 #ifdef FEAT_EVAL | |
7284 /* Remember where the option was set. */ | |
694 | 7285 set_option_scriptID_idx(opt_idx, opt_flags, current_SID); |
7 | 7286 #endif |
7287 | |
634 | 7288 #ifdef FEAT_GUI |
7289 need_mouse_correct = TRUE; | |
7290 #endif | |
7291 | |
7 | 7292 /* May set global value for local option. */ |
7293 if ((opt_flags & (OPT_LOCAL | OPT_GLOBAL)) == 0) | |
7294 *(int *)get_varp_scope(&(options[opt_idx]), OPT_GLOBAL) = value; | |
7295 | |
7296 /* | |
7297 * Handle side effects of changing a bool option. | |
7298 */ | |
7299 | |
7300 /* 'compatible' */ | |
7301 if ((int *)varp == &p_cp) | |
7302 { | |
7303 compatible_set(); | |
7304 } | |
7305 | |
1945 | 7306 /* 'list', 'number' */ |
7307 else if ((int *)varp == &curwin->w_p_list | |
2178
c6f1aa1e9f32
Add 'relativenumber' patch from Markus Heidelberg.
Bram Moolenaar <bram@vim.org>
parents:
2144
diff
changeset
|
7308 || (int *)varp == &curwin->w_p_nu |
c6f1aa1e9f32
Add 'relativenumber' patch from Markus Heidelberg.
Bram Moolenaar <bram@vim.org>
parents:
2144
diff
changeset
|
7309 || (int *)varp == &curwin->w_p_rnu) |
1945 | 7310 { |
7311 if (curwin->w_curswant != MAXCOL) | |
7312 curwin->w_set_curswant = TRUE; | |
2178
c6f1aa1e9f32
Add 'relativenumber' patch from Markus Heidelberg.
Bram Moolenaar <bram@vim.org>
parents:
2144
diff
changeset
|
7313 |
c6f1aa1e9f32
Add 'relativenumber' patch from Markus Heidelberg.
Bram Moolenaar <bram@vim.org>
parents:
2144
diff
changeset
|
7314 /* If 'number' is set, reset 'relativenumber'. */ |
c6f1aa1e9f32
Add 'relativenumber' patch from Markus Heidelberg.
Bram Moolenaar <bram@vim.org>
parents:
2144
diff
changeset
|
7315 /* If 'relativenumber' is set, reset 'number'. */ |
c6f1aa1e9f32
Add 'relativenumber' patch from Markus Heidelberg.
Bram Moolenaar <bram@vim.org>
parents:
2144
diff
changeset
|
7316 if ((int *)varp == &curwin->w_p_nu && curwin->w_p_nu) |
c6f1aa1e9f32
Add 'relativenumber' patch from Markus Heidelberg.
Bram Moolenaar <bram@vim.org>
parents:
2144
diff
changeset
|
7317 curwin->w_p_rnu = FALSE; |
c6f1aa1e9f32
Add 'relativenumber' patch from Markus Heidelberg.
Bram Moolenaar <bram@vim.org>
parents:
2144
diff
changeset
|
7318 if ((int *)varp == &curwin->w_p_rnu && curwin->w_p_rnu) |
c6f1aa1e9f32
Add 'relativenumber' patch from Markus Heidelberg.
Bram Moolenaar <bram@vim.org>
parents:
2144
diff
changeset
|
7319 curwin->w_p_nu = FALSE; |
1945 | 7320 } |
7321 | |
7 | 7322 else if ((int *)varp == &curbuf->b_p_ro) |
7323 { | |
548 | 7324 /* when 'readonly' is reset globally, also reset readonlymode */ |
7 | 7325 if (!curbuf->b_p_ro && (opt_flags & OPT_LOCAL) == 0) |
7326 readonlymode = FALSE; | |
548 | 7327 |
7328 /* when 'readonly' is set may give W10 again */ | |
7329 if (curbuf->b_p_ro) | |
7330 curbuf->b_did_warn = FALSE; | |
7331 | |
7 | 7332 #ifdef FEAT_TITLE |
1805 | 7333 redraw_titles(); |
7 | 7334 #endif |
7335 } | |
7336 | |
2269
fb627e94e6c6
Couple of small fixes for conceal feature. (Dominique Pelle)
Bram Moolenaar <bram@vim.org>
parents:
2267
diff
changeset
|
7337 #if defined(FEAT_TITLE) || defined(FEAT_CONCEAL) |
fb627e94e6c6
Couple of small fixes for conceal feature. (Dominique Pelle)
Bram Moolenaar <bram@vim.org>
parents:
2267
diff
changeset
|
7338 /* when 'modifiable' is changed, redraw the window title and |
fb627e94e6c6
Couple of small fixes for conceal feature. (Dominique Pelle)
Bram Moolenaar <bram@vim.org>
parents:
2267
diff
changeset
|
7339 * update current line for concealable items */ |
7 | 7340 else if ((int *)varp == &curbuf->b_p_ma) |
1805 | 7341 { |
2269
fb627e94e6c6
Couple of small fixes for conceal feature. (Dominique Pelle)
Bram Moolenaar <bram@vim.org>
parents:
2267
diff
changeset
|
7342 # ifdef FEAT_TITLE |
1805 | 7343 redraw_titles(); |
2269
fb627e94e6c6
Couple of small fixes for conceal feature. (Dominique Pelle)
Bram Moolenaar <bram@vim.org>
parents:
2267
diff
changeset
|
7344 # endif |
fb627e94e6c6
Couple of small fixes for conceal feature. (Dominique Pelle)
Bram Moolenaar <bram@vim.org>
parents:
2267
diff
changeset
|
7345 # ifdef FEAT_CONCEAL |
fb627e94e6c6
Couple of small fixes for conceal feature. (Dominique Pelle)
Bram Moolenaar <bram@vim.org>
parents:
2267
diff
changeset
|
7346 if (curwin->w_p_conceal) |
fb627e94e6c6
Couple of small fixes for conceal feature. (Dominique Pelle)
Bram Moolenaar <bram@vim.org>
parents:
2267
diff
changeset
|
7347 update_single_line(curwin, curwin->w_cursor.lnum); |
fb627e94e6c6
Couple of small fixes for conceal feature. (Dominique Pelle)
Bram Moolenaar <bram@vim.org>
parents:
2267
diff
changeset
|
7348 # endif |
fb627e94e6c6
Couple of small fixes for conceal feature. (Dominique Pelle)
Bram Moolenaar <bram@vim.org>
parents:
2267
diff
changeset
|
7349 } |
fb627e94e6c6
Couple of small fixes for conceal feature. (Dominique Pelle)
Bram Moolenaar <bram@vim.org>
parents:
2267
diff
changeset
|
7350 #endif |
fb627e94e6c6
Couple of small fixes for conceal feature. (Dominique Pelle)
Bram Moolenaar <bram@vim.org>
parents:
2267
diff
changeset
|
7351 #ifdef FEAT_TITLE |
7 | 7352 /* when 'endofline' is changed, redraw the window title */ |
7353 else if ((int *)varp == &curbuf->b_p_eol) | |
1805 | 7354 { |
7355 redraw_titles(); | |
7356 } | |
7357 # ifdef FEAT_MBYTE | |
7358 /* when 'bomb' is changed, redraw the window title and tab page text */ | |
1352 | 7359 else if ((int *)varp == &curbuf->b_p_bomb) |
1805 | 7360 { |
7361 redraw_titles(); | |
7362 } | |
7363 # endif | |
7 | 7364 #endif |
7365 | |
7366 /* when 'bin' is set also set some other options */ | |
7367 else if ((int *)varp == &curbuf->b_p_bin) | |
7368 { | |
7369 set_options_bin(old_value, curbuf->b_p_bin, opt_flags); | |
7370 #ifdef FEAT_TITLE | |
1805 | 7371 redraw_titles(); |
7 | 7372 #endif |
7373 } | |
7374 | |
7375 #ifdef FEAT_AUTOCMD | |
7376 /* when 'buflisted' changes, trigger autocommands */ | |
7377 else if ((int *)varp == &curbuf->b_p_bl && old_value != curbuf->b_p_bl) | |
7378 { | |
7379 apply_autocmds(curbuf->b_p_bl ? EVENT_BUFADD : EVENT_BUFDELETE, | |
7380 NULL, NULL, TRUE, curbuf); | |
7381 } | |
7382 #endif | |
7383 | |
7384 /* when 'swf' is set, create swapfile, when reset remove swapfile */ | |
7385 else if ((int *)varp == &curbuf->b_p_swf) | |
7386 { | |
7387 if (curbuf->b_p_swf && p_uc) | |
7388 ml_open_file(curbuf); /* create the swap file */ | |
7389 else | |
1157 | 7390 /* no need to reset curbuf->b_may_swap, ml_open_file() will check |
7391 * buf->b_p_swf */ | |
7 | 7392 mf_close_file(curbuf, TRUE); /* remove the swap file */ |
7393 } | |
7394 | |
7395 /* when 'terse' is set change 'shortmess' */ | |
7396 else if ((int *)varp == &p_terse) | |
7397 { | |
7398 char_u *p; | |
7399 | |
7400 p = vim_strchr(p_shm, SHM_SEARCH); | |
7401 | |
7402 /* insert 's' in p_shm */ | |
7403 if (p_terse && p == NULL) | |
7404 { | |
7405 STRCPY(IObuff, p_shm); | |
7406 STRCAT(IObuff, "s"); | |
694 | 7407 set_string_option_direct((char_u *)"shm", -1, IObuff, OPT_FREE, 0); |
7 | 7408 } |
7409 /* remove 's' from p_shm */ | |
7410 else if (!p_terse && p != NULL) | |
1622 | 7411 STRMOVE(p, p + 1); |
7 | 7412 } |
7413 | |
7414 /* when 'paste' is set or reset also change other options */ | |
7415 else if ((int *)varp == &p_paste) | |
7416 { | |
7417 paste_option_changed(); | |
7418 } | |
7419 | |
7420 /* when 'insertmode' is set from an autocommand need to do work here */ | |
7421 else if ((int *)varp == &p_im) | |
7422 { | |
7423 if (p_im) | |
7424 { | |
7425 if ((State & INSERT) == 0) | |
7426 need_start_insertmode = TRUE; | |
7427 stop_insert_mode = FALSE; | |
7428 } | |
7429 else | |
7430 { | |
7431 need_start_insertmode = FALSE; | |
7432 stop_insert_mode = TRUE; | |
644 | 7433 if (restart_edit != 0 && mode_displayed) |
7 | 7434 clear_cmdline = TRUE; /* remove "(insert)" */ |
7435 restart_edit = 0; | |
7436 } | |
7437 } | |
7438 | |
7439 /* when 'ignorecase' is set or reset and 'hlsearch' is set, redraw */ | |
7440 else if ((int *)varp == &p_ic && p_hls) | |
7441 { | |
744 | 7442 redraw_all_later(SOME_VALID); |
7 | 7443 } |
7444 | |
7445 #ifdef FEAT_SEARCH_EXTRA | |
7446 /* when 'hlsearch' is set or reset: reset no_hlsearch */ | |
7447 else if ((int *)varp == &p_hls) | |
7448 { | |
7449 no_hlsearch = FALSE; | |
7450 } | |
7451 #endif | |
7452 | |
7453 #ifdef FEAT_SCROLLBIND | |
7454 /* when 'scrollbind' is set: snapshot the current position to avoid a jump | |
7455 * at the end of normal_cmd() */ | |
7456 else if ((int *)varp == &curwin->w_p_scb) | |
7457 { | |
7458 if (curwin->w_p_scb) | |
7459 do_check_scrollbind(FALSE); | |
7460 } | |
7461 #endif | |
7462 | |
7463 #if defined(FEAT_WINDOWS) && defined(FEAT_QUICKFIX) | |
7464 /* There can be only one window with 'previewwindow' set. */ | |
7465 else if ((int *)varp == &curwin->w_p_pvw) | |
7466 { | |
7467 if (curwin->w_p_pvw) | |
7468 { | |
7469 win_T *win; | |
7470 | |
7471 for (win = firstwin; win != NULL; win = win->w_next) | |
7472 if (win->w_p_pvw && win != curwin) | |
7473 { | |
7474 curwin->w_p_pvw = FALSE; | |
7475 return (char_u *)N_("E590: A preview window already exists"); | |
7476 } | |
7477 } | |
7478 } | |
7479 #endif | |
7480 | |
7481 /* when 'textmode' is set or reset also change 'fileformat' */ | |
7482 else if ((int *)varp == &curbuf->b_p_tx) | |
7483 { | |
7484 set_fileformat(curbuf->b_p_tx ? EOL_DOS : EOL_UNIX, opt_flags); | |
7485 } | |
7486 | |
7487 /* when 'textauto' is set or reset also change 'fileformats' */ | |
7488 else if ((int *)varp == &p_ta) | |
7489 set_string_option_direct((char_u *)"ffs", -1, | |
7490 p_ta ? (char_u *)DFLT_FFS_VIM : (char_u *)"", | |
694 | 7491 OPT_FREE | opt_flags, 0); |
7 | 7492 |
7493 /* | |
7494 * When 'lisp' option changes include/exclude '-' in | |
7495 * keyword characters. | |
7496 */ | |
7497 #ifdef FEAT_LISP | |
7498 else if (varp == (char_u *)&(curbuf->b_p_lisp)) | |
7499 { | |
7500 (void)buf_init_chartab(curbuf, FALSE); /* ignore errors */ | |
7501 } | |
7502 #endif | |
7503 | |
7504 #ifdef FEAT_TITLE | |
7505 /* when 'title' changed, may need to change the title; same for 'icon' */ | |
7506 else if ((int *)varp == &p_title) | |
7507 { | |
7508 did_set_title(FALSE); | |
7509 } | |
7510 | |
7511 else if ((int *)varp == &p_icon) | |
7512 { | |
7513 did_set_title(TRUE); | |
7514 } | |
7515 #endif | |
7516 | |
7517 else if ((int *)varp == &curbuf->b_changed) | |
7518 { | |
7519 if (!value) | |
7520 save_file_ff(curbuf); /* Buffer is unchanged */ | |
7521 #ifdef FEAT_TITLE | |
1805 | 7522 redraw_titles(); |
7 | 7523 #endif |
7524 #ifdef FEAT_AUTOCMD | |
7525 modified_was_set = value; | |
7526 #endif | |
7527 } | |
7528 | |
7529 #ifdef BACKSLASH_IN_FILENAME | |
7530 else if ((int *)varp == &p_ssl) | |
7531 { | |
7532 if (p_ssl) | |
7533 { | |
7534 psepc = '/'; | |
7535 psepcN = '\\'; | |
7536 pseps[0] = '/'; | |
7537 } | |
7538 else | |
7539 { | |
7540 psepc = '\\'; | |
7541 psepcN = '/'; | |
7542 pseps[0] = '\\'; | |
7543 } | |
7544 | |
7545 /* need to adjust the file name arguments and buffer names. */ | |
7546 buflist_slash_adjust(); | |
7547 alist_slash_adjust(); | |
7548 # ifdef FEAT_EVAL | |
7549 scriptnames_slash_adjust(); | |
7550 # endif | |
7551 } | |
7552 #endif | |
7553 | |
7554 /* If 'wrap' is set, set w_leftcol to zero. */ | |
7555 else if ((int *)varp == &curwin->w_p_wrap) | |
7556 { | |
7557 if (curwin->w_p_wrap) | |
7558 curwin->w_leftcol = 0; | |
1958 | 7559 if (curwin->w_curswant != MAXCOL) |
7560 curwin->w_set_curswant = TRUE; | |
7 | 7561 } |
7562 | |
7563 #ifdef FEAT_WINDOWS | |
7564 else if ((int *)varp == &p_ea) | |
7565 { | |
7566 if (p_ea && !old_value) | |
7567 win_equal(curwin, FALSE, 0); | |
7568 } | |
7569 #endif | |
7570 | |
7571 else if ((int *)varp == &p_wiv) | |
7572 { | |
7573 /* | |
7574 * When 'weirdinvert' changed, set/reset 't_xs'. | |
7575 * Then set 'weirdinvert' according to value of 't_xs'. | |
7576 */ | |
7577 if (p_wiv && !old_value) | |
7578 T_XS = (char_u *)"y"; | |
7579 else if (!p_wiv && old_value) | |
7580 T_XS = empty_option; | |
7581 p_wiv = (*T_XS != NUL); | |
7582 } | |
7583 | |
190 | 7584 #ifdef FEAT_BEVAL |
7 | 7585 else if ((int *)varp == &p_beval) |
7586 { | |
7587 if (p_beval == TRUE) | |
7588 gui_mch_enable_beval_area(balloonEval); | |
7589 else | |
7590 gui_mch_disable_beval_area(balloonEval); | |
7591 } | |
820 | 7592 #endif |
7593 | |
7594 #ifdef FEAT_AUTOCHDIR | |
7 | 7595 else if ((int *)varp == &p_acd) |
7596 { | |
961 | 7597 /* Change directories when the 'acd' option is set now. */ |
7598 DO_AUTOCHDIR | |
7 | 7599 } |
7600 #endif | |
7601 | |
7602 #ifdef FEAT_DIFF | |
7603 /* 'diff' */ | |
7604 else if ((int *)varp == &curwin->w_p_diff) | |
7605 { | |
16 | 7606 /* May add or remove the buffer from the list of diff buffers. */ |
7607 diff_buf_adjust(curwin); | |
7608 # ifdef FEAT_FOLDING | |
7 | 7609 if (foldmethodIsDiff(curwin)) |
7610 foldUpdateAll(curwin); | |
16 | 7611 # endif |
7 | 7612 } |
7613 #endif | |
7614 | |
7615 #ifdef USE_IM_CONTROL | |
7616 /* 'imdisable' */ | |
7617 else if ((int *)varp == &p_imdisable) | |
7618 { | |
7619 /* Only de-activate it here, it will be enabled when changing mode. */ | |
7620 if (p_imdisable) | |
7621 im_set_active(FALSE); | |
7622 } | |
7623 #endif | |
7624 | |
744 | 7625 #ifdef FEAT_SPELL |
258 | 7626 /* 'spell' */ |
7627 else if ((int *)varp == &curwin->w_p_spell) | |
7628 { | |
7629 if (curwin->w_p_spell) | |
7630 { | |
2250
1bac28a53fae
Add the conceal patch from Vince Negri.
Bram Moolenaar <bram@vim.org>
parents:
2248
diff
changeset
|
7631 char_u *errmsg = did_set_spelllang(curwin); |
258 | 7632 if (errmsg != NULL) |
7633 EMSG(_(errmsg)); | |
7634 } | |
7635 } | |
7636 #endif | |
7637 | |
7 | 7638 #ifdef FEAT_FKMAP |
7639 else if ((int *)varp == &p_altkeymap) | |
7640 { | |
7641 if (old_value != p_altkeymap) | |
7642 { | |
7643 if (!p_altkeymap) | |
7644 { | |
7645 p_hkmap = p_fkmap; | |
7646 p_fkmap = 0; | |
7647 } | |
7648 else | |
7649 { | |
7650 p_fkmap = p_hkmap; | |
7651 p_hkmap = 0; | |
7652 } | |
7653 (void)init_chartab(); | |
7654 } | |
7655 } | |
7656 | |
7657 /* | |
7658 * In case some second language keymapping options have changed, check | |
7659 * and correct the setting in a consistent way. | |
7660 */ | |
7661 | |
7662 /* | |
7663 * If hkmap or fkmap are set, reset Arabic keymapping. | |
7664 */ | |
7665 if ((p_hkmap || p_fkmap) && p_altkeymap) | |
7666 { | |
7667 p_altkeymap = p_fkmap; | |
7668 # ifdef FEAT_ARABIC | |
7669 curwin->w_p_arab = FALSE; | |
7670 # endif | |
7671 (void)init_chartab(); | |
7672 } | |
7673 | |
7674 /* | |
7675 * If hkmap set, reset Farsi keymapping. | |
7676 */ | |
7677 if (p_hkmap && p_altkeymap) | |
7678 { | |
7679 p_altkeymap = 0; | |
7680 p_fkmap = 0; | |
7681 # ifdef FEAT_ARABIC | |
7682 curwin->w_p_arab = FALSE; | |
7683 # endif | |
7684 (void)init_chartab(); | |
7685 } | |
7686 | |
7687 /* | |
7688 * If fkmap set, reset Hebrew keymapping. | |
7689 */ | |
7690 if (p_fkmap && !p_altkeymap) | |
7691 { | |
7692 p_altkeymap = 1; | |
7693 p_hkmap = 0; | |
7694 # ifdef FEAT_ARABIC | |
7695 curwin->w_p_arab = FALSE; | |
7696 # endif | |
7697 (void)init_chartab(); | |
7698 } | |
7699 #endif | |
7700 | |
7701 #ifdef FEAT_ARABIC | |
7702 if ((int *)varp == &curwin->w_p_arab) | |
7703 { | |
7704 if (curwin->w_p_arab) | |
7705 { | |
7706 /* | |
7707 * 'arabic' is set, handle various sub-settings. | |
7708 */ | |
7709 if (!p_tbidi) | |
7710 { | |
7711 /* set rightleft mode */ | |
7712 if (!curwin->w_p_rl) | |
7713 { | |
7714 curwin->w_p_rl = TRUE; | |
7715 changed_window_setting(); | |
7716 } | |
7717 | |
7718 /* Enable Arabic shaping (major part of what Arabic requires) */ | |
7719 if (!p_arshape) | |
7720 { | |
7721 p_arshape = TRUE; | |
7722 redraw_later_clear(); | |
7723 } | |
7724 } | |
7725 | |
7726 /* Arabic requires a utf-8 encoding, inform the user if its not | |
7727 * set. */ | |
7728 if (STRCMP(p_enc, "utf-8") != 0) | |
16 | 7729 { |
1848 | 7730 static char *w_arabic = N_("W17: Arabic requires UTF-8, do ':set encoding=utf-8'"); |
7731 | |
16 | 7732 msg_source(hl_attr(HLF_W)); |
1848 | 7733 MSG_ATTR(_(w_arabic), hl_attr(HLF_W)); |
7734 #ifdef FEAT_EVAL | |
7735 set_vim_var_string(VV_WARNINGMSG, (char_u *)_(w_arabic), -1); | |
7736 #endif | |
16 | 7737 } |
7 | 7738 |
7739 # ifdef FEAT_MBYTE | |
7740 /* set 'delcombine' */ | |
7741 p_deco = TRUE; | |
7742 # endif | |
7743 | |
7744 # ifdef FEAT_KEYMAP | |
7745 /* Force-set the necessary keymap for arabic */ | |
7746 set_option_value((char_u *)"keymap", 0L, (char_u *)"arabic", | |
7747 OPT_LOCAL); | |
7748 # endif | |
7749 # ifdef FEAT_FKMAP | |
7750 p_altkeymap = 0; | |
7751 p_hkmap = 0; | |
7752 p_fkmap = 0; | |
7753 (void)init_chartab(); | |
7754 # endif | |
7755 } | |
7756 else | |
7757 { | |
7758 /* | |
7759 * 'arabic' is reset, handle various sub-settings. | |
7760 */ | |
7761 if (!p_tbidi) | |
7762 { | |
7763 /* reset rightleft mode */ | |
7764 if (curwin->w_p_rl) | |
7765 { | |
7766 curwin->w_p_rl = FALSE; | |
7767 changed_window_setting(); | |
7768 } | |
7769 | |
7770 /* 'arabicshape' isn't reset, it is a global option and | |
7771 * another window may still need it "on". */ | |
7772 } | |
7773 | |
7774 /* 'delcombine' isn't reset, it is a global option and another | |
7775 * window may still want it "on". */ | |
7776 | |
7777 # ifdef FEAT_KEYMAP | |
7778 /* Revert to the default keymap */ | |
7779 curbuf->b_p_iminsert = B_IMODE_NONE; | |
7780 curbuf->b_p_imsearch = B_IMODE_USE_INSERT; | |
7781 # endif | |
7782 } | |
1945 | 7783 if (curwin->w_curswant != MAXCOL) |
7784 curwin->w_set_curswant = TRUE; | |
7785 } | |
7786 | |
7787 else if ((int *)varp == &p_arshape) | |
7788 { | |
7789 if (curwin->w_curswant != MAXCOL) | |
7790 curwin->w_set_curswant = TRUE; | |
7 | 7791 } |
7792 #endif | |
7793 | |
1958 | 7794 #ifdef FEAT_LINEBREAK |
7795 if ((int *)varp == &curwin->w_p_lbr) | |
7796 { | |
7797 if (curwin->w_curswant != MAXCOL) | |
7798 curwin->w_set_curswant = TRUE; | |
7799 } | |
7800 #endif | |
7801 | |
7802 #ifdef FEAT_RIGHTLEFT | |
7803 if ((int *)varp == &curwin->w_p_rl) | |
7804 { | |
7805 if (curwin->w_curswant != MAXCOL) | |
7806 curwin->w_set_curswant = TRUE; | |
7807 } | |
7808 #endif | |
7809 | |
7 | 7810 /* |
7811 * End of handling side effects for bool options. | |
7812 */ | |
7813 | |
7814 options[opt_idx].flags |= P_WAS_SET; | |
7815 | |
7816 comp_col(); /* in case 'ruler' or 'showcmd' changed */ | |
1945 | 7817 |
7 | 7818 check_redraw(options[opt_idx].flags); |
7819 | |
7820 return NULL; | |
7821 } | |
7822 | |
7823 /* | |
7824 * Set the value of a number option, and take care of side effects. | |
7825 * Returns NULL for success, or an error message for an error. | |
7826 */ | |
7827 static char_u * | |
274 | 7828 set_num_option(opt_idx, varp, value, errbuf, errbuflen, opt_flags) |
7 | 7829 int opt_idx; /* index in options[] table */ |
7830 char_u *varp; /* pointer to the option variable */ | |
7831 long value; /* new value */ | |
7832 char_u *errbuf; /* buffer for error messages */ | |
274 | 7833 size_t errbuflen; /* length of "errbuf" */ |
7 | 7834 int opt_flags; /* OPT_LOCAL, OPT_GLOBAL and |
7835 OPT_MODELINE */ | |
7836 { | |
7837 char_u *errmsg = NULL; | |
7838 long old_value = *(long *)varp; | |
7839 long old_Rows = Rows; /* remember old Rows */ | |
7840 long old_Columns = Columns; /* remember old Columns */ | |
7841 long *pp = (long *)varp; | |
7842 | |
634 | 7843 /* Disallow changing some options from secure mode. */ |
7844 if ((secure | |
7845 #ifdef HAVE_SANDBOX | |
7846 || sandbox != 0 | |
7847 #endif | |
7848 ) && (options[opt_idx].flags & P_SECURE)) | |
7849 return e_secure; | |
7 | 7850 |
7851 *pp = value; | |
7852 #ifdef FEAT_EVAL | |
7853 /* Remember where the option was set. */ | |
694 | 7854 set_option_scriptID_idx(opt_idx, opt_flags, current_SID); |
7 | 7855 #endif |
634 | 7856 #ifdef FEAT_GUI |
7857 need_mouse_correct = TRUE; | |
7858 #endif | |
7 | 7859 |
7860 if (curbuf->b_p_sw <= 0) | |
7861 { | |
7862 errmsg = e_positive; | |
7863 curbuf->b_p_sw = curbuf->b_p_ts; | |
7864 } | |
7865 | |
7866 /* | |
7867 * Number options that need some action when changed | |
7868 */ | |
7869 #ifdef FEAT_WINDOWS | |
7870 if (pp == &p_wh || pp == &p_hh) | |
7871 { | |
7872 if (p_wh < 1) | |
7873 { | |
7874 errmsg = e_positive; | |
7875 p_wh = 1; | |
7876 } | |
7877 if (p_wmh > p_wh) | |
7878 { | |
7879 errmsg = e_winheight; | |
7880 p_wh = p_wmh; | |
7881 } | |
7882 if (p_hh < 0) | |
7883 { | |
7884 errmsg = e_positive; | |
7885 p_hh = 0; | |
7886 } | |
7887 | |
7888 /* Change window height NOW */ | |
7889 if (lastwin != firstwin) | |
7890 { | |
7891 if (pp == &p_wh && curwin->w_height < p_wh) | |
7892 win_setheight((int)p_wh); | |
7893 if (pp == &p_hh && curbuf->b_help && curwin->w_height < p_hh) | |
7894 win_setheight((int)p_hh); | |
7895 } | |
7896 } | |
7897 | |
7898 /* 'winminheight' */ | |
7899 else if (pp == &p_wmh) | |
7900 { | |
7901 if (p_wmh < 0) | |
7902 { | |
7903 errmsg = e_positive; | |
7904 p_wmh = 0; | |
7905 } | |
7906 if (p_wmh > p_wh) | |
7907 { | |
7908 errmsg = e_winheight; | |
7909 p_wmh = p_wh; | |
7910 } | |
7911 win_setminheight(); | |
7912 } | |
7913 | |
7914 # ifdef FEAT_VERTSPLIT | |
13 | 7915 else if (pp == &p_wiw) |
7 | 7916 { |
7917 if (p_wiw < 1) | |
7918 { | |
7919 errmsg = e_positive; | |
7920 p_wiw = 1; | |
7921 } | |
7922 if (p_wmw > p_wiw) | |
7923 { | |
7924 errmsg = e_winwidth; | |
7925 p_wiw = p_wmw; | |
7926 } | |
7927 | |
7928 /* Change window width NOW */ | |
7929 if (lastwin != firstwin && curwin->w_width < p_wiw) | |
7930 win_setwidth((int)p_wiw); | |
7931 } | |
7932 | |
7933 /* 'winminwidth' */ | |
7934 else if (pp == &p_wmw) | |
7935 { | |
7936 if (p_wmw < 0) | |
7937 { | |
7938 errmsg = e_positive; | |
7939 p_wmw = 0; | |
7940 } | |
7941 if (p_wmw > p_wiw) | |
7942 { | |
7943 errmsg = e_winwidth; | |
7944 p_wmw = p_wiw; | |
7945 } | |
7946 win_setminheight(); | |
7947 } | |
7948 # endif | |
7949 | |
7950 #endif | |
7951 | |
2184
5028c4d6d825
Fixed encryption big/little endian test.
Bram Moolenaar <bram@vim.org>
parents:
2180
diff
changeset
|
7952 #ifdef FEAT_CRYPT |
2180
f60a0c9cbe6c
Add the blowfish encryption patch from Mohsin Ahmed. Needs more work.
Bram Moolenaar <bram@vim.org>
parents:
2178
diff
changeset
|
7953 else if (pp == &curbuf->b_p_cm) |
f60a0c9cbe6c
Add the blowfish encryption patch from Mohsin Ahmed. Needs more work.
Bram Moolenaar <bram@vim.org>
parents:
2178
diff
changeset
|
7954 { |
f60a0c9cbe6c
Add the blowfish encryption patch from Mohsin Ahmed. Needs more work.
Bram Moolenaar <bram@vim.org>
parents:
2178
diff
changeset
|
7955 if (curbuf->b_p_cm < 0) |
f60a0c9cbe6c
Add the blowfish encryption patch from Mohsin Ahmed. Needs more work.
Bram Moolenaar <bram@vim.org>
parents:
2178
diff
changeset
|
7956 { |
f60a0c9cbe6c
Add the blowfish encryption patch from Mohsin Ahmed. Needs more work.
Bram Moolenaar <bram@vim.org>
parents:
2178
diff
changeset
|
7957 errmsg = e_positive; |
2267 | 7958 curbuf->b_p_cm = old_value; |
2180
f60a0c9cbe6c
Add the blowfish encryption patch from Mohsin Ahmed. Needs more work.
Bram Moolenaar <bram@vim.org>
parents:
2178
diff
changeset
|
7959 } |
f60a0c9cbe6c
Add the blowfish encryption patch from Mohsin Ahmed. Needs more work.
Bram Moolenaar <bram@vim.org>
parents:
2178
diff
changeset
|
7960 if (curbuf->b_p_cm > 1) |
f60a0c9cbe6c
Add the blowfish encryption patch from Mohsin Ahmed. Needs more work.
Bram Moolenaar <bram@vim.org>
parents:
2178
diff
changeset
|
7961 { |
f60a0c9cbe6c
Add the blowfish encryption patch from Mohsin Ahmed. Needs more work.
Bram Moolenaar <bram@vim.org>
parents:
2178
diff
changeset
|
7962 errmsg = e_invarg; |
2267 | 7963 curbuf->b_p_cm = old_value; |
2180
f60a0c9cbe6c
Add the blowfish encryption patch from Mohsin Ahmed. Needs more work.
Bram Moolenaar <bram@vim.org>
parents:
2178
diff
changeset
|
7964 } |
f60a0c9cbe6c
Add the blowfish encryption patch from Mohsin Ahmed. Needs more work.
Bram Moolenaar <bram@vim.org>
parents:
2178
diff
changeset
|
7965 if (curbuf->b_p_cm > 0 && blowfish_self_test() == FAIL) |
2267 | 7966 curbuf->b_p_cm = old_value; |
7967 | |
7968 if (curbuf->b_p_cm != old_value && *curbuf->b_p_key != NUL) | |
7969 /* Need to update the swapfile. */ | |
7970 ml_set_crypt_key(curbuf, curbuf->b_p_key, old_value); | |
2180
f60a0c9cbe6c
Add the blowfish encryption patch from Mohsin Ahmed. Needs more work.
Bram Moolenaar <bram@vim.org>
parents:
2178
diff
changeset
|
7971 } |
2184
5028c4d6d825
Fixed encryption big/little endian test.
Bram Moolenaar <bram@vim.org>
parents:
2180
diff
changeset
|
7972 #endif |
2180
f60a0c9cbe6c
Add the blowfish encryption patch from Mohsin Ahmed. Needs more work.
Bram Moolenaar <bram@vim.org>
parents:
2178
diff
changeset
|
7973 |
7 | 7974 #ifdef FEAT_WINDOWS |
7975 /* (re)set last window status line */ | |
7976 else if (pp == &p_ls) | |
7977 { | |
7978 last_status(FALSE); | |
7979 } | |
670 | 7980 |
7981 /* (re)set tab page line */ | |
677 | 7982 else if (pp == &p_stal) |
670 | 7983 { |
7984 shell_new_rows(); /* recompute window positions and heights */ | |
7985 } | |
7 | 7986 #endif |
7987 | |
7988 #ifdef FEAT_GUI | |
7989 else if (pp == &p_linespace) | |
7990 { | |
444 | 7991 /* Recompute gui.char_height and resize the Vim window to keep the |
7992 * same number of lines. */ | |
7993 if (gui.in_use && gui_mch_adjust_charheight() == OK) | |
813 | 7994 gui_set_shellsize(FALSE, FALSE, RESIZE_VERT); |
7 | 7995 } |
7996 #endif | |
7997 | |
7998 #ifdef FEAT_FOLDING | |
7999 /* 'foldlevel' */ | |
8000 else if (pp == &curwin->w_p_fdl) | |
8001 { | |
8002 if (curwin->w_p_fdl < 0) | |
8003 curwin->w_p_fdl = 0; | |
8004 newFoldLevel(); | |
8005 } | |
8006 | |
1805 | 8007 /* 'foldminlines' */ |
7 | 8008 else if (pp == &curwin->w_p_fml) |
8009 { | |
8010 foldUpdateAll(curwin); | |
8011 } | |
8012 | |
8013 /* 'foldnestmax' */ | |
8014 else if (pp == &curwin->w_p_fdn) | |
8015 { | |
8016 if (foldmethodIsSyntax(curwin) || foldmethodIsIndent(curwin)) | |
8017 foldUpdateAll(curwin); | |
8018 } | |
8019 | |
8020 /* 'foldcolumn' */ | |
8021 else if (pp == &curwin->w_p_fdc) | |
8022 { | |
8023 if (curwin->w_p_fdc < 0) | |
8024 { | |
8025 errmsg = e_positive; | |
8026 curwin->w_p_fdc = 0; | |
8027 } | |
8028 else if (curwin->w_p_fdc > 12) | |
8029 { | |
8030 errmsg = e_invarg; | |
8031 curwin->w_p_fdc = 12; | |
8032 } | |
8033 } | |
8034 | |
8035 /* 'shiftwidth' or 'tabstop' */ | |
8036 else if (pp == &curbuf->b_p_sw || pp == &curbuf->b_p_ts) | |
8037 { | |
8038 if (foldmethodIsIndent(curwin)) | |
8039 foldUpdateAll(curwin); | |
8040 } | |
8041 #endif /* FEAT_FOLDING */ | |
8042 | |
714 | 8043 #ifdef FEAT_MBYTE |
8044 /* 'maxcombine' */ | |
8045 else if (pp == &p_mco) | |
8046 { | |
8047 if (p_mco > MAX_MCO) | |
8048 p_mco = MAX_MCO; | |
8049 else if (p_mco < 0) | |
8050 p_mco = 0; | |
8051 screenclear(); /* will re-allocate the screen */ | |
8052 } | |
8053 #endif | |
8054 | |
7 | 8055 else if (pp == &curbuf->b_p_iminsert) |
8056 { | |
8057 if (curbuf->b_p_iminsert < 0 || curbuf->b_p_iminsert > B_IMODE_LAST) | |
8058 { | |
8059 errmsg = e_invarg; | |
8060 curbuf->b_p_iminsert = B_IMODE_NONE; | |
8061 } | |
8062 p_iminsert = curbuf->b_p_iminsert; | |
8063 if (termcap_active) /* don't do this in the alternate screen */ | |
8064 showmode(); | |
8065 #if defined(FEAT_WINDOWS) && defined(FEAT_KEYMAP) | |
8066 /* Show/unshow value of 'keymap' in status lines. */ | |
8067 status_redraw_curbuf(); | |
8068 #endif | |
8069 } | |
8070 | |
164 | 8071 else if (pp == &p_window) |
8072 { | |
8073 if (p_window < 1) | |
8074 p_window = 1; | |
8075 else if (p_window >= Rows) | |
8076 p_window = Rows - 1; | |
8077 } | |
8078 | |
7 | 8079 else if (pp == &curbuf->b_p_imsearch) |
8080 { | |
8081 if (curbuf->b_p_imsearch < -1 || curbuf->b_p_imsearch > B_IMODE_LAST) | |
8082 { | |
8083 errmsg = e_invarg; | |
8084 curbuf->b_p_imsearch = B_IMODE_NONE; | |
8085 } | |
8086 p_imsearch = curbuf->b_p_imsearch; | |
8087 } | |
8088 | |
8089 #ifdef FEAT_TITLE | |
8090 /* if 'titlelen' has changed, redraw the title */ | |
8091 else if (pp == &p_titlelen) | |
8092 { | |
8093 if (p_titlelen < 0) | |
8094 { | |
8095 errmsg = e_positive; | |
8096 p_titlelen = 85; | |
8097 } | |
8098 if (starting != NO_SCREEN && old_value != p_titlelen) | |
8099 need_maketitle = TRUE; | |
8100 } | |
8101 #endif | |
8102 | |
8103 /* if p_ch changed value, change the command line height */ | |
8104 else if (pp == &p_ch) | |
8105 { | |
8106 if (p_ch < 1) | |
8107 { | |
8108 errmsg = e_positive; | |
8109 p_ch = 1; | |
8110 } | |
1404 | 8111 if (p_ch > Rows - min_rows() + 1) |
8112 p_ch = Rows - min_rows() + 1; | |
7 | 8113 |
8114 /* Only compute the new window layout when startup has been | |
8115 * completed. Otherwise the frame sizes may be wrong. */ | |
8116 if (p_ch != old_value && full_screen | |
8117 #ifdef FEAT_GUI | |
8118 && !gui.starting | |
8119 #endif | |
8120 ) | |
824 | 8121 command_height(); |
7 | 8122 } |
8123 | |
8124 /* when 'updatecount' changes from zero to non-zero, open swap files */ | |
8125 else if (pp == &p_uc) | |
8126 { | |
8127 if (p_uc < 0) | |
8128 { | |
8129 errmsg = e_positive; | |
8130 p_uc = 100; | |
8131 } | |
8132 if (p_uc && !old_value) | |
8133 ml_open_files(); | |
8134 } | |
2250
1bac28a53fae
Add the conceal patch from Vince Negri.
Bram Moolenaar <bram@vim.org>
parents:
2248
diff
changeset
|
8135 #ifdef FEAT_CONCEAL |
2271
2b33a7678e7b
Fix compiler warnings for shadowed variables. Make 'conceal' a long instead
Bram Moolenaar <bram@vim.org>
parents:
2269
diff
changeset
|
8136 else if (pp == &curwin->w_p_conceal) |
2250
1bac28a53fae
Add the conceal patch from Vince Negri.
Bram Moolenaar <bram@vim.org>
parents:
2248
diff
changeset
|
8137 { |
1bac28a53fae
Add the conceal patch from Vince Negri.
Bram Moolenaar <bram@vim.org>
parents:
2248
diff
changeset
|
8138 if (curwin->w_p_conceal < 0) |
1bac28a53fae
Add the conceal patch from Vince Negri.
Bram Moolenaar <bram@vim.org>
parents:
2248
diff
changeset
|
8139 { |
1bac28a53fae
Add the conceal patch from Vince Negri.
Bram Moolenaar <bram@vim.org>
parents:
2248
diff
changeset
|
8140 errmsg = e_positive; |
1bac28a53fae
Add the conceal patch from Vince Negri.
Bram Moolenaar <bram@vim.org>
parents:
2248
diff
changeset
|
8141 curwin->w_p_conceal = 0; |
1bac28a53fae
Add the conceal patch from Vince Negri.
Bram Moolenaar <bram@vim.org>
parents:
2248
diff
changeset
|
8142 } |
1bac28a53fae
Add the conceal patch from Vince Negri.
Bram Moolenaar <bram@vim.org>
parents:
2248
diff
changeset
|
8143 else if (curwin->w_p_conceal > 3) |
1bac28a53fae
Add the conceal patch from Vince Negri.
Bram Moolenaar <bram@vim.org>
parents:
2248
diff
changeset
|
8144 { |
1bac28a53fae
Add the conceal patch from Vince Negri.
Bram Moolenaar <bram@vim.org>
parents:
2248
diff
changeset
|
8145 errmsg = e_invarg; |
1bac28a53fae
Add the conceal patch from Vince Negri.
Bram Moolenaar <bram@vim.org>
parents:
2248
diff
changeset
|
8146 curwin->w_p_conceal = 3; |
1bac28a53fae
Add the conceal patch from Vince Negri.
Bram Moolenaar <bram@vim.org>
parents:
2248
diff
changeset
|
8147 } |
1bac28a53fae
Add the conceal patch from Vince Negri.
Bram Moolenaar <bram@vim.org>
parents:
2248
diff
changeset
|
8148 } |
1bac28a53fae
Add the conceal patch from Vince Negri.
Bram Moolenaar <bram@vim.org>
parents:
2248
diff
changeset
|
8149 #endif |
16 | 8150 #ifdef MZSCHEME_GUI_THREADS |
14 | 8151 else if (pp == &p_mzq) |
8152 mzvim_reset_timer(); | |
8153 #endif | |
7 | 8154 |
8155 /* sync undo before 'undolevels' changes */ | |
8156 else if (pp == &p_ul) | |
8157 { | |
8158 /* use the old value, otherwise u_sync() may not work properly */ | |
8159 p_ul = old_value; | |
825 | 8160 u_sync(TRUE); |
7 | 8161 p_ul = value; |
8162 } | |
8163 | |
13 | 8164 #ifdef FEAT_LINEBREAK |
8165 /* 'numberwidth' must be positive */ | |
8166 else if (pp == &curwin->w_p_nuw) | |
8167 { | |
8168 if (curwin->w_p_nuw < 1) | |
8169 { | |
8170 errmsg = e_positive; | |
8171 curwin->w_p_nuw = 1; | |
8172 } | |
8173 if (curwin->w_p_nuw > 10) | |
8174 { | |
8175 errmsg = e_invarg; | |
8176 curwin->w_p_nuw = 10; | |
8177 } | |
8178 curwin->w_nrwidth_line_count = 0; | |
8179 } | |
8180 #endif | |
8181 | |
7 | 8182 /* |
8183 * Check the bounds for numeric options here | |
8184 */ | |
8185 if (Rows < min_rows() && full_screen) | |
8186 { | |
8187 if (errbuf != NULL) | |
8188 { | |
274 | 8189 vim_snprintf((char *)errbuf, errbuflen, |
8190 _("E593: Need at least %d lines"), min_rows()); | |
7 | 8191 errmsg = errbuf; |
8192 } | |
8193 Rows = min_rows(); | |
8194 } | |
8195 if (Columns < MIN_COLUMNS && full_screen) | |
8196 { | |
8197 if (errbuf != NULL) | |
8198 { | |
274 | 8199 vim_snprintf((char *)errbuf, errbuflen, |
8200 _("E594: Need at least %d columns"), MIN_COLUMNS); | |
7 | 8201 errmsg = errbuf; |
8202 } | |
8203 Columns = MIN_COLUMNS; | |
8204 } | |
534 | 8205 /* Limit the values to avoid an overflow in Rows * Columns. */ |
8206 if (Columns > 10000) | |
8207 Columns = 10000; | |
8208 if (Rows > 1000) | |
8209 Rows = 1000; | |
7 | 8210 |
8211 #ifdef DJGPP | |
8212 /* avoid a crash by checking for a too large value of 'columns' */ | |
8213 if (old_Columns != Columns && full_screen && term_console) | |
8214 mch_check_columns(); | |
8215 #endif | |
8216 | |
8217 /* | |
8218 * If the screen (shell) height has been changed, assume it is the | |
8219 * physical screenheight. | |
8220 */ | |
8221 if (old_Rows != Rows || old_Columns != Columns) | |
8222 { | |
8223 /* Changing the screen size is not allowed while updating the screen. */ | |
8224 if (updating_screen) | |
8225 *pp = old_value; | |
8226 else if (full_screen | |
8227 #ifdef FEAT_GUI | |
8228 && !gui.starting | |
8229 #endif | |
8230 ) | |
8231 set_shellsize((int)Columns, (int)Rows, TRUE); | |
8232 else | |
8233 { | |
8234 /* Postpone the resizing; check the size and cmdline position for | |
8235 * messages. */ | |
8236 check_shellsize(); | |
8237 if (cmdline_row > Rows - p_ch && Rows > p_ch) | |
8238 cmdline_row = Rows - p_ch; | |
8239 } | |
857 | 8240 if (p_window >= Rows || !option_was_set((char_u *)"window")) |
164 | 8241 p_window = Rows - 1; |
7 | 8242 } |
8243 | |
8244 if (curbuf->b_p_sts < 0) | |
8245 { | |
8246 errmsg = e_positive; | |
8247 curbuf->b_p_sts = 0; | |
8248 } | |
8249 if (curbuf->b_p_ts <= 0) | |
8250 { | |
8251 errmsg = e_positive; | |
8252 curbuf->b_p_ts = 8; | |
8253 } | |
8254 if (curbuf->b_p_tw < 0) | |
8255 { | |
8256 errmsg = e_positive; | |
8257 curbuf->b_p_tw = 0; | |
8258 } | |
8259 if (p_tm < 0) | |
8260 { | |
8261 errmsg = e_positive; | |
8262 p_tm = 0; | |
8263 } | |
8264 if ((curwin->w_p_scr <= 0 | |
8265 || (curwin->w_p_scr > curwin->w_height | |
8266 && curwin->w_height > 0)) | |
8267 && full_screen) | |
8268 { | |
8269 if (pp == &(curwin->w_p_scr)) | |
8270 { | |
8271 if (curwin->w_p_scr != 0) | |
8272 errmsg = e_scroll; | |
8273 win_comp_scroll(curwin); | |
8274 } | |
8275 /* If 'scroll' became invalid because of a side effect silently adjust | |
8276 * it. */ | |
8277 else if (curwin->w_p_scr <= 0) | |
8278 curwin->w_p_scr = 1; | |
8279 else /* curwin->w_p_scr > curwin->w_height */ | |
8280 curwin->w_p_scr = curwin->w_height; | |
8281 } | |
1726 | 8282 if (p_hi < 0) |
8283 { | |
8284 errmsg = e_positive; | |
8285 p_hi = 0; | |
8286 } | |
7 | 8287 if (p_report < 0) |
8288 { | |
8289 errmsg = e_positive; | |
8290 p_report = 1; | |
8291 } | |
532 | 8292 if ((p_sj < -100 || p_sj >= Rows) && full_screen) |
7 | 8293 { |
8294 if (Rows != old_Rows) /* Rows changed, just adjust p_sj */ | |
8295 p_sj = Rows / 2; | |
8296 else | |
8297 { | |
8298 errmsg = e_scroll; | |
8299 p_sj = 1; | |
8300 } | |
8301 } | |
8302 if (p_so < 0 && full_screen) | |
8303 { | |
8304 errmsg = e_scroll; | |
8305 p_so = 0; | |
8306 } | |
8307 if (p_siso < 0 && full_screen) | |
8308 { | |
8309 errmsg = e_positive; | |
8310 p_siso = 0; | |
8311 } | |
8312 #ifdef FEAT_CMDWIN | |
8313 if (p_cwh < 1) | |
8314 { | |
8315 errmsg = e_positive; | |
8316 p_cwh = 1; | |
8317 } | |
8318 #endif | |
8319 if (p_ut < 0) | |
8320 { | |
8321 errmsg = e_positive; | |
8322 p_ut = 2000; | |
8323 } | |
8324 if (p_ss < 0) | |
8325 { | |
8326 errmsg = e_positive; | |
8327 p_ss = 0; | |
8328 } | |
8329 | |
8330 /* May set global value for local option. */ | |
8331 if ((opt_flags & (OPT_LOCAL | OPT_GLOBAL)) == 0) | |
8332 *(long *)get_varp_scope(&(options[opt_idx]), OPT_GLOBAL) = *pp; | |
8333 | |
8334 options[opt_idx].flags |= P_WAS_SET; | |
8335 | |
8336 comp_col(); /* in case 'columns' or 'ls' changed */ | |
8337 if (curwin->w_curswant != MAXCOL) | |
8338 curwin->w_set_curswant = TRUE; /* in case 'tabstop' changed */ | |
8339 check_redraw(options[opt_idx].flags); | |
8340 | |
8341 return errmsg; | |
8342 } | |
8343 | |
8344 /* | |
8345 * Called after an option changed: check if something needs to be redrawn. | |
8346 */ | |
8347 static void | |
8348 check_redraw(flags) | |
8349 long_u flags; | |
8350 { | |
8351 /* Careful: P_RCLR and P_RALL are a combination of other P_ flags */ | |
8352 int clear = (flags & P_RCLR) == P_RCLR; | |
8353 int all = ((flags & P_RALL) == P_RALL || clear); | |
8354 | |
8355 #ifdef FEAT_WINDOWS | |
8356 if ((flags & P_RSTAT) || all) /* mark all status lines dirty */ | |
8357 status_redraw_all(); | |
8358 #endif | |
8359 | |
8360 if ((flags & P_RBUF) || (flags & P_RWIN) || all) | |
8361 changed_window_setting(); | |
8362 if (flags & P_RBUF) | |
8363 redraw_curbuf_later(NOT_VALID); | |
8364 if (clear) | |
8365 redraw_all_later(CLEAR); | |
8366 else if (all) | |
8367 redraw_all_later(NOT_VALID); | |
8368 } | |
8369 | |
8370 /* | |
8371 * Find index for option 'arg'. | |
8372 * Return -1 if not found. | |
8373 */ | |
8374 static int | |
8375 findoption(arg) | |
8376 char_u *arg; | |
8377 { | |
8378 int opt_idx; | |
8379 char *s, *p; | |
8380 static short quick_tab[27] = {0, 0}; /* quick access table */ | |
8381 int is_term_opt; | |
8382 | |
8383 /* | |
8384 * For first call: Initialize the quick-access table. | |
8385 * It contains the index for the first option that starts with a certain | |
8386 * letter. There are 26 letters, plus the first "t_" option. | |
8387 */ | |
8388 if (quick_tab[1] == 0) | |
8389 { | |
8390 p = options[0].fullname; | |
8391 for (opt_idx = 1; (s = options[opt_idx].fullname) != NULL; opt_idx++) | |
8392 { | |
8393 if (s[0] != p[0]) | |
8394 { | |
8395 if (s[0] == 't' && s[1] == '_') | |
8396 quick_tab[26] = opt_idx; | |
8397 else | |
8398 quick_tab[CharOrdLow(s[0])] = opt_idx; | |
8399 } | |
8400 p = s; | |
8401 } | |
8402 } | |
8403 | |
8404 /* | |
8405 * Check for name starting with an illegal character. | |
8406 */ | |
8407 #ifdef EBCDIC | |
8408 if (!islower(arg[0])) | |
8409 #else | |
8410 if (arg[0] < 'a' || arg[0] > 'z') | |
8411 #endif | |
8412 return -1; | |
8413 | |
8414 is_term_opt = (arg[0] == 't' && arg[1] == '_'); | |
8415 if (is_term_opt) | |
8416 opt_idx = quick_tab[26]; | |
8417 else | |
8418 opt_idx = quick_tab[CharOrdLow(arg[0])]; | |
8419 for ( ; (s = options[opt_idx].fullname) != NULL; opt_idx++) | |
8420 { | |
8421 if (STRCMP(arg, s) == 0) /* match full name */ | |
8422 break; | |
8423 } | |
8424 if (s == NULL && !is_term_opt) | |
8425 { | |
8426 opt_idx = quick_tab[CharOrdLow(arg[0])]; | |
8427 for ( ; options[opt_idx].fullname != NULL; opt_idx++) | |
8428 { | |
8429 s = options[opt_idx].shortname; | |
8430 if (s != NULL && STRCMP(arg, s) == 0) /* match short name */ | |
8431 break; | |
8432 s = NULL; | |
8433 } | |
8434 } | |
8435 if (s == NULL) | |
8436 opt_idx = -1; | |
8437 return opt_idx; | |
8438 } | |
8439 | |
14 | 8440 #if defined(FEAT_EVAL) || defined(FEAT_TCL) || defined(FEAT_MZSCHEME) |
7 | 8441 /* |
8442 * Get the value for an option. | |
8443 * | |
8444 * Returns: | |
8445 * Number or Toggle option: 1, *numval gets value. | |
8446 * String option: 0, *stringval gets allocated string. | |
8447 * Hidden Number or Toggle option: -1. | |
8448 * hidden String option: -2. | |
8449 * unknown option: -3. | |
8450 */ | |
8451 int | |
8452 get_option_value(name, numval, stringval, opt_flags) | |
8453 char_u *name; | |
8454 long *numval; | |
2269
fb627e94e6c6
Couple of small fixes for conceal feature. (Dominique Pelle)
Bram Moolenaar <bram@vim.org>
parents:
2267
diff
changeset
|
8455 char_u **stringval; /* NULL when only checking existence */ |
7 | 8456 int opt_flags; |
8457 { | |
8458 int opt_idx; | |
8459 char_u *varp; | |
8460 | |
8461 opt_idx = findoption(name); | |
8462 if (opt_idx < 0) /* unknown option */ | |
8463 return -3; | |
8464 | |
8465 varp = get_varp_scope(&(options[opt_idx]), opt_flags); | |
8466 | |
8467 if (options[opt_idx].flags & P_STRING) | |
8468 { | |
8469 if (varp == NULL) /* hidden option */ | |
8470 return -2; | |
8471 if (stringval != NULL) | |
8472 { | |
8473 #ifdef FEAT_CRYPT | |
8474 /* never return the value of the crypt key */ | |
1622 | 8475 if ((char_u **)varp == &curbuf->b_p_key |
8476 && **(char_u **)(varp) != NUL) | |
7 | 8477 *stringval = vim_strsave((char_u *)"*****"); |
8478 else | |
8479 #endif | |
8480 *stringval = vim_strsave(*(char_u **)(varp)); | |
8481 } | |
8482 return 0; | |
8483 } | |
8484 | |
8485 if (varp == NULL) /* hidden option */ | |
8486 return -1; | |
8487 if (options[opt_idx].flags & P_NUM) | |
8488 *numval = *(long *)varp; | |
8489 else | |
8490 { | |
8491 /* Special case: 'modified' is b_changed, but we also want to consider | |
8492 * it set when 'ff' or 'fenc' changed. */ | |
8493 if ((int *)varp == &curbuf->b_changed) | |
8494 *numval = curbufIsChanged(); | |
8495 else | |
8496 *numval = *(int *)varp; | |
8497 } | |
8498 return 1; | |
8499 } | |
8500 #endif | |
8501 | |
8502 /* | |
8503 * Set the value of option "name". | |
8504 * Use "string" for string options, use "number" for other options. | |
8505 */ | |
8506 void | |
8507 set_option_value(name, number, string, opt_flags) | |
8508 char_u *name; | |
8509 long number; | |
8510 char_u *string; | |
8511 int opt_flags; /* OPT_LOCAL or 0 (both) */ | |
8512 { | |
8513 int opt_idx; | |
8514 char_u *varp; | |
835 | 8515 long_u flags; |
7 | 8516 |
8517 opt_idx = findoption(name); | |
838 | 8518 if (opt_idx < 0) |
7 | 8519 EMSG2(_("E355: Unknown option: %s"), name); |
8520 else | |
8521 { | |
8522 flags = options[opt_idx].flags; | |
8523 #ifdef HAVE_SANDBOX | |
8524 /* Disallow changing some options in the sandbox */ | |
8525 if (sandbox > 0 && (flags & P_SECURE)) | |
634 | 8526 { |
7 | 8527 EMSG(_(e_sandbox)); |
634 | 8528 return; |
8529 } | |
8530 #endif | |
8531 if (flags & P_STRING) | |
7 | 8532 set_string_option(opt_idx, string, opt_flags); |
8533 else | |
8534 { | |
1667 | 8535 varp = get_varp_scope(&(options[opt_idx]), opt_flags); |
7 | 8536 if (varp != NULL) /* hidden option is not changed */ |
8537 { | |
1298 | 8538 if (number == 0 && string != NULL) |
8539 { | |
1757 | 8540 int idx; |
1298 | 8541 |
8542 /* Either we are given a string or we are setting option | |
8543 * to zero. */ | |
1757 | 8544 for (idx = 0; string[idx] == '0'; ++idx) |
1298 | 8545 ; |
1757 | 8546 if (string[idx] != NUL || idx == 0) |
1298 | 8547 { |
8548 /* There's another character after zeros or the string | |
8549 * is empty. In both cases, we are trying to set a | |
8550 * num option using a string. */ | |
8551 EMSG3(_("E521: Number required: &%s = '%s'"), | |
8552 name, string); | |
8553 return; /* do nothing as we hit an error */ | |
8554 | |
8555 } | |
8556 } | |
7 | 8557 if (flags & P_NUM) |
274 | 8558 (void)set_num_option(opt_idx, varp, number, |
8559 NULL, 0, opt_flags); | |
7 | 8560 else |
634 | 8561 (void)set_bool_option(opt_idx, varp, (int)number, |
8562 opt_flags); | |
7 | 8563 } |
8564 } | |
8565 } | |
8566 } | |
8567 | |
8568 /* | |
8569 * Get the terminal code for a terminal option. | |
8570 * Returns NULL when not found. | |
8571 */ | |
8572 char_u * | |
8573 get_term_code(tname) | |
8574 char_u *tname; | |
8575 { | |
8576 int opt_idx; | |
8577 char_u *varp; | |
8578 | |
8579 if (tname[0] != 't' || tname[1] != '_' || | |
8580 tname[2] == NUL || tname[3] == NUL) | |
8581 return NULL; | |
8582 if ((opt_idx = findoption(tname)) >= 0) | |
8583 { | |
8584 varp = get_varp(&(options[opt_idx])); | |
8585 if (varp != NULL) | |
8586 varp = *(char_u **)(varp); | |
8587 return varp; | |
8588 } | |
8589 return find_termcode(tname + 2); | |
8590 } | |
8591 | |
8592 char_u * | |
8593 get_highlight_default() | |
8594 { | |
8595 int i; | |
8596 | |
8597 i = findoption((char_u *)"hl"); | |
8598 if (i >= 0) | |
8599 return options[i].def_val[VI_DEFAULT]; | |
8600 return (char_u *)NULL; | |
8601 } | |
8602 | |
39 | 8603 #if defined(FEAT_MBYTE) || defined(PROTO) |
8604 char_u * | |
8605 get_encoding_default() | |
8606 { | |
8607 int i; | |
8608 | |
8609 i = findoption((char_u *)"enc"); | |
8610 if (i >= 0) | |
8611 return options[i].def_val[VI_DEFAULT]; | |
8612 return (char_u *)NULL; | |
8613 } | |
8614 #endif | |
8615 | |
7 | 8616 /* |
8617 * Translate a string like "t_xx", "<t_xx>" or "<S-Tab>" to a key number. | |
8618 */ | |
8619 static int | |
8620 find_key_option(arg) | |
8621 char_u *arg; | |
8622 { | |
8623 int key; | |
8624 int modifiers; | |
8625 | |
8626 /* | |
8627 * Don't use get_special_key_code() for t_xx, we don't want it to call | |
8628 * add_termcap_entry(). | |
8629 */ | |
8630 if (arg[0] == 't' && arg[1] == '_' && arg[2] && arg[3]) | |
8631 key = TERMCAP2KEY(arg[2], arg[3]); | |
8632 else | |
8633 { | |
8634 --arg; /* put arg at the '<' */ | |
8635 modifiers = 0; | |
1775 | 8636 key = find_special_key(&arg, &modifiers, TRUE, TRUE); |
7 | 8637 if (modifiers) /* can't handle modifiers here */ |
8638 key = 0; | |
8639 } | |
8640 return key; | |
8641 } | |
8642 | |
8643 /* | |
8644 * if 'all' == 0: show changed options | |
8645 * if 'all' == 1: show all normal options | |
8646 * if 'all' == 2: show all terminal options | |
8647 */ | |
8648 static void | |
8649 showoptions(all, opt_flags) | |
8650 int all; | |
8651 int opt_flags; /* OPT_LOCAL and/or OPT_GLOBAL */ | |
8652 { | |
8653 struct vimoption *p; | |
8654 int col; | |
8655 int isterm; | |
8656 char_u *varp; | |
8657 struct vimoption **items; | |
8658 int item_count; | |
8659 int run; | |
8660 int row, rows; | |
8661 int cols; | |
8662 int i; | |
8663 int len; | |
8664 | |
8665 #define INC 20 | |
8666 #define GAP 3 | |
8667 | |
8668 items = (struct vimoption **)alloc((unsigned)(sizeof(struct vimoption *) * | |
8669 PARAM_COUNT)); | |
8670 if (items == NULL) | |
8671 return; | |
8672 | |
8673 /* Highlight title */ | |
8674 if (all == 2) | |
8675 MSG_PUTS_TITLE(_("\n--- Terminal codes ---")); | |
8676 else if (opt_flags & OPT_GLOBAL) | |
8677 MSG_PUTS_TITLE(_("\n--- Global option values ---")); | |
8678 else if (opt_flags & OPT_LOCAL) | |
8679 MSG_PUTS_TITLE(_("\n--- Local option values ---")); | |
8680 else | |
8681 MSG_PUTS_TITLE(_("\n--- Options ---")); | |
8682 | |
8683 /* | |
8684 * do the loop two times: | |
8685 * 1. display the short items | |
8686 * 2. display the long items (only strings and numbers) | |
8687 */ | |
8688 for (run = 1; run <= 2 && !got_int; ++run) | |
8689 { | |
8690 /* | |
8691 * collect the items in items[] | |
8692 */ | |
8693 item_count = 0; | |
8694 for (p = &options[0]; p->fullname != NULL; p++) | |
8695 { | |
8696 varp = NULL; | |
8697 isterm = istermoption(p); | |
8698 if (opt_flags != 0) | |
8699 { | |
8700 if (p->indir != PV_NONE && !isterm) | |
8701 varp = get_varp_scope(p, opt_flags); | |
8702 } | |
8703 else | |
8704 varp = get_varp(p); | |
8705 if (varp != NULL | |
8706 && ((all == 2 && isterm) | |
8707 || (all == 1 && !isterm) | |
8708 || (all == 0 && !optval_default(p, varp)))) | |
8709 { | |
8710 if (p->flags & P_BOOL) | |
8711 len = 1; /* a toggle option fits always */ | |
8712 else | |
8713 { | |
8714 option_value2string(p, opt_flags); | |
8715 len = (int)STRLEN(p->fullname) + vim_strsize(NameBuff) + 1; | |
8716 } | |
8717 if ((len <= INC - GAP && run == 1) || | |
8718 (len > INC - GAP && run == 2)) | |
8719 items[item_count++] = p; | |
8720 } | |
8721 } | |
8722 | |
8723 /* | |
8724 * display the items | |
8725 */ | |
8726 if (run == 1) | |
8727 { | |
8728 cols = (Columns + GAP - 3) / INC; | |
8729 if (cols == 0) | |
8730 cols = 1; | |
8731 rows = (item_count + cols - 1) / cols; | |
8732 } | |
8733 else /* run == 2 */ | |
8734 rows = item_count; | |
8735 for (row = 0; row < rows && !got_int; ++row) | |
8736 { | |
8737 msg_putchar('\n'); /* go to next line */ | |
8738 if (got_int) /* 'q' typed in more */ | |
8739 break; | |
8740 col = 0; | |
8741 for (i = row; i < item_count; i += rows) | |
8742 { | |
8743 msg_col = col; /* make columns */ | |
8744 showoneopt(items[i], opt_flags); | |
8745 col += INC; | |
8746 } | |
8747 out_flush(); | |
8748 ui_breakcheck(); | |
8749 } | |
8750 } | |
8751 vim_free(items); | |
8752 } | |
8753 | |
8754 /* | |
8755 * Return TRUE if option "p" has its default value. | |
8756 */ | |
8757 static int | |
8758 optval_default(p, varp) | |
8759 struct vimoption *p; | |
8760 char_u *varp; | |
8761 { | |
8762 int dvi; | |
8763 | |
8764 if (varp == NULL) | |
8765 return TRUE; /* hidden option is always at default */ | |
8766 dvi = ((p->flags & P_VI_DEF) || p_cp) ? VI_DEFAULT : VIM_DEFAULT; | |
8767 if (p->flags & P_NUM) | |
840 | 8768 return (*(long *)varp == (long)(long_i)p->def_val[dvi]); |
7 | 8769 if (p->flags & P_BOOL) |
840 | 8770 /* the cast to long is required for Manx C, long_i is |
8771 * needed for MSVC */ | |
8772 return (*(int *)varp == (int)(long)(long_i)p->def_val[dvi]); | |
7 | 8773 /* P_STRING */ |
8774 return (STRCMP(*(char_u **)varp, p->def_val[dvi]) == 0); | |
8775 } | |
8776 | |
8777 /* | |
8778 * showoneopt: show the value of one option | |
8779 * must not be called with a hidden option! | |
8780 */ | |
8781 static void | |
8782 showoneopt(p, opt_flags) | |
8783 struct vimoption *p; | |
8784 int opt_flags; /* OPT_LOCAL or OPT_GLOBAL */ | |
8785 { | |
168 | 8786 char_u *varp; |
8787 int save_silent = silent_mode; | |
8788 | |
8789 silent_mode = FALSE; | |
8790 info_message = TRUE; /* use mch_msg(), not mch_errmsg() */ | |
7 | 8791 |
8792 varp = get_varp_scope(p, opt_flags); | |
8793 | |
8794 /* for 'modified' we also need to check if 'ff' or 'fenc' changed. */ | |
8795 if ((p->flags & P_BOOL) && ((int *)varp == &curbuf->b_changed | |
8796 ? !curbufIsChanged() : !*(int *)varp)) | |
8797 MSG_PUTS("no"); | |
8798 else if ((p->flags & P_BOOL) && *(int *)varp < 0) | |
8799 MSG_PUTS("--"); | |
8800 else | |
8801 MSG_PUTS(" "); | |
8802 MSG_PUTS(p->fullname); | |
8803 if (!(p->flags & P_BOOL)) | |
8804 { | |
8805 msg_putchar('='); | |
8806 /* put value string in NameBuff */ | |
8807 option_value2string(p, opt_flags); | |
8808 msg_outtrans(NameBuff); | |
8809 } | |
168 | 8810 |
8811 silent_mode = save_silent; | |
8812 info_message = FALSE; | |
7 | 8813 } |
8814 | |
8815 /* | |
8816 * Write modified options as ":set" commands to a file. | |
8817 * | |
8818 * There are three values for "opt_flags": | |
8819 * OPT_GLOBAL: Write global option values and fresh values of | |
8820 * buffer-local options (used for start of a session | |
8821 * file). | |
8822 * OPT_GLOBAL + OPT_LOCAL: Idem, add fresh values of window-local options for | |
8823 * curwin (used for a vimrc file). | |
8824 * OPT_LOCAL: Write buffer-local option values for curbuf, fresh | |
8825 * and local values for window-local options of | |
8826 * curwin. Local values are also written when at the | |
8827 * default value, because a modeline or autocommand | |
8828 * may have set them when doing ":edit file" and the | |
8829 * user has set them back at the default or fresh | |
8830 * value. | |
8831 * When "local_only" is TRUE, don't write fresh | |
8832 * values, only local values (for ":mkview"). | |
8833 * (fresh value = value used for a new buffer or window for a local option). | |
8834 * | |
8835 * Return FAIL on error, OK otherwise. | |
8836 */ | |
8837 int | |
8838 makeset(fd, opt_flags, local_only) | |
8839 FILE *fd; | |
8840 int opt_flags; | |
8841 int local_only; | |
8842 { | |
8843 struct vimoption *p; | |
8844 char_u *varp; /* currently used value */ | |
8845 char_u *varp_fresh; /* local value */ | |
8846 char_u *varp_local = NULL; /* fresh value */ | |
8847 char *cmd; | |
8848 int round; | |
1384 | 8849 int pri; |
7 | 8850 |
8851 /* | |
8852 * The options that don't have a default (terminal name, columns, lines) | |
8853 * are never written. Terminal options are also not written. | |
1384 | 8854 * Do the loop over "options[]" twice: once for options with the |
8855 * P_PRI_MKRC flag and once without. | |
7 | 8856 */ |
1384 | 8857 for (pri = 1; pri >= 0; --pri) |
8858 { | |
8859 for (p = &options[0]; !istermoption(p); p++) | |
8860 if (!(p->flags & P_NO_MKRC) | |
8861 && !istermoption(p) | |
8862 && ((pri == 1) == ((p->flags & P_PRI_MKRC) != 0))) | |
7 | 8863 { |
8864 /* skip global option when only doing locals */ | |
8865 if (p->indir == PV_NONE && !(opt_flags & OPT_GLOBAL)) | |
8866 continue; | |
8867 | |
8868 /* Do not store options like 'bufhidden' and 'syntax' in a vimrc | |
8869 * file, they are always buffer-specific. */ | |
8870 if ((opt_flags & OPT_GLOBAL) && (p->flags & P_NOGLOB)) | |
8871 continue; | |
8872 | |
8873 /* Global values are only written when not at the default value. */ | |
8874 varp = get_varp_scope(p, opt_flags); | |
8875 if ((opt_flags & OPT_GLOBAL) && optval_default(p, varp)) | |
8876 continue; | |
8877 | |
8878 round = 2; | |
8879 if (p->indir != PV_NONE) | |
8880 { | |
8881 if (p->var == VAR_WIN) | |
8882 { | |
8883 /* skip window-local option when only doing globals */ | |
8884 if (!(opt_flags & OPT_LOCAL)) | |
8885 continue; | |
8886 /* When fresh value of window-local option is not at the | |
8887 * default, need to write it too. */ | |
8888 if (!(opt_flags & OPT_GLOBAL) && !local_only) | |
8889 { | |
8890 varp_fresh = get_varp_scope(p, OPT_GLOBAL); | |
8891 if (!optval_default(p, varp_fresh)) | |
8892 { | |
8893 round = 1; | |
8894 varp_local = varp; | |
8895 varp = varp_fresh; | |
8896 } | |
8897 } | |
8898 } | |
8899 } | |
8900 | |
8901 /* Round 1: fresh value for window-local options. | |
8902 * Round 2: other values */ | |
8903 for ( ; round <= 2; varp = varp_local, ++round) | |
8904 { | |
8905 if (round == 1 || (opt_flags & OPT_GLOBAL)) | |
8906 cmd = "set"; | |
8907 else | |
8908 cmd = "setlocal"; | |
8909 | |
8910 if (p->flags & P_BOOL) | |
8911 { | |
8912 if (put_setbool(fd, cmd, p->fullname, *(int *)varp) == FAIL) | |
8913 return FAIL; | |
8914 } | |
8915 else if (p->flags & P_NUM) | |
8916 { | |
8917 if (put_setnum(fd, cmd, p->fullname, (long *)varp) == FAIL) | |
8918 return FAIL; | |
8919 } | |
8920 else /* P_STRING */ | |
8921 { | |
694 | 8922 #if defined(FEAT_SYN_HL) || defined(FEAT_AUTOCMD) |
8923 int do_endif = FALSE; | |
8924 | |
7 | 8925 /* Don't set 'syntax' and 'filetype' again if the value is |
8926 * already right, avoids reloading the syntax file. */ | |
694 | 8927 if ( |
8928 # if defined(FEAT_SYN_HL) | |
8929 p->indir == PV_SYN | |
8930 # if defined(FEAT_AUTOCMD) | |
8931 || | |
8932 # endif | |
8933 # endif | |
8934 # if defined(FEAT_AUTOCMD) | |
1683 | 8935 p->indir == PV_FT |
694 | 8936 # endif |
1683 | 8937 ) |
7 | 8938 { |
8939 if (fprintf(fd, "if &%s != '%s'", p->fullname, | |
8940 *(char_u **)(varp)) < 0 | |
8941 || put_eol(fd) < 0) | |
8942 return FAIL; | |
694 | 8943 do_endif = TRUE; |
7 | 8944 } |
694 | 8945 #endif |
7 | 8946 if (put_setstring(fd, cmd, p->fullname, (char_u **)varp, |
8947 (p->flags & P_EXPAND) != 0) == FAIL) | |
8948 return FAIL; | |
694 | 8949 #if defined(FEAT_SYN_HL) || defined(FEAT_AUTOCMD) |
8950 if (do_endif) | |
7 | 8951 { |
8952 if (put_line(fd, "endif") == FAIL) | |
8953 return FAIL; | |
8954 } | |
694 | 8955 #endif |
7 | 8956 } |
8957 } | |
8958 } | |
1384 | 8959 } |
7 | 8960 return OK; |
8961 } | |
8962 | |
8963 #if defined(FEAT_FOLDING) || defined(PROTO) | |
8964 /* | |
8965 * Generate set commands for the local fold options only. Used when | |
8966 * 'sessionoptions' or 'viewoptions' contains "folds" but not "options". | |
8967 */ | |
8968 int | |
8969 makefoldset(fd) | |
8970 FILE *fd; | |
8971 { | |
8972 if (put_setstring(fd, "setlocal", "fdm", &curwin->w_p_fdm, FALSE) == FAIL | |
8973 # ifdef FEAT_EVAL | |
8974 || put_setstring(fd, "setlocal", "fde", &curwin->w_p_fde, FALSE) | |
8975 == FAIL | |
8976 # endif | |
8977 || put_setstring(fd, "setlocal", "fmr", &curwin->w_p_fmr, FALSE) | |
8978 == FAIL | |
8979 || put_setstring(fd, "setlocal", "fdi", &curwin->w_p_fdi, FALSE) | |
8980 == FAIL | |
8981 || put_setnum(fd, "setlocal", "fdl", &curwin->w_p_fdl) == FAIL | |
8982 || put_setnum(fd, "setlocal", "fml", &curwin->w_p_fml) == FAIL | |
8983 || put_setnum(fd, "setlocal", "fdn", &curwin->w_p_fdn) == FAIL | |
8984 || put_setbool(fd, "setlocal", "fen", curwin->w_p_fen) == FAIL | |
8985 ) | |
8986 return FAIL; | |
8987 | |
8988 return OK; | |
8989 } | |
8990 #endif | |
8991 | |
8992 static int | |
8993 put_setstring(fd, cmd, name, valuep, expand) | |
8994 FILE *fd; | |
8995 char *cmd; | |
8996 char *name; | |
8997 char_u **valuep; | |
8998 int expand; | |
8999 { | |
9000 char_u *s; | |
9001 char_u buf[MAXPATHL]; | |
9002 | |
9003 if (fprintf(fd, "%s %s=", cmd, name) < 0) | |
9004 return FAIL; | |
9005 if (*valuep != NULL) | |
9006 { | |
9007 /* Output 'pastetoggle' as key names. For other | |
9008 * options some characters have to be escaped with | |
9009 * CTRL-V or backslash */ | |
9010 if (valuep == &p_pt) | |
9011 { | |
9012 s = *valuep; | |
9013 while (*s != NUL) | |
1601 | 9014 if (put_escstr(fd, str2special(&s, FALSE), 2) == FAIL) |
7 | 9015 return FAIL; |
9016 } | |
9017 else if (expand) | |
9018 { | |
9019 home_replace(NULL, *valuep, buf, MAXPATHL, FALSE); | |
9020 if (put_escstr(fd, buf, 2) == FAIL) | |
9021 return FAIL; | |
9022 } | |
9023 else if (put_escstr(fd, *valuep, 2) == FAIL) | |
9024 return FAIL; | |
9025 } | |
9026 if (put_eol(fd) < 0) | |
9027 return FAIL; | |
9028 return OK; | |
9029 } | |
9030 | |
9031 static int | |
9032 put_setnum(fd, cmd, name, valuep) | |
9033 FILE *fd; | |
9034 char *cmd; | |
9035 char *name; | |
9036 long *valuep; | |
9037 { | |
9038 long wc; | |
9039 | |
9040 if (fprintf(fd, "%s %s=", cmd, name) < 0) | |
9041 return FAIL; | |
9042 if (wc_use_keyname((char_u *)valuep, &wc)) | |
9043 { | |
9044 /* print 'wildchar' and 'wildcharm' as a key name */ | |
9045 if (fputs((char *)get_special_key_name((int)wc, 0), fd) < 0) | |
9046 return FAIL; | |
9047 } | |
9048 else if (fprintf(fd, "%ld", *valuep) < 0) | |
9049 return FAIL; | |
9050 if (put_eol(fd) < 0) | |
9051 return FAIL; | |
9052 return OK; | |
9053 } | |
9054 | |
9055 static int | |
9056 put_setbool(fd, cmd, name, value) | |
9057 FILE *fd; | |
9058 char *cmd; | |
9059 char *name; | |
9060 int value; | |
9061 { | |
1416 | 9062 if (value < 0) /* global/local option using global value */ |
9063 return OK; | |
7 | 9064 if (fprintf(fd, "%s %s%s", cmd, value ? "" : "no", name) < 0 |
9065 || put_eol(fd) < 0) | |
9066 return FAIL; | |
9067 return OK; | |
9068 } | |
9069 | |
9070 /* | |
9071 * Clear all the terminal options. | |
9072 * If the option has been allocated, free the memory. | |
9073 * Terminal options are never hidden or indirect. | |
9074 */ | |
9075 void | |
9076 clear_termoptions() | |
9077 { | |
9078 /* | |
9079 * Reset a few things before clearing the old options. This may cause | |
9080 * outputting a few things that the terminal doesn't understand, but the | |
9081 * screen will be cleared later, so this is OK. | |
9082 */ | |
9083 #ifdef FEAT_MOUSE_TTY | |
9084 mch_setmouse(FALSE); /* switch mouse off */ | |
9085 #endif | |
9086 #ifdef FEAT_TITLE | |
9087 mch_restore_title(3); /* restore window titles */ | |
9088 #endif | |
9089 #if defined(FEAT_XCLIPBOARD) && defined(FEAT_GUI) | |
9090 /* When starting the GUI close the display opened for the clipboard. | |
9091 * After restoring the title, because that will need the display. */ | |
9092 if (gui.starting) | |
9093 clear_xterm_clip(); | |
9094 #endif | |
9095 #ifdef WIN3264 | |
9096 /* | |
9097 * Check if this is allowed now. | |
9098 */ | |
9099 if (can_end_termcap_mode(FALSE) == TRUE) | |
9100 #endif | |
9101 stoptermcap(); /* stop termcap mode */ | |
9102 | |
359 | 9103 free_termoptions(); |
9104 } | |
9105 | |
9106 void | |
9107 free_termoptions() | |
9108 { | |
9109 struct vimoption *p; | |
9110 | |
7 | 9111 for (p = &options[0]; p->fullname != NULL; p++) |
9112 if (istermoption(p)) | |
9113 { | |
9114 if (p->flags & P_ALLOCED) | |
9115 free_string_option(*(char_u **)(p->var)); | |
9116 if (p->flags & P_DEF_ALLOCED) | |
9117 free_string_option(p->def_val[VI_DEFAULT]); | |
9118 *(char_u **)(p->var) = empty_option; | |
9119 p->def_val[VI_DEFAULT] = empty_option; | |
9120 p->flags &= ~(P_ALLOCED|P_DEF_ALLOCED); | |
9121 } | |
9122 clear_termcodes(); | |
9123 } | |
9124 | |
9125 /* | |
1941 | 9126 * Free the string for one term option, if it was allocated. |
9127 * Set the string to empty_option and clear allocated flag. | |
9128 * "var" points to the option value. | |
9129 */ | |
9130 void | |
9131 free_one_termoption(var) | |
9132 char_u *var; | |
9133 { | |
9134 struct vimoption *p; | |
9135 | |
9136 for (p = &options[0]; p->fullname != NULL; p++) | |
9137 if (p->var == var) | |
9138 { | |
9139 if (p->flags & P_ALLOCED) | |
9140 free_string_option(*(char_u **)(p->var)); | |
9141 *(char_u **)(p->var) = empty_option; | |
9142 p->flags &= ~P_ALLOCED; | |
9143 break; | |
9144 } | |
9145 } | |
9146 | |
9147 /* | |
7 | 9148 * Set the terminal option defaults to the current value. |
9149 * Used after setting the terminal name. | |
9150 */ | |
9151 void | |
9152 set_term_defaults() | |
9153 { | |
9154 struct vimoption *p; | |
9155 | |
9156 for (p = &options[0]; p->fullname != NULL; p++) | |
9157 { | |
9158 if (istermoption(p) && p->def_val[VI_DEFAULT] != *(char_u **)(p->var)) | |
9159 { | |
9160 if (p->flags & P_DEF_ALLOCED) | |
9161 { | |
9162 free_string_option(p->def_val[VI_DEFAULT]); | |
9163 p->flags &= ~P_DEF_ALLOCED; | |
9164 } | |
9165 p->def_val[VI_DEFAULT] = *(char_u **)(p->var); | |
9166 if (p->flags & P_ALLOCED) | |
9167 { | |
9168 p->flags |= P_DEF_ALLOCED; | |
9169 p->flags &= ~P_ALLOCED; /* don't free the value now */ | |
9170 } | |
9171 } | |
9172 } | |
9173 } | |
9174 | |
9175 /* | |
9176 * return TRUE if 'p' starts with 't_' | |
9177 */ | |
9178 static int | |
9179 istermoption(p) | |
9180 struct vimoption *p; | |
9181 { | |
9182 return (p->fullname[0] == 't' && p->fullname[1] == '_'); | |
9183 } | |
9184 | |
9185 /* | |
9186 * Compute columns for ruler and shown command. 'sc_col' is also used to | |
9187 * decide what the maximum length of a message on the status line can be. | |
9188 * If there is a status line for the last window, 'sc_col' is independent | |
9189 * of 'ru_col'. | |
9190 */ | |
9191 | |
9192 #define COL_RULER 17 /* columns needed by standard ruler */ | |
9193 | |
9194 void | |
9195 comp_col() | |
9196 { | |
9197 #if defined(FEAT_CMDL_INFO) && defined(FEAT_WINDOWS) | |
9198 int last_has_status = (p_ls == 2 || (p_ls == 1 && firstwin != lastwin)); | |
9199 | |
9200 sc_col = 0; | |
9201 ru_col = 0; | |
9202 if (p_ru) | |
9203 { | |
9204 #ifdef FEAT_STL_OPT | |
9205 ru_col = (ru_wid ? ru_wid : COL_RULER) + 1; | |
9206 #else | |
9207 ru_col = COL_RULER + 1; | |
9208 #endif | |
9209 /* no last status line, adjust sc_col */ | |
9210 if (!last_has_status) | |
9211 sc_col = ru_col; | |
9212 } | |
9213 if (p_sc) | |
9214 { | |
9215 sc_col += SHOWCMD_COLS; | |
9216 if (!p_ru || last_has_status) /* no need for separating space */ | |
9217 ++sc_col; | |
9218 } | |
9219 sc_col = Columns - sc_col; | |
9220 ru_col = Columns - ru_col; | |
9221 if (sc_col <= 0) /* screen too narrow, will become a mess */ | |
9222 sc_col = 1; | |
9223 if (ru_col <= 0) | |
9224 ru_col = 1; | |
9225 #else | |
9226 sc_col = Columns; | |
9227 ru_col = Columns; | |
9228 #endif | |
9229 } | |
9230 | |
9231 /* | |
9232 * Get pointer to option variable, depending on local or global scope. | |
9233 */ | |
9234 static char_u * | |
9235 get_varp_scope(p, opt_flags) | |
9236 struct vimoption *p; | |
9237 int opt_flags; | |
9238 { | |
9239 if ((opt_flags & OPT_GLOBAL) && p->indir != PV_NONE) | |
9240 { | |
9241 if (p->var == VAR_WIN) | |
9242 return (char_u *)GLOBAL_WO(get_varp(p)); | |
9243 return p->var; | |
9244 } | |
692 | 9245 if ((opt_flags & OPT_LOCAL) && ((int)p->indir & PV_BOTH)) |
7 | 9246 { |
9247 switch ((int)p->indir) | |
9248 { | |
9249 #ifdef FEAT_QUICKFIX | |
694 | 9250 case PV_EFM: return (char_u *)&(curbuf->b_p_efm); |
9251 case PV_GP: return (char_u *)&(curbuf->b_p_gp); | |
9252 case PV_MP: return (char_u *)&(curbuf->b_p_mp); | |
9253 #endif | |
9254 case PV_EP: return (char_u *)&(curbuf->b_p_ep); | |
9255 case PV_KP: return (char_u *)&(curbuf->b_p_kp); | |
9256 case PV_PATH: return (char_u *)&(curbuf->b_p_path); | |
692 | 9257 case PV_AR: return (char_u *)&(curbuf->b_p_ar); |
694 | 9258 case PV_TAGS: return (char_u *)&(curbuf->b_p_tags); |
7 | 9259 #ifdef FEAT_FIND_ID |
694 | 9260 case PV_DEF: return (char_u *)&(curbuf->b_p_def); |
9261 case PV_INC: return (char_u *)&(curbuf->b_p_inc); | |
7 | 9262 #endif |
9263 #ifdef FEAT_INS_EXPAND | |
694 | 9264 case PV_DICT: return (char_u *)&(curbuf->b_p_dict); |
9265 case PV_TSR: return (char_u *)&(curbuf->b_p_tsr); | |
7 | 9266 #endif |
790 | 9267 #if defined(FEAT_BEVAL) && defined(FEAT_EVAL) |
9268 case PV_BEXPR: return (char_u *)&(curbuf->b_p_bexpr); | |
9269 #endif | |
40 | 9270 #ifdef FEAT_STL_OPT |
694 | 9271 case PV_STL: return (char_u *)&(curwin->w_p_stl); |
40 | 9272 #endif |
7 | 9273 } |
9274 return NULL; /* "cannot happen" */ | |
9275 } | |
9276 return get_varp(p); | |
9277 } | |
9278 | |
9279 /* | |
9280 * Get pointer to option variable. | |
9281 */ | |
9282 static char_u * | |
9283 get_varp(p) | |
9284 struct vimoption *p; | |
9285 { | |
9286 /* hidden option, always return NULL */ | |
9287 if (p->var == NULL) | |
9288 return NULL; | |
9289 | |
9290 switch ((int)p->indir) | |
9291 { | |
9292 case PV_NONE: return p->var; | |
9293 | |
9294 /* global option with local value: use local value if it's been set */ | |
694 | 9295 case PV_EP: return *curbuf->b_p_ep != NUL |
7 | 9296 ? (char_u *)&curbuf->b_p_ep : p->var; |
694 | 9297 case PV_KP: return *curbuf->b_p_kp != NUL |
7 | 9298 ? (char_u *)&curbuf->b_p_kp : p->var; |
694 | 9299 case PV_PATH: return *curbuf->b_p_path != NUL |
7 | 9300 ? (char_u *)&(curbuf->b_p_path) : p->var; |
692 | 9301 case PV_AR: return curbuf->b_p_ar >= 0 |
7 | 9302 ? (char_u *)&(curbuf->b_p_ar) : p->var; |
694 | 9303 case PV_TAGS: return *curbuf->b_p_tags != NUL |
7 | 9304 ? (char_u *)&(curbuf->b_p_tags) : p->var; |
9305 #ifdef FEAT_FIND_ID | |
694 | 9306 case PV_DEF: return *curbuf->b_p_def != NUL |
7 | 9307 ? (char_u *)&(curbuf->b_p_def) : p->var; |
694 | 9308 case PV_INC: return *curbuf->b_p_inc != NUL |
7 | 9309 ? (char_u *)&(curbuf->b_p_inc) : p->var; |
9310 #endif | |
9311 #ifdef FEAT_INS_EXPAND | |
694 | 9312 case PV_DICT: return *curbuf->b_p_dict != NUL |
7 | 9313 ? (char_u *)&(curbuf->b_p_dict) : p->var; |
694 | 9314 case PV_TSR: return *curbuf->b_p_tsr != NUL |
7 | 9315 ? (char_u *)&(curbuf->b_p_tsr) : p->var; |
9316 #endif | |
9317 #ifdef FEAT_QUICKFIX | |
694 | 9318 case PV_EFM: return *curbuf->b_p_efm != NUL |
9319 ? (char_u *)&(curbuf->b_p_efm) : p->var; | |
9320 case PV_GP: return *curbuf->b_p_gp != NUL | |
7 | 9321 ? (char_u *)&(curbuf->b_p_gp) : p->var; |
694 | 9322 case PV_MP: return *curbuf->b_p_mp != NUL |
7 | 9323 ? (char_u *)&(curbuf->b_p_mp) : p->var; |
9324 #endif | |
790 | 9325 #if defined(FEAT_BEVAL) && defined(FEAT_EVAL) |
9326 case PV_BEXPR: return *curbuf->b_p_bexpr != NUL | |
9327 ? (char_u *)&(curbuf->b_p_bexpr) : p->var; | |
9328 #endif | |
40 | 9329 #ifdef FEAT_STL_OPT |
694 | 9330 case PV_STL: return *curwin->w_p_stl != NUL |
40 | 9331 ? (char_u *)&(curwin->w_p_stl) : p->var; |
9332 #endif | |
7 | 9333 |
9334 #ifdef FEAT_ARABIC | |
9335 case PV_ARAB: return (char_u *)&(curwin->w_p_arab); | |
9336 #endif | |
9337 case PV_LIST: return (char_u *)&(curwin->w_p_list); | |
744 | 9338 #ifdef FEAT_SPELL |
9339 case PV_SPELL: return (char_u *)&(curwin->w_p_spell); | |
9340 #endif | |
221 | 9341 #ifdef FEAT_SYN_HL |
744 | 9342 case PV_CUC: return (char_u *)&(curwin->w_p_cuc); |
9343 case PV_CUL: return (char_u *)&(curwin->w_p_cul); | |
221 | 9344 #endif |
7 | 9345 #ifdef FEAT_DIFF |
9346 case PV_DIFF: return (char_u *)&(curwin->w_p_diff); | |
9347 #endif | |
9348 #ifdef FEAT_FOLDING | |
9349 case PV_FDC: return (char_u *)&(curwin->w_p_fdc); | |
9350 case PV_FEN: return (char_u *)&(curwin->w_p_fen); | |
9351 case PV_FDI: return (char_u *)&(curwin->w_p_fdi); | |
9352 case PV_FDL: return (char_u *)&(curwin->w_p_fdl); | |
9353 case PV_FDM: return (char_u *)&(curwin->w_p_fdm); | |
9354 case PV_FML: return (char_u *)&(curwin->w_p_fml); | |
9355 case PV_FDN: return (char_u *)&(curwin->w_p_fdn); | |
9356 # ifdef FEAT_EVAL | |
9357 case PV_FDE: return (char_u *)&(curwin->w_p_fde); | |
9358 case PV_FDT: return (char_u *)&(curwin->w_p_fdt); | |
9359 # endif | |
9360 case PV_FMR: return (char_u *)&(curwin->w_p_fmr); | |
9361 #endif | |
9362 case PV_NU: return (char_u *)&(curwin->w_p_nu); | |
2178
c6f1aa1e9f32
Add 'relativenumber' patch from Markus Heidelberg.
Bram Moolenaar <bram@vim.org>
parents:
2144
diff
changeset
|
9363 case PV_RNU: return (char_u *)&(curwin->w_p_rnu); |
13 | 9364 #ifdef FEAT_LINEBREAK |
9365 case PV_NUW: return (char_u *)&(curwin->w_p_nuw); | |
9366 #endif | |
694 | 9367 #ifdef FEAT_WINDOWS |
7 | 9368 case PV_WFH: return (char_u *)&(curwin->w_p_wfh); |
9369 #endif | |
782 | 9370 #ifdef FEAT_VERTSPLIT |
9371 case PV_WFW: return (char_u *)&(curwin->w_p_wfw); | |
9372 #endif | |
7 | 9373 #if defined(FEAT_WINDOWS) && defined(FEAT_QUICKFIX) |
9374 case PV_PVW: return (char_u *)&(curwin->w_p_pvw); | |
9375 #endif | |
9376 #ifdef FEAT_RIGHTLEFT | |
9377 case PV_RL: return (char_u *)&(curwin->w_p_rl); | |
9378 case PV_RLC: return (char_u *)&(curwin->w_p_rlc); | |
9379 #endif | |
9380 case PV_SCROLL: return (char_u *)&(curwin->w_p_scr); | |
9381 case PV_WRAP: return (char_u *)&(curwin->w_p_wrap); | |
9382 #ifdef FEAT_LINEBREAK | |
9383 case PV_LBR: return (char_u *)&(curwin->w_p_lbr); | |
9384 #endif | |
9385 #ifdef FEAT_SCROLLBIND | |
9386 case PV_SCBIND: return (char_u *)&(curwin->w_p_scb); | |
9387 #endif | |
2250
1bac28a53fae
Add the conceal patch from Vince Negri.
Bram Moolenaar <bram@vim.org>
parents:
2248
diff
changeset
|
9388 #ifdef FEAT_CURSORBIND |
1bac28a53fae
Add the conceal patch from Vince Negri.
Bram Moolenaar <bram@vim.org>
parents:
2248
diff
changeset
|
9389 case PV_CRBIND: return (char_u *)&(curwin->w_p_crb); |
1bac28a53fae
Add the conceal patch from Vince Negri.
Bram Moolenaar <bram@vim.org>
parents:
2248
diff
changeset
|
9390 #endif |
1bac28a53fae
Add the conceal patch from Vince Negri.
Bram Moolenaar <bram@vim.org>
parents:
2248
diff
changeset
|
9391 #ifdef FEAT_CONCEAL |
1bac28a53fae
Add the conceal patch from Vince Negri.
Bram Moolenaar <bram@vim.org>
parents:
2248
diff
changeset
|
9392 case PV_CONCEAL: return (char_u *)&(curwin->w_p_conceal); |
1bac28a53fae
Add the conceal patch from Vince Negri.
Bram Moolenaar <bram@vim.org>
parents:
2248
diff
changeset
|
9393 #endif |
7 | 9394 |
9395 case PV_AI: return (char_u *)&(curbuf->b_p_ai); | |
9396 case PV_BIN: return (char_u *)&(curbuf->b_p_bin); | |
9397 #ifdef FEAT_MBYTE | |
9398 case PV_BOMB: return (char_u *)&(curbuf->b_p_bomb); | |
9399 #endif | |
9400 #if defined(FEAT_QUICKFIX) | |
9401 case PV_BH: return (char_u *)&(curbuf->b_p_bh); | |
9402 case PV_BT: return (char_u *)&(curbuf->b_p_bt); | |
9403 #endif | |
9404 case PV_BL: return (char_u *)&(curbuf->b_p_bl); | |
9405 case PV_CI: return (char_u *)&(curbuf->b_p_ci); | |
9406 #ifdef FEAT_CINDENT | |
9407 case PV_CIN: return (char_u *)&(curbuf->b_p_cin); | |
9408 case PV_CINK: return (char_u *)&(curbuf->b_p_cink); | |
9409 case PV_CINO: return (char_u *)&(curbuf->b_p_cino); | |
9410 #endif | |
2184
5028c4d6d825
Fixed encryption big/little endian test.
Bram Moolenaar <bram@vim.org>
parents:
2180
diff
changeset
|
9411 #ifdef FEAT_CRYPT |
2180
f60a0c9cbe6c
Add the blowfish encryption patch from Mohsin Ahmed. Needs more work.
Bram Moolenaar <bram@vim.org>
parents:
2178
diff
changeset
|
9412 case PV_CM: return (char_u *)&(curbuf->b_p_cm); |
2184
5028c4d6d825
Fixed encryption big/little endian test.
Bram Moolenaar <bram@vim.org>
parents:
2180
diff
changeset
|
9413 #endif |
7 | 9414 #if defined(FEAT_SMARTINDENT) || defined(FEAT_CINDENT) |
9415 case PV_CINW: return (char_u *)&(curbuf->b_p_cinw); | |
9416 #endif | |
9417 #ifdef FEAT_COMMENTS | |
9418 case PV_COM: return (char_u *)&(curbuf->b_p_com); | |
9419 #endif | |
9420 #ifdef FEAT_FOLDING | |
9421 case PV_CMS: return (char_u *)&(curbuf->b_p_cms); | |
9422 #endif | |
9423 #ifdef FEAT_INS_EXPAND | |
9424 case PV_CPT: return (char_u *)&(curbuf->b_p_cpt); | |
9425 #endif | |
12 | 9426 #ifdef FEAT_COMPL_FUNC |
9427 case PV_CFU: return (char_u *)&(curbuf->b_p_cfu); | |
502 | 9428 case PV_OFU: return (char_u *)&(curbuf->b_p_ofu); |
12 | 9429 #endif |
7 | 9430 case PV_EOL: return (char_u *)&(curbuf->b_p_eol); |
9431 case PV_ET: return (char_u *)&(curbuf->b_p_et); | |
9432 #ifdef FEAT_MBYTE | |
9433 case PV_FENC: return (char_u *)&(curbuf->b_p_fenc); | |
9434 #endif | |
9435 case PV_FF: return (char_u *)&(curbuf->b_p_ff); | |
9436 #ifdef FEAT_AUTOCMD | |
9437 case PV_FT: return (char_u *)&(curbuf->b_p_ft); | |
9438 #endif | |
9439 case PV_FO: return (char_u *)&(curbuf->b_p_fo); | |
41 | 9440 case PV_FLP: return (char_u *)&(curbuf->b_p_flp); |
7 | 9441 case PV_IMI: return (char_u *)&(curbuf->b_p_iminsert); |
9442 case PV_IMS: return (char_u *)&(curbuf->b_p_imsearch); | |
9443 case PV_INF: return (char_u *)&(curbuf->b_p_inf); | |
9444 case PV_ISK: return (char_u *)&(curbuf->b_p_isk); | |
9445 #ifdef FEAT_FIND_ID | |
9446 # ifdef FEAT_EVAL | |
9447 case PV_INEX: return (char_u *)&(curbuf->b_p_inex); | |
9448 # endif | |
9449 #endif | |
9450 #if defined(FEAT_CINDENT) && defined(FEAT_EVAL) | |
9451 case PV_INDE: return (char_u *)&(curbuf->b_p_inde); | |
9452 case PV_INDK: return (char_u *)&(curbuf->b_p_indk); | |
9453 #endif | |
694 | 9454 #ifdef FEAT_EVAL |
667 | 9455 case PV_FEX: return (char_u *)&(curbuf->b_p_fex); |
9456 #endif | |
7 | 9457 #ifdef FEAT_CRYPT |
9458 case PV_KEY: return (char_u *)&(curbuf->b_p_key); | |
9459 #endif | |
9460 #ifdef FEAT_LISP | |
9461 case PV_LISP: return (char_u *)&(curbuf->b_p_lisp); | |
9462 #endif | |
9463 case PV_ML: return (char_u *)&(curbuf->b_p_ml); | |
9464 case PV_MPS: return (char_u *)&(curbuf->b_p_mps); | |
9465 case PV_MA: return (char_u *)&(curbuf->b_p_ma); | |
9466 case PV_MOD: return (char_u *)&(curbuf->b_changed); | |
9467 case PV_NF: return (char_u *)&(curbuf->b_p_nf); | |
9468 #ifdef FEAT_OSFILETYPE | |
9469 case PV_OFT: return (char_u *)&(curbuf->b_p_oft); | |
9470 #endif | |
9471 case PV_PI: return (char_u *)&(curbuf->b_p_pi); | |
12 | 9472 #ifdef FEAT_TEXTOBJ |
9473 case PV_QE: return (char_u *)&(curbuf->b_p_qe); | |
9474 #endif | |
7 | 9475 case PV_RO: return (char_u *)&(curbuf->b_p_ro); |
9476 #ifdef FEAT_SMARTINDENT | |
9477 case PV_SI: return (char_u *)&(curbuf->b_p_si); | |
9478 #endif | |
9479 #ifndef SHORT_FNAME | |
9480 case PV_SN: return (char_u *)&(curbuf->b_p_sn); | |
9481 #endif | |
9482 case PV_STS: return (char_u *)&(curbuf->b_p_sts); | |
9483 #ifdef FEAT_SEARCHPATH | |
9484 case PV_SUA: return (char_u *)&(curbuf->b_p_sua); | |
9485 #endif | |
9486 case PV_SWF: return (char_u *)&(curbuf->b_p_swf); | |
9487 #ifdef FEAT_SYN_HL | |
410 | 9488 case PV_SMC: return (char_u *)&(curbuf->b_p_smc); |
744 | 9489 case PV_SYN: return (char_u *)&(curbuf->b_p_syn); |
9490 #endif | |
9491 #ifdef FEAT_SPELL | |
2250
1bac28a53fae
Add the conceal patch from Vince Negri.
Bram Moolenaar <bram@vim.org>
parents:
2248
diff
changeset
|
9492 case PV_SPC: return (char_u *)&(curwin->w_s->b_p_spc); |
1bac28a53fae
Add the conceal patch from Vince Negri.
Bram Moolenaar <bram@vim.org>
parents:
2248
diff
changeset
|
9493 case PV_SPF: return (char_u *)&(curwin->w_s->b_p_spf); |
1bac28a53fae
Add the conceal patch from Vince Negri.
Bram Moolenaar <bram@vim.org>
parents:
2248
diff
changeset
|
9494 case PV_SPL: return (char_u *)&(curwin->w_s->b_p_spl); |
7 | 9495 #endif |
9496 case PV_SW: return (char_u *)&(curbuf->b_p_sw); | |
9497 case PV_TS: return (char_u *)&(curbuf->b_p_ts); | |
9498 case PV_TW: return (char_u *)&(curbuf->b_p_tw); | |
9499 case PV_TX: return (char_u *)&(curbuf->b_p_tx); | |
2214
f8222d1f9a73
Included patch for persistent undo. Lots of changes and added test.
Bram Moolenaar <bram@vim.org>
parents:
2184
diff
changeset
|
9500 #ifdef FEAT_PERSISTENT_UNDO |
f8222d1f9a73
Included patch for persistent undo. Lots of changes and added test.
Bram Moolenaar <bram@vim.org>
parents:
2184
diff
changeset
|
9501 case PV_UDF: return (char_u *)&(curbuf->b_p_udf); |
f8222d1f9a73
Included patch for persistent undo. Lots of changes and added test.
Bram Moolenaar <bram@vim.org>
parents:
2184
diff
changeset
|
9502 #endif |
7 | 9503 case PV_WM: return (char_u *)&(curbuf->b_p_wm); |
9504 #ifdef FEAT_KEYMAP | |
9505 case PV_KMAP: return (char_u *)&(curbuf->b_p_keymap); | |
9506 #endif | |
9507 default: EMSG(_("E356: get_varp ERROR")); | |
9508 } | |
9509 /* always return a valid pointer to avoid a crash! */ | |
9510 return (char_u *)&(curbuf->b_p_wm); | |
9511 } | |
9512 | |
9513 /* | |
9514 * Get the value of 'equalprg', either the buffer-local one or the global one. | |
9515 */ | |
9516 char_u * | |
9517 get_equalprg() | |
9518 { | |
9519 if (*curbuf->b_p_ep == NUL) | |
9520 return p_ep; | |
9521 return curbuf->b_p_ep; | |
9522 } | |
9523 | |
9524 #if defined(FEAT_WINDOWS) || defined(PROTO) | |
9525 /* | |
9526 * Copy options from one window to another. | |
9527 * Used when splitting a window. | |
9528 */ | |
9529 void | |
9530 win_copy_options(wp_from, wp_to) | |
9531 win_T *wp_from; | |
9532 win_T *wp_to; | |
9533 { | |
9534 copy_winopt(&wp_from->w_onebuf_opt, &wp_to->w_onebuf_opt); | |
9535 copy_winopt(&wp_from->w_allbuf_opt, &wp_to->w_allbuf_opt); | |
9536 # ifdef FEAT_RIGHTLEFT | |
9537 # ifdef FEAT_FKMAP | |
9538 /* Is this right? */ | |
9539 wp_to->w_farsi = wp_from->w_farsi; | |
9540 # endif | |
9541 # endif | |
9542 } | |
9543 #endif | |
9544 | |
9545 /* | |
9546 * Copy the options from one winopt_T to another. | |
9547 * Doesn't free the old option values in "to", use clear_winopt() for that. | |
9548 * The 'scroll' option is not copied, because it depends on the window height. | |
9549 * The 'previewwindow' option is reset, there can be only one preview window. | |
9550 */ | |
9551 void | |
9552 copy_winopt(from, to) | |
9553 winopt_T *from; | |
9554 winopt_T *to; | |
9555 { | |
9556 #ifdef FEAT_ARABIC | |
9557 to->wo_arab = from->wo_arab; | |
9558 #endif | |
9559 to->wo_list = from->wo_list; | |
9560 to->wo_nu = from->wo_nu; | |
2178
c6f1aa1e9f32
Add 'relativenumber' patch from Markus Heidelberg.
Bram Moolenaar <bram@vim.org>
parents:
2144
diff
changeset
|
9561 to->wo_rnu = from->wo_rnu; |
13 | 9562 #ifdef FEAT_LINEBREAK |
9563 to->wo_nuw = from->wo_nuw; | |
9564 #endif | |
7 | 9565 #ifdef FEAT_RIGHTLEFT |
9566 to->wo_rl = from->wo_rl; | |
9567 to->wo_rlc = vim_strsave(from->wo_rlc); | |
9568 #endif | |
40 | 9569 #ifdef FEAT_STL_OPT |
9570 to->wo_stl = vim_strsave(from->wo_stl); | |
9571 #endif | |
7 | 9572 to->wo_wrap = from->wo_wrap; |
9573 #ifdef FEAT_LINEBREAK | |
9574 to->wo_lbr = from->wo_lbr; | |
9575 #endif | |
9576 #ifdef FEAT_SCROLLBIND | |
9577 to->wo_scb = from->wo_scb; | |
9578 #endif | |
744 | 9579 #ifdef FEAT_SPELL |
9580 to->wo_spell = from->wo_spell; | |
9581 #endif | |
221 | 9582 #ifdef FEAT_SYN_HL |
744 | 9583 to->wo_cuc = from->wo_cuc; |
9584 to->wo_cul = from->wo_cul; | |
221 | 9585 #endif |
7 | 9586 #ifdef FEAT_DIFF |
9587 to->wo_diff = from->wo_diff; | |
9588 #endif | |
9589 #ifdef FEAT_FOLDING | |
9590 to->wo_fdc = from->wo_fdc; | |
9591 to->wo_fen = from->wo_fen; | |
9592 to->wo_fdi = vim_strsave(from->wo_fdi); | |
9593 to->wo_fml = from->wo_fml; | |
9594 to->wo_fdl = from->wo_fdl; | |
9595 to->wo_fdm = vim_strsave(from->wo_fdm); | |
9596 to->wo_fdn = from->wo_fdn; | |
9597 # ifdef FEAT_EVAL | |
9598 to->wo_fde = vim_strsave(from->wo_fde); | |
9599 to->wo_fdt = vim_strsave(from->wo_fdt); | |
9600 # endif | |
9601 to->wo_fmr = vim_strsave(from->wo_fmr); | |
9602 #endif | |
9603 check_winopt(to); /* don't want NULL pointers */ | |
9604 } | |
9605 | |
9606 /* | |
9607 * Check string options in a window for a NULL value. | |
9608 */ | |
9609 void | |
9610 check_win_options(win) | |
9611 win_T *win; | |
9612 { | |
9613 check_winopt(&win->w_onebuf_opt); | |
9614 check_winopt(&win->w_allbuf_opt); | |
9615 } | |
9616 | |
9617 /* | |
9618 * Check for NULL pointers in a winopt_T and replace them with empty_option. | |
9619 */ | |
9620 void | |
9621 check_winopt(wop) | |
1877 | 9622 winopt_T *wop UNUSED; |
7 | 9623 { |
9624 #ifdef FEAT_FOLDING | |
9625 check_string_option(&wop->wo_fdi); | |
9626 check_string_option(&wop->wo_fdm); | |
9627 # ifdef FEAT_EVAL | |
9628 check_string_option(&wop->wo_fde); | |
9629 check_string_option(&wop->wo_fdt); | |
9630 # endif | |
9631 check_string_option(&wop->wo_fmr); | |
9632 #endif | |
9633 #ifdef FEAT_RIGHTLEFT | |
9634 check_string_option(&wop->wo_rlc); | |
9635 #endif | |
40 | 9636 #ifdef FEAT_STL_OPT |
9637 check_string_option(&wop->wo_stl); | |
9638 #endif | |
7 | 9639 } |
9640 | |
9641 /* | |
9642 * Free the allocated memory inside a winopt_T. | |
9643 */ | |
9644 void | |
9645 clear_winopt(wop) | |
1877 | 9646 winopt_T *wop UNUSED; |
7 | 9647 { |
9648 #ifdef FEAT_FOLDING | |
9649 clear_string_option(&wop->wo_fdi); | |
9650 clear_string_option(&wop->wo_fdm); | |
9651 # ifdef FEAT_EVAL | |
9652 clear_string_option(&wop->wo_fde); | |
9653 clear_string_option(&wop->wo_fdt); | |
9654 # endif | |
9655 clear_string_option(&wop->wo_fmr); | |
9656 #endif | |
9657 #ifdef FEAT_RIGHTLEFT | |
9658 clear_string_option(&wop->wo_rlc); | |
9659 #endif | |
40 | 9660 #ifdef FEAT_STL_OPT |
9661 clear_string_option(&wop->wo_stl); | |
9662 #endif | |
7 | 9663 } |
9664 | |
9665 /* | |
9666 * Copy global option values to local options for one buffer. | |
9667 * Used when creating a new buffer and sometimes when entering a buffer. | |
9668 * flags: | |
9669 * BCO_ENTER We will enter the buf buffer. | |
9670 * BCO_ALWAYS Always copy the options, but only set b_p_initialized when | |
9671 * appropriate. | |
9672 * BCO_NOHELP Don't copy the values to a help buffer. | |
9673 */ | |
9674 void | |
9675 buf_copy_options(buf, flags) | |
9676 buf_T *buf; | |
9677 int flags; | |
9678 { | |
9679 int should_copy = TRUE; | |
9680 char_u *save_p_isk = NULL; /* init for GCC */ | |
9681 int dont_do_help; | |
9682 int did_isk = FALSE; | |
9683 | |
9684 /* | |
9685 * Don't do anything of the buffer is invalid. | |
9686 */ | |
9687 if (buf == NULL || !buf_valid(buf)) | |
9688 return; | |
9689 | |
9690 /* | |
9691 * Skip this when the option defaults have not been set yet. Happens when | |
9692 * main() allocates the first buffer. | |
9693 */ | |
9694 if (p_cpo != NULL) | |
9695 { | |
9696 /* | |
9697 * Always copy when entering and 'cpo' contains 'S'. | |
9698 * Don't copy when already initialized. | |
9699 * Don't copy when 'cpo' contains 's' and not entering. | |
9700 * 'S' BCO_ENTER initialized 's' should_copy | |
9701 * yes yes X X TRUE | |
9702 * yes no yes X FALSE | |
9703 * no X yes X FALSE | |
9704 * X no no yes FALSE | |
9705 * X no no no TRUE | |
9706 * no yes no X TRUE | |
9707 */ | |
9708 if ((vim_strchr(p_cpo, CPO_BUFOPTGLOB) == NULL || !(flags & BCO_ENTER)) | |
9709 && (buf->b_p_initialized | |
9710 || (!(flags & BCO_ENTER) | |
9711 && vim_strchr(p_cpo, CPO_BUFOPT) != NULL))) | |
9712 should_copy = FALSE; | |
9713 | |
9714 if (should_copy || (flags & BCO_ALWAYS)) | |
9715 { | |
9716 /* Don't copy the options specific to a help buffer when | |
9717 * BCO_NOHELP is given or the options were initialized already | |
9718 * (jumping back to a help file with CTRL-T or CTRL-O) */ | |
9719 dont_do_help = ((flags & BCO_NOHELP) && buf->b_help) | |
9720 || buf->b_p_initialized; | |
9721 if (dont_do_help) /* don't free b_p_isk */ | |
9722 { | |
9723 save_p_isk = buf->b_p_isk; | |
9724 buf->b_p_isk = NULL; | |
9725 } | |
9726 /* | |
9727 * Always free the allocated strings. | |
9728 * If not already initialized, set 'readonly' and copy 'fileformat'. | |
9729 */ | |
9730 if (!buf->b_p_initialized) | |
9731 { | |
9732 free_buf_options(buf, TRUE); | |
9733 buf->b_p_ro = FALSE; /* don't copy readonly */ | |
9734 buf->b_p_tx = p_tx; | |
9735 #ifdef FEAT_MBYTE | |
9736 buf->b_p_fenc = vim_strsave(p_fenc); | |
9737 #endif | |
9738 buf->b_p_ff = vim_strsave(p_ff); | |
9739 #if defined(FEAT_QUICKFIX) | |
9740 buf->b_p_bh = empty_option; | |
9741 buf->b_p_bt = empty_option; | |
9742 #endif | |
9743 } | |
9744 else | |
9745 free_buf_options(buf, FALSE); | |
9746 | |
9747 buf->b_p_ai = p_ai; | |
9748 buf->b_p_ai_nopaste = p_ai_nopaste; | |
9749 buf->b_p_sw = p_sw; | |
9750 buf->b_p_tw = p_tw; | |
9751 buf->b_p_tw_nopaste = p_tw_nopaste; | |
9752 buf->b_p_tw_nobin = p_tw_nobin; | |
9753 buf->b_p_wm = p_wm; | |
9754 buf->b_p_wm_nopaste = p_wm_nopaste; | |
9755 buf->b_p_wm_nobin = p_wm_nobin; | |
9756 buf->b_p_bin = p_bin; | |
402 | 9757 #ifdef FEAT_MBYTE |
9758 buf->b_p_bomb = p_bomb; | |
9759 #endif | |
7 | 9760 buf->b_p_et = p_et; |
9761 buf->b_p_et_nobin = p_et_nobin; | |
9762 buf->b_p_ml = p_ml; | |
9763 buf->b_p_ml_nobin = p_ml_nobin; | |
9764 buf->b_p_inf = p_inf; | |
9765 buf->b_p_swf = p_swf; | |
9766 #ifdef FEAT_INS_EXPAND | |
9767 buf->b_p_cpt = vim_strsave(p_cpt); | |
9768 #endif | |
12 | 9769 #ifdef FEAT_COMPL_FUNC |
9770 buf->b_p_cfu = vim_strsave(p_cfu); | |
502 | 9771 buf->b_p_ofu = vim_strsave(p_ofu); |
12 | 9772 #endif |
7 | 9773 buf->b_p_sts = p_sts; |
9774 buf->b_p_sts_nopaste = p_sts_nopaste; | |
9775 #ifndef SHORT_FNAME | |
9776 buf->b_p_sn = p_sn; | |
9777 #endif | |
9778 #ifdef FEAT_COMMENTS | |
9779 buf->b_p_com = vim_strsave(p_com); | |
9780 #endif | |
9781 #ifdef FEAT_FOLDING | |
9782 buf->b_p_cms = vim_strsave(p_cms); | |
9783 #endif | |
9784 buf->b_p_fo = vim_strsave(p_fo); | |
41 | 9785 buf->b_p_flp = vim_strsave(p_flp); |
7 | 9786 buf->b_p_nf = vim_strsave(p_nf); |
9787 buf->b_p_mps = vim_strsave(p_mps); | |
9788 #ifdef FEAT_SMARTINDENT | |
9789 buf->b_p_si = p_si; | |
9790 #endif | |
9791 buf->b_p_ci = p_ci; | |
9792 #ifdef FEAT_CINDENT | |
9793 buf->b_p_cin = p_cin; | |
9794 buf->b_p_cink = vim_strsave(p_cink); | |
9795 buf->b_p_cino = vim_strsave(p_cino); | |
9796 #endif | |
9797 #ifdef FEAT_AUTOCMD | |
9798 /* Don't copy 'filetype', it must be detected */ | |
9799 buf->b_p_ft = empty_option; | |
9800 #endif | |
9801 #ifdef FEAT_OSFILETYPE | |
9802 buf->b_p_oft = vim_strsave(p_oft); | |
9803 #endif | |
9804 buf->b_p_pi = p_pi; | |
9805 #if defined(FEAT_SMARTINDENT) || defined(FEAT_CINDENT) | |
9806 buf->b_p_cinw = vim_strsave(p_cinw); | |
9807 #endif | |
9808 #ifdef FEAT_LISP | |
9809 buf->b_p_lisp = p_lisp; | |
9810 #endif | |
9811 #ifdef FEAT_SYN_HL | |
9812 /* Don't copy 'syntax', it must be set */ | |
9813 buf->b_p_syn = empty_option; | |
410 | 9814 buf->b_p_smc = p_smc; |
744 | 9815 #endif |
9816 #ifdef FEAT_SPELL | |
2250
1bac28a53fae
Add the conceal patch from Vince Negri.
Bram Moolenaar <bram@vim.org>
parents:
2248
diff
changeset
|
9817 buf->b_s.b_p_spc = vim_strsave(p_spf); |
1bac28a53fae
Add the conceal patch from Vince Negri.
Bram Moolenaar <bram@vim.org>
parents:
2248
diff
changeset
|
9818 (void)compile_cap_prog(&buf->b_s); |
1bac28a53fae
Add the conceal patch from Vince Negri.
Bram Moolenaar <bram@vim.org>
parents:
2248
diff
changeset
|
9819 buf->b_s.b_p_spf = vim_strsave(p_spf); |
1bac28a53fae
Add the conceal patch from Vince Negri.
Bram Moolenaar <bram@vim.org>
parents:
2248
diff
changeset
|
9820 buf->b_s.b_p_spl = vim_strsave(p_spl); |
7 | 9821 #endif |
9822 #if defined(FEAT_CINDENT) && defined(FEAT_EVAL) | |
9823 buf->b_p_inde = vim_strsave(p_inde); | |
9824 buf->b_p_indk = vim_strsave(p_indk); | |
9825 #endif | |
667 | 9826 #if defined(FEAT_EVAL) |
9827 buf->b_p_fex = vim_strsave(p_fex); | |
9828 #endif | |
7 | 9829 #ifdef FEAT_CRYPT |
9830 buf->b_p_key = vim_strsave(p_key); | |
9831 #endif | |
9832 #ifdef FEAT_SEARCHPATH | |
9833 buf->b_p_sua = vim_strsave(p_sua); | |
9834 #endif | |
9835 #ifdef FEAT_KEYMAP | |
9836 buf->b_p_keymap = vim_strsave(p_keymap); | |
9837 buf->b_kmap_state |= KEYMAP_INIT; | |
9838 #endif | |
9839 /* This isn't really an option, but copying the langmap and IME | |
9840 * state from the current buffer is better than resetting it. */ | |
9841 buf->b_p_iminsert = p_iminsert; | |
9842 buf->b_p_imsearch = p_imsearch; | |
9843 | |
9844 /* options that are normally global but also have a local value | |
9845 * are not copied, start using the global value */ | |
9846 buf->b_p_ar = -1; | |
9847 #ifdef FEAT_QUICKFIX | |
9848 buf->b_p_gp = empty_option; | |
9849 buf->b_p_mp = empty_option; | |
9850 buf->b_p_efm = empty_option; | |
9851 #endif | |
9852 buf->b_p_ep = empty_option; | |
9853 buf->b_p_kp = empty_option; | |
9854 buf->b_p_path = empty_option; | |
9855 buf->b_p_tags = empty_option; | |
9856 #ifdef FEAT_FIND_ID | |
9857 buf->b_p_def = empty_option; | |
9858 buf->b_p_inc = empty_option; | |
9859 # ifdef FEAT_EVAL | |
9860 buf->b_p_inex = vim_strsave(p_inex); | |
9861 # endif | |
9862 #endif | |
9863 #ifdef FEAT_INS_EXPAND | |
9864 buf->b_p_dict = empty_option; | |
9865 buf->b_p_tsr = empty_option; | |
9866 #endif | |
12 | 9867 #ifdef FEAT_TEXTOBJ |
9868 buf->b_p_qe = vim_strsave(p_qe); | |
9869 #endif | |
790 | 9870 #if defined(FEAT_BEVAL) && defined(FEAT_EVAL) |
9871 buf->b_p_bexpr = empty_option; | |
9872 #endif | |
2214
f8222d1f9a73
Included patch for persistent undo. Lots of changes and added test.
Bram Moolenaar <bram@vim.org>
parents:
2184
diff
changeset
|
9873 #ifdef FEAT_PERSISTENT_UNDO |
f8222d1f9a73
Included patch for persistent undo. Lots of changes and added test.
Bram Moolenaar <bram@vim.org>
parents:
2184
diff
changeset
|
9874 buf->b_p_udf = p_udf; |
f8222d1f9a73
Included patch for persistent undo. Lots of changes and added test.
Bram Moolenaar <bram@vim.org>
parents:
2184
diff
changeset
|
9875 #endif |
7 | 9876 |
9877 /* | |
9878 * Don't copy the options set by ex_help(), use the saved values, | |
9879 * when going from a help buffer to a non-help buffer. | |
9880 * Don't touch these at all when BCO_NOHELP is used and going from | |
9881 * or to a help buffer. | |
9882 */ | |
9883 if (dont_do_help) | |
9884 buf->b_p_isk = save_p_isk; | |
9885 else | |
9886 { | |
9887 buf->b_p_isk = vim_strsave(p_isk); | |
9888 did_isk = TRUE; | |
9889 buf->b_p_ts = p_ts; | |
9890 buf->b_help = FALSE; | |
9891 #ifdef FEAT_QUICKFIX | |
9892 if (buf->b_p_bt[0] == 'h') | |
9893 clear_string_option(&buf->b_p_bt); | |
9894 #endif | |
9895 buf->b_p_ma = p_ma; | |
9896 } | |
9897 } | |
9898 | |
9899 /* | |
9900 * When the options should be copied (ignoring BCO_ALWAYS), set the | |
9901 * flag that indicates that the options have been initialized. | |
9902 */ | |
9903 if (should_copy) | |
9904 buf->b_p_initialized = TRUE; | |
9905 } | |
9906 | |
9907 check_buf_options(buf); /* make sure we don't have NULLs */ | |
9908 if (did_isk) | |
9909 (void)buf_init_chartab(buf, FALSE); | |
9910 } | |
9911 | |
9912 /* | |
9913 * Reset the 'modifiable' option and its default value. | |
9914 */ | |
9915 void | |
9916 reset_modifiable() | |
9917 { | |
9918 int opt_idx; | |
9919 | |
9920 curbuf->b_p_ma = FALSE; | |
9921 p_ma = FALSE; | |
9922 opt_idx = findoption((char_u *)"ma"); | |
838 | 9923 if (opt_idx >= 0) |
9924 options[opt_idx].def_val[VI_DEFAULT] = FALSE; | |
7 | 9925 } |
9926 | |
9927 /* | |
9928 * Set the global value for 'iminsert' to the local value. | |
9929 */ | |
9930 void | |
9931 set_iminsert_global() | |
9932 { | |
9933 p_iminsert = curbuf->b_p_iminsert; | |
9934 } | |
9935 | |
9936 /* | |
9937 * Set the global value for 'imsearch' to the local value. | |
9938 */ | |
9939 void | |
9940 set_imsearch_global() | |
9941 { | |
9942 p_imsearch = curbuf->b_p_imsearch; | |
9943 } | |
9944 | |
9945 #if defined(FEAT_CMDL_COMPL) || defined(PROTO) | |
9946 static int expand_option_idx = -1; | |
9947 static char_u expand_option_name[5] = {'t', '_', NUL, NUL, NUL}; | |
9948 static int expand_option_flags = 0; | |
9949 | |
9950 void | |
9951 set_context_in_set_cmd(xp, arg, opt_flags) | |
9952 expand_T *xp; | |
9953 char_u *arg; | |
9954 int opt_flags; /* OPT_GLOBAL and/or OPT_LOCAL */ | |
9955 { | |
9956 int nextchar; | |
9957 long_u flags = 0; /* init for GCC */ | |
9958 int opt_idx = 0; /* init for GCC */ | |
9959 char_u *p; | |
9960 char_u *s; | |
9961 int is_term_option = FALSE; | |
9962 int key; | |
9963 | |
9964 expand_option_flags = opt_flags; | |
9965 | |
9966 xp->xp_context = EXPAND_SETTINGS; | |
9967 if (*arg == NUL) | |
9968 { | |
9969 xp->xp_pattern = arg; | |
9970 return; | |
9971 } | |
9972 p = arg + STRLEN(arg) - 1; | |
9973 if (*p == ' ' && *(p - 1) != '\\') | |
9974 { | |
9975 xp->xp_pattern = p + 1; | |
9976 return; | |
9977 } | |
9978 while (p > arg) | |
9979 { | |
9980 s = p; | |
9981 /* count number of backslashes before ' ' or ',' */ | |
9982 if (*p == ' ' || *p == ',') | |
9983 { | |
9984 while (s > arg && *(s - 1) == '\\') | |
9985 --s; | |
9986 } | |
9987 /* break at a space with an even number of backslashes */ | |
9988 if (*p == ' ' && ((p - s) & 1) == 0) | |
9989 { | |
9990 ++p; | |
9991 break; | |
9992 } | |
9993 --p; | |
9994 } | |
1911 | 9995 if (STRNCMP(p, "no", 2) == 0 && STRNCMP(p, "novice", 6) != 0) |
7 | 9996 { |
9997 xp->xp_context = EXPAND_BOOL_SETTINGS; | |
9998 p += 2; | |
9999 } | |
10000 if (STRNCMP(p, "inv", 3) == 0) | |
10001 { | |
10002 xp->xp_context = EXPAND_BOOL_SETTINGS; | |
10003 p += 3; | |
10004 } | |
10005 xp->xp_pattern = arg = p; | |
10006 if (*arg == '<') | |
10007 { | |
10008 while (*p != '>') | |
10009 if (*p++ == NUL) /* expand terminal option name */ | |
10010 return; | |
10011 key = get_special_key_code(arg + 1); | |
10012 if (key == 0) /* unknown name */ | |
10013 { | |
10014 xp->xp_context = EXPAND_NOTHING; | |
10015 return; | |
10016 } | |
10017 nextchar = *++p; | |
10018 is_term_option = TRUE; | |
10019 expand_option_name[2] = KEY2TERMCAP0(key); | |
10020 expand_option_name[3] = KEY2TERMCAP1(key); | |
10021 } | |
10022 else | |
10023 { | |
10024 if (p[0] == 't' && p[1] == '_') | |
10025 { | |
10026 p += 2; | |
10027 if (*p != NUL) | |
10028 ++p; | |
10029 if (*p == NUL) | |
10030 return; /* expand option name */ | |
10031 nextchar = *++p; | |
10032 is_term_option = TRUE; | |
10033 expand_option_name[2] = p[-2]; | |
10034 expand_option_name[3] = p[-1]; | |
10035 } | |
10036 else | |
10037 { | |
10038 /* Allow * wildcard */ | |
10039 while (ASCII_ISALNUM(*p) || *p == '_' || *p == '*') | |
10040 p++; | |
10041 if (*p == NUL) | |
10042 return; | |
10043 nextchar = *p; | |
10044 *p = NUL; | |
10045 opt_idx = findoption(arg); | |
10046 *p = nextchar; | |
10047 if (opt_idx == -1 || options[opt_idx].var == NULL) | |
10048 { | |
10049 xp->xp_context = EXPAND_NOTHING; | |
10050 return; | |
10051 } | |
10052 flags = options[opt_idx].flags; | |
10053 if (flags & P_BOOL) | |
10054 { | |
10055 xp->xp_context = EXPAND_NOTHING; | |
10056 return; | |
10057 } | |
10058 } | |
10059 } | |
10060 /* handle "-=" and "+=" */ | |
10061 if ((nextchar == '-' || nextchar == '+' || nextchar == '^') && p[1] == '=') | |
10062 { | |
10063 ++p; | |
10064 nextchar = '='; | |
10065 } | |
10066 if ((nextchar != '=' && nextchar != ':') | |
10067 || xp->xp_context == EXPAND_BOOL_SETTINGS) | |
10068 { | |
10069 xp->xp_context = EXPAND_UNSUCCESSFUL; | |
10070 return; | |
10071 } | |
10072 if (xp->xp_context != EXPAND_BOOL_SETTINGS && p[1] == NUL) | |
10073 { | |
10074 xp->xp_context = EXPAND_OLD_SETTING; | |
10075 if (is_term_option) | |
10076 expand_option_idx = -1; | |
10077 else | |
10078 expand_option_idx = opt_idx; | |
10079 xp->xp_pattern = p + 1; | |
10080 return; | |
10081 } | |
10082 xp->xp_context = EXPAND_NOTHING; | |
10083 if (is_term_option || (flags & P_NUM)) | |
10084 return; | |
10085 | |
10086 xp->xp_pattern = p + 1; | |
10087 | |
10088 if (flags & P_EXPAND) | |
10089 { | |
10090 p = options[opt_idx].var; | |
10091 if (p == (char_u *)&p_bdir | |
10092 || p == (char_u *)&p_dir | |
10093 || p == (char_u *)&p_path | |
10094 || p == (char_u *)&p_rtp | |
10095 #ifdef FEAT_SEARCHPATH | |
10096 || p == (char_u *)&p_cdpath | |
10097 #endif | |
10098 #ifdef FEAT_SESSION | |
10099 || p == (char_u *)&p_vdir | |
10100 #endif | |
10101 ) | |
10102 { | |
10103 xp->xp_context = EXPAND_DIRECTORIES; | |
10104 if (p == (char_u *)&p_path | |
10105 #ifdef FEAT_SEARCHPATH | |
10106 || p == (char_u *)&p_cdpath | |
10107 #endif | |
10108 ) | |
10109 xp->xp_backslash = XP_BS_THREE; | |
10110 else | |
10111 xp->xp_backslash = XP_BS_ONE; | |
10112 } | |
10113 else | |
10114 { | |
10115 xp->xp_context = EXPAND_FILES; | |
10116 /* for 'tags' need three backslashes for a space */ | |
10117 if (p == (char_u *)&p_tags) | |
10118 xp->xp_backslash = XP_BS_THREE; | |
10119 else | |
10120 xp->xp_backslash = XP_BS_ONE; | |
10121 } | |
10122 } | |
10123 | |
10124 /* For an option that is a list of file names, find the start of the | |
10125 * last file name. */ | |
10126 for (p = arg + STRLEN(arg) - 1; p > xp->xp_pattern; --p) | |
10127 { | |
10128 /* count number of backslashes before ' ' or ',' */ | |
10129 if (*p == ' ' || *p == ',') | |
10130 { | |
10131 s = p; | |
10132 while (s > xp->xp_pattern && *(s - 1) == '\\') | |
10133 --s; | |
10134 if ((*p == ' ' && (xp->xp_backslash == XP_BS_THREE && (p - s) < 3)) | |
10135 || (*p == ',' && (flags & P_COMMA) && ((p - s) & 1) == 0)) | |
10136 { | |
10137 xp->xp_pattern = p + 1; | |
10138 break; | |
10139 } | |
10140 } | |
374 | 10141 |
744 | 10142 #ifdef FEAT_SPELL |
374 | 10143 /* for 'spellsuggest' start at "file:" */ |
10144 if (options[opt_idx].var == (char_u *)&p_sps | |
10145 && STRNCMP(p, "file:", 5) == 0) | |
10146 { | |
10147 xp->xp_pattern = p + 5; | |
10148 break; | |
10149 } | |
10150 #endif | |
7 | 10151 } |
10152 | |
10153 return; | |
10154 } | |
10155 | |
10156 int | |
10157 ExpandSettings(xp, regmatch, num_file, file) | |
10158 expand_T *xp; | |
10159 regmatch_T *regmatch; | |
10160 int *num_file; | |
10161 char_u ***file; | |
10162 { | |
10163 int num_normal = 0; /* Nr of matching non-term-code settings */ | |
10164 int num_term = 0; /* Nr of matching terminal code settings */ | |
10165 int opt_idx; | |
10166 int match; | |
10167 int count = 0; | |
10168 char_u *str; | |
10169 int loop; | |
10170 int is_term_opt; | |
10171 char_u name_buf[MAX_KEY_NAME_LEN]; | |
10172 static char *(names[]) = {"all", "termcap"}; | |
10173 int ic = regmatch->rm_ic; /* remember the ignore-case flag */ | |
10174 | |
10175 /* do this loop twice: | |
10176 * loop == 0: count the number of matching options | |
10177 * loop == 1: copy the matching options into allocated memory | |
10178 */ | |
10179 for (loop = 0; loop <= 1; ++loop) | |
10180 { | |
10181 regmatch->rm_ic = ic; | |
10182 if (xp->xp_context != EXPAND_BOOL_SETTINGS) | |
10183 { | |
1883 | 10184 for (match = 0; match < (int)(sizeof(names) / sizeof(char *)); |
10185 ++match) | |
7 | 10186 if (vim_regexec(regmatch, (char_u *)names[match], (colnr_T)0)) |
10187 { | |
10188 if (loop == 0) | |
10189 num_normal++; | |
10190 else | |
10191 (*file)[count++] = vim_strsave((char_u *)names[match]); | |
10192 } | |
10193 } | |
10194 for (opt_idx = 0; (str = (char_u *)options[opt_idx].fullname) != NULL; | |
10195 opt_idx++) | |
10196 { | |
10197 if (options[opt_idx].var == NULL) | |
10198 continue; | |
10199 if (xp->xp_context == EXPAND_BOOL_SETTINGS | |
10200 && !(options[opt_idx].flags & P_BOOL)) | |
10201 continue; | |
10202 is_term_opt = istermoption(&options[opt_idx]); | |
10203 if (is_term_opt && num_normal > 0) | |
10204 continue; | |
10205 match = FALSE; | |
10206 if (vim_regexec(regmatch, str, (colnr_T)0) | |
10207 || (options[opt_idx].shortname != NULL | |
10208 && vim_regexec(regmatch, | |
10209 (char_u *)options[opt_idx].shortname, (colnr_T)0))) | |
10210 match = TRUE; | |
10211 else if (is_term_opt) | |
10212 { | |
10213 name_buf[0] = '<'; | |
10214 name_buf[1] = 't'; | |
10215 name_buf[2] = '_'; | |
10216 name_buf[3] = str[2]; | |
10217 name_buf[4] = str[3]; | |
10218 name_buf[5] = '>'; | |
10219 name_buf[6] = NUL; | |
10220 if (vim_regexec(regmatch, name_buf, (colnr_T)0)) | |
10221 { | |
10222 match = TRUE; | |
10223 str = name_buf; | |
10224 } | |
10225 } | |
10226 if (match) | |
10227 { | |
10228 if (loop == 0) | |
10229 { | |
10230 if (is_term_opt) | |
10231 num_term++; | |
10232 else | |
10233 num_normal++; | |
10234 } | |
10235 else | |
10236 (*file)[count++] = vim_strsave(str); | |
10237 } | |
10238 } | |
10239 /* | |
10240 * Check terminal key codes, these are not in the option table | |
10241 */ | |
10242 if (xp->xp_context != EXPAND_BOOL_SETTINGS && num_normal == 0) | |
10243 { | |
10244 for (opt_idx = 0; (str = get_termcode(opt_idx)) != NULL; opt_idx++) | |
10245 { | |
10246 if (!isprint(str[0]) || !isprint(str[1])) | |
10247 continue; | |
10248 | |
10249 name_buf[0] = 't'; | |
10250 name_buf[1] = '_'; | |
10251 name_buf[2] = str[0]; | |
10252 name_buf[3] = str[1]; | |
10253 name_buf[4] = NUL; | |
10254 | |
10255 match = FALSE; | |
10256 if (vim_regexec(regmatch, name_buf, (colnr_T)0)) | |
10257 match = TRUE; | |
10258 else | |
10259 { | |
10260 name_buf[0] = '<'; | |
10261 name_buf[1] = 't'; | |
10262 name_buf[2] = '_'; | |
10263 name_buf[3] = str[0]; | |
10264 name_buf[4] = str[1]; | |
10265 name_buf[5] = '>'; | |
10266 name_buf[6] = NUL; | |
10267 | |
10268 if (vim_regexec(regmatch, name_buf, (colnr_T)0)) | |
10269 match = TRUE; | |
10270 } | |
10271 if (match) | |
10272 { | |
10273 if (loop == 0) | |
10274 num_term++; | |
10275 else | |
10276 (*file)[count++] = vim_strsave(name_buf); | |
10277 } | |
10278 } | |
10279 | |
10280 /* | |
10281 * Check special key names. | |
10282 */ | |
10283 regmatch->rm_ic = TRUE; /* ignore case here */ | |
10284 for (opt_idx = 0; (str = get_key_name(opt_idx)) != NULL; opt_idx++) | |
10285 { | |
10286 name_buf[0] = '<'; | |
10287 STRCPY(name_buf + 1, str); | |
10288 STRCAT(name_buf, ">"); | |
10289 | |
10290 if (vim_regexec(regmatch, name_buf, (colnr_T)0)) | |
10291 { | |
10292 if (loop == 0) | |
10293 num_term++; | |
10294 else | |
10295 (*file)[count++] = vim_strsave(name_buf); | |
10296 } | |
10297 } | |
10298 } | |
10299 if (loop == 0) | |
10300 { | |
10301 if (num_normal > 0) | |
10302 *num_file = num_normal; | |
10303 else if (num_term > 0) | |
10304 *num_file = num_term; | |
10305 else | |
10306 return OK; | |
10307 *file = (char_u **)alloc((unsigned)(*num_file * sizeof(char_u *))); | |
10308 if (*file == NULL) | |
10309 { | |
10310 *file = (char_u **)""; | |
10311 return FAIL; | |
10312 } | |
10313 } | |
10314 } | |
10315 return OK; | |
10316 } | |
10317 | |
10318 int | |
10319 ExpandOldSetting(num_file, file) | |
10320 int *num_file; | |
10321 char_u ***file; | |
10322 { | |
10323 char_u *var = NULL; /* init for GCC */ | |
10324 char_u *buf; | |
10325 | |
10326 *num_file = 0; | |
10327 *file = (char_u **)alloc((unsigned)sizeof(char_u *)); | |
10328 if (*file == NULL) | |
10329 return FAIL; | |
10330 | |
10331 /* | |
10332 * For a terminal key code expand_option_idx is < 0. | |
10333 */ | |
10334 if (expand_option_idx < 0) | |
10335 { | |
10336 var = find_termcode(expand_option_name + 2); | |
10337 if (var == NULL) | |
10338 expand_option_idx = findoption(expand_option_name); | |
10339 } | |
10340 | |
10341 if (expand_option_idx >= 0) | |
10342 { | |
10343 /* put string of option value in NameBuff */ | |
10344 option_value2string(&options[expand_option_idx], expand_option_flags); | |
10345 var = NameBuff; | |
10346 } | |
10347 else if (var == NULL) | |
10348 var = (char_u *)""; | |
10349 | |
10350 /* A backslash is required before some characters. This is the reverse of | |
10351 * what happens in do_set(). */ | |
10352 buf = vim_strsave_escaped(var, escape_chars); | |
10353 | |
10354 if (buf == NULL) | |
10355 { | |
10356 vim_free(*file); | |
10357 *file = NULL; | |
10358 return FAIL; | |
10359 } | |
10360 | |
10361 #ifdef BACKSLASH_IN_FILENAME | |
10362 /* For MS-Windows et al. we don't double backslashes at the start and | |
10363 * before a file name character. */ | |
39 | 10364 for (var = buf; *var != NUL; mb_ptr_adv(var)) |
7 | 10365 if (var[0] == '\\' && var[1] == '\\' |
10366 && expand_option_idx >= 0 | |
10367 && (options[expand_option_idx].flags & P_EXPAND) | |
10368 && vim_isfilec(var[2]) | |
10369 && (var[2] != '\\' || (var == buf && var[4] != '\\'))) | |
1622 | 10370 STRMOVE(var, var + 1); |
7 | 10371 #endif |
10372 | |
10373 *file[0] = buf; | |
10374 *num_file = 1; | |
10375 return OK; | |
10376 } | |
10377 #endif | |
10378 | |
10379 /* | |
10380 * Get the value for the numeric or string option *opp in a nice format into | |
10381 * NameBuff[]. Must not be called with a hidden option! | |
10382 */ | |
10383 static void | |
10384 option_value2string(opp, opt_flags) | |
10385 struct vimoption *opp; | |
10386 int opt_flags; /* OPT_GLOBAL and/or OPT_LOCAL */ | |
10387 { | |
10388 char_u *varp; | |
10389 | |
10390 varp = get_varp_scope(opp, opt_flags); | |
10391 | |
10392 if (opp->flags & P_NUM) | |
10393 { | |
10394 long wc = 0; | |
10395 | |
10396 if (wc_use_keyname(varp, &wc)) | |
10397 STRCPY(NameBuff, get_special_key_name((int)wc, 0)); | |
10398 else if (wc != 0) | |
10399 STRCPY(NameBuff, transchar((int)wc)); | |
10400 else | |
10401 sprintf((char *)NameBuff, "%ld", *(long *)varp); | |
10402 } | |
10403 else /* P_STRING */ | |
10404 { | |
10405 varp = *(char_u **)(varp); | |
10406 if (varp == NULL) /* just in case */ | |
10407 NameBuff[0] = NUL; | |
10408 #ifdef FEAT_CRYPT | |
10409 /* don't show the actual value of 'key', only that it's set */ | |
840 | 10410 else if (opp->var == (char_u *)&p_key && *varp) |
7 | 10411 STRCPY(NameBuff, "*****"); |
10412 #endif | |
10413 else if (opp->flags & P_EXPAND) | |
10414 home_replace(NULL, varp, NameBuff, MAXPATHL, FALSE); | |
10415 /* Translate 'pastetoggle' into special key names */ | |
10416 else if ((char_u **)opp->var == &p_pt) | |
10417 str2specialbuf(p_pt, NameBuff, MAXPATHL); | |
10418 else | |
419 | 10419 vim_strncpy(NameBuff, varp, MAXPATHL - 1); |
7 | 10420 } |
10421 } | |
10422 | |
10423 /* | |
10424 * Return TRUE if "varp" points to 'wildchar' or 'wildcharm' and it can be | |
10425 * printed as a keyname. | |
10426 * "*wcp" is set to the value of the option if it's 'wildchar' or 'wildcharm'. | |
10427 */ | |
10428 static int | |
10429 wc_use_keyname(varp, wcp) | |
10430 char_u *varp; | |
10431 long *wcp; | |
10432 { | |
10433 if (((long *)varp == &p_wc) || ((long *)varp == &p_wcm)) | |
10434 { | |
10435 *wcp = *(long *)varp; | |
10436 if (IS_SPECIAL(*wcp) || find_special_key_in_table((int)*wcp) >= 0) | |
10437 return TRUE; | |
10438 } | |
10439 return FALSE; | |
10440 } | |
10441 | |
10442 #ifdef FEAT_LANGMAP | |
10443 /* | |
1811 | 10444 * Any character has an equivalent 'langmap' character. This is used for |
10445 * keyboards that have a special language mode that sends characters above | |
10446 * 128 (although other characters can be translated too). The "to" field is a | |
10447 * Vim command character. This avoids having to switch the keyboard back to | |
10448 * ASCII mode when leaving Insert mode. | |
10449 * | |
10450 * langmap_mapchar[] maps any of 256 chars to an ASCII char used for Vim | |
10451 * commands. | |
10452 * When FEAT_MBYTE is defined langmap_mapga.ga_data is a sorted table of | |
10453 * langmap_entry_T. This does the same as langmap_mapchar[] for characters >= | |
10454 * 256. | |
10455 */ | |
10456 # ifdef FEAT_MBYTE | |
10457 /* | |
10458 * With multi-byte support use growarray for 'langmap' chars >= 256 | |
10459 */ | |
10460 typedef struct | |
10461 { | |
10462 int from; | |
10463 int to; | |
10464 } langmap_entry_T; | |
10465 | |
10466 static garray_T langmap_mapga; | |
10467 static void langmap_set_entry __ARGS((int from, int to)); | |
10468 | |
10469 /* | |
10470 * Search for an entry in "langmap_mapga" for "from". If found set the "to" | |
10471 * field. If not found insert a new entry at the appropriate location. | |
10472 */ | |
10473 static void | |
10474 langmap_set_entry(from, to) | |
10475 int from; | |
10476 int to; | |
10477 { | |
10478 langmap_entry_T *entries = (langmap_entry_T *)(langmap_mapga.ga_data); | |
10479 int a = 0; | |
10480 int b = langmap_mapga.ga_len; | |
10481 | |
10482 /* Do a binary search for an existing entry. */ | |
10483 while (a != b) | |
10484 { | |
10485 int i = (a + b) / 2; | |
10486 int d = entries[i].from - from; | |
10487 | |
10488 if (d == 0) | |
10489 { | |
10490 entries[i].to = to; | |
10491 return; | |
10492 } | |
10493 if (d < 0) | |
10494 a = i + 1; | |
10495 else | |
10496 b = i; | |
10497 } | |
10498 | |
10499 if (ga_grow(&langmap_mapga, 1) != OK) | |
10500 return; /* out of memory */ | |
10501 | |
10502 /* insert new entry at position "a" */ | |
10503 entries = (langmap_entry_T *)(langmap_mapga.ga_data) + a; | |
10504 mch_memmove(entries + 1, entries, | |
10505 (langmap_mapga.ga_len - a) * sizeof(langmap_entry_T)); | |
10506 ++langmap_mapga.ga_len; | |
10507 entries[0].from = from; | |
10508 entries[0].to = to; | |
10509 } | |
10510 | |
10511 /* | |
10512 * Apply 'langmap' to multi-byte character "c" and return the result. | |
10513 */ | |
10514 int | |
10515 langmap_adjust_mb(c) | |
10516 int c; | |
10517 { | |
10518 langmap_entry_T *entries = (langmap_entry_T *)(langmap_mapga.ga_data); | |
10519 int a = 0; | |
10520 int b = langmap_mapga.ga_len; | |
10521 | |
10522 while (a != b) | |
10523 { | |
10524 int i = (a + b) / 2; | |
10525 int d = entries[i].from - c; | |
10526 | |
10527 if (d == 0) | |
10528 return entries[i].to; /* found matching entry */ | |
10529 if (d < 0) | |
10530 a = i + 1; | |
10531 else | |
10532 b = i; | |
10533 } | |
10534 return c; /* no entry found, return "c" unmodified */ | |
10535 } | |
10536 # endif | |
7 | 10537 |
10538 static void | |
10539 langmap_init() | |
10540 { | |
10541 int i; | |
10542 | |
1811 | 10543 for (i = 0; i < 256; i++) |
10544 langmap_mapchar[i] = i; /* we init with a one-to-one map */ | |
10545 # ifdef FEAT_MBYTE | |
10546 ga_init2(&langmap_mapga, sizeof(langmap_entry_T), 8); | |
10547 # endif | |
7 | 10548 } |
10549 | |
10550 /* | |
10551 * Called when langmap option is set; the language map can be | |
10552 * changed at any time! | |
10553 */ | |
10554 static void | |
10555 langmap_set() | |
10556 { | |
10557 char_u *p; | |
10558 char_u *p2; | |
10559 int from, to; | |
10560 | |
1811 | 10561 #ifdef FEAT_MBYTE |
10562 ga_clear(&langmap_mapga); /* clear the previous map first */ | |
10563 #endif | |
10564 langmap_init(); /* back to one-to-one map */ | |
7 | 10565 |
10566 for (p = p_langmap; p[0] != NUL; ) | |
10567 { | |
39 | 10568 for (p2 = p; p2[0] != NUL && p2[0] != ',' && p2[0] != ';'; |
10569 mb_ptr_adv(p2)) | |
7 | 10570 { |
10571 if (p2[0] == '\\' && p2[1] != NUL) | |
10572 ++p2; | |
10573 } | |
10574 if (p2[0] == ';') | |
10575 ++p2; /* abcd;ABCD form, p2 points to A */ | |
10576 else | |
10577 p2 = NULL; /* aAbBcCdD form, p2 is NULL */ | |
10578 while (p[0]) | |
10579 { | |
2144
2775dcd05603
updated for version 7.2.426
Bram Moolenaar <bram@zimbu.org>
parents:
2135
diff
changeset
|
10580 if (p[0] == ',') |
2775dcd05603
updated for version 7.2.426
Bram Moolenaar <bram@zimbu.org>
parents:
2135
diff
changeset
|
10581 { |
2775dcd05603
updated for version 7.2.426
Bram Moolenaar <bram@zimbu.org>
parents:
2135
diff
changeset
|
10582 ++p; |
2775dcd05603
updated for version 7.2.426
Bram Moolenaar <bram@zimbu.org>
parents:
2135
diff
changeset
|
10583 break; |
2775dcd05603
updated for version 7.2.426
Bram Moolenaar <bram@zimbu.org>
parents:
2135
diff
changeset
|
10584 } |
7 | 10585 if (p[0] == '\\' && p[1] != NUL) |
10586 ++p; | |
10587 #ifdef FEAT_MBYTE | |
10588 from = (*mb_ptr2char)(p); | |
10589 #else | |
10590 from = p[0]; | |
10591 #endif | |
2144
2775dcd05603
updated for version 7.2.426
Bram Moolenaar <bram@zimbu.org>
parents:
2135
diff
changeset
|
10592 to = NUL; |
7 | 10593 if (p2 == NULL) |
10594 { | |
39 | 10595 mb_ptr_adv(p); |
2144
2775dcd05603
updated for version 7.2.426
Bram Moolenaar <bram@zimbu.org>
parents:
2135
diff
changeset
|
10596 if (p[0] != ',') |
2775dcd05603
updated for version 7.2.426
Bram Moolenaar <bram@zimbu.org>
parents:
2135
diff
changeset
|
10597 { |
2775dcd05603
updated for version 7.2.426
Bram Moolenaar <bram@zimbu.org>
parents:
2135
diff
changeset
|
10598 if (p[0] == '\\') |
2775dcd05603
updated for version 7.2.426
Bram Moolenaar <bram@zimbu.org>
parents:
2135
diff
changeset
|
10599 ++p; |
7 | 10600 #ifdef FEAT_MBYTE |
2144
2775dcd05603
updated for version 7.2.426
Bram Moolenaar <bram@zimbu.org>
parents:
2135
diff
changeset
|
10601 to = (*mb_ptr2char)(p); |
2775dcd05603
updated for version 7.2.426
Bram Moolenaar <bram@zimbu.org>
parents:
2135
diff
changeset
|
10602 #else |
2775dcd05603
updated for version 7.2.426
Bram Moolenaar <bram@zimbu.org>
parents:
2135
diff
changeset
|
10603 to = p[0]; |
2775dcd05603
updated for version 7.2.426
Bram Moolenaar <bram@zimbu.org>
parents:
2135
diff
changeset
|
10604 #endif |
2775dcd05603
updated for version 7.2.426
Bram Moolenaar <bram@zimbu.org>
parents:
2135
diff
changeset
|
10605 } |
7 | 10606 } |
10607 else | |
10608 { | |
2144
2775dcd05603
updated for version 7.2.426
Bram Moolenaar <bram@zimbu.org>
parents:
2135
diff
changeset
|
10609 if (p2[0] != ',') |
2775dcd05603
updated for version 7.2.426
Bram Moolenaar <bram@zimbu.org>
parents:
2135
diff
changeset
|
10610 { |
2775dcd05603
updated for version 7.2.426
Bram Moolenaar <bram@zimbu.org>
parents:
2135
diff
changeset
|
10611 if (p2[0] == '\\') |
2775dcd05603
updated for version 7.2.426
Bram Moolenaar <bram@zimbu.org>
parents:
2135
diff
changeset
|
10612 ++p2; |
7 | 10613 #ifdef FEAT_MBYTE |
2144
2775dcd05603
updated for version 7.2.426
Bram Moolenaar <bram@zimbu.org>
parents:
2135
diff
changeset
|
10614 to = (*mb_ptr2char)(p2); |
2775dcd05603
updated for version 7.2.426
Bram Moolenaar <bram@zimbu.org>
parents:
2135
diff
changeset
|
10615 #else |
2775dcd05603
updated for version 7.2.426
Bram Moolenaar <bram@zimbu.org>
parents:
2135
diff
changeset
|
10616 to = p2[0]; |
2775dcd05603
updated for version 7.2.426
Bram Moolenaar <bram@zimbu.org>
parents:
2135
diff
changeset
|
10617 #endif |
2775dcd05603
updated for version 7.2.426
Bram Moolenaar <bram@zimbu.org>
parents:
2135
diff
changeset
|
10618 } |
7 | 10619 } |
10620 if (to == NUL) | |
10621 { | |
10622 EMSG2(_("E357: 'langmap': Matching character missing for %s"), | |
10623 transchar(from)); | |
10624 return; | |
10625 } | |
1811 | 10626 |
10627 #ifdef FEAT_MBYTE | |
10628 if (from >= 256) | |
10629 langmap_set_entry(from, to); | |
10630 else | |
10631 #endif | |
10632 langmap_mapchar[from & 255] = to; | |
7 | 10633 |
10634 /* Advance to next pair */ | |
39 | 10635 mb_ptr_adv(p); |
2144
2775dcd05603
updated for version 7.2.426
Bram Moolenaar <bram@zimbu.org>
parents:
2135
diff
changeset
|
10636 if (p2 != NULL) |
7 | 10637 { |
39 | 10638 mb_ptr_adv(p2); |
7 | 10639 if (*p == ';') |
10640 { | |
10641 p = p2; | |
10642 if (p[0] != NUL) | |
10643 { | |
10644 if (p[0] != ',') | |
10645 { | |
10646 EMSG2(_("E358: 'langmap': Extra characters after semicolon: %s"), p); | |
10647 return; | |
10648 } | |
10649 ++p; | |
10650 } | |
10651 break; | |
10652 } | |
10653 } | |
10654 } | |
10655 } | |
10656 } | |
10657 #endif | |
10658 | |
10659 /* | |
10660 * Return TRUE if format option 'x' is in effect. | |
10661 * Take care of no formatting when 'paste' is set. | |
10662 */ | |
10663 int | |
10664 has_format_option(x) | |
10665 int x; | |
10666 { | |
10667 if (p_paste) | |
10668 return FALSE; | |
10669 return (vim_strchr(curbuf->b_p_fo, x) != NULL); | |
10670 } | |
10671 | |
10672 /* | |
10673 * Return TRUE if "x" is present in 'shortmess' option, or | |
10674 * 'shortmess' contains 'a' and "x" is present in SHM_A. | |
10675 */ | |
10676 int | |
10677 shortmess(x) | |
10678 int x; | |
10679 { | |
10680 return ( vim_strchr(p_shm, x) != NULL | |
10681 || (vim_strchr(p_shm, 'a') != NULL | |
10682 && vim_strchr((char_u *)SHM_A, x) != NULL)); | |
10683 } | |
10684 | |
10685 /* | |
10686 * paste_option_changed() - Called after p_paste was set or reset. | |
10687 */ | |
10688 static void | |
10689 paste_option_changed() | |
10690 { | |
10691 static int old_p_paste = FALSE; | |
10692 static int save_sm = 0; | |
10693 #ifdef FEAT_CMDL_INFO | |
10694 static int save_ru = 0; | |
10695 #endif | |
10696 #ifdef FEAT_RIGHTLEFT | |
10697 static int save_ri = 0; | |
10698 static int save_hkmap = 0; | |
10699 #endif | |
10700 buf_T *buf; | |
10701 | |
10702 if (p_paste) | |
10703 { | |
10704 /* | |
10705 * Paste switched from off to on. | |
10706 * Save the current values, so they can be restored later. | |
10707 */ | |
10708 if (!old_p_paste) | |
10709 { | |
10710 /* save options for each buffer */ | |
10711 for (buf = firstbuf; buf != NULL; buf = buf->b_next) | |
10712 { | |
10713 buf->b_p_tw_nopaste = buf->b_p_tw; | |
10714 buf->b_p_wm_nopaste = buf->b_p_wm; | |
10715 buf->b_p_sts_nopaste = buf->b_p_sts; | |
10716 buf->b_p_ai_nopaste = buf->b_p_ai; | |
10717 } | |
10718 | |
10719 /* save global options */ | |
10720 save_sm = p_sm; | |
10721 #ifdef FEAT_CMDL_INFO | |
10722 save_ru = p_ru; | |
10723 #endif | |
10724 #ifdef FEAT_RIGHTLEFT | |
10725 save_ri = p_ri; | |
10726 save_hkmap = p_hkmap; | |
10727 #endif | |
10728 /* save global values for local buffer options */ | |
10729 p_tw_nopaste = p_tw; | |
10730 p_wm_nopaste = p_wm; | |
10731 p_sts_nopaste = p_sts; | |
10732 p_ai_nopaste = p_ai; | |
10733 } | |
10734 | |
10735 /* | |
10736 * Always set the option values, also when 'paste' is set when it is | |
10737 * already on. | |
10738 */ | |
10739 /* set options for each buffer */ | |
10740 for (buf = firstbuf; buf != NULL; buf = buf->b_next) | |
10741 { | |
10742 buf->b_p_tw = 0; /* textwidth is 0 */ | |
10743 buf->b_p_wm = 0; /* wrapmargin is 0 */ | |
10744 buf->b_p_sts = 0; /* softtabstop is 0 */ | |
10745 buf->b_p_ai = 0; /* no auto-indent */ | |
10746 } | |
10747 | |
10748 /* set global options */ | |
10749 p_sm = 0; /* no showmatch */ | |
10750 #ifdef FEAT_CMDL_INFO | |
10751 # ifdef FEAT_WINDOWS | |
10752 if (p_ru) | |
10753 status_redraw_all(); /* redraw to remove the ruler */ | |
10754 # endif | |
10755 p_ru = 0; /* no ruler */ | |
10756 #endif | |
10757 #ifdef FEAT_RIGHTLEFT | |
10758 p_ri = 0; /* no reverse insert */ | |
10759 p_hkmap = 0; /* no Hebrew keyboard */ | |
10760 #endif | |
10761 /* set global values for local buffer options */ | |
10762 p_tw = 0; | |
10763 p_wm = 0; | |
10764 p_sts = 0; | |
10765 p_ai = 0; | |
10766 } | |
10767 | |
10768 /* | |
10769 * Paste switched from on to off: Restore saved values. | |
10770 */ | |
10771 else if (old_p_paste) | |
10772 { | |
10773 /* restore options for each buffer */ | |
10774 for (buf = firstbuf; buf != NULL; buf = buf->b_next) | |
10775 { | |
10776 buf->b_p_tw = buf->b_p_tw_nopaste; | |
10777 buf->b_p_wm = buf->b_p_wm_nopaste; | |
10778 buf->b_p_sts = buf->b_p_sts_nopaste; | |
10779 buf->b_p_ai = buf->b_p_ai_nopaste; | |
10780 } | |
10781 | |
10782 /* restore global options */ | |
10783 p_sm = save_sm; | |
10784 #ifdef FEAT_CMDL_INFO | |
10785 # ifdef FEAT_WINDOWS | |
10786 if (p_ru != save_ru) | |
10787 status_redraw_all(); /* redraw to draw the ruler */ | |
10788 # endif | |
10789 p_ru = save_ru; | |
10790 #endif | |
10791 #ifdef FEAT_RIGHTLEFT | |
10792 p_ri = save_ri; | |
10793 p_hkmap = save_hkmap; | |
10794 #endif | |
10795 /* set global values for local buffer options */ | |
10796 p_tw = p_tw_nopaste; | |
10797 p_wm = p_wm_nopaste; | |
10798 p_sts = p_sts_nopaste; | |
10799 p_ai = p_ai_nopaste; | |
10800 } | |
10801 | |
10802 old_p_paste = p_paste; | |
10803 } | |
10804 | |
10805 /* | |
10806 * vimrc_found() - Called when a ".vimrc" or "VIMINIT" has been found. | |
10807 * | |
10808 * Reset 'compatible' and set the values for options that didn't get set yet | |
10809 * to the Vim defaults. | |
10810 * Don't do this if the 'compatible' option has been set or reset before. | |
819 | 10811 * When "fname" is not NULL, use it to set $"envname" when it wasn't set yet. |
7 | 10812 */ |
10813 void | |
819 | 10814 vimrc_found(fname, envname) |
10815 char_u *fname; | |
10816 char_u *envname; | |
10817 { | |
10818 int opt_idx; | |
826 | 10819 int dofree = FALSE; |
819 | 10820 char_u *p; |
7 | 10821 |
10822 if (!option_was_set((char_u *)"cp")) | |
10823 { | |
10824 p_cp = FALSE; | |
10825 for (opt_idx = 0; !istermoption(&options[opt_idx]); opt_idx++) | |
10826 if (!(options[opt_idx].flags & (P_WAS_SET|P_VI_DEF))) | |
10827 set_option_default(opt_idx, OPT_FREE, FALSE); | |
10828 didset_options(); | |
10829 } | |
819 | 10830 |
10831 if (fname != NULL) | |
10832 { | |
10833 p = vim_getenv(envname, &dofree); | |
10834 if (p == NULL) | |
10835 { | |
10836 /* Set $MYVIMRC to the first vimrc file found. */ | |
10837 p = FullName_save(fname, FALSE); | |
10838 if (p != NULL) | |
10839 { | |
10840 vim_setenv(envname, p); | |
10841 vim_free(p); | |
10842 } | |
10843 } | |
10844 else if (dofree) | |
10845 vim_free(p); | |
10846 } | |
7 | 10847 } |
10848 | |
10849 /* | |
10850 * Set 'compatible' on or off. Called for "-C" and "-N" command line arg. | |
10851 */ | |
10852 void | |
10853 change_compatible(on) | |
10854 int on; | |
10855 { | |
838 | 10856 int opt_idx; |
10857 | |
7 | 10858 if (p_cp != on) |
10859 { | |
10860 p_cp = on; | |
10861 compatible_set(); | |
10862 } | |
838 | 10863 opt_idx = findoption((char_u *)"cp"); |
10864 if (opt_idx >= 0) | |
10865 options[opt_idx].flags |= P_WAS_SET; | |
7 | 10866 } |
10867 | |
10868 /* | |
10869 * Return TRUE when option "name" has been set. | |
10870 */ | |
10871 int | |
10872 option_was_set(name) | |
10873 char_u *name; | |
10874 { | |
10875 int idx; | |
10876 | |
10877 idx = findoption(name); | |
10878 if (idx < 0) /* unknown option */ | |
10879 return FALSE; | |
10880 if (options[idx].flags & P_WAS_SET) | |
10881 return TRUE; | |
10882 return FALSE; | |
10883 } | |
10884 | |
10885 /* | |
10886 * compatible_set() - Called when 'compatible' has been set or unset. | |
10887 * | |
10888 * When 'compatible' set: Set all relevant options (those that have the P_VIM) | |
10889 * flag) to a Vi compatible value. | |
10890 * When 'compatible' is unset: Set all options that have a different default | |
10891 * for Vim (without the P_VI_DEF flag) to that default. | |
10892 */ | |
10893 static void | |
10894 compatible_set() | |
10895 { | |
10896 int opt_idx; | |
10897 | |
10898 for (opt_idx = 0; !istermoption(&options[opt_idx]); opt_idx++) | |
10899 if ( ((options[opt_idx].flags & P_VIM) && p_cp) | |
10900 || (!(options[opt_idx].flags & P_VI_DEF) && !p_cp)) | |
10901 set_option_default(opt_idx, OPT_FREE, p_cp); | |
10902 didset_options(); | |
10903 } | |
10904 | |
10905 #ifdef FEAT_LINEBREAK | |
10906 | |
10907 # if defined(__BORLANDC__) && (__BORLANDC__ < 0x500) | |
10908 /* Borland C++ screws up loop optimisation here (negri) */ | |
133 | 10909 #pragma option -O-l |
7 | 10910 # endif |
10911 | |
10912 /* | |
10913 * fill_breakat_flags() -- called when 'breakat' changes value. | |
10914 */ | |
10915 static void | |
10916 fill_breakat_flags() | |
10917 { | |
500 | 10918 char_u *p; |
7 | 10919 int i; |
10920 | |
10921 for (i = 0; i < 256; i++) | |
10922 breakat_flags[i] = FALSE; | |
10923 | |
10924 if (p_breakat != NULL) | |
500 | 10925 for (p = p_breakat; *p; p++) |
10926 breakat_flags[*p] = TRUE; | |
7 | 10927 } |
10928 | |
10929 # if defined(__BORLANDC__) && (__BORLANDC__ < 0x500) | |
133 | 10930 #pragma option -O.l |
7 | 10931 # endif |
10932 | |
10933 #endif | |
10934 | |
10935 /* | |
10936 * Check an option that can be a range of string values. | |
10937 * | |
10938 * Return OK for correct value, FAIL otherwise. | |
10939 * Empty is always OK. | |
10940 */ | |
10941 static int | |
10942 check_opt_strings(val, values, list) | |
10943 char_u *val; | |
10944 char **values; | |
10945 int list; /* when TRUE: accept a list of values */ | |
10946 { | |
10947 return opt_strings_flags(val, values, NULL, list); | |
10948 } | |
10949 | |
10950 /* | |
10951 * Handle an option that can be a range of string values. | |
10952 * Set a flag in "*flagp" for each string present. | |
10953 * | |
10954 * Return OK for correct value, FAIL otherwise. | |
10955 * Empty is always OK. | |
10956 */ | |
10957 static int | |
10958 opt_strings_flags(val, values, flagp, list) | |
10959 char_u *val; /* new value */ | |
10960 char **values; /* array of valid string values */ | |
10961 unsigned *flagp; | |
10962 int list; /* when TRUE: accept a list of values */ | |
10963 { | |
10964 int i; | |
10965 int len; | |
10966 unsigned new_flags = 0; | |
10967 | |
10968 while (*val) | |
10969 { | |
10970 for (i = 0; ; ++i) | |
10971 { | |
10972 if (values[i] == NULL) /* val not found in values[] */ | |
10973 return FAIL; | |
10974 | |
10975 len = (int)STRLEN(values[i]); | |
10976 if (STRNCMP(values[i], val, len) == 0 | |
10977 && ((list && val[len] == ',') || val[len] == NUL)) | |
10978 { | |
10979 val += len + (val[len] == ','); | |
10980 new_flags |= (1 << i); | |
10981 break; /* check next item in val list */ | |
10982 } | |
10983 } | |
10984 } | |
10985 if (flagp != NULL) | |
10986 *flagp = new_flags; | |
10987 | |
10988 return OK; | |
10989 } | |
10990 | |
10991 /* | |
10992 * Read the 'wildmode' option, fill wim_flags[]. | |
10993 */ | |
10994 static int | |
10995 check_opt_wim() | |
10996 { | |
10997 char_u new_wim_flags[4]; | |
10998 char_u *p; | |
10999 int i; | |
11000 int idx = 0; | |
11001 | |
11002 for (i = 0; i < 4; ++i) | |
11003 new_wim_flags[i] = 0; | |
11004 | |
11005 for (p = p_wim; *p; ++p) | |
11006 { | |
11007 for (i = 0; ASCII_ISALPHA(p[i]); ++i) | |
11008 ; | |
11009 if (p[i] != NUL && p[i] != ',' && p[i] != ':') | |
11010 return FAIL; | |
11011 if (i == 7 && STRNCMP(p, "longest", 7) == 0) | |
11012 new_wim_flags[idx] |= WIM_LONGEST; | |
11013 else if (i == 4 && STRNCMP(p, "full", 4) == 0) | |
11014 new_wim_flags[idx] |= WIM_FULL; | |
11015 else if (i == 4 && STRNCMP(p, "list", 4) == 0) | |
11016 new_wim_flags[idx] |= WIM_LIST; | |
11017 else | |
11018 return FAIL; | |
11019 p += i; | |
11020 if (*p == NUL) | |
11021 break; | |
11022 if (*p == ',') | |
11023 { | |
11024 if (idx == 3) | |
11025 return FAIL; | |
11026 ++idx; | |
11027 } | |
11028 } | |
11029 | |
11030 /* fill remaining entries with last flag */ | |
11031 while (idx < 3) | |
11032 { | |
11033 new_wim_flags[idx + 1] = new_wim_flags[idx]; | |
11034 ++idx; | |
11035 } | |
11036 | |
11037 /* only when there are no errors, wim_flags[] is changed */ | |
11038 for (i = 0; i < 4; ++i) | |
11039 wim_flags[i] = new_wim_flags[i]; | |
11040 return OK; | |
11041 } | |
11042 | |
11043 /* | |
11044 * Check if backspacing over something is allowed. | |
11045 */ | |
11046 int | |
11047 can_bs(what) | |
11048 int what; /* BS_INDENT, BS_EOL or BS_START */ | |
11049 { | |
11050 switch (*p_bs) | |
11051 { | |
11052 case '2': return TRUE; | |
11053 case '1': return (what != BS_START); | |
11054 case '0': return FALSE; | |
11055 } | |
11056 return vim_strchr(p_bs, what) != NULL; | |
11057 } | |
11058 | |
11059 /* | |
11060 * Save the current values of 'fileformat' and 'fileencoding', so that we know | |
11061 * the file must be considered changed when the value is different. | |
11062 */ | |
11063 void | |
11064 save_file_ff(buf) | |
11065 buf_T *buf; | |
11066 { | |
11067 buf->b_start_ffc = *buf->b_p_ff; | |
11068 buf->b_start_eol = buf->b_p_eol; | |
11069 #ifdef FEAT_MBYTE | |
1352 | 11070 buf->b_start_bomb = buf->b_p_bomb; |
11071 | |
7 | 11072 /* Only use free/alloc when necessary, they take time. */ |
11073 if (buf->b_start_fenc == NULL | |
11074 || STRCMP(buf->b_start_fenc, buf->b_p_fenc) != 0) | |
11075 { | |
11076 vim_free(buf->b_start_fenc); | |
11077 buf->b_start_fenc = vim_strsave(buf->b_p_fenc); | |
11078 } | |
11079 #endif | |
11080 } | |
11081 | |
11082 /* | |
11083 * Return TRUE if 'fileformat' and/or 'fileencoding' has a different value | |
11084 * from when editing started (save_file_ff() called). | |
1352 | 11085 * Also when 'endofline' was changed and 'binary' is set, or when 'bomb' was |
11086 * changed and 'binary' is not set. | |
7 | 11087 * Don't consider a new, empty buffer to be changed. |
11088 */ | |
11089 int | |
11090 file_ff_differs(buf) | |
11091 buf_T *buf; | |
11092 { | |
1319 | 11093 /* In a buffer that was never loaded the options are not valid. */ |
11094 if (buf->b_flags & BF_NEVERLOADED) | |
11095 return FALSE; | |
7 | 11096 if ((buf->b_flags & BF_NEW) |
11097 && buf->b_ml.ml_line_count == 1 | |
11098 && *ml_get_buf(buf, (linenr_T)1, FALSE) == NUL) | |
11099 return FALSE; | |
11100 if (buf->b_start_ffc != *buf->b_p_ff) | |
11101 return TRUE; | |
11102 if (buf->b_p_bin && buf->b_start_eol != buf->b_p_eol) | |
11103 return TRUE; | |
11104 #ifdef FEAT_MBYTE | |
1352 | 11105 if (!buf->b_p_bin && buf->b_start_bomb != buf->b_p_bomb) |
11106 return TRUE; | |
7 | 11107 if (buf->b_start_fenc == NULL) |
11108 return (*buf->b_p_fenc != NUL); | |
11109 return (STRCMP(buf->b_start_fenc, buf->b_p_fenc) != 0); | |
11110 #else | |
11111 return FALSE; | |
11112 #endif | |
11113 } | |
11114 | |
11115 /* | |
11116 * return OK if "p" is a valid fileformat name, FAIL otherwise. | |
11117 */ | |
11118 int | |
11119 check_ff_value(p) | |
11120 char_u *p; | |
11121 { | |
11122 return check_opt_strings(p, p_ff_values, FALSE); | |
11123 } |