summaryrefslogtreecommitdiffstats
path: root/debian/patches/debian/Support-sourcing-a-vimrc.tiny-when-Vim-is-invoked-as-vi.patch
diff options
context:
space:
mode:
Diffstat (limited to 'debian/patches/debian/Support-sourcing-a-vimrc.tiny-when-Vim-is-invoked-as-vi.patch')
-rw-r--r--debian/patches/debian/Support-sourcing-a-vimrc.tiny-when-Vim-is-invoked-as-vi.patch101
1 files changed, 101 insertions, 0 deletions
diff --git a/debian/patches/debian/Support-sourcing-a-vimrc.tiny-when-Vim-is-invoked-as-vi.patch b/debian/patches/debian/Support-sourcing-a-vimrc.tiny-when-Vim-is-invoked-as-vi.patch
new file mode 100644
index 0000000..74c2f85
--- /dev/null
+++ b/debian/patches/debian/Support-sourcing-a-vimrc.tiny-when-Vim-is-invoked-as-vi.patch
@@ -0,0 +1,101 @@
+From: James McCoy <jamessan@debian.org>
+Date: Tue, 6 Oct 2015 23:46:30 -0400
+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 other Vim packages, so it does not make sense to
+share the same config.
+
+Closes: #222138
+Signed-off-by: Stefano Zacchiroli <zack@debian.org>
+Signed-off-by: James Vega <jamessan@debian.org>
+---
+ src/main.c | 23 ++++++++++++++++++++++-
+ src/os_unix.h | 3 +++
+ src/structs.h | 3 +++
+ 3 files changed, 28 insertions(+), 1 deletion(-)
+
+diff --git a/src/main.c b/src/main.c
+index d1c42ed..c3e6bda 100644
+--- a/src/main.c
++++ b/src/main.c
+@@ -1929,6 +1929,10 @@ parse_command_name(mparm_T *parmp)
+ }
+ 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)
+@@ -3224,7 +3228,12 @@ source_startup_scripts(mparm_T *parmp)
+ * 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, NULL);
++# if defined(SYS_TINYRC_FILE) && defined(TINY_VIMRC)
++ if (parmp->vi_mode)
++ (void)do_source((char_u *)SYS_TINYRC_FILE, FALSE, DOSO_NONE, NULL);
++ else
++# endif
++ (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,
+@@ -3263,13 +3272,25 @@ source_startup_scripts(mparm_T *parmp)
+ #ifdef USR_EXRC_FILE2
+ && do_source((char_u *)USR_EXRC_FILE2, FALSE,
+ DOSO_NONE, NULL) == FAIL
++#endif
++#if defined(SYS_TINYRC_FILE) && defined(TINY_VIMRC)
++ && !parmp->vi_mode
+ #endif
+ && !has_dash_c_arg)
+ {
+ // When no .vimrc file was found: source defaults.vim.
+ if (do_source((char_u *)VIM_DEFAULTS_FILE, FALSE, DOSO_NONE,
+ NULL) == FAIL)
++ {
++ /*
++ * If running as the vim.tiny executable, regardless how what argv[0] is, we
++ * don't want to error due to missing defaults.vim. That's provided by
++ * vim-runtime, which isn't typically installed with vim-tiny.
++ */
++#ifndef TINY_VIMRC
+ emsg(e_failed_to_source_defaults);
++#endif
++ }
+ }
+ }
+
+diff --git a/src/os_unix.h b/src/os_unix.h
+index d87ec90..3f5ce0f 100644
+--- a/src/os_unix.h
++++ b/src/os_unix.h
+@@ -205,6 +205,9 @@ typedef struct dsc$descriptor DESC;
+ /*
+ * 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
+diff --git a/src/structs.h b/src/structs.h
+index 46a71cb..ac661a6 100644
+--- a/src/structs.h
++++ b/src/structs.h
+@@ -4468,6 +4468,9 @@ typedef struct
+ #ifdef FEAT_DIFF
+ int diff_mode; // start with 'diff' set
+ #endif
++#ifdef SYS_TINYRC_FILE
++ int vi_mode; /* started as "vi" */
++#endif
+ } mparm_T;
+
+ /*