Re: $VIMRC over .vimrc ?
Christopher <[email protected]> Wed, 18 Mar 2026 11:33:25 -0700 (PDT)
| Newsgroups | gmane.editors.vim |
|---|---|
| Message-ID | <[email protected]> |
------=_Part_323372_409732148.1773858805820
Content-Type: multipart/alternative;
boundary="----=_Part_323373_181689962.1773858805820"
------=_Part_323373_181689962.1773858805820
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
On Wednesday, March 18, 2026 at 11:48:15=E2=80=AFAM UTC-4 D. Ben Knoble wro=
te:
On Tuesday, March 17, 2026 at 10:38:51=E2=80=AFAM UTC-4 Christopher wrote:
When initializing Vim it searches first for $MYVIMRC, although that file=20
doesn't exist in my case so it immediately goes to .vimrc. I'm reading the=
=20
documentation on how to create this $VIMRC file as so that it's read first,=
=20
rather then the .vimrc file ?
I'm afraid your question isn't clear to me, but let's look at `:help=20
myvimrc`:
c. Five places are searched for initializations. The first that exist=
s
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. 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) (*)
Note: For Unix and Amiga, when ".vimrc" does not exist,
"_vimrc" is also tried, in case an MS-DOS compatible file
system is used. For MS-Windows ".vimrc" is checked after
"_vimrc", in case long file names are used.
Note: For Win32, "$HOME" is checked first. If no "_vimrc" or
".vimrc" is found there, "$VIM" is tried. See |$VIM| for when
$VIM is not set.
III The environment variable EXINIT.
The value of $EXINIT is used as an Ex command line.
IV The user exrc file(s). Same as for the user vimrc file, but with
"vimrc" replaced by "exrc". But only one of ".exrc" and "_exrc" is
used, depending on the system. And without the (*)!
V The default vimrc file, $VIMRUNTIME/defaults.vim. This sets up
options values and has "syntax on" and "filetype on" commands,
which is what most new users will want. See |defaults.vim|.
So, unless you use VIMINIT to set MYVIMRC, MYVIMRC is intended to be set=20
_by Vim_ to the file it finds.
Most folks I know use either ~/.vimrc or ~/.vim/vimrc (with equivalent=20
~/_vimrc or ~/vimfiles/vimrc on Windows).=20
I read the documentation, therefore like with many I also use the system=20
wide .vimrc file when starting vim. I want to know how to set the $MYVIMRC=
=20
as the documentation ?=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/8a7=
3adf8-6fd5-4619-88ba-96820a7e71f4n%40googlegroups.com.
------=_Part_323373_181689962.1773858805820
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
<br /><br /><div><div dir=3D"auto">On Wednesday, March 18, 2026 at 11:48:15=
=E2=80=AFAM 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;"><div><div dir=3D"auto">On Tuesday, March 17, 2026 at 10:38:51=E2=
=80=AFAM UTC-4 Christopher wrote:<br /></div><blockquote style=3D"margin: 0=
px 0px 0px 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: =
1ex;">When initializing Vim it searches first for $MYVIMRC, although that f=
ile doesn't exist in my case so it immediately goes to .vimrc. I'm reading =
the documentation on how to create this $VIMRC file as so that it's read fi=
rst, rather then the .vimrc file ?</blockquote><div><br /></div></div><div>=
<div>I'm afraid your question isn't clear to me, but let's look at `:help m=
yvimrc`:</div><div><br /></div>=C2=A0 =C2=A0 =C2=A0c. Five places are searc=
hed for initializations. =C2=A0The first that exists<br /><span style=3D"wh=
ite-space: pre;"> </span>is used, the others are ignored. =C2=A0The `$MYVIM=
RC` environment variable is<br /><span style=3D"white-space: pre;"> </span>=
set to the file that was first found, unless `$MYVIMRC` was already set<br =
/><span style=3D"white-space: pre;"> </span>when using VIMINIT. =C2=A0The `=
$MYVIMDIR` environment variable is<br /><span style=3D"white-space: pre;"> =
</span>set to the personal 'rtp' directory, however it is not verified<br /=
><span style=3D"white-space: pre;"> </span>that the directory actually exis=
ts.<br /><span style=3D"white-space: pre;"> </span>I =C2=A0 The environment=
variable VIMINIT (see also |compatible-default|) (*)<br /><span style=3D"w=
hite-space: pre;"> </span>=C2=A0 =C2=A0 The value of $VIMINIT is used as an=
Ex command line.<br /><span style=3D"white-space: pre;"> </span>II =C2=A0T=
he user vimrc file(s):<br /><span style=3D"white-space: pre;"> </span>=C2=
=A0 =C2=A0 "$HOME/.vimrc"<span style=3D"white-space: pre;"> </span>=C2=A0 =
(for Unix) (*)<br /><span style=3D"white-space: pre;"> </span>=C2=A0 =C2=
=A0 "$HOME/.vim/vimrc"<span style=3D"white-space: pre;"> </span>=C2=A0 (fo=
r Unix) (*)<br /><span style=3D"white-space: pre;"> </span>=C2=A0 =C2=A0 "=
$XDG_CONFIG_HOME/vim/vimrc" =C2=A0(for Unix) (*)<br /><span style=3D"white-=
space: pre;"> </span>=C2=A0 =C2=A0 "s:.vimrc"<span style=3D"white-space: p=
re;"> </span>=C2=A0 (for Amiga) (*)<br /><span style=3D"white-space: pre;=
"> </span>=C2=A0 =C2=A0 "home:.vimrc"<span style=3D"white-space: pre;"> <=
/span>=C2=A0 (for Amiga) (*)<br /><span style=3D"white-space: pre;"> </spa=
n>=C2=A0 =C2=A0 "home:vimfiles:vimrc"<span style=3D"white-space: pre;"> </s=
pan>=C2=A0 (for Amiga) (*)<br /><span style=3D"white-space: pre;"> </span>=
=C2=A0 =C2=A0 "$VIM/.vimrc"<span style=3D"white-space: pre;"> </span>=C2=
=A0 (for Amiga) (*)<br /><span style=3D"white-space: pre;"> </span>=C2=A0 =
=C2=A0 "$HOME/_vimrc"<span style=3D"white-space: pre;"> </span>=C2=A0 (for=
Win32) (*)<br /><span style=3D"white-space: pre;"> </span>=C2=A0 =C2=A0 "=
$HOME/vimfiles/vimrc"<span style=3D"white-space: pre;"> </span>=C2=A0 (for =
Win32) (*)<br /><span style=3D"white-space: pre;"> </span>=C2=A0 =C2=A0 "$=
VIM/_vimrc"<span style=3D"white-space: pre;"> </span>=C2=A0 (for Win32) (*=
)<br /><span style=3D"white-space: pre;"> </span>=C2=A0 =C2=A0 "$HOME/conf=
ig/settings/vim/vimrc"<span style=3D"white-space: pre;"> </span>(for Haiku)=
(*)<br /><br /><span style=3D"white-space: pre;"> </span>Note: For Unix a=
nd Amiga, when ".vimrc" does not exist,<br /><span style=3D"white-space: pr=
e;"> </span>"_vimrc" is also tried, in case an MS-DOS compatible file<br /=
><span style=3D"white-space: pre;"> </span>system is used. =C2=A0For MS-Wi=
ndows ".vimrc" is checked after<br /><span style=3D"white-space: pre;"> </=
span>"_vimrc", in case long file names are used.<br /><span style=3D"white-=
space: pre;"> </span>Note: For Win32, "$HOME" is checked first. =C2=A0If n=
o "_vimrc" or<br /><span style=3D"white-space: pre;"> </span>".vimrc" is f=
ound there, "$VIM" is tried. =C2=A0See |$VIM| for when<br /><span style=3D"=
white-space: pre;"> </span>$VIM is not set.<br /><span style=3D"white-spac=
e: pre;"> </span>III The environment variable EXINIT.<br /><span style=3D"w=
hite-space: pre;"> </span>=C2=A0 =C2=A0 The value of $EXINIT is used as an =
Ex command line.<br /><span style=3D"white-space: pre;"> </span>IV =C2=A0Th=
e user exrc file(s). =C2=A0Same as for the user vimrc file, but with<br /><=
span style=3D"white-space: pre;"> </span>=C2=A0 =C2=A0 "vimrc" replaced by =
"exrc". =C2=A0But only one of ".exrc" and "_exrc" is<br /><span style=3D"wh=
ite-space: pre;"> </span>=C2=A0 =C2=A0 used, depending on the system. =C2=
=A0And without the (*)!<br /><span style=3D"white-space: pre;"> </span>V =
=C2=A0 The default vimrc file, $VIMRUNTIME/defaults.vim. =C2=A0This sets up=
<br /><span style=3D"white-space: pre;"> </span>=C2=A0 =C2=A0 options value=
s and has "syntax on" and "filetype on" commands,<br /><span style=3D"white=
-space: pre;"> </span>=C2=A0 =C2=A0 which is what most new users will want.=
=C2=A0See |defaults.vim|.<br /><div><br /></div><div>So, unless you use VI=
MINIT to set MYVIMRC, MYVIMRC is intended to be set _by Vim_ to the file it=
finds.</div><div><br /></div><div>Most folks I know use either ~/.vimrc or=
~/.vim/vimrc (with equivalent ~/_vimrc or ~/vimfiles/vimrc on Windows).=C2=
=A0</div></div></blockquote><div><br /></div><div>I read the documentation,=
therefore like with many I also use the system wide .vimrc file when start=
ing vim. I want to know how to set=C2=A0 the $MYVIMRC as the documentation =
?=C2=A0</div></div>
<p></p>
-- <br />
-- <br />
You received this message from the "vim_use" 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" 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/8a73adf8-6fd5-4619-88ba-96820a7e71f4n%40googlegroups.com?utm_medium=
=3Demail&utm_source=3Dfooter">https://groups.google.com/d/msgid/vim_use/8a7=
3adf8-6fd5-4619-88ba-96820a7e71f4n%40googlegroups.com</a>.<br />
------=_Part_323373_181689962.1773858805820--
------=_Part_323372_409732148.1773858805820--