Add foldtext for hunk headers

This commit is contained in:
Tim Pope
2019-09-01 13:38:58 -05:00
parent 88f50bba60
commit c028ea5a44

View File

@@ -6815,9 +6815,11 @@ function! fugitive#Foldtext() abort
if exists('binary') if exists('binary')
return 'Binary: '.filename return 'Binary: '.filename
else else
return (add<10&&remove<100?' ':'') . add . '+ ' . (remove<10&&add<100?' ':'') . remove . '- ' . filename return '+-' . v:folddashes . ' ' . (add<10&&remove<100?' ':'') . add . '+ ' . (remove<10&&add<100?' ':'') . remove . '- ' . filename
endif endif
elseif line_foldstart =~# '^# .*:$' elseif line_foldstart =~# '^@@\+ .* @@'
return '+-' . v:folddashes . ' ' . line_foldstart
elseif &filetype ==# 'gitcommit' && line_foldstart =~# '^# .*:$'
let lines = getline(v:foldstart, v:foldend) let lines = getline(v:foldstart, v:foldend)
call filter(lines, 'v:val =~# "^#\t"') call filter(lines, 'v:val =~# "^#\t"')
cal map(lines, "s:sub(v:val, '^#\t%(modified: +|renamed: +)=', '')") cal map(lines, "s:sub(v:val, '^#\t%(modified: +|renamed: +)=', '')")