How can I make Neovim automatically return to the tabpage that was active before running :Git diff %
?
Before I commit my work in git, I often run :Git diff
to review changes (the :Git
command is supplied by fugitive). The :Git diff
command runs in a new instance of Neovim's terminal, which seems to open in a new tabpage of its own. I press q
to abort the process, and the new tabpage disappears. Neovim then activates the next available tabpage, instead of returning to the tabpage that was active before I ran :Git diff
.
For example, suppose that I've got Neovim running with three tabpages. If I run 1gt
to activate the first tabpage, then after running :Git diff
I'll finish up on the second tabpage (I'll then press gT
to go back to the tab I was working on). If I run 2gt
to activate the second tabpage, then after running :Git diff
I'll finish up on the third tabpage (again, gT
gets me back to where I was). If I run 3gt
, then I can run :Git diff
and remain on the third tabpage, because it's the last one that's open.
I'd like to be able to run 1gt
, then :Git diff
, and to be automatically returned to the first tabpage when the terminal process exits. How can I make that happen?
git diff
tab is created before the current active tab, which would make the "close-and-go-to-next" land on the good tab. Can this be the problem?:Gstatus
. If i am concerned with the exact nature of my commit I use thecvc
command which does:Gcommit --verbose
which gives the diff below the message.