blob: 02086c7660a795a5889c8b5e274b6b5147289e0d [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
38static void list_features __ARGS((void));
39
Bram Moolenaar071d4272004-06-13 20:20:40 +000040 void
41make_version()
42{
43 /*
44 * Construct the long version string. Necessary because
45 * VAX C can't catenate strings in the preprocessor.
46 */
47 strcpy(longVersion, VIM_VERSION_LONG_DATE);
48 strcat(longVersion, __DATE__);
49 strcat(longVersion, " ");
50 strcat(longVersion, __TIME__);
51 strcat(longVersion, ")");
52}
53# else
54char *longVersion = VIM_VERSION_LONG_DATE __DATE__ " " __TIME__ ")";
55# endif
56#else
57char *longVersion = VIM_VERSION_LONG;
58#endif
59
60static void version_msg __ARGS((char *s));
61
62static char *(features[]) =
63{
64#ifdef AMIGA /* only for Amiga systems */
65# ifdef FEAT_ARP
66 "+ARP",
67# else
68 "-ARP",
69# endif
70#endif
71#ifdef FEAT_ARABIC
72 "+arabic",
73#else
74 "-arabic",
75#endif
76#ifdef FEAT_AUTOCMD
77 "+autocmd",
78#else
79 "-autocmd",
80#endif
81#ifdef FEAT_BEVAL
82 "+balloon_eval",
83#else
84 "-balloon_eval",
85#endif
86#ifdef FEAT_BROWSE
87 "+browse",
88#else
89 "-browse",
90#endif
91#ifdef NO_BUILTIN_TCAPS
92 "-builtin_terms",
93#endif
94#ifdef SOME_BUILTIN_TCAPS
95 "+builtin_terms",
96#endif
97#ifdef ALL_BUILTIN_TCAPS
98 "++builtin_terms",
99#endif
100#ifdef FEAT_BYTEOFF
101 "+byte_offset",
102#else
103 "-byte_offset",
104#endif
105#ifdef FEAT_CINDENT
106 "+cindent",
107#else
108 "-cindent",
109#endif
110#ifdef FEAT_CLIENTSERVER
111 "+clientserver",
112#else
113 "-clientserver",
114#endif
115#ifdef FEAT_CLIPBOARD
116 "+clipboard",
117#else
118 "-clipboard",
119#endif
120#ifdef FEAT_CMDL_COMPL
121 "+cmdline_compl",
122#else
123 "-cmdline_compl",
124#endif
125#ifdef FEAT_CMDHIST
126 "+cmdline_hist",
127#else
128 "-cmdline_hist",
129#endif
130#ifdef FEAT_CMDL_INFO
131 "+cmdline_info",
132#else
133 "-cmdline_info",
134#endif
135#ifdef FEAT_COMMENTS
136 "+comments",
137#else
138 "-comments",
139#endif
Bram Moolenaar860cae12010-06-05 23:22:07 +0200140#ifdef FEAT_CONCEAL
141 "+conceal",
142#else
143 "-conceal",
144#endif
Bram Moolenaar071d4272004-06-13 20:20:40 +0000145#ifdef FEAT_CRYPT
146 "+cryptv",
147#else
148 "-cryptv",
149#endif
150#ifdef FEAT_CSCOPE
151 "+cscope",
152#else
153 "-cscope",
154#endif
Bram Moolenaar860cae12010-06-05 23:22:07 +0200155#ifdef FEAT_CURSORBIND
156 "+cursorbind",
157#else
158 "-cursorbind",
159#endif
Bram Moolenaar17c7c012006-01-26 22:25:15 +0000160#ifdef CURSOR_SHAPE
161 "+cursorshape",
162#else
163 "-cursorshape",
164#endif
Bram Moolenaar071d4272004-06-13 20:20:40 +0000165#if defined(FEAT_CON_DIALOG) && defined(FEAT_GUI_DIALOG)
166 "+dialog_con_gui",
167#else
168# if defined(FEAT_CON_DIALOG)
169 "+dialog_con",
170# else
171# if defined(FEAT_GUI_DIALOG)
172 "+dialog_gui",
173# else
174 "-dialog",
175# endif
176# endif
177#endif
178#ifdef FEAT_DIFF
179 "+diff",
180#else
181 "-diff",
182#endif
183#ifdef FEAT_DIGRAPHS
184 "+digraphs",
185#else
186 "-digraphs",
187#endif
188#ifdef FEAT_DND
189 "+dnd",
190#else
191 "-dnd",
192#endif
193#ifdef EBCDIC
194 "+ebcdic",
195#else
196 "-ebcdic",
197#endif
198#ifdef FEAT_EMACS_TAGS
199 "+emacs_tags",
200#else
201 "-emacs_tags",
202#endif
203#ifdef FEAT_EVAL
204 "+eval",
205#else
206 "-eval",
207#endif
208#ifdef FEAT_EX_EXTRA
209 "+ex_extra",
210#else
211 "-ex_extra",
212#endif
213#ifdef FEAT_SEARCH_EXTRA
214 "+extra_search",
215#else
216 "-extra_search",
217#endif
218#ifdef FEAT_FKMAP
219 "+farsi",
220#else
221 "-farsi",
222#endif
223#ifdef FEAT_SEARCHPATH
224 "+file_in_path",
225#else
226 "-file_in_path",
227#endif
228#ifdef FEAT_FIND_ID
229 "+find_in_path",
230#else
231 "-find_in_path",
232#endif
Bram Moolenaar446cb832008-06-24 21:56:24 +0000233#ifdef FEAT_FLOAT
234 "+float",
235#else
236 "-float",
237#endif
Bram Moolenaar071d4272004-06-13 20:20:40 +0000238#ifdef FEAT_FOLDING
239 "+folding",
240#else
241 "-folding",
242#endif
243#ifdef FEAT_FOOTER
244 "+footer",
245#else
246 "-footer",
247#endif
248 /* only interesting on Unix systems */
249#if !defined(USE_SYSTEM) && defined(UNIX)
250 "+fork()",
251#endif
252#ifdef FEAT_GETTEXT
253# ifdef DYNAMIC_GETTEXT
254 "+gettext/dyn",
255# else
256 "+gettext",
257# endif
258#else
259 "-gettext",
260#endif
261#ifdef FEAT_HANGULIN
262 "+hangul_input",
263#else
264 "-hangul_input",
265#endif
266#if (defined(HAVE_ICONV_H) && defined(USE_ICONV)) || defined(DYNAMIC_ICONV)
267# ifdef DYNAMIC_ICONV
268 "+iconv/dyn",
269# else
270 "+iconv",
271# endif
272#else
273 "-iconv",
274#endif
275#ifdef FEAT_INS_EXPAND
276 "+insert_expand",
277#else
278 "-insert_expand",
279#endif
280#ifdef FEAT_JUMPLIST
281 "+jumplist",
282#else
283 "-jumplist",
284#endif
285#ifdef FEAT_KEYMAP
286 "+keymap",
287#else
288 "-keymap",
289#endif
290#ifdef FEAT_LANGMAP
291 "+langmap",
292#else
293 "-langmap",
294#endif
295#ifdef FEAT_LIBCALL
296 "+libcall",
297#else
298 "-libcall",
299#endif
300#ifdef FEAT_LINEBREAK
301 "+linebreak",
302#else
303 "-linebreak",
304#endif
305#ifdef FEAT_LISP
306 "+lispindent",
307#else
308 "-lispindent",
309#endif
310#ifdef FEAT_LISTCMDS
311 "+listcmds",
312#else
313 "-listcmds",
314#endif
315#ifdef FEAT_LOCALMAP
316 "+localmap",
317#else
318 "-localmap",
319#endif
Bram Moolenaar0ba04292010-07-14 23:23:17 +0200320#ifdef FEAT_LUA
321# ifdef DYNAMIC_LUA
322 "+lua/dyn",
323# else
324 "+lua",
325# endif
326#else
327 "-lua",
328#endif
Bram Moolenaar071d4272004-06-13 20:20:40 +0000329#ifdef FEAT_MENU
330 "+menu",
331#else
332 "-menu",
333#endif
334#ifdef FEAT_SESSION
335 "+mksession",
336#else
337 "-mksession",
338#endif
339#ifdef FEAT_MODIFY_FNAME
340 "+modify_fname",
341#else
342 "-modify_fname",
343#endif
344#ifdef FEAT_MOUSE
345 "+mouse",
346# ifdef FEAT_MOUSESHAPE
347 "+mouseshape",
348# else
349 "-mouseshape",
350# endif
351# else
352 "-mouse",
353#endif
Bram Moolenaar707cfb82012-10-21 04:00:07 +0200354
Bram Moolenaar071d4272004-06-13 20:20:40 +0000355#if defined(UNIX) || defined(VMS)
356# ifdef FEAT_MOUSE_DEC
357 "+mouse_dec",
358# else
359 "-mouse_dec",
360# endif
361# ifdef FEAT_MOUSE_GPM
362 "+mouse_gpm",
363# else
364 "-mouse_gpm",
365# endif
366# ifdef FEAT_MOUSE_JSB
367 "+mouse_jsbterm",
368# else
369 "-mouse_jsbterm",
370# endif
371# ifdef FEAT_MOUSE_NET
372 "+mouse_netterm",
373# else
374 "-mouse_netterm",
375# endif
Bram Moolenaar071d4272004-06-13 20:20:40 +0000376#endif
Bram Moolenaar707cfb82012-10-21 04:00:07 +0200377
Bram Moolenaar071d4272004-06-13 20:20:40 +0000378#ifdef __QNX__
379# ifdef FEAT_MOUSE_PTERM
380 "+mouse_pterm",
381# else
382 "-mouse_pterm",
383# endif
384#endif
Bram Moolenaar707cfb82012-10-21 04:00:07 +0200385
386#if defined(UNIX) || defined(VMS)
387# ifdef FEAT_MOUSE_SGR
388 "+mouse_sgr",
389# else
390 "-mouse_sgr",
391# endif
392# ifdef FEAT_SYSMOUSE
393 "+mouse_sysmouse",
394# else
395 "-mouse_sysmouse",
396# endif
397# ifdef FEAT_MOUSE_URXVT
398 "+mouse_urxvt",
399# else
400 "-mouse_urxvt",
401# endif
402# ifdef FEAT_MOUSE_XTERM
403 "+mouse_xterm",
404# else
405 "-mouse_xterm",
406# endif
407#endif
408
Bram Moolenaar071d4272004-06-13 20:20:40 +0000409#ifdef FEAT_MBYTE_IME
410# ifdef DYNAMIC_IME
411 "+multi_byte_ime/dyn",
412# else
413 "+multi_byte_ime",
414# endif
415#else
416# ifdef FEAT_MBYTE
417 "+multi_byte",
418# else
419 "-multi_byte",
420# endif
421#endif
422#ifdef FEAT_MULTI_LANG
423 "+multi_lang",
424#else
425 "-multi_lang",
426#endif
Bram Moolenaar325b7a22004-07-05 15:58:32 +0000427#ifdef FEAT_MZSCHEME
Bram Moolenaardf3267e2005-01-25 22:07:05 +0000428# ifdef DYNAMIC_MZSCHEME
429 "+mzscheme/dyn",
430# else
Bram Moolenaar325b7a22004-07-05 15:58:32 +0000431 "+mzscheme",
Bram Moolenaardf3267e2005-01-25 22:07:05 +0000432# endif
Bram Moolenaar325b7a22004-07-05 15:58:32 +0000433#else
434 "-mzscheme",
435#endif
Bram Moolenaar071d4272004-06-13 20:20:40 +0000436#ifdef FEAT_NETBEANS_INTG
437 "+netbeans_intg",
438#else
439 "-netbeans_intg",
440#endif
441#ifdef FEAT_GUI_W32
442# ifdef FEAT_OLE
443 "+ole",
444# else
445 "-ole",
446# endif
447#endif
Bram Moolenaar071d4272004-06-13 20:20:40 +0000448#ifdef FEAT_PATH_EXTRA
449 "+path_extra",
450#else
451 "-path_extra",
452#endif
453#ifdef FEAT_PERL
454# ifdef DYNAMIC_PERL
455 "+perl/dyn",
456# else
457 "+perl",
458# endif
459#else
460 "-perl",
461#endif
Bram Moolenaar55debbe2010-05-23 23:34:36 +0200462#ifdef FEAT_PERSISTENT_UNDO
463 "+persistent_undo",
464#else
465 "-persistent_undo",
466#endif
Bram Moolenaar071d4272004-06-13 20:20:40 +0000467#ifdef FEAT_PRINTER
468# ifdef FEAT_POSTSCRIPT
469 "+postscript",
470# else
471 "-postscript",
472# endif
473 "+printer",
474#else
475 "-printer",
476#endif
Bram Moolenaar05159a02005-02-26 23:04:13 +0000477#ifdef FEAT_PROFILE
478 "+profile",
479#else
480 "-profile",
481#endif
Bram Moolenaar071d4272004-06-13 20:20:40 +0000482#ifdef FEAT_PYTHON
483# ifdef DYNAMIC_PYTHON
484 "+python/dyn",
485# else
486 "+python",
487# endif
488#else
489 "-python",
490#endif
Bram Moolenaarbd5e15f2010-07-17 21:19:38 +0200491#ifdef FEAT_PYTHON3
492# ifdef DYNAMIC_PYTHON3
493 "+python3/dyn",
494# else
495 "+python3",
496# endif
497#else
498 "-python3",
499#endif
Bram Moolenaar071d4272004-06-13 20:20:40 +0000500#ifdef FEAT_QUICKFIX
501 "+quickfix",
502#else
503 "-quickfix",
504#endif
Bram Moolenaard68071d2006-05-02 22:08:30 +0000505#ifdef FEAT_RELTIME
506 "+reltime",
507#else
508 "-reltime",
509#endif
Bram Moolenaar071d4272004-06-13 20:20:40 +0000510#ifdef FEAT_RIGHTLEFT
511 "+rightleft",
512#else
513 "-rightleft",
514#endif
515#ifdef FEAT_RUBY
516# ifdef DYNAMIC_RUBY
517 "+ruby/dyn",
518# else
519 "+ruby",
520# endif
521#else
522 "-ruby",
523#endif
524#ifdef FEAT_SCROLLBIND
525 "+scrollbind",
526#else
527 "-scrollbind",
528#endif
529#ifdef FEAT_SIGNS
530 "+signs",
531#else
532 "-signs",
533#endif
534#ifdef FEAT_SMARTINDENT
535 "+smartindent",
536#else
537 "-smartindent",
538#endif
539#ifdef FEAT_SNIFF
540 "+sniff",
541#else
542 "-sniff",
543#endif
Bram Moolenaaref94eec2009-11-11 13:22:11 +0000544#ifdef STARTUPTIME
545 "+startuptime",
546#else
547 "-startuptime",
548#endif
Bram Moolenaar071d4272004-06-13 20:20:40 +0000549#ifdef FEAT_STL_OPT
550 "+statusline",
551#else
552 "-statusline",
553#endif
554#ifdef FEAT_SUN_WORKSHOP
555 "+sun_workshop",
556#else
557 "-sun_workshop",
558#endif
559#ifdef FEAT_SYN_HL
560 "+syntax",
561#else
562 "-syntax",
563#endif
564 /* only interesting on Unix systems */
565#if defined(USE_SYSTEM) && (defined(UNIX) || defined(__EMX__))
566 "+system()",
567#endif
568#ifdef FEAT_TAG_BINS
569 "+tag_binary",
570#else
571 "-tag_binary",
572#endif
573#ifdef FEAT_TAG_OLDSTATIC
574 "+tag_old_static",
575#else
576 "-tag_old_static",
577#endif
578#ifdef FEAT_TAG_ANYWHITE
579 "+tag_any_white",
580#else
581 "-tag_any_white",
582#endif
583#ifdef FEAT_TCL
584# ifdef DYNAMIC_TCL
585 "+tcl/dyn",
586# else
587 "+tcl",
588# endif
589#else
590 "-tcl",
591#endif
592#if defined(UNIX) || defined(__EMX__)
593/* only Unix (or OS/2 with EMX!) can have terminfo instead of termcap */
594# ifdef TERMINFO
595 "+terminfo",
596# else
597 "-terminfo",
598# endif
599#else /* unix always includes termcap support */
600# ifdef HAVE_TGETENT
601 "+tgetent",
602# else
603 "-tgetent",
604# endif
605#endif
606#ifdef FEAT_TERMRESPONSE
607 "+termresponse",
608#else
609 "-termresponse",
610#endif
611#ifdef FEAT_TEXTOBJ
612 "+textobjects",
613#else
614 "-textobjects",
615#endif
616#ifdef FEAT_TITLE
617 "+title",
618#else
619 "-title",
620#endif
621#ifdef FEAT_TOOLBAR
622 "+toolbar",
623#else
624 "-toolbar",
625#endif
626#ifdef FEAT_USR_CMDS
627 "+user_commands",
628#else
629 "-user_commands",
630#endif
631#ifdef FEAT_VERTSPLIT
632 "+vertsplit",
633#else
634 "-vertsplit",
635#endif
636#ifdef FEAT_VIRTUALEDIT
637 "+virtualedit",
638#else
639 "-virtualedit",
640#endif
641#ifdef FEAT_VISUAL
642 "+visual",
643# ifdef FEAT_VISUALEXTRA
644 "+visualextra",
645# else
646 "-visualextra",
647# endif
648#else
649 "-visual",
650#endif
651#ifdef FEAT_VIMINFO
652 "+viminfo",
653#else
654 "-viminfo",
655#endif
656#ifdef FEAT_VREPLACE
657 "+vreplace",
658#else
659 "-vreplace",
660#endif
661#ifdef FEAT_WILDIGN
662 "+wildignore",
663#else
664 "-wildignore",
665#endif
666#ifdef FEAT_WILDMENU
667 "+wildmenu",
668#else
669 "-wildmenu",
670#endif
671#ifdef FEAT_WINDOWS
672 "+windows",
673#else
674 "-windows",
675#endif
676#ifdef FEAT_WRITEBACKUP
677 "+writebackup",
678#else
679 "-writebackup",
680#endif
681#if defined(UNIX) || defined(VMS)
682# ifdef FEAT_X11
683 "+X11",
684# else
685 "-X11",
686# endif
687#endif
688#ifdef FEAT_XFONTSET
689 "+xfontset",
690#else
691 "-xfontset",
692#endif
693#ifdef FEAT_XIM
694 "+xim",
695#else
696 "-xim",
697#endif
698#if defined(UNIX) || defined(VMS)
699# ifdef USE_XSMP_INTERACT
700 "+xsmp_interact",
701# else
702# ifdef USE_XSMP
703 "+xsmp",
704# else
705 "-xsmp",
706# endif
707# endif
708# ifdef FEAT_XCLIPBOARD
709 "+xterm_clipboard",
710# else
711 "-xterm_clipboard",
712# endif
713#endif
714#ifdef FEAT_XTERM_SAVE
715 "+xterm_save",
716#else
717 "-xterm_save",
718#endif
719#ifdef WIN3264
720# ifdef FEAT_XPM_W32
721 "+xpm_w32",
722# else
723 "-xpm_w32",
724# endif
725#endif
726 NULL
727};
728
729static int included_patches[] =
730{ /* Add new patch number below this line */
731/**/
Bram Moolenaarb69510e2013-07-09 17:08:29 +0200732 7,
733/**/
Bram Moolenaar4ca8d5f2013-07-09 14:58:10 +0200734 6,
735/**/
Bram Moolenaar04c5c9e2013-07-09 13:44:59 +0200736 5,
737/**/
Bram Moolenaarc64b85a2013-07-09 13:15:46 +0200738 4,
739/**/
Bram Moolenaarf4c096b2013-07-09 12:54:21 +0200740 3,
741/**/
Bram Moolenaare8785f22013-07-07 16:15:35 +0200742 2,
743/**/
Bram Moolenaar7b8c2682013-07-06 16:23:02 +0200744 1,
745/**/
Bram Moolenaar071d4272004-06-13 20:20:40 +0000746 0
747};
748
Bram Moolenaar10d4cec2008-11-30 11:15:09 +0000749/*
750 * Place to put a short description when adding a feature with a patch.
751 * Keep it short, e.g.,: "relative numbers", "persistent undo".
752 * Also add a comment marker to separate the lines.
753 * See the official Vim patches for the diff format: It must use a context of
Bram Moolenaarcbb8eb32008-12-24 13:25:14 +0000754 * one line only. Create it by hand or use "diff -C2" and edit the patch.
Bram Moolenaar10d4cec2008-11-30 11:15:09 +0000755 */
756static char *(extra_patches[]) =
757{ /* Add your patch description below this line */
758/**/
759 NULL
760};
761
Bram Moolenaar071d4272004-06-13 20:20:40 +0000762 int
763highest_patch()
764{
765 int i;
766 int h = 0;
767
768 for (i = 0; included_patches[i] != 0; ++i)
769 if (included_patches[i] > h)
770 h = included_patches[i];
771 return h;
772}
773
774#if defined(FEAT_EVAL) || defined(PROTO)
775/*
776 * Return TRUE if patch "n" has been included.
777 */
778 int
779has_patch(n)
780 int n;
781{
782 int i;
783
784 for (i = 0; included_patches[i] != 0; ++i)
785 if (included_patches[i] == n)
786 return TRUE;
787 return FALSE;
788}
789#endif
790
791 void
792ex_version(eap)
793 exarg_T *eap;
794{
795 /*
796 * Ignore a ":version 9.99" command.
797 */
798 if (*eap->arg == NUL)
799 {
800 msg_putchar('\n');
801 list_version();
802 }
803}
804
Bram Moolenaar445f3032013-02-20 16:47:36 +0100805/*
806 * List all features aligned in columns, dictionary style.
807 */
808 static void
809list_features()
810{
811 int i;
812 int ncol;
813 int nrow;
814 int nfeat = 0;
815 int width = 0;
816
817 /* Find the length of the longest feature name, use that + 1 as the column
818 * width */
819 for (i = 0; features[i] != NULL; ++i)
820 {
Bram Moolenaar5c962632013-02-26 11:25:33 +0100821 int l = (int)STRLEN(features[i]);
Bram Moolenaar445f3032013-02-20 16:47:36 +0100822
823 if (l > width)
824 width = l;
825 ++nfeat;
826 }
827 width += 1;
828
829 if (Columns < width)
830 {
831 /* Not enough screen columns - show one per line */
832 for (i = 0; features[i] != NULL; ++i)
833 {
834 version_msg(features[i]);
835 if (msg_col > 0)
836 msg_putchar('\n');
837 }
838 return;
839 }
840
Bram Moolenaar445f3032013-02-20 16:47:36 +0100841 /* The rightmost column doesn't need a separator.
842 * Sacrifice it to fit in one more column if possible. */
Bram Moolenaarf13f45d2013-02-26 15:27:23 +0100843 ncol = (int) (Columns + 1) / width;
Bram Moolenaar445f3032013-02-20 16:47:36 +0100844 nrow = nfeat / ncol + (nfeat % ncol ? 1 : 0);
845
Bram Moolenaarf13f45d2013-02-26 15:27:23 +0100846 /* i counts columns then rows. idx counts rows then columns. */
Bram Moolenaar445f3032013-02-20 16:47:36 +0100847 for (i = 0; !got_int && i < nrow * ncol; ++i)
848 {
849 int idx = (i / ncol) + (i % ncol) * nrow;
850
851 if (idx < nfeat)
852 {
853 int last_col = (i + 1) % ncol == 0;
854
855 msg_puts((char_u *)features[idx]);
856 if (last_col)
857 {
858 if (msg_col > 0)
859 msg_putchar('\n');
860 }
861 else
862 {
863 while (msg_col % width)
864 msg_putchar(' ');
865 }
866 }
867 else
Bram Moolenaarf13f45d2013-02-26 15:27:23 +0100868 {
869 if (msg_col > 0)
870 msg_putchar('\n');
871 }
Bram Moolenaar445f3032013-02-20 16:47:36 +0100872 }
873}
Bram Moolenaar5c962632013-02-26 11:25:33 +0100874
Bram Moolenaar071d4272004-06-13 20:20:40 +0000875 void
876list_version()
877{
878 int i;
879 int first;
880 char *s = "";
881
882 /*
883 * When adding features here, don't forget to update the list of
884 * internal variables in eval.c!
885 */
886 MSG(longVersion);
887#ifdef WIN3264
888# ifdef FEAT_GUI_W32
889# if defined(_MSC_VER) && (_MSC_VER <= 1010)
890 /* Only MS VC 4.1 and earlier can do Win32s */
Bram Moolenaare7cb9cf2008-06-20 14:32:41 +0000891 MSG_PUTS(_("\nMS-Windows 16/32-bit GUI version"));
Bram Moolenaar071d4272004-06-13 20:20:40 +0000892# else
Bram Moolenaard9b87332006-10-03 14:30:41 +0000893# ifdef _WIN64
Bram Moolenaare7cb9cf2008-06-20 14:32:41 +0000894 MSG_PUTS(_("\nMS-Windows 64-bit GUI version"));
Bram Moolenaard9b87332006-10-03 14:30:41 +0000895# else
Bram Moolenaare7cb9cf2008-06-20 14:32:41 +0000896 MSG_PUTS(_("\nMS-Windows 32-bit GUI version"));
Bram Moolenaard9b87332006-10-03 14:30:41 +0000897# endif
Bram Moolenaar071d4272004-06-13 20:20:40 +0000898# endif
899 if (gui_is_win32s())
900 MSG_PUTS(_(" in Win32s mode"));
901# ifdef FEAT_OLE
902 MSG_PUTS(_(" with OLE support"));
903# endif
904# else
Bram Moolenaare7cb9cf2008-06-20 14:32:41 +0000905# ifdef _WIN64
906 MSG_PUTS(_("\nMS-Windows 64-bit console version"));
907# else
908 MSG_PUTS(_("\nMS-Windows 32-bit console version"));
909# endif
Bram Moolenaar071d4272004-06-13 20:20:40 +0000910# endif
911#endif
912#ifdef WIN16
Bram Moolenaare7cb9cf2008-06-20 14:32:41 +0000913 MSG_PUTS(_("\nMS-Windows 16-bit version"));
Bram Moolenaar071d4272004-06-13 20:20:40 +0000914#endif
915#ifdef MSDOS
916# ifdef DJGPP
Bram Moolenaare7cb9cf2008-06-20 14:32:41 +0000917 MSG_PUTS(_("\n32-bit MS-DOS version"));
Bram Moolenaar071d4272004-06-13 20:20:40 +0000918# else
Bram Moolenaare7cb9cf2008-06-20 14:32:41 +0000919 MSG_PUTS(_("\n16-bit MS-DOS version"));
Bram Moolenaar071d4272004-06-13 20:20:40 +0000920# endif
921#endif
922#ifdef MACOS
923# ifdef MACOS_X
924# ifdef MACOS_X_UNIX
925 MSG_PUTS(_("\nMacOS X (unix) version"));
926# else
927 MSG_PUTS(_("\nMacOS X version"));
928# endif
929#else
930 MSG_PUTS(_("\nMacOS version"));
931# endif
932#endif
933
Bram Moolenaar071d4272004-06-13 20:20:40 +0000934#ifdef VMS
Bram Moolenaar6949d1d2008-08-25 02:14:05 +0000935 MSG_PUTS(_("\nOpenVMS version"));
Bram Moolenaar3d20ca12006-11-28 16:43:58 +0000936# ifdef HAVE_PATHDEF
937 if (*compiled_arch != NUL)
938 {
939 MSG_PUTS(" - ");
940 MSG_PUTS(compiled_arch);
941 }
942# endif
943
Bram Moolenaar071d4272004-06-13 20:20:40 +0000944#endif
945
946 /* Print the list of patch numbers if there is at least one. */
947 /* Print a range when patches are consecutive: "1-10, 12, 15-40, 42-45" */
948 if (included_patches[0] != 0)
949 {
950 MSG_PUTS(_("\nIncluded patches: "));
951 first = -1;
952 /* find last one */
953 for (i = 0; included_patches[i] != 0; ++i)
954 ;
955 while (--i >= 0)
956 {
957 if (first < 0)
958 first = included_patches[i];
959 if (i == 0 || included_patches[i - 1] != included_patches[i] + 1)
960 {
961 MSG_PUTS(s);
962 s = ", ";
963 msg_outnum((long)first);
964 if (first != included_patches[i])
965 {
966 MSG_PUTS("-");
967 msg_outnum((long)included_patches[i]);
968 }
969 first = -1;
970 }
971 }
972 }
973
Bram Moolenaar10d4cec2008-11-30 11:15:09 +0000974 /* Print the list of extra patch descriptions if there is at least one. */
975 if (extra_patches[0] != NULL)
976 {
977 MSG_PUTS(_("\nExtra patches: "));
978 s = "";
979 for (i = 0; extra_patches[i] != NULL; ++i)
980 {
981 MSG_PUTS(s);
982 s = ", ";
983 MSG_PUTS(extra_patches[i]);
984 }
985 }
986
Bram Moolenaar071d4272004-06-13 20:20:40 +0000987#ifdef MODIFIED_BY
988 MSG_PUTS("\n");
989 MSG_PUTS(_("Modified by "));
990 MSG_PUTS(MODIFIED_BY);
991#endif
992
993#ifdef HAVE_PATHDEF
994 if (*compiled_user != NUL || *compiled_sys != NUL)
995 {
996 MSG_PUTS(_("\nCompiled "));
997 if (*compiled_user != NUL)
998 {
999 MSG_PUTS(_("by "));
1000 MSG_PUTS(compiled_user);
1001 }
1002 if (*compiled_sys != NUL)
1003 {
1004 MSG_PUTS("@");
1005 MSG_PUTS(compiled_sys);
1006 }
1007 }
1008#endif
1009
1010#ifdef FEAT_HUGE
1011 MSG_PUTS(_("\nHuge version "));
1012#else
1013# ifdef FEAT_BIG
1014 MSG_PUTS(_("\nBig version "));
1015# else
1016# ifdef FEAT_NORMAL
1017 MSG_PUTS(_("\nNormal version "));
1018# else
1019# ifdef FEAT_SMALL
1020 MSG_PUTS(_("\nSmall version "));
1021# else
1022 MSG_PUTS(_("\nTiny version "));
1023# endif
1024# endif
1025# endif
1026#endif
1027#ifndef FEAT_GUI
1028 MSG_PUTS(_("without GUI."));
1029#else
1030# ifdef FEAT_GUI_GTK
1031# ifdef FEAT_GUI_GNOME
Bram Moolenaar071d4272004-06-13 20:20:40 +00001032 MSG_PUTS(_("with GTK2-GNOME GUI."));
Bram Moolenaar071d4272004-06-13 20:20:40 +00001033# else
Bram Moolenaar071d4272004-06-13 20:20:40 +00001034 MSG_PUTS(_("with GTK2 GUI."));
Bram Moolenaar071d4272004-06-13 20:20:40 +00001035# endif
1036# else
1037# ifdef FEAT_GUI_MOTIF
1038 MSG_PUTS(_("with X11-Motif GUI."));
1039# else
1040# ifdef FEAT_GUI_ATHENA
1041# ifdef FEAT_GUI_NEXTAW
1042 MSG_PUTS(_("with X11-neXtaw GUI."));
1043# else
1044 MSG_PUTS(_("with X11-Athena GUI."));
1045# endif
1046# else
Bram Moolenaar071d4272004-06-13 20:20:40 +00001047# ifdef FEAT_GUI_PHOTON
1048 MSG_PUTS(_("with Photon GUI."));
1049# else
1050# if defined(MSWIN)
1051 MSG_PUTS(_("with GUI."));
1052# else
Bram Moolenaar860cae12010-06-05 23:22:07 +02001053# if defined(TARGET_API_MAC_CARBON) && TARGET_API_MAC_CARBON
Bram Moolenaar071d4272004-06-13 20:20:40 +00001054 MSG_PUTS(_("with Carbon GUI."));
1055# else
Bram Moolenaar860cae12010-06-05 23:22:07 +02001056# if defined(TARGET_API_MAC_OSX) && TARGET_API_MAC_OSX
Bram Moolenaar071d4272004-06-13 20:20:40 +00001057 MSG_PUTS(_("with Cocoa GUI."));
1058# else
Bram Moolenaar860cae12010-06-05 23:22:07 +02001059# if defined(MACOS)
Bram Moolenaar071d4272004-06-13 20:20:40 +00001060 MSG_PUTS(_("with (classic) GUI."));
Bram Moolenaar071d4272004-06-13 20:20:40 +00001061# endif
1062# endif
1063# endif
1064# endif
Bram Moolenaar071d4272004-06-13 20:20:40 +00001065# endif
1066# endif
1067# endif
1068# endif
1069#endif
1070 version_msg(_(" Features included (+) or not (-):\n"));
1071
Bram Moolenaar445f3032013-02-20 16:47:36 +01001072 list_features();
Bram Moolenaar071d4272004-06-13 20:20:40 +00001073
Bram Moolenaar071d4272004-06-13 20:20:40 +00001074#ifdef SYS_VIMRC_FILE
1075 version_msg(_(" system vimrc file: \""));
1076 version_msg(SYS_VIMRC_FILE);
1077 version_msg("\"\n");
1078#endif
1079#ifdef USR_VIMRC_FILE
1080 version_msg(_(" user vimrc file: \""));
1081 version_msg(USR_VIMRC_FILE);
1082 version_msg("\"\n");
1083#endif
1084#ifdef USR_VIMRC_FILE2
1085 version_msg(_(" 2nd user vimrc file: \""));
1086 version_msg(USR_VIMRC_FILE2);
1087 version_msg("\"\n");
1088#endif
1089#ifdef USR_VIMRC_FILE3
1090 version_msg(_(" 3rd user vimrc file: \""));
1091 version_msg(USR_VIMRC_FILE3);
1092 version_msg("\"\n");
1093#endif
1094#ifdef USR_EXRC_FILE
1095 version_msg(_(" user exrc file: \""));
1096 version_msg(USR_EXRC_FILE);
1097 version_msg("\"\n");
1098#endif
1099#ifdef USR_EXRC_FILE2
1100 version_msg(_(" 2nd user exrc file: \""));
1101 version_msg(USR_EXRC_FILE2);
1102 version_msg("\"\n");
1103#endif
1104#ifdef FEAT_GUI
1105# ifdef SYS_GVIMRC_FILE
1106 version_msg(_(" system gvimrc file: \""));
1107 version_msg(SYS_GVIMRC_FILE);
1108 version_msg("\"\n");
1109# endif
1110 version_msg(_(" user gvimrc file: \""));
1111 version_msg(USR_GVIMRC_FILE);
1112 version_msg("\"\n");
1113# ifdef USR_GVIMRC_FILE2
1114 version_msg(_("2nd user gvimrc file: \""));
1115 version_msg(USR_GVIMRC_FILE2);
1116 version_msg("\"\n");
1117# endif
1118# ifdef USR_GVIMRC_FILE3
1119 version_msg(_("3rd user gvimrc file: \""));
1120 version_msg(USR_GVIMRC_FILE3);
1121 version_msg("\"\n");
1122# endif
1123#endif
1124#ifdef FEAT_GUI
1125# ifdef SYS_MENU_FILE
1126 version_msg(_(" system menu file: \""));
1127 version_msg(SYS_MENU_FILE);
1128 version_msg("\"\n");
1129# endif
1130#endif
1131#ifdef HAVE_PATHDEF
1132 if (*default_vim_dir != NUL)
1133 {
1134 version_msg(_(" fall-back for $VIM: \""));
1135 version_msg((char *)default_vim_dir);
1136 version_msg("\"\n");
1137 }
1138 if (*default_vimruntime_dir != NUL)
1139 {
1140 version_msg(_(" f-b for $VIMRUNTIME: \""));
1141 version_msg((char *)default_vimruntime_dir);
1142 version_msg("\"\n");
1143 }
1144 version_msg(_("Compilation: "));
1145 version_msg((char *)all_cflags);
1146 version_msg("\n");
1147#ifdef VMS
1148 if (*compiler_version != NUL)
1149 {
1150 version_msg(_("Compiler: "));
1151 version_msg((char *)compiler_version);
1152 version_msg("\n");
1153 }
1154#endif
1155 version_msg(_("Linking: "));
1156 version_msg((char *)all_lflags);
1157#endif
1158#ifdef DEBUG
1159 version_msg("\n");
1160 version_msg(_(" DEBUG BUILD"));
1161#endif
1162}
1163
1164/*
1165 * Output a string for the version message. If it's going to wrap, output a
1166 * newline, unless the message is too long to fit on the screen anyway.
1167 */
1168 static void
1169version_msg(s)
1170 char *s;
1171{
1172 int len = (int)STRLEN(s);
1173
1174 if (!got_int && len < (int)Columns && msg_col + len >= (int)Columns
1175 && *s != '\n')
1176 msg_putchar('\n');
1177 if (!got_int)
1178 MSG_PUTS(s);
1179}
1180
1181static void do_intro_line __ARGS((int row, char_u *mesg, int add_version, int attr));
1182
1183/*
Bram Moolenaar249f0dd2013-07-04 22:31:03 +02001184 * Show the intro message when not editing a file.
1185 */
1186 void
1187maybe_intro_message()
1188{
1189 if (bufempty()
1190 && curbuf->b_fname == NULL
1191#ifdef FEAT_WINDOWS
1192 && firstwin->w_next == NULL
1193#endif
1194 && vim_strchr(p_shm, SHM_INTRO) == NULL)
1195 intro_message(FALSE);
1196}
1197
1198/*
Bram Moolenaar071d4272004-06-13 20:20:40 +00001199 * Give an introductory message about Vim.
1200 * Only used when starting Vim on an empty file, without a file name.
1201 * Or with the ":intro" command (for Sven :-).
1202 */
1203 void
1204intro_message(colon)
1205 int colon; /* TRUE for ":intro" */
1206{
1207 int i;
1208 int row;
1209 int blanklines;
1210 int sponsor;
1211 char *p;
1212 static char *(lines[]) =
1213 {
1214 N_("VIM - Vi IMproved"),
1215 "",
1216 N_("version "),
1217 N_("by Bram Moolenaar et al."),
1218#ifdef MODIFIED_BY
1219 " ",
1220#endif
1221 N_("Vim is open source and freely distributable"),
1222 "",
1223 N_("Help poor children in Uganda!"),
1224 N_("type :help iccf<Enter> for information "),
1225 "",
1226 N_("type :q<Enter> to exit "),
1227 N_("type :help<Enter> or <F1> for on-line help"),
Bram Moolenaar3fdfa4a2004-10-07 21:02:47 +00001228 N_("type :help version7<Enter> for version info"),
Bram Moolenaar071d4272004-06-13 20:20:40 +00001229 NULL,
1230 "",
1231 N_("Running in Vi compatible mode"),
1232 N_("type :set nocp<Enter> for Vim defaults"),
1233 N_("type :help cp-default<Enter> for info on this"),
1234 };
1235#ifdef FEAT_GUI
1236 static char *(gui_lines[]) =
1237 {
1238 NULL,
1239 NULL,
1240 NULL,
1241 NULL,
1242#ifdef MODIFIED_BY
1243 NULL,
1244#endif
1245 NULL,
1246 NULL,
1247 NULL,
1248 N_("menu Help->Orphans for information "),
1249 NULL,
1250 N_("Running modeless, typed text is inserted"),
1251 N_("menu Edit->Global Settings->Toggle Insert Mode "),
1252 N_(" for two modes "),
1253 NULL,
1254 NULL,
1255 NULL,
1256 N_("menu Edit->Global Settings->Toggle Vi Compatible"),
1257 N_(" for Vim defaults "),
1258 };
1259#endif
1260
1261 /* blanklines = screen height - # message lines */
1262 blanklines = (int)Rows - ((sizeof(lines) / sizeof(char *)) - 1);
1263 if (!p_cp)
1264 blanklines += 4; /* add 4 for not showing "Vi compatible" message */
1265#if defined(WIN3264) && !defined(FEAT_GUI_W32)
1266 if (mch_windows95())
1267 blanklines -= 3; /* subtract 3 for showing "Windows 95" message */
1268#endif
1269
1270#ifdef FEAT_WINDOWS
1271 /* Don't overwrite a statusline. Depends on 'cmdheight'. */
1272 if (p_ls > 1)
1273 blanklines -= Rows - topframe->fr_height;
1274#endif
1275 if (blanklines < 0)
1276 blanklines = 0;
1277
1278 /* Show the sponsor and register message one out of four times, the Uganda
1279 * message two out of four times. */
Bram Moolenaarf4cd3e82005-12-22 22:47:02 +00001280 sponsor = (int)time(NULL);
Bram Moolenaar071d4272004-06-13 20:20:40 +00001281 sponsor = ((sponsor & 2) == 0) - ((sponsor & 4) == 0);
1282
1283 /* start displaying the message lines after half of the blank lines */
1284 row = blanklines / 2;
1285 if ((row >= 2 && Columns >= 50) || colon)
1286 {
1287 for (i = 0; i < (int)(sizeof(lines) / sizeof(char *)); ++i)
1288 {
1289 p = lines[i];
1290#ifdef FEAT_GUI
1291 if (p_im && gui.in_use && gui_lines[i] != NULL)
1292 p = gui_lines[i];
1293#endif
1294 if (p == NULL)
1295 {
1296 if (!p_cp)
1297 break;
1298 continue;
1299 }
1300 if (sponsor != 0)
1301 {
1302 if (strstr(p, "children") != NULL)
1303 p = sponsor < 0
1304 ? N_("Sponsor Vim development!")
1305 : N_("Become a registered Vim user!");
1306 else if (strstr(p, "iccf") != NULL)
1307 p = sponsor < 0
1308 ? N_("type :help sponsor<Enter> for information ")
1309 : N_("type :help register<Enter> for information ");
1310 else if (strstr(p, "Orphans") != NULL)
1311 p = N_("menu Help->Sponsor/Register for information ");
1312 }
1313 if (*p != NUL)
1314 do_intro_line(row, (char_u *)_(p), i == 2, 0);
1315 ++row;
1316 }
1317#if defined(WIN3264) && !defined(FEAT_GUI_W32)
1318 if (mch_windows95())
1319 {
1320 do_intro_line(++row,
1321 (char_u *)_("WARNING: Windows 95/98/ME detected"),
1322 FALSE, hl_attr(HLF_E));
1323 do_intro_line(++row,
1324 (char_u *)_("type :help windows95<Enter> for info on this"),
1325 FALSE, 0);
1326 }
1327#endif
1328 }
1329
1330 /* Make the wait-return message appear just below the text. */
1331 if (colon)
1332 msg_row = row;
1333}
1334
1335 static void
1336do_intro_line(row, mesg, add_version, attr)
1337 int row;
1338 char_u *mesg;
1339 int add_version;
1340 int attr;
1341{
1342 char_u vers[20];
1343 int col;
1344 char_u *p;
1345 int l;
1346 int clen;
1347#ifdef MODIFIED_BY
1348# define MODBY_LEN 150
1349 char_u modby[MODBY_LEN];
1350
1351 if (*mesg == ' ')
1352 {
Bram Moolenaar589e43a2008-01-05 12:59:22 +00001353 vim_strncpy(modby, (char_u *)_("Modified by "), MODBY_LEN - 1);
Bram Moolenaar071d4272004-06-13 20:20:40 +00001354 l = STRLEN(modby);
Bram Moolenaar589e43a2008-01-05 12:59:22 +00001355 vim_strncpy(modby + l, (char_u *)MODIFIED_BY, MODBY_LEN - l - 1);
Bram Moolenaar071d4272004-06-13 20:20:40 +00001356 mesg = modby;
1357 }
1358#endif
1359
1360 /* Center the message horizontally. */
1361 col = vim_strsize(mesg);
1362 if (add_version)
1363 {
1364 STRCPY(vers, mediumVersion);
1365 if (highest_patch())
1366 {
1367 /* Check for 9.9x or 9.9xx, alpha/beta version */
Bram Moolenaar22df3f92010-10-27 16:01:27 +02001368 if (isalpha((int)vers[3]))
Bram Moolenaar071d4272004-06-13 20:20:40 +00001369 {
Bram Moolenaar552ac132012-03-07 18:03:10 +01001370 int len = (isalpha((int)vers[4])) ? 5 : 4;
1371 sprintf((char *)vers + len, ".%d%s", highest_patch(),
1372 mediumVersion + len);
Bram Moolenaar071d4272004-06-13 20:20:40 +00001373 }
1374 else
1375 sprintf((char *)vers + 3, ".%d", highest_patch());
1376 }
1377 col += (int)STRLEN(vers);
1378 }
1379 col = (Columns - col) / 2;
1380 if (col < 0)
1381 col = 0;
1382
1383 /* Split up in parts to highlight <> items differently. */
1384 for (p = mesg; *p != NUL; p += l)
1385 {
1386 clen = 0;
1387 for (l = 0; p[l] != NUL
1388 && (l == 0 || (p[l] != '<' && p[l - 1] != '>')); ++l)
1389 {
1390#ifdef FEAT_MBYTE
1391 if (has_mbyte)
1392 {
1393 clen += ptr2cells(p + l);
Bram Moolenaar0fa313a2005-08-10 21:07:57 +00001394 l += (*mb_ptr2len)(p + l) - 1;
Bram Moolenaar071d4272004-06-13 20:20:40 +00001395 }
1396 else
1397#endif
1398 clen += byte2cells(p[l]);
1399 }
1400 screen_puts_len(p, l, row, col, *p == '<' ? hl_attr(HLF_8) : attr);
1401 col += clen;
1402 }
1403
1404 /* Add the version number to the version line. */
1405 if (add_version)
1406 screen_puts(vers, row, col, 0);
1407}
1408
1409/*
1410 * ":intro": clear screen, display intro screen and wait for return.
1411 */
Bram Moolenaar071d4272004-06-13 20:20:40 +00001412 void
1413ex_intro(eap)
Bram Moolenaar0c094b92009-05-14 20:20:33 +00001414 exarg_T *eap UNUSED;
Bram Moolenaar071d4272004-06-13 20:20:40 +00001415{
1416 screenclear();
1417 intro_message(TRUE);
1418 wait_return(TRUE);
1419}