From 8797e3ec0e5e008d90499304ddfd3c41e4143494 Mon Sep 17 00:00:00 2001 From: Grzegorz Rozdzialik Date: Mon, 22 Mar 2021 22:11:22 +0100 Subject: [PATCH] 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 a special marker and concealing to avoid false-positives when commit subjects begin with parentheses. --- autoload/fugitive.vim | 8 +++++--- syntax/fugitive.vim | 5 ++++- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/autoload/fugitive.vim b/autoload/fugitive.vim index aac79c6e93..93fd7b7c0c 100644 --- a/autoload/fugitive.vim +++ b/autoload/fugitive.vim @@ -1701,14 +1701,16 @@ function! s:ReplaceCmd(cmd) abort endfunction function! s:QueryLog(refspec) abort - let lines = s:LinesError(['log', '-n', '256', '--pretty=format:%h%x09%s', a:refspec, '--'])[0] + let lines = s:LinesError(['log', '-n', '256', '--pretty=format:%h%x09%d%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")}') + call map(lines, '{"type": "Log", "commit": v:val[0], "refs": trim(v:val[1]), "subject": join(v:val[2 : -1], "\t")}') return lines endfunction function! s:FormatLog(dict) abort - return a:dict.commit . ' ' . a:dict.subject + setlocal conceallevel=3 + setlocal concealcursor=nc + return a:dict.commit . ' ' . ((len(a:dict.refs) > 0) ? ("\x1f" . a:dict.refs . ' ') : '') . a:dict.subject endfunction function! s:FormatRebase(dict) abort diff --git a/syntax/fugitive.vim b/syntax/fugitive.vim index e84eba4e76..7425e855b3 100644 --- a/syntax/fugitive.vim +++ b/syntax/fugitive.vim @@ -23,8 +23,10 @@ syn match fugitiveDone /^done\>/ contained containedin=@fugitiveSection nextgrou syn match fugitiveStop /^stop\>/ contained containedin=@fugitiveSection nextgroup=fugitiveHash skipwhite syn match fugitiveModifier /^[MADRCU?]\{1,2} / contained containedin=@fugitiveSection syn match fugitiveSymbolicRef /\.\@!\%(\.\.\@!\|[^[:space:][:cntrl:]\:.]\)\+\.\@