Search code examples
vimmacvimvim-fugitive

Fugitive commands unavailable after opening .vimrc to edit


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?


Solution

  • 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.