blob: d45181d9d76f312a496d185f84b77ffbcdcf6604 [file] [log] [blame]
Bram Moolenaaredf3f972016-08-29 22:49:24 +02001/* vi:set ts=8 sts=4 sw=4 noet:
Bram Moolenaar071d4272004-06-13 20:20:40 +00002 *
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#include "vim.h"
11
Bram Moolenaar071d4272004-06-13 20:20:40 +000012/*
13 * Vim originated from Stevie version 3.6 (Fish disk 217) by GRWalter (Fred)
14 * It has been changed beyond recognition since then.
15 *
Bram Moolenaarabd56da2022-06-23 20:46:27 +010016 * Differences between version 8.2 and 9.0 can be found with ":help version9".
Bram Moolenaar640102482016-09-12 16:23:34 +020017 * Differences between version 7.4 and 8.x can be found with ":help version8".
18 * Differences between version 6.4 and 7.x can be found with ":help version7".
19 * Differences between version 5.8 and 6.x can be found with ":help version6".
Bram Moolenaar071d4272004-06-13 20:20:40 +000020 * Differences between version 4.x and 5.x can be found with ":help version5".
21 * Differences between version 3.0 and 4.x can be found with ":help version4".
22 * All the remarks about older versions have been removed, they are not very
23 * interesting.
24 */
25
26#include "version.h"
27
Bram Moolenaard042c562005-06-30 22:04:15 +000028char *Version = VIM_VERSION_SHORT;
29static char *mediumVersion = VIM_VERSION_MEDIUM;
Bram Moolenaar071d4272004-06-13 20:20:40 +000030
31#if defined(HAVE_DATE_TIME) || defined(PROTO)
32# if (defined(VMS) && defined(VAXC)) || defined(PROTO)
33char longVersion[sizeof(VIM_VERSION_LONG_DATE) + sizeof(__DATE__)
34 + sizeof(__TIME__) + 3];
Bram Moolenaar445f3032013-02-20 16:47:36 +010035
Bram Moolenaar071d4272004-06-13 20:20:40 +000036 void
Bram Moolenaar35fb6fb2018-06-23 16:12:21 +020037init_longVersion(void)
Bram Moolenaar071d4272004-06-13 20:20:40 +000038{
39 /*
40 * Construct the long version string. Necessary because
Bram Moolenaarbdace832019-03-02 10:13:42 +010041 * VAX C can't concatenate strings in the preprocessor.
Bram Moolenaar071d4272004-06-13 20:20:40 +000042 */
43 strcpy(longVersion, VIM_VERSION_LONG_DATE);
Bram Moolenaar8f1dde52020-06-05 23:16:29 +020044#ifdef BUILD_DATE
45 strcat(longVersion, BUILD_DATE);
46#else
Bram Moolenaar071d4272004-06-13 20:20:40 +000047 strcat(longVersion, __DATE__);
48 strcat(longVersion, " ");
49 strcat(longVersion, __TIME__);
Bram Moolenaar8f1dde52020-06-05 23:16:29 +020050#endif
Bram Moolenaar071d4272004-06-13 20:20:40 +000051 strcat(longVersion, ")");
52}
Bram Moolenaar35fb6fb2018-06-23 16:12:21 +020053
Bram Moolenaar071d4272004-06-13 20:20:40 +000054# else
Bram Moolenaar542ffe12021-09-17 20:45:30 +020055char *longVersion = NULL;
56
Bram Moolenaar35fb6fb2018-06-23 16:12:21 +020057 void
58init_longVersion(void)
59{
Yegappan Lakshmanan142ed772023-01-26 12:00:00 +000060 if (longVersion != NULL)
61 return;
Bram Moolenaar278e8382020-04-13 18:25:33 +020062
Yegappan Lakshmanan142ed772023-01-26 12:00:00 +000063#ifdef BUILD_DATE
64 char *date_time = BUILD_DATE;
65#else
66 char *date_time = __DATE__ " " __TIME__;
67#endif
68 char *msg = _("%s (%s, compiled %s)");
69 size_t len = strlen(msg)
70 + strlen(VIM_VERSION_LONG_ONLY)
71 + strlen(VIM_VERSION_DATE_ONLY)
72 + strlen(date_time);
73
74 longVersion = alloc(len);
75 if (longVersion == NULL)
76 longVersion = VIM_VERSION_LONG;
77 else
78 vim_snprintf(longVersion, len, msg,
79 VIM_VERSION_LONG_ONLY, VIM_VERSION_DATE_ONLY, date_time);
Bram Moolenaar35fb6fb2018-06-23 16:12:21 +020080}
Bram Moolenaar071d4272004-06-13 20:20:40 +000081# endif
82#else
83char *longVersion = VIM_VERSION_LONG;
Bram Moolenaareee3e942018-06-24 14:44:46 +020084
85 void
86init_longVersion(void)
87{
88 // nothing to do
89}
Bram Moolenaar071d4272004-06-13 20:20:40 +000090#endif
91
Bram Moolenaar071d4272004-06-13 20:20:40 +000092static char *(features[]) =
93{
Bram Moolenaarb5ef5e12013-08-30 16:35:44 +020094#ifdef HAVE_ACL
95 "+acl",
96#else
97 "-acl",
98#endif
Bram Moolenaaraa2f0ee2019-12-21 18:47:26 +010099#ifdef AMIGA // only for Amiga systems
Bram Moolenaar071d4272004-06-13 20:20:40 +0000100# ifdef FEAT_ARP
101 "+ARP",
102# else
103 "-ARP",
104# endif
105#endif
106#ifdef FEAT_ARABIC
107 "+arabic",
108#else
109 "-arabic",
110#endif
Bram Moolenaar071d4272004-06-13 20:20:40 +0000111 "+autocmd",
Bram Moolenaar83ec2a72018-07-27 22:08:59 +0200112#ifdef FEAT_AUTOCHDIR
113 "+autochdir",
114#else
115 "-autochdir",
116#endif
Bram Moolenaare42a6d22017-11-12 19:21:51 +0100117#ifdef FEAT_AUTOSERVERNAME
118 "+autoservername",
119#else
120 "-autoservername",
121#endif
Bram Moolenaarc3719bd2017-11-18 22:13:31 +0100122#ifdef FEAT_BEVAL_GUI
Bram Moolenaar071d4272004-06-13 20:20:40 +0000123 "+balloon_eval",
124#else
125 "-balloon_eval",
126#endif
Bram Moolenaarc3719bd2017-11-18 22:13:31 +0100127#ifdef FEAT_BEVAL_TERM
Bram Moolenaar51b0f372017-11-18 18:52:04 +0100128 "+balloon_eval_term",
129#else
130 "-balloon_eval_term",
131#endif
Bram Moolenaar071d4272004-06-13 20:20:40 +0000132#ifdef FEAT_BROWSE
133 "+browse",
134#else
135 "-browse",
136#endif
Bram Moolenaar071d4272004-06-13 20:20:40 +0000137 "++builtin_terms",
Bram Moolenaar071d4272004-06-13 20:20:40 +0000138#ifdef FEAT_BYTEOFF
139 "+byte_offset",
140#else
141 "-byte_offset",
142#endif
Bram Moolenaar509ce2a2016-03-11 22:52:15 +0100143#ifdef FEAT_JOB_CHANNEL
Bram Moolenaar5aec4812016-01-25 20:15:45 +0100144 "+channel",
145#else
146 "-channel",
147#endif
Bram Moolenaar071d4272004-06-13 20:20:40 +0000148 "+cindent",
Bram Moolenaar071d4272004-06-13 20:20:40 +0000149#ifdef FEAT_CLIENTSERVER
150 "+clientserver",
151#else
152 "-clientserver",
153#endif
154#ifdef FEAT_CLIPBOARD
155 "+clipboard",
156#else
157 "-clipboard",
158#endif
Bram Moolenaar071d4272004-06-13 20:20:40 +0000159 "+cmdline_compl",
Bram Moolenaar071d4272004-06-13 20:20:40 +0000160 "+cmdline_hist",
Bram Moolenaar071d4272004-06-13 20:20:40 +0000161 "+cmdline_info",
Bram Moolenaar071d4272004-06-13 20:20:40 +0000162 "+comments",
Bram Moolenaar860cae12010-06-05 23:22:07 +0200163#ifdef FEAT_CONCEAL
164 "+conceal",
165#else
166 "-conceal",
167#endif
Bram Moolenaar071d4272004-06-13 20:20:40 +0000168#ifdef FEAT_CRYPT
169 "+cryptv",
170#else
171 "-cryptv",
172#endif
173#ifdef FEAT_CSCOPE
174 "+cscope",
175#else
176 "-cscope",
177#endif
Bram Moolenaar860cae12010-06-05 23:22:07 +0200178 "+cursorbind",
Bram Moolenaar17c7c012006-01-26 22:25:15 +0000179#ifdef CURSOR_SHAPE
180 "+cursorshape",
181#else
182 "-cursorshape",
183#endif
Bram Moolenaar071d4272004-06-13 20:20:40 +0000184#if defined(FEAT_CON_DIALOG) && defined(FEAT_GUI_DIALOG)
185 "+dialog_con_gui",
186#else
187# if defined(FEAT_CON_DIALOG)
188 "+dialog_con",
189# else
190# if defined(FEAT_GUI_DIALOG)
191 "+dialog_gui",
192# else
193 "-dialog",
194# endif
195# endif
196#endif
197#ifdef FEAT_DIFF
198 "+diff",
199#else
200 "-diff",
201#endif
202#ifdef FEAT_DIGRAPHS
203 "+digraphs",
204#else
205 "-digraphs",
206#endif
Bram Moolenaar4f974752019-02-17 17:44:42 +0100207#ifdef FEAT_GUI_MSWIN
Bram Moolenaarb5a7a8b2014-08-06 14:52:30 +0200208# ifdef FEAT_DIRECTX
209 "+directx",
210# else
211 "-directx",
212# endif
213#endif
Bram Moolenaar071d4272004-06-13 20:20:40 +0000214#ifdef FEAT_DND
215 "+dnd",
216#else
217 "-dnd",
218#endif
Bram Moolenaar071d4272004-06-13 20:20:40 +0000219 "-ebcdic",
Bram Moolenaar071d4272004-06-13 20:20:40 +0000220#ifdef FEAT_EMACS_TAGS
221 "+emacs_tags",
222#else
223 "-emacs_tags",
224#endif
225#ifdef FEAT_EVAL
226 "+eval",
227#else
228 "-eval",
229#endif
Bram Moolenaar071d4272004-06-13 20:20:40 +0000230 "+ex_extra",
Bram Moolenaar071d4272004-06-13 20:20:40 +0000231#ifdef FEAT_SEARCH_EXTRA
232 "+extra_search",
233#else
234 "-extra_search",
235#endif
Bram Moolenaar071d4272004-06-13 20:20:40 +0000236 "-farsi",
Bram Moolenaar071d4272004-06-13 20:20:40 +0000237 "+file_in_path",
Bram Moolenaar071d4272004-06-13 20:20:40 +0000238#ifdef FEAT_FIND_ID
239 "+find_in_path",
240#else
241 "-find_in_path",
242#endif
Bram Moolenaar446cb832008-06-24 21:56:24 +0000243 "+float",
Bram Moolenaar071d4272004-06-13 20:20:40 +0000244#ifdef FEAT_FOLDING
245 "+folding",
246#else
247 "-folding",
248#endif
Bram Moolenaar071d4272004-06-13 20:20:40 +0000249 "-footer",
Bram Moolenaarc8ac3a02022-09-04 12:29:28 +0100250 // only interesting on Unix systems
Bram Moolenaar071d4272004-06-13 20:20:40 +0000251#if !defined(USE_SYSTEM) && defined(UNIX)
252 "+fork()",
253#endif
254#ifdef FEAT_GETTEXT
255# ifdef DYNAMIC_GETTEXT
256 "+gettext/dyn",
257# else
258 "+gettext",
259# endif
260#else
261 "-gettext",
262#endif
Bram Moolenaar071d4272004-06-13 20:20:40 +0000263 "-hangul_input",
Bram Moolenaar071d4272004-06-13 20:20:40 +0000264#if (defined(HAVE_ICONV_H) && defined(USE_ICONV)) || defined(DYNAMIC_ICONV)
265# ifdef DYNAMIC_ICONV
266 "+iconv/dyn",
267# else
268 "+iconv",
269# endif
270#else
271 "-iconv",
272#endif
Bram Moolenaar071d4272004-06-13 20:20:40 +0000273 "+insert_expand",
Bram Moolenaar352f5542020-04-13 19:04:21 +0200274#ifdef FEAT_IPV6
275 "+ipv6",
276#else
277 "-ipv6",
278#endif
Bram Moolenaar509ce2a2016-03-11 22:52:15 +0100279#ifdef FEAT_JOB_CHANNEL
Bram Moolenaar835dc632016-02-07 14:27:38 +0100280 "+job",
281#else
282 "-job",
283#endif
Bram Moolenaar071d4272004-06-13 20:20:40 +0000284 "+jumplist",
Bram Moolenaar071d4272004-06-13 20:20:40 +0000285#ifdef FEAT_KEYMAP
286 "+keymap",
287#else
288 "-keymap",
289#endif
Bram Moolenaar9532fe72016-07-29 22:50:35 +0200290#ifdef FEAT_EVAL
291 "+lambda",
292#else
293 "-lambda",
294#endif
Bram Moolenaar071d4272004-06-13 20:20:40 +0000295#ifdef FEAT_LANGMAP
296 "+langmap",
297#else
298 "-langmap",
299#endif
300#ifdef FEAT_LIBCALL
301 "+libcall",
302#else
303 "-libcall",
304#endif
305#ifdef FEAT_LINEBREAK
306 "+linebreak",
307#else
308 "-linebreak",
309#endif
Bram Moolenaar071d4272004-06-13 20:20:40 +0000310 "+lispindent",
Bram Moolenaar071d4272004-06-13 20:20:40 +0000311 "+listcmds",
Bram Moolenaar071d4272004-06-13 20:20:40 +0000312 "+localmap",
Bram Moolenaar0ba04292010-07-14 23:23:17 +0200313#ifdef FEAT_LUA
314# ifdef DYNAMIC_LUA
315 "+lua/dyn",
316# else
317 "+lua",
318# endif
319#else
320 "-lua",
321#endif
Bram Moolenaar071d4272004-06-13 20:20:40 +0000322#ifdef FEAT_MENU
323 "+menu",
324#else
325 "-menu",
326#endif
327#ifdef FEAT_SESSION
328 "+mksession",
329#else
330 "-mksession",
331#endif
Bram Moolenaar071d4272004-06-13 20:20:40 +0000332 "+modify_fname",
Bram Moolenaar071d4272004-06-13 20:20:40 +0000333 "+mouse",
Bram Moolenaara1cb1d12019-10-17 23:00:07 +0200334#ifdef FEAT_MOUSESHAPE
Bram Moolenaar071d4272004-06-13 20:20:40 +0000335 "+mouseshape",
Bram Moolenaara1cb1d12019-10-17 23:00:07 +0200336#else
Bram Moolenaar071d4272004-06-13 20:20:40 +0000337 "-mouseshape",
Bram Moolenaar071d4272004-06-13 20:20:40 +0000338#endif
Bram Moolenaar707cfb82012-10-21 04:00:07 +0200339
Bram Moolenaar071d4272004-06-13 20:20:40 +0000340#if defined(UNIX) || defined(VMS)
341# ifdef FEAT_MOUSE_DEC
342 "+mouse_dec",
343# else
344 "-mouse_dec",
345# endif
346# ifdef FEAT_MOUSE_GPM
Bram Moolenaar33fc4a62022-02-23 18:07:38 +0000347# ifdef DYNAMIC_GPM
348 "+mouse_gpm/dyn",
349# else
Bram Moolenaar071d4272004-06-13 20:20:40 +0000350 "+mouse_gpm",
Bram Moolenaar33fc4a62022-02-23 18:07:38 +0000351# endif
Bram Moolenaar071d4272004-06-13 20:20:40 +0000352# else
353 "-mouse_gpm",
354# endif
355# ifdef FEAT_MOUSE_JSB
356 "+mouse_jsbterm",
357# else
358 "-mouse_jsbterm",
359# endif
360# ifdef FEAT_MOUSE_NET
361 "+mouse_netterm",
362# else
363 "-mouse_netterm",
364# endif
Bram Moolenaar071d4272004-06-13 20:20:40 +0000365#endif
Bram Moolenaar707cfb82012-10-21 04:00:07 +0200366
Bram Moolenaar071d4272004-06-13 20:20:40 +0000367#ifdef __QNX__
368# ifdef FEAT_MOUSE_PTERM
369 "+mouse_pterm",
370# else
371 "-mouse_pterm",
372# endif
373#endif
Bram Moolenaar707cfb82012-10-21 04:00:07 +0200374
375#if defined(UNIX) || defined(VMS)
Bram Moolenaar707cfb82012-10-21 04:00:07 +0200376 "+mouse_sgr",
Bram Moolenaar707cfb82012-10-21 04:00:07 +0200377# ifdef FEAT_SYSMOUSE
378 "+mouse_sysmouse",
379# else
380 "-mouse_sysmouse",
381# endif
382# ifdef FEAT_MOUSE_URXVT
383 "+mouse_urxvt",
384# else
385 "-mouse_urxvt",
386# endif
Bram Moolenaar707cfb82012-10-21 04:00:07 +0200387 "+mouse_xterm",
Bram Moolenaar707cfb82012-10-21 04:00:07 +0200388#endif
389
Bram Moolenaar071d4272004-06-13 20:20:40 +0000390#ifdef FEAT_MBYTE_IME
391# ifdef DYNAMIC_IME
392 "+multi_byte_ime/dyn",
393# else
394 "+multi_byte_ime",
395# endif
396#else
Bram Moolenaar071d4272004-06-13 20:20:40 +0000397 "+multi_byte",
Bram Moolenaar071d4272004-06-13 20:20:40 +0000398#endif
399#ifdef FEAT_MULTI_LANG
400 "+multi_lang",
401#else
402 "-multi_lang",
403#endif
Bram Moolenaar325b7a22004-07-05 15:58:32 +0000404#ifdef FEAT_MZSCHEME
Bram Moolenaardf3267e2005-01-25 22:07:05 +0000405# ifdef DYNAMIC_MZSCHEME
406 "+mzscheme/dyn",
407# else
Bram Moolenaar325b7a22004-07-05 15:58:32 +0000408 "+mzscheme",
Bram Moolenaardf3267e2005-01-25 22:07:05 +0000409# endif
Bram Moolenaar325b7a22004-07-05 15:58:32 +0000410#else
411 "-mzscheme",
412#endif
Bram Moolenaar071d4272004-06-13 20:20:40 +0000413#ifdef FEAT_NETBEANS_INTG
414 "+netbeans_intg",
415#else
416 "-netbeans_intg",
417#endif
Bram Moolenaar22fcfad2016-07-01 18:17:26 +0200418 "+num64",
Bram Moolenaar4f974752019-02-17 17:44:42 +0100419#ifdef FEAT_GUI_MSWIN
Bram Moolenaar071d4272004-06-13 20:20:40 +0000420# ifdef FEAT_OLE
421 "+ole",
422# else
423 "-ole",
424# endif
425#endif
Bram Moolenaar6183ccb2018-07-22 05:08:11 +0200426#ifdef FEAT_EVAL
Bram Moolenaarf6fee0e2016-02-21 23:02:49 +0100427 "+packages",
Bram Moolenaar6183ccb2018-07-22 05:08:11 +0200428#else
429 "-packages",
430#endif
Bram Moolenaar071d4272004-06-13 20:20:40 +0000431 "+path_extra",
Bram Moolenaar071d4272004-06-13 20:20:40 +0000432#ifdef FEAT_PERL
433# ifdef DYNAMIC_PERL
434 "+perl/dyn",
435# else
436 "+perl",
437# endif
438#else
439 "-perl",
440#endif
Bram Moolenaar55debbe2010-05-23 23:34:36 +0200441#ifdef FEAT_PERSISTENT_UNDO
442 "+persistent_undo",
443#else
444 "-persistent_undo",
445#endif
Bram Moolenaar05ad5ff2019-11-30 22:48:27 +0100446#ifdef FEAT_PROP_POPUP
447 "+popupwin",
448#else
449 "-popupwin",
450#endif
Bram Moolenaar071d4272004-06-13 20:20:40 +0000451#ifdef FEAT_PRINTER
452# ifdef FEAT_POSTSCRIPT
453 "+postscript",
454# else
455 "-postscript",
456# endif
457 "+printer",
458#else
459 "-printer",
460#endif
Bram Moolenaar05159a02005-02-26 23:04:13 +0000461#ifdef FEAT_PROFILE
462 "+profile",
463#else
464 "-profile",
465#endif
Bram Moolenaar071d4272004-06-13 20:20:40 +0000466#ifdef FEAT_PYTHON
467# ifdef DYNAMIC_PYTHON
468 "+python/dyn",
469# else
470 "+python",
471# endif
472#else
473 "-python",
474#endif
Bram Moolenaarbd5e15f2010-07-17 21:19:38 +0200475#ifdef FEAT_PYTHON3
476# ifdef DYNAMIC_PYTHON3
Yee Cheng Chinc13b3d12023-08-20 21:18:38 +0200477# ifdef DYNAMIC_PYTHON3_STABLE_ABI
478 "+python3/dyn-stable",
479# else
Bram Moolenaarbd5e15f2010-07-17 21:19:38 +0200480 "+python3/dyn",
Yee Cheng Chinc13b3d12023-08-20 21:18:38 +0200481# endif
Bram Moolenaarbd5e15f2010-07-17 21:19:38 +0200482# else
483 "+python3",
484# endif
485#else
486 "-python3",
487#endif
Bram Moolenaar071d4272004-06-13 20:20:40 +0000488#ifdef FEAT_QUICKFIX
489 "+quickfix",
490#else
491 "-quickfix",
492#endif
Bram Moolenaard68071d2006-05-02 22:08:30 +0000493#ifdef FEAT_RELTIME
494 "+reltime",
495#else
496 "-reltime",
497#endif
Bram Moolenaar071d4272004-06-13 20:20:40 +0000498#ifdef FEAT_RIGHTLEFT
499 "+rightleft",
500#else
501 "-rightleft",
502#endif
503#ifdef FEAT_RUBY
504# ifdef DYNAMIC_RUBY
505 "+ruby/dyn",
506# else
507 "+ruby",
508# endif
509#else
510 "-ruby",
511#endif
Bram Moolenaar071d4272004-06-13 20:20:40 +0000512 "+scrollbind",
Bram Moolenaar071d4272004-06-13 20:20:40 +0000513#ifdef FEAT_SIGNS
514 "+signs",
515#else
516 "-signs",
517#endif
Bram Moolenaar071d4272004-06-13 20:20:40 +0000518 "+smartindent",
Christian Brabandtf573c6e2021-06-20 14:02:16 +0200519#ifdef FEAT_SODIUM
K.Takatad68b2fc2022-02-12 11:18:37 +0000520# ifdef DYNAMIC_SODIUM
521 "+sodium/dyn",
522# else
Christian Brabandtf573c6e2021-06-20 14:02:16 +0200523 "+sodium",
K.Takatad68b2fc2022-02-12 11:18:37 +0000524# endif
Christian Brabandtf573c6e2021-06-20 14:02:16 +0200525#else
526 "-sodium",
527#endif
Bram Moolenaar427f5b62019-06-09 13:43:51 +0200528#ifdef FEAT_SOUND
529 "+sound",
530#else
531 "-sound",
532#endif
533#ifdef FEAT_SPELL
534 "+spell",
535#else
536 "-spell",
537#endif
Bram Moolenaaref94eec2009-11-11 13:22:11 +0000538#ifdef STARTUPTIME
539 "+startuptime",
540#else
541 "-startuptime",
542#endif
Bram Moolenaar071d4272004-06-13 20:20:40 +0000543#ifdef FEAT_STL_OPT
544 "+statusline",
545#else
546 "-statusline",
547#endif
Bram Moolenaar071d4272004-06-13 20:20:40 +0000548 "-sun_workshop",
Bram Moolenaar071d4272004-06-13 20:20:40 +0000549#ifdef FEAT_SYN_HL
550 "+syntax",
551#else
552 "-syntax",
553#endif
Bram Moolenaaraa2f0ee2019-12-21 18:47:26 +0100554 // only interesting on Unix systems
Bram Moolenaara06ecab2016-07-16 14:47:36 +0200555#if defined(USE_SYSTEM) && defined(UNIX)
Bram Moolenaar071d4272004-06-13 20:20:40 +0000556 "+system()",
557#endif
Bram Moolenaar071d4272004-06-13 20:20:40 +0000558 "+tag_binary",
Bram Moolenaar071d4272004-06-13 20:20:40 +0000559 "-tag_old_static",
Bram Moolenaar071d4272004-06-13 20:20:40 +0000560 "-tag_any_white",
Bram Moolenaar071d4272004-06-13 20:20:40 +0000561#ifdef FEAT_TCL
562# ifdef DYNAMIC_TCL
563 "+tcl/dyn",
564# else
565 "+tcl",
566# endif
567#else
568 "-tcl",
569#endif
Bram Moolenaar61be73b2016-04-29 22:59:22 +0200570#ifdef FEAT_TERMGUICOLORS
571 "+termguicolors",
572#else
573 "-termguicolors",
574#endif
Bram Moolenaar26e85582017-07-15 20:05:54 +0200575#ifdef FEAT_TERMINAL
576 "+terminal",
577#else
578 "-terminal",
579#endif
Bram Moolenaara06ecab2016-07-16 14:47:36 +0200580#if defined(UNIX)
Bram Moolenaaraa2f0ee2019-12-21 18:47:26 +0100581// only Unix can have terminfo instead of termcap
Bram Moolenaar071d4272004-06-13 20:20:40 +0000582# ifdef TERMINFO
583 "+terminfo",
584# else
585 "-terminfo",
586# endif
Bram Moolenaar071d4272004-06-13 20:20:40 +0000587#endif
588#ifdef FEAT_TERMRESPONSE
589 "+termresponse",
590#else
591 "-termresponse",
592#endif
Bram Moolenaar071d4272004-06-13 20:20:40 +0000593 "+textobjects",
Bram Moolenaar05ad5ff2019-11-30 22:48:27 +0100594#ifdef FEAT_PROP_POPUP
Bram Moolenaar98aefe72018-12-13 22:20:09 +0100595 "+textprop",
596#else
597 "-textprop",
598#endif
599#if !defined(UNIX)
Bram Moolenaaraa2f0ee2019-12-21 18:47:26 +0100600// unix always includes termcap support
Bram Moolenaar98aefe72018-12-13 22:20:09 +0100601# ifdef HAVE_TGETENT
602 "+tgetent",
603# else
604 "-tgetent",
605# endif
606#endif
Bram Moolenaar975b5272016-03-15 23:10:59 +0100607#ifdef FEAT_TIMERS
608 "+timers",
609#else
610 "-timers",
611#endif
Bram Moolenaar071d4272004-06-13 20:20:40 +0000612 "+title",
Bram Moolenaar071d4272004-06-13 20:20:40 +0000613#ifdef FEAT_TOOLBAR
614 "+toolbar",
615#else
616 "-toolbar",
617#endif
Bram Moolenaar071d4272004-06-13 20:20:40 +0000618 "+user_commands",
Bram Moolenaar04958cb2018-06-23 19:23:02 +0200619#ifdef FEAT_VARTABS
620 "+vartabs",
621#else
622 "-vartabs",
623#endif
Bram Moolenaar071d4272004-06-13 20:20:40 +0000624 "+vertsplit",
Bram Moolenaara6feb162022-01-02 12:06:33 +0000625 "+vim9script",
Bram Moolenaar071d4272004-06-13 20:20:40 +0000626#ifdef FEAT_VIMINFO
627 "+viminfo",
628#else
629 "-viminfo",
630#endif
Bram Moolenaara6feb162022-01-02 12:06:33 +0000631 "+virtualedit",
632 "+visual",
633 "+visualextra",
Bram Moolenaar071d4272004-06-13 20:20:40 +0000634 "+vreplace",
Bram Moolenaar4f974752019-02-17 17:44:42 +0100635#ifdef MSWIN
Bram Moolenaarcafafb32018-02-22 21:07:09 +0100636# ifdef FEAT_VTP
637 "+vtp",
638# else
639 "-vtp",
640# endif
641#endif
Bram Moolenaar071d4272004-06-13 20:20:40 +0000642 "+wildignore",
Bram Moolenaar071d4272004-06-13 20:20:40 +0000643 "+wildmenu",
Bram Moolenaar071d4272004-06-13 20:20:40 +0000644 "+windows",
Bram Moolenaar071d4272004-06-13 20:20:40 +0000645#ifdef FEAT_WRITEBACKUP
646 "+writebackup",
647#else
648 "-writebackup",
649#endif
650#if defined(UNIX) || defined(VMS)
651# ifdef FEAT_X11
652 "+X11",
653# else
654 "-X11",
655# endif
656#endif
Christian Brabandte085dfd2023-09-30 12:49:18 +0200657# ifdef FEAT_XATTR
658 "+xattr",
659# else
660 "-xattr",
661# endif
Bram Moolenaar071d4272004-06-13 20:20:40 +0000662#ifdef FEAT_XFONTSET
663 "+xfontset",
664#else
665 "-xfontset",
666#endif
667#ifdef FEAT_XIM
668 "+xim",
669#else
670 "-xim",
671#endif
ichizok02560422022-04-05 14:18:44 +0100672#if defined(MSWIN)
Bram Moolenaard58b0f92016-08-13 16:39:56 +0200673# ifdef FEAT_XPM_W32
674 "+xpm_w32",
675# else
676 "-xpm_w32",
677# endif
ichizok02560422022-04-05 14:18:44 +0100678#elif defined(HAVE_XPM)
Bram Moolenaard58b0f92016-08-13 16:39:56 +0200679 "+xpm",
ichizok02560422022-04-05 14:18:44 +0100680#else
Bram Moolenaard58b0f92016-08-13 16:39:56 +0200681 "-xpm",
Bram Moolenaard58b0f92016-08-13 16:39:56 +0200682#endif
Bram Moolenaar071d4272004-06-13 20:20:40 +0000683#if defined(UNIX) || defined(VMS)
ichizok02560422022-04-05 14:18:44 +0100684# if defined(USE_XSMP_INTERACT)
Bram Moolenaar071d4272004-06-13 20:20:40 +0000685 "+xsmp_interact",
ichizok02560422022-04-05 14:18:44 +0100686# elif defined(USE_XSMP)
Bram Moolenaar071d4272004-06-13 20:20:40 +0000687 "+xsmp",
ichizok02560422022-04-05 14:18:44 +0100688# else
Bram Moolenaar071d4272004-06-13 20:20:40 +0000689 "-xsmp",
Bram Moolenaar071d4272004-06-13 20:20:40 +0000690# endif
691# ifdef FEAT_XCLIPBOARD
692 "+xterm_clipboard",
693# else
694 "-xterm_clipboard",
695# endif
696#endif
697#ifdef FEAT_XTERM_SAVE
698 "+xterm_save",
699#else
700 "-xterm_save",
701#endif
Bram Moolenaar071d4272004-06-13 20:20:40 +0000702 NULL
703};
704
705static int included_patches[] =
706{ /* Add new patch number below this line */
707/**/
Christian Brabandtd2cc51f2024-01-04 22:54:08 +0100708 11,
709/**/
Doug Kearns81642d92024-01-04 22:37:44 +0100710 10,
711/**/
Yegappan Lakshmananf93b1c82024-01-04 22:28:46 +0100712 9,
713/**/
Christian Brabandt30994d62024-01-04 22:14:28 +0100714 8,
715/**/
Christian Brabandtad4d7f42024-01-04 21:43:36 +0100716 7,
717/**/
Keith Thompson184f71c2024-01-04 21:19:04 +0100718 6,
719/**/
Zoltan Arpadffy4d8cb682024-01-04 21:01:13 +0100720 5,
721/**/
Gregory Anders83ad2722024-01-03 19:48:51 +0100722 4,
723/**/
Isao Sato443657b2024-01-03 19:31:05 +0100724 3,
725/**/
Shota Nozaki0689b872024-01-03 19:18:43 +0100726 2,
727/**/
Sean Dewarbf44b692024-01-03 18:52:52 +0100728 1,
729/**/
Bram Moolenaar071d4272004-06-13 20:20:40 +0000730 0
731};
732
Bram Moolenaar10d4cec2008-11-30 11:15:09 +0000733/*
734 * Place to put a short description when adding a feature with a patch.
735 * Keep it short, e.g.,: "relative numbers", "persistent undo".
736 * Also add a comment marker to separate the lines.
737 * See the official Vim patches for the diff format: It must use a context of
Bram Moolenaarcbb8eb32008-12-24 13:25:14 +0000738 * one line only. Create it by hand or use "diff -C2" and edit the patch.
Bram Moolenaar10d4cec2008-11-30 11:15:09 +0000739 */
740static char *(extra_patches[]) =
741{ /* Add your patch description below this line */
742/**/
743 NULL
744};
745
Bram Moolenaar071d4272004-06-13 20:20:40 +0000746 int
Bram Moolenaarb638a7b2016-01-30 21:29:58 +0100747highest_patch(void)
Bram Moolenaar071d4272004-06-13 20:20:40 +0000748{
Bram Moolenaar37df9a42019-06-14 14:39:51 +0200749 // this relies on the highest patch number to be the first entry
750 return included_patches[0];
Bram Moolenaar071d4272004-06-13 20:20:40 +0000751}
752
753#if defined(FEAT_EVAL) || defined(PROTO)
754/*
755 * Return TRUE if patch "n" has been included.
756 */
757 int
Bram Moolenaarb638a7b2016-01-30 21:29:58 +0100758has_patch(int n)
Bram Moolenaar071d4272004-06-13 20:20:40 +0000759{
Bram Moolenaar232f4612020-11-10 20:54:29 +0100760 int h, m, l;
Bram Moolenaar071d4272004-06-13 20:20:40 +0000761
Bram Moolenaar232f4612020-11-10 20:54:29 +0100762 // Perform a binary search.
763 l = 0;
K.Takataeeec2542021-06-02 13:28:16 +0200764 h = (int)ARRAY_LENGTH(included_patches) - 1;
Bram Moolenaarb0375d42022-06-30 11:03:39 +0100765 for (;;)
Bram Moolenaar232f4612020-11-10 20:54:29 +0100766 {
767 m = (l + h) / 2;
768 if (included_patches[m] == n)
Bram Moolenaar071d4272004-06-13 20:20:40 +0000769 return TRUE;
Bram Moolenaarb0375d42022-06-30 11:03:39 +0100770 if (l == h)
771 break;
Bram Moolenaar232f4612020-11-10 20:54:29 +0100772 if (included_patches[m] < n)
773 h = m;
774 else
775 l = m + 1;
776 }
Bram Moolenaar071d4272004-06-13 20:20:40 +0000777 return FALSE;
778}
779#endif
780
781 void
Bram Moolenaarb638a7b2016-01-30 21:29:58 +0100782ex_version(exarg_T *eap)
Bram Moolenaar071d4272004-06-13 20:20:40 +0000783{
784 /*
785 * Ignore a ":version 9.99" command.
786 */
787 if (*eap->arg == NUL)
788 {
789 msg_putchar('\n');
790 list_version();
791 }
792}
793
Bram Moolenaar445f3032013-02-20 16:47:36 +0100794/*
Bram Moolenaar5d69da42018-04-20 22:01:41 +0200795 * Output a string for the version message. If it's going to wrap, output a
796 * newline, unless the message is too long to fit on the screen anyway.
797 * When "wrap" is TRUE wrap the string in [].
798 */
799 static void
800version_msg_wrap(char_u *s, int wrap)
801{
=?UTF-8?q?Dundar=20G=C3=B6c?=dfa5e462021-10-02 11:26:51 +0100802 int len = vim_strsize(s) + (wrap ? 2 : 0);
Bram Moolenaar5d69da42018-04-20 22:01:41 +0200803
804 if (!got_int && len < (int)Columns && msg_col + len >= (int)Columns
805 && *s != '\n')
806 msg_putchar('\n');
807 if (!got_int)
808 {
809 if (wrap)
Bram Moolenaar32526b32019-01-19 17:43:09 +0100810 msg_puts("[");
811 msg_puts((char *)s);
Bram Moolenaar5d69da42018-04-20 22:01:41 +0200812 if (wrap)
Bram Moolenaar32526b32019-01-19 17:43:09 +0100813 msg_puts("]");
Bram Moolenaar5d69da42018-04-20 22:01:41 +0200814 }
815}
816
817 static void
818version_msg(char *s)
819{
820 version_msg_wrap((char_u *)s, FALSE);
821}
822
823/*
Bram Moolenaar445f3032013-02-20 16:47:36 +0100824 * List all features aligned in columns, dictionary style.
825 */
826 static void
Bram Moolenaarb638a7b2016-01-30 21:29:58 +0100827list_features(void)
Bram Moolenaar445f3032013-02-20 16:47:36 +0100828{
Bram Moolenaar5d69da42018-04-20 22:01:41 +0200829 list_in_columns((char_u **)features, -1, -1);
830}
831
832/*
833 * List string items nicely aligned in columns.
834 * When "size" is < 0 then the last entry is marked with NULL.
835 * The entry with index "current" is inclosed in [].
836 */
837 void
838list_in_columns(char_u **items, int size, int current)
839{
Bram Moolenaar445f3032013-02-20 16:47:36 +0100840 int i;
841 int ncol;
842 int nrow;
Bram Moolenaar949f1982019-07-23 23:00:08 +0200843 int cur_row = 1;
Bram Moolenaar5d69da42018-04-20 22:01:41 +0200844 int item_count = 0;
Bram Moolenaar445f3032013-02-20 16:47:36 +0100845 int width = 0;
Bram Moolenaarc85ffc92019-01-02 17:26:35 +0100846#ifdef FEAT_SYN_HL
847 int use_highlight = (items == (char_u **)features);
848#endif
Bram Moolenaar445f3032013-02-20 16:47:36 +0100849
Bram Moolenaaraa2f0ee2019-12-21 18:47:26 +0100850 // Find the length of the longest item, use that + 1 as the column
851 // width.
Bram Moolenaar5d69da42018-04-20 22:01:41 +0200852 for (i = 0; size < 0 ? items[i] != NULL : i < size; ++i)
Bram Moolenaar445f3032013-02-20 16:47:36 +0100853 {
=?UTF-8?q?Dundar=20G=C3=B6c?=dfa5e462021-10-02 11:26:51 +0100854 int l = vim_strsize(items[i]) + (i == current ? 2 : 0);
Bram Moolenaar445f3032013-02-20 16:47:36 +0100855
856 if (l > width)
857 width = l;
Bram Moolenaar5d69da42018-04-20 22:01:41 +0200858 ++item_count;
Bram Moolenaar445f3032013-02-20 16:47:36 +0100859 }
860 width += 1;
861
862 if (Columns < width)
863 {
Bram Moolenaar9800bfe2019-07-27 21:23:45 +0200864 // Not enough screen columns - show one per line
Bram Moolenaare961cba2018-09-18 21:51:47 +0200865 for (i = 0; i < item_count; ++i)
Bram Moolenaar445f3032013-02-20 16:47:36 +0100866 {
Bram Moolenaar5d69da42018-04-20 22:01:41 +0200867 version_msg_wrap(items[i], i == current);
Bram Moolenaar9800bfe2019-07-27 21:23:45 +0200868 if (msg_col > 0 && i < item_count - 1)
Bram Moolenaar445f3032013-02-20 16:47:36 +0100869 msg_putchar('\n');
870 }
871 return;
872 }
873
Bram Moolenaar949f1982019-07-23 23:00:08 +0200874 // The rightmost column doesn't need a separator.
875 // Sacrifice it to fit in one more column if possible.
Bram Moolenaarf13f45d2013-02-26 15:27:23 +0100876 ncol = (int) (Columns + 1) / width;
K.Takata54119102022-02-03 13:33:03 +0000877 nrow = item_count / ncol + ((item_count % ncol) ? 1 : 0);
Bram Moolenaar445f3032013-02-20 16:47:36 +0100878
Bram Moolenaar9800bfe2019-07-27 21:23:45 +0200879 // "i" counts columns then rows. "idx" counts rows then columns.
Bram Moolenaar445f3032013-02-20 16:47:36 +0100880 for (i = 0; !got_int && i < nrow * ncol; ++i)
881 {
882 int idx = (i / ncol) + (i % ncol) * nrow;
883
Bram Moolenaar5d69da42018-04-20 22:01:41 +0200884 if (idx < item_count)
Bram Moolenaar445f3032013-02-20 16:47:36 +0100885 {
886 int last_col = (i + 1) % ncol == 0;
887
Bram Moolenaar5d69da42018-04-20 22:01:41 +0200888 if (idx == current)
889 msg_putchar('[');
Bram Moolenaarc85ffc92019-01-02 17:26:35 +0100890#ifdef FEAT_SYN_HL
891 if (use_highlight && items[idx][0] == '-')
Bram Moolenaar32526b32019-01-19 17:43:09 +0100892 msg_puts_attr((char *)items[idx], HL_ATTR(HLF_W));
Bram Moolenaarc85ffc92019-01-02 17:26:35 +0100893 else
894#endif
Bram Moolenaar32526b32019-01-19 17:43:09 +0100895 msg_puts((char *)items[idx]);
Bram Moolenaar5d69da42018-04-20 22:01:41 +0200896 if (idx == current)
897 msg_putchar(']');
Bram Moolenaar445f3032013-02-20 16:47:36 +0100898 if (last_col)
899 {
Bram Moolenaar949f1982019-07-23 23:00:08 +0200900 if (msg_col > 0 && cur_row < nrow)
Bram Moolenaar445f3032013-02-20 16:47:36 +0100901 msg_putchar('\n');
Bram Moolenaar949f1982019-07-23 23:00:08 +0200902 ++cur_row;
Bram Moolenaar445f3032013-02-20 16:47:36 +0100903 }
904 else
905 {
906 while (msg_col % width)
907 msg_putchar(' ');
908 }
909 }
Bram Moolenaar74da3932019-07-25 21:52:39 +0200910 else
911 {
912 // this row is out of items, thus at the end of the row
Bram Moolenaar9800bfe2019-07-27 21:23:45 +0200913 if (msg_col > 0)
914 {
915 if (cur_row < nrow)
916 msg_putchar('\n');
917 ++cur_row;
918 }
Bram Moolenaar74da3932019-07-25 21:52:39 +0200919 }
Bram Moolenaar445f3032013-02-20 16:47:36 +0100920 }
921}
Bram Moolenaar5c962632013-02-26 11:25:33 +0100922
Bram Moolenaar071d4272004-06-13 20:20:40 +0000923 void
Bram Moolenaarb638a7b2016-01-30 21:29:58 +0100924list_version(void)
Bram Moolenaar071d4272004-06-13 20:20:40 +0000925{
926 int i;
927 int first;
928 char *s = "";
929
930 /*
931 * When adding features here, don't forget to update the list of
932 * internal variables in eval.c!
933 */
Bram Moolenaar35fb6fb2018-06-23 16:12:21 +0200934 init_longVersion();
Bram Moolenaar32526b32019-01-19 17:43:09 +0100935 msg(longVersion);
Bram Moolenaar4f974752019-02-17 17:44:42 +0100936#ifdef MSWIN
937# ifdef FEAT_GUI_MSWIN
Bram Moolenaarafde13b2019-04-28 19:46:49 +0200938# ifdef VIMDLL
939# ifdef _WIN64
940 msg_puts(_("\nMS-Windows 64-bit GUI/console version"));
941# else
942 msg_puts(_("\nMS-Windows 32-bit GUI/console version"));
943# endif
Bram Moolenaarcea912a2016-10-12 14:20:24 +0200944# else
Bram Moolenaarafde13b2019-04-28 19:46:49 +0200945# ifdef _WIN64
946 msg_puts(_("\nMS-Windows 64-bit GUI version"));
947# else
Bram Moolenaar32526b32019-01-19 17:43:09 +0100948 msg_puts(_("\nMS-Windows 32-bit GUI version"));
Bram Moolenaarafde13b2019-04-28 19:46:49 +0200949# endif
Bram Moolenaar071d4272004-06-13 20:20:40 +0000950# endif
Bram Moolenaar4f974752019-02-17 17:44:42 +0100951# ifdef FEAT_OLE
Bram Moolenaar32526b32019-01-19 17:43:09 +0100952 msg_puts(_(" with OLE support"));
Bram Moolenaar4f974752019-02-17 17:44:42 +0100953# endif
Bram Moolenaar071d4272004-06-13 20:20:40 +0000954# else
Bram Moolenaare7cb9cf2008-06-20 14:32:41 +0000955# ifdef _WIN64
Bram Moolenaar32526b32019-01-19 17:43:09 +0100956 msg_puts(_("\nMS-Windows 64-bit console version"));
Bram Moolenaare7cb9cf2008-06-20 14:32:41 +0000957# else
Bram Moolenaar32526b32019-01-19 17:43:09 +0100958 msg_puts(_("\nMS-Windows 32-bit console version"));
Bram Moolenaare7cb9cf2008-06-20 14:32:41 +0000959# endif
Bram Moolenaar071d4272004-06-13 20:20:40 +0000960# endif
961#endif
Bram Moolenaard0573012017-10-28 21:11:06 +0200962#if defined(MACOS_X)
963# if defined(MACOS_X_DARWIN)
Bram Moolenaar32526b32019-01-19 17:43:09 +0100964 msg_puts(_("\nmacOS version"));
Bram Moolenaard0573012017-10-28 21:11:06 +0200965# else
Bram Moolenaar32526b32019-01-19 17:43:09 +0100966 msg_puts(_("\nmacOS version w/o darwin feat."));
Bram Moolenaar071d4272004-06-13 20:20:40 +0000967# endif
Bram Moolenaar8c9d98a2020-12-21 13:05:57 +0100968# if defined(__arm64__)
969 msg_puts(" - arm64");
970# elif defined(__x86_64__)
971 msg_puts(" - x86_64");
972# endif
Bram Moolenaar071d4272004-06-13 20:20:40 +0000973#endif
974
Bram Moolenaar071d4272004-06-13 20:20:40 +0000975#ifdef VMS
Bram Moolenaar32526b32019-01-19 17:43:09 +0100976 msg_puts(_("\nOpenVMS version"));
Bram Moolenaar3d20ca12006-11-28 16:43:58 +0000977# ifdef HAVE_PATHDEF
978 if (*compiled_arch != NUL)
979 {
Bram Moolenaar32526b32019-01-19 17:43:09 +0100980 msg_puts(" - ");
981 msg_puts((char *)compiled_arch);
Bram Moolenaar3d20ca12006-11-28 16:43:58 +0000982 }
983# endif
984
Bram Moolenaar071d4272004-06-13 20:20:40 +0000985#endif
986
Bram Moolenaaraa2f0ee2019-12-21 18:47:26 +0100987 // Print the list of patch numbers if there is at least one.
988 // Print a range when patches are consecutive: "1-10, 12, 15-40, 42-45"
Bram Moolenaar071d4272004-06-13 20:20:40 +0000989 if (included_patches[0] != 0)
990 {
Bram Moolenaar32526b32019-01-19 17:43:09 +0100991 msg_puts(_("\nIncluded patches: "));
Bram Moolenaar071d4272004-06-13 20:20:40 +0000992 first = -1;
K.Takataeeec2542021-06-02 13:28:16 +0200993 i = (int)ARRAY_LENGTH(included_patches) - 1;
Bram Moolenaar071d4272004-06-13 20:20:40 +0000994 while (--i >= 0)
995 {
996 if (first < 0)
997 first = included_patches[i];
998 if (i == 0 || included_patches[i - 1] != included_patches[i] + 1)
999 {
Bram Moolenaar32526b32019-01-19 17:43:09 +01001000 msg_puts(s);
Bram Moolenaar071d4272004-06-13 20:20:40 +00001001 s = ", ";
1002 msg_outnum((long)first);
1003 if (first != included_patches[i])
1004 {
Bram Moolenaar32526b32019-01-19 17:43:09 +01001005 msg_puts("-");
Bram Moolenaar071d4272004-06-13 20:20:40 +00001006 msg_outnum((long)included_patches[i]);
1007 }
1008 first = -1;
1009 }
1010 }
1011 }
1012
Bram Moolenaaraa2f0ee2019-12-21 18:47:26 +01001013 // Print the list of extra patch descriptions if there is at least one.
Bram Moolenaar10d4cec2008-11-30 11:15:09 +00001014 if (extra_patches[0] != NULL)
1015 {
Bram Moolenaar32526b32019-01-19 17:43:09 +01001016 msg_puts(_("\nExtra patches: "));
Bram Moolenaar10d4cec2008-11-30 11:15:09 +00001017 s = "";
1018 for (i = 0; extra_patches[i] != NULL; ++i)
1019 {
Bram Moolenaar32526b32019-01-19 17:43:09 +01001020 msg_puts(s);
Bram Moolenaar10d4cec2008-11-30 11:15:09 +00001021 s = ", ";
Bram Moolenaar32526b32019-01-19 17:43:09 +01001022 msg_puts(extra_patches[i]);
Bram Moolenaar10d4cec2008-11-30 11:15:09 +00001023 }
1024 }
1025
Bram Moolenaar071d4272004-06-13 20:20:40 +00001026#ifdef MODIFIED_BY
Bram Moolenaar32526b32019-01-19 17:43:09 +01001027 msg_puts("\n");
1028 msg_puts(_("Modified by "));
1029 msg_puts(MODIFIED_BY);
Bram Moolenaar071d4272004-06-13 20:20:40 +00001030#endif
1031
1032#ifdef HAVE_PATHDEF
1033 if (*compiled_user != NUL || *compiled_sys != NUL)
1034 {
Bram Moolenaar32526b32019-01-19 17:43:09 +01001035 msg_puts(_("\nCompiled "));
Bram Moolenaar071d4272004-06-13 20:20:40 +00001036 if (*compiled_user != NUL)
1037 {
Bram Moolenaar32526b32019-01-19 17:43:09 +01001038 msg_puts(_("by "));
1039 msg_puts((char *)compiled_user);
Bram Moolenaar071d4272004-06-13 20:20:40 +00001040 }
1041 if (*compiled_sys != NUL)
1042 {
Bram Moolenaar32526b32019-01-19 17:43:09 +01001043 msg_puts("@");
1044 msg_puts((char *)compiled_sys);
Bram Moolenaar071d4272004-06-13 20:20:40 +00001045 }
1046 }
1047#endif
1048
ichizok02560422022-04-05 14:18:44 +01001049#if defined(FEAT_HUGE)
Bram Moolenaar32526b32019-01-19 17:43:09 +01001050 msg_puts(_("\nHuge version "));
ichizok02560422022-04-05 14:18:44 +01001051#elif defined(FEAT_NORMAL)
Bram Moolenaar32526b32019-01-19 17:43:09 +01001052 msg_puts(_("\nNormal version "));
Bram Moolenaar071d4272004-06-13 20:20:40 +00001053#else
ichizok02560422022-04-05 14:18:44 +01001054 msg_puts(_("\nTiny version "));
1055#endif
1056#if !defined(FEAT_GUI)
1057 msg_puts(_("without GUI."));
1058#elif defined(FEAT_GUI_GTK)
1059# if defined(USE_GTK3)
Bram Moolenaar32526b32019-01-19 17:43:09 +01001060 msg_puts(_("with GTK3 GUI."));
ichizok02560422022-04-05 14:18:44 +01001061# elif defined(FEAT_GUI_GNOME)
Bram Moolenaar32526b32019-01-19 17:43:09 +01001062 msg_puts(_("with GTK2-GNOME GUI."));
Bram Moolenaar071d4272004-06-13 20:20:40 +00001063# else
ichizok02560422022-04-05 14:18:44 +01001064 msg_puts(_("with GTK2 GUI."));
Bram Moolenaar071d4272004-06-13 20:20:40 +00001065# endif
ichizok02560422022-04-05 14:18:44 +01001066#elif defined(FEAT_GUI_MOTIF)
1067 msg_puts(_("with X11-Motif GUI."));
1068#elif defined(FEAT_GUI_HAIKU)
1069 msg_puts(_("with Haiku GUI."));
1070#elif defined(FEAT_GUI_PHOTON)
1071 msg_puts(_("with Photon GUI."));
1072#elif defined(MSWIN)
1073 msg_puts(_("with GUI."));
Bram Moolenaar071d4272004-06-13 20:20:40 +00001074#endif
1075 version_msg(_(" Features included (+) or not (-):\n"));
1076
Bram Moolenaar445f3032013-02-20 16:47:36 +01001077 list_features();
Bram Moolenaar8a5c29a2019-07-26 19:48:19 +02001078 if (msg_col > 0)
1079 msg_putchar('\n');
Bram Moolenaar071d4272004-06-13 20:20:40 +00001080
Bram Moolenaar071d4272004-06-13 20:20:40 +00001081#ifdef SYS_VIMRC_FILE
1082 version_msg(_(" system vimrc file: \""));
1083 version_msg(SYS_VIMRC_FILE);
1084 version_msg("\"\n");
1085#endif
1086#ifdef USR_VIMRC_FILE
1087 version_msg(_(" user vimrc file: \""));
1088 version_msg(USR_VIMRC_FILE);
1089 version_msg("\"\n");
1090#endif
1091#ifdef USR_VIMRC_FILE2
1092 version_msg(_(" 2nd user vimrc file: \""));
1093 version_msg(USR_VIMRC_FILE2);
1094 version_msg("\"\n");
1095#endif
1096#ifdef USR_VIMRC_FILE3
1097 version_msg(_(" 3rd user vimrc file: \""));
1098 version_msg(USR_VIMRC_FILE3);
1099 version_msg("\"\n");
1100#endif
1101#ifdef USR_EXRC_FILE
1102 version_msg(_(" user exrc file: \""));
1103 version_msg(USR_EXRC_FILE);
1104 version_msg("\"\n");
1105#endif
1106#ifdef USR_EXRC_FILE2
1107 version_msg(_(" 2nd user exrc file: \""));
1108 version_msg(USR_EXRC_FILE2);
1109 version_msg("\"\n");
1110#endif
1111#ifdef FEAT_GUI
1112# ifdef SYS_GVIMRC_FILE
1113 version_msg(_(" system gvimrc file: \""));
1114 version_msg(SYS_GVIMRC_FILE);
1115 version_msg("\"\n");
1116# endif
1117 version_msg(_(" user gvimrc file: \""));
1118 version_msg(USR_GVIMRC_FILE);
1119 version_msg("\"\n");
1120# ifdef USR_GVIMRC_FILE2
1121 version_msg(_("2nd user gvimrc file: \""));
1122 version_msg(USR_GVIMRC_FILE2);
1123 version_msg("\"\n");
1124# endif
1125# ifdef USR_GVIMRC_FILE3
1126 version_msg(_("3rd user gvimrc file: \""));
1127 version_msg(USR_GVIMRC_FILE3);
1128 version_msg("\"\n");
1129# endif
1130#endif
Bram Moolenaar8c08b5b2016-07-28 22:24:15 +02001131 version_msg(_(" defaults file: \""));
1132 version_msg(VIM_DEFAULTS_FILE);
1133 version_msg("\"\n");
Bram Moolenaar071d4272004-06-13 20:20:40 +00001134#ifdef FEAT_GUI
1135# ifdef SYS_MENU_FILE
1136 version_msg(_(" system menu file: \""));
1137 version_msg(SYS_MENU_FILE);
1138 version_msg("\"\n");
1139# endif
1140#endif
1141#ifdef HAVE_PATHDEF
1142 if (*default_vim_dir != NUL)
1143 {
1144 version_msg(_(" fall-back for $VIM: \""));
1145 version_msg((char *)default_vim_dir);
1146 version_msg("\"\n");
1147 }
1148 if (*default_vimruntime_dir != NUL)
1149 {
1150 version_msg(_(" f-b for $VIMRUNTIME: \""));
1151 version_msg((char *)default_vimruntime_dir);
1152 version_msg("\"\n");
1153 }
1154 version_msg(_("Compilation: "));
1155 version_msg((char *)all_cflags);
1156 version_msg("\n");
1157#ifdef VMS
1158 if (*compiler_version != NUL)
1159 {
1160 version_msg(_("Compiler: "));
1161 version_msg((char *)compiler_version);
1162 version_msg("\n");
1163 }
1164#endif
1165 version_msg(_("Linking: "));
1166 version_msg((char *)all_lflags);
1167#endif
1168#ifdef DEBUG
1169 version_msg("\n");
1170 version_msg(_(" DEBUG BUILD"));
1171#endif
1172}
1173
Bram Moolenaarbaaa7e92016-01-29 22:47:03 +01001174static void do_intro_line(int row, char_u *mesg, int add_version, int attr);
Bram Moolenaarbdff0122020-04-05 18:56:05 +02001175static void intro_message(int colon);
Bram Moolenaar071d4272004-06-13 20:20:40 +00001176
1177/*
Bram Moolenaar249f0dd2013-07-04 22:31:03 +02001178 * Show the intro message when not editing a file.
1179 */
1180 void
Bram Moolenaarb638a7b2016-01-30 21:29:58 +01001181maybe_intro_message(void)
Bram Moolenaar249f0dd2013-07-04 22:31:03 +02001182{
Bram Moolenaarb5aedf32017-03-12 18:23:53 +01001183 if (BUFEMPTY()
Bram Moolenaar249f0dd2013-07-04 22:31:03 +02001184 && curbuf->b_fname == NULL
Bram Moolenaar249f0dd2013-07-04 22:31:03 +02001185 && firstwin->w_next == NULL
Bram Moolenaar249f0dd2013-07-04 22:31:03 +02001186 && vim_strchr(p_shm, SHM_INTRO) == NULL)
1187 intro_message(FALSE);
1188}
1189
1190/*
Bram Moolenaar071d4272004-06-13 20:20:40 +00001191 * Give an introductory message about Vim.
1192 * Only used when starting Vim on an empty file, without a file name.
1193 * Or with the ":intro" command (for Sven :-).
1194 */
Bram Moolenaarbdff0122020-04-05 18:56:05 +02001195 static void
Bram Moolenaarb638a7b2016-01-30 21:29:58 +01001196intro_message(
Bram Moolenaaraa2f0ee2019-12-21 18:47:26 +01001197 int colon) // TRUE for ":intro"
Bram Moolenaar071d4272004-06-13 20:20:40 +00001198{
1199 int i;
1200 int row;
1201 int blanklines;
1202 int sponsor;
1203 char *p;
1204 static char *(lines[]) =
1205 {
1206 N_("VIM - Vi IMproved"),
1207 "",
1208 N_("version "),
1209 N_("by Bram Moolenaar et al."),
1210#ifdef MODIFIED_BY
1211 " ",
1212#endif
1213 N_("Vim is open source and freely distributable"),
1214 "",
1215 N_("Help poor children in Uganda!"),
1216 N_("type :help iccf<Enter> for information "),
1217 "",
1218 N_("type :q<Enter> to exit "),
1219 N_("type :help<Enter> or <F1> for on-line help"),
Bram Moolenaarabd56da2022-06-23 20:46:27 +01001220 N_("type :help version9<Enter> for version info"),
Bram Moolenaar071d4272004-06-13 20:20:40 +00001221 NULL,
1222 "",
1223 N_("Running in Vi compatible mode"),
1224 N_("type :set nocp<Enter> for Vim defaults"),
1225 N_("type :help cp-default<Enter> for info on this"),
1226 };
1227#ifdef FEAT_GUI
1228 static char *(gui_lines[]) =
1229 {
1230 NULL,
1231 NULL,
1232 NULL,
1233 NULL,
1234#ifdef MODIFIED_BY
1235 NULL,
1236#endif
1237 NULL,
1238 NULL,
1239 NULL,
1240 N_("menu Help->Orphans for information "),
1241 NULL,
1242 N_("Running modeless, typed text is inserted"),
1243 N_("menu Edit->Global Settings->Toggle Insert Mode "),
1244 N_(" for two modes "),
1245 NULL,
1246 NULL,
1247 NULL,
1248 N_("menu Edit->Global Settings->Toggle Vi Compatible"),
1249 N_(" for Vim defaults "),
1250 };
1251#endif
1252
Bram Moolenaaraa2f0ee2019-12-21 18:47:26 +01001253 // blanklines = screen height - # message lines
K.Takataeeec2542021-06-02 13:28:16 +02001254 blanklines = (int)Rows - (ARRAY_LENGTH(lines) - 1);
Bram Moolenaar071d4272004-06-13 20:20:40 +00001255 if (!p_cp)
Bram Moolenaaraa2f0ee2019-12-21 18:47:26 +01001256 blanklines += 4; // add 4 for not showing "Vi compatible" message
Bram Moolenaar071d4272004-06-13 20:20:40 +00001257
Bram Moolenaaraa2f0ee2019-12-21 18:47:26 +01001258 // Don't overwrite a statusline. Depends on 'cmdheight'.
Bram Moolenaar071d4272004-06-13 20:20:40 +00001259 if (p_ls > 1)
1260 blanklines -= Rows - topframe->fr_height;
Bram Moolenaar071d4272004-06-13 20:20:40 +00001261 if (blanklines < 0)
1262 blanklines = 0;
1263
Bram Moolenaaraa2f0ee2019-12-21 18:47:26 +01001264 // Show the sponsor and register message one out of four times, the Uganda
1265 // message two out of four times.
Bram Moolenaarf4cd3e82005-12-22 22:47:02 +00001266 sponsor = (int)time(NULL);
Bram Moolenaar071d4272004-06-13 20:20:40 +00001267 sponsor = ((sponsor & 2) == 0) - ((sponsor & 4) == 0);
1268
Bram Moolenaaraa2f0ee2019-12-21 18:47:26 +01001269 // start displaying the message lines after half of the blank lines
Bram Moolenaar071d4272004-06-13 20:20:40 +00001270 row = blanklines / 2;
1271 if ((row >= 2 && Columns >= 50) || colon)
1272 {
K.Takataeeec2542021-06-02 13:28:16 +02001273 for (i = 0; i < (int)ARRAY_LENGTH(lines); ++i)
Bram Moolenaar071d4272004-06-13 20:20:40 +00001274 {
1275 p = lines[i];
1276#ifdef FEAT_GUI
1277 if (p_im && gui.in_use && gui_lines[i] != NULL)
1278 p = gui_lines[i];
1279#endif
1280 if (p == NULL)
1281 {
1282 if (!p_cp)
1283 break;
1284 continue;
1285 }
1286 if (sponsor != 0)
1287 {
1288 if (strstr(p, "children") != NULL)
1289 p = sponsor < 0
1290 ? N_("Sponsor Vim development!")
1291 : N_("Become a registered Vim user!");
1292 else if (strstr(p, "iccf") != NULL)
1293 p = sponsor < 0
1294 ? N_("type :help sponsor<Enter> for information ")
1295 : N_("type :help register<Enter> for information ");
1296 else if (strstr(p, "Orphans") != NULL)
1297 p = N_("menu Help->Sponsor/Register for information ");
1298 }
1299 if (*p != NUL)
1300 do_intro_line(row, (char_u *)_(p), i == 2, 0);
1301 ++row;
1302 }
Bram Moolenaar071d4272004-06-13 20:20:40 +00001303 }
1304
Bram Moolenaaraa2f0ee2019-12-21 18:47:26 +01001305 // Make the wait-return message appear just below the text.
Bram Moolenaar071d4272004-06-13 20:20:40 +00001306 if (colon)
1307 msg_row = row;
1308}
1309
1310 static void
Bram Moolenaarb638a7b2016-01-30 21:29:58 +01001311do_intro_line(
1312 int row,
1313 char_u *mesg,
1314 int add_version,
1315 int attr)
Bram Moolenaar071d4272004-06-13 20:20:40 +00001316{
1317 char_u vers[20];
1318 int col;
1319 char_u *p;
1320 int l;
1321 int clen;
1322#ifdef MODIFIED_BY
1323# define MODBY_LEN 150
1324 char_u modby[MODBY_LEN];
1325
1326 if (*mesg == ' ')
1327 {
Bram Moolenaar589e43a2008-01-05 12:59:22 +00001328 vim_strncpy(modby, (char_u *)_("Modified by "), MODBY_LEN - 1);
Bram Moolenaar9b0ac222016-06-01 20:31:43 +02001329 l = (int)STRLEN(modby);
Bram Moolenaar589e43a2008-01-05 12:59:22 +00001330 vim_strncpy(modby + l, (char_u *)MODIFIED_BY, MODBY_LEN - l - 1);
Bram Moolenaar071d4272004-06-13 20:20:40 +00001331 mesg = modby;
1332 }
1333#endif
1334
Bram Moolenaaraa2f0ee2019-12-21 18:47:26 +01001335 // Center the message horizontally.
Bram Moolenaar071d4272004-06-13 20:20:40 +00001336 col = vim_strsize(mesg);
1337 if (add_version)
1338 {
1339 STRCPY(vers, mediumVersion);
1340 if (highest_patch())
1341 {
Bram Moolenaaraa2f0ee2019-12-21 18:47:26 +01001342 // Check for 9.9x or 9.9xx, alpha/beta version
Keith Thompson184f71c2024-01-04 21:19:04 +01001343 if (SAFE_isalpha((int)vers[3]))
Bram Moolenaar071d4272004-06-13 20:20:40 +00001344 {
Keith Thompson184f71c2024-01-04 21:19:04 +01001345 int len = (SAFE_isalpha((int)vers[4])) ? 5 : 4;
Bram Moolenaar552ac132012-03-07 18:03:10 +01001346 sprintf((char *)vers + len, ".%d%s", highest_patch(),
1347 mediumVersion + len);
Bram Moolenaar071d4272004-06-13 20:20:40 +00001348 }
1349 else
1350 sprintf((char *)vers + 3, ".%d", highest_patch());
1351 }
1352 col += (int)STRLEN(vers);
1353 }
1354 col = (Columns - col) / 2;
1355 if (col < 0)
1356 col = 0;
1357
Bram Moolenaaraa2f0ee2019-12-21 18:47:26 +01001358 // Split up in parts to highlight <> items differently.
Bram Moolenaar071d4272004-06-13 20:20:40 +00001359 for (p = mesg; *p != NUL; p += l)
1360 {
1361 clen = 0;
1362 for (l = 0; p[l] != NUL
1363 && (l == 0 || (p[l] != '<' && p[l - 1] != '>')); ++l)
1364 {
Bram Moolenaar071d4272004-06-13 20:20:40 +00001365 if (has_mbyte)
1366 {
1367 clen += ptr2cells(p + l);
Bram Moolenaar0fa313a2005-08-10 21:07:57 +00001368 l += (*mb_ptr2len)(p + l) - 1;
Bram Moolenaar071d4272004-06-13 20:20:40 +00001369 }
1370 else
Bram Moolenaar071d4272004-06-13 20:20:40 +00001371 clen += byte2cells(p[l]);
1372 }
Bram Moolenaar8820b482017-03-16 17:23:31 +01001373 screen_puts_len(p, l, row, col, *p == '<' ? HL_ATTR(HLF_8) : attr);
Bram Moolenaar071d4272004-06-13 20:20:40 +00001374 col += clen;
1375 }
1376
Bram Moolenaaraa2f0ee2019-12-21 18:47:26 +01001377 // Add the version number to the version line.
Bram Moolenaar071d4272004-06-13 20:20:40 +00001378 if (add_version)
1379 screen_puts(vers, row, col, 0);
1380}
1381
1382/*
1383 * ":intro": clear screen, display intro screen and wait for return.
1384 */
Bram Moolenaar071d4272004-06-13 20:20:40 +00001385 void
Bram Moolenaarb638a7b2016-01-30 21:29:58 +01001386ex_intro(exarg_T *eap UNUSED)
Bram Moolenaar071d4272004-06-13 20:20:40 +00001387{
1388 screenclear();
1389 intro_message(TRUE);
1390 wait_return(TRUE);
1391}