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

Re: How to stop dir expansion in the prompt?


Problem solved.

2014-11-05 0:43 GMT+08:00 Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>:
> On Nov 4,  5:42pm, Shiyao Ma wrote:
> }
> } When outside a vcs directory, `echo $vcs_info_msg_0_` gives %d, which
> } is the same string in zstyle nvcsformat.
> Ah, of course.  You want:
> PROMPT="%(?.${success_color}.${failure_color})${SSH_TTY:+[%n@%m]}%B%${max_path_chars}<...<"'${${(%)vcs_info_msg_0_}/#$HOME/~}'"%<<%(!.${root_char}.${user_char})%b%f
> "
> The (%) in ${(%)vcs_info_msg_0_} tells it to do prompt expansion right
> away, rather than return the format for the prompt to expand later, so
> then the /#$HOME/ can do its work.
> } Yup. One minor question. No matter how many % I write, like this
> } one:echo  ${vcs_info_msg_0_%%%%%}, it's the same as echo
> } ${vcs_info_msg_0_}. So what's % here?
>      If the PATTERN matches the end of the value of NAME, then
>      substitute the value of NAME with the matched portion deleted;
>      otherwise, just substitute the value of NAME.  In the first form,
>      the smallest matching pattern is preferred; in the second form,
>      the largest matching pattern is preferred.
> So after the first two %%, any more % you add become the pattern, which
> is unlikely to match in a directory name.
> I don't know why Julien left %% in there with no pattern after it.



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