commit e87c612491c331ed58416e3577777e34694971d0 (tree)
parent 0816915503ae846ca978c60a1945e3218da5863a
Author: Tim Pope <code@tpope.net>
Date: Sat, 6 Jul 2019 03:50:40 -0400
Jump to appropriate section for s/u on :Gstatus header
Diffstat:
1 file changed, 16 insertions(+), 7 deletions(-)
diff --git a/autoload/fugitive.vim b/autoload/fugitive.vim
@@ -2369,23 +2369,24 @@ endfunction
function! s:Do(action, visual) abort
let line = getline('.')
+ let reload = 0
if !a:0 && !v:count && line =~# '^[A-Z][a-z]'
let header = matchstr(line, '^\S\+\ze:')
if len(header) && exists('*s:Do' . a:action . header . 'Header')
- call s:Do{a:action}{header}Header(matchstr(line, ': \zs.*'))
- endif
- let section = matchstr(line, '^\S\+')
- if exists('*s:Do' . a:action . section . 'Heading')
- call s:Do{a:action}{section}Heading(line)
- return s:ReloadStatus()
+ let reload = s:Do{a:action}{header}Header(matchstr(line, ': \zs.*')) > 0
+ else
+ let section = matchstr(line, '^\S\+')
+ if exists('*s:Do' . a:action . section . 'Heading')
+ let reload = s:Do{a:action}{section}Heading(line) > 0
+ endif
endif
+ return reload ? s:ReloadStatus() : ''
endif
let selection = s:Selection(a:visual ? 'v' : 'n')
if empty(selection)
return ''
endif
call filter(selection, 'v:val.section ==# selection[0].section')
- let reload = 0
let status = 0
let err = ''
try
@@ -2672,6 +2673,14 @@ function! s:DoToggleHeadHeader(value) abort
call search('\C^index$', 'wc')
endfunction
+function! s:DoStageHeadHeader(value) abort
+ exe search('^Untracked\|^Unstaged', 'wn') + 1
+endfunction
+
+function! s:DoUnstageHeadHeader(value) abort
+ exe search('^Staged', 'wn') + 1
+endfunction
+
function! s:DoToggleUnpushedHeading(heading) abort
let remote = matchstr(a:heading, 'to \zs[^/]\+\ze/')
if empty(remote)