Home » Questions » Computers [ Ask a new question ]

Where should the .vimrc file be located on Windows 7?

Where should the .vimrc file be located on Windows 7?

I recently installed vim on Windows 7 as a stand-alone binary.

Asked by: Guest | Views: 65
Total answers/comments: 5
Guest [Entry]

"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 _gvimrc, .gvimrc, _vimrc and .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"
Guest [Entry]

If you need to find out just from a .bat file first look in the %HOME% directory. If that is not defined then vim/gvim looks in the path defined by concatenating %HOMEDRIVE% and %HOMEPATH%.
Guest [Entry]

I found that vim-tux installed via Chocolatey can see .vimrc files only under C:\Users\MyUsername\vimfiles though :version tells that C:\Users\MyUsername also included.
Guest [Entry]

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.
Guest [Entry]

"I found it in ( windows 10 )

\tools\vim\_vimrc"