I recently installed vim on Windows 7 as a stand-alone binary.
Where should I put my .vimrc file?
Super User is a question and answer site for computer enthusiasts and power users. It only takes a minute to sign up.Sign up to join this community
From the Vim Wiki.
In Vim, your home directory is specified with $HOME. On Unix systems, this is your ~ directory. On Windows systems, the best way to find the value of $HOME is from within Vim, as follows. These commands are useful to see what directories your Vim is using:
:version :echo expand('~') :echo $HOME :echo $VIM :echo $VIMRUNTIME
Once you determine the
HOME variable put the
vimrc file within that directory.
If you would like to change your
HOME variable, set
HOME as an environment variable for either the system or user.
Computer > Properties > Advanced System Settings > Advanced > Environment Variables > User | System Variables.
Windows (both Native and Cygwin*) will use
.vimrc in that order of priority. The gvim* files will be checked with the gvim process, while the console vim will only check the vim* files.
*: verified against vim 7.2 and 7.3
For Vim 7.4, these are the paths it looks for on Windows
system vimrc file: "$VIM\vimrc" user vimrc file: "$HOME\_vimrc" 2nd user vimrc file: "$HOME\vimfiles\vimrc" 3rd user vimrc file: "$VIM\_vimrc" user exrc file: "$HOME\_exrc" 2nd user exrc file: "$VIM\_exrc" system gvimrc file: "$VIM\gvimrc" user gvimrc file: "$HOME\_gvimrc" 2nd user gvimrc file: "$HOME\vimfiles\gvimrc" 3rd user gvimrc file: "$VIM\_gvimrc" system menu file: "$VIMRUNTIME\menu.vim"
As Darren Hall said, use these commands to find out the values of
:echo $HOME :echo $VIM
For example, one good place for gvim-specific settings would be
That is actually a good question because after installation (oddly enough) you get a _vimrc file under "Program Files" - which is not a good place for configuration files.
Put it under
This way it will be picked up instead of the configuration file put by the installation.
I find that when I open gvim from Windows file explorer, $HOME is set to c:\Users\myname but when launched from my Cygwin file explorer it is set to /cygwin/home/myname. This is good because it lets me put slightly different settings in each one. To keep things separate and make backup easier, the Windows one is called _vimrc and the Cygwin one is called .vimrc.