-
Notifications
You must be signed in to change notification settings - Fork 2
/
0001-Add-patch-for-stateless.patch
67 lines (61 loc) · 2 KB
/
0001-Add-patch-for-stateless.patch
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
60
61
62
63
64
65
66
67
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Patrick McCarty <[email protected]>
Date: Tue, 17 Feb 2015 11:30:33 -0800
Subject: [PATCH] Add patch for stateless
If present, the vimrc in /etc will override the one in /usr/share/vim.
This patch does not add stateless gvimrc file support, but the changes
would be very similar (see src/gui.c).
Signed-off-by: Patrick McCarty <[email protected]>
---
src/feature.h | 4 +++-
src/main.c | 7 ++++++-
src/os_unix.h | 3 +++
3 files changed, 12 insertions(+), 2 deletions(-)
diff --git a/src/feature.h b/src/feature.h
index 4c0758d..e24bf9d 100644
--- a/src/feature.h
+++ b/src/feature.h
@@ -813,8 +813,10 @@
/*
* SYS_VIMRC_FILE Name of the system-wide .vimrc file.
+ * SYS_VIMRC_FILE2 Name of the .vimrc file to override SYS_VIMRC_FILE.
*/
-// #define SYS_VIMRC_FILE "/etc/vimrc"
+// #define SYS_VIMRC_FILE "$VIM/vimrc"
+// #define SYS_VIMRC_FILE2 "/etc/vimrc"
/*
* SYS_GVIMRC_FILE Name of the system-wide .gvimrc file.
diff --git a/src/main.c b/src/main.c
index 2ec5c26..947cbe5 100644
--- a/src/main.c
+++ b/src/main.c
@@ -3208,9 +3208,14 @@ source_startup_scripts(mparm_T *parmp)
/*
* Get system wide defaults, if the file name is defined.
*/
+#ifdef SYS_VIMRC_FILE2
+ if (do_source((char_u *)SYS_VIMRC_FILE2, FALSE, DOSO_NONE, NULL) == FAIL)
+#endif
+ {
#ifdef SYS_VIMRC_FILE
- (void)do_source((char_u *)SYS_VIMRC_FILE, FALSE, DOSO_NONE, NULL);
+ (void)do_source((char_u *)SYS_VIMRC_FILE, FALSE, DOSO_NONE, NULL);
#endif
+ }
#ifdef MACOS_X
(void)do_source((char_u *)"$VIMRUNTIME/macmap.vim", FALSE,
DOSO_NONE, NULL);
diff --git a/src/os_unix.h b/src/os_unix.h
index 618c0e9..8261d5e 100644
--- a/src/os_unix.h
+++ b/src/os_unix.h
@@ -216,6 +216,9 @@ typedef struct dsc$descriptor DESC;
#ifndef SYS_VIMRC_FILE
# define SYS_VIMRC_FILE "$VIM/vimrc"
#endif
+#ifndef SYS_VIMRC_FILE2
+# define SYS_VIMRC_FILE2 "/etc/vimrc"
+#endif
#ifndef SYS_GVIMRC_FILE
# define SYS_GVIMRC_FILE "$VIM/gvimrc"
#endif