Skip to content

Commit da134a4

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. Use digraphs to reduce the possibility of false positives when syntax highlighting.
1 parent 857496c commit da134a4

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

autoload/fugitive.vim

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1701,14 +1701,14 @@ 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%s%x09%D', a:refspec, '--'])[0]
17051705
call map(lines, 'split(v:val, "\t")')
1706-
call map(lines, '{"type": "Log", "commit": v:val[0], "subject": v:val[-1]}')
1706+
call map(lines, '{"type": "Log", "commit": v:val[0], "subject": v:val[1], "ref": get(v:val, 2, "")}')
17071707
return lines
17081708
endfunction
17091709

17101710
function! s:FormatLog(dict) abort
1711-
return a:dict.commit . ' ' . a:dict.subject
1711+
return a:dict.commit . ' ' . a:dict.subject . ((len(a:dict.ref) > 0) ? (' «' . a:dict.ref . '»') : '')
17121712
endfunction
17131713

17141714
function! s:FormatRebase(dict) abort

syntax/fugitive.vim

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ syn match fugitiveModifier /^[MADRCU?]\{1,2} / contained containedin=@fugitiveSe
2525
syn match fugitiveSymbolicRef /\.\@!\%(\.\.\@!\|[^[:space:][:cntrl:]\:.]\)\+\.\@<!/ contained
2626
syn match fugitiveHash /^\x\{4,\}\S\@!/ contained containedin=@fugitiveSection
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)