Re: $VIMRC over .vimrc ?
"D. Ben Knoble" <[email protected]> Thu, 19 Mar 2026 12:29:19 -0400
| Newsgroups | gmane.editors.vim |
|---|---|
| Message-ID | <CALnO6CB5mct8F=D=SsnUWeEtWyjJNuCtHY-Kk9-od76qoH_V_w@mail.gmail.com> |
On Thu, Mar 19, 2026 at 9:45=E2=80=AFAM Marvin Renich <[email protected]> wro= te: > > * Christopher <[email protected]> [260319 03:56]: > > On Wednesday, March 18, 2026 at 3:48:41=E2=80=AFPM UTC-4 Ben Knoble wro= te: > > I'm afraid your question isn't clear to me, but let's look at `:help > > myvimrc`: > > > > c. Five places are searched for initializations. The first that e= xists > > is used, the others are ignored. The `$MYVIMRC` environment variable i= s > > set to the file that was first found, unless `$MYVIMRC` was already set > > and > > > when using VIMINIT. The `$MYVIMDIR` environment variable is > > set to the personal 'rtp' directory, however it is not verified > > that the directory actually exists. > > I The environment variable VIMINIT (see also |compatible-default|) (*= ) > > The value of $VIMINIT is used as an Ex command line. > > II The user vimrc file(s): > > "$HOME/.vimrc" (for Unix) (*) > > "$HOME/.vim/vimrc" (for Unix) (*) > > "$XDG_CONFIG_HOME/vim/vimrc" (for Unix) (*) > > "s:.vimrc" (for Amiga) (*) > > "home:.vimrc" (for Amiga) (*) > > "home:vimfiles:vimrc" (for Amiga) (*) > > "$VIM/.vimrc" (for Amiga) (*) > > "$HOME/_vimrc" (for Win32) (*) > > "$HOME/vimfiles/vimrc" (for Win32) (*) > > "$VIM/_vimrc" (for Win32) (*) > > "$HOME/config/settings/vim/vimrc" (for Haiku) (*) > > This quote is missing an important word, as shown above. > > Perhaps that word should be "or" rather than "and", but either way the > meaning should be clear: > > If VIMINIT is set, it contains ex commands, vim does not search for or > read any rc file, and MYVIMRC is not set. > > If VIMINIT is not set, vim searches for a file in the places listed > above, and sets MYVIMRC to the file that was found and read. > > So, MYVIMRC is not an input to vim, it is how vim communicates to the > user which file was found and read. If MYVIMRC is exported before > invoking vim, it is ignored completely; it is neither read nor set. > > The user's vimrc file _must_ be one of the files listed above, unless > you specify the -u option. The only way to specify the vimrc file in an > environment variable is to export VIMINT=3D"source /path/to/your/vimrc" > before (or while) starting vim. > > The strongly recommended way is to _not_ use VIMINT, and to place your > vimrc file at ~/.vim/vimrc. VIMINIT is a compatibility holdover. > > ...Marvin Indeed. This is what I meant to convey, and I apologize if my initial reply was not clear on this point: Vim sets MYVIMRC for the user, not the other way around! --=20 D. Ben Knoble --=20 --=20 You received this message from the "vim_use" maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php ---=20 You received this message because you are subscribed to the Google Groups "= vim_use" group. To unsubscribe from this group and stop receiving emails from it, send an e= mail to [email protected]. To view this discussion visit https://groups.google.com/d/msgid/vim_use/CAL= nO6CB5mct8F%3DD%3DSsnUWeEtWyjJNuCtHY-Kk9-od76qoH_V_w%40mail.gmail.com.