commit c028ea5a441a54c9e3a9e984cd229a165db297ec (tree)
parent 88f50bba604f353c21dea554bf9932ad5c76265e
Author: Tim Pope <code@tpope.net>
Date: Sun, 1 Sep 2019 13:38:58 -0500
Add foldtext for hunk headers
Diffstat:
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/autoload/fugitive.vim b/autoload/fugitive.vim
@@ -6815,9 +6815,11 @@ function! fugitive#Foldtext() abort
if exists('binary')
return 'Binary: '.filename
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
- elseif line_foldstart =~# '^# .*:$'
+ elseif line_foldstart =~# '^@@\+ .* @@'
+ return '+-' . v:folddashes . ' ' . line_foldstart
+ elseif &filetype ==# 'gitcommit' && line_foldstart =~# '^# .*:$'
let lines = getline(v:foldstart, v:foldend)
call filter(lines, 'v:val =~# "^#\t"')
cal map(lines, "s:sub(v:val, '^#\t%(modified: +|renamed: +)=', '')")