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

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



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'm doing this using my customised version of Oh My ZSH: https://github.com/AlexSatrapa/oh-my-zsh - check my "alex" theme, which is based on "arrow" and "deiter".

While another contributor was trying to get a similar change pulled back into the master Oh My ZSH, it was suggested that the VCS stuff be done using vcs_info, which is a common contrib shipped with ZSH. To this end I have tried the following commands in order to emulate my current RPROMPT information:

11:06 .oh-my-zsh ➤ touch blah                                                    ±master 
11:07 .oh-my-zsh ➤ autoload vcs_info                                             ±master!
11:07 .oh-my-zsh ➤ zstyle ':vcs_info:*:*:*' use-prompt-escapes true              ±master!
11:07 .oh-my-zsh ➤ zstyle ':vcs_info:*:*:*' check-for-changes true               ±master!
11:07 .oh-my-zsh ➤ vcs_info ; echo $vcs_info_msg_0_                              ±master!
(git)-[master]-
11:08 .oh-my-zsh ➤ zstyle ':vcs_info:*' formats '%b%u%c'                         ±master!
[m.oh-my-zsh'%                                                                            
11:09 .oh-my-zsh ➤ vcs_info ; echo $vcs_info_msg_0_                              ±master!
master%u%c

I am expecting that setting 'use-prompt-escapes' to true will cause 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.

Does anyone have a suggestion as to what I'm doing wrong?  As the adage goes, "when reality doesn't meet your expectations, it's not reality that has to change."  What am I missing, which is stopping vcs_info from behaving the way I'm expecting it to?

My reference documentation is only §26.4 of the ZSH manual, "Gathering information from version control systems", and a bunch of scripts provided by other people such as https://github.com/blueyed/oh-my-zsh/blob/master/themes/blueyed.zsh-theme

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

Alex



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