Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disable all zsh hooks on theme change #654

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 3 additions & 6 deletions bin/antigen.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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.
Expand Down
9 changes: 3 additions & 6 deletions src/commands/theme.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
}