Re: $VIMRC over .vimrc ?

Christian Brabandt <[email protected]> Thu, 19 Mar 2026 14:17:57 +0100
Newsgroups gmane.editors.vim
Message-ID <[email protected]>
On Do, 19 M=C3=A4r 2026, Gary Johnson wrote:

> That's what I used to think, too, was that MYVIMRC was set, but not
> read, by Vim.  But ":help MYVIMRC" says this:
>=20
> 			*$MYVIMRC* *$MYVIMDIR*
>      c. Five places are searched for initializations.  The first that exi=
sts
> 	is used, the others are ignored.  The `$MYVIMRC` environment variable is
> 	set to the file that was first found, unless `$MYVIMRC` was already set
> 	when using VIMINIT.  ...
>=20
> It's that "unless `$MYVIMRC was already set" that I don't understand
> the meaning of.  That suggests to me if $MYVIMRC is already set, Vim
> uses that value instead of looking further for the file.
>=20
> In my experiments, I executed
>=20
>     VIMINIT=3D'let $MYVIMRC=3D"/path/to/a/vimrc"' vim
>=20
> expecting Vim to source /path/to/a/vimrc, but it didn't.  I'm OK
> with the actual behavior, but I don't think the documentation is
> clear.

I understand this that Vim won't overwrite your $MYVIMRC environment=20
variable, if for whatever reason it already exists when starting Vim. It=20
doesn't mean it will use this value of this environment variable as an=20
init file that it should actually read.

Thanks,
Christian
--=20
God made the world in six days, and was arrested on the seventh.

--=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/abv=
3hXDtGRarmEsp%40256bit.org.