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

Re: triviality with prompts



On 12/02/2014 07:02 PM, Bart Schaefer wrote:
On Dec 2,  4:17pm, Ray Andrews wrote:
}
} PS3  will permit that variable substitution even without
} " setopt prompt_subst ", whereas PS1 requires it.

I think you've deluded yourself somehow.  PS3 behaves just like all the
other prompts.
A red herring there.
I had this form, which seems not to need the option:

PS3=$'\n '"$_red MAKE A SELECTION ... "

... and I changed it to this form, which does need it:
PS3=$'\n $_red MAKE A SELECTION ... '

... whereas in PS1 I had the (what look very much like) single quotes
only version, which does need it, so one seemed to need it, and the
other not.

... so the issue was quote voodoo, as usual.

Once again you're confused about how quoting works.  The variable isn't
inside single quotes at the time the prompt is expanded.  In fact, in your
example $'...' is NOT the same as single quotes.
God knows. If ' ... ' isn't single quotes then is sure has me fooled. One day it will all make sense. I know everything is different with prompt strings tho,
it's a world unto itself where single quotes are not single quotes.
If you'd read a little further through the scrolls, you'd have seen you
need neither _red=$'%{\e[1;31m%}' nor prompt_subst:

PS3=$'\n %F{red} MAKE A SELECTION ... %f'
PS1=$'\n%F{yellow}%l %F{red}%m %F{green}%n %F{blue}%d %F{magenta}%(3L.%L.)$ %f'
There are so many scrolls!  I'll get there.  Anyway, I like my way better.
Even knowing only a tiny bit about the prompt, it is astonishing how much
love went into that.




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