From 3bd7aac84f32b84ca9c7034a6d995f0c066e0c1e Mon Sep 17 00:00:00 2001 From: Jonny Barnes Date: Sun, 19 Jan 2025 13:38:48 +0000 Subject: [PATCH] Conditionally add the `eza` command to list contents on `cd` We dont want to blindly add it multiple times, that just causes the contents of a directory to get listed multiple times when `cd`ing. --- zshrc.zsh | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/zshrc.zsh b/zshrc.zsh index 792a1d8..b50caf7 100644 --- a/zshrc.zsh +++ b/zshrc.zsh @@ -36,7 +36,10 @@ ezacd () { eza --oneline --long --classify --icons --header } -chpwd_functions=(${chpwd_functions[@]} "ezacd") +# Only add ezacd to chpwd_functions if it's not already there +if (( ${chpwd_functions[(I)ezacd]} == 0 )); then + chpwd_functions=(${chpwd_functions[@]} "ezacd") +fi # Go Lang stuff export GOPATH=$HOME/go