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 Author: James Vega 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