From 0e7171bd5fa70f165965280a4e638165db809405 Mon Sep 17 00:00:00 2001 From: Julian Prein Date: Wed, 25 Jun 2025 14:11:41 +0200 Subject: [PATCH] zsh:diffcmds: Make diff_cmd overwritable by caller --- .config/zsh/zshrc.d/40-functions.zsh | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/.config/zsh/zshrc.d/40-functions.zsh b/.config/zsh/zshrc.d/40-functions.zsh index 462c477..d0070bf 100644 --- a/.config/zsh/zshrc.d/40-functions.zsh +++ b/.config/zsh/zshrc.d/40-functions.zsh @@ -673,10 +673,13 @@ diffcmds() { # TODO: Support own arguments for example to switch the placeholder or the # diffcmd # TODO: Find better way to dequote pipes. (e.g. `%|` to use a pipe?) - local diff_cmd i arg ps_sub + local i arg ps_sub local -a template args final_cmd - if (( $+commands[vimdiff] && ! $+commands[diff] )); then + local diff_cmd="$diff_cmd" + if [[ -n $diff_cmd ]]; then + # already set by caller + elif (( $+commands[vimdiff] && ! $+commands[diff] )); then diff_cmd=vimdiff elif (( $+commands[diff] && ! $+commands[vimdiff] )); then diff_cmd=diff