Skip to content

Commit 018ac73

Browse files
committed
Add commit hash to the default fugitive display format
- Improve readability of the pretty format string for the `git show` command. - Include `commit %H` to the `git show` output, which is one of the most useful and important information for a git commit being displayed.
1 parent 8d4e8d4 commit 018ac73

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

autoload/fugitive.vim

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3193,7 +3193,19 @@ function! fugitive#BufReadCmd(...) abort
31933193
if b:fugitive_display_format
31943194
call s:ReplaceCmd([dir, 'cat-file', b:fugitive_type, rev])
31953195
else
3196-
call s:ReplaceCmd([dir, '-c', 'diff.noprefix=false', '-c', 'log.showRoot=false', 'show', '--no-color', '-m', '--first-parent', '--pretty=format:tree%x20%T%nparent%x20%P%nauthor%x20%an%x20<%ae>%x20%ad%ncommitter%x20%cn%x20<%ce>%x20%cd%nencoding%x20%e%n%n%s%n%n%b', rev])
3196+
let s:format = substitute(join([
3197+
\ 'commit %H',
3198+
\ 'tree %T',
3199+
\ 'parent %P',
3200+
\ 'author %an <%ae> %ad',
3201+
\ 'committer %cn <%ce> %cd',
3202+
\ 'encoding %e',
3203+
\ '',
3204+
\ '%s',
3205+
\ '',
3206+
\ '%b'
3207+
\], '%n'), ' ', '%x20', 'g')
3208+
call s:ReplaceCmd([dir, '-c', 'diff.noprefix=false', '-c', 'log.showRoot=false', 'show', '--no-color', '-m', '--first-parent', '--pretty=' . s:format, rev])
31973209
keepjumps 1
31983210
keepjumps call search('^parent ')
31993211
if getline('.') ==# 'parent '

0 commit comments

Comments
 (0)