git-tools: fix git-diff-show

This commit is contained in:
Maxime Coste 2013-04-11 22:41:43 +02:00
parent 3f5dc9e1cb
commit dcc054a785

View File

@ -5,17 +5,17 @@ def git-diff-update-buffer %{ %sh{
removed_lines=""
git diff -U0 $kak_bufname | {
line=0
flags="0:red:."
flags="0|red|."
while read; do
if [[ $REPLY =~ ^---.* ]]; then
continue
elif [[ $REPLY =~ ^@@.-[0-9]+(,[0-9]+)?.\+([0-9]+)(,[0-9]+)?.@@.* ]]; then
line=${BASH_REMATCH[2]}
elif [[ $REPLY =~ ^\+ ]]; then
flags="$flags,$line:green:+"
flags="$flags;$line|green|+"
((line++))
elif [[ $REPLY =~ ^\- ]]; then
flags="$flags,$line:red:-"
flags="$flags;$line|red|-"
fi
done
echo "setb git_diff_flags '$flags'"