I have a few functions in my Z shell
precmd
function list.
I can see them with
echo $precmd_functions
In this list I can see a function called _ntfy_precmd
How can I remove it from the function list?
(This function was added after installing https://github.com/dschep/ntfy)
Just as with adding functions to precmd
you have two choices:
Directly manipulate the precmd_functions
array:
precmd_functions=(${precmd_functions:#_ntfy_precmd})
The ${name:#pattern}
parameter expansion, when used on an array, removes all elements matching pattern
from the expansion of name
.
Use the add-zsh-hook
utility to remove functions from the hook functions lists:
add-zsh-hook -d precmd _ntfy_precmd
If zsh
tells you that there is no add-zsh-hook
command, you can load it with
autoload -Uz add-zsh-hook
BTW: You can list the functions with add-zsh-hook -L [HOOK]
, too.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With