blob: 4ab241eb90780ebce1105b81d0fb3ec80f8ad8db [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
13# include <time.h> /* for time() */
14#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 Moolenaarb638a7b2016-01-30 21:29:58 +010040make_version(void)
Bram Moolenaar071d4272004-06-13 20:20:40 +000041{
42 /*
43 * Construct the long version string. Necessary because
44 * VAX C can't catenate strings in the preprocessor.
45 */
46 strcpy(longVersion, VIM_VERSION_LONG_DATE);
47 strcat(longVersion, __DATE__);
48 strcat(longVersion, " ");
49 strcat(longVersion, __TIME__);
50 strcat(longVersion, ")");
51}
52# else
53char *longVersion = VIM_VERSION_LONG_DATE __DATE__ " " __TIME__ ")";
54# endif
55#else
56char *longVersion = VIM_VERSION_LONG;
57#endif
58
Bram Moolenaarbaaa7e92016-01-29 22:47:03 +010059static void list_features(void);
Bram Moolenaar071d4272004-06-13 20:20:40 +000060
61static char *(features[]) =
62{
Bram Moolenaarb5ef5e12013-08-30 16:35:44 +020063#ifdef HAVE_ACL
64 "+acl",
65#else
66 "-acl",
67#endif
Bram Moolenaar071d4272004-06-13 20:20:40 +000068#ifdef AMIGA /* only for Amiga systems */
69# ifdef FEAT_ARP
70 "+ARP",
71# else
72 "-ARP",
73# endif
74#endif
75#ifdef FEAT_ARABIC
76 "+arabic",
77#else
78 "-arabic",
79#endif
Bram Moolenaar071d4272004-06-13 20:20:40 +000080 "+autocmd",
Bram Moolenaare42a6d22017-11-12 19:21:51 +010081#ifdef FEAT_AUTOSERVERNAME
82 "+autoservername",
83#else
84 "-autoservername",
85#endif
Bram Moolenaarc3719bd2017-11-18 22:13:31 +010086#ifdef FEAT_BEVAL_GUI
Bram Moolenaar071d4272004-06-13 20:20:40 +000087 "+balloon_eval",
88#else
89 "-balloon_eval",
90#endif
Bram Moolenaarc3719bd2017-11-18 22:13:31 +010091#ifdef FEAT_BEVAL_TERM
Bram Moolenaar51b0f372017-11-18 18:52:04 +010092 "+balloon_eval_term",
93#else
94 "-balloon_eval_term",
95#endif
Bram Moolenaar071d4272004-06-13 20:20:40 +000096#ifdef FEAT_BROWSE
97 "+browse",
98#else
99 "-browse",
100#endif
101#ifdef NO_BUILTIN_TCAPS
102 "-builtin_terms",
103#endif
104#ifdef SOME_BUILTIN_TCAPS
105 "+builtin_terms",
106#endif
107#ifdef ALL_BUILTIN_TCAPS
108 "++builtin_terms",
109#endif
110#ifdef FEAT_BYTEOFF
111 "+byte_offset",
112#else
113 "-byte_offset",
114#endif
Bram Moolenaar509ce2a2016-03-11 22:52:15 +0100115#ifdef FEAT_JOB_CHANNEL
Bram Moolenaar5aec4812016-01-25 20:15:45 +0100116 "+channel",
117#else
118 "-channel",
119#endif
Bram Moolenaar071d4272004-06-13 20:20:40 +0000120#ifdef FEAT_CINDENT
121 "+cindent",
122#else
123 "-cindent",
124#endif
125#ifdef FEAT_CLIENTSERVER
126 "+clientserver",
127#else
128 "-clientserver",
129#endif
130#ifdef FEAT_CLIPBOARD
131 "+clipboard",
132#else
133 "-clipboard",
134#endif
135#ifdef FEAT_CMDL_COMPL
136 "+cmdline_compl",
137#else
138 "-cmdline_compl",
139#endif
140#ifdef FEAT_CMDHIST
141 "+cmdline_hist",
142#else
143 "-cmdline_hist",
144#endif
145#ifdef FEAT_CMDL_INFO
146 "+cmdline_info",
147#else
148 "-cmdline_info",
149#endif
150#ifdef FEAT_COMMENTS
151 "+comments",
152#else
153 "-comments",
154#endif
Bram Moolenaar860cae12010-06-05 23:22:07 +0200155#ifdef FEAT_CONCEAL
156 "+conceal",
157#else
158 "-conceal",
159#endif
Bram Moolenaar071d4272004-06-13 20:20:40 +0000160#ifdef FEAT_CRYPT
161 "+cryptv",
162#else
163 "-cryptv",
164#endif
165#ifdef FEAT_CSCOPE
166 "+cscope",
167#else
168 "-cscope",
169#endif
Bram Moolenaar860cae12010-06-05 23:22:07 +0200170 "+cursorbind",
Bram Moolenaar17c7c012006-01-26 22:25:15 +0000171#ifdef CURSOR_SHAPE
172 "+cursorshape",
173#else
174 "-cursorshape",
175#endif
Bram Moolenaar071d4272004-06-13 20:20:40 +0000176#if defined(FEAT_CON_DIALOG) && defined(FEAT_GUI_DIALOG)
177 "+dialog_con_gui",
178#else
179# if defined(FEAT_CON_DIALOG)
180 "+dialog_con",
181# else
182# if defined(FEAT_GUI_DIALOG)
183 "+dialog_gui",
184# else
185 "-dialog",
186# endif
187# endif
188#endif
189#ifdef FEAT_DIFF
190 "+diff",
191#else
192 "-diff",
193#endif
194#ifdef FEAT_DIGRAPHS
195 "+digraphs",
196#else
197 "-digraphs",
198#endif
Bram Moolenaarb5a7a8b2014-08-06 14:52:30 +0200199#ifdef FEAT_GUI_W32
200# ifdef FEAT_DIRECTX
201 "+directx",
202# else
203 "-directx",
204# endif
205#endif
Bram Moolenaar071d4272004-06-13 20:20:40 +0000206#ifdef FEAT_DND
207 "+dnd",
208#else
209 "-dnd",
210#endif
211#ifdef EBCDIC
212 "+ebcdic",
213#else
214 "-ebcdic",
215#endif
216#ifdef FEAT_EMACS_TAGS
217 "+emacs_tags",
218#else
219 "-emacs_tags",
220#endif
221#ifdef FEAT_EVAL
222 "+eval",
223#else
224 "-eval",
225#endif
Bram Moolenaar071d4272004-06-13 20:20:40 +0000226 "+ex_extra",
Bram Moolenaar071d4272004-06-13 20:20:40 +0000227#ifdef FEAT_SEARCH_EXTRA
228 "+extra_search",
229#else
230 "-extra_search",
231#endif
232#ifdef FEAT_FKMAP
233 "+farsi",
234#else
235 "-farsi",
236#endif
237#ifdef FEAT_SEARCHPATH
238 "+file_in_path",
239#else
240 "-file_in_path",
241#endif
242#ifdef FEAT_FIND_ID
243 "+find_in_path",
244#else
245 "-find_in_path",
246#endif
Bram Moolenaar446cb832008-06-24 21:56:24 +0000247#ifdef FEAT_FLOAT
248 "+float",
249#else
250 "-float",
251#endif
Bram Moolenaar071d4272004-06-13 20:20:40 +0000252#ifdef FEAT_FOLDING
253 "+folding",
254#else
255 "-folding",
256#endif
257#ifdef FEAT_FOOTER
258 "+footer",
259#else
260 "-footer",
261#endif
262 /* only interesting on Unix systems */
263#if !defined(USE_SYSTEM) && defined(UNIX)
264 "+fork()",
265#endif
266#ifdef FEAT_GETTEXT
267# ifdef DYNAMIC_GETTEXT
268 "+gettext/dyn",
269# else
270 "+gettext",
271# endif
272#else
273 "-gettext",
274#endif
275#ifdef FEAT_HANGULIN
276 "+hangul_input",
277#else
278 "-hangul_input",
279#endif
280#if (defined(HAVE_ICONV_H) && defined(USE_ICONV)) || defined(DYNAMIC_ICONV)
281# ifdef DYNAMIC_ICONV
282 "+iconv/dyn",
283# else
284 "+iconv",
285# endif
286#else
287 "-iconv",
288#endif
289#ifdef FEAT_INS_EXPAND
290 "+insert_expand",
291#else
292 "-insert_expand",
293#endif
Bram Moolenaar509ce2a2016-03-11 22:52:15 +0100294#ifdef FEAT_JOB_CHANNEL
Bram Moolenaar835dc632016-02-07 14:27:38 +0100295 "+job",
296#else
297 "-job",
298#endif
Bram Moolenaar071d4272004-06-13 20:20:40 +0000299#ifdef FEAT_JUMPLIST
300 "+jumplist",
301#else
302 "-jumplist",
303#endif
304#ifdef FEAT_KEYMAP
305 "+keymap",
306#else
307 "-keymap",
308#endif
Bram Moolenaar9532fe72016-07-29 22:50:35 +0200309#ifdef FEAT_EVAL
310 "+lambda",
311#else
312 "-lambda",
313#endif
Bram Moolenaar071d4272004-06-13 20:20:40 +0000314#ifdef FEAT_LANGMAP
315 "+langmap",
316#else
317 "-langmap",
318#endif
319#ifdef FEAT_LIBCALL
320 "+libcall",
321#else
322 "-libcall",
323#endif
324#ifdef FEAT_LINEBREAK
325 "+linebreak",
326#else
327 "-linebreak",
328#endif
329#ifdef FEAT_LISP
330 "+lispindent",
331#else
332 "-lispindent",
333#endif
Bram Moolenaar071d4272004-06-13 20:20:40 +0000334 "+listcmds",
Bram Moolenaar071d4272004-06-13 20:20:40 +0000335#ifdef FEAT_LOCALMAP
336 "+localmap",
337#else
338 "-localmap",
339#endif
Bram Moolenaar0ba04292010-07-14 23:23:17 +0200340#ifdef FEAT_LUA
341# ifdef DYNAMIC_LUA
342 "+lua/dyn",
343# else
344 "+lua",
345# endif
346#else
347 "-lua",
348#endif
Bram Moolenaar071d4272004-06-13 20:20:40 +0000349#ifdef FEAT_MENU
350 "+menu",
351#else
352 "-menu",
353#endif
354#ifdef FEAT_SESSION
355 "+mksession",
356#else
357 "-mksession",
358#endif
359#ifdef FEAT_MODIFY_FNAME
360 "+modify_fname",
361#else
362 "-modify_fname",
363#endif
364#ifdef FEAT_MOUSE
365 "+mouse",
366# ifdef FEAT_MOUSESHAPE
367 "+mouseshape",
368# else
369 "-mouseshape",
370# endif
371# else
372 "-mouse",
373#endif
Bram Moolenaar707cfb82012-10-21 04:00:07 +0200374
Bram Moolenaar071d4272004-06-13 20:20:40 +0000375#if defined(UNIX) || defined(VMS)
376# ifdef FEAT_MOUSE_DEC
377 "+mouse_dec",
378# else
379 "-mouse_dec",
380# endif
381# ifdef FEAT_MOUSE_GPM
382 "+mouse_gpm",
383# else
384 "-mouse_gpm",
385# endif
386# ifdef FEAT_MOUSE_JSB
387 "+mouse_jsbterm",
388# else
389 "-mouse_jsbterm",
390# endif
391# ifdef FEAT_MOUSE_NET
392 "+mouse_netterm",
393# else
394 "-mouse_netterm",
395# endif
Bram Moolenaar071d4272004-06-13 20:20:40 +0000396#endif
Bram Moolenaar707cfb82012-10-21 04:00:07 +0200397
Bram Moolenaar071d4272004-06-13 20:20:40 +0000398#ifdef __QNX__
399# ifdef FEAT_MOUSE_PTERM
400 "+mouse_pterm",
401# else
402 "-mouse_pterm",
403# endif
404#endif
Bram Moolenaar707cfb82012-10-21 04:00:07 +0200405
406#if defined(UNIX) || defined(VMS)
407# ifdef FEAT_MOUSE_SGR
408 "+mouse_sgr",
409# else
410 "-mouse_sgr",
411# endif
412# ifdef FEAT_SYSMOUSE
413 "+mouse_sysmouse",
414# else
415 "-mouse_sysmouse",
416# endif
417# ifdef FEAT_MOUSE_URXVT
418 "+mouse_urxvt",
419# else
420 "-mouse_urxvt",
421# endif
422# ifdef FEAT_MOUSE_XTERM
423 "+mouse_xterm",
424# else
425 "-mouse_xterm",
426# endif
427#endif
428
Bram Moolenaar071d4272004-06-13 20:20:40 +0000429#ifdef FEAT_MBYTE_IME
430# ifdef DYNAMIC_IME
431 "+multi_byte_ime/dyn",
432# else
433 "+multi_byte_ime",
434# endif
435#else
436# ifdef FEAT_MBYTE
437 "+multi_byte",
438# else
439 "-multi_byte",
440# endif
441#endif
442#ifdef FEAT_MULTI_LANG
443 "+multi_lang",
444#else
445 "-multi_lang",
446#endif
Bram Moolenaar325b7a22004-07-05 15:58:32 +0000447#ifdef FEAT_MZSCHEME
Bram Moolenaardf3267e2005-01-25 22:07:05 +0000448# ifdef DYNAMIC_MZSCHEME
449 "+mzscheme/dyn",
450# else
Bram Moolenaar325b7a22004-07-05 15:58:32 +0000451 "+mzscheme",
Bram Moolenaardf3267e2005-01-25 22:07:05 +0000452# endif
Bram Moolenaar325b7a22004-07-05 15:58:32 +0000453#else
454 "-mzscheme",
455#endif
Bram Moolenaar071d4272004-06-13 20:20:40 +0000456#ifdef FEAT_NETBEANS_INTG
457 "+netbeans_intg",
458#else
459 "-netbeans_intg",
460#endif
Bram Moolenaar22fcfad2016-07-01 18:17:26 +0200461#ifdef FEAT_NUM64
462 "+num64",
463#else
464 "-num64",
465#endif
Bram Moolenaar071d4272004-06-13 20:20:40 +0000466#ifdef FEAT_GUI_W32
467# ifdef FEAT_OLE
468 "+ole",
469# else
470 "-ole",
471# endif
472#endif
Bram Moolenaarf6fee0e2016-02-21 23:02:49 +0100473 "+packages",
Bram Moolenaar071d4272004-06-13 20:20:40 +0000474#ifdef FEAT_PATH_EXTRA
475 "+path_extra",
476#else
477 "-path_extra",
478#endif
479#ifdef FEAT_PERL
480# ifdef DYNAMIC_PERL
481 "+perl/dyn",
482# else
483 "+perl",
484# endif
485#else
486 "-perl",
487#endif
Bram Moolenaar55debbe2010-05-23 23:34:36 +0200488#ifdef FEAT_PERSISTENT_UNDO
489 "+persistent_undo",
490#else
491 "-persistent_undo",
492#endif
Bram Moolenaar071d4272004-06-13 20:20:40 +0000493#ifdef FEAT_PRINTER
494# ifdef FEAT_POSTSCRIPT
495 "+postscript",
496# else
497 "-postscript",
498# endif
499 "+printer",
500#else
501 "-printer",
502#endif
Bram Moolenaar05159a02005-02-26 23:04:13 +0000503#ifdef FEAT_PROFILE
504 "+profile",
505#else
506 "-profile",
507#endif
Bram Moolenaar071d4272004-06-13 20:20:40 +0000508#ifdef FEAT_PYTHON
509# ifdef DYNAMIC_PYTHON
510 "+python/dyn",
511# else
512 "+python",
513# endif
514#else
515 "-python",
516#endif
Bram Moolenaarbd5e15f2010-07-17 21:19:38 +0200517#ifdef FEAT_PYTHON3
518# ifdef DYNAMIC_PYTHON3
519 "+python3/dyn",
520# else
521 "+python3",
522# endif
523#else
524 "-python3",
525#endif
Bram Moolenaar071d4272004-06-13 20:20:40 +0000526#ifdef FEAT_QUICKFIX
527 "+quickfix",
528#else
529 "-quickfix",
530#endif
Bram Moolenaard68071d2006-05-02 22:08:30 +0000531#ifdef FEAT_RELTIME
532 "+reltime",
533#else
534 "-reltime",
535#endif
Bram Moolenaar071d4272004-06-13 20:20:40 +0000536#ifdef FEAT_RIGHTLEFT
537 "+rightleft",
538#else
539 "-rightleft",
540#endif
541#ifdef FEAT_RUBY
542# ifdef DYNAMIC_RUBY
543 "+ruby/dyn",
544# else
545 "+ruby",
546# endif
547#else
548 "-ruby",
549#endif
Bram Moolenaar071d4272004-06-13 20:20:40 +0000550 "+scrollbind",
Bram Moolenaar071d4272004-06-13 20:20:40 +0000551#ifdef FEAT_SIGNS
552 "+signs",
553#else
554 "-signs",
555#endif
556#ifdef FEAT_SMARTINDENT
557 "+smartindent",
558#else
559 "-smartindent",
560#endif
Bram Moolenaaref94eec2009-11-11 13:22:11 +0000561#ifdef STARTUPTIME
562 "+startuptime",
563#else
564 "-startuptime",
565#endif
Bram Moolenaar071d4272004-06-13 20:20:40 +0000566#ifdef FEAT_STL_OPT
567 "+statusline",
568#else
569 "-statusline",
570#endif
571#ifdef FEAT_SUN_WORKSHOP
572 "+sun_workshop",
573#else
574 "-sun_workshop",
575#endif
576#ifdef FEAT_SYN_HL
577 "+syntax",
578#else
579 "-syntax",
580#endif
581 /* only interesting on Unix systems */
Bram Moolenaara06ecab2016-07-16 14:47:36 +0200582#if defined(USE_SYSTEM) && defined(UNIX)
Bram Moolenaar071d4272004-06-13 20:20:40 +0000583 "+system()",
584#endif
585#ifdef FEAT_TAG_BINS
586 "+tag_binary",
587#else
588 "-tag_binary",
589#endif
590#ifdef FEAT_TAG_OLDSTATIC
591 "+tag_old_static",
592#else
593 "-tag_old_static",
594#endif
595#ifdef FEAT_TAG_ANYWHITE
596 "+tag_any_white",
597#else
598 "-tag_any_white",
599#endif
600#ifdef FEAT_TCL
601# ifdef DYNAMIC_TCL
602 "+tcl/dyn",
603# else
604 "+tcl",
605# endif
606#else
607 "-tcl",
608#endif
Bram Moolenaar61be73b2016-04-29 22:59:22 +0200609#ifdef FEAT_TERMGUICOLORS
610 "+termguicolors",
611#else
612 "-termguicolors",
613#endif
Bram Moolenaar26e85582017-07-15 20:05:54 +0200614#ifdef FEAT_TERMINAL
615 "+terminal",
616#else
617 "-terminal",
618#endif
Bram Moolenaara06ecab2016-07-16 14:47:36 +0200619#if defined(UNIX)
620/* only Unix can have terminfo instead of termcap */
Bram Moolenaar071d4272004-06-13 20:20:40 +0000621# ifdef TERMINFO
622 "+terminfo",
623# else
624 "-terminfo",
625# endif
626#else /* unix always includes termcap support */
627# ifdef HAVE_TGETENT
628 "+tgetent",
629# else
630 "-tgetent",
631# endif
632#endif
633#ifdef FEAT_TERMRESPONSE
634 "+termresponse",
635#else
636 "-termresponse",
637#endif
638#ifdef FEAT_TEXTOBJ
639 "+textobjects",
640#else
641 "-textobjects",
642#endif
Bram Moolenaar975b5272016-03-15 23:10:59 +0100643#ifdef FEAT_TIMERS
644 "+timers",
645#else
646 "-timers",
647#endif
Bram Moolenaar071d4272004-06-13 20:20:40 +0000648#ifdef FEAT_TITLE
649 "+title",
650#else
651 "-title",
652#endif
653#ifdef FEAT_TOOLBAR
654 "+toolbar",
655#else
656 "-toolbar",
657#endif
658#ifdef FEAT_USR_CMDS
659 "+user_commands",
660#else
661 "-user_commands",
662#endif
Bram Moolenaar071d4272004-06-13 20:20:40 +0000663 "+vertsplit",
Bram Moolenaar071d4272004-06-13 20:20:40 +0000664#ifdef FEAT_VIRTUALEDIT
665 "+virtualedit",
666#else
667 "-virtualedit",
668#endif
Bram Moolenaar071d4272004-06-13 20:20:40 +0000669 "+visual",
Bram Moolenaarf7ff6e82014-03-23 15:13:05 +0100670#ifdef FEAT_VISUALEXTRA
Bram Moolenaar071d4272004-06-13 20:20:40 +0000671 "+visualextra",
Bram Moolenaar071d4272004-06-13 20:20:40 +0000672#else
Bram Moolenaarf7ff6e82014-03-23 15:13:05 +0100673 "-visualextra",
Bram Moolenaar071d4272004-06-13 20:20:40 +0000674#endif
675#ifdef FEAT_VIMINFO
676 "+viminfo",
677#else
678 "-viminfo",
679#endif
680#ifdef FEAT_VREPLACE
681 "+vreplace",
682#else
683 "-vreplace",
684#endif
Bram Moolenaarcafafb32018-02-22 21:07:09 +0100685#ifdef WIN3264
686# ifdef FEAT_VTP
687 "+vtp",
688# else
689 "-vtp",
690# endif
691#endif
Bram Moolenaar071d4272004-06-13 20:20:40 +0000692#ifdef FEAT_WILDIGN
693 "+wildignore",
694#else
695 "-wildignore",
696#endif
697#ifdef FEAT_WILDMENU
698 "+wildmenu",
699#else
700 "-wildmenu",
701#endif
Bram Moolenaar071d4272004-06-13 20:20:40 +0000702 "+windows",
Bram Moolenaar071d4272004-06-13 20:20:40 +0000703#ifdef FEAT_WRITEBACKUP
704 "+writebackup",
705#else
706 "-writebackup",
707#endif
708#if defined(UNIX) || defined(VMS)
709# ifdef FEAT_X11
710 "+X11",
711# else
712 "-X11",
713# endif
714#endif
715#ifdef FEAT_XFONTSET
716 "+xfontset",
717#else
718 "-xfontset",
719#endif
720#ifdef FEAT_XIM
721 "+xim",
722#else
723 "-xim",
724#endif
Bram Moolenaard58b0f92016-08-13 16:39:56 +0200725#ifdef WIN3264
726# ifdef FEAT_XPM_W32
727 "+xpm_w32",
728# else
729 "-xpm_w32",
730# endif
731#else
732# ifdef HAVE_XPM
733 "+xpm",
734# else
735 "-xpm",
736# endif
737#endif
Bram Moolenaar071d4272004-06-13 20:20:40 +0000738#if defined(UNIX) || defined(VMS)
739# ifdef USE_XSMP_INTERACT
740 "+xsmp_interact",
741# else
742# ifdef USE_XSMP
743 "+xsmp",
744# else
745 "-xsmp",
746# endif
747# endif
748# ifdef FEAT_XCLIPBOARD
749 "+xterm_clipboard",
750# else
751 "-xterm_clipboard",
752# endif
753#endif
754#ifdef FEAT_XTERM_SAVE
755 "+xterm_save",
756#else
757 "-xterm_save",
758#endif
Bram Moolenaar071d4272004-06-13 20:20:40 +0000759 NULL
760};
761
762static int included_patches[] =
763{ /* Add new patch number below this line */
764/**/
Bram Moolenaarf98b8452018-06-10 14:39:52 +0200765 42,
766/**/
Bram Moolenaare950f992018-06-10 13:55:55 +0200767 41,
768/**/
Bram Moolenaare31e2562018-06-10 13:12:55 +0200769 40,
770/**/
Bram Moolenaard79a2622018-06-07 18:17:46 +0200771 39,
772/**/
Bram Moolenaar680c99b2018-06-07 15:18:41 +0200773 38,
774/**/
Bram Moolenaarca851592018-06-06 21:04:07 +0200775 37,
776/**/
Bram Moolenaar891e1fd2018-06-06 18:02:39 +0200777 36,
778/**/
Bram Moolenaar6d41c782018-06-06 09:11:12 +0200779 35,
780/**/
Bram Moolenaaradb8fbe2018-06-04 20:34:23 +0200781 34,
782/**/
Bram Moolenaaracb9eff2018-06-04 19:11:11 +0200783 33,
784/**/
Bram Moolenaar6b810d92018-06-04 17:28:44 +0200785 32,
786/**/
Bram Moolenaarc8523e22018-06-03 18:22:02 +0200787 31,
788/**/
Bram Moolenaar3339d3d2018-06-03 17:10:40 +0200789 30,
790/**/
Bram Moolenaar1580f752018-06-03 15:26:36 +0200791 29,
792/**/
Bram Moolenaar11493822018-06-03 15:08:09 +0200793 28,
794/**/
Bram Moolenaarf2732452018-06-03 14:47:35 +0200795 27,
796/**/
Bram Moolenaar33c5e9f2018-05-26 18:58:51 +0200797 26,
798/**/
Bram Moolenaare5fa1112018-05-26 18:46:30 +0200799 25,
800/**/
Bram Moolenaar6b69e5c2018-05-26 18:39:32 +0200801 24,
802/**/
Bram Moolenaar22c10562018-05-26 17:35:27 +0200803 23,
804/**/
Bram Moolenaar833093b2018-05-23 21:53:52 +0200805 22,
806/**/
Bram Moolenaard315cf52018-05-23 20:30:56 +0200807 21,
808/**/
Bram Moolenaar0b6d9112018-05-22 20:35:17 +0200809 20,
810/**/
Bram Moolenaarb4518562018-05-22 18:31:35 +0200811 19,
812/**/
Bram Moolenaarbdb65792018-05-22 17:50:42 +0200813 18,
814/**/
Bram Moolenaar62fe66f2018-05-22 16:58:47 +0200815 17,
816/**/
Bram Moolenaard45aa552018-05-21 22:50:29 +0200817 16,
818/**/
Bram Moolenaar05af9a42018-05-21 18:48:12 +0200819 15,
820/**/
Bram Moolenaar6053f2d2018-05-21 16:56:38 +0200821 14,
822/**/
Bram Moolenaar4f7fd562018-05-21 14:55:28 +0200823 13,
824/**/
Bram Moolenaar1f131ae2018-05-21 13:39:40 +0200825 12,
826/**/
Bram Moolenaarf88a5bc2018-05-21 13:28:44 +0200827 11,
828/**/
Bram Moolenaar6bff7192018-05-20 15:41:17 +0200829 10,
830/**/
Bram Moolenaardbe88692018-05-20 14:57:22 +0200831 9,
832/**/
Bram Moolenaar42ab17b2018-05-20 14:11:10 +0200833 8,
834/**/
Bram Moolenaar2e949762018-05-20 14:06:38 +0200835 7,
836/**/
Bram Moolenaara772baf2018-05-20 13:35:44 +0200837 6,
838/**/
Bram Moolenaard19b2342018-05-19 16:45:15 +0200839 5,
840/**/
Bram Moolenaar54651f72018-05-19 15:52:11 +0200841 4,
842/**/
Bram Moolenaar10561fe2018-05-19 15:01:10 +0200843 3,
844/**/
Bram Moolenaar2abad542018-05-19 14:43:45 +0200845 2,
846/**/
Bram Moolenaar00e45562018-05-17 23:40:05 +0200847 1,
848/**/
Bram Moolenaar071d4272004-06-13 20:20:40 +0000849 0
850};
851
Bram Moolenaar10d4cec2008-11-30 11:15:09 +0000852/*
853 * Place to put a short description when adding a feature with a patch.
854 * Keep it short, e.g.,: "relative numbers", "persistent undo".
855 * Also add a comment marker to separate the lines.
856 * See the official Vim patches for the diff format: It must use a context of
Bram Moolenaarcbb8eb32008-12-24 13:25:14 +0000857 * one line only. Create it by hand or use "diff -C2" and edit the patch.
Bram Moolenaar10d4cec2008-11-30 11:15:09 +0000858 */
859static char *(extra_patches[]) =
860{ /* Add your patch description below this line */
861/**/
862 NULL
863};
864
Bram Moolenaar071d4272004-06-13 20:20:40 +0000865 int
Bram Moolenaarb638a7b2016-01-30 21:29:58 +0100866highest_patch(void)
Bram Moolenaar071d4272004-06-13 20:20:40 +0000867{
868 int i;
869 int h = 0;
870
871 for (i = 0; included_patches[i] != 0; ++i)
872 if (included_patches[i] > h)
873 h = included_patches[i];
874 return h;
875}
876
877#if defined(FEAT_EVAL) || defined(PROTO)
878/*
879 * Return TRUE if patch "n" has been included.
880 */
881 int
Bram Moolenaarb638a7b2016-01-30 21:29:58 +0100882has_patch(int n)
Bram Moolenaar071d4272004-06-13 20:20:40 +0000883{
884 int i;
885
886 for (i = 0; included_patches[i] != 0; ++i)
887 if (included_patches[i] == n)
888 return TRUE;
889 return FALSE;
890}
891#endif
892
893 void
Bram Moolenaarb638a7b2016-01-30 21:29:58 +0100894ex_version(exarg_T *eap)
Bram Moolenaar071d4272004-06-13 20:20:40 +0000895{
896 /*
897 * Ignore a ":version 9.99" command.
898 */
899 if (*eap->arg == NUL)
900 {
901 msg_putchar('\n');
902 list_version();
903 }
904}
905
Bram Moolenaar445f3032013-02-20 16:47:36 +0100906/*
Bram Moolenaar5d69da42018-04-20 22:01:41 +0200907 * Output a string for the version message. If it's going to wrap, output a
908 * newline, unless the message is too long to fit on the screen anyway.
909 * When "wrap" is TRUE wrap the string in [].
910 */
911 static void
912version_msg_wrap(char_u *s, int wrap)
913{
914 int len = (int)vim_strsize(s) + (wrap ? 2 : 0);
915
916 if (!got_int && len < (int)Columns && msg_col + len >= (int)Columns
917 && *s != '\n')
918 msg_putchar('\n');
919 if (!got_int)
920 {
921 if (wrap)
922 MSG_PUTS("[");
923 MSG_PUTS(s);
924 if (wrap)
925 MSG_PUTS("]");
926 }
927}
928
929 static void
930version_msg(char *s)
931{
932 version_msg_wrap((char_u *)s, FALSE);
933}
934
935/*
Bram Moolenaar445f3032013-02-20 16:47:36 +0100936 * List all features aligned in columns, dictionary style.
937 */
938 static void
Bram Moolenaarb638a7b2016-01-30 21:29:58 +0100939list_features(void)
Bram Moolenaar445f3032013-02-20 16:47:36 +0100940{
Bram Moolenaar5d69da42018-04-20 22:01:41 +0200941 list_in_columns((char_u **)features, -1, -1);
942}
943
944/*
945 * List string items nicely aligned in columns.
946 * When "size" is < 0 then the last entry is marked with NULL.
947 * The entry with index "current" is inclosed in [].
948 */
949 void
950list_in_columns(char_u **items, int size, int current)
951{
Bram Moolenaar445f3032013-02-20 16:47:36 +0100952 int i;
953 int ncol;
954 int nrow;
Bram Moolenaar5d69da42018-04-20 22:01:41 +0200955 int item_count = 0;
Bram Moolenaar445f3032013-02-20 16:47:36 +0100956 int width = 0;
957
Bram Moolenaar5d69da42018-04-20 22:01:41 +0200958 /* Find the length of the longest item, use that + 1 as the column
959 * width. */
960 for (i = 0; size < 0 ? items[i] != NULL : i < size; ++i)
Bram Moolenaar445f3032013-02-20 16:47:36 +0100961 {
Bram Moolenaar5d69da42018-04-20 22:01:41 +0200962 int l = (int)vim_strsize(items[i]) + (i == current ? 2 : 0);
Bram Moolenaar445f3032013-02-20 16:47:36 +0100963
964 if (l > width)
965 width = l;
Bram Moolenaar5d69da42018-04-20 22:01:41 +0200966 ++item_count;
Bram Moolenaar445f3032013-02-20 16:47:36 +0100967 }
968 width += 1;
969
970 if (Columns < width)
971 {
972 /* Not enough screen columns - show one per line */
Bram Moolenaar5d69da42018-04-20 22:01:41 +0200973 for (i = 0; items[i] != NULL; ++i)
Bram Moolenaar445f3032013-02-20 16:47:36 +0100974 {
Bram Moolenaar5d69da42018-04-20 22:01:41 +0200975 version_msg_wrap(items[i], i == current);
Bram Moolenaar445f3032013-02-20 16:47:36 +0100976 if (msg_col > 0)
977 msg_putchar('\n');
978 }
979 return;
980 }
981
Bram Moolenaar445f3032013-02-20 16:47:36 +0100982 /* The rightmost column doesn't need a separator.
983 * Sacrifice it to fit in one more column if possible. */
Bram Moolenaarf13f45d2013-02-26 15:27:23 +0100984 ncol = (int) (Columns + 1) / width;
Bram Moolenaar5d69da42018-04-20 22:01:41 +0200985 nrow = item_count / ncol + (item_count % ncol ? 1 : 0);
Bram Moolenaar445f3032013-02-20 16:47:36 +0100986
Bram Moolenaarf13f45d2013-02-26 15:27:23 +0100987 /* i counts columns then rows. idx counts rows then columns. */
Bram Moolenaar445f3032013-02-20 16:47:36 +0100988 for (i = 0; !got_int && i < nrow * ncol; ++i)
989 {
990 int idx = (i / ncol) + (i % ncol) * nrow;
991
Bram Moolenaar5d69da42018-04-20 22:01:41 +0200992 if (idx < item_count)
Bram Moolenaar445f3032013-02-20 16:47:36 +0100993 {
994 int last_col = (i + 1) % ncol == 0;
995
Bram Moolenaar5d69da42018-04-20 22:01:41 +0200996 if (idx == current)
997 msg_putchar('[');
998 msg_puts(items[idx]);
999 if (idx == current)
1000 msg_putchar(']');
Bram Moolenaar445f3032013-02-20 16:47:36 +01001001 if (last_col)
1002 {
1003 if (msg_col > 0)
1004 msg_putchar('\n');
1005 }
1006 else
1007 {
1008 while (msg_col % width)
1009 msg_putchar(' ');
1010 }
1011 }
1012 else
Bram Moolenaarf13f45d2013-02-26 15:27:23 +01001013 {
1014 if (msg_col > 0)
1015 msg_putchar('\n');
1016 }
Bram Moolenaar445f3032013-02-20 16:47:36 +01001017 }
1018}
Bram Moolenaar5c962632013-02-26 11:25:33 +01001019
Bram Moolenaar071d4272004-06-13 20:20:40 +00001020 void
Bram Moolenaarb638a7b2016-01-30 21:29:58 +01001021list_version(void)
Bram Moolenaar071d4272004-06-13 20:20:40 +00001022{
1023 int i;
1024 int first;
1025 char *s = "";
1026
1027 /*
1028 * When adding features here, don't forget to update the list of
1029 * internal variables in eval.c!
1030 */
1031 MSG(longVersion);
1032#ifdef WIN3264
1033# ifdef FEAT_GUI_W32
Bram Moolenaarcea912a2016-10-12 14:20:24 +02001034# ifdef _WIN64
Bram Moolenaare7cb9cf2008-06-20 14:32:41 +00001035 MSG_PUTS(_("\nMS-Windows 64-bit GUI version"));
Bram Moolenaarcea912a2016-10-12 14:20:24 +02001036# else
Bram Moolenaare7cb9cf2008-06-20 14:32:41 +00001037 MSG_PUTS(_("\nMS-Windows 32-bit GUI version"));
Bram Moolenaar071d4272004-06-13 20:20:40 +00001038# endif
Bram Moolenaar071d4272004-06-13 20:20:40 +00001039# ifdef FEAT_OLE
1040 MSG_PUTS(_(" with OLE support"));
1041# endif
1042# else
Bram Moolenaare7cb9cf2008-06-20 14:32:41 +00001043# ifdef _WIN64
1044 MSG_PUTS(_("\nMS-Windows 64-bit console version"));
1045# else
1046 MSG_PUTS(_("\nMS-Windows 32-bit console version"));
1047# endif
Bram Moolenaar071d4272004-06-13 20:20:40 +00001048# endif
1049#endif
Bram Moolenaard0573012017-10-28 21:11:06 +02001050#if defined(MACOS_X)
1051# if defined(MACOS_X_DARWIN)
1052 MSG_PUTS(_("\nmacOS version"));
1053# else
1054 MSG_PUTS(_("\nmacOS version w/o darwin feat."));
Bram Moolenaar071d4272004-06-13 20:20:40 +00001055# endif
1056#endif
1057
Bram Moolenaar071d4272004-06-13 20:20:40 +00001058#ifdef VMS
Bram Moolenaar6949d1d2008-08-25 02:14:05 +00001059 MSG_PUTS(_("\nOpenVMS version"));
Bram Moolenaar3d20ca12006-11-28 16:43:58 +00001060# ifdef HAVE_PATHDEF
1061 if (*compiled_arch != NUL)
1062 {
1063 MSG_PUTS(" - ");
1064 MSG_PUTS(compiled_arch);
1065 }
1066# endif
1067
Bram Moolenaar071d4272004-06-13 20:20:40 +00001068#endif
1069
1070 /* Print the list of patch numbers if there is at least one. */
1071 /* Print a range when patches are consecutive: "1-10, 12, 15-40, 42-45" */
1072 if (included_patches[0] != 0)
1073 {
1074 MSG_PUTS(_("\nIncluded patches: "));
1075 first = -1;
1076 /* find last one */
1077 for (i = 0; included_patches[i] != 0; ++i)
1078 ;
1079 while (--i >= 0)
1080 {
1081 if (first < 0)
1082 first = included_patches[i];
1083 if (i == 0 || included_patches[i - 1] != included_patches[i] + 1)
1084 {
1085 MSG_PUTS(s);
1086 s = ", ";
1087 msg_outnum((long)first);
1088 if (first != included_patches[i])
1089 {
1090 MSG_PUTS("-");
1091 msg_outnum((long)included_patches[i]);
1092 }
1093 first = -1;
1094 }
1095 }
1096 }
1097
Bram Moolenaar10d4cec2008-11-30 11:15:09 +00001098 /* Print the list of extra patch descriptions if there is at least one. */
1099 if (extra_patches[0] != NULL)
1100 {
1101 MSG_PUTS(_("\nExtra patches: "));
1102 s = "";
1103 for (i = 0; extra_patches[i] != NULL; ++i)
1104 {
1105 MSG_PUTS(s);
1106 s = ", ";
1107 MSG_PUTS(extra_patches[i]);
1108 }
1109 }
1110
Bram Moolenaar071d4272004-06-13 20:20:40 +00001111#ifdef MODIFIED_BY
1112 MSG_PUTS("\n");
1113 MSG_PUTS(_("Modified by "));
1114 MSG_PUTS(MODIFIED_BY);
1115#endif
1116
1117#ifdef HAVE_PATHDEF
1118 if (*compiled_user != NUL || *compiled_sys != NUL)
1119 {
1120 MSG_PUTS(_("\nCompiled "));
1121 if (*compiled_user != NUL)
1122 {
1123 MSG_PUTS(_("by "));
1124 MSG_PUTS(compiled_user);
1125 }
1126 if (*compiled_sys != NUL)
1127 {
1128 MSG_PUTS("@");
1129 MSG_PUTS(compiled_sys);
1130 }
1131 }
1132#endif
1133
1134#ifdef FEAT_HUGE
1135 MSG_PUTS(_("\nHuge version "));
1136#else
1137# ifdef FEAT_BIG
1138 MSG_PUTS(_("\nBig version "));
1139# else
1140# ifdef FEAT_NORMAL
1141 MSG_PUTS(_("\nNormal version "));
1142# else
1143# ifdef FEAT_SMALL
1144 MSG_PUTS(_("\nSmall version "));
1145# else
1146 MSG_PUTS(_("\nTiny version "));
1147# endif
1148# endif
1149# endif
1150#endif
1151#ifndef FEAT_GUI
1152 MSG_PUTS(_("without GUI."));
1153#else
1154# ifdef FEAT_GUI_GTK
Bram Moolenaar98921892016-02-23 17:14:37 +01001155# ifdef USE_GTK3
1156 MSG_PUTS(_("with GTK3 GUI."));
Bram Moolenaar071d4272004-06-13 20:20:40 +00001157# else
Bram Moolenaar98921892016-02-23 17:14:37 +01001158# ifdef FEAT_GUI_GNOME
1159 MSG_PUTS(_("with GTK2-GNOME GUI."));
1160# else
1161 MSG_PUTS(_("with GTK2 GUI."));
1162# endif
1163# endif
Bram Moolenaar071d4272004-06-13 20:20:40 +00001164# else
1165# ifdef FEAT_GUI_MOTIF
1166 MSG_PUTS(_("with X11-Motif GUI."));
1167# else
1168# ifdef FEAT_GUI_ATHENA
1169# ifdef FEAT_GUI_NEXTAW
1170 MSG_PUTS(_("with X11-neXtaw GUI."));
1171# else
1172 MSG_PUTS(_("with X11-Athena GUI."));
1173# endif
1174# else
Bram Moolenaar071d4272004-06-13 20:20:40 +00001175# ifdef FEAT_GUI_PHOTON
1176 MSG_PUTS(_("with Photon GUI."));
1177# else
1178# if defined(MSWIN)
1179 MSG_PUTS(_("with GUI."));
1180# else
Bram Moolenaar860cae12010-06-05 23:22:07 +02001181# if defined(TARGET_API_MAC_CARBON) && TARGET_API_MAC_CARBON
Bram Moolenaar071d4272004-06-13 20:20:40 +00001182 MSG_PUTS(_("with Carbon GUI."));
1183# else
Bram Moolenaar860cae12010-06-05 23:22:07 +02001184# if defined(TARGET_API_MAC_OSX) && TARGET_API_MAC_OSX
Bram Moolenaar071d4272004-06-13 20:20:40 +00001185 MSG_PUTS(_("with Cocoa GUI."));
1186# else
Bram Moolenaar071d4272004-06-13 20:20:40 +00001187# endif
1188# endif
1189# endif
Bram Moolenaar071d4272004-06-13 20:20:40 +00001190# endif
1191# endif
1192# endif
1193# endif
1194#endif
1195 version_msg(_(" Features included (+) or not (-):\n"));
1196
Bram Moolenaar445f3032013-02-20 16:47:36 +01001197 list_features();
Bram Moolenaar071d4272004-06-13 20:20:40 +00001198
Bram Moolenaar071d4272004-06-13 20:20:40 +00001199#ifdef SYS_VIMRC_FILE
1200 version_msg(_(" system vimrc file: \""));
1201 version_msg(SYS_VIMRC_FILE);
1202 version_msg("\"\n");
1203#endif
1204#ifdef USR_VIMRC_FILE
1205 version_msg(_(" user vimrc file: \""));
1206 version_msg(USR_VIMRC_FILE);
1207 version_msg("\"\n");
1208#endif
1209#ifdef USR_VIMRC_FILE2
1210 version_msg(_(" 2nd user vimrc file: \""));
1211 version_msg(USR_VIMRC_FILE2);
1212 version_msg("\"\n");
1213#endif
1214#ifdef USR_VIMRC_FILE3
1215 version_msg(_(" 3rd user vimrc file: \""));
1216 version_msg(USR_VIMRC_FILE3);
1217 version_msg("\"\n");
1218#endif
1219#ifdef USR_EXRC_FILE
1220 version_msg(_(" user exrc file: \""));
1221 version_msg(USR_EXRC_FILE);
1222 version_msg("\"\n");
1223#endif
1224#ifdef USR_EXRC_FILE2
1225 version_msg(_(" 2nd user exrc file: \""));
1226 version_msg(USR_EXRC_FILE2);
1227 version_msg("\"\n");
1228#endif
1229#ifdef FEAT_GUI
1230# ifdef SYS_GVIMRC_FILE
1231 version_msg(_(" system gvimrc file: \""));
1232 version_msg(SYS_GVIMRC_FILE);
1233 version_msg("\"\n");
1234# endif
1235 version_msg(_(" user gvimrc file: \""));
1236 version_msg(USR_GVIMRC_FILE);
1237 version_msg("\"\n");
1238# ifdef USR_GVIMRC_FILE2
1239 version_msg(_("2nd user gvimrc file: \""));
1240 version_msg(USR_GVIMRC_FILE2);
1241 version_msg("\"\n");
1242# endif
1243# ifdef USR_GVIMRC_FILE3
1244 version_msg(_("3rd user gvimrc file: \""));
1245 version_msg(USR_GVIMRC_FILE3);
1246 version_msg("\"\n");
1247# endif
1248#endif
Bram Moolenaar8c08b5b2016-07-28 22:24:15 +02001249 version_msg(_(" defaults file: \""));
1250 version_msg(VIM_DEFAULTS_FILE);
1251 version_msg("\"\n");
Bram Moolenaar071d4272004-06-13 20:20:40 +00001252#ifdef FEAT_GUI
1253# ifdef SYS_MENU_FILE
1254 version_msg(_(" system menu file: \""));
1255 version_msg(SYS_MENU_FILE);
1256 version_msg("\"\n");
1257# endif
1258#endif
1259#ifdef HAVE_PATHDEF
1260 if (*default_vim_dir != NUL)
1261 {
1262 version_msg(_(" fall-back for $VIM: \""));
1263 version_msg((char *)default_vim_dir);
1264 version_msg("\"\n");
1265 }
1266 if (*default_vimruntime_dir != NUL)
1267 {
1268 version_msg(_(" f-b for $VIMRUNTIME: \""));
1269 version_msg((char *)default_vimruntime_dir);
1270 version_msg("\"\n");
1271 }
1272 version_msg(_("Compilation: "));
1273 version_msg((char *)all_cflags);
1274 version_msg("\n");
1275#ifdef VMS
1276 if (*compiler_version != NUL)
1277 {
1278 version_msg(_("Compiler: "));
1279 version_msg((char *)compiler_version);
1280 version_msg("\n");
1281 }
1282#endif
1283 version_msg(_("Linking: "));
1284 version_msg((char *)all_lflags);
1285#endif
1286#ifdef DEBUG
1287 version_msg("\n");
1288 version_msg(_(" DEBUG BUILD"));
1289#endif
1290}
1291
Bram Moolenaarbaaa7e92016-01-29 22:47:03 +01001292static void do_intro_line(int row, char_u *mesg, int add_version, int attr);
Bram Moolenaar071d4272004-06-13 20:20:40 +00001293
1294/*
Bram Moolenaar249f0dd2013-07-04 22:31:03 +02001295 * Show the intro message when not editing a file.
1296 */
1297 void
Bram Moolenaarb638a7b2016-01-30 21:29:58 +01001298maybe_intro_message(void)
Bram Moolenaar249f0dd2013-07-04 22:31:03 +02001299{
Bram Moolenaarb5aedf32017-03-12 18:23:53 +01001300 if (BUFEMPTY()
Bram Moolenaar249f0dd2013-07-04 22:31:03 +02001301 && curbuf->b_fname == NULL
Bram Moolenaar249f0dd2013-07-04 22:31:03 +02001302 && firstwin->w_next == NULL
Bram Moolenaar249f0dd2013-07-04 22:31:03 +02001303 && vim_strchr(p_shm, SHM_INTRO) == NULL)
1304 intro_message(FALSE);
1305}
1306
1307/*
Bram Moolenaar071d4272004-06-13 20:20:40 +00001308 * Give an introductory message about Vim.
1309 * Only used when starting Vim on an empty file, without a file name.
1310 * Or with the ":intro" command (for Sven :-).
1311 */
1312 void
Bram Moolenaarb638a7b2016-01-30 21:29:58 +01001313intro_message(
1314 int colon) /* TRUE for ":intro" */
Bram Moolenaar071d4272004-06-13 20:20:40 +00001315{
1316 int i;
1317 int row;
1318 int blanklines;
1319 int sponsor;
1320 char *p;
1321 static char *(lines[]) =
1322 {
1323 N_("VIM - Vi IMproved"),
1324 "",
1325 N_("version "),
1326 N_("by Bram Moolenaar et al."),
1327#ifdef MODIFIED_BY
1328 " ",
1329#endif
1330 N_("Vim is open source and freely distributable"),
1331 "",
1332 N_("Help poor children in Uganda!"),
1333 N_("type :help iccf<Enter> for information "),
1334 "",
1335 N_("type :q<Enter> to exit "),
1336 N_("type :help<Enter> or <F1> for on-line help"),
Bram Moolenaar640102482016-09-12 16:23:34 +02001337 N_("type :help version8<Enter> for version info"),
Bram Moolenaar071d4272004-06-13 20:20:40 +00001338 NULL,
1339 "",
1340 N_("Running in Vi compatible mode"),
1341 N_("type :set nocp<Enter> for Vim defaults"),
1342 N_("type :help cp-default<Enter> for info on this"),
1343 };
1344#ifdef FEAT_GUI
1345 static char *(gui_lines[]) =
1346 {
1347 NULL,
1348 NULL,
1349 NULL,
1350 NULL,
1351#ifdef MODIFIED_BY
1352 NULL,
1353#endif
1354 NULL,
1355 NULL,
1356 NULL,
1357 N_("menu Help->Orphans for information "),
1358 NULL,
1359 N_("Running modeless, typed text is inserted"),
1360 N_("menu Edit->Global Settings->Toggle Insert Mode "),
1361 N_(" for two modes "),
1362 NULL,
1363 NULL,
1364 NULL,
1365 N_("menu Edit->Global Settings->Toggle Vi Compatible"),
1366 N_(" for Vim defaults "),
1367 };
1368#endif
1369
1370 /* blanklines = screen height - # message lines */
1371 blanklines = (int)Rows - ((sizeof(lines) / sizeof(char *)) - 1);
1372 if (!p_cp)
1373 blanklines += 4; /* add 4 for not showing "Vi compatible" message */
Bram Moolenaar071d4272004-06-13 20:20:40 +00001374
Bram Moolenaar071d4272004-06-13 20:20:40 +00001375 /* Don't overwrite a statusline. Depends on 'cmdheight'. */
1376 if (p_ls > 1)
1377 blanklines -= Rows - topframe->fr_height;
Bram Moolenaar071d4272004-06-13 20:20:40 +00001378 if (blanklines < 0)
1379 blanklines = 0;
1380
1381 /* Show the sponsor and register message one out of four times, the Uganda
1382 * message two out of four times. */
Bram Moolenaarf4cd3e82005-12-22 22:47:02 +00001383 sponsor = (int)time(NULL);
Bram Moolenaar071d4272004-06-13 20:20:40 +00001384 sponsor = ((sponsor & 2) == 0) - ((sponsor & 4) == 0);
1385
1386 /* start displaying the message lines after half of the blank lines */
1387 row = blanklines / 2;
1388 if ((row >= 2 && Columns >= 50) || colon)
1389 {
1390 for (i = 0; i < (int)(sizeof(lines) / sizeof(char *)); ++i)
1391 {
1392 p = lines[i];
1393#ifdef FEAT_GUI
1394 if (p_im && gui.in_use && gui_lines[i] != NULL)
1395 p = gui_lines[i];
1396#endif
1397 if (p == NULL)
1398 {
1399 if (!p_cp)
1400 break;
1401 continue;
1402 }
1403 if (sponsor != 0)
1404 {
1405 if (strstr(p, "children") != NULL)
1406 p = sponsor < 0
1407 ? N_("Sponsor Vim development!")
1408 : N_("Become a registered Vim user!");
1409 else if (strstr(p, "iccf") != NULL)
1410 p = sponsor < 0
1411 ? N_("type :help sponsor<Enter> for information ")
1412 : N_("type :help register<Enter> for information ");
1413 else if (strstr(p, "Orphans") != NULL)
1414 p = N_("menu Help->Sponsor/Register for information ");
1415 }
1416 if (*p != NUL)
1417 do_intro_line(row, (char_u *)_(p), i == 2, 0);
1418 ++row;
1419 }
Bram Moolenaar071d4272004-06-13 20:20:40 +00001420 }
1421
1422 /* Make the wait-return message appear just below the text. */
1423 if (colon)
1424 msg_row = row;
1425}
1426
1427 static void
Bram Moolenaarb638a7b2016-01-30 21:29:58 +01001428do_intro_line(
1429 int row,
1430 char_u *mesg,
1431 int add_version,
1432 int attr)
Bram Moolenaar071d4272004-06-13 20:20:40 +00001433{
1434 char_u vers[20];
1435 int col;
1436 char_u *p;
1437 int l;
1438 int clen;
1439#ifdef MODIFIED_BY
1440# define MODBY_LEN 150
1441 char_u modby[MODBY_LEN];
1442
1443 if (*mesg == ' ')
1444 {
Bram Moolenaar589e43a2008-01-05 12:59:22 +00001445 vim_strncpy(modby, (char_u *)_("Modified by "), MODBY_LEN - 1);
Bram Moolenaar9b0ac222016-06-01 20:31:43 +02001446 l = (int)STRLEN(modby);
Bram Moolenaar589e43a2008-01-05 12:59:22 +00001447 vim_strncpy(modby + l, (char_u *)MODIFIED_BY, MODBY_LEN - l - 1);
Bram Moolenaar071d4272004-06-13 20:20:40 +00001448 mesg = modby;
1449 }
1450#endif
1451
1452 /* Center the message horizontally. */
1453 col = vim_strsize(mesg);
1454 if (add_version)
1455 {
1456 STRCPY(vers, mediumVersion);
1457 if (highest_patch())
1458 {
1459 /* Check for 9.9x or 9.9xx, alpha/beta version */
Bram Moolenaar22df3f92010-10-27 16:01:27 +02001460 if (isalpha((int)vers[3]))
Bram Moolenaar071d4272004-06-13 20:20:40 +00001461 {
Bram Moolenaar552ac132012-03-07 18:03:10 +01001462 int len = (isalpha((int)vers[4])) ? 5 : 4;
1463 sprintf((char *)vers + len, ".%d%s", highest_patch(),
1464 mediumVersion + len);
Bram Moolenaar071d4272004-06-13 20:20:40 +00001465 }
1466 else
1467 sprintf((char *)vers + 3, ".%d", highest_patch());
1468 }
1469 col += (int)STRLEN(vers);
1470 }
1471 col = (Columns - col) / 2;
1472 if (col < 0)
1473 col = 0;
1474
1475 /* Split up in parts to highlight <> items differently. */
1476 for (p = mesg; *p != NUL; p += l)
1477 {
1478 clen = 0;
1479 for (l = 0; p[l] != NUL
1480 && (l == 0 || (p[l] != '<' && p[l - 1] != '>')); ++l)
1481 {
1482#ifdef FEAT_MBYTE
1483 if (has_mbyte)
1484 {
1485 clen += ptr2cells(p + l);
Bram Moolenaar0fa313a2005-08-10 21:07:57 +00001486 l += (*mb_ptr2len)(p + l) - 1;
Bram Moolenaar071d4272004-06-13 20:20:40 +00001487 }
1488 else
1489#endif
1490 clen += byte2cells(p[l]);
1491 }
Bram Moolenaar8820b482017-03-16 17:23:31 +01001492 screen_puts_len(p, l, row, col, *p == '<' ? HL_ATTR(HLF_8) : attr);
Bram Moolenaar071d4272004-06-13 20:20:40 +00001493 col += clen;
1494 }
1495
1496 /* Add the version number to the version line. */
1497 if (add_version)
1498 screen_puts(vers, row, col, 0);
1499}
1500
1501/*
1502 * ":intro": clear screen, display intro screen and wait for return.
1503 */
Bram Moolenaar071d4272004-06-13 20:20:40 +00001504 void
Bram Moolenaarb638a7b2016-01-30 21:29:58 +01001505ex_intro(exarg_T *eap UNUSED)
Bram Moolenaar071d4272004-06-13 20:20:40 +00001506{
1507 screenclear();
1508 intro_message(TRUE);
1509 wait_return(TRUE);
1510}