164
votes

Is there a command in the vim editor to find the .vimrc file location?

3

3 Answers

251
votes

Just try doing the following:

:version

You will get an output which includes something like:

 system vimrc file: "$VIM/vimrc"
     user vimrc file: "$HOME/.vimrc"
      user exrc file: "$HOME/.exrc"
  system gvimrc file: "$VIM/gvimrc"
    user gvimrc file: "$HOME/.gvimrc"
    system menu file: "$VIMRUNTIME/menu.vim"

As noted by Herbert in comments, this is where vim looks for vimrcs, it doesn't mean they exist.

You can check the full path of your vimrc with

:echo $MYVIMRC

If the output is empty, then your vim doesn't use a user vimrc (just create it if you wish).

3
votes

:version does not list /etc/vim but this is where vim is picking up gvimrc and vimrc on my ubuntu box running vim82 from vim-gtk3

2
votes

For nvim use :scriptnames like proposed in Randy Morris comment