diff --git a/autoload/fugitive.vim b/autoload/fugitive.vim index 1213af0..b1db038 100644 --- a/autoload/fugitive.vim +++ b/autoload/fugitive.vim @@ -2465,8 +2465,8 @@ function! s:ReplaceCmd(cmd) abort endif endfunction -function! s:QueryLog(refspec) abort - let lines = s:LinesError(['log', '-n', '256', '--pretty=format:%h%x09%s', a:refspec, '--'])[0] +function! s:QueryLog(refspec, limit) abort + let lines = s:LinesError(['log', '-n', '' . a:limit, '--pretty=format:%h%x09%s', a:refspec, '--'])[0] call map(lines, 'split(v:val, "\t", 1)') call map(lines, '{"type": "Log", "commit": v:val[0], "subject": join(v:val[1 : -1], "\t")}') return lines @@ -2516,6 +2516,20 @@ function! s:AddSection(label, lines, ...) abort call append(line('$'), ['', a:label . (len(note) ? ': ' . note : ' (' . len(a:lines) . ')')] + s:Format(a:lines)) endfunction +function! s:AddLogSection(label, a, b) abort + let limit = 256 + let log = s:QueryLog(a:a . '..' . a:b, limit) + if empty(log) + return + elseif len(log) == limit + call remove(log, -1) + let label = a:label . ' (' . (limit - 1). '+)' + else + let label = a:label . ' (' . len(log) . ')' + endif + call append(line('$'), ['', label] + s:Format(log)) +endfunction + let s:rebase_abbrevs = { \ 'p': 'pick', \ 'r': 'reword', @@ -2767,16 +2781,16 @@ function! fugitive#BufReadStatus() abort let staged_end = len(staged) ? line('$') : 0 if len(pull) && get(props, 'branch.ab') !~# ' -0$' - call s:AddSection('Unpulled from ' . pull, s:QueryLog(head . '..' . pull)) + call s:AddLogSection('Unpulled from ' . pull, head, pull) endif if len(push) && push !=# pull - call s:AddSection('Unpulled from ' . push, s:QueryLog(head . '..' . push)) + call s:AddLogSection('Unpulled from ' . push, head, push) endif if len(pull) && push !=# pull - call s:AddSection('Unpushed to ' . pull, s:QueryLog(pull . '..' . head)) + call s:AddLogSection('Unpushed to ' . pull, pull, head) endif if len(push) && !(push ==# pull && get(props, 'branch.ab') =~# '^+0 ') - call s:AddSection('Unpushed to ' . push, s:QueryLog(push . '..' . head)) + call s:AddLogSection('Unpushed to ' . push, push, head) endif setlocal nomodified readonly noswapfile @@ -3995,7 +4009,7 @@ function! s:StageSeek(info, fallback) abort if empty(info.heading) return a:fallback endif - let line = search('^' . escape(info.heading, '^$.*[]~\') . ' (\d\+)$', 'wn') + let line = search('^' . escape(info.heading, '^$.*[]~\') . ' (\d\++\=)$', 'wn') if !line for section in get({'Staged': ['Unstaged', 'Untracked'], 'Unstaged': ['Untracked', 'Staged'], 'Untracked': ['Unstaged', 'Staged']}, info.section, []) let line = search('^' . section, 'wn') @@ -4224,7 +4238,7 @@ function! s:StageInfo(...) abort let index = 0 while len(getline(slnum - 1)) && empty(heading) let slnum -= 1 - let heading = matchstr(getline(slnum), '^\u\l\+.\{-\}\ze (\d\+)$') + let heading = matchstr(getline(slnum), '^\u\l\+.\{-\}\ze (\d\++\=)$') if empty(heading) && getline(slnum) !~# '^[ @\+-]' let index += 1 endif @@ -4279,7 +4293,7 @@ function! s:Selection(arg1, ...) abort let index = 0 while empty(heading) let slnum -= 1 - let heading = matchstr(getline(slnum), '^\u\l\+.\{-\}\ze (\d\+)$') + let heading = matchstr(getline(slnum), '^\u\l\+.\{-\}\ze (\d\++\=)$') if empty(heading) && getline(slnum) !~# '^[ @\+-]' let index += 1 endif @@ -4299,7 +4313,7 @@ function! s:Selection(arg1, ...) abort let lnum = first - (arg1 == flnum ? 0 : 1) let root = s:Tree() . '/' while lnum <= last - let heading = matchstr(line, '^\u\l\+\ze.\{-\}\ze (\d\+)$') + let heading = matchstr(line, '^\u\l\+\ze.\{-\}\ze (\d\++\=)$') if len(heading) let template.heading = heading let template.section = matchstr(heading, '^\u\l\+') diff --git a/syntax/fugitive.vim b/syntax/fugitive.vim index 0ed82dd..e61b34f 100644 --- a/syntax/fugitive.vim +++ b/syntax/fugitive.vim @@ -13,10 +13,10 @@ syn match fugitiveHeader /^Pull:\|^Rebase:\|^Merge:\|^Push:/ nextgroup=fugitiveS syn match fugitiveHelpHeader /^Help:/ nextgroup=fugitiveHelpTag skipwhite syn match fugitiveHelpTag /\S\+/ contained -syn region fugitiveSection start=/^\%(.*(\d\+)$\)\@=/ contains=fugitiveHeading end=/^$/ +syn region fugitiveSection start=/^\%(.*(\d\++\=)$\)\@=/ contains=fugitiveHeading end=/^$/ syn cluster fugitiveSection contains=fugitiveSection -syn match fugitiveHeading /^[A-Z][a-z][^:]*\ze (\d\+)$/ contains=fugitivePreposition contained nextgroup=fugitiveCount skipwhite -syn match fugitiveCount /(\d\+)/hs=s+1,he=e-1 contained +syn match fugitiveHeading /^[A-Z][a-z][^:]*\ze (\d\++\=)$/ contains=fugitivePreposition contained nextgroup=fugitiveCount skipwhite +syn match fugitiveCount /(\d\++\=)/hs=s+1,he=e-1 contained syn match fugitivePreposition /\<\%([io]nto\|from\|to\|Rebasing\%( detached\)\=\)\>/ transparent contained nextgroup=fugitiveHash,fugitiveSymbolicRef skipwhite syn match fugitiveInstruction /^\l\l\+\>/ contained containedin=@fugitiveSection nextgroup=fugitiveHash skipwhite @@ -30,10 +30,10 @@ syn match fugitiveHash /\S\@