blob: 9f3810ef842784f5084090251ca2c3ef1e57b264 [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);
60static void version_msg(char *s);
Bram Moolenaar071d4272004-06-13 20:20:40 +000061
62static char *(features[]) =
63{
Bram Moolenaarb5ef5e12013-08-30 16:35:44 +020064#ifdef HAVE_ACL
65 "+acl",
66#else
67 "-acl",
68#endif
Bram Moolenaar071d4272004-06-13 20:20:40 +000069#ifdef AMIGA /* only for Amiga systems */
70# ifdef FEAT_ARP
71 "+ARP",
72# else
73 "-ARP",
74# endif
75#endif
76#ifdef FEAT_ARABIC
77 "+arabic",
78#else
79 "-arabic",
80#endif
81#ifdef FEAT_AUTOCMD
82 "+autocmd",
83#else
84 "-autocmd",
85#endif
86#ifdef FEAT_BEVAL
87 "+balloon_eval",
88#else
89 "-balloon_eval",
90#endif
91#ifdef FEAT_BROWSE
92 "+browse",
93#else
94 "-browse",
95#endif
96#ifdef NO_BUILTIN_TCAPS
97 "-builtin_terms",
98#endif
99#ifdef SOME_BUILTIN_TCAPS
100 "+builtin_terms",
101#endif
102#ifdef ALL_BUILTIN_TCAPS
103 "++builtin_terms",
104#endif
105#ifdef FEAT_BYTEOFF
106 "+byte_offset",
107#else
108 "-byte_offset",
109#endif
Bram Moolenaar509ce2a2016-03-11 22:52:15 +0100110#ifdef FEAT_JOB_CHANNEL
Bram Moolenaar5aec4812016-01-25 20:15:45 +0100111 "+channel",
112#else
113 "-channel",
114#endif
Bram Moolenaar071d4272004-06-13 20:20:40 +0000115#ifdef FEAT_CINDENT
116 "+cindent",
117#else
118 "-cindent",
119#endif
120#ifdef FEAT_CLIENTSERVER
121 "+clientserver",
122#else
123 "-clientserver",
124#endif
125#ifdef FEAT_CLIPBOARD
126 "+clipboard",
127#else
128 "-clipboard",
129#endif
130#ifdef FEAT_CMDL_COMPL
131 "+cmdline_compl",
132#else
133 "-cmdline_compl",
134#endif
135#ifdef FEAT_CMDHIST
136 "+cmdline_hist",
137#else
138 "-cmdline_hist",
139#endif
140#ifdef FEAT_CMDL_INFO
141 "+cmdline_info",
142#else
143 "-cmdline_info",
144#endif
145#ifdef FEAT_COMMENTS
146 "+comments",
147#else
148 "-comments",
149#endif
Bram Moolenaar860cae12010-06-05 23:22:07 +0200150#ifdef FEAT_CONCEAL
151 "+conceal",
152#else
153 "-conceal",
154#endif
Bram Moolenaar071d4272004-06-13 20:20:40 +0000155#ifdef FEAT_CRYPT
156 "+cryptv",
157#else
158 "-cryptv",
159#endif
160#ifdef FEAT_CSCOPE
161 "+cscope",
162#else
163 "-cscope",
164#endif
Bram Moolenaar860cae12010-06-05 23:22:07 +0200165#ifdef FEAT_CURSORBIND
166 "+cursorbind",
167#else
168 "-cursorbind",
169#endif
Bram Moolenaar17c7c012006-01-26 22:25:15 +0000170#ifdef CURSOR_SHAPE
171 "+cursorshape",
172#else
173 "-cursorshape",
174#endif
Bram Moolenaar071d4272004-06-13 20:20:40 +0000175#if defined(FEAT_CON_DIALOG) && defined(FEAT_GUI_DIALOG)
176 "+dialog_con_gui",
177#else
178# if defined(FEAT_CON_DIALOG)
179 "+dialog_con",
180# else
181# if defined(FEAT_GUI_DIALOG)
182 "+dialog_gui",
183# else
184 "-dialog",
185# endif
186# endif
187#endif
188#ifdef FEAT_DIFF
189 "+diff",
190#else
191 "-diff",
192#endif
193#ifdef FEAT_DIGRAPHS
194 "+digraphs",
195#else
196 "-digraphs",
197#endif
Bram Moolenaarb5a7a8b2014-08-06 14:52:30 +0200198#ifdef FEAT_GUI_W32
199# ifdef FEAT_DIRECTX
200 "+directx",
201# else
202 "-directx",
203# endif
204#endif
Bram Moolenaar071d4272004-06-13 20:20:40 +0000205#ifdef FEAT_DND
206 "+dnd",
207#else
208 "-dnd",
209#endif
210#ifdef EBCDIC
211 "+ebcdic",
212#else
213 "-ebcdic",
214#endif
215#ifdef FEAT_EMACS_TAGS
216 "+emacs_tags",
217#else
218 "-emacs_tags",
219#endif
220#ifdef FEAT_EVAL
221 "+eval",
222#else
223 "-eval",
224#endif
Bram Moolenaar071d4272004-06-13 20:20:40 +0000225 "+ex_extra",
Bram Moolenaar071d4272004-06-13 20:20:40 +0000226#ifdef FEAT_SEARCH_EXTRA
227 "+extra_search",
228#else
229 "-extra_search",
230#endif
231#ifdef FEAT_FKMAP
232 "+farsi",
233#else
234 "-farsi",
235#endif
236#ifdef FEAT_SEARCHPATH
237 "+file_in_path",
238#else
239 "-file_in_path",
240#endif
241#ifdef FEAT_FIND_ID
242 "+find_in_path",
243#else
244 "-find_in_path",
245#endif
Bram Moolenaar446cb832008-06-24 21:56:24 +0000246#ifdef FEAT_FLOAT
247 "+float",
248#else
249 "-float",
250#endif
Bram Moolenaar071d4272004-06-13 20:20:40 +0000251#ifdef FEAT_FOLDING
252 "+folding",
253#else
254 "-folding",
255#endif
256#ifdef FEAT_FOOTER
257 "+footer",
258#else
259 "-footer",
260#endif
261 /* only interesting on Unix systems */
262#if !defined(USE_SYSTEM) && defined(UNIX)
263 "+fork()",
264#endif
265#ifdef FEAT_GETTEXT
266# ifdef DYNAMIC_GETTEXT
267 "+gettext/dyn",
268# else
269 "+gettext",
270# endif
271#else
272 "-gettext",
273#endif
274#ifdef FEAT_HANGULIN
275 "+hangul_input",
276#else
277 "-hangul_input",
278#endif
279#if (defined(HAVE_ICONV_H) && defined(USE_ICONV)) || defined(DYNAMIC_ICONV)
280# ifdef DYNAMIC_ICONV
281 "+iconv/dyn",
282# else
283 "+iconv",
284# endif
285#else
286 "-iconv",
287#endif
288#ifdef FEAT_INS_EXPAND
289 "+insert_expand",
290#else
291 "-insert_expand",
292#endif
Bram Moolenaar509ce2a2016-03-11 22:52:15 +0100293#ifdef FEAT_JOB_CHANNEL
Bram Moolenaar835dc632016-02-07 14:27:38 +0100294 "+job",
295#else
296 "-job",
297#endif
Bram Moolenaar071d4272004-06-13 20:20:40 +0000298#ifdef FEAT_JUMPLIST
299 "+jumplist",
300#else
301 "-jumplist",
302#endif
303#ifdef FEAT_KEYMAP
304 "+keymap",
305#else
306 "-keymap",
307#endif
Bram Moolenaar9532fe72016-07-29 22:50:35 +0200308#ifdef FEAT_EVAL
309 "+lambda",
310#else
311 "-lambda",
312#endif
Bram Moolenaar071d4272004-06-13 20:20:40 +0000313#ifdef FEAT_LANGMAP
314 "+langmap",
315#else
316 "-langmap",
317#endif
318#ifdef FEAT_LIBCALL
319 "+libcall",
320#else
321 "-libcall",
322#endif
323#ifdef FEAT_LINEBREAK
324 "+linebreak",
325#else
326 "-linebreak",
327#endif
328#ifdef FEAT_LISP
329 "+lispindent",
330#else
331 "-lispindent",
332#endif
333#ifdef FEAT_LISTCMDS
334 "+listcmds",
335#else
336 "-listcmds",
337#endif
338#ifdef FEAT_LOCALMAP
339 "+localmap",
340#else
341 "-localmap",
342#endif
Bram Moolenaar0ba04292010-07-14 23:23:17 +0200343#ifdef FEAT_LUA
344# ifdef DYNAMIC_LUA
345 "+lua/dyn",
346# else
347 "+lua",
348# endif
349#else
350 "-lua",
351#endif
Bram Moolenaar071d4272004-06-13 20:20:40 +0000352#ifdef FEAT_MENU
353 "+menu",
354#else
355 "-menu",
356#endif
357#ifdef FEAT_SESSION
358 "+mksession",
359#else
360 "-mksession",
361#endif
362#ifdef FEAT_MODIFY_FNAME
363 "+modify_fname",
364#else
365 "-modify_fname",
366#endif
367#ifdef FEAT_MOUSE
368 "+mouse",
369# ifdef FEAT_MOUSESHAPE
370 "+mouseshape",
371# else
372 "-mouseshape",
373# endif
374# else
375 "-mouse",
376#endif
Bram Moolenaar707cfb82012-10-21 04:00:07 +0200377
Bram Moolenaar071d4272004-06-13 20:20:40 +0000378#if defined(UNIX) || defined(VMS)
379# ifdef FEAT_MOUSE_DEC
380 "+mouse_dec",
381# else
382 "-mouse_dec",
383# endif
384# ifdef FEAT_MOUSE_GPM
385 "+mouse_gpm",
386# else
387 "-mouse_gpm",
388# endif
389# ifdef FEAT_MOUSE_JSB
390 "+mouse_jsbterm",
391# else
392 "-mouse_jsbterm",
393# endif
394# ifdef FEAT_MOUSE_NET
395 "+mouse_netterm",
396# else
397 "-mouse_netterm",
398# endif
Bram Moolenaar071d4272004-06-13 20:20:40 +0000399#endif
Bram Moolenaar707cfb82012-10-21 04:00:07 +0200400
Bram Moolenaar071d4272004-06-13 20:20:40 +0000401#ifdef __QNX__
402# ifdef FEAT_MOUSE_PTERM
403 "+mouse_pterm",
404# else
405 "-mouse_pterm",
406# endif
407#endif
Bram Moolenaar707cfb82012-10-21 04:00:07 +0200408
409#if defined(UNIX) || defined(VMS)
410# ifdef FEAT_MOUSE_SGR
411 "+mouse_sgr",
412# else
413 "-mouse_sgr",
414# endif
415# ifdef FEAT_SYSMOUSE
416 "+mouse_sysmouse",
417# else
418 "-mouse_sysmouse",
419# endif
420# ifdef FEAT_MOUSE_URXVT
421 "+mouse_urxvt",
422# else
423 "-mouse_urxvt",
424# endif
425# ifdef FEAT_MOUSE_XTERM
426 "+mouse_xterm",
427# else
428 "-mouse_xterm",
429# endif
430#endif
431
Bram Moolenaar071d4272004-06-13 20:20:40 +0000432#ifdef FEAT_MBYTE_IME
433# ifdef DYNAMIC_IME
434 "+multi_byte_ime/dyn",
435# else
436 "+multi_byte_ime",
437# endif
438#else
439# ifdef FEAT_MBYTE
440 "+multi_byte",
441# else
442 "-multi_byte",
443# endif
444#endif
445#ifdef FEAT_MULTI_LANG
446 "+multi_lang",
447#else
448 "-multi_lang",
449#endif
Bram Moolenaar325b7a22004-07-05 15:58:32 +0000450#ifdef FEAT_MZSCHEME
Bram Moolenaardf3267e2005-01-25 22:07:05 +0000451# ifdef DYNAMIC_MZSCHEME
452 "+mzscheme/dyn",
453# else
Bram Moolenaar325b7a22004-07-05 15:58:32 +0000454 "+mzscheme",
Bram Moolenaardf3267e2005-01-25 22:07:05 +0000455# endif
Bram Moolenaar325b7a22004-07-05 15:58:32 +0000456#else
457 "-mzscheme",
458#endif
Bram Moolenaar071d4272004-06-13 20:20:40 +0000459#ifdef FEAT_NETBEANS_INTG
460 "+netbeans_intg",
461#else
462 "-netbeans_intg",
463#endif
Bram Moolenaar22fcfad2016-07-01 18:17:26 +0200464#ifdef FEAT_NUM64
465 "+num64",
466#else
467 "-num64",
468#endif
Bram Moolenaar071d4272004-06-13 20:20:40 +0000469#ifdef FEAT_GUI_W32
470# ifdef FEAT_OLE
471 "+ole",
472# else
473 "-ole",
474# endif
475#endif
Bram Moolenaarf6fee0e2016-02-21 23:02:49 +0100476 "+packages",
Bram Moolenaar071d4272004-06-13 20:20:40 +0000477#ifdef FEAT_PATH_EXTRA
478 "+path_extra",
479#else
480 "-path_extra",
481#endif
482#ifdef FEAT_PERL
483# ifdef DYNAMIC_PERL
484 "+perl/dyn",
485# else
486 "+perl",
487# endif
488#else
489 "-perl",
490#endif
Bram Moolenaar55debbe2010-05-23 23:34:36 +0200491#ifdef FEAT_PERSISTENT_UNDO
492 "+persistent_undo",
493#else
494 "-persistent_undo",
495#endif
Bram Moolenaar071d4272004-06-13 20:20:40 +0000496#ifdef FEAT_PRINTER
497# ifdef FEAT_POSTSCRIPT
498 "+postscript",
499# else
500 "-postscript",
501# endif
502 "+printer",
503#else
504 "-printer",
505#endif
Bram Moolenaar05159a02005-02-26 23:04:13 +0000506#ifdef FEAT_PROFILE
507 "+profile",
508#else
509 "-profile",
510#endif
Bram Moolenaar071d4272004-06-13 20:20:40 +0000511#ifdef FEAT_PYTHON
512# ifdef DYNAMIC_PYTHON
513 "+python/dyn",
514# else
515 "+python",
516# endif
517#else
518 "-python",
519#endif
Bram Moolenaarbd5e15f2010-07-17 21:19:38 +0200520#ifdef FEAT_PYTHON3
521# ifdef DYNAMIC_PYTHON3
522 "+python3/dyn",
523# else
524 "+python3",
525# endif
526#else
527 "-python3",
528#endif
Bram Moolenaar071d4272004-06-13 20:20:40 +0000529#ifdef FEAT_QUICKFIX
530 "+quickfix",
531#else
532 "-quickfix",
533#endif
Bram Moolenaard68071d2006-05-02 22:08:30 +0000534#ifdef FEAT_RELTIME
535 "+reltime",
536#else
537 "-reltime",
538#endif
Bram Moolenaar071d4272004-06-13 20:20:40 +0000539#ifdef FEAT_RIGHTLEFT
540 "+rightleft",
541#else
542 "-rightleft",
543#endif
544#ifdef FEAT_RUBY
545# ifdef DYNAMIC_RUBY
546 "+ruby/dyn",
547# else
548 "+ruby",
549# endif
550#else
551 "-ruby",
552#endif
553#ifdef FEAT_SCROLLBIND
554 "+scrollbind",
555#else
556 "-scrollbind",
557#endif
558#ifdef FEAT_SIGNS
559 "+signs",
560#else
561 "-signs",
562#endif
563#ifdef FEAT_SMARTINDENT
564 "+smartindent",
565#else
566 "-smartindent",
567#endif
Bram Moolenaaref94eec2009-11-11 13:22:11 +0000568#ifdef STARTUPTIME
569 "+startuptime",
570#else
571 "-startuptime",
572#endif
Bram Moolenaar071d4272004-06-13 20:20:40 +0000573#ifdef FEAT_STL_OPT
574 "+statusline",
575#else
576 "-statusline",
577#endif
578#ifdef FEAT_SUN_WORKSHOP
579 "+sun_workshop",
580#else
581 "-sun_workshop",
582#endif
583#ifdef FEAT_SYN_HL
584 "+syntax",
585#else
586 "-syntax",
587#endif
588 /* only interesting on Unix systems */
Bram Moolenaara06ecab2016-07-16 14:47:36 +0200589#if defined(USE_SYSTEM) && defined(UNIX)
Bram Moolenaar071d4272004-06-13 20:20:40 +0000590 "+system()",
591#endif
592#ifdef FEAT_TAG_BINS
593 "+tag_binary",
594#else
595 "-tag_binary",
596#endif
597#ifdef FEAT_TAG_OLDSTATIC
598 "+tag_old_static",
599#else
600 "-tag_old_static",
601#endif
602#ifdef FEAT_TAG_ANYWHITE
603 "+tag_any_white",
604#else
605 "-tag_any_white",
606#endif
607#ifdef FEAT_TCL
608# ifdef DYNAMIC_TCL
609 "+tcl/dyn",
610# else
611 "+tcl",
612# endif
613#else
614 "-tcl",
615#endif
Bram Moolenaar61be73b2016-04-29 22:59:22 +0200616#ifdef FEAT_TERMGUICOLORS
617 "+termguicolors",
618#else
619 "-termguicolors",
620#endif
Bram Moolenaara06ecab2016-07-16 14:47:36 +0200621#if defined(UNIX)
622/* only Unix can have terminfo instead of termcap */
Bram Moolenaar071d4272004-06-13 20:20:40 +0000623# ifdef TERMINFO
624 "+terminfo",
625# else
626 "-terminfo",
627# endif
628#else /* unix always includes termcap support */
629# ifdef HAVE_TGETENT
630 "+tgetent",
631# else
632 "-tgetent",
633# endif
634#endif
635#ifdef FEAT_TERMRESPONSE
636 "+termresponse",
637#else
638 "-termresponse",
639#endif
640#ifdef FEAT_TEXTOBJ
641 "+textobjects",
642#else
643 "-textobjects",
644#endif
Bram Moolenaar975b5272016-03-15 23:10:59 +0100645#ifdef FEAT_TIMERS
646 "+timers",
647#else
648 "-timers",
649#endif
Bram Moolenaar071d4272004-06-13 20:20:40 +0000650#ifdef FEAT_TITLE
651 "+title",
652#else
653 "-title",
654#endif
655#ifdef FEAT_TOOLBAR
656 "+toolbar",
657#else
658 "-toolbar",
659#endif
660#ifdef FEAT_USR_CMDS
661 "+user_commands",
662#else
663 "-user_commands",
664#endif
Bram Moolenaar44a2f922016-03-19 22:11:51 +0100665#ifdef FEAT_WINDOWS
Bram Moolenaar071d4272004-06-13 20:20:40 +0000666 "+vertsplit",
667#else
668 "-vertsplit",
669#endif
670#ifdef FEAT_VIRTUALEDIT
671 "+virtualedit",
672#else
673 "-virtualedit",
674#endif
Bram Moolenaar071d4272004-06-13 20:20:40 +0000675 "+visual",
Bram Moolenaarf7ff6e82014-03-23 15:13:05 +0100676#ifdef FEAT_VISUALEXTRA
Bram Moolenaar071d4272004-06-13 20:20:40 +0000677 "+visualextra",
Bram Moolenaar071d4272004-06-13 20:20:40 +0000678#else
Bram Moolenaarf7ff6e82014-03-23 15:13:05 +0100679 "-visualextra",
Bram Moolenaar071d4272004-06-13 20:20:40 +0000680#endif
681#ifdef FEAT_VIMINFO
682 "+viminfo",
683#else
684 "-viminfo",
685#endif
686#ifdef FEAT_VREPLACE
687 "+vreplace",
688#else
689 "-vreplace",
690#endif
691#ifdef FEAT_WILDIGN
692 "+wildignore",
693#else
694 "-wildignore",
695#endif
696#ifdef FEAT_WILDMENU
697 "+wildmenu",
698#else
699 "-wildmenu",
700#endif
701#ifdef FEAT_WINDOWS
702 "+windows",
703#else
704 "-windows",
705#endif
706#ifdef FEAT_WRITEBACKUP
707 "+writebackup",
708#else
709 "-writebackup",
710#endif
711#if defined(UNIX) || defined(VMS)
712# ifdef FEAT_X11
713 "+X11",
714# else
715 "-X11",
716# endif
717#endif
718#ifdef FEAT_XFONTSET
719 "+xfontset",
720#else
721 "-xfontset",
722#endif
723#ifdef FEAT_XIM
724 "+xim",
725#else
726 "-xim",
727#endif
Bram Moolenaard58b0f92016-08-13 16:39:56 +0200728#ifdef WIN3264
729# ifdef FEAT_XPM_W32
730 "+xpm_w32",
731# else
732 "-xpm_w32",
733# endif
734#else
735# ifdef HAVE_XPM
736 "+xpm",
737# else
738 "-xpm",
739# endif
740#endif
Bram Moolenaar071d4272004-06-13 20:20:40 +0000741#if defined(UNIX) || defined(VMS)
742# ifdef USE_XSMP_INTERACT
743 "+xsmp_interact",
744# else
745# ifdef USE_XSMP
746 "+xsmp",
747# else
748 "-xsmp",
749# endif
750# endif
751# ifdef FEAT_XCLIPBOARD
752 "+xterm_clipboard",
753# else
754 "-xterm_clipboard",
755# endif
756#endif
757#ifdef FEAT_XTERM_SAVE
758 "+xterm_save",
759#else
760 "-xterm_save",
761#endif
Bram Moolenaar071d4272004-06-13 20:20:40 +0000762 NULL
763};
764
765static int included_patches[] =
766{ /* Add new patch number below this line */
767/**/
Bram Moolenaare3505df2016-11-11 21:57:45 +0100768 77,
769/**/
Bram Moolenaar79cbdcb2016-11-11 21:14:03 +0100770 76,
771/**/
Bram Moolenaar8a5883b2016-11-10 20:20:05 +0100772 75,
773/**/
Bram Moolenaar95f09602016-11-10 20:01:45 +0100774 74,
775/**/
Bram Moolenaar459ca562016-11-10 18:16:33 +0100776 73,
777/**/
Bram Moolenaar38bc4952016-11-10 17:10:51 +0100778 72,
779/**/
Bram Moolenaarc4d4ac22016-11-07 22:42:57 +0100780 71,
781/**/
Bram Moolenaar3f9ebf32016-11-07 22:13:32 +0100782 70,
783/**/
Bram Moolenaara1f4cb92016-11-06 15:25:42 +0100784 69,
785/**/
Bram Moolenaar21662be2016-11-06 14:46:44 +0100786 68,
787/**/
Bram Moolenaar98500fd2016-11-06 14:17:16 +0100788 67,
789/**/
Bram Moolenaar4a08b0d2016-11-05 21:55:13 +0100790 66,
791/**/
Bram Moolenaar40d3f132016-11-05 20:13:35 +0100792 65,
793/**/
Bram Moolenaareb828d02016-11-05 19:54:01 +0100794 64,
795/**/
Bram Moolenaar55952d42016-11-05 14:58:34 +0100796 63,
797/**/
Bram Moolenaar81615512016-11-04 22:17:16 +0100798 62,
799/**/
Bram Moolenaaraab33832016-11-04 22:08:29 +0100800 61,
801/**/
Bram Moolenaar426f3752016-11-04 21:22:37 +0100802 60,
803/**/
Bram Moolenaarde5e2c22016-11-04 20:35:31 +0100804 59,
805/**/
Bram Moolenaar91e44a32016-11-04 20:08:52 +0100806 58,
807/**/
Bram Moolenaar9376f5f2016-11-04 16:41:20 +0100808 57,
809/**/
Bram Moolenaard0b51382016-11-04 15:23:45 +0100810 56,
811/**/
Bram Moolenaar3a117e12016-10-30 21:57:52 +0100812 55,
813/**/
Bram Moolenaarfb630902016-10-29 14:55:00 +0200814 54,
815/**/
Bram Moolenaar60ef3e82016-10-29 14:37:56 +0200816 53,
817/**/
Bram Moolenaar35a1f592016-10-28 22:10:27 +0200818 52,
819/**/
Bram Moolenaar14207f42016-10-27 21:13:10 +0200820 51,
821/**/
Bram Moolenaar01688ad2016-10-27 20:00:07 +0200822 50,
823/**/
Bram Moolenaar2f979122016-10-27 17:27:44 +0200824 49,
825/**/
Bram Moolenaara350bab2016-10-27 16:46:53 +0200826 48,
827/**/
Bram Moolenaar50e53762016-10-27 14:49:15 +0200828 47,
829/**/
Bram Moolenaar7756e742016-10-21 20:35:37 +0200830 46,
831/**/
Bram Moolenaarbb09ceb2016-10-18 16:27:23 +0200832 45,
833/**/
Bram Moolenaar025e3e02016-10-18 14:50:18 +0200834 44,
835/**/
Bram Moolenaar9ec7fa82016-10-18 13:06:41 +0200836 43,
837/**/
Bram Moolenaarcbd3bd62016-10-17 20:47:02 +0200838 42,
839/**/
Bram Moolenaar869e3522016-10-16 15:35:47 +0200840 41,
841/**/
Bram Moolenaar85077472016-10-16 14:35:48 +0200842 40,
843/**/
Bram Moolenaar156919f2016-10-15 20:46:20 +0200844 39,
845/**/
Bram Moolenaarca291ae2016-10-15 19:33:50 +0200846 38,
847/**/
Bram Moolenaar0a9046f2016-10-15 19:28:13 +0200848 37,
849/**/
Bram Moolenaar97792de2016-10-15 18:36:49 +0200850 36,
851/**/
Bram Moolenaar472e8592016-10-15 17:06:47 +0200852 35,
853/**/
Bram Moolenaar9e507ca2016-10-15 15:39:39 +0200854 34,
855/**/
Bram Moolenaara6c27ee2016-10-15 14:56:30 +0200856 33,
857/**/
Bram Moolenaar3e8474d2016-10-12 17:52:42 +0200858 32,
859/**/
Bram Moolenaare8ef3a02016-10-12 17:45:29 +0200860 31,
861/**/
Bram Moolenaar0ba40702016-10-12 14:50:54 +0200862 30,
863/**/
Bram Moolenaarcea912a2016-10-12 14:20:24 +0200864 29,
865/**/
Bram Moolenaara7c023e2016-10-12 12:13:35 +0200866 28,
867/**/
Bram Moolenaardc0ccae2016-10-09 17:28:01 +0200868 27,
869/**/
Bram Moolenaar9b457942016-10-09 16:10:05 +0200870 26,
871/**/
Bram Moolenaar936c48f2016-10-09 15:50:48 +0200872 25,
873/**/
Bram Moolenaar8ddef482016-10-09 15:43:25 +0200874 24,
875/**/
Bram Moolenaar226630a2016-10-08 19:21:31 +0200876 23,
877/**/
Bram Moolenaarec68a992016-10-03 21:37:41 +0200878 22,
879/**/
Bram Moolenaar84dbd492016-10-02 23:09:31 +0200880 21,
881/**/
Bram Moolenaar6100d022016-10-02 16:51:57 +0200882 20,
883/**/
Bram Moolenaarb3435b02016-09-29 20:54:59 +0200884 19,
885/**/
Bram Moolenaarb9c31e72016-09-29 15:18:57 +0200886 18,
887/**/
Bram Moolenaar890680c2016-09-27 21:28:56 +0200888 17,
889/**/
Bram Moolenaar0e77b762016-09-26 22:58:58 +0200890 16,
891/**/
Bram Moolenaar7ef38102016-09-26 22:36:58 +0200892 15,
893/**/
Bram Moolenaar1eceada2016-09-26 20:14:56 +0200894 14,
895/**/
Bram Moolenaarc79d6aa2016-09-25 22:27:37 +0200896 13,
897/**/
Bram Moolenaar9af41842016-09-25 21:45:05 +0200898 12,
899/**/
Bram Moolenaar947000d2016-09-25 21:03:02 +0200900 11,
901/**/
Bram Moolenaar680e0152016-09-25 20:54:11 +0200902 10,
903/**/
Bram Moolenaar3f1c15b2016-09-25 20:22:02 +0200904 9,
905/**/
Bram Moolenaar9e02cfa2016-09-22 21:27:11 +0200906 8,
907/**/
Bram Moolenaarbbe917d2016-09-21 22:41:24 +0200908 7,
909/**/
Bram Moolenaarebdd90a2016-09-20 21:39:14 +0200910 6,
911/**/
Bram Moolenaar3c4ebeb2016-09-15 11:44:27 +0200912 5,
913/**/
Bram Moolenaar5582ef12016-09-14 22:16:13 +0200914 4,
915/**/
Bram Moolenaar789a5c02016-09-12 19:51:11 +0200916 3,
917/**/
Bram Moolenaar9e1e7af2016-09-12 16:31:10 +0200918 2,
919/**/
Bram Moolenaar640102482016-09-12 16:23:34 +0200920 1,
921/**/
Bram Moolenaar071d4272004-06-13 20:20:40 +0000922 0
923};
924
Bram Moolenaar10d4cec2008-11-30 11:15:09 +0000925/*
926 * Place to put a short description when adding a feature with a patch.
927 * Keep it short, e.g.,: "relative numbers", "persistent undo".
928 * Also add a comment marker to separate the lines.
929 * See the official Vim patches for the diff format: It must use a context of
Bram Moolenaarcbb8eb32008-12-24 13:25:14 +0000930 * one line only. Create it by hand or use "diff -C2" and edit the patch.
Bram Moolenaar10d4cec2008-11-30 11:15:09 +0000931 */
932static char *(extra_patches[]) =
933{ /* Add your patch description below this line */
934/**/
935 NULL
936};
937
Bram Moolenaar071d4272004-06-13 20:20:40 +0000938 int
Bram Moolenaarb638a7b2016-01-30 21:29:58 +0100939highest_patch(void)
Bram Moolenaar071d4272004-06-13 20:20:40 +0000940{
941 int i;
942 int h = 0;
943
944 for (i = 0; included_patches[i] != 0; ++i)
945 if (included_patches[i] > h)
946 h = included_patches[i];
947 return h;
948}
949
950#if defined(FEAT_EVAL) || defined(PROTO)
951/*
952 * Return TRUE if patch "n" has been included.
953 */
954 int
Bram Moolenaarb638a7b2016-01-30 21:29:58 +0100955has_patch(int n)
Bram Moolenaar071d4272004-06-13 20:20:40 +0000956{
957 int i;
958
959 for (i = 0; included_patches[i] != 0; ++i)
960 if (included_patches[i] == n)
961 return TRUE;
962 return FALSE;
963}
964#endif
965
966 void
Bram Moolenaarb638a7b2016-01-30 21:29:58 +0100967ex_version(exarg_T *eap)
Bram Moolenaar071d4272004-06-13 20:20:40 +0000968{
969 /*
970 * Ignore a ":version 9.99" command.
971 */
972 if (*eap->arg == NUL)
973 {
974 msg_putchar('\n');
975 list_version();
976 }
977}
978
Bram Moolenaar445f3032013-02-20 16:47:36 +0100979/*
980 * List all features aligned in columns, dictionary style.
981 */
982 static void
Bram Moolenaarb638a7b2016-01-30 21:29:58 +0100983list_features(void)
Bram Moolenaar445f3032013-02-20 16:47:36 +0100984{
985 int i;
986 int ncol;
987 int nrow;
988 int nfeat = 0;
989 int width = 0;
990
991 /* Find the length of the longest feature name, use that + 1 as the column
992 * width */
993 for (i = 0; features[i] != NULL; ++i)
994 {
Bram Moolenaar5c962632013-02-26 11:25:33 +0100995 int l = (int)STRLEN(features[i]);
Bram Moolenaar445f3032013-02-20 16:47:36 +0100996
997 if (l > width)
998 width = l;
999 ++nfeat;
1000 }
1001 width += 1;
1002
1003 if (Columns < width)
1004 {
1005 /* Not enough screen columns - show one per line */
1006 for (i = 0; features[i] != NULL; ++i)
1007 {
1008 version_msg(features[i]);
1009 if (msg_col > 0)
1010 msg_putchar('\n');
1011 }
1012 return;
1013 }
1014
Bram Moolenaar445f3032013-02-20 16:47:36 +01001015 /* The rightmost column doesn't need a separator.
1016 * Sacrifice it to fit in one more column if possible. */
Bram Moolenaarf13f45d2013-02-26 15:27:23 +01001017 ncol = (int) (Columns + 1) / width;
Bram Moolenaar445f3032013-02-20 16:47:36 +01001018 nrow = nfeat / ncol + (nfeat % ncol ? 1 : 0);
1019
Bram Moolenaarf13f45d2013-02-26 15:27:23 +01001020 /* i counts columns then rows. idx counts rows then columns. */
Bram Moolenaar445f3032013-02-20 16:47:36 +01001021 for (i = 0; !got_int && i < nrow * ncol; ++i)
1022 {
1023 int idx = (i / ncol) + (i % ncol) * nrow;
1024
1025 if (idx < nfeat)
1026 {
1027 int last_col = (i + 1) % ncol == 0;
1028
1029 msg_puts((char_u *)features[idx]);
1030 if (last_col)
1031 {
1032 if (msg_col > 0)
1033 msg_putchar('\n');
1034 }
1035 else
1036 {
1037 while (msg_col % width)
1038 msg_putchar(' ');
1039 }
1040 }
1041 else
Bram Moolenaarf13f45d2013-02-26 15:27:23 +01001042 {
1043 if (msg_col > 0)
1044 msg_putchar('\n');
1045 }
Bram Moolenaar445f3032013-02-20 16:47:36 +01001046 }
1047}
Bram Moolenaar5c962632013-02-26 11:25:33 +01001048
Bram Moolenaar071d4272004-06-13 20:20:40 +00001049 void
Bram Moolenaarb638a7b2016-01-30 21:29:58 +01001050list_version(void)
Bram Moolenaar071d4272004-06-13 20:20:40 +00001051{
1052 int i;
1053 int first;
1054 char *s = "";
1055
1056 /*
1057 * When adding features here, don't forget to update the list of
1058 * internal variables in eval.c!
1059 */
1060 MSG(longVersion);
1061#ifdef WIN3264
1062# ifdef FEAT_GUI_W32
Bram Moolenaarcea912a2016-10-12 14:20:24 +02001063# ifdef _WIN64
Bram Moolenaare7cb9cf2008-06-20 14:32:41 +00001064 MSG_PUTS(_("\nMS-Windows 64-bit GUI version"));
Bram Moolenaarcea912a2016-10-12 14:20:24 +02001065# else
Bram Moolenaare7cb9cf2008-06-20 14:32:41 +00001066 MSG_PUTS(_("\nMS-Windows 32-bit GUI version"));
Bram Moolenaar071d4272004-06-13 20:20:40 +00001067# endif
Bram Moolenaar071d4272004-06-13 20:20:40 +00001068# ifdef FEAT_OLE
1069 MSG_PUTS(_(" with OLE support"));
1070# endif
1071# else
Bram Moolenaare7cb9cf2008-06-20 14:32:41 +00001072# ifdef _WIN64
1073 MSG_PUTS(_("\nMS-Windows 64-bit console version"));
1074# else
1075 MSG_PUTS(_("\nMS-Windows 32-bit console version"));
1076# endif
Bram Moolenaar071d4272004-06-13 20:20:40 +00001077# endif
1078#endif
Bram Moolenaar071d4272004-06-13 20:20:40 +00001079#ifdef MACOS
1080# ifdef MACOS_X
1081# ifdef MACOS_X_UNIX
1082 MSG_PUTS(_("\nMacOS X (unix) version"));
1083# else
1084 MSG_PUTS(_("\nMacOS X version"));
1085# endif
1086#else
1087 MSG_PUTS(_("\nMacOS version"));
1088# endif
1089#endif
1090
Bram Moolenaar071d4272004-06-13 20:20:40 +00001091#ifdef VMS
Bram Moolenaar6949d1d2008-08-25 02:14:05 +00001092 MSG_PUTS(_("\nOpenVMS version"));
Bram Moolenaar3d20ca12006-11-28 16:43:58 +00001093# ifdef HAVE_PATHDEF
1094 if (*compiled_arch != NUL)
1095 {
1096 MSG_PUTS(" - ");
1097 MSG_PUTS(compiled_arch);
1098 }
1099# endif
1100
Bram Moolenaar071d4272004-06-13 20:20:40 +00001101#endif
1102
1103 /* Print the list of patch numbers if there is at least one. */
1104 /* Print a range when patches are consecutive: "1-10, 12, 15-40, 42-45" */
1105 if (included_patches[0] != 0)
1106 {
1107 MSG_PUTS(_("\nIncluded patches: "));
1108 first = -1;
1109 /* find last one */
1110 for (i = 0; included_patches[i] != 0; ++i)
1111 ;
1112 while (--i >= 0)
1113 {
1114 if (first < 0)
1115 first = included_patches[i];
1116 if (i == 0 || included_patches[i - 1] != included_patches[i] + 1)
1117 {
1118 MSG_PUTS(s);
1119 s = ", ";
1120 msg_outnum((long)first);
1121 if (first != included_patches[i])
1122 {
1123 MSG_PUTS("-");
1124 msg_outnum((long)included_patches[i]);
1125 }
1126 first = -1;
1127 }
1128 }
1129 }
1130
Bram Moolenaar10d4cec2008-11-30 11:15:09 +00001131 /* Print the list of extra patch descriptions if there is at least one. */
1132 if (extra_patches[0] != NULL)
1133 {
1134 MSG_PUTS(_("\nExtra patches: "));
1135 s = "";
1136 for (i = 0; extra_patches[i] != NULL; ++i)
1137 {
1138 MSG_PUTS(s);
1139 s = ", ";
1140 MSG_PUTS(extra_patches[i]);
1141 }
1142 }
1143
Bram Moolenaar071d4272004-06-13 20:20:40 +00001144#ifdef MODIFIED_BY
1145 MSG_PUTS("\n");
1146 MSG_PUTS(_("Modified by "));
1147 MSG_PUTS(MODIFIED_BY);
1148#endif
1149
1150#ifdef HAVE_PATHDEF
1151 if (*compiled_user != NUL || *compiled_sys != NUL)
1152 {
1153 MSG_PUTS(_("\nCompiled "));
1154 if (*compiled_user != NUL)
1155 {
1156 MSG_PUTS(_("by "));
1157 MSG_PUTS(compiled_user);
1158 }
1159 if (*compiled_sys != NUL)
1160 {
1161 MSG_PUTS("@");
1162 MSG_PUTS(compiled_sys);
1163 }
1164 }
1165#endif
1166
1167#ifdef FEAT_HUGE
1168 MSG_PUTS(_("\nHuge version "));
1169#else
1170# ifdef FEAT_BIG
1171 MSG_PUTS(_("\nBig version "));
1172# else
1173# ifdef FEAT_NORMAL
1174 MSG_PUTS(_("\nNormal version "));
1175# else
1176# ifdef FEAT_SMALL
1177 MSG_PUTS(_("\nSmall version "));
1178# else
1179 MSG_PUTS(_("\nTiny version "));
1180# endif
1181# endif
1182# endif
1183#endif
1184#ifndef FEAT_GUI
1185 MSG_PUTS(_("without GUI."));
1186#else
1187# ifdef FEAT_GUI_GTK
Bram Moolenaar98921892016-02-23 17:14:37 +01001188# ifdef USE_GTK3
1189 MSG_PUTS(_("with GTK3 GUI."));
Bram Moolenaar071d4272004-06-13 20:20:40 +00001190# else
Bram Moolenaar98921892016-02-23 17:14:37 +01001191# ifdef FEAT_GUI_GNOME
1192 MSG_PUTS(_("with GTK2-GNOME GUI."));
1193# else
1194 MSG_PUTS(_("with GTK2 GUI."));
1195# endif
1196# endif
Bram Moolenaar071d4272004-06-13 20:20:40 +00001197# else
1198# ifdef FEAT_GUI_MOTIF
1199 MSG_PUTS(_("with X11-Motif GUI."));
1200# else
1201# ifdef FEAT_GUI_ATHENA
1202# ifdef FEAT_GUI_NEXTAW
1203 MSG_PUTS(_("with X11-neXtaw GUI."));
1204# else
1205 MSG_PUTS(_("with X11-Athena GUI."));
1206# endif
1207# else
Bram Moolenaar071d4272004-06-13 20:20:40 +00001208# ifdef FEAT_GUI_PHOTON
1209 MSG_PUTS(_("with Photon GUI."));
1210# else
1211# if defined(MSWIN)
1212 MSG_PUTS(_("with GUI."));
1213# else
Bram Moolenaar860cae12010-06-05 23:22:07 +02001214# if defined(TARGET_API_MAC_CARBON) && TARGET_API_MAC_CARBON
Bram Moolenaar071d4272004-06-13 20:20:40 +00001215 MSG_PUTS(_("with Carbon GUI."));
1216# else
Bram Moolenaar860cae12010-06-05 23:22:07 +02001217# if defined(TARGET_API_MAC_OSX) && TARGET_API_MAC_OSX
Bram Moolenaar071d4272004-06-13 20:20:40 +00001218 MSG_PUTS(_("with Cocoa GUI."));
1219# else
Bram Moolenaar860cae12010-06-05 23:22:07 +02001220# if defined(MACOS)
Bram Moolenaar071d4272004-06-13 20:20:40 +00001221 MSG_PUTS(_("with (classic) GUI."));
Bram Moolenaar071d4272004-06-13 20:20:40 +00001222# endif
1223# endif
1224# endif
1225# endif
Bram Moolenaar071d4272004-06-13 20:20:40 +00001226# endif
1227# endif
1228# endif
1229# endif
1230#endif
1231 version_msg(_(" Features included (+) or not (-):\n"));
1232
Bram Moolenaar445f3032013-02-20 16:47:36 +01001233 list_features();
Bram Moolenaar071d4272004-06-13 20:20:40 +00001234
Bram Moolenaar071d4272004-06-13 20:20:40 +00001235#ifdef SYS_VIMRC_FILE
1236 version_msg(_(" system vimrc file: \""));
1237 version_msg(SYS_VIMRC_FILE);
1238 version_msg("\"\n");
1239#endif
1240#ifdef USR_VIMRC_FILE
1241 version_msg(_(" user vimrc file: \""));
1242 version_msg(USR_VIMRC_FILE);
1243 version_msg("\"\n");
1244#endif
1245#ifdef USR_VIMRC_FILE2
1246 version_msg(_(" 2nd user vimrc file: \""));
1247 version_msg(USR_VIMRC_FILE2);
1248 version_msg("\"\n");
1249#endif
1250#ifdef USR_VIMRC_FILE3
1251 version_msg(_(" 3rd user vimrc file: \""));
1252 version_msg(USR_VIMRC_FILE3);
1253 version_msg("\"\n");
1254#endif
1255#ifdef USR_EXRC_FILE
1256 version_msg(_(" user exrc file: \""));
1257 version_msg(USR_EXRC_FILE);
1258 version_msg("\"\n");
1259#endif
1260#ifdef USR_EXRC_FILE2
1261 version_msg(_(" 2nd user exrc file: \""));
1262 version_msg(USR_EXRC_FILE2);
1263 version_msg("\"\n");
1264#endif
1265#ifdef FEAT_GUI
1266# ifdef SYS_GVIMRC_FILE
1267 version_msg(_(" system gvimrc file: \""));
1268 version_msg(SYS_GVIMRC_FILE);
1269 version_msg("\"\n");
1270# endif
1271 version_msg(_(" user gvimrc file: \""));
1272 version_msg(USR_GVIMRC_FILE);
1273 version_msg("\"\n");
1274# ifdef USR_GVIMRC_FILE2
1275 version_msg(_("2nd user gvimrc file: \""));
1276 version_msg(USR_GVIMRC_FILE2);
1277 version_msg("\"\n");
1278# endif
1279# ifdef USR_GVIMRC_FILE3
1280 version_msg(_("3rd user gvimrc file: \""));
1281 version_msg(USR_GVIMRC_FILE3);
1282 version_msg("\"\n");
1283# endif
1284#endif
Bram Moolenaar8c08b5b2016-07-28 22:24:15 +02001285 version_msg(_(" defaults file: \""));
1286 version_msg(VIM_DEFAULTS_FILE);
1287 version_msg("\"\n");
Bram Moolenaar071d4272004-06-13 20:20:40 +00001288#ifdef FEAT_GUI
1289# ifdef SYS_MENU_FILE
1290 version_msg(_(" system menu file: \""));
1291 version_msg(SYS_MENU_FILE);
1292 version_msg("\"\n");
1293# endif
1294#endif
1295#ifdef HAVE_PATHDEF
1296 if (*default_vim_dir != NUL)
1297 {
1298 version_msg(_(" fall-back for $VIM: \""));
1299 version_msg((char *)default_vim_dir);
1300 version_msg("\"\n");
1301 }
1302 if (*default_vimruntime_dir != NUL)
1303 {
1304 version_msg(_(" f-b for $VIMRUNTIME: \""));
1305 version_msg((char *)default_vimruntime_dir);
1306 version_msg("\"\n");
1307 }
1308 version_msg(_("Compilation: "));
1309 version_msg((char *)all_cflags);
1310 version_msg("\n");
1311#ifdef VMS
1312 if (*compiler_version != NUL)
1313 {
1314 version_msg(_("Compiler: "));
1315 version_msg((char *)compiler_version);
1316 version_msg("\n");
1317 }
1318#endif
1319 version_msg(_("Linking: "));
1320 version_msg((char *)all_lflags);
1321#endif
1322#ifdef DEBUG
1323 version_msg("\n");
1324 version_msg(_(" DEBUG BUILD"));
1325#endif
1326}
1327
1328/*
1329 * Output a string for the version message. If it's going to wrap, output a
1330 * newline, unless the message is too long to fit on the screen anyway.
1331 */
1332 static void
Bram Moolenaarb638a7b2016-01-30 21:29:58 +01001333version_msg(char *s)
Bram Moolenaar071d4272004-06-13 20:20:40 +00001334{
1335 int len = (int)STRLEN(s);
1336
1337 if (!got_int && len < (int)Columns && msg_col + len >= (int)Columns
1338 && *s != '\n')
1339 msg_putchar('\n');
1340 if (!got_int)
1341 MSG_PUTS(s);
1342}
1343
Bram Moolenaarbaaa7e92016-01-29 22:47:03 +01001344static void do_intro_line(int row, char_u *mesg, int add_version, int attr);
Bram Moolenaar071d4272004-06-13 20:20:40 +00001345
1346/*
Bram Moolenaar249f0dd2013-07-04 22:31:03 +02001347 * Show the intro message when not editing a file.
1348 */
1349 void
Bram Moolenaarb638a7b2016-01-30 21:29:58 +01001350maybe_intro_message(void)
Bram Moolenaar249f0dd2013-07-04 22:31:03 +02001351{
1352 if (bufempty()
1353 && curbuf->b_fname == NULL
1354#ifdef FEAT_WINDOWS
1355 && firstwin->w_next == NULL
1356#endif
1357 && vim_strchr(p_shm, SHM_INTRO) == NULL)
1358 intro_message(FALSE);
1359}
1360
1361/*
Bram Moolenaar071d4272004-06-13 20:20:40 +00001362 * Give an introductory message about Vim.
1363 * Only used when starting Vim on an empty file, without a file name.
1364 * Or with the ":intro" command (for Sven :-).
1365 */
1366 void
Bram Moolenaarb638a7b2016-01-30 21:29:58 +01001367intro_message(
1368 int colon) /* TRUE for ":intro" */
Bram Moolenaar071d4272004-06-13 20:20:40 +00001369{
1370 int i;
1371 int row;
1372 int blanklines;
1373 int sponsor;
1374 char *p;
1375 static char *(lines[]) =
1376 {
1377 N_("VIM - Vi IMproved"),
1378 "",
1379 N_("version "),
1380 N_("by Bram Moolenaar et al."),
1381#ifdef MODIFIED_BY
1382 " ",
1383#endif
1384 N_("Vim is open source and freely distributable"),
1385 "",
1386 N_("Help poor children in Uganda!"),
1387 N_("type :help iccf<Enter> for information "),
1388 "",
1389 N_("type :q<Enter> to exit "),
1390 N_("type :help<Enter> or <F1> for on-line help"),
Bram Moolenaar640102482016-09-12 16:23:34 +02001391 N_("type :help version8<Enter> for version info"),
Bram Moolenaar071d4272004-06-13 20:20:40 +00001392 NULL,
1393 "",
1394 N_("Running in Vi compatible mode"),
1395 N_("type :set nocp<Enter> for Vim defaults"),
1396 N_("type :help cp-default<Enter> for info on this"),
1397 };
1398#ifdef FEAT_GUI
1399 static char *(gui_lines[]) =
1400 {
1401 NULL,
1402 NULL,
1403 NULL,
1404 NULL,
1405#ifdef MODIFIED_BY
1406 NULL,
1407#endif
1408 NULL,
1409 NULL,
1410 NULL,
1411 N_("menu Help->Orphans for information "),
1412 NULL,
1413 N_("Running modeless, typed text is inserted"),
1414 N_("menu Edit->Global Settings->Toggle Insert Mode "),
1415 N_(" for two modes "),
1416 NULL,
1417 NULL,
1418 NULL,
1419 N_("menu Edit->Global Settings->Toggle Vi Compatible"),
1420 N_(" for Vim defaults "),
1421 };
1422#endif
1423
1424 /* blanklines = screen height - # message lines */
1425 blanklines = (int)Rows - ((sizeof(lines) / sizeof(char *)) - 1);
1426 if (!p_cp)
1427 blanklines += 4; /* add 4 for not showing "Vi compatible" message */
Bram Moolenaar071d4272004-06-13 20:20:40 +00001428
1429#ifdef FEAT_WINDOWS
1430 /* Don't overwrite a statusline. Depends on 'cmdheight'. */
1431 if (p_ls > 1)
1432 blanklines -= Rows - topframe->fr_height;
1433#endif
1434 if (blanklines < 0)
1435 blanklines = 0;
1436
1437 /* Show the sponsor and register message one out of four times, the Uganda
1438 * message two out of four times. */
Bram Moolenaarf4cd3e82005-12-22 22:47:02 +00001439 sponsor = (int)time(NULL);
Bram Moolenaar071d4272004-06-13 20:20:40 +00001440 sponsor = ((sponsor & 2) == 0) - ((sponsor & 4) == 0);
1441
1442 /* start displaying the message lines after half of the blank lines */
1443 row = blanklines / 2;
1444 if ((row >= 2 && Columns >= 50) || colon)
1445 {
1446 for (i = 0; i < (int)(sizeof(lines) / sizeof(char *)); ++i)
1447 {
1448 p = lines[i];
1449#ifdef FEAT_GUI
1450 if (p_im && gui.in_use && gui_lines[i] != NULL)
1451 p = gui_lines[i];
1452#endif
1453 if (p == NULL)
1454 {
1455 if (!p_cp)
1456 break;
1457 continue;
1458 }
1459 if (sponsor != 0)
1460 {
1461 if (strstr(p, "children") != NULL)
1462 p = sponsor < 0
1463 ? N_("Sponsor Vim development!")
1464 : N_("Become a registered Vim user!");
1465 else if (strstr(p, "iccf") != NULL)
1466 p = sponsor < 0
1467 ? N_("type :help sponsor<Enter> for information ")
1468 : N_("type :help register<Enter> for information ");
1469 else if (strstr(p, "Orphans") != NULL)
1470 p = N_("menu Help->Sponsor/Register for information ");
1471 }
1472 if (*p != NUL)
1473 do_intro_line(row, (char_u *)_(p), i == 2, 0);
1474 ++row;
1475 }
Bram Moolenaar071d4272004-06-13 20:20:40 +00001476 }
1477
1478 /* Make the wait-return message appear just below the text. */
1479 if (colon)
1480 msg_row = row;
1481}
1482
1483 static void
Bram Moolenaarb638a7b2016-01-30 21:29:58 +01001484do_intro_line(
1485 int row,
1486 char_u *mesg,
1487 int add_version,
1488 int attr)
Bram Moolenaar071d4272004-06-13 20:20:40 +00001489{
1490 char_u vers[20];
1491 int col;
1492 char_u *p;
1493 int l;
1494 int clen;
1495#ifdef MODIFIED_BY
1496# define MODBY_LEN 150
1497 char_u modby[MODBY_LEN];
1498
1499 if (*mesg == ' ')
1500 {
Bram Moolenaar589e43a2008-01-05 12:59:22 +00001501 vim_strncpy(modby, (char_u *)_("Modified by "), MODBY_LEN - 1);
Bram Moolenaar9b0ac222016-06-01 20:31:43 +02001502 l = (int)STRLEN(modby);
Bram Moolenaar589e43a2008-01-05 12:59:22 +00001503 vim_strncpy(modby + l, (char_u *)MODIFIED_BY, MODBY_LEN - l - 1);
Bram Moolenaar071d4272004-06-13 20:20:40 +00001504 mesg = modby;
1505 }
1506#endif
1507
1508 /* Center the message horizontally. */
1509 col = vim_strsize(mesg);
1510 if (add_version)
1511 {
1512 STRCPY(vers, mediumVersion);
1513 if (highest_patch())
1514 {
1515 /* Check for 9.9x or 9.9xx, alpha/beta version */
Bram Moolenaar22df3f92010-10-27 16:01:27 +02001516 if (isalpha((int)vers[3]))
Bram Moolenaar071d4272004-06-13 20:20:40 +00001517 {
Bram Moolenaar552ac132012-03-07 18:03:10 +01001518 int len = (isalpha((int)vers[4])) ? 5 : 4;
1519 sprintf((char *)vers + len, ".%d%s", highest_patch(),
1520 mediumVersion + len);
Bram Moolenaar071d4272004-06-13 20:20:40 +00001521 }
1522 else
1523 sprintf((char *)vers + 3, ".%d", highest_patch());
1524 }
1525 col += (int)STRLEN(vers);
1526 }
1527 col = (Columns - col) / 2;
1528 if (col < 0)
1529 col = 0;
1530
1531 /* Split up in parts to highlight <> items differently. */
1532 for (p = mesg; *p != NUL; p += l)
1533 {
1534 clen = 0;
1535 for (l = 0; p[l] != NUL
1536 && (l == 0 || (p[l] != '<' && p[l - 1] != '>')); ++l)
1537 {
1538#ifdef FEAT_MBYTE
1539 if (has_mbyte)
1540 {
1541 clen += ptr2cells(p + l);
Bram Moolenaar0fa313a2005-08-10 21:07:57 +00001542 l += (*mb_ptr2len)(p + l) - 1;
Bram Moolenaar071d4272004-06-13 20:20:40 +00001543 }
1544 else
1545#endif
1546 clen += byte2cells(p[l]);
1547 }
1548 screen_puts_len(p, l, row, col, *p == '<' ? hl_attr(HLF_8) : attr);
1549 col += clen;
1550 }
1551
1552 /* Add the version number to the version line. */
1553 if (add_version)
1554 screen_puts(vers, row, col, 0);
1555}
1556
1557/*
1558 * ":intro": clear screen, display intro screen and wait for return.
1559 */
Bram Moolenaar071d4272004-06-13 20:20:40 +00001560 void
Bram Moolenaarb638a7b2016-01-30 21:29:58 +01001561ex_intro(exarg_T *eap UNUSED)
Bram Moolenaar071d4272004-06-13 20:20:40 +00001562{
1563 screenclear();
1564 intro_message(TRUE);
1565 wait_return(TRUE);
1566}