What is the shortcut to go to the parent directory when browsing a git tree with fugitive?

301 views Asked by At

I am browsing the repository state with fugitive at a particular git commit, I am able to go only into the directory, but I don't know how to go back up to the parent directory. I end up looking this commit up again and start browsing from the top.

Directory view within a tree

What is the shortcut to go to the parent directory when browsing a git tree with fugitive?

1

There are 1 answers

0
TamaMcGlinn On

This is vim! It is whatever shortcut you want. I find - to be the most intuitive, so it works the same as NetRW.

nnoremap <silent> - :e %:h<CR>

When in a fugitive buffer, this opens the tree of the directory above the current one. When in a normal buffer, it opens the directory containing the file.