1
1
mirror of https://github.com/mawww/kakoune.git synced 2024-11-27 12:16:22 +03:00

git-tools.kak uses $kak_buffile rather than $kak_bufname

This commit is contained in:
Maxime Coste 2014-03-02 01:05:01 +00:00
parent bd331742d2
commit ffe4ea4722

View File

@ -40,7 +40,7 @@ def -shell-params git %{ %sh{
( (
echo "eval -client '$kak_client' %{ echo "eval -client '$kak_client' %{
try %{ addhl flag_lines magenta git_blame_flags } try %{ addhl flag_lines magenta git_blame_flags }
set buffer=$kak_bufname git_blame_flags '' set buffer=$kak_buffile git_blame_flags ''
}" | socat -u stdin UNIX-CONNECT:/tmp/kak-${kak_session} }" | socat -u stdin UNIX-CONNECT:/tmp/kak-${kak_session}
declare -A authors declare -A authors
declare -A dates declare -A dates
@ -51,9 +51,9 @@ def -shell-params git %{ %sh{
for (( i=1; $i < $count; i++ )); do for (( i=1; $i < $count; i++ )); do
flag="$flag:$(($line+$i))|black|$text" flag="$flag:$(($line+$i))|black|$text"
done done
echo "set -add buffer=$kak_bufname git_blame_flags %{${flag}}" | socat -u stdin UNIX-CONNECT:/tmp/kak-${kak_session} echo "set -add buffer=$kak_buffile git_blame_flags %{${flag}}" | socat -u stdin UNIX-CONNECT:/tmp/kak-${kak_session}
} }
git blame --incremental $kak_bufname | ( while read blame_line; do git blame --incremental $kak_buffile | ( while read blame_line; do
if [[ $blame_line =~ ([0-9a-f]{40}).([0-9]+).([0-9]+).([0-9]+) ]]; then if [[ $blame_line =~ ([0-9a-f]{40}).([0-9]+).([0-9]+).([0-9]+) ]]; then
send_flags send_flags
sha=${BASH_REMATCH[1]} sha=${BASH_REMATCH[1]}
@ -69,7 +69,7 @@ def -shell-params git %{ %sh{
} }
update_diff() { update_diff() {
git diff -U0 $kak_bufname | { git diff -U0 $kak_buffile | {
local line=0 local line=0
local flags="0|red|." local flags="0|red|."
while read; do while read; do
@ -97,7 +97,7 @@ def -shell-params git %{ %sh{
;; ;;
update-diff) update_diff ;; update-diff) update_diff ;;
add) add)
name="${2:-${kak_bufname}}" name="${2:-${kak_buffile}}"
if git add -- "${name}"; then if git add -- "${name}"; then
echo "echo -color Information 'git: added ${name}'" echo "echo -color Information 'git: added ${name}'"
else else