Jump to appropriate section for s/u on :Gstatus header
This commit is contained in:
parent
0816915503
commit
e87c612491
@ -2369,23 +2369,24 @@ endfunction
|
|||||||
|
|
||||||
function! s:Do(action, visual) abort
|
function! s:Do(action, visual) abort
|
||||||
let line = getline('.')
|
let line = getline('.')
|
||||||
|
let reload = 0
|
||||||
if !a:0 && !v:count && line =~# '^[A-Z][a-z]'
|
if !a:0 && !v:count && line =~# '^[A-Z][a-z]'
|
||||||
let header = matchstr(line, '^\S\+\ze:')
|
let header = matchstr(line, '^\S\+\ze:')
|
||||||
if len(header) && exists('*s:Do' . a:action . header . 'Header')
|
if len(header) && exists('*s:Do' . a:action . header . 'Header')
|
||||||
call s:Do{a:action}{header}Header(matchstr(line, ': \zs.*'))
|
let reload = s:Do{a:action}{header}Header(matchstr(line, ': \zs.*')) > 0
|
||||||
endif
|
else
|
||||||
let section = matchstr(line, '^\S\+')
|
let section = matchstr(line, '^\S\+')
|
||||||
if exists('*s:Do' . a:action . section . 'Heading')
|
if exists('*s:Do' . a:action . section . 'Heading')
|
||||||
call s:Do{a:action}{section}Heading(line)
|
let reload = s:Do{a:action}{section}Heading(line) > 0
|
||||||
return s:ReloadStatus()
|
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
return reload ? s:ReloadStatus() : ''
|
||||||
|
endif
|
||||||
let selection = s:Selection(a:visual ? 'v' : 'n')
|
let selection = s:Selection(a:visual ? 'v' : 'n')
|
||||||
if empty(selection)
|
if empty(selection)
|
||||||
return ''
|
return ''
|
||||||
endif
|
endif
|
||||||
call filter(selection, 'v:val.section ==# selection[0].section')
|
call filter(selection, 'v:val.section ==# selection[0].section')
|
||||||
let reload = 0
|
|
||||||
let status = 0
|
let status = 0
|
||||||
let err = ''
|
let err = ''
|
||||||
try
|
try
|
||||||
@ -2672,6 +2673,14 @@ function! s:DoToggleHeadHeader(value) abort
|
|||||||
call search('\C^index$', 'wc')
|
call search('\C^index$', 'wc')
|
||||||
endfunction
|
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
|
function! s:DoToggleUnpushedHeading(heading) abort
|
||||||
let remote = matchstr(a:heading, 'to \zs[^/]\+\ze/')
|
let remote = matchstr(a:heading, 'to \zs[^/]\+\ze/')
|
||||||
if empty(remote)
|
if empty(remote)
|
||||||
|
Loading…
Reference in New Issue
Block a user