From f2a8eb33ad31ffa1ded299837040176433978124 Mon Sep 17 00:00:00 2001 From: Andrew Janke Date: Tue, 31 Mar 2015 05:48:30 -0400 Subject: [PATCH] Reset all prompt levels when resetting theme. Ignore aliases for PROMPT* variables. --- plugins/themes/themes.plugin.zsh | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/plugins/themes/themes.plugin.zsh b/plugins/themes/themes.plugin.zsh index bc84f39e8..6cdf23e69 100644 --- a/plugins/themes/themes.plugin.zsh +++ b/plugins/themes/themes.plugin.zsh @@ -79,7 +79,7 @@ function _omz_load_theme_from_file() { params_added=(${params_after:|params_before}) ignore_params=(LINENO RANDOM _ parameters prompt values_before modules \ params_added ignore_params params_before params_after params_changed \ - SECONDS TTYIDLE) + SECONDS TTYIDLE PS1 PS2 PS3 PS4 RPS1 RPS2) params_before=(${params_before:|ignore_params}) local params_changed params_changed=() @@ -104,7 +104,7 @@ function _omz_load_theme_from_file() { if [[ -n $params_changed ]]; then printf '=== %s ===\n%s\n' "Theme changed parameters:" ${(F)params_changed} fi - if [[ -n "$_OMZ_THEME_CHPWD_FUNCTIONS$_OMZ_THEME_PRECMD_FUNCTIONS$_OMZ_THEME_PREEXEC_FUNCTIONS" ]]; then + if [[ -n "${_OMZ_THEME_CHPWD_FUNCTIONS}${_OMZ_THEME_PRECMD_FUNCTIONS}${_OMZ_THEME_PREEXEC_FUNCTIONS}" ]]; then printf '=== %s ===\n' "Theme added hooks:" if [[ -n $_OMZ_THEME_CHPWD_FUNCTIONS ]]; then echo "Theme added chpwd hooks: $_OMZ_THEME_CHPWD_FUNCTIONS" @@ -142,7 +142,12 @@ function _omz_source_theme_file() { # It will also remove any hook functions installed by the current theme, if it # was loaded by the theme() function function _omz_reset_theme() { + # Prompts PROMPT="%n@%m:%~%# " + PROMPT2='%_> ' + PROMPT3='?# ' + PROMPT4='+%N:%i> ' + unset RPROMPT RPROMPT2 # This assumes that all ZSH_THEME__* variables are owned by # OMZ theming, and can be reset en masse