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="" removed_lines=""
git diff -U0 $kak_bufname | { git diff -U0 $kak_bufname | {
line=0 line=0
flags="0:red:." flags="0|red|."
while read; do while read; do
if [[ $REPLY =~ ^---.* ]]; then if [[ $REPLY =~ ^---.* ]]; then
continue continue
elif [[ $REPLY =~ ^@@.-[0-9]+(,[0-9]+)?.\+([0-9]+)(,[0-9]+)?.@@.* ]]; then elif [[ $REPLY =~ ^@@.-[0-9]+(,[0-9]+)?.\+([0-9]+)(,[0-9]+)?.@@.* ]]; then
line=${BASH_REMATCH[2]} line=${BASH_REMATCH[2]}
elif [[ $REPLY =~ ^\+ ]]; then elif [[ $REPLY =~ ^\+ ]]; then
flags="$flags,$line:green:+" flags="$flags;$line|green|+"
((line++)) ((line++))
elif [[ $REPLY =~ ^\- ]]; then elif [[ $REPLY =~ ^\- ]]; then
flags="$flags,$line:red:-" flags="$flags;$line|red|-"
fi fi
done done
echo "setb git_diff_flags '$flags'" echo "setb git_diff_flags '$flags'"