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

Re: vcs_info: can't get %c and %u to perform as expected

Alex Satrapa wrote:
> I'm trying to set up git/hg information in my ZSH prompt. At this
> point I can do the following without using vcs_info (the RPROMPT):
>  10:59 .zsh.d ➤                    ±master!
> Here you see the time, the name of the current directory (the path is
> summarised in the window title), then over on the right hand side the
> ± means it's a git repository (there would be a ☿ if it was
> Mercurial), the current branch name and a '!' to indicate that the
> repository is dirty.
> I am expecting that setting 'use-prompt-escapes' to true will cause

`use-prompt-escapes' has nothing to do with normal `vcs_info' execution,
as documented it is *only* used by `vcs_info_lastmsg'.

> the %u and %c escapes to be replaced with 'U' and 'S' if the current
> repository has unstaged or staged changes (as per the ZSH
> manual). Note that the "!" on my current RPROMPT will be set if the
> repository is "dirty" (i.e.: has any changes at all, tracked or
> untracked), so there are in fact unstaged changes in this directory.

You need to set the `check-for-changes' style. After that, it should
work.  I'm not sure if with the hg backend, it's also required to set
the `get-revision' style (Seth?).  If it is, that's missing from the
manual and should be fixed.

> At this point I haven't been able to find any "Dummy's Guide To
> vcs_info*" :(

There is a file `Misc/vcs_info-examples', which is included with newer
versions of zsh. If contains a number of examples for `vcs_info' as its
name suggests.

There is also a blog entry by Seth (whom I've Cc:ed) which gives
pointers towards using `vcs_info' with mercurial. He extended the hg
backend a lot, so he knows what he's doing:


Regards, Frank

In protocol design, perfection has been reached not when there is
nothing left to add, but when there is nothing left to take away.
                                                  -- RFC 1925

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