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

Re: what is the effect of a percentage sign (%) as last character on the command line



Peter writes:
> Yes, sorry , my snippet was too short:
>
> git_info() {
>   ref=$(git symbolic-ref -q HEAD 2>/dev/null)
>   ref=${ref#refs/heads}
>   echo ${ref:+"${GREEN}[$ref]${WHITE}"}
[...]

Since you're trying to collect information from version control systems,
if you're on zsh 4.3.7 or newer, zsh includes a collection of functions
called `vcs_info' which do all the work for you. The thing is pretty
configurable, so tweaking it to your liking shouldn't be an issue.

It has support for a great number of version control systems; git is
among them (and the git backend is probably the one with the most
features).

If `vcs_info' is included in your zsh version, this should get you to
its documentation:
    % MANPAGER='less -M -p GATHER' man zshcontrib

Regards, Frank



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