From aff4e160fa44ba8d5739c3f9299848b08b97669e Mon Sep 17 00:00:00 2001 From: Yuan Chiu Date: Wed, 23 Apr 2025 18:00:07 +0800 Subject: [PATCH] =?UTF-8?q?fix=20.zshrc:=20imgcat=20(=E6=9C=83=E8=A2=ABiTe?= =?UTF-8?q?rm2=E4=BD=94=E8=B5=B0)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- dot_zshrc | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/dot_zshrc b/dot_zshrc index b0312aa..7918f46 100644 --- a/dot_zshrc +++ b/dot_zshrc @@ -174,13 +174,15 @@ test -e "${HOME}/.iterm2_shell_integration.zsh" && source "${HOME}/.iterm2_shell [[ -s "/etc/grc.zsh" ]] && source /etc/grc.zsh # 圖片顯示 -imgcat() { - if [[ -z "$1" ]]; then - echo "❌ 請指定圖片檔案,例如:imgcat ~/Pictures/foo.png" - return 1 - fi +if ! type imgcat &>/dev/null && command -v magick &>/dev/null; then + imgcat() { + if [[ -z "$1" ]]; then + echo "❌ 請指定圖片檔案,例如:imgcat ~/Pictures/foo.png" + return 1 + fi - magick "$1" -geometry 800x480 sixel:- -} + magick "$1" -geometry 800x480 sixel:- + } +fi zinit light mass8326/zsh-chezmoi