[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: switching to vim-tiny for standard vi?



On Tue, Dec 20, 2005 at 12:11:37AM -0500, Glenn Maynard wrote:
> > Yeah; vi not behaving like vi by default seems like a showstopper.
> "Can't make vim act like vi" might be a showstopper.  "The default
> configuration makes vim not act like vi" isn't a showstopper--it's
> trivial to change.

Geez, I hate arguments about defaults. If it's trivial to change, that's
great; but until the defaults are changed it's still a showstopper.

> I guess there are two competing goals here: acting like vi by default,
> for the people in a time capsule, 

*sigh*

> and acting like vim by default, to
> show off vim's cool features.  I wonder if there's a sensible way to
> do both, eg. argv[0] for "vi" and "vim".

The following patch lets you have a /usr/share/vim/virc (which should
be a symlink to /etc, like /usr/share/vim/vimrc) to specify different
behaviour when vim's invoked as vi instead of vim.

--- vim-6.4.old/vim64/src/main.c        2005-02-15 23:09:15.000000000 +1000
+++ vim-6.4/vim64/src/main.c    2005-12-20 16:36:49.000000000 +1000
@@ -1363,6 +1363,10 @@
         * Get system wide defaults, if the file name is defined.
         */
 #ifdef SYS_VIMRC_FILE
+# ifdef SYS_VIM_VIRC_FILE
+        if (STRCMP(initstr, "vi") != 0 ||
+           do_source((char_u *)SYS_VIM_VIRC_FILE, FALSE, FALSE) == FAIL)
+# endif
        (void)do_source((char_u *)SYS_VIMRC_FILE, FALSE, FALSE);
 #endif
 
--- vim-6.4.old/vim64/src/os_unix.h     2003-11-10 19:53:44.000000000 +1000
+++ vim-6.4/vim64/src/os_unix.h 2005-12-20 16:14:07.000000000 +1000
@@ -233,6 +233,9 @@
 #ifndef SYS_VIMRC_FILE
 # define SYS_VIMRC_FILE "$VIM/vimrc"
 #endif
+#ifndef SYS_VIM_VIRC_FILE
+# define SYS_VIM_VIRC_FILE "$VIM/virc"
+#endif
 #ifndef SYS_GVIMRC_FILE
 # define SYS_GVIMRC_FILE "$VIM/gvimrc"
 #endif

Cheers,
aj

Attachment: signature.asc
Description: Digital signature


Reply to: