I've been messing around with my workflow, and created a key mapping for myself to quickly open :Git status window in a new tab (so that I can work with my diffs at full width and height), and when :Git is dismissed with gq, I'm taken back to the tab I was on before, like nothing happened :)
The tab manipulation at the end there is needed because by default when a tab is closed, Vim will take you to the next tab, but I want to return to the tab from which I originally launched :Git.
My first shot at making this mapping looked like this:
nmap <silent> gs :-tab Git<CR>
But :-tab doesn't seem to work "as advertised" with :Git - instead of opening the new tab before the current tab, it opens it after the current tab, basically as if it just ignores the -. (I tested that e.g. :-tab split does indeed work as shown in Vim docs). Is there a reason for this not working with the :Git command? In fact, all flavors of :tab below seem to be ignored when used with :Git as well.
From the docs:
:[count]tab {cmd} *:tab*
Execute {cmd} and when it opens a new window open a new tab
page instead. Doesn't work for |:diffsplit|, |:diffpatch|,
|:execute| and |:normal|.
If [count] is given the new tab page appears after the tab
page [count] otherwise the new tab page will appear after the
current one.
Examples: >
:tab split " opens current buffer in new tab page
:tab help gt " opens tab page with help for "gt"
:.tab help gt " as above
:+tab help " opens tab page with help after the next
" tab page
:-tab help " opens tab page with help before the
" current one
:0tab help " opens tab page with help before the
" first one
:$tab help " opens tab page with help after the last
" one
First of all, thank you so much for Fugitive!
I've been messing around with my workflow, and created a key mapping for myself to quickly open
:Git
status window in a new tab (so that I can work with my diffs at full width and height), and when:Git
is dismissed withgq
, I'm taken back to the tab I was on before, like nothing happened :)The tab manipulation at the end there is needed because by default when a tab is closed, Vim will take you to the next tab, but I want to return to the tab from which I originally launched
:Git
.My first shot at making this mapping looked like this:
But
:-tab
doesn't seem to work "as advertised" with:Git
- instead of opening the new tab before the current tab, it opens it after the current tab, basically as if it just ignores the-
. (I tested that e.g.:-tab split
does indeed work as shown in Vim docs). Is there a reason for this not working with the:Git
command? In fact, all flavors of:tab
below seem to be ignored when used with:Git
as well.From the docs: