LinuxmacOSWindows

Where Is the Vim vimrc File?

Where Vim looks for vimrc on Linux, macOS and Windows, and the one command that prints the live file.

Last updated

Vim customizations live in one startup file: ~/.vimrc on Linux and macOS, _vimrc in your home folder on Windows. Plugins and colorschemes live beside it in ~/.vim (or ~/vimfiles on Windows), but the rc file is the one you edit day to day.

Unsure which file is live? Type :echo $MYVIMRC inside Vim and it prints the exact path it loaded. That beats guessing between home directories, XDG overrides and system wide defaults. Back up the single file to carry your setup anywhere.

Where Vim stores this, by platform

Linux
~/.vimrc

A dotfile in home. Plugins go in ~/.vim beside it. If $XDG_CONFIG_HOME is set, modern Vim also accepts ~/.config/vim/vimrc, but the plain home path wins when both exist.

macOS
~/.vimrc

Same as Linux. The system vimrc in /usr/share/vim is defaults, not yours: leave it alone and keep personal settings in the home file.

Windows
%USERPROFILE%\_vimrc

Note the underscore prefix instead of a dot. Plugins go in %USERPROFILE%\vimfiles. Run :echo $MYVIMRC inside Vim to confirm, since $HOME can differ under some terminals.

Frequently asked questions

I have several vimrc files. Which one wins?

Vim reads the first one it finds in a fixed order and ignores the rest. Run :scriptnames inside Vim to see which files actually loaded. If your edits seem ignored, you are almost certainly editing a file that loses the lookup order.

Is this the same as the Neovim config file?

They are different programs with different homes. Classic Vim uses ~/.vimrc (or _vimrc on Windows). Neovim uses init.lua in its own config folder and never reads vimrc. See the Neovim config post for that side.

Notice an outdated path? Let us know.