Loading ...
Sorry, an error occurred while loading the content.

Re: Specifying .vimrc on cmdline

Expand Messages
  • A. J. Mechelynck
    ... OK, then you can workaround it:
    Message 1 of 4 , Dec 1, 2005
      Tim Chase wrote:
      >> What's confusing though, is that my ~/.vimrc does not override
      >> /etc/vim/vimrc and each time I run vim, both are sourced by
      >> default, although I don't have a `source' cmd in ~/.vimrc for
      >> /etc/vim/vimrc. But supplying .vimrc in the cmdline overrides
      >> all others.
      > As buried in the
      > :help vimrc
      > If Vim was started with "-u filename", the file
      > "filename" is used.
      > All following initializations until 5. are skipped.
      > This means that it will skip the system vimrc file as well as the
      > loading of plugins. Without the "-u filename" side of things, it will
      > proceed by default with the loading of both the system-wide vimrc and
      > the loading of plugins.
      > The default think-process would be "load the system vimrc file, then
      > override it with any settings in the ~/.vimrc for this particular user"
      > whereas specifying the "-u" option would be something like "these
      > settings are exactly what I want, no more, no less".
      > -tim

      OK, then you can workaround it:

      <<<<<< ~/__vimrc
      set nocompatible
      if filereadable("/etc/vimrc")
      source /etc/vimrc
      if filereadable("$HOME/.vimrc")
      source ~/.vimrc
      <<<<< ~/__vimrc <<<<< end

      $ vim -u ~/__vimrc main.c

      Like this it doesn't make much sense but if you add other ex-commands in
      ~/__vimrc (or /devel/abraca/d/acarba/src/vimrc or whatever) then it will.

      Best regards,
    Your message has been successfully submitted and would be delivered to recipients shortly.