rc tools git: blame to hide blame if already shown

This simplifies the UI (no need to add multiple mappings) and might
obsolete hide-blame.
This commit is contained in:
Johannes Altmanninger 2024-01-21 11:49:47 +01:00
parent 6b03f4dc4f
commit 462bf9ff6a

View File

@ -62,13 +62,12 @@ define-command -params 1.. \
Available commands: Available commands:
add add
apply (alias for "patch git apply") apply (alias for "patch git apply")
blame blame (toggle blame annotations)
checkout checkout
commit commit
diff diff
edit edit
grep grep
hide-blame
hide-diff hide-diff
init init
log log
@ -91,7 +90,6 @@ define-command -params 1.. \
diff \ diff \
edit \ edit \
grep \ grep \
hide-blame \
hide-diff \ hide-diff \
init \ init \
log \ log \
@ -153,7 +151,18 @@ define-command -params 1.. \
}" }"
} }
hide_blame() {
printf %s "
set-option buffer=$kak_bufname git_blame_flags $kak_timestamp
remove-highlighter window/git-blame
"
}
run_git_blame() { run_git_blame() {
if [ "${kak_opt_git_blame_flags#* *}" != "${kak_opt_git_blame_flags}" ]; then
hide_blame
exit
fi
( (
cd_bufdir cd_bufdir
printf %s "evaluate-commands -client '$kak_client' %{ printf %s "evaluate-commands -client '$kak_client' %{
@ -365,10 +374,7 @@ define-command -params 1.. \
run_git_blame "$@" run_git_blame "$@"
;; ;;
hide-blame) hide-blame)
printf %s " hide_blame
set-option buffer=$kak_bufname git_blame_flags $kak_timestamp
remove-highlighter window/git-blame
"
;; ;;
show-diff) show-diff)
echo 'try %{ add-highlighter window/git-diff flag-lines Default git_diff_flags }' echo 'try %{ add-highlighter window/git-diff flag-lines Default git_diff_flags }'