Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: problem with function in prompt



Am 24.03.2011 21:23, schrieb Stephen Prater:
> 
> The problem is that it never re-executes the function in the prompt ----
> 
> setopt prompt_subst
> 
> PROMPT_INFO="$(draw f21 ul hbar) $(host_name)- %L
> $(draw f21 ll hbar) $(dir_name) $(free_mem)"
> DEF_PROMPT="${(e)${PROMPT_INFO}} %F{cyan} [ %f"
> INS_MODE_PROMPT="${(e)${PROMPT_INFO}} %F{red} [ %f"
> 
> 
> The value that appears in the prompt is always the same as the one when
> the shell was initially executed.

You should use FOO='$bla' instead of FOO="$bla" -- with the latter, $bla
is evaluated while assigning -- with the first one, $bla is evaluated
while evaluating $FOO.

This means, with your current way, the variables and functions are all
computed while setting the prompt variable -- and then there is nothing
left to evaluate while printing the prompt :)

HTH,
- René

Attachment: signature.asc
Description: OpenPGP digital signature



Messages sorted by: Reverse Date, Date, Thread, Author