From 88fdfe7a8418d903b78c49c66b04173c52d9ddd7 Mon Sep 17 00:00:00 2001 From: "Kenneth Benzie (Benie)" Date: Wed, 8 May 2024 23:17:23 +0100 Subject: [PATCH] Properly cleanup fresh prompt theme If `prompt ` is used, prior to this patch the `fresh_line_one` precmd hook would not be removed. This is no longer the case and cleanup is correctly performed. --- prompt_fresh_setup | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/prompt_fresh_setup b/prompt_fresh_setup index 99544d7..15a47f4 100644 --- a/prompt_fresh_setup +++ b/prompt_fresh_setup @@ -63,6 +63,12 @@ fresh_line_one() { # First get the last commands exit code before doing anything local exit_code=$? + # Clean up if fresh is no longer the current prompt theme + if [[ "`prompt -c | tail -1 | xargs`" != "fresh" ]]; then + add-zsh-hook -d precmd fresh_line_one + return + fi + # Construct the time and directory portions of the prompt local time_stamp="%{%F{244}%}%D{%H:%M:%S}%{%f%}" [[ -n $SANDBOX_HOME ]] && \