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.

I have downloaded and installed git for windows (msysgit) and frequently used the included git bash. Whenever I run vim from git bash my _vimrc file is not loaded because there is syntax highlighting or anything. When I run the same command to start vim form with in windows command line (cmd) instead of git bash it works as described in my _vimrc file. The only customization I have done to git bash is to add the following bash_profile to C:\Program Files (x86)\Git\etc

alias up='cd ..'
alias ls='ls --color'
alias la='ls -a'
alias vimconfig='vim /c/Program\ Files/Vim/_vimrc'
alias gvimconfig='vim /c/Program\ Files/Vim/_gvimrc'
alias bashconfig='vim /c/Program\ Files/Git/etc/bash_profile'
LS_COLORS='di=36:fi=37:ln=31:pi=5:so=5:bd=5:cd=5:or=31:mi=0:ex=35:*.rpm=90'
export LS_COLORS

Does anyone know why it loads my _vimrc file correctly when vim is launched from cmd and incorrectly when launched from git bash?

share|improve this question
add comment

1 Answer

up vote 6 down vote accepted

msysgit comes with its own version of vim.

You can verify this by running

type vim

inside your git bash prompt.

I think it will tell you that vim = /bin/vim, not /c/Program Files/Vim/Vim.exe.

Then run

vim --version | grep vimrc

to see which config files it looks for.

On my system, it says

$ vim --version | grep vimrc
   system vimrc file: "$VIM\vimrc"
     user vimrc file: "$HOME\_vimrc"
 2nd user vimrc file: "$VIM\_vimrc"

$VIM points to C:\Program Files\Git\share\vim and $HOME points to c:\Users\USERNAME.

I guess your best option is to run your Windows-based version of vim, e.g.

alias vim='/c/Program Files/Vim/Vim.exe'

or similar.

Or you could move the msysgit version of vim aside, e.g.

mv /bin/vim /bin/vim.disabled
share|improve this answer
    
Did you mean "msysgit comes with its own version of vim."? –  Heptite May 7 '11 at 17:39
    
@Heptite: Yes, thanks! –  Mikel May 7 '11 at 21:29
1  
Note that you might have to run git bash as Administrator to do that last line. –  Kristo Jun 11 '12 at 2:58
add comment

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.