Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Is there a way to configure gvim to look in a different location for gvimrc? I know about -U but I'm curious if there's another method.

EDIT: I'm specifically looking for a self contained solution. I.e. something like a gvim_init file in the program directory.

share|improve this question
1  
Personally I would just leave gvimrc in the default location and source a file in it that had the settings that I wanted. –  EBGreen Nov 27 '12 at 15:47
    
The default location on windows can't be written to because of UAC. It also attempts to write to the user folder instead of the user settings folder. –  Amaron Nov 27 '12 at 16:25

2 Answers 2

Vim's :help startup describes the various places vim and gvim look for configuration files. Executing :version will also show you the places your particular Vim will look for configuration files. If none of those places is what you want, you might try setting the environment variable MYVIMRC to your desired location. Alternatively, you could set the environment variable VIMINIT or EXINIT to source the desired gvimrc. (See :help VIMINIT.)

share|improve this answer
    
Thanks for the info. I updated my question to be more precise but I'll upvote. –  Amaron Nov 27 '12 at 16:27
    
@Amaron: Thanks for the vote. Clarifying the question is not really going to help, though. All the possibilities are in the help file containing the :help startup entry. –  garyjohn Nov 27 '12 at 16:56
    
The :help startup says it applies to vim and not gvim? –  Amaron Nov 27 '12 at 17:02
    
The term "vim" is used sometimes to mean Vim operating in terminal mode and sometimes to mean the program generically. :help startup applies to both terminal vim and GUI gvim except where it discusses some terminal-only or GUI-only behavior. –  garyjohn Nov 27 '12 at 18:14
up vote 0 down vote accepted

I found a solution. You simply go to the directory vim is installed in. Create _gvimrc and set the first line:

source $HOME . "\\AppData\Roaming\\_gvimrc"

The $HOME ev is the user directory by default. You can also set runtime environment variables to give each user their own vimfiles directory this way.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.