zsh-users
 help / color / mirror / code / Atom feed
From: "Suraj N. Kurapati" <sunaku@gmail.com>
To: zsh-users@zsh.org
Subject: Misc/vcs_info-examples - "git-st" snippet broken?
Date: Wed, 19 Oct 2011 03:44:02 -0700	[thread overview]
Message-ID: <20111019034402.4d73538a@gmail.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 1903 bytes --]

Hello,

I'm using zsh 4.3.12 (x86_64-unknown-linux-gnu) and have added the
"git-st" snippet shown below to my .zshrc file from the ZSH git
repository's Misc/vcs_info-examples file.  The problem is that
+vi-git-st() isn't being called automatically by vcs_info().

What am I doing wrong?

Thanks for your consideration.

####################################################################

# my "sunaku" prompt from oh-my-zsh (see http://ompldr.org/vOHcwZg)
local prompt_user_color='green'
test $UID -eq 0 && prompt_user_color='red'
PROMPT='%(?..%B%F{red}exit %?%f%b
)'\
'$(vcs_info && echo $vcs_info_msg_0_)'\
'%F{$prompt_user_color}%~%b'\
'%(!.#.>) '
RPROMPT='%F{cyan}%@%f'

# VCS integration for ZSH command prompt
autoload -Uz vcs_info
zstyle ':vcs_info:*' stagedstr '%F{green}+%f'
zstyle ':vcs_info:*' unstagedstr '%F{yellow}!%f'
zstyle ':vcs_info:*' check-for-changes true
local prompt_vcs_branch='%m%B%c%u%%b%b'
zstyle ':vcs_info:*' formats "$prompt_vcs_branch "
zstyle ':vcs_info:*' actionformats "$prompt_vcs_branch
%B%F{red}%s:%a%f%%b "

### git: Show +N/-N when your local branch is ahead-of or behind remote
HEAD. # Make sure you have added misc to your 'formats':  %m
zstyle ':vcs_info:git*+set-message:*' hooks git-st
function +vi-git-st() {
    local ahead behind
    local -a gitstatus

    # for git prior to 1.7
    # ahead=$(git rev-list origin/${hook_com[branch]}..HEAD | wc -l)
    ahead=$(git rev-list ${hook_com[branch]}@{upstream}..HEAD
    2>/dev/null | wc -l) (( $ahead )) && gitstatus+=( "+${ahead}" )

    # for git prior to 1.7
    # behind=$(git rev-list HEAD..origin/${hook_com[branch]} | wc -l)
    behind=$(git rev-list HEAD..${hook_com[branch]}@{upstream}
    2>/dev/null | wc -l) (( $behind )) && gitstatus+=( "-${behind}" )

    hook_com[misc]+=${(j:/:)gitstatus}
}

-- 
Cobol programmers are down in the dumps.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 198 bytes --]

             reply	other threads:[~2011-10-19 10:44 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-10-19 10:44 Suraj N. Kurapati [this message]
2011-10-19 11:26 ` Frank Terbeck
2011-10-19 18:08   ` Suraj N. Kurapati
2011-10-19 18:17     ` Frank Terbeck
2011-10-19 18:37       ` Suraj N. Kurapati

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20111019034402.4d73538a@gmail.com \
    --to=sunaku@gmail.com \
    --cc=zsh-users@zsh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).