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
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
:Git diff, and to be automatically returned to the first tabpage when the terminal process exits. How can I make that happen?