summaryrefslogtreecommitdiff
path: root/vim/patches/vim-tiny.patch
blob: 28925980743f72ca40969dc7eadc2cdb2c29f199 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
Subject: Support sourcing a vimrc.tiny when Vim is invoked as vi
 This is used only in the vim-tiny package to allow a specific
 configuration for vim-tiny's vi.  The vim-tiny package is substantially
 different from the other Vim packages, so it did not make sense to
 share the same config.
Forwarded: not-needed
Author: Stefano Zacchiroli <zack@debian.org>
Author: James Vega <jamessan@debian.org>
Bug-Debian: http://bugs.debian.org/222138

--- a/src/main.c
+++ b/src/main.c
@@ -83,6 +83,9 @@
 #ifdef FEAT_DIFF
     int		diff_mode;		/* start with 'diff' set */
 #endif
+#ifdef SYS_TINYRC_FILE
+    int		vi_mode;		/* started as "vi" */
+#endif
 } mparm_T;
 
 /* Values for edit_type. */
@@ -1606,6 +1609,10 @@
     }
     else if (STRNICMP(initstr, "vim", 3) == 0)
 	initstr += 3;
+#ifdef SYS_TINYRC_FILE
+    else if (STRNICMP(initstr, "vi", 2) == 0)
+	parmp->vi_mode = TRUE;
+#endif
 
     /* Catch "[r][g]vimdiff" and "[r][g]viewdiff". */
     if (STRICMP(initstr, "diff") == 0)
@@ -2916,7 +2923,12 @@
 	 * Get system wide defaults, if the file name is defined.
 	 */
 #ifdef SYS_VIMRC_FILE
-	(void)do_source((char_u *)SYS_VIMRC_FILE, FALSE, DOSO_NONE);
+# if defined(SYS_TINYRC_FILE) && defined(TINY_VIMRC)
+	if (parmp->vi_mode)
+	    (void)do_source((char_u *)SYS_TINYRC_FILE, FALSE, DOSO_NONE);
+	else
+# endif
+	    (void)do_source((char_u *)SYS_VIMRC_FILE, FALSE, DOSO_NONE);
 #endif
 #ifdef MACOS_X
 	(void)do_source((char_u *)"$VIMRUNTIME/macmap.vim", FALSE, DOSO_NONE);
--- a/src/os_unix.h
+++ b/src/os_unix.h
@@ -233,6 +233,9 @@
 /*
  * Unix system-dependent file names
  */
+#ifndef SYS_TINYRC_FILE
+# define SYS_TINYRC_FILE "$VIM/vimrc.tiny"
+#endif
 #ifndef SYS_VIMRC_FILE
 # define SYS_VIMRC_FILE "$VIM/vimrc"
 #endif