I have a git repository: ~/home/foo/repo

I mounted core to another directory:

mount --bind ~/home/foo/repo ~/home/bar

Now I want to edit my code with vim and use vim-fugitive. vim ~/home/bar/myCode.txt; :Gblame

2 Answers 2


According to vim-fugitive sources, you can use Fugitive commands for any file that belongs to git index. E.g.

cd ~
vim ~/home/foo/repo/README.md # works
vim ~/home/bar/README.md # works too
  • Well, It is not working for me. I do not think that the file belongs to the git index because it is outside of my repository and I am accessing this file as a link.
    – Kfir
    Commented Jul 22, 2019 at 8:23
  • well ... do you have .git. directory ? ls ~/home/bar/.git
    – Yasen
    Commented Jul 22, 2019 at 19:57
  • This is exactly my problem. I want to access it outside of the .git directory tree. ~/home/foo/repo/.git exists and ~/home/bar/.git does not
    – Kfir
    Commented Jul 23, 2019 at 7:05
  • 3
    @Kfir Is the mount command in the question the exact one you ran? I just tried it, and for me, after running the mount command, ~/home/bar/.git does exist, and therefore fugitive should work fine.
    – Rich
    Commented Aug 23, 2019 at 14:41

I found a solution. Put set autochdir in your .vimrc. vim-fugitive can't know where the repo of the current file is if it is outside of the .git folder.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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