5

One of my project folders has a file $MYVIMRC. I didn't create it. I have a .vimrc file I created in my home folder. What is the difference and what is $MYVIMRC and when/how is it created.

  • 4
    You simply typed an erroneous command at some point or another. You can delete that file safely. – romainl Nov 20 '16 at 19:36
4

From :h $MYVIMRC:

VIMINIT .vimrc _vimrc EXINIT .exrc _exrc $MYVIMRC

c. Four places are searched for initializations. The first that exists is used, the others are ignored. The $MYVIMRC environment variable is set to the file that was first found, unless $MYVIMRC was already set and when using VIMINIT.

  • The environment variable VIMINIT (see also |compatible-default|) (*)
    The value of $VIMINIT is used as an Ex command line.
  • The environment variable VIMINIT (see also |compatible-default|) (*)
    The value of $VIMINIT is used as an Ex command line.
  • The user vimrc file(s):
    • "$HOME/.vimrc" (for Unix and OS/2) (*)
    • "$HOME/.vim/vimrc" (for Unix and OS/2) (*)
    • "s:.vimrc" (for Amiga) (*)
    • "home:.vimrc" (for Amiga) (*)
    • "home:vimfiles:vimrc" (for Amiga) (*)
    • "$VIM/.vimrc" (for OS/2 and Amiga) (*)
    • "$HOME/_vimrc" (for MS-DOS and Win32) (*)
    • "$HOME/vimfiles/vimrc" (for MS-DOS and Win32) (*)
    • "$VIM/_vimrc" (for MS-DOS and Win32) (*)

So basically $MYVIMRC contains the location of the file which as used as your configuration file

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.