Runaway commands are not available after opening .vimrc for editing

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

In MacVim, Fugitive doesn't work at all.

This is slightly different on Vim. I set up a mapping to open the file .vimrc

like this:

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


Immediately after opening vim, all Fugitive commands are available, but after opening the file .vimrc

using the above mapping, I cannot issue any Fugitive commands :G*

. If I usually open the file .vimrc

(i.e. with :e ~/.vimrc

) everything is fine.

My entire .vim

dir (with .vimrc

as vimrc

in the root directory) can be obtained from here .

What can I do to make it work?


source to share

2 answers

The runaway functions are only available if the given file is part of a Git repository. Your file .vimrc

is likely not under Git control, or if it is, you edited it with a symbolic path that Fugitive does not handle at the time of writing.

If your file is .vimrc

indeed under version control, you can fix this by calling :edit

on the canonical file path rather than through any symbolic links that will force Fugitive to find the .git

subdirectory and metadata correctly inside.



If yours $MYVIMRC

is a symbolic link try this mapping.

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


It will open the target file vimrc

which is in the git repo and thus can be brought up by Fugitive.



All Articles