From 1ba0af650ac575a7d35b10146d2e7a7b3b2e2ae6 Mon Sep 17 00:00:00 2001 From: Jacob Tomaw Date: Tue, 19 Nov 2019 12:47:12 -0500 Subject: Use safer append to hook function arrays (#8406) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Use add-zsh-hook to add functions to hooks. That way they won't be added again when doing `source ~/.zshrc` multiple times. Co-authored-by: Marc Cornellà --- themes/pygmalion.zsh-theme | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'themes/pygmalion.zsh-theme') diff --git a/themes/pygmalion.zsh-theme b/themes/pygmalion.zsh-theme index 5f5fe7f9a..cd773e4a4 100644 --- a/themes/pygmalion.zsh-theme +++ b/themes/pygmalion.zsh-theme @@ -12,7 +12,8 @@ prompt_setup_pygmalion(){ base_prompt_nocolor=$(echo "$base_prompt" | perl -pe "s/%\{[^}]+\}//g") post_prompt_nocolor=$(echo "$post_prompt" | perl -pe "s/%\{[^}]+\}//g") - precmd_functions+=(prompt_pygmalion_precmd) + autoload -U add-zsh-hook + add-zsh-hook precmd prompt_pygmalion_precmd } prompt_pygmalion_precmd(){ @@ -30,5 +31,3 @@ prompt_pygmalion_precmd(){ } prompt_setup_pygmalion - - -- cgit v1.2.3-70-g09d2