Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

zsh prompt function not running

Tags:

zsh

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?

like image 495
richsoni Avatar asked Mar 04 '13 22:03

richsoni


1 Answers

You need to do setopt prompt_subst. This is documented in the zshoptions man page, which viewable on the zsh website.

like image 153
qqx Avatar answered Oct 05 '22 17:10

qqx