How to get Vim to automatically load .vimrc config from the current directory

gvimvim

I have a few projects that need different commands for running, building and testing, so I've put a .vimrc file in each of the project directories that define mappings to some F buttons. In the vim help files it says:

'exrc' 'ex'             boolean (default off)
                        global
                        {not in Vi}
        Enables the reading of .vimrc, .exrc and .gvimrc in the current
        directory.

So I have that option enabled, but when I :cd into a directory, the .vimrc file is not loaded. If I write :so .\.vimrc then it loads fine. Why isn't it being loaded automatically?


I'm using gVim 7.3 x64 for Windows.

Best Answer

If 'exrc' is set, the current directory is searched for a file named _vimrc, .vimrc or _exrc at startup. This is not done every time you :cd to a new directory. See

:help .vimrc
Related Question