I am trying to learn about custom prompts in zsh, and I am having the following issue:
With this code:
print_dir(){
echo $PWD
}
export PROMPT=$'%{%F{134}%}$(print_dir)%{%f%}
%{%F{231}%}❯%{%f%} '
I get this output instead of the result of the function:
$(project_pwd)
I know this function is not needed here, but I want to expand it as I learn.
Why is the function not executing?
You need to do setopt prompt_subst
. This is documented in the zshoptions
man page, which viewable on the zsh website.
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