Skip to content

Commit 1c8dc4d

Browse files
committed
Show refs in log in Gstatus
Display refs (the output of %d from git log's format=pretty) next to commit summaries in Gstatus. Use basic syntax highlighting for all refs.
1 parent 156dbcd commit 1c8dc4d

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

autoload/fugitive.vim

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1701,14 +1701,15 @@ function! s:ReplaceCmd(cmd) abort
17011701
endfunction
17021702

17031703
function! s:QueryLog(refspec) abort
1704-
let lines = s:LinesError(['log', '-n', '256', '--pretty=format:%h%x09%s', a:refspec, '--'])[0]
1704+
let lines = s:LinesError(['log', '-n', '256', '--pretty=format:%h%x09%d%x09%s', a:refspec, '--'])[0]
17051705
call map(lines, 'split(v:val, "\t", 1)')
1706-
call map(lines, '{"type": "Log", "commit": v:val[0], "subject": join(v:val[1 : -1], "\t")}')
1706+
call map(lines, '{"type": "Log", "commit": v:val[0], "ref": v:val[1], "subject": join(v:val[2 : -1], "\t")}')
17071707
return lines
17081708
endfunction
17091709

17101710
function! s:FormatLog(dict) abort
1711-
return a:dict.commit . ' ' . a:dict.subject
1711+
echo a:dict.ref
1712+
return a:dict.commit . ((len(a:dict.ref) > 0) ? (a:dict.ref . ' ') : ' ') . a:dict.subject
17121713
endfunction
17131714

17141715
function! s:FormatRebase(dict) abort

syntax/fugitive.vim

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,9 @@ syn match fugitiveDone /^done\>/ contained containedin=@fugitiveSection nextgrou
2323
syn match fugitiveStop /^stop\>/ contained containedin=@fugitiveSection nextgroup=fugitiveHash skipwhite
2424
syn match fugitiveModifier /^[MADRCU?]\{1,2} / contained containedin=@fugitiveSection
2525
syn match fugitiveSymbolicRef /\.\@!\%(\.\.\@!\|[^[:space:][:cntrl:]\:.]\)\+\.\@<!/ contained
26-
syn match fugitiveHash /^\x\{4,\}\S\@!/ contained containedin=@fugitiveSection
26+
syn match fugitiveHash /^\x\{4,\}\S\@!/ contained containedin=@fugitiveSection nextgroup=fugitiveRefs
2727
syn match fugitiveHash /\S\@<!\x\{4,\}\S\@!/ contained
28+
syn match fugitiveRefs /([^)]\+)/hs=s+1,he=e-1 contained containedin=@fugitiveSection
2829

2930
syn region fugitiveHunk start=/^\%(@@\+ -\)\@=/ end=/^\%([A-Za-z?@]\|$\)\@=/ contains=@fugitiveDiff containedin=@fugitiveSection fold
3031

@@ -51,6 +52,7 @@ hi def link fugitiveStagedModifier Typedef
5152
hi def link fugitiveInstruction Type
5253
hi def link fugitiveStop Function
5354
hi def link fugitiveHash Identifier
55+
hi def link fugitiveRefs Function
5456
hi def link fugitiveSymbolicRef Function
5557
hi def link fugitiveCount Number
5658

0 commit comments

Comments
 (0)