From fc06e9d5770496d275a2ccbf3cd21ffd97ea313c Mon Sep 17 00:00:00 2001 From: DC* Date: Mon, 12 Feb 2018 12:42:11 -0300 Subject: [PATCH] Disable all zsh hooks on theme change --- bin/antigen.zsh | 9 +++------ src/commands/theme.zsh | 9 +++------ 2 files changed, 6 insertions(+), 12 deletions(-) diff --git a/bin/antigen.zsh b/bin/antigen.zsh index aeba2a7a..a55284e1 100644 --- a/bin/antigen.zsh +++ b/bin/antigen.zsh @@ -1254,7 +1254,7 @@ antigen-theme () { # Remove currently active hooks, this may leave the prompt broken if the # new theme is not found/can not be loaded. We should have a way to test if # a theme/bundle can be loaded/exists. - #-antigen-theme-reset-hooks + -antigen-theme-reset-hooks if [[ "$1" != */* && "$1" != --* ]]; then # The first argument is just a name of the plugin, to be picked up from @@ -1273,7 +1273,7 @@ antigen-theme () { if [[ "$_ANTIGEN_THEME" != "" && $_ANTIGEN_BUNDLE_RECORD[(I)*$_ANTIGEN_THEME*] > 0 ]]; then _ANTIGEN_BUNDLE_RECORD[$_ANTIGEN_BUNDLE_RECORD[(I)*$_ANTIGEN_THEME*]]=() fi - + # Set new theme as active. _ANTIGEN_THEME=$record fi @@ -1293,10 +1293,7 @@ antigen-theme () { fi for hook in chpwd precmd preexec periodic; do - add-zsh-hook -D "${hook}" "prompt_*" - # common in omz themes - add-zsh-hook -D "${hook}" "*_${hook}" - add-zsh-hook -d "${hook}" "vcs_info" + add-zsh-hook -D "${hook}" "*" done } # Updates the bundles or a single bundle. diff --git a/src/commands/theme.zsh b/src/commands/theme.zsh index 86e92520..d0cb2164 100644 --- a/src/commands/theme.zsh +++ b/src/commands/theme.zsh @@ -33,7 +33,7 @@ antigen-theme () { # Remove currently active hooks, this may leave the prompt broken if the # new theme is not found/can not be loaded. We should have a way to test if # a theme/bundle can be loaded/exists. - #-antigen-theme-reset-hooks + -antigen-theme-reset-hooks if [[ "$1" != */* && "$1" != --* ]]; then # The first argument is just a name of the plugin, to be picked up from @@ -52,7 +52,7 @@ antigen-theme () { if [[ "$_ANTIGEN_THEME" != "" && $_ANTIGEN_BUNDLE_RECORD[(I)*$_ANTIGEN_THEME*] > 0 ]]; then _ANTIGEN_BUNDLE_RECORD[$_ANTIGEN_BUNDLE_RECORD[(I)*$_ANTIGEN_THEME*]]=() fi - + # Set new theme as active. _ANTIGEN_THEME=$record fi @@ -72,9 +72,6 @@ antigen-theme () { fi for hook in chpwd precmd preexec periodic; do - add-zsh-hook -D "${hook}" "prompt_*" - # common in omz themes - add-zsh-hook -D "${hook}" "*_${hook}" - add-zsh-hook -d "${hook}" "vcs_info" + add-zsh-hook -D "${hook}" "*" done }