blob: 8eee3e95cc462bb04fe55c2e6c0414f45bb4cc7c [file] [log] [blame]
Bram Moolenaar071d4272004-06-13 20:20:40 +00001/* vi:set ts=8 sts=4 sw=4:
2 *
3 * VIM - Vi IMproved by Bram Moolenaar
4 *
5 * Do ":help uganda" in Vim to read copying and usage conditions.
6 * Do ":help credits" in Vim to see a list of people who contributed.
7 * See README.txt for an overview of the Vim source code.
8 */
9
10#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 Moolenaar3fdfa4a2004-10-07 21:02:47 +000020 * Differences between version 6.x and 7.x can be found with ":help version7".
Bram Moolenaar071d4272004-06-13 20:20:40 +000021 * Differences between version 5.x and 6.x can be found with ":help version6".
22 * Differences between version 4.x and 5.x can be found with ":help version5".
23 * Differences between version 3.0 and 4.x can be found with ":help version4".
24 * All the remarks about older versions have been removed, they are not very
25 * interesting.
26 */
27
28#include "version.h"
29
Bram Moolenaard042c562005-06-30 22:04:15 +000030char *Version = VIM_VERSION_SHORT;
31static char *mediumVersion = VIM_VERSION_MEDIUM;
Bram Moolenaar071d4272004-06-13 20:20:40 +000032
33#if defined(HAVE_DATE_TIME) || defined(PROTO)
34# if (defined(VMS) && defined(VAXC)) || defined(PROTO)
35char longVersion[sizeof(VIM_VERSION_LONG_DATE) + sizeof(__DATE__)
36 + sizeof(__TIME__) + 3];
Bram Moolenaar445f3032013-02-20 16:47:36 +010037
Bram Moolenaar071d4272004-06-13 20:20:40 +000038 void
39make_version()
40{
41 /*
42 * Construct the long version string. Necessary because
43 * VAX C can't catenate strings in the preprocessor.
44 */
45 strcpy(longVersion, VIM_VERSION_LONG_DATE);
46 strcat(longVersion, __DATE__);
47 strcat(longVersion, " ");
48 strcat(longVersion, __TIME__);
49 strcat(longVersion, ")");
50}
51# else
52char *longVersion = VIM_VERSION_LONG_DATE __DATE__ " " __TIME__ ")";
53# endif
54#else
55char *longVersion = VIM_VERSION_LONG;
56#endif
57
Bram Moolenaarfb97f282013-07-09 17:42:46 +020058static void list_features __ARGS((void));
Bram Moolenaar071d4272004-06-13 20:20:40 +000059static void version_msg __ARGS((char *s));
60
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
80#ifdef FEAT_AUTOCMD
81 "+autocmd",
82#else
83 "-autocmd",
84#endif
85#ifdef FEAT_BEVAL
86 "+balloon_eval",
87#else
88 "-balloon_eval",
89#endif
90#ifdef FEAT_BROWSE
91 "+browse",
92#else
93 "-browse",
94#endif
95#ifdef NO_BUILTIN_TCAPS
96 "-builtin_terms",
97#endif
98#ifdef SOME_BUILTIN_TCAPS
99 "+builtin_terms",
100#endif
101#ifdef ALL_BUILTIN_TCAPS
102 "++builtin_terms",
103#endif
104#ifdef FEAT_BYTEOFF
105 "+byte_offset",
106#else
107 "-byte_offset",
108#endif
109#ifdef FEAT_CINDENT
110 "+cindent",
111#else
112 "-cindent",
113#endif
114#ifdef FEAT_CLIENTSERVER
115 "+clientserver",
116#else
117 "-clientserver",
118#endif
119#ifdef FEAT_CLIPBOARD
120 "+clipboard",
121#else
122 "-clipboard",
123#endif
124#ifdef FEAT_CMDL_COMPL
125 "+cmdline_compl",
126#else
127 "-cmdline_compl",
128#endif
129#ifdef FEAT_CMDHIST
130 "+cmdline_hist",
131#else
132 "-cmdline_hist",
133#endif
134#ifdef FEAT_CMDL_INFO
135 "+cmdline_info",
136#else
137 "-cmdline_info",
138#endif
139#ifdef FEAT_COMMENTS
140 "+comments",
141#else
142 "-comments",
143#endif
Bram Moolenaar860cae12010-06-05 23:22:07 +0200144#ifdef FEAT_CONCEAL
145 "+conceal",
146#else
147 "-conceal",
148#endif
Bram Moolenaar071d4272004-06-13 20:20:40 +0000149#ifdef FEAT_CRYPT
150 "+cryptv",
151#else
152 "-cryptv",
153#endif
154#ifdef FEAT_CSCOPE
155 "+cscope",
156#else
157 "-cscope",
158#endif
Bram Moolenaar860cae12010-06-05 23:22:07 +0200159#ifdef FEAT_CURSORBIND
160 "+cursorbind",
161#else
162 "-cursorbind",
163#endif
Bram Moolenaar17c7c012006-01-26 22:25:15 +0000164#ifdef CURSOR_SHAPE
165 "+cursorshape",
166#else
167 "-cursorshape",
168#endif
Bram Moolenaar071d4272004-06-13 20:20:40 +0000169#if defined(FEAT_CON_DIALOG) && defined(FEAT_GUI_DIALOG)
170 "+dialog_con_gui",
171#else
172# if defined(FEAT_CON_DIALOG)
173 "+dialog_con",
174# else
175# if defined(FEAT_GUI_DIALOG)
176 "+dialog_gui",
177# else
178 "-dialog",
179# endif
180# endif
181#endif
182#ifdef FEAT_DIFF
183 "+diff",
184#else
185 "-diff",
186#endif
187#ifdef FEAT_DIGRAPHS
188 "+digraphs",
189#else
190 "-digraphs",
191#endif
192#ifdef FEAT_DND
193 "+dnd",
194#else
195 "-dnd",
196#endif
197#ifdef EBCDIC
198 "+ebcdic",
199#else
200 "-ebcdic",
201#endif
202#ifdef FEAT_EMACS_TAGS
203 "+emacs_tags",
204#else
205 "-emacs_tags",
206#endif
207#ifdef FEAT_EVAL
208 "+eval",
209#else
210 "-eval",
211#endif
212#ifdef FEAT_EX_EXTRA
213 "+ex_extra",
214#else
215 "-ex_extra",
216#endif
217#ifdef FEAT_SEARCH_EXTRA
218 "+extra_search",
219#else
220 "-extra_search",
221#endif
222#ifdef FEAT_FKMAP
223 "+farsi",
224#else
225 "-farsi",
226#endif
227#ifdef FEAT_SEARCHPATH
228 "+file_in_path",
229#else
230 "-file_in_path",
231#endif
232#ifdef FEAT_FIND_ID
233 "+find_in_path",
234#else
235 "-find_in_path",
236#endif
Bram Moolenaar446cb832008-06-24 21:56:24 +0000237#ifdef FEAT_FLOAT
238 "+float",
239#else
240 "-float",
241#endif
Bram Moolenaar071d4272004-06-13 20:20:40 +0000242#ifdef FEAT_FOLDING
243 "+folding",
244#else
245 "-folding",
246#endif
247#ifdef FEAT_FOOTER
248 "+footer",
249#else
250 "-footer",
251#endif
252 /* only interesting on Unix systems */
253#if !defined(USE_SYSTEM) && defined(UNIX)
254 "+fork()",
255#endif
256#ifdef FEAT_GETTEXT
257# ifdef DYNAMIC_GETTEXT
258 "+gettext/dyn",
259# else
260 "+gettext",
261# endif
262#else
263 "-gettext",
264#endif
265#ifdef FEAT_HANGULIN
266 "+hangul_input",
267#else
268 "-hangul_input",
269#endif
270#if (defined(HAVE_ICONV_H) && defined(USE_ICONV)) || defined(DYNAMIC_ICONV)
271# ifdef DYNAMIC_ICONV
272 "+iconv/dyn",
273# else
274 "+iconv",
275# endif
276#else
277 "-iconv",
278#endif
279#ifdef FEAT_INS_EXPAND
280 "+insert_expand",
281#else
282 "-insert_expand",
283#endif
284#ifdef FEAT_JUMPLIST
285 "+jumplist",
286#else
287 "-jumplist",
288#endif
289#ifdef FEAT_KEYMAP
290 "+keymap",
291#else
292 "-keymap",
293#endif
294#ifdef FEAT_LANGMAP
295 "+langmap",
296#else
297 "-langmap",
298#endif
299#ifdef FEAT_LIBCALL
300 "+libcall",
301#else
302 "-libcall",
303#endif
304#ifdef FEAT_LINEBREAK
305 "+linebreak",
306#else
307 "-linebreak",
308#endif
309#ifdef FEAT_LISP
310 "+lispindent",
311#else
312 "-lispindent",
313#endif
314#ifdef FEAT_LISTCMDS
315 "+listcmds",
316#else
317 "-listcmds",
318#endif
319#ifdef FEAT_LOCALMAP
320 "+localmap",
321#else
322 "-localmap",
323#endif
Bram Moolenaar0ba04292010-07-14 23:23:17 +0200324#ifdef FEAT_LUA
325# ifdef DYNAMIC_LUA
326 "+lua/dyn",
327# else
328 "+lua",
329# endif
330#else
331 "-lua",
332#endif
Bram Moolenaar071d4272004-06-13 20:20:40 +0000333#ifdef FEAT_MENU
334 "+menu",
335#else
336 "-menu",
337#endif
338#ifdef FEAT_SESSION
339 "+mksession",
340#else
341 "-mksession",
342#endif
343#ifdef FEAT_MODIFY_FNAME
344 "+modify_fname",
345#else
346 "-modify_fname",
347#endif
348#ifdef FEAT_MOUSE
349 "+mouse",
350# ifdef FEAT_MOUSESHAPE
351 "+mouseshape",
352# else
353 "-mouseshape",
354# endif
355# else
356 "-mouse",
357#endif
Bram Moolenaar707cfb82012-10-21 04:00:07 +0200358
Bram Moolenaar071d4272004-06-13 20:20:40 +0000359#if defined(UNIX) || defined(VMS)
360# ifdef FEAT_MOUSE_DEC
361 "+mouse_dec",
362# else
363 "-mouse_dec",
364# endif
365# ifdef FEAT_MOUSE_GPM
366 "+mouse_gpm",
367# else
368 "-mouse_gpm",
369# endif
370# ifdef FEAT_MOUSE_JSB
371 "+mouse_jsbterm",
372# else
373 "-mouse_jsbterm",
374# endif
375# ifdef FEAT_MOUSE_NET
376 "+mouse_netterm",
377# else
378 "-mouse_netterm",
379# endif
Bram Moolenaar071d4272004-06-13 20:20:40 +0000380#endif
Bram Moolenaar707cfb82012-10-21 04:00:07 +0200381
Bram Moolenaar071d4272004-06-13 20:20:40 +0000382#ifdef __QNX__
383# ifdef FEAT_MOUSE_PTERM
384 "+mouse_pterm",
385# else
386 "-mouse_pterm",
387# endif
388#endif
Bram Moolenaar707cfb82012-10-21 04:00:07 +0200389
390#if defined(UNIX) || defined(VMS)
391# ifdef FEAT_MOUSE_SGR
392 "+mouse_sgr",
393# else
394 "-mouse_sgr",
395# endif
396# ifdef FEAT_SYSMOUSE
397 "+mouse_sysmouse",
398# else
399 "-mouse_sysmouse",
400# endif
401# ifdef FEAT_MOUSE_URXVT
402 "+mouse_urxvt",
403# else
404 "-mouse_urxvt",
405# endif
406# ifdef FEAT_MOUSE_XTERM
407 "+mouse_xterm",
408# else
409 "-mouse_xterm",
410# endif
411#endif
412
Bram Moolenaar071d4272004-06-13 20:20:40 +0000413#ifdef FEAT_MBYTE_IME
414# ifdef DYNAMIC_IME
415 "+multi_byte_ime/dyn",
416# else
417 "+multi_byte_ime",
418# endif
419#else
420# ifdef FEAT_MBYTE
421 "+multi_byte",
422# else
423 "-multi_byte",
424# endif
425#endif
426#ifdef FEAT_MULTI_LANG
427 "+multi_lang",
428#else
429 "-multi_lang",
430#endif
Bram Moolenaar325b7a22004-07-05 15:58:32 +0000431#ifdef FEAT_MZSCHEME
Bram Moolenaardf3267e2005-01-25 22:07:05 +0000432# ifdef DYNAMIC_MZSCHEME
433 "+mzscheme/dyn",
434# else
Bram Moolenaar325b7a22004-07-05 15:58:32 +0000435 "+mzscheme",
Bram Moolenaardf3267e2005-01-25 22:07:05 +0000436# endif
Bram Moolenaar325b7a22004-07-05 15:58:32 +0000437#else
438 "-mzscheme",
439#endif
Bram Moolenaar071d4272004-06-13 20:20:40 +0000440#ifdef FEAT_NETBEANS_INTG
441 "+netbeans_intg",
442#else
443 "-netbeans_intg",
444#endif
445#ifdef FEAT_GUI_W32
446# ifdef FEAT_OLE
447 "+ole",
448# else
449 "-ole",
450# endif
451#endif
Bram Moolenaar071d4272004-06-13 20:20:40 +0000452#ifdef FEAT_PATH_EXTRA
453 "+path_extra",
454#else
455 "-path_extra",
456#endif
457#ifdef FEAT_PERL
458# ifdef DYNAMIC_PERL
459 "+perl/dyn",
460# else
461 "+perl",
462# endif
463#else
464 "-perl",
465#endif
Bram Moolenaar55debbe2010-05-23 23:34:36 +0200466#ifdef FEAT_PERSISTENT_UNDO
467 "+persistent_undo",
468#else
469 "-persistent_undo",
470#endif
Bram Moolenaar071d4272004-06-13 20:20:40 +0000471#ifdef FEAT_PRINTER
472# ifdef FEAT_POSTSCRIPT
473 "+postscript",
474# else
475 "-postscript",
476# endif
477 "+printer",
478#else
479 "-printer",
480#endif
Bram Moolenaar05159a02005-02-26 23:04:13 +0000481#ifdef FEAT_PROFILE
482 "+profile",
483#else
484 "-profile",
485#endif
Bram Moolenaar071d4272004-06-13 20:20:40 +0000486#ifdef FEAT_PYTHON
487# ifdef DYNAMIC_PYTHON
488 "+python/dyn",
489# else
490 "+python",
491# endif
492#else
493 "-python",
494#endif
Bram Moolenaarbd5e15f2010-07-17 21:19:38 +0200495#ifdef FEAT_PYTHON3
496# ifdef DYNAMIC_PYTHON3
497 "+python3/dyn",
498# else
499 "+python3",
500# endif
501#else
502 "-python3",
503#endif
Bram Moolenaar071d4272004-06-13 20:20:40 +0000504#ifdef FEAT_QUICKFIX
505 "+quickfix",
506#else
507 "-quickfix",
508#endif
Bram Moolenaard68071d2006-05-02 22:08:30 +0000509#ifdef FEAT_RELTIME
510 "+reltime",
511#else
512 "-reltime",
513#endif
Bram Moolenaar071d4272004-06-13 20:20:40 +0000514#ifdef FEAT_RIGHTLEFT
515 "+rightleft",
516#else
517 "-rightleft",
518#endif
519#ifdef FEAT_RUBY
520# ifdef DYNAMIC_RUBY
521 "+ruby/dyn",
522# else
523 "+ruby",
524# endif
525#else
526 "-ruby",
527#endif
528#ifdef FEAT_SCROLLBIND
529 "+scrollbind",
530#else
531 "-scrollbind",
532#endif
533#ifdef FEAT_SIGNS
534 "+signs",
535#else
536 "-signs",
537#endif
538#ifdef FEAT_SMARTINDENT
539 "+smartindent",
540#else
541 "-smartindent",
542#endif
543#ifdef FEAT_SNIFF
544 "+sniff",
545#else
546 "-sniff",
547#endif
Bram Moolenaaref94eec2009-11-11 13:22:11 +0000548#ifdef STARTUPTIME
549 "+startuptime",
550#else
551 "-startuptime",
552#endif
Bram Moolenaar071d4272004-06-13 20:20:40 +0000553#ifdef FEAT_STL_OPT
554 "+statusline",
555#else
556 "-statusline",
557#endif
558#ifdef FEAT_SUN_WORKSHOP
559 "+sun_workshop",
560#else
561 "-sun_workshop",
562#endif
563#ifdef FEAT_SYN_HL
564 "+syntax",
565#else
566 "-syntax",
567#endif
568 /* only interesting on Unix systems */
569#if defined(USE_SYSTEM) && (defined(UNIX) || defined(__EMX__))
570 "+system()",
571#endif
572#ifdef FEAT_TAG_BINS
573 "+tag_binary",
574#else
575 "-tag_binary",
576#endif
577#ifdef FEAT_TAG_OLDSTATIC
578 "+tag_old_static",
579#else
580 "-tag_old_static",
581#endif
582#ifdef FEAT_TAG_ANYWHITE
583 "+tag_any_white",
584#else
585 "-tag_any_white",
586#endif
587#ifdef FEAT_TCL
588# ifdef DYNAMIC_TCL
589 "+tcl/dyn",
590# else
591 "+tcl",
592# endif
593#else
594 "-tcl",
595#endif
596#if defined(UNIX) || defined(__EMX__)
597/* only Unix (or OS/2 with EMX!) can have terminfo instead of termcap */
598# ifdef TERMINFO
599 "+terminfo",
600# else
601 "-terminfo",
602# endif
603#else /* unix always includes termcap support */
604# ifdef HAVE_TGETENT
605 "+tgetent",
606# else
607 "-tgetent",
608# endif
609#endif
610#ifdef FEAT_TERMRESPONSE
611 "+termresponse",
612#else
613 "-termresponse",
614#endif
615#ifdef FEAT_TEXTOBJ
616 "+textobjects",
617#else
618 "-textobjects",
619#endif
620#ifdef FEAT_TITLE
621 "+title",
622#else
623 "-title",
624#endif
625#ifdef FEAT_TOOLBAR
626 "+toolbar",
627#else
628 "-toolbar",
629#endif
630#ifdef FEAT_USR_CMDS
631 "+user_commands",
632#else
633 "-user_commands",
634#endif
635#ifdef FEAT_VERTSPLIT
636 "+vertsplit",
637#else
638 "-vertsplit",
639#endif
640#ifdef FEAT_VIRTUALEDIT
641 "+virtualedit",
642#else
643 "-virtualedit",
644#endif
645#ifdef FEAT_VISUAL
646 "+visual",
647# ifdef FEAT_VISUALEXTRA
648 "+visualextra",
649# else
650 "-visualextra",
651# endif
652#else
653 "-visual",
654#endif
655#ifdef FEAT_VIMINFO
656 "+viminfo",
657#else
658 "-viminfo",
659#endif
660#ifdef FEAT_VREPLACE
661 "+vreplace",
662#else
663 "-vreplace",
664#endif
665#ifdef FEAT_WILDIGN
666 "+wildignore",
667#else
668 "-wildignore",
669#endif
670#ifdef FEAT_WILDMENU
671 "+wildmenu",
672#else
673 "-wildmenu",
674#endif
675#ifdef FEAT_WINDOWS
676 "+windows",
677#else
678 "-windows",
679#endif
680#ifdef FEAT_WRITEBACKUP
681 "+writebackup",
682#else
683 "-writebackup",
684#endif
685#if defined(UNIX) || defined(VMS)
686# ifdef FEAT_X11
687 "+X11",
688# else
689 "-X11",
690# endif
691#endif
692#ifdef FEAT_XFONTSET
693 "+xfontset",
694#else
695 "-xfontset",
696#endif
697#ifdef FEAT_XIM
698 "+xim",
699#else
700 "-xim",
701#endif
702#if defined(UNIX) || defined(VMS)
703# ifdef USE_XSMP_INTERACT
704 "+xsmp_interact",
705# else
706# ifdef USE_XSMP
707 "+xsmp",
708# else
709 "-xsmp",
710# endif
711# endif
712# ifdef FEAT_XCLIPBOARD
713 "+xterm_clipboard",
714# else
715 "-xterm_clipboard",
716# endif
717#endif
718#ifdef FEAT_XTERM_SAVE
719 "+xterm_save",
720#else
721 "-xterm_save",
722#endif
723#ifdef WIN3264
724# ifdef FEAT_XPM_W32
725 "+xpm_w32",
726# else
727 "-xpm_w32",
728# endif
Bram Moolenaarb5ef5e12013-08-30 16:35:44 +0200729#else
730# ifdef HAVE_XPM
731 "+xpm",
732# else
733 "-xpm",
734# endif
Bram Moolenaar071d4272004-06-13 20:20:40 +0000735#endif
736 NULL
737};
738
739static int included_patches[] =
740{ /* Add new patch number below this line */
741/**/
Bram Moolenaar604729e2013-08-30 16:44:19 +0200742 12,
743/**/
Bram Moolenaarb5ef5e12013-08-30 16:35:44 +0200744 11,
745/**/
Bram Moolenaar195ef0c2013-08-30 16:00:08 +0200746 10,
747/**/
Bram Moolenaarcf81aef2013-08-25 17:46:08 +0200748 9,
749/**/
Bram Moolenaar41f12052013-08-25 17:01:42 +0200750 8,
751/**/
Bram Moolenaar74cd6242013-08-22 14:14:27 +0200752 7,
753/**/
Bram Moolenaar67652c22013-08-22 12:06:55 +0200754 6,
755/**/
Bram Moolenaarc56c4592013-08-14 17:45:29 +0200756 5,
757/**/
Bram Moolenaarc93df6b2013-08-14 17:11:20 +0200758 4,
759/**/
Bram Moolenaarebefd992013-08-14 14:18:40 +0200760 3,
761/**/
Bram Moolenaar3f0df062013-08-14 13:34:25 +0200762 2,
763/**/
Bram Moolenaar1cfad522013-08-14 12:06:49 +0200764 1,
765/**/
Bram Moolenaar071d4272004-06-13 20:20:40 +0000766 0
767};
768
Bram Moolenaar10d4cec2008-11-30 11:15:09 +0000769/*
770 * Place to put a short description when adding a feature with a patch.
771 * Keep it short, e.g.,: "relative numbers", "persistent undo".
772 * Also add a comment marker to separate the lines.
773 * See the official Vim patches for the diff format: It must use a context of
Bram Moolenaarcbb8eb32008-12-24 13:25:14 +0000774 * one line only. Create it by hand or use "diff -C2" and edit the patch.
Bram Moolenaar10d4cec2008-11-30 11:15:09 +0000775 */
776static char *(extra_patches[]) =
777{ /* Add your patch description below this line */
778/**/
779 NULL
780};
781
Bram Moolenaar071d4272004-06-13 20:20:40 +0000782 int
783highest_patch()
784{
785 int i;
786 int h = 0;
787
788 for (i = 0; included_patches[i] != 0; ++i)
789 if (included_patches[i] > h)
790 h = included_patches[i];
791 return h;
792}
793
794#if defined(FEAT_EVAL) || defined(PROTO)
795/*
796 * Return TRUE if patch "n" has been included.
797 */
798 int
799has_patch(n)
800 int n;
801{
802 int i;
803
804 for (i = 0; included_patches[i] != 0; ++i)
805 if (included_patches[i] == n)
806 return TRUE;
807 return FALSE;
808}
809#endif
810
811 void
812ex_version(eap)
813 exarg_T *eap;
814{
815 /*
816 * Ignore a ":version 9.99" command.
817 */
818 if (*eap->arg == NUL)
819 {
820 msg_putchar('\n');
821 list_version();
822 }
823}
824
Bram Moolenaar445f3032013-02-20 16:47:36 +0100825/*
826 * List all features aligned in columns, dictionary style.
827 */
828 static void
829list_features()
830{
831 int i;
832 int ncol;
833 int nrow;
834 int nfeat = 0;
835 int width = 0;
836
837 /* Find the length of the longest feature name, use that + 1 as the column
838 * width */
839 for (i = 0; features[i] != NULL; ++i)
840 {
Bram Moolenaar5c962632013-02-26 11:25:33 +0100841 int l = (int)STRLEN(features[i]);
Bram Moolenaar445f3032013-02-20 16:47:36 +0100842
843 if (l > width)
844 width = l;
845 ++nfeat;
846 }
847 width += 1;
848
849 if (Columns < width)
850 {
851 /* Not enough screen columns - show one per line */
852 for (i = 0; features[i] != NULL; ++i)
853 {
854 version_msg(features[i]);
855 if (msg_col > 0)
856 msg_putchar('\n');
857 }
858 return;
859 }
860
Bram Moolenaar445f3032013-02-20 16:47:36 +0100861 /* The rightmost column doesn't need a separator.
862 * Sacrifice it to fit in one more column if possible. */
Bram Moolenaarf13f45d2013-02-26 15:27:23 +0100863 ncol = (int) (Columns + 1) / width;
Bram Moolenaar445f3032013-02-20 16:47:36 +0100864 nrow = nfeat / ncol + (nfeat % ncol ? 1 : 0);
865
Bram Moolenaarf13f45d2013-02-26 15:27:23 +0100866 /* i counts columns then rows. idx counts rows then columns. */
Bram Moolenaar445f3032013-02-20 16:47:36 +0100867 for (i = 0; !got_int && i < nrow * ncol; ++i)
868 {
869 int idx = (i / ncol) + (i % ncol) * nrow;
870
871 if (idx < nfeat)
872 {
873 int last_col = (i + 1) % ncol == 0;
874
875 msg_puts((char_u *)features[idx]);
876 if (last_col)
877 {
878 if (msg_col > 0)
879 msg_putchar('\n');
880 }
881 else
882 {
883 while (msg_col % width)
884 msg_putchar(' ');
885 }
886 }
887 else
Bram Moolenaarf13f45d2013-02-26 15:27:23 +0100888 {
889 if (msg_col > 0)
890 msg_putchar('\n');
891 }
Bram Moolenaar445f3032013-02-20 16:47:36 +0100892 }
893}
Bram Moolenaar5c962632013-02-26 11:25:33 +0100894
Bram Moolenaar071d4272004-06-13 20:20:40 +0000895 void
896list_version()
897{
898 int i;
899 int first;
900 char *s = "";
901
902 /*
903 * When adding features here, don't forget to update the list of
904 * internal variables in eval.c!
905 */
906 MSG(longVersion);
907#ifdef WIN3264
908# ifdef FEAT_GUI_W32
909# if defined(_MSC_VER) && (_MSC_VER <= 1010)
910 /* Only MS VC 4.1 and earlier can do Win32s */
Bram Moolenaare7cb9cf2008-06-20 14:32:41 +0000911 MSG_PUTS(_("\nMS-Windows 16/32-bit GUI version"));
Bram Moolenaar071d4272004-06-13 20:20:40 +0000912# else
Bram Moolenaard9b87332006-10-03 14:30:41 +0000913# ifdef _WIN64
Bram Moolenaare7cb9cf2008-06-20 14:32:41 +0000914 MSG_PUTS(_("\nMS-Windows 64-bit GUI version"));
Bram Moolenaard9b87332006-10-03 14:30:41 +0000915# else
Bram Moolenaare7cb9cf2008-06-20 14:32:41 +0000916 MSG_PUTS(_("\nMS-Windows 32-bit GUI version"));
Bram Moolenaard9b87332006-10-03 14:30:41 +0000917# endif
Bram Moolenaar071d4272004-06-13 20:20:40 +0000918# endif
919 if (gui_is_win32s())
920 MSG_PUTS(_(" in Win32s mode"));
921# ifdef FEAT_OLE
922 MSG_PUTS(_(" with OLE support"));
923# endif
924# else
Bram Moolenaare7cb9cf2008-06-20 14:32:41 +0000925# ifdef _WIN64
926 MSG_PUTS(_("\nMS-Windows 64-bit console version"));
927# else
928 MSG_PUTS(_("\nMS-Windows 32-bit console version"));
929# endif
Bram Moolenaar071d4272004-06-13 20:20:40 +0000930# endif
931#endif
932#ifdef WIN16
Bram Moolenaare7cb9cf2008-06-20 14:32:41 +0000933 MSG_PUTS(_("\nMS-Windows 16-bit version"));
Bram Moolenaar071d4272004-06-13 20:20:40 +0000934#endif
935#ifdef MSDOS
936# ifdef DJGPP
Bram Moolenaare7cb9cf2008-06-20 14:32:41 +0000937 MSG_PUTS(_("\n32-bit MS-DOS version"));
Bram Moolenaar071d4272004-06-13 20:20:40 +0000938# else
Bram Moolenaare7cb9cf2008-06-20 14:32:41 +0000939 MSG_PUTS(_("\n16-bit MS-DOS version"));
Bram Moolenaar071d4272004-06-13 20:20:40 +0000940# endif
941#endif
942#ifdef MACOS
943# ifdef MACOS_X
944# ifdef MACOS_X_UNIX
945 MSG_PUTS(_("\nMacOS X (unix) version"));
946# else
947 MSG_PUTS(_("\nMacOS X version"));
948# endif
949#else
950 MSG_PUTS(_("\nMacOS version"));
951# endif
952#endif
953
Bram Moolenaar071d4272004-06-13 20:20:40 +0000954#ifdef VMS
Bram Moolenaar6949d1d2008-08-25 02:14:05 +0000955 MSG_PUTS(_("\nOpenVMS version"));
Bram Moolenaar3d20ca12006-11-28 16:43:58 +0000956# ifdef HAVE_PATHDEF
957 if (*compiled_arch != NUL)
958 {
959 MSG_PUTS(" - ");
960 MSG_PUTS(compiled_arch);
961 }
962# endif
963
Bram Moolenaar071d4272004-06-13 20:20:40 +0000964#endif
965
966 /* Print the list of patch numbers if there is at least one. */
967 /* Print a range when patches are consecutive: "1-10, 12, 15-40, 42-45" */
968 if (included_patches[0] != 0)
969 {
970 MSG_PUTS(_("\nIncluded patches: "));
971 first = -1;
972 /* find last one */
973 for (i = 0; included_patches[i] != 0; ++i)
974 ;
975 while (--i >= 0)
976 {
977 if (first < 0)
978 first = included_patches[i];
979 if (i == 0 || included_patches[i - 1] != included_patches[i] + 1)
980 {
981 MSG_PUTS(s);
982 s = ", ";
983 msg_outnum((long)first);
984 if (first != included_patches[i])
985 {
986 MSG_PUTS("-");
987 msg_outnum((long)included_patches[i]);
988 }
989 first = -1;
990 }
991 }
992 }
993
Bram Moolenaar10d4cec2008-11-30 11:15:09 +0000994 /* Print the list of extra patch descriptions if there is at least one. */
995 if (extra_patches[0] != NULL)
996 {
997 MSG_PUTS(_("\nExtra patches: "));
998 s = "";
999 for (i = 0; extra_patches[i] != NULL; ++i)
1000 {
1001 MSG_PUTS(s);
1002 s = ", ";
1003 MSG_PUTS(extra_patches[i]);
1004 }
1005 }
1006
Bram Moolenaar071d4272004-06-13 20:20:40 +00001007#ifdef MODIFIED_BY
1008 MSG_PUTS("\n");
1009 MSG_PUTS(_("Modified by "));
1010 MSG_PUTS(MODIFIED_BY);
1011#endif
1012
1013#ifdef HAVE_PATHDEF
1014 if (*compiled_user != NUL || *compiled_sys != NUL)
1015 {
1016 MSG_PUTS(_("\nCompiled "));
1017 if (*compiled_user != NUL)
1018 {
1019 MSG_PUTS(_("by "));
1020 MSG_PUTS(compiled_user);
1021 }
1022 if (*compiled_sys != NUL)
1023 {
1024 MSG_PUTS("@");
1025 MSG_PUTS(compiled_sys);
1026 }
1027 }
1028#endif
1029
1030#ifdef FEAT_HUGE
1031 MSG_PUTS(_("\nHuge version "));
1032#else
1033# ifdef FEAT_BIG
1034 MSG_PUTS(_("\nBig version "));
1035# else
1036# ifdef FEAT_NORMAL
1037 MSG_PUTS(_("\nNormal version "));
1038# else
1039# ifdef FEAT_SMALL
1040 MSG_PUTS(_("\nSmall version "));
1041# else
1042 MSG_PUTS(_("\nTiny version "));
1043# endif
1044# endif
1045# endif
1046#endif
1047#ifndef FEAT_GUI
1048 MSG_PUTS(_("without GUI."));
1049#else
1050# ifdef FEAT_GUI_GTK
1051# ifdef FEAT_GUI_GNOME
Bram Moolenaar071d4272004-06-13 20:20:40 +00001052 MSG_PUTS(_("with GTK2-GNOME GUI."));
Bram Moolenaar071d4272004-06-13 20:20:40 +00001053# else
Bram Moolenaar071d4272004-06-13 20:20:40 +00001054 MSG_PUTS(_("with GTK2 GUI."));
Bram Moolenaar071d4272004-06-13 20:20:40 +00001055# endif
1056# else
1057# ifdef FEAT_GUI_MOTIF
1058 MSG_PUTS(_("with X11-Motif GUI."));
1059# else
1060# ifdef FEAT_GUI_ATHENA
1061# ifdef FEAT_GUI_NEXTAW
1062 MSG_PUTS(_("with X11-neXtaw GUI."));
1063# else
1064 MSG_PUTS(_("with X11-Athena GUI."));
1065# endif
1066# else
Bram Moolenaar071d4272004-06-13 20:20:40 +00001067# ifdef FEAT_GUI_PHOTON
1068 MSG_PUTS(_("with Photon GUI."));
1069# else
1070# if defined(MSWIN)
1071 MSG_PUTS(_("with GUI."));
1072# else
Bram Moolenaar860cae12010-06-05 23:22:07 +02001073# if defined(TARGET_API_MAC_CARBON) && TARGET_API_MAC_CARBON
Bram Moolenaar071d4272004-06-13 20:20:40 +00001074 MSG_PUTS(_("with Carbon GUI."));
1075# else
Bram Moolenaar860cae12010-06-05 23:22:07 +02001076# if defined(TARGET_API_MAC_OSX) && TARGET_API_MAC_OSX
Bram Moolenaar071d4272004-06-13 20:20:40 +00001077 MSG_PUTS(_("with Cocoa GUI."));
1078# else
Bram Moolenaar860cae12010-06-05 23:22:07 +02001079# if defined(MACOS)
Bram Moolenaar071d4272004-06-13 20:20:40 +00001080 MSG_PUTS(_("with (classic) GUI."));
Bram Moolenaar071d4272004-06-13 20:20:40 +00001081# endif
1082# endif
1083# endif
1084# endif
Bram Moolenaar071d4272004-06-13 20:20:40 +00001085# endif
1086# endif
1087# endif
1088# endif
1089#endif
1090 version_msg(_(" Features included (+) or not (-):\n"));
1091
Bram Moolenaar445f3032013-02-20 16:47:36 +01001092 list_features();
Bram Moolenaar071d4272004-06-13 20:20:40 +00001093
Bram Moolenaar071d4272004-06-13 20:20:40 +00001094#ifdef SYS_VIMRC_FILE
1095 version_msg(_(" system vimrc file: \""));
1096 version_msg(SYS_VIMRC_FILE);
1097 version_msg("\"\n");
1098#endif
1099#ifdef USR_VIMRC_FILE
1100 version_msg(_(" user vimrc file: \""));
1101 version_msg(USR_VIMRC_FILE);
1102 version_msg("\"\n");
1103#endif
1104#ifdef USR_VIMRC_FILE2
1105 version_msg(_(" 2nd user vimrc file: \""));
1106 version_msg(USR_VIMRC_FILE2);
1107 version_msg("\"\n");
1108#endif
1109#ifdef USR_VIMRC_FILE3
1110 version_msg(_(" 3rd user vimrc file: \""));
1111 version_msg(USR_VIMRC_FILE3);
1112 version_msg("\"\n");
1113#endif
1114#ifdef USR_EXRC_FILE
1115 version_msg(_(" user exrc file: \""));
1116 version_msg(USR_EXRC_FILE);
1117 version_msg("\"\n");
1118#endif
1119#ifdef USR_EXRC_FILE2
1120 version_msg(_(" 2nd user exrc file: \""));
1121 version_msg(USR_EXRC_FILE2);
1122 version_msg("\"\n");
1123#endif
1124#ifdef FEAT_GUI
1125# ifdef SYS_GVIMRC_FILE
1126 version_msg(_(" system gvimrc file: \""));
1127 version_msg(SYS_GVIMRC_FILE);
1128 version_msg("\"\n");
1129# endif
1130 version_msg(_(" user gvimrc file: \""));
1131 version_msg(USR_GVIMRC_FILE);
1132 version_msg("\"\n");
1133# ifdef USR_GVIMRC_FILE2
1134 version_msg(_("2nd user gvimrc file: \""));
1135 version_msg(USR_GVIMRC_FILE2);
1136 version_msg("\"\n");
1137# endif
1138# ifdef USR_GVIMRC_FILE3
1139 version_msg(_("3rd user gvimrc file: \""));
1140 version_msg(USR_GVIMRC_FILE3);
1141 version_msg("\"\n");
1142# endif
1143#endif
1144#ifdef FEAT_GUI
1145# ifdef SYS_MENU_FILE
1146 version_msg(_(" system menu file: \""));
1147 version_msg(SYS_MENU_FILE);
1148 version_msg("\"\n");
1149# endif
1150#endif
1151#ifdef HAVE_PATHDEF
1152 if (*default_vim_dir != NUL)
1153 {
1154 version_msg(_(" fall-back for $VIM: \""));
1155 version_msg((char *)default_vim_dir);
1156 version_msg("\"\n");
1157 }
1158 if (*default_vimruntime_dir != NUL)
1159 {
1160 version_msg(_(" f-b for $VIMRUNTIME: \""));
1161 version_msg((char *)default_vimruntime_dir);
1162 version_msg("\"\n");
1163 }
1164 version_msg(_("Compilation: "));
1165 version_msg((char *)all_cflags);
1166 version_msg("\n");
1167#ifdef VMS
1168 if (*compiler_version != NUL)
1169 {
1170 version_msg(_("Compiler: "));
1171 version_msg((char *)compiler_version);
1172 version_msg("\n");
1173 }
1174#endif
1175 version_msg(_("Linking: "));
1176 version_msg((char *)all_lflags);
1177#endif
1178#ifdef DEBUG
1179 version_msg("\n");
1180 version_msg(_(" DEBUG BUILD"));
1181#endif
1182}
1183
1184/*
1185 * Output a string for the version message. If it's going to wrap, output a
1186 * newline, unless the message is too long to fit on the screen anyway.
1187 */
1188 static void
1189version_msg(s)
1190 char *s;
1191{
1192 int len = (int)STRLEN(s);
1193
1194 if (!got_int && len < (int)Columns && msg_col + len >= (int)Columns
1195 && *s != '\n')
1196 msg_putchar('\n');
1197 if (!got_int)
1198 MSG_PUTS(s);
1199}
1200
1201static void do_intro_line __ARGS((int row, char_u *mesg, int add_version, int attr));
1202
1203/*
Bram Moolenaar249f0dd2013-07-04 22:31:03 +02001204 * Show the intro message when not editing a file.
1205 */
1206 void
1207maybe_intro_message()
1208{
1209 if (bufempty()
1210 && curbuf->b_fname == NULL
1211#ifdef FEAT_WINDOWS
1212 && firstwin->w_next == NULL
1213#endif
1214 && vim_strchr(p_shm, SHM_INTRO) == NULL)
1215 intro_message(FALSE);
1216}
1217
1218/*
Bram Moolenaar071d4272004-06-13 20:20:40 +00001219 * Give an introductory message about Vim.
1220 * Only used when starting Vim on an empty file, without a file name.
1221 * Or with the ":intro" command (for Sven :-).
1222 */
1223 void
1224intro_message(colon)
1225 int colon; /* TRUE for ":intro" */
1226{
1227 int i;
1228 int row;
1229 int blanklines;
1230 int sponsor;
1231 char *p;
1232 static char *(lines[]) =
1233 {
1234 N_("VIM - Vi IMproved"),
1235 "",
1236 N_("version "),
1237 N_("by Bram Moolenaar et al."),
1238#ifdef MODIFIED_BY
1239 " ",
1240#endif
1241 N_("Vim is open source and freely distributable"),
1242 "",
1243 N_("Help poor children in Uganda!"),
1244 N_("type :help iccf<Enter> for information "),
1245 "",
1246 N_("type :q<Enter> to exit "),
1247 N_("type :help<Enter> or <F1> for on-line help"),
Bram Moolenaar3fdfa4a2004-10-07 21:02:47 +00001248 N_("type :help version7<Enter> for version info"),
Bram Moolenaar071d4272004-06-13 20:20:40 +00001249 NULL,
1250 "",
1251 N_("Running in Vi compatible mode"),
1252 N_("type :set nocp<Enter> for Vim defaults"),
1253 N_("type :help cp-default<Enter> for info on this"),
1254 };
1255#ifdef FEAT_GUI
1256 static char *(gui_lines[]) =
1257 {
1258 NULL,
1259 NULL,
1260 NULL,
1261 NULL,
1262#ifdef MODIFIED_BY
1263 NULL,
1264#endif
1265 NULL,
1266 NULL,
1267 NULL,
1268 N_("menu Help->Orphans for information "),
1269 NULL,
1270 N_("Running modeless, typed text is inserted"),
1271 N_("menu Edit->Global Settings->Toggle Insert Mode "),
1272 N_(" for two modes "),
1273 NULL,
1274 NULL,
1275 NULL,
1276 N_("menu Edit->Global Settings->Toggle Vi Compatible"),
1277 N_(" for Vim defaults "),
1278 };
1279#endif
1280
1281 /* blanklines = screen height - # message lines */
1282 blanklines = (int)Rows - ((sizeof(lines) / sizeof(char *)) - 1);
1283 if (!p_cp)
1284 blanklines += 4; /* add 4 for not showing "Vi compatible" message */
1285#if defined(WIN3264) && !defined(FEAT_GUI_W32)
1286 if (mch_windows95())
1287 blanklines -= 3; /* subtract 3 for showing "Windows 95" message */
1288#endif
1289
1290#ifdef FEAT_WINDOWS
1291 /* Don't overwrite a statusline. Depends on 'cmdheight'. */
1292 if (p_ls > 1)
1293 blanklines -= Rows - topframe->fr_height;
1294#endif
1295 if (blanklines < 0)
1296 blanklines = 0;
1297
1298 /* Show the sponsor and register message one out of four times, the Uganda
1299 * message two out of four times. */
Bram Moolenaarf4cd3e82005-12-22 22:47:02 +00001300 sponsor = (int)time(NULL);
Bram Moolenaar071d4272004-06-13 20:20:40 +00001301 sponsor = ((sponsor & 2) == 0) - ((sponsor & 4) == 0);
1302
1303 /* start displaying the message lines after half of the blank lines */
1304 row = blanklines / 2;
1305 if ((row >= 2 && Columns >= 50) || colon)
1306 {
1307 for (i = 0; i < (int)(sizeof(lines) / sizeof(char *)); ++i)
1308 {
1309 p = lines[i];
1310#ifdef FEAT_GUI
1311 if (p_im && gui.in_use && gui_lines[i] != NULL)
1312 p = gui_lines[i];
1313#endif
1314 if (p == NULL)
1315 {
1316 if (!p_cp)
1317 break;
1318 continue;
1319 }
1320 if (sponsor != 0)
1321 {
1322 if (strstr(p, "children") != NULL)
1323 p = sponsor < 0
1324 ? N_("Sponsor Vim development!")
1325 : N_("Become a registered Vim user!");
1326 else if (strstr(p, "iccf") != NULL)
1327 p = sponsor < 0
1328 ? N_("type :help sponsor<Enter> for information ")
1329 : N_("type :help register<Enter> for information ");
1330 else if (strstr(p, "Orphans") != NULL)
1331 p = N_("menu Help->Sponsor/Register for information ");
1332 }
1333 if (*p != NUL)
1334 do_intro_line(row, (char_u *)_(p), i == 2, 0);
1335 ++row;
1336 }
1337#if defined(WIN3264) && !defined(FEAT_GUI_W32)
1338 if (mch_windows95())
1339 {
1340 do_intro_line(++row,
1341 (char_u *)_("WARNING: Windows 95/98/ME detected"),
1342 FALSE, hl_attr(HLF_E));
1343 do_intro_line(++row,
1344 (char_u *)_("type :help windows95<Enter> for info on this"),
1345 FALSE, 0);
1346 }
1347#endif
1348 }
1349
1350 /* Make the wait-return message appear just below the text. */
1351 if (colon)
1352 msg_row = row;
1353}
1354
1355 static void
1356do_intro_line(row, mesg, add_version, attr)
1357 int row;
1358 char_u *mesg;
1359 int add_version;
1360 int attr;
1361{
1362 char_u vers[20];
1363 int col;
1364 char_u *p;
1365 int l;
1366 int clen;
1367#ifdef MODIFIED_BY
1368# define MODBY_LEN 150
1369 char_u modby[MODBY_LEN];
1370
1371 if (*mesg == ' ')
1372 {
Bram Moolenaar589e43a2008-01-05 12:59:22 +00001373 vim_strncpy(modby, (char_u *)_("Modified by "), MODBY_LEN - 1);
Bram Moolenaar071d4272004-06-13 20:20:40 +00001374 l = STRLEN(modby);
Bram Moolenaar589e43a2008-01-05 12:59:22 +00001375 vim_strncpy(modby + l, (char_u *)MODIFIED_BY, MODBY_LEN - l - 1);
Bram Moolenaar071d4272004-06-13 20:20:40 +00001376 mesg = modby;
1377 }
1378#endif
1379
1380 /* Center the message horizontally. */
1381 col = vim_strsize(mesg);
1382 if (add_version)
1383 {
1384 STRCPY(vers, mediumVersion);
1385 if (highest_patch())
1386 {
1387 /* Check for 9.9x or 9.9xx, alpha/beta version */
Bram Moolenaar22df3f92010-10-27 16:01:27 +02001388 if (isalpha((int)vers[3]))
Bram Moolenaar071d4272004-06-13 20:20:40 +00001389 {
Bram Moolenaar552ac132012-03-07 18:03:10 +01001390 int len = (isalpha((int)vers[4])) ? 5 : 4;
1391 sprintf((char *)vers + len, ".%d%s", highest_patch(),
1392 mediumVersion + len);
Bram Moolenaar071d4272004-06-13 20:20:40 +00001393 }
1394 else
1395 sprintf((char *)vers + 3, ".%d", highest_patch());
1396 }
1397 col += (int)STRLEN(vers);
1398 }
1399 col = (Columns - col) / 2;
1400 if (col < 0)
1401 col = 0;
1402
1403 /* Split up in parts to highlight <> items differently. */
1404 for (p = mesg; *p != NUL; p += l)
1405 {
1406 clen = 0;
1407 for (l = 0; p[l] != NUL
1408 && (l == 0 || (p[l] != '<' && p[l - 1] != '>')); ++l)
1409 {
1410#ifdef FEAT_MBYTE
1411 if (has_mbyte)
1412 {
1413 clen += ptr2cells(p + l);
Bram Moolenaar0fa313a2005-08-10 21:07:57 +00001414 l += (*mb_ptr2len)(p + l) - 1;
Bram Moolenaar071d4272004-06-13 20:20:40 +00001415 }
1416 else
1417#endif
1418 clen += byte2cells(p[l]);
1419 }
1420 screen_puts_len(p, l, row, col, *p == '<' ? hl_attr(HLF_8) : attr);
1421 col += clen;
1422 }
1423
1424 /* Add the version number to the version line. */
1425 if (add_version)
1426 screen_puts(vers, row, col, 0);
1427}
1428
1429/*
1430 * ":intro": clear screen, display intro screen and wait for return.
1431 */
Bram Moolenaar071d4272004-06-13 20:20:40 +00001432 void
1433ex_intro(eap)
Bram Moolenaar0c094b92009-05-14 20:20:33 +00001434 exarg_T *eap UNUSED;
Bram Moolenaar071d4272004-06-13 20:20:40 +00001435{
1436 screenclear();
1437 intro_message(TRUE);
1438 wait_return(TRUE);
1439}