blob: 9f369a95d80666b3f22deda083ce619ca9c0d92a [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
12#ifdef AMIGA
Bram Moolenaaraa2f0ee2019-12-21 18:47:26 +010013# include <time.h> // for time()
Bram Moolenaar071d4272004-06-13 20:20:40 +000014#endif
15
16/*
17 * Vim originated from Stevie version 3.6 (Fish disk 217) by GRWalter (Fred)
18 * It has been changed beyond recognition since then.
19 *
Bram Moolenaar640102482016-09-12 16:23:34 +020020 * Differences between version 7.4 and 8.x can be found with ":help version8".
21 * Differences between version 6.4 and 7.x can be found with ":help version7".
22 * Differences between version 5.8 and 6.x can be found with ":help version6".
Bram Moolenaar071d4272004-06-13 20:20:40 +000023 * Differences between version 4.x and 5.x can be found with ":help version5".
24 * Differences between version 3.0 and 4.x can be found with ":help version4".
25 * All the remarks about older versions have been removed, they are not very
26 * interesting.
27 */
28
29#include "version.h"
30
Bram Moolenaard042c562005-06-30 22:04:15 +000031char *Version = VIM_VERSION_SHORT;
32static char *mediumVersion = VIM_VERSION_MEDIUM;
Bram Moolenaar071d4272004-06-13 20:20:40 +000033
34#if defined(HAVE_DATE_TIME) || defined(PROTO)
35# if (defined(VMS) && defined(VAXC)) || defined(PROTO)
36char longVersion[sizeof(VIM_VERSION_LONG_DATE) + sizeof(__DATE__)
37 + sizeof(__TIME__) + 3];
Bram Moolenaar445f3032013-02-20 16:47:36 +010038
Bram Moolenaar071d4272004-06-13 20:20:40 +000039 void
Bram Moolenaar35fb6fb2018-06-23 16:12:21 +020040init_longVersion(void)
Bram Moolenaar071d4272004-06-13 20:20:40 +000041{
42 /*
43 * Construct the long version string. Necessary because
Bram Moolenaarbdace832019-03-02 10:13:42 +010044 * VAX C can't concatenate strings in the preprocessor.
Bram Moolenaar071d4272004-06-13 20:20:40 +000045 */
46 strcpy(longVersion, VIM_VERSION_LONG_DATE);
47 strcat(longVersion, __DATE__);
48 strcat(longVersion, " ");
49 strcat(longVersion, __TIME__);
50 strcat(longVersion, ")");
51}
Bram Moolenaar35fb6fb2018-06-23 16:12:21 +020052
Bram Moolenaar071d4272004-06-13 20:20:40 +000053# else
Bram Moolenaar35fb6fb2018-06-23 16:12:21 +020054 void
55init_longVersion(void)
56{
57 char *date_time = __DATE__ " " __TIME__;
58 char *msg = _("%s (%s, compiled %s)");
59 size_t len = strlen(msg)
60 + strlen(VIM_VERSION_LONG_ONLY)
61 + strlen(VIM_VERSION_DATE_ONLY)
62 + strlen(date_time);
63
Bram Moolenaarc799fe22019-05-28 23:08:19 +020064 longVersion = alloc(len);
Bram Moolenaar35fb6fb2018-06-23 16:12:21 +020065 if (longVersion == NULL)
66 longVersion = VIM_VERSION_LONG;
67 else
68 vim_snprintf(longVersion, len, msg,
69 VIM_VERSION_LONG_ONLY, VIM_VERSION_DATE_ONLY, date_time);
70}
Bram Moolenaar071d4272004-06-13 20:20:40 +000071# endif
72#else
73char *longVersion = VIM_VERSION_LONG;
Bram Moolenaareee3e942018-06-24 14:44:46 +020074
75 void
76init_longVersion(void)
77{
78 // nothing to do
79}
Bram Moolenaar071d4272004-06-13 20:20:40 +000080#endif
81
Bram Moolenaar071d4272004-06-13 20:20:40 +000082static char *(features[]) =
83{
Bram Moolenaarb5ef5e12013-08-30 16:35:44 +020084#ifdef HAVE_ACL
85 "+acl",
86#else
87 "-acl",
88#endif
Bram Moolenaaraa2f0ee2019-12-21 18:47:26 +010089#ifdef AMIGA // only for Amiga systems
Bram Moolenaar071d4272004-06-13 20:20:40 +000090# ifdef FEAT_ARP
91 "+ARP",
92# else
93 "-ARP",
94# endif
95#endif
96#ifdef FEAT_ARABIC
97 "+arabic",
98#else
99 "-arabic",
100#endif
Bram Moolenaar071d4272004-06-13 20:20:40 +0000101 "+autocmd",
Bram Moolenaar83ec2a72018-07-27 22:08:59 +0200102#ifdef FEAT_AUTOCHDIR
103 "+autochdir",
104#else
105 "-autochdir",
106#endif
Bram Moolenaare42a6d22017-11-12 19:21:51 +0100107#ifdef FEAT_AUTOSERVERNAME
108 "+autoservername",
109#else
110 "-autoservername",
111#endif
Bram Moolenaarc3719bd2017-11-18 22:13:31 +0100112#ifdef FEAT_BEVAL_GUI
Bram Moolenaar071d4272004-06-13 20:20:40 +0000113 "+balloon_eval",
114#else
115 "-balloon_eval",
116#endif
Bram Moolenaarc3719bd2017-11-18 22:13:31 +0100117#ifdef FEAT_BEVAL_TERM
Bram Moolenaar51b0f372017-11-18 18:52:04 +0100118 "+balloon_eval_term",
119#else
120 "-balloon_eval_term",
121#endif
Bram Moolenaar071d4272004-06-13 20:20:40 +0000122#ifdef FEAT_BROWSE
123 "+browse",
124#else
125 "-browse",
126#endif
127#ifdef NO_BUILTIN_TCAPS
128 "-builtin_terms",
129#endif
130#ifdef SOME_BUILTIN_TCAPS
131 "+builtin_terms",
132#endif
133#ifdef ALL_BUILTIN_TCAPS
134 "++builtin_terms",
135#endif
136#ifdef FEAT_BYTEOFF
137 "+byte_offset",
138#else
139 "-byte_offset",
140#endif
Bram Moolenaar509ce2a2016-03-11 22:52:15 +0100141#ifdef FEAT_JOB_CHANNEL
Bram Moolenaar5aec4812016-01-25 20:15:45 +0100142 "+channel",
143#else
144 "-channel",
145#endif
Bram Moolenaar071d4272004-06-13 20:20:40 +0000146#ifdef FEAT_CINDENT
147 "+cindent",
148#else
149 "-cindent",
150#endif
151#ifdef FEAT_CLIENTSERVER
152 "+clientserver",
153#else
154 "-clientserver",
155#endif
156#ifdef FEAT_CLIPBOARD
157 "+clipboard",
158#else
159 "-clipboard",
160#endif
Bram Moolenaar071d4272004-06-13 20:20:40 +0000161 "+cmdline_compl",
Bram Moolenaar071d4272004-06-13 20:20:40 +0000162 "+cmdline_hist",
Bram Moolenaar071d4272004-06-13 20:20:40 +0000163#ifdef FEAT_CMDL_INFO
164 "+cmdline_info",
165#else
166 "-cmdline_info",
167#endif
Bram Moolenaar071d4272004-06-13 20:20:40 +0000168 "+comments",
Bram Moolenaar860cae12010-06-05 23:22:07 +0200169#ifdef FEAT_CONCEAL
170 "+conceal",
171#else
172 "-conceal",
173#endif
Bram Moolenaar071d4272004-06-13 20:20:40 +0000174#ifdef FEAT_CRYPT
175 "+cryptv",
176#else
177 "-cryptv",
178#endif
179#ifdef FEAT_CSCOPE
180 "+cscope",
181#else
182 "-cscope",
183#endif
Bram Moolenaar860cae12010-06-05 23:22:07 +0200184 "+cursorbind",
Bram Moolenaar17c7c012006-01-26 22:25:15 +0000185#ifdef CURSOR_SHAPE
186 "+cursorshape",
187#else
188 "-cursorshape",
189#endif
Bram Moolenaar071d4272004-06-13 20:20:40 +0000190#if defined(FEAT_CON_DIALOG) && defined(FEAT_GUI_DIALOG)
191 "+dialog_con_gui",
192#else
193# if defined(FEAT_CON_DIALOG)
194 "+dialog_con",
195# else
196# if defined(FEAT_GUI_DIALOG)
197 "+dialog_gui",
198# else
199 "-dialog",
200# endif
201# endif
202#endif
203#ifdef FEAT_DIFF
204 "+diff",
205#else
206 "-diff",
207#endif
208#ifdef FEAT_DIGRAPHS
209 "+digraphs",
210#else
211 "-digraphs",
212#endif
Bram Moolenaar4f974752019-02-17 17:44:42 +0100213#ifdef FEAT_GUI_MSWIN
Bram Moolenaarb5a7a8b2014-08-06 14:52:30 +0200214# ifdef FEAT_DIRECTX
215 "+directx",
216# else
217 "-directx",
218# endif
219#endif
Bram Moolenaar071d4272004-06-13 20:20:40 +0000220#ifdef FEAT_DND
221 "+dnd",
222#else
223 "-dnd",
224#endif
225#ifdef EBCDIC
226 "+ebcdic",
227#else
228 "-ebcdic",
229#endif
230#ifdef FEAT_EMACS_TAGS
231 "+emacs_tags",
232#else
233 "-emacs_tags",
234#endif
235#ifdef FEAT_EVAL
236 "+eval",
237#else
238 "-eval",
239#endif
Bram Moolenaar071d4272004-06-13 20:20:40 +0000240 "+ex_extra",
Bram Moolenaar071d4272004-06-13 20:20:40 +0000241#ifdef FEAT_SEARCH_EXTRA
242 "+extra_search",
243#else
244 "-extra_search",
245#endif
Bram Moolenaar071d4272004-06-13 20:20:40 +0000246 "-farsi",
Bram Moolenaar071d4272004-06-13 20:20:40 +0000247#ifdef FEAT_SEARCHPATH
248 "+file_in_path",
249#else
250 "-file_in_path",
251#endif
252#ifdef FEAT_FIND_ID
253 "+find_in_path",
254#else
255 "-find_in_path",
256#endif
Bram Moolenaar446cb832008-06-24 21:56:24 +0000257#ifdef FEAT_FLOAT
258 "+float",
259#else
260 "-float",
261#endif
Bram Moolenaar071d4272004-06-13 20:20:40 +0000262#ifdef FEAT_FOLDING
263 "+folding",
264#else
265 "-folding",
266#endif
267#ifdef FEAT_FOOTER
268 "+footer",
269#else
270 "-footer",
271#endif
Bram Moolenaaraa2f0ee2019-12-21 18:47:26 +0100272 // only interesting on Unix systems
Bram Moolenaar071d4272004-06-13 20:20:40 +0000273#if !defined(USE_SYSTEM) && defined(UNIX)
274 "+fork()",
275#endif
276#ifdef FEAT_GETTEXT
277# ifdef DYNAMIC_GETTEXT
278 "+gettext/dyn",
279# else
280 "+gettext",
281# endif
282#else
283 "-gettext",
284#endif
Bram Moolenaar071d4272004-06-13 20:20:40 +0000285 "-hangul_input",
Bram Moolenaar071d4272004-06-13 20:20:40 +0000286#if (defined(HAVE_ICONV_H) && defined(USE_ICONV)) || defined(DYNAMIC_ICONV)
287# ifdef DYNAMIC_ICONV
288 "+iconv/dyn",
289# else
290 "+iconv",
291# endif
292#else
293 "-iconv",
294#endif
Bram Moolenaar071d4272004-06-13 20:20:40 +0000295 "+insert_expand",
Bram Moolenaar509ce2a2016-03-11 22:52:15 +0100296#ifdef FEAT_JOB_CHANNEL
Bram Moolenaar835dc632016-02-07 14:27:38 +0100297 "+job",
298#else
299 "-job",
300#endif
Bram Moolenaar071d4272004-06-13 20:20:40 +0000301#ifdef FEAT_JUMPLIST
302 "+jumplist",
303#else
304 "-jumplist",
305#endif
306#ifdef FEAT_KEYMAP
307 "+keymap",
308#else
309 "-keymap",
310#endif
Bram Moolenaar9532fe72016-07-29 22:50:35 +0200311#ifdef FEAT_EVAL
312 "+lambda",
313#else
314 "-lambda",
315#endif
Bram Moolenaar071d4272004-06-13 20:20:40 +0000316#ifdef FEAT_LANGMAP
317 "+langmap",
318#else
319 "-langmap",
320#endif
321#ifdef FEAT_LIBCALL
322 "+libcall",
323#else
324 "-libcall",
325#endif
326#ifdef FEAT_LINEBREAK
327 "+linebreak",
328#else
329 "-linebreak",
330#endif
331#ifdef FEAT_LISP
332 "+lispindent",
333#else
334 "-lispindent",
335#endif
Bram Moolenaar071d4272004-06-13 20:20:40 +0000336 "+listcmds",
Bram Moolenaar071d4272004-06-13 20:20:40 +0000337 "+localmap",
Bram Moolenaar0ba04292010-07-14 23:23:17 +0200338#ifdef FEAT_LUA
339# ifdef DYNAMIC_LUA
340 "+lua/dyn",
341# else
342 "+lua",
343# endif
344#else
345 "-lua",
346#endif
Bram Moolenaar071d4272004-06-13 20:20:40 +0000347#ifdef FEAT_MENU
348 "+menu",
349#else
350 "-menu",
351#endif
352#ifdef FEAT_SESSION
353 "+mksession",
354#else
355 "-mksession",
356#endif
Bram Moolenaar071d4272004-06-13 20:20:40 +0000357 "+modify_fname",
Bram Moolenaar071d4272004-06-13 20:20:40 +0000358 "+mouse",
Bram Moolenaara1cb1d12019-10-17 23:00:07 +0200359#ifdef FEAT_MOUSESHAPE
Bram Moolenaar071d4272004-06-13 20:20:40 +0000360 "+mouseshape",
Bram Moolenaara1cb1d12019-10-17 23:00:07 +0200361#else
Bram Moolenaar071d4272004-06-13 20:20:40 +0000362 "-mouseshape",
Bram Moolenaar071d4272004-06-13 20:20:40 +0000363#endif
Bram Moolenaar707cfb82012-10-21 04:00:07 +0200364
Bram Moolenaar071d4272004-06-13 20:20:40 +0000365#if defined(UNIX) || defined(VMS)
366# ifdef FEAT_MOUSE_DEC
367 "+mouse_dec",
368# else
369 "-mouse_dec",
370# endif
371# ifdef FEAT_MOUSE_GPM
372 "+mouse_gpm",
373# else
374 "-mouse_gpm",
375# endif
376# ifdef FEAT_MOUSE_JSB
377 "+mouse_jsbterm",
378# else
379 "-mouse_jsbterm",
380# endif
381# ifdef FEAT_MOUSE_NET
382 "+mouse_netterm",
383# else
384 "-mouse_netterm",
385# endif
Bram Moolenaar071d4272004-06-13 20:20:40 +0000386#endif
Bram Moolenaar707cfb82012-10-21 04:00:07 +0200387
Bram Moolenaar071d4272004-06-13 20:20:40 +0000388#ifdef __QNX__
389# ifdef FEAT_MOUSE_PTERM
390 "+mouse_pterm",
391# else
392 "-mouse_pterm",
393# endif
394#endif
Bram Moolenaar707cfb82012-10-21 04:00:07 +0200395
396#if defined(UNIX) || defined(VMS)
Bram Moolenaar707cfb82012-10-21 04:00:07 +0200397 "+mouse_sgr",
Bram Moolenaar707cfb82012-10-21 04:00:07 +0200398# ifdef FEAT_SYSMOUSE
399 "+mouse_sysmouse",
400# else
401 "-mouse_sysmouse",
402# endif
403# ifdef FEAT_MOUSE_URXVT
404 "+mouse_urxvt",
405# else
406 "-mouse_urxvt",
407# endif
Bram Moolenaar707cfb82012-10-21 04:00:07 +0200408 "+mouse_xterm",
Bram Moolenaar707cfb82012-10-21 04:00:07 +0200409#endif
410
Bram Moolenaar071d4272004-06-13 20:20:40 +0000411#ifdef FEAT_MBYTE_IME
412# ifdef DYNAMIC_IME
413 "+multi_byte_ime/dyn",
414# else
415 "+multi_byte_ime",
416# endif
417#else
Bram Moolenaar071d4272004-06-13 20:20:40 +0000418 "+multi_byte",
Bram Moolenaar071d4272004-06-13 20:20:40 +0000419#endif
420#ifdef FEAT_MULTI_LANG
421 "+multi_lang",
422#else
423 "-multi_lang",
424#endif
Bram Moolenaar325b7a22004-07-05 15:58:32 +0000425#ifdef FEAT_MZSCHEME
Bram Moolenaardf3267e2005-01-25 22:07:05 +0000426# ifdef DYNAMIC_MZSCHEME
427 "+mzscheme/dyn",
428# else
Bram Moolenaar325b7a22004-07-05 15:58:32 +0000429 "+mzscheme",
Bram Moolenaardf3267e2005-01-25 22:07:05 +0000430# endif
Bram Moolenaar325b7a22004-07-05 15:58:32 +0000431#else
432 "-mzscheme",
433#endif
Bram Moolenaar071d4272004-06-13 20:20:40 +0000434#ifdef FEAT_NETBEANS_INTG
435 "+netbeans_intg",
436#else
437 "-netbeans_intg",
438#endif
Bram Moolenaar22fcfad2016-07-01 18:17:26 +0200439#ifdef FEAT_NUM64
440 "+num64",
441#else
442 "-num64",
443#endif
Bram Moolenaar4f974752019-02-17 17:44:42 +0100444#ifdef FEAT_GUI_MSWIN
Bram Moolenaar071d4272004-06-13 20:20:40 +0000445# ifdef FEAT_OLE
446 "+ole",
447# else
448 "-ole",
449# endif
450#endif
Bram Moolenaar6183ccb2018-07-22 05:08:11 +0200451#ifdef FEAT_EVAL
Bram Moolenaarf6fee0e2016-02-21 23:02:49 +0100452 "+packages",
Bram Moolenaar6183ccb2018-07-22 05:08:11 +0200453#else
454 "-packages",
455#endif
Bram Moolenaar071d4272004-06-13 20:20:40 +0000456#ifdef FEAT_PATH_EXTRA
457 "+path_extra",
458#else
459 "-path_extra",
460#endif
461#ifdef FEAT_PERL
462# ifdef DYNAMIC_PERL
463 "+perl/dyn",
464# else
465 "+perl",
466# endif
467#else
468 "-perl",
469#endif
Bram Moolenaar55debbe2010-05-23 23:34:36 +0200470#ifdef FEAT_PERSISTENT_UNDO
471 "+persistent_undo",
472#else
473 "-persistent_undo",
474#endif
Bram Moolenaar05ad5ff2019-11-30 22:48:27 +0100475#ifdef FEAT_PROP_POPUP
476 "+popupwin",
477#else
478 "-popupwin",
479#endif
Bram Moolenaar071d4272004-06-13 20:20:40 +0000480#ifdef FEAT_PRINTER
481# ifdef FEAT_POSTSCRIPT
482 "+postscript",
483# else
484 "-postscript",
485# endif
486 "+printer",
487#else
488 "-printer",
489#endif
Bram Moolenaar05159a02005-02-26 23:04:13 +0000490#ifdef FEAT_PROFILE
491 "+profile",
492#else
493 "-profile",
494#endif
Bram Moolenaar071d4272004-06-13 20:20:40 +0000495#ifdef FEAT_PYTHON
496# ifdef DYNAMIC_PYTHON
497 "+python/dyn",
498# else
499 "+python",
500# endif
501#else
502 "-python",
503#endif
Bram Moolenaarbd5e15f2010-07-17 21:19:38 +0200504#ifdef FEAT_PYTHON3
505# ifdef DYNAMIC_PYTHON3
506 "+python3/dyn",
507# else
508 "+python3",
509# endif
510#else
511 "-python3",
512#endif
Bram Moolenaar071d4272004-06-13 20:20:40 +0000513#ifdef FEAT_QUICKFIX
514 "+quickfix",
515#else
516 "-quickfix",
517#endif
Bram Moolenaard68071d2006-05-02 22:08:30 +0000518#ifdef FEAT_RELTIME
519 "+reltime",
520#else
521 "-reltime",
522#endif
Bram Moolenaar071d4272004-06-13 20:20:40 +0000523#ifdef FEAT_RIGHTLEFT
524 "+rightleft",
525#else
526 "-rightleft",
527#endif
528#ifdef FEAT_RUBY
529# ifdef DYNAMIC_RUBY
530 "+ruby/dyn",
531# else
532 "+ruby",
533# endif
534#else
535 "-ruby",
536#endif
Bram Moolenaar071d4272004-06-13 20:20:40 +0000537 "+scrollbind",
Bram Moolenaar071d4272004-06-13 20:20:40 +0000538#ifdef FEAT_SIGNS
539 "+signs",
540#else
541 "-signs",
542#endif
543#ifdef FEAT_SMARTINDENT
544 "+smartindent",
545#else
546 "-smartindent",
547#endif
Bram Moolenaar427f5b62019-06-09 13:43:51 +0200548#ifdef FEAT_SOUND
549 "+sound",
550#else
551 "-sound",
552#endif
553#ifdef FEAT_SPELL
554 "+spell",
555#else
556 "-spell",
557#endif
Bram Moolenaaref94eec2009-11-11 13:22:11 +0000558#ifdef STARTUPTIME
559 "+startuptime",
560#else
561 "-startuptime",
562#endif
Bram Moolenaar071d4272004-06-13 20:20:40 +0000563#ifdef FEAT_STL_OPT
564 "+statusline",
565#else
566 "-statusline",
567#endif
Bram Moolenaar071d4272004-06-13 20:20:40 +0000568 "-sun_workshop",
Bram Moolenaar071d4272004-06-13 20:20:40 +0000569#ifdef FEAT_SYN_HL
570 "+syntax",
571#else
572 "-syntax",
573#endif
Bram Moolenaaraa2f0ee2019-12-21 18:47:26 +0100574 // only interesting on Unix systems
Bram Moolenaara06ecab2016-07-16 14:47:36 +0200575#if defined(USE_SYSTEM) && defined(UNIX)
Bram Moolenaar071d4272004-06-13 20:20:40 +0000576 "+system()",
577#endif
578#ifdef FEAT_TAG_BINS
579 "+tag_binary",
580#else
581 "-tag_binary",
582#endif
Bram Moolenaar071d4272004-06-13 20:20:40 +0000583 "-tag_old_static",
Bram Moolenaar071d4272004-06-13 20:20:40 +0000584 "-tag_any_white",
Bram Moolenaar071d4272004-06-13 20:20:40 +0000585#ifdef FEAT_TCL
586# ifdef DYNAMIC_TCL
587 "+tcl/dyn",
588# else
589 "+tcl",
590# endif
591#else
592 "-tcl",
593#endif
Bram Moolenaar61be73b2016-04-29 22:59:22 +0200594#ifdef FEAT_TERMGUICOLORS
595 "+termguicolors",
596#else
597 "-termguicolors",
598#endif
Bram Moolenaar26e85582017-07-15 20:05:54 +0200599#ifdef FEAT_TERMINAL
600 "+terminal",
601#else
602 "-terminal",
603#endif
Bram Moolenaara06ecab2016-07-16 14:47:36 +0200604#if defined(UNIX)
Bram Moolenaaraa2f0ee2019-12-21 18:47:26 +0100605// only Unix can have terminfo instead of termcap
Bram Moolenaar071d4272004-06-13 20:20:40 +0000606# ifdef TERMINFO
607 "+terminfo",
608# else
609 "-terminfo",
610# endif
Bram Moolenaar071d4272004-06-13 20:20:40 +0000611#endif
612#ifdef FEAT_TERMRESPONSE
613 "+termresponse",
614#else
615 "-termresponse",
616#endif
617#ifdef FEAT_TEXTOBJ
618 "+textobjects",
619#else
620 "-textobjects",
621#endif
Bram Moolenaar05ad5ff2019-11-30 22:48:27 +0100622#ifdef FEAT_PROP_POPUP
Bram Moolenaar98aefe72018-12-13 22:20:09 +0100623 "+textprop",
624#else
625 "-textprop",
626#endif
627#if !defined(UNIX)
Bram Moolenaaraa2f0ee2019-12-21 18:47:26 +0100628// unix always includes termcap support
Bram Moolenaar98aefe72018-12-13 22:20:09 +0100629# ifdef HAVE_TGETENT
630 "+tgetent",
631# else
632 "-tgetent",
633# endif
634#endif
Bram Moolenaar975b5272016-03-15 23:10:59 +0100635#ifdef FEAT_TIMERS
636 "+timers",
637#else
638 "-timers",
639#endif
Bram Moolenaar071d4272004-06-13 20:20:40 +0000640#ifdef FEAT_TITLE
641 "+title",
642#else
643 "-title",
644#endif
645#ifdef FEAT_TOOLBAR
646 "+toolbar",
647#else
648 "-toolbar",
649#endif
Bram Moolenaar071d4272004-06-13 20:20:40 +0000650 "+user_commands",
Bram Moolenaar04958cb2018-06-23 19:23:02 +0200651#ifdef FEAT_VARTABS
652 "+vartabs",
653#else
654 "-vartabs",
655#endif
Bram Moolenaar071d4272004-06-13 20:20:40 +0000656 "+vertsplit",
Bram Moolenaar071d4272004-06-13 20:20:40 +0000657 "+virtualedit",
Bram Moolenaar071d4272004-06-13 20:20:40 +0000658 "+visual",
Bram Moolenaar071d4272004-06-13 20:20:40 +0000659 "+visualextra",
Bram Moolenaar071d4272004-06-13 20:20:40 +0000660#ifdef FEAT_VIMINFO
661 "+viminfo",
662#else
663 "-viminfo",
664#endif
Bram Moolenaar071d4272004-06-13 20:20:40 +0000665 "+vreplace",
Bram Moolenaar4f974752019-02-17 17:44:42 +0100666#ifdef MSWIN
Bram Moolenaarcafafb32018-02-22 21:07:09 +0100667# ifdef FEAT_VTP
668 "+vtp",
669# else
670 "-vtp",
671# endif
672#endif
Bram Moolenaar071d4272004-06-13 20:20:40 +0000673#ifdef FEAT_WILDIGN
674 "+wildignore",
675#else
676 "-wildignore",
677#endif
678#ifdef FEAT_WILDMENU
679 "+wildmenu",
680#else
681 "-wildmenu",
682#endif
Bram Moolenaar071d4272004-06-13 20:20:40 +0000683 "+windows",
Bram Moolenaar071d4272004-06-13 20:20:40 +0000684#ifdef FEAT_WRITEBACKUP
685 "+writebackup",
686#else
687 "-writebackup",
688#endif
689#if defined(UNIX) || defined(VMS)
690# ifdef FEAT_X11
691 "+X11",
692# else
693 "-X11",
694# endif
695#endif
696#ifdef FEAT_XFONTSET
697 "+xfontset",
698#else
699 "-xfontset",
700#endif
701#ifdef FEAT_XIM
702 "+xim",
703#else
704 "-xim",
705#endif
Bram Moolenaar4f974752019-02-17 17:44:42 +0100706#ifdef MSWIN
Bram Moolenaard58b0f92016-08-13 16:39:56 +0200707# ifdef FEAT_XPM_W32
708 "+xpm_w32",
709# else
710 "-xpm_w32",
711# endif
712#else
713# ifdef HAVE_XPM
714 "+xpm",
715# else
716 "-xpm",
717# endif
718#endif
Bram Moolenaar071d4272004-06-13 20:20:40 +0000719#if defined(UNIX) || defined(VMS)
720# ifdef USE_XSMP_INTERACT
721 "+xsmp_interact",
722# else
723# ifdef USE_XSMP
724 "+xsmp",
725# else
726 "-xsmp",
727# endif
728# endif
729# ifdef FEAT_XCLIPBOARD
730 "+xterm_clipboard",
731# else
732 "-xterm_clipboard",
733# endif
734#endif
735#ifdef FEAT_XTERM_SAVE
736 "+xterm_save",
737#else
738 "-xterm_save",
739#endif
Bram Moolenaar071d4272004-06-13 20:20:40 +0000740 NULL
741};
742
743static int included_patches[] =
744{ /* Add new patch number below this line */
745/**/
Bram Moolenaar70188f52019-12-23 18:18:52 +0100746 34,
747/**/
Bram Moolenaar7c77b342019-12-22 19:40:40 +0100748 33,
749/**/
Bram Moolenaar7c2a2f82019-12-22 18:28:51 +0100750 32,
751/**/
Bram Moolenaarba0a7472019-12-22 16:09:06 +0100752 31,
753/**/
Bram Moolenaar64e74c92019-12-22 15:38:06 +0100754 30,
755/**/
Bram Moolenaara27655e2019-12-21 22:22:01 +0100756 29,
757/**/
Bram Moolenaar3ba35402019-12-21 22:00:50 +0100758 28,
759/**/
Bram Moolenaaraa2f0ee2019-12-21 18:47:26 +0100760 27,
761/**/
Bram Moolenaar85a20022019-12-21 18:25:54 +0100762 26,
763/**/
Bram Moolenaarfe72d082019-12-20 19:07:00 +0100764 25,
765/**/
Bram Moolenaara4ce82f2019-12-19 15:57:42 +0100766 24,
767/**/
Bram Moolenaar59cb0412019-12-18 22:26:31 +0100768 23,
769/**/
Bram Moolenaar0ce37332019-12-18 21:33:22 +0100770 22,
771/**/
Bram Moolenaarbc28e9f2019-12-18 20:10:23 +0100772 21,
773/**/
Bram Moolenaarf19f8d12019-12-18 19:36:23 +0100774 20,
775/**/
Bram Moolenaara9e96792019-12-17 22:40:15 +0100776 19,
777/**/
Bram Moolenaar91b65e42019-12-17 22:10:58 +0100778 18,
779/**/
Bram Moolenaar6f345a12019-12-17 21:27:18 +0100780 17,
781/**/
Bram Moolenaara48e78e2019-12-17 20:29:26 +0100782 16,
783/**/
Bram Moolenaare74331d2019-12-17 19:22:40 +0100784 15,
785/**/
Bram Moolenaarafc13bd2019-12-16 22:43:31 +0100786 14,
787/**/
Bram Moolenaarddef1292019-12-16 17:10:33 +0100788 13,
789/**/
Bram Moolenaar559b9c62019-12-15 18:09:19 +0100790 12,
791/**/
Bram Moolenaar5e5a98d2019-12-15 14:55:33 +0100792 11,
793/**/
Bram Moolenaarf9cb05c2019-12-15 13:39:22 +0100794 10,
795/**/
Bram Moolenaar95f0b6e2019-12-15 12:54:18 +0100796 9,
797/**/
Bram Moolenaar3e2d1c82019-12-14 20:35:01 +0100798 8,
799/**/
Bram Moolenaar09dd2bb2019-12-14 18:42:15 +0100800 7,
801/**/
Bram Moolenaar6e43b302019-12-14 17:53:27 +0100802 6,
803/**/
Bram Moolenaar50212252019-12-14 17:24:53 +0100804 5,
805/**/
Bram Moolenaara6e8f882019-12-14 16:18:15 +0100806 4,
807/**/
Bram Moolenaarf5f4b6c2019-12-14 13:17:11 +0100808 3,
809/**/
Bram Moolenaar3b681232019-12-13 19:35:55 +0100810 2,
811/**/
Bram Moolenaar74ee5e22019-12-13 18:13:22 +0100812 1,
813/**/
Bram Moolenaar071d4272004-06-13 20:20:40 +0000814 0
815};
816
Bram Moolenaar10d4cec2008-11-30 11:15:09 +0000817/*
818 * Place to put a short description when adding a feature with a patch.
819 * Keep it short, e.g.,: "relative numbers", "persistent undo".
820 * Also add a comment marker to separate the lines.
821 * See the official Vim patches for the diff format: It must use a context of
Bram Moolenaarcbb8eb32008-12-24 13:25:14 +0000822 * one line only. Create it by hand or use "diff -C2" and edit the patch.
Bram Moolenaar10d4cec2008-11-30 11:15:09 +0000823 */
824static char *(extra_patches[]) =
825{ /* Add your patch description below this line */
826/**/
827 NULL
828};
829
Bram Moolenaar071d4272004-06-13 20:20:40 +0000830 int
Bram Moolenaarb638a7b2016-01-30 21:29:58 +0100831highest_patch(void)
Bram Moolenaar071d4272004-06-13 20:20:40 +0000832{
Bram Moolenaar37df9a42019-06-14 14:39:51 +0200833 // this relies on the highest patch number to be the first entry
834 return included_patches[0];
Bram Moolenaar071d4272004-06-13 20:20:40 +0000835}
836
837#if defined(FEAT_EVAL) || defined(PROTO)
838/*
839 * Return TRUE if patch "n" has been included.
840 */
841 int
Bram Moolenaarb638a7b2016-01-30 21:29:58 +0100842has_patch(int n)
Bram Moolenaar071d4272004-06-13 20:20:40 +0000843{
844 int i;
845
846 for (i = 0; included_patches[i] != 0; ++i)
847 if (included_patches[i] == n)
848 return TRUE;
849 return FALSE;
850}
851#endif
852
853 void
Bram Moolenaarb638a7b2016-01-30 21:29:58 +0100854ex_version(exarg_T *eap)
Bram Moolenaar071d4272004-06-13 20:20:40 +0000855{
856 /*
857 * Ignore a ":version 9.99" command.
858 */
859 if (*eap->arg == NUL)
860 {
861 msg_putchar('\n');
862 list_version();
863 }
864}
865
Bram Moolenaar445f3032013-02-20 16:47:36 +0100866/*
Bram Moolenaar5d69da42018-04-20 22:01:41 +0200867 * Output a string for the version message. If it's going to wrap, output a
868 * newline, unless the message is too long to fit on the screen anyway.
869 * When "wrap" is TRUE wrap the string in [].
870 */
871 static void
872version_msg_wrap(char_u *s, int wrap)
873{
874 int len = (int)vim_strsize(s) + (wrap ? 2 : 0);
875
876 if (!got_int && len < (int)Columns && msg_col + len >= (int)Columns
877 && *s != '\n')
878 msg_putchar('\n');
879 if (!got_int)
880 {
881 if (wrap)
Bram Moolenaar32526b32019-01-19 17:43:09 +0100882 msg_puts("[");
883 msg_puts((char *)s);
Bram Moolenaar5d69da42018-04-20 22:01:41 +0200884 if (wrap)
Bram Moolenaar32526b32019-01-19 17:43:09 +0100885 msg_puts("]");
Bram Moolenaar5d69da42018-04-20 22:01:41 +0200886 }
887}
888
889 static void
890version_msg(char *s)
891{
892 version_msg_wrap((char_u *)s, FALSE);
893}
894
895/*
Bram Moolenaar445f3032013-02-20 16:47:36 +0100896 * List all features aligned in columns, dictionary style.
897 */
898 static void
Bram Moolenaarb638a7b2016-01-30 21:29:58 +0100899list_features(void)
Bram Moolenaar445f3032013-02-20 16:47:36 +0100900{
Bram Moolenaar5d69da42018-04-20 22:01:41 +0200901 list_in_columns((char_u **)features, -1, -1);
902}
903
904/*
905 * List string items nicely aligned in columns.
906 * When "size" is < 0 then the last entry is marked with NULL.
907 * The entry with index "current" is inclosed in [].
908 */
909 void
910list_in_columns(char_u **items, int size, int current)
911{
Bram Moolenaar445f3032013-02-20 16:47:36 +0100912 int i;
913 int ncol;
914 int nrow;
Bram Moolenaar949f1982019-07-23 23:00:08 +0200915 int cur_row = 1;
Bram Moolenaar5d69da42018-04-20 22:01:41 +0200916 int item_count = 0;
Bram Moolenaar445f3032013-02-20 16:47:36 +0100917 int width = 0;
Bram Moolenaarc85ffc92019-01-02 17:26:35 +0100918#ifdef FEAT_SYN_HL
919 int use_highlight = (items == (char_u **)features);
920#endif
Bram Moolenaar445f3032013-02-20 16:47:36 +0100921
Bram Moolenaaraa2f0ee2019-12-21 18:47:26 +0100922 // Find the length of the longest item, use that + 1 as the column
923 // width.
Bram Moolenaar5d69da42018-04-20 22:01:41 +0200924 for (i = 0; size < 0 ? items[i] != NULL : i < size; ++i)
Bram Moolenaar445f3032013-02-20 16:47:36 +0100925 {
Bram Moolenaar5d69da42018-04-20 22:01:41 +0200926 int l = (int)vim_strsize(items[i]) + (i == current ? 2 : 0);
Bram Moolenaar445f3032013-02-20 16:47:36 +0100927
928 if (l > width)
929 width = l;
Bram Moolenaar5d69da42018-04-20 22:01:41 +0200930 ++item_count;
Bram Moolenaar445f3032013-02-20 16:47:36 +0100931 }
932 width += 1;
933
934 if (Columns < width)
935 {
Bram Moolenaar9800bfe2019-07-27 21:23:45 +0200936 // Not enough screen columns - show one per line
Bram Moolenaare961cba2018-09-18 21:51:47 +0200937 for (i = 0; i < item_count; ++i)
Bram Moolenaar445f3032013-02-20 16:47:36 +0100938 {
Bram Moolenaar5d69da42018-04-20 22:01:41 +0200939 version_msg_wrap(items[i], i == current);
Bram Moolenaar9800bfe2019-07-27 21:23:45 +0200940 if (msg_col > 0 && i < item_count - 1)
Bram Moolenaar445f3032013-02-20 16:47:36 +0100941 msg_putchar('\n');
942 }
943 return;
944 }
945
Bram Moolenaar949f1982019-07-23 23:00:08 +0200946 // The rightmost column doesn't need a separator.
947 // Sacrifice it to fit in one more column if possible.
Bram Moolenaarf13f45d2013-02-26 15:27:23 +0100948 ncol = (int) (Columns + 1) / width;
Bram Moolenaar5d69da42018-04-20 22:01:41 +0200949 nrow = item_count / ncol + (item_count % ncol ? 1 : 0);
Bram Moolenaar445f3032013-02-20 16:47:36 +0100950
Bram Moolenaar9800bfe2019-07-27 21:23:45 +0200951 // "i" counts columns then rows. "idx" counts rows then columns.
Bram Moolenaar445f3032013-02-20 16:47:36 +0100952 for (i = 0; !got_int && i < nrow * ncol; ++i)
953 {
954 int idx = (i / ncol) + (i % ncol) * nrow;
955
Bram Moolenaar5d69da42018-04-20 22:01:41 +0200956 if (idx < item_count)
Bram Moolenaar445f3032013-02-20 16:47:36 +0100957 {
958 int last_col = (i + 1) % ncol == 0;
959
Bram Moolenaar5d69da42018-04-20 22:01:41 +0200960 if (idx == current)
961 msg_putchar('[');
Bram Moolenaarc85ffc92019-01-02 17:26:35 +0100962#ifdef FEAT_SYN_HL
963 if (use_highlight && items[idx][0] == '-')
Bram Moolenaar32526b32019-01-19 17:43:09 +0100964 msg_puts_attr((char *)items[idx], HL_ATTR(HLF_W));
Bram Moolenaarc85ffc92019-01-02 17:26:35 +0100965 else
966#endif
Bram Moolenaar32526b32019-01-19 17:43:09 +0100967 msg_puts((char *)items[idx]);
Bram Moolenaar5d69da42018-04-20 22:01:41 +0200968 if (idx == current)
969 msg_putchar(']');
Bram Moolenaar445f3032013-02-20 16:47:36 +0100970 if (last_col)
971 {
Bram Moolenaar949f1982019-07-23 23:00:08 +0200972 if (msg_col > 0 && cur_row < nrow)
Bram Moolenaar445f3032013-02-20 16:47:36 +0100973 msg_putchar('\n');
Bram Moolenaar949f1982019-07-23 23:00:08 +0200974 ++cur_row;
Bram Moolenaar445f3032013-02-20 16:47:36 +0100975 }
976 else
977 {
978 while (msg_col % width)
979 msg_putchar(' ');
980 }
981 }
Bram Moolenaar74da3932019-07-25 21:52:39 +0200982 else
983 {
984 // this row is out of items, thus at the end of the row
Bram Moolenaar9800bfe2019-07-27 21:23:45 +0200985 if (msg_col > 0)
986 {
987 if (cur_row < nrow)
988 msg_putchar('\n');
989 ++cur_row;
990 }
Bram Moolenaar74da3932019-07-25 21:52:39 +0200991 }
Bram Moolenaar445f3032013-02-20 16:47:36 +0100992 }
993}
Bram Moolenaar5c962632013-02-26 11:25:33 +0100994
Bram Moolenaar071d4272004-06-13 20:20:40 +0000995 void
Bram Moolenaarb638a7b2016-01-30 21:29:58 +0100996list_version(void)
Bram Moolenaar071d4272004-06-13 20:20:40 +0000997{
998 int i;
999 int first;
1000 char *s = "";
1001
1002 /*
1003 * When adding features here, don't forget to update the list of
1004 * internal variables in eval.c!
1005 */
Bram Moolenaar35fb6fb2018-06-23 16:12:21 +02001006 init_longVersion();
Bram Moolenaar32526b32019-01-19 17:43:09 +01001007 msg(longVersion);
Bram Moolenaar4f974752019-02-17 17:44:42 +01001008#ifdef MSWIN
1009# ifdef FEAT_GUI_MSWIN
Bram Moolenaarafde13b2019-04-28 19:46:49 +02001010# ifdef VIMDLL
1011# ifdef _WIN64
1012 msg_puts(_("\nMS-Windows 64-bit GUI/console version"));
1013# else
1014 msg_puts(_("\nMS-Windows 32-bit GUI/console version"));
1015# endif
Bram Moolenaarcea912a2016-10-12 14:20:24 +02001016# else
Bram Moolenaarafde13b2019-04-28 19:46:49 +02001017# ifdef _WIN64
1018 msg_puts(_("\nMS-Windows 64-bit GUI version"));
1019# else
Bram Moolenaar32526b32019-01-19 17:43:09 +01001020 msg_puts(_("\nMS-Windows 32-bit GUI version"));
Bram Moolenaarafde13b2019-04-28 19:46:49 +02001021# endif
Bram Moolenaar071d4272004-06-13 20:20:40 +00001022# endif
Bram Moolenaar4f974752019-02-17 17:44:42 +01001023# ifdef FEAT_OLE
Bram Moolenaar32526b32019-01-19 17:43:09 +01001024 msg_puts(_(" with OLE support"));
Bram Moolenaar4f974752019-02-17 17:44:42 +01001025# endif
Bram Moolenaar071d4272004-06-13 20:20:40 +00001026# else
Bram Moolenaare7cb9cf2008-06-20 14:32:41 +00001027# ifdef _WIN64
Bram Moolenaar32526b32019-01-19 17:43:09 +01001028 msg_puts(_("\nMS-Windows 64-bit console version"));
Bram Moolenaare7cb9cf2008-06-20 14:32:41 +00001029# else
Bram Moolenaar32526b32019-01-19 17:43:09 +01001030 msg_puts(_("\nMS-Windows 32-bit console version"));
Bram Moolenaare7cb9cf2008-06-20 14:32:41 +00001031# endif
Bram Moolenaar071d4272004-06-13 20:20:40 +00001032# endif
1033#endif
Bram Moolenaard0573012017-10-28 21:11:06 +02001034#if defined(MACOS_X)
1035# if defined(MACOS_X_DARWIN)
Bram Moolenaar32526b32019-01-19 17:43:09 +01001036 msg_puts(_("\nmacOS version"));
Bram Moolenaard0573012017-10-28 21:11:06 +02001037# else
Bram Moolenaar32526b32019-01-19 17:43:09 +01001038 msg_puts(_("\nmacOS version w/o darwin feat."));
Bram Moolenaar071d4272004-06-13 20:20:40 +00001039# endif
1040#endif
1041
Bram Moolenaar071d4272004-06-13 20:20:40 +00001042#ifdef VMS
Bram Moolenaar32526b32019-01-19 17:43:09 +01001043 msg_puts(_("\nOpenVMS version"));
Bram Moolenaar3d20ca12006-11-28 16:43:58 +00001044# ifdef HAVE_PATHDEF
1045 if (*compiled_arch != NUL)
1046 {
Bram Moolenaar32526b32019-01-19 17:43:09 +01001047 msg_puts(" - ");
1048 msg_puts((char *)compiled_arch);
Bram Moolenaar3d20ca12006-11-28 16:43:58 +00001049 }
1050# endif
1051
Bram Moolenaar071d4272004-06-13 20:20:40 +00001052#endif
1053
Bram Moolenaaraa2f0ee2019-12-21 18:47:26 +01001054 // Print the list of patch numbers if there is at least one.
1055 // Print a range when patches are consecutive: "1-10, 12, 15-40, 42-45"
Bram Moolenaar071d4272004-06-13 20:20:40 +00001056 if (included_patches[0] != 0)
1057 {
Bram Moolenaar32526b32019-01-19 17:43:09 +01001058 msg_puts(_("\nIncluded patches: "));
Bram Moolenaar071d4272004-06-13 20:20:40 +00001059 first = -1;
Bram Moolenaaraa2f0ee2019-12-21 18:47:26 +01001060 // find last one
Bram Moolenaar071d4272004-06-13 20:20:40 +00001061 for (i = 0; included_patches[i] != 0; ++i)
1062 ;
1063 while (--i >= 0)
1064 {
1065 if (first < 0)
1066 first = included_patches[i];
1067 if (i == 0 || included_patches[i - 1] != included_patches[i] + 1)
1068 {
Bram Moolenaar32526b32019-01-19 17:43:09 +01001069 msg_puts(s);
Bram Moolenaar071d4272004-06-13 20:20:40 +00001070 s = ", ";
1071 msg_outnum((long)first);
1072 if (first != included_patches[i])
1073 {
Bram Moolenaar32526b32019-01-19 17:43:09 +01001074 msg_puts("-");
Bram Moolenaar071d4272004-06-13 20:20:40 +00001075 msg_outnum((long)included_patches[i]);
1076 }
1077 first = -1;
1078 }
1079 }
1080 }
1081
Bram Moolenaaraa2f0ee2019-12-21 18:47:26 +01001082 // Print the list of extra patch descriptions if there is at least one.
Bram Moolenaar10d4cec2008-11-30 11:15:09 +00001083 if (extra_patches[0] != NULL)
1084 {
Bram Moolenaar32526b32019-01-19 17:43:09 +01001085 msg_puts(_("\nExtra patches: "));
Bram Moolenaar10d4cec2008-11-30 11:15:09 +00001086 s = "";
1087 for (i = 0; extra_patches[i] != NULL; ++i)
1088 {
Bram Moolenaar32526b32019-01-19 17:43:09 +01001089 msg_puts(s);
Bram Moolenaar10d4cec2008-11-30 11:15:09 +00001090 s = ", ";
Bram Moolenaar32526b32019-01-19 17:43:09 +01001091 msg_puts(extra_patches[i]);
Bram Moolenaar10d4cec2008-11-30 11:15:09 +00001092 }
1093 }
1094
Bram Moolenaar071d4272004-06-13 20:20:40 +00001095#ifdef MODIFIED_BY
Bram Moolenaar32526b32019-01-19 17:43:09 +01001096 msg_puts("\n");
1097 msg_puts(_("Modified by "));
1098 msg_puts(MODIFIED_BY);
Bram Moolenaar071d4272004-06-13 20:20:40 +00001099#endif
1100
1101#ifdef HAVE_PATHDEF
1102 if (*compiled_user != NUL || *compiled_sys != NUL)
1103 {
Bram Moolenaar32526b32019-01-19 17:43:09 +01001104 msg_puts(_("\nCompiled "));
Bram Moolenaar071d4272004-06-13 20:20:40 +00001105 if (*compiled_user != NUL)
1106 {
Bram Moolenaar32526b32019-01-19 17:43:09 +01001107 msg_puts(_("by "));
1108 msg_puts((char *)compiled_user);
Bram Moolenaar071d4272004-06-13 20:20:40 +00001109 }
1110 if (*compiled_sys != NUL)
1111 {
Bram Moolenaar32526b32019-01-19 17:43:09 +01001112 msg_puts("@");
1113 msg_puts((char *)compiled_sys);
Bram Moolenaar071d4272004-06-13 20:20:40 +00001114 }
1115 }
1116#endif
1117
1118#ifdef FEAT_HUGE
Bram Moolenaar32526b32019-01-19 17:43:09 +01001119 msg_puts(_("\nHuge version "));
Bram Moolenaar071d4272004-06-13 20:20:40 +00001120#else
1121# ifdef FEAT_BIG
Bram Moolenaar32526b32019-01-19 17:43:09 +01001122 msg_puts(_("\nBig version "));
Bram Moolenaar071d4272004-06-13 20:20:40 +00001123# else
1124# ifdef FEAT_NORMAL
Bram Moolenaar32526b32019-01-19 17:43:09 +01001125 msg_puts(_("\nNormal version "));
Bram Moolenaar071d4272004-06-13 20:20:40 +00001126# else
1127# ifdef FEAT_SMALL
Bram Moolenaar32526b32019-01-19 17:43:09 +01001128 msg_puts(_("\nSmall version "));
Bram Moolenaar071d4272004-06-13 20:20:40 +00001129# else
Bram Moolenaar32526b32019-01-19 17:43:09 +01001130 msg_puts(_("\nTiny version "));
Bram Moolenaar071d4272004-06-13 20:20:40 +00001131# endif
1132# endif
1133# endif
1134#endif
1135#ifndef FEAT_GUI
Bram Moolenaar32526b32019-01-19 17:43:09 +01001136 msg_puts(_("without GUI."));
Bram Moolenaar071d4272004-06-13 20:20:40 +00001137#else
1138# ifdef FEAT_GUI_GTK
Bram Moolenaar98921892016-02-23 17:14:37 +01001139# ifdef USE_GTK3
Bram Moolenaar32526b32019-01-19 17:43:09 +01001140 msg_puts(_("with GTK3 GUI."));
Bram Moolenaar071d4272004-06-13 20:20:40 +00001141# else
Bram Moolenaar98921892016-02-23 17:14:37 +01001142# ifdef FEAT_GUI_GNOME
Bram Moolenaar32526b32019-01-19 17:43:09 +01001143 msg_puts(_("with GTK2-GNOME GUI."));
Bram Moolenaar98921892016-02-23 17:14:37 +01001144# else
Bram Moolenaar32526b32019-01-19 17:43:09 +01001145 msg_puts(_("with GTK2 GUI."));
Bram Moolenaar98921892016-02-23 17:14:37 +01001146# endif
1147# endif
Bram Moolenaar071d4272004-06-13 20:20:40 +00001148# else
1149# ifdef FEAT_GUI_MOTIF
Bram Moolenaar32526b32019-01-19 17:43:09 +01001150 msg_puts(_("with X11-Motif GUI."));
Bram Moolenaar071d4272004-06-13 20:20:40 +00001151# else
1152# ifdef FEAT_GUI_ATHENA
1153# ifdef FEAT_GUI_NEXTAW
Bram Moolenaar32526b32019-01-19 17:43:09 +01001154 msg_puts(_("with X11-neXtaw GUI."));
Bram Moolenaar071d4272004-06-13 20:20:40 +00001155# else
Bram Moolenaar32526b32019-01-19 17:43:09 +01001156 msg_puts(_("with X11-Athena GUI."));
Bram Moolenaar071d4272004-06-13 20:20:40 +00001157# endif
1158# else
Bram Moolenaar071d4272004-06-13 20:20:40 +00001159# ifdef FEAT_GUI_PHOTON
Bram Moolenaar32526b32019-01-19 17:43:09 +01001160 msg_puts(_("with Photon GUI."));
Bram Moolenaar071d4272004-06-13 20:20:40 +00001161# else
1162# if defined(MSWIN)
Bram Moolenaar32526b32019-01-19 17:43:09 +01001163 msg_puts(_("with GUI."));
Bram Moolenaar071d4272004-06-13 20:20:40 +00001164# else
Bram Moolenaar860cae12010-06-05 23:22:07 +02001165# if defined(TARGET_API_MAC_CARBON) && TARGET_API_MAC_CARBON
Bram Moolenaar32526b32019-01-19 17:43:09 +01001166 msg_puts(_("with Carbon GUI."));
Bram Moolenaar071d4272004-06-13 20:20:40 +00001167# else
Bram Moolenaar860cae12010-06-05 23:22:07 +02001168# if defined(TARGET_API_MAC_OSX) && TARGET_API_MAC_OSX
Bram Moolenaar32526b32019-01-19 17:43:09 +01001169 msg_puts(_("with Cocoa GUI."));
Bram Moolenaar071d4272004-06-13 20:20:40 +00001170# else
Bram Moolenaar071d4272004-06-13 20:20:40 +00001171# endif
1172# endif
1173# endif
Bram Moolenaar071d4272004-06-13 20:20:40 +00001174# endif
1175# endif
1176# endif
1177# endif
1178#endif
1179 version_msg(_(" Features included (+) or not (-):\n"));
1180
Bram Moolenaar445f3032013-02-20 16:47:36 +01001181 list_features();
Bram Moolenaar8a5c29a2019-07-26 19:48:19 +02001182 if (msg_col > 0)
1183 msg_putchar('\n');
Bram Moolenaar071d4272004-06-13 20:20:40 +00001184
Bram Moolenaar071d4272004-06-13 20:20:40 +00001185#ifdef SYS_VIMRC_FILE
1186 version_msg(_(" system vimrc file: \""));
1187 version_msg(SYS_VIMRC_FILE);
1188 version_msg("\"\n");
1189#endif
1190#ifdef USR_VIMRC_FILE
1191 version_msg(_(" user vimrc file: \""));
1192 version_msg(USR_VIMRC_FILE);
1193 version_msg("\"\n");
1194#endif
1195#ifdef USR_VIMRC_FILE2
1196 version_msg(_(" 2nd user vimrc file: \""));
1197 version_msg(USR_VIMRC_FILE2);
1198 version_msg("\"\n");
1199#endif
1200#ifdef USR_VIMRC_FILE3
1201 version_msg(_(" 3rd user vimrc file: \""));
1202 version_msg(USR_VIMRC_FILE3);
1203 version_msg("\"\n");
1204#endif
1205#ifdef USR_EXRC_FILE
1206 version_msg(_(" user exrc file: \""));
1207 version_msg(USR_EXRC_FILE);
1208 version_msg("\"\n");
1209#endif
1210#ifdef USR_EXRC_FILE2
1211 version_msg(_(" 2nd user exrc file: \""));
1212 version_msg(USR_EXRC_FILE2);
1213 version_msg("\"\n");
1214#endif
1215#ifdef FEAT_GUI
1216# ifdef SYS_GVIMRC_FILE
1217 version_msg(_(" system gvimrc file: \""));
1218 version_msg(SYS_GVIMRC_FILE);
1219 version_msg("\"\n");
1220# endif
1221 version_msg(_(" user gvimrc file: \""));
1222 version_msg(USR_GVIMRC_FILE);
1223 version_msg("\"\n");
1224# ifdef USR_GVIMRC_FILE2
1225 version_msg(_("2nd user gvimrc file: \""));
1226 version_msg(USR_GVIMRC_FILE2);
1227 version_msg("\"\n");
1228# endif
1229# ifdef USR_GVIMRC_FILE3
1230 version_msg(_("3rd user gvimrc file: \""));
1231 version_msg(USR_GVIMRC_FILE3);
1232 version_msg("\"\n");
1233# endif
1234#endif
Bram Moolenaar8c08b5b2016-07-28 22:24:15 +02001235 version_msg(_(" defaults file: \""));
1236 version_msg(VIM_DEFAULTS_FILE);
1237 version_msg("\"\n");
Bram Moolenaar071d4272004-06-13 20:20:40 +00001238#ifdef FEAT_GUI
1239# ifdef SYS_MENU_FILE
1240 version_msg(_(" system menu file: \""));
1241 version_msg(SYS_MENU_FILE);
1242 version_msg("\"\n");
1243# endif
1244#endif
1245#ifdef HAVE_PATHDEF
1246 if (*default_vim_dir != NUL)
1247 {
1248 version_msg(_(" fall-back for $VIM: \""));
1249 version_msg((char *)default_vim_dir);
1250 version_msg("\"\n");
1251 }
1252 if (*default_vimruntime_dir != NUL)
1253 {
1254 version_msg(_(" f-b for $VIMRUNTIME: \""));
1255 version_msg((char *)default_vimruntime_dir);
1256 version_msg("\"\n");
1257 }
1258 version_msg(_("Compilation: "));
1259 version_msg((char *)all_cflags);
1260 version_msg("\n");
1261#ifdef VMS
1262 if (*compiler_version != NUL)
1263 {
1264 version_msg(_("Compiler: "));
1265 version_msg((char *)compiler_version);
1266 version_msg("\n");
1267 }
1268#endif
1269 version_msg(_("Linking: "));
1270 version_msg((char *)all_lflags);
1271#endif
1272#ifdef DEBUG
1273 version_msg("\n");
1274 version_msg(_(" DEBUG BUILD"));
1275#endif
1276}
1277
Bram Moolenaarbaaa7e92016-01-29 22:47:03 +01001278static void do_intro_line(int row, char_u *mesg, int add_version, int attr);
Bram Moolenaar071d4272004-06-13 20:20:40 +00001279
1280/*
Bram Moolenaar249f0dd2013-07-04 22:31:03 +02001281 * Show the intro message when not editing a file.
1282 */
1283 void
Bram Moolenaarb638a7b2016-01-30 21:29:58 +01001284maybe_intro_message(void)
Bram Moolenaar249f0dd2013-07-04 22:31:03 +02001285{
Bram Moolenaarb5aedf32017-03-12 18:23:53 +01001286 if (BUFEMPTY()
Bram Moolenaar249f0dd2013-07-04 22:31:03 +02001287 && curbuf->b_fname == NULL
Bram Moolenaar249f0dd2013-07-04 22:31:03 +02001288 && firstwin->w_next == NULL
Bram Moolenaar249f0dd2013-07-04 22:31:03 +02001289 && vim_strchr(p_shm, SHM_INTRO) == NULL)
1290 intro_message(FALSE);
1291}
1292
1293/*
Bram Moolenaar071d4272004-06-13 20:20:40 +00001294 * Give an introductory message about Vim.
1295 * Only used when starting Vim on an empty file, without a file name.
1296 * Or with the ":intro" command (for Sven :-).
1297 */
1298 void
Bram Moolenaarb638a7b2016-01-30 21:29:58 +01001299intro_message(
Bram Moolenaaraa2f0ee2019-12-21 18:47:26 +01001300 int colon) // TRUE for ":intro"
Bram Moolenaar071d4272004-06-13 20:20:40 +00001301{
1302 int i;
1303 int row;
1304 int blanklines;
1305 int sponsor;
1306 char *p;
1307 static char *(lines[]) =
1308 {
1309 N_("VIM - Vi IMproved"),
1310 "",
1311 N_("version "),
1312 N_("by Bram Moolenaar et al."),
1313#ifdef MODIFIED_BY
1314 " ",
1315#endif
1316 N_("Vim is open source and freely distributable"),
1317 "",
1318 N_("Help poor children in Uganda!"),
1319 N_("type :help iccf<Enter> for information "),
1320 "",
1321 N_("type :q<Enter> to exit "),
1322 N_("type :help<Enter> or <F1> for on-line help"),
Bram Moolenaar640102482016-09-12 16:23:34 +02001323 N_("type :help version8<Enter> for version info"),
Bram Moolenaar071d4272004-06-13 20:20:40 +00001324 NULL,
1325 "",
1326 N_("Running in Vi compatible mode"),
1327 N_("type :set nocp<Enter> for Vim defaults"),
1328 N_("type :help cp-default<Enter> for info on this"),
1329 };
1330#ifdef FEAT_GUI
1331 static char *(gui_lines[]) =
1332 {
1333 NULL,
1334 NULL,
1335 NULL,
1336 NULL,
1337#ifdef MODIFIED_BY
1338 NULL,
1339#endif
1340 NULL,
1341 NULL,
1342 NULL,
1343 N_("menu Help->Orphans for information "),
1344 NULL,
1345 N_("Running modeless, typed text is inserted"),
1346 N_("menu Edit->Global Settings->Toggle Insert Mode "),
1347 N_(" for two modes "),
1348 NULL,
1349 NULL,
1350 NULL,
1351 N_("menu Edit->Global Settings->Toggle Vi Compatible"),
1352 N_(" for Vim defaults "),
1353 };
1354#endif
1355
Bram Moolenaaraa2f0ee2019-12-21 18:47:26 +01001356 // blanklines = screen height - # message lines
Bram Moolenaar071d4272004-06-13 20:20:40 +00001357 blanklines = (int)Rows - ((sizeof(lines) / sizeof(char *)) - 1);
1358 if (!p_cp)
Bram Moolenaaraa2f0ee2019-12-21 18:47:26 +01001359 blanklines += 4; // add 4 for not showing "Vi compatible" message
Bram Moolenaar071d4272004-06-13 20:20:40 +00001360
Bram Moolenaaraa2f0ee2019-12-21 18:47:26 +01001361 // Don't overwrite a statusline. Depends on 'cmdheight'.
Bram Moolenaar071d4272004-06-13 20:20:40 +00001362 if (p_ls > 1)
1363 blanklines -= Rows - topframe->fr_height;
Bram Moolenaar071d4272004-06-13 20:20:40 +00001364 if (blanklines < 0)
1365 blanklines = 0;
1366
Bram Moolenaaraa2f0ee2019-12-21 18:47:26 +01001367 // Show the sponsor and register message one out of four times, the Uganda
1368 // message two out of four times.
Bram Moolenaarf4cd3e82005-12-22 22:47:02 +00001369 sponsor = (int)time(NULL);
Bram Moolenaar071d4272004-06-13 20:20:40 +00001370 sponsor = ((sponsor & 2) == 0) - ((sponsor & 4) == 0);
1371
Bram Moolenaaraa2f0ee2019-12-21 18:47:26 +01001372 // start displaying the message lines after half of the blank lines
Bram Moolenaar071d4272004-06-13 20:20:40 +00001373 row = blanklines / 2;
1374 if ((row >= 2 && Columns >= 50) || colon)
1375 {
1376 for (i = 0; i < (int)(sizeof(lines) / sizeof(char *)); ++i)
1377 {
1378 p = lines[i];
1379#ifdef FEAT_GUI
1380 if (p_im && gui.in_use && gui_lines[i] != NULL)
1381 p = gui_lines[i];
1382#endif
1383 if (p == NULL)
1384 {
1385 if (!p_cp)
1386 break;
1387 continue;
1388 }
1389 if (sponsor != 0)
1390 {
1391 if (strstr(p, "children") != NULL)
1392 p = sponsor < 0
1393 ? N_("Sponsor Vim development!")
1394 : N_("Become a registered Vim user!");
1395 else if (strstr(p, "iccf") != NULL)
1396 p = sponsor < 0
1397 ? N_("type :help sponsor<Enter> for information ")
1398 : N_("type :help register<Enter> for information ");
1399 else if (strstr(p, "Orphans") != NULL)
1400 p = N_("menu Help->Sponsor/Register for information ");
1401 }
1402 if (*p != NUL)
1403 do_intro_line(row, (char_u *)_(p), i == 2, 0);
1404 ++row;
1405 }
Bram Moolenaar071d4272004-06-13 20:20:40 +00001406 }
1407
Bram Moolenaaraa2f0ee2019-12-21 18:47:26 +01001408 // Make the wait-return message appear just below the text.
Bram Moolenaar071d4272004-06-13 20:20:40 +00001409 if (colon)
1410 msg_row = row;
1411}
1412
1413 static void
Bram Moolenaarb638a7b2016-01-30 21:29:58 +01001414do_intro_line(
1415 int row,
1416 char_u *mesg,
1417 int add_version,
1418 int attr)
Bram Moolenaar071d4272004-06-13 20:20:40 +00001419{
1420 char_u vers[20];
1421 int col;
1422 char_u *p;
1423 int l;
1424 int clen;
1425#ifdef MODIFIED_BY
1426# define MODBY_LEN 150
1427 char_u modby[MODBY_LEN];
1428
1429 if (*mesg == ' ')
1430 {
Bram Moolenaar589e43a2008-01-05 12:59:22 +00001431 vim_strncpy(modby, (char_u *)_("Modified by "), MODBY_LEN - 1);
Bram Moolenaar9b0ac222016-06-01 20:31:43 +02001432 l = (int)STRLEN(modby);
Bram Moolenaar589e43a2008-01-05 12:59:22 +00001433 vim_strncpy(modby + l, (char_u *)MODIFIED_BY, MODBY_LEN - l - 1);
Bram Moolenaar071d4272004-06-13 20:20:40 +00001434 mesg = modby;
1435 }
1436#endif
1437
Bram Moolenaaraa2f0ee2019-12-21 18:47:26 +01001438 // Center the message horizontally.
Bram Moolenaar071d4272004-06-13 20:20:40 +00001439 col = vim_strsize(mesg);
1440 if (add_version)
1441 {
1442 STRCPY(vers, mediumVersion);
1443 if (highest_patch())
1444 {
Bram Moolenaaraa2f0ee2019-12-21 18:47:26 +01001445 // Check for 9.9x or 9.9xx, alpha/beta version
Bram Moolenaar22df3f92010-10-27 16:01:27 +02001446 if (isalpha((int)vers[3]))
Bram Moolenaar071d4272004-06-13 20:20:40 +00001447 {
Bram Moolenaar552ac132012-03-07 18:03:10 +01001448 int len = (isalpha((int)vers[4])) ? 5 : 4;
1449 sprintf((char *)vers + len, ".%d%s", highest_patch(),
1450 mediumVersion + len);
Bram Moolenaar071d4272004-06-13 20:20:40 +00001451 }
1452 else
1453 sprintf((char *)vers + 3, ".%d", highest_patch());
1454 }
1455 col += (int)STRLEN(vers);
1456 }
1457 col = (Columns - col) / 2;
1458 if (col < 0)
1459 col = 0;
1460
Bram Moolenaaraa2f0ee2019-12-21 18:47:26 +01001461 // Split up in parts to highlight <> items differently.
Bram Moolenaar071d4272004-06-13 20:20:40 +00001462 for (p = mesg; *p != NUL; p += l)
1463 {
1464 clen = 0;
1465 for (l = 0; p[l] != NUL
1466 && (l == 0 || (p[l] != '<' && p[l - 1] != '>')); ++l)
1467 {
Bram Moolenaar071d4272004-06-13 20:20:40 +00001468 if (has_mbyte)
1469 {
1470 clen += ptr2cells(p + l);
Bram Moolenaar0fa313a2005-08-10 21:07:57 +00001471 l += (*mb_ptr2len)(p + l) - 1;
Bram Moolenaar071d4272004-06-13 20:20:40 +00001472 }
1473 else
Bram Moolenaar071d4272004-06-13 20:20:40 +00001474 clen += byte2cells(p[l]);
1475 }
Bram Moolenaar8820b482017-03-16 17:23:31 +01001476 screen_puts_len(p, l, row, col, *p == '<' ? HL_ATTR(HLF_8) : attr);
Bram Moolenaar071d4272004-06-13 20:20:40 +00001477 col += clen;
1478 }
1479
Bram Moolenaaraa2f0ee2019-12-21 18:47:26 +01001480 // Add the version number to the version line.
Bram Moolenaar071d4272004-06-13 20:20:40 +00001481 if (add_version)
1482 screen_puts(vers, row, col, 0);
1483}
1484
1485/*
1486 * ":intro": clear screen, display intro screen and wait for return.
1487 */
Bram Moolenaar071d4272004-06-13 20:20:40 +00001488 void
Bram Moolenaarb638a7b2016-01-30 21:29:58 +01001489ex_intro(exarg_T *eap UNUSED)
Bram Moolenaar071d4272004-06-13 20:20:40 +00001490{
1491 screenclear();
1492 intro_message(TRUE);
1493 wait_return(TRUE);
1494}