Re: $VIMRC over .vimrc ?

Christopher <[email protected]> Thu, 19 Mar 2026 16:14:42 -0700 (PDT)
Newsgroups gmane.editors.vim
Message-ID <[email protected]>
------=_Part_35220_1885112596.1773962082249
Content-Type: multipart/alternative; 
	boundary="----=_Part_35221_510478329.1773962082249"

------=_Part_35221_510478329.1773962082249
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable



On Thursday, March 19, 2026 at 12:29:46=E2=80=AFPM UTC-4 D. Ben Knoble wrot=
e:

On Thu, Mar 19, 2026 at 9:45=E2=80=AFAM Marvin Renich <[email protected]> wr=
ote:=20
>=20
> * Christopher <[email protected]> [260319 03:56]:=20
> > On Wednesday, March 18, 2026 at 3:48:41=E2=80=AFPM UTC-4 Ben Knoble wro=
te:=20
> > I'm afraid your question isn't clear to me, but let's look at `:help=20
> > myvimrc`:=20
> >=20
> > c. Five places are searched for initializations. The first that exists=
=20
> > is used, the others are ignored. The `$MYVIMRC` environment variable is=
=20
> > set to the file that was first found, unless `$MYVIMRC` was already set=
=20
>=20
> and=20
>=20
> > when using VIMINIT. The `$MYVIMDIR` environment variable is=20
> > set to the personal 'rtp' directory, however it is not verified=20
> > that the directory actually exists.=20
> > I The environment variable VIMINIT (see also |compatible-default|) (*)=
=20
> > The value of $VIMINIT is used as an Ex command line.=20
> > II The user vimrc file(s):=20
> > "$HOME/.vimrc" (for Unix) (*)=20
> > "$HOME/.vim/vimrc" (for Unix) (*)=20
> > "$XDG_CONFIG_HOME/vim/vimrc" (for Unix) (*)=20
> > "s:.vimrc" (for Amiga) (*)=20
> > "home:.vimrc" (for Amiga) (*)=20
> > "home:vimfiles:vimrc" (for Amiga) (*)=20
> > "$VIM/.vimrc" (for Amiga) (*)=20
> > "$HOME/_vimrc" (for Win32) (*)=20
> > "$HOME/vimfiles/vimrc" (for Win32) (*)=20
> > "$VIM/_vimrc" (for Win32) (*)=20
> > "$HOME/config/settings/vim/vimrc" (for Haiku) (*)=20
>=20
> This quote is missing an important word, as shown above.=20
>=20
> Perhaps that word should be "or" rather than "and", but either way the=20
> meaning should be clear:=20
>=20
> If VIMINIT is set, it contains ex commands, vim does not search for or=20
> read any rc file, and MYVIMRC is not set.=20
>=20
> If VIMINIT is not set, vim searches for a file in the places listed=20
> above, and sets MYVIMRC to the file that was found and read.=20
>=20
> So, MYVIMRC is not an input to vim, it is how vim communicates to the=20
> user which file was found and read. If MYVIMRC is exported before=20
> invoking vim, it is ignored completely; it is neither read nor set.=20
>=20
> The user's vimrc file _must_ be one of the files listed above, unless=20
> you specify the -u option. The only way to specify the vimrc file in an=
=20
> environment variable is to export VIMINT=3D"source /path/to/your/vimrc"=
=20
> before (or while) starting vim.=20
>=20
> The strongly recommended way is to _not_ use VIMINT, and to place your=20
> vimrc file at ~/.vim/vimrc. VIMINIT is a compatibility holdover.=20
>=20
> ...Marvin=20

Indeed. This is what I meant to convey, and I apologize if my initial=20
reply was not clear on this point:=20

Vim sets MYVIMRC for the user, not the other way around!=20

--=20
D. Ben Knoble=20


> The user's vimrc file _must_ be one of the files listed above, unless=20
> you specify the -u option. The only way to specify the vimrc file in an=
=20
> environment variable is to export VIMINT=3D"source /path/to/your/vimrc"=
=20
> before (or while) starting vim. =20

You mention, the only way to specify a vimrc in a environment variable; I=
=20
assume as in $MYVIMRC is to export VIMNT which is the source of your vimrc=
=20
file. If my vimrc file was located in the system path then that would be;
VIMINT=3D`/etc/vimrc and that would create the environment variable $MYVIMR=
C=20
?=20

--=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/b3e=
fd6e9-4d4f-4752-af97-2d5666abfd6en%40googlegroups.com.

------=_Part_35221_510478329.1773962082249
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<br /><br /><div><div dir=3D"auto">On Thursday, March 19, 2026 at 12:29:46=
=E2=80=AFPM UTC-4 D. Ben Knoble wrote:<br /></div><blockquote style=3D"marg=
in: 0px 0px 0px 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-l=
eft: 1ex;">On Thu, Mar 19, 2026 at 9:45=E2=80=AFAM Marvin Renich &lt;<a hre=
f=3D"" rel=3D"nofollow">[email protected]</a>&gt; wrote:
<br />&gt;
<br />&gt; * Christopher &lt;<a href=3D"" rel=3D"nofollow">crestchr...@gmai=
l.com</a>&gt; [260319 03:56]:
<br />&gt; &gt; On Wednesday, March 18, 2026 at 3:48:41=E2=80=AFPM UTC-4 Be=
n Knoble wrote:
<br />&gt; &gt; I'm afraid your question isn't clear to me, but let's look =
at `:help
<br />&gt; &gt; myvimrc`:
<br />&gt; &gt;
<br />&gt; &gt;      c. Five places are searched for initializations.  The =
first that exists
<br />&gt; &gt; is used, the others are ignored.  The `$MYVIMRC` environmen=
t variable is
<br />&gt; &gt; set to the file that was first found, unless `$MYVIMRC` was=
 already set
<br />&gt;
<br />&gt;   and
<br />&gt;
<br />&gt; &gt; when using VIMINIT.  The `$MYVIMDIR` environment variable i=
s
<br />&gt; &gt; set to the personal 'rtp' directory, however it is not veri=
fied
<br />&gt; &gt; that the directory actually exists.
<br />&gt; &gt; I   The environment variable VIMINIT (see also |compatible-=
default|) (*)
<br />&gt; &gt;     The value of $VIMINIT is used as an Ex command line.
<br />&gt; &gt; II  The user vimrc file(s):
<br />&gt; &gt;     "$HOME/.vimrc"   (for Unix) (*)
<br />&gt; &gt;     "$HOME/.vim/vimrc"   (for Unix) (*)
<br />&gt; &gt;     "$XDG_CONFIG_HOME/vim/vimrc"  (for Unix) (*)
<br />&gt; &gt;     "s:.vimrc"   (for Amiga) (*)
<br />&gt; &gt;     "home:.vimrc"   (for Amiga) (*)
<br />&gt; &gt;     "home:vimfiles:vimrc"   (for Amiga) (*)
<br />&gt; &gt;     "$VIM/.vimrc"   (for Amiga) (*)
<br />&gt; &gt;     "$HOME/_vimrc"   (for Win32) (*)
<br />&gt; &gt;     "$HOME/vimfiles/vimrc"   (for Win32) (*)
<br />&gt; &gt;     "$VIM/_vimrc"   (for Win32) (*)
<br />&gt; &gt;     "$HOME/config/settings/vim/vimrc" (for Haiku) (*)
<br />&gt;
<br />&gt; This quote is missing an important word, as shown above.
<br />&gt;
<br />&gt; Perhaps that word should be "or" rather than "and", but either w=
ay the
<br />&gt; meaning should be clear:
<br />&gt;
<br />&gt; If VIMINIT is set, it contains ex commands, vim does not search =
for or
<br />&gt; read any rc file, and MYVIMRC is not set.
<br />&gt;
<br />&gt; If VIMINIT is not set, vim searches for a file in the places lis=
ted
<br />&gt; above, and sets MYVIMRC to the file that was found and read.
<br />&gt;
<br />&gt; So, MYVIMRC is not an input to vim, it is how vim communicates t=
o the
<br />&gt; user which file was found and read.  If MYVIMRC is exported befo=
re
<br />&gt; invoking vim, it is ignored completely; it is neither read nor s=
et.
<br />&gt;
<br />&gt; The user's vimrc file _must_ be one of the files listed above, u=
nless
<br />&gt; you specify the -u option.  The only way to specify the vimrc fi=
le in an
<br />&gt; environment variable is to export VIMINT=3D"source /path/to/your=
/vimrc"
<br />&gt; before (or while) starting vim.
<br />&gt;
<br />&gt; The strongly recommended way is to _not_ use VIMINT, and to plac=
e your
<br />&gt; vimrc file at ~/.vim/vimrc.  VIMINIT is a compatibility holdover=
.
<br />&gt;
<br />&gt; ...Marvin
<br />
<br />Indeed. This is what I meant to convey, and I apologize if my initial
<br />reply was not clear on this point:
<br />
<br />Vim sets MYVIMRC for the user, not the other way around!
<br />
<br />--=20
<br />D. Ben Knoble
<br /></blockquote><div><br /></div><div>&gt; The user's vimrc file _must_ =
be one of the files listed above, unless <br />&gt; you specify the -u opti=
on. The only way to specify the vimrc file in an <br />&gt; environment var=
iable is to export VIMINT=3D"source /path/to/your/vimrc" <br />&gt; before =
(or while) starting vim.

=C2=A0</div><div><br /></div><div>You mention, the only way to specify a vi=
mrc in a environment variable; I assume as in $MYVIMRC is to export VIMNT w=
hich is the source of your vimrc file. If my vimrc file was located in the =
system path then that would be;</div><div>VIMINT=3D`/etc/vimrc and that wou=
ld create the environment variable $MYVIMRC ?=C2=A0</div></div>

<p></p>

-- <br />
-- <br />
You received this message from the &quot;vim_use&quot; maillist.<br />
Do not top-post! Type your reply below the text you are replying to.<br />
For more information, visit <a href=3D"http://www.vim.org/maillist.php">htt=
p://www.vim.org/maillist.php</a><br />
<br />
--- <br />
You received this message because you are subscribed to the Google Groups &=
quot;vim_use&quot; group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:[email protected]">vim_use+uns=
[email protected]</a>.<br />
To view this discussion visit <a href=3D"https://groups.google.com/d/msgid/=
vim_use/b3efd6e9-4d4f-4752-af97-2d5666abfd6en%40googlegroups.com?utm_medium=
=3Demail&utm_source=3Dfooter">https://groups.google.com/d/msgid/vim_use/b3e=
fd6e9-4d4f-4752-af97-2d5666abfd6en%40googlegroups.com</a>.<br />

------=_Part_35221_510478329.1773962082249--

------=_Part_35220_1885112596.1773962082249--