Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to locate the vimrc file used by vim editor?

People also ask

Where is vimrc file located?

The global or system-wide vim configuration file is generally located under the /etc/vim/vimrc . This configuration file is applied to all users and when Vim is started this configuration file is read and Vim is configured according to this file contents.

Where is my vimrc file Ubuntu?

Vim Configuration Files: Vim can be configured system wide (globally) via the /etc/vim/vimrc. local file on Ubuntu/Debian based operating systems. On CentOS 7 and RHEL 7, the system wide configuration file for Vim is in /etc/vimrc.

Where does Vim look for vimrc on Windows?

vimrc The files are searched in the order specified above and only the first one that is found is read. RECOMMENDATION: Put all your Vim configuration stuff in the $HOME/. vim/ directory ($HOME/vimfiles/ for MS-Windows). That makes it easy to copy it to another system.

What is vimrc file?

The vimrc file contains optional runtime configuration settings to initialize Vim when it starts. On Unix based systems, the file is named .vimrc , while on Windows systems it is named _vimrc . : help vimrc. You can customize Vim by putting suitable commands in your vimrc.


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).


: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


For nvim use :scriptnames like proposed in Randy Morris comment