3

My system is an OS X 10.6 with MacVim 7.3 (GUI) and Vim 7.2 (on iTerm).

On MacVim, Fugitive does not work at all.

On Vim, it is a little bit different. I have set a mapping to open the .vimrc file as follows:

nmap <silent> <leader>ev :e $MYVIMRC<CR>

Just after opening vim, all Fugitive commands are available, but after opening the .vimrc file using the mapping above I can't issue any of the Fugitive :G* commands. If I open the .vimrc file normally (i.e. with :e ~/.vimrc) everything is fine.

My entire .vim dir (with .vimrc as vimrc in the root) can be accessed here.

What can I do to make it work?

freitass
  • 6,542
  • 5
  • 40
  • 44
  • What do you mean by "On MacVim, Fugitive does not work at all."? What are the symptoms? For the other part, try replacing `$MYVIMRC` in your mapping by `~/.vimrc` or `~/.vim/vimrc` and also try doing manually `:e $MYVIMRC`. I suspect the issue has something to do with your `~/.vimrc` being a symlink to `~/.vim/vimrc`. – romainl Mar 20 '12 at 08:23
  • @romainl: Sorry, by "On MacVim, Fugitive does not work at all." I meant that the Fugitive commands are not available from start. I don't even need to issue `\ev` as I do for "terminal vim". What is awkward is that I have seven other plugins installed and they work just fine, only Fugitive is behaving that way. I'll investigate the symlink. Thanks – freitass Mar 20 '12 at 17:39

2 Answers2

10

Fugitive's functions are only available if the file in question is part of a Git repository. It's likely that your .vimrc file isn't under Git version control, or if it is, that you've edited it via a symlinked path, which Fugitive does not handle at the time of writing.

If your .vimrc file really is under version control, you can fix this by calling :edit on the canonical path to the file, rather than via any symbolic links, which will prompt Fugitive to correctly find the .git subdirectory and the metadata within.

3

If your $MYVIMRC is a symlink, try this mapping instead.

noremap <leader>ev :execute 'e ' . resolve(expand($MYVIMRC))<CR>

It will open the target vimrc file, which is in a git repo and thus can be picked up by Fugitive.

Xuan
  • 5,255
  • 1
  • 34
  • 30