vcs_info Quickstart (zsh)

#### 26.5.1 Quickstart ¶

To get this feature working quickly (including colors), you can do the following (assuming, you loaded `vcs_info` properly - see above):

    zstyle ':vcs_info:*' actionformats \
        '%F{5}(%f%s%F{5})%F{3}-%F{5}[%F{2}%b%F{3}|%F{1}%a%F{5}]%f '
    zstyle ':vcs_info:*' formats       \
        '%F{5}(%f%s%F{5})%F{3}-%F{5}[%F{2}%b%F{5}]%f '
    zstyle ':vcs_info:(sv[nk]|bzr):*' branchformat '%b%F{1}:%F{3}%r'
    precmd () { vcs_info }
    PS1='%F{5}[%F{2}%n%F{5}] %F{3}%3~ ${vcs_info_msg_0_}%f%# '

Obviously, the last two lines are there for demonstration. You need to call `vcs_info` from your `precmd` function. Once that is done you need a single quoted `'${vcs_info_msg_0_}'` in your prompt.

To be able to use `'${vcs_info_msg_0_}'` directly in your prompt like this, you will need to have the `PROMPT_SUBST` option enabled.

Now call the `vcs_info_printsys` utility from the command line:

    % vcs_info_printsys
    ## list of supported version control backends:
    ## disabled systems are prefixed by a hash sign (#)
    bzr
    cdv
    cvs
    darcs
    fossil
    git
    hg
    mtn
    p4
    svk
    svn
    tla
    ## flavours (cannot be used in the enable or disable styles; they
    ## are enabled and disabled with their master [git-svn -> git])
    ## they *can* be used in contexts: ':vcs_info:git-svn:*'.
    git-p4
    git-svn
    hg-git
    hg-hgsubversion
    hg-hgsvn

You may not want all of these because there is no point in running the code to detect systems you do not use. So there is a way to disable some backends altogether:

    zstyle ':vcs_info:*' disable bzr cdv darcs mtn svk tla

You may also pick a few from that list and enable only those:

    zstyle ':vcs_info:*' enable git cvs svn

If you rerun `vcs_info_printsys` after one of these commands, you will see the backends listed in the `disable` style (or backends not in the `enable` style - if you used that) marked as disabled by a hash sign. That means the detection of these systems is skipped completely. No wasted time there.