From 0175b253959685828813efa86180e0c029ec4dea Mon Sep 17 00:00:00 2001 From: Dominik Ritter Date: Thu, 2 Apr 2015 01:14:16 +0200 Subject: [PATCH 1/2] Git: Show stashed changes. --- powerlevel9k.zsh-theme | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/powerlevel9k.zsh-theme b/powerlevel9k.zsh-theme index c8a9ac89..443f7cc3 100644 --- a/powerlevel9k.zsh-theme +++ b/powerlevel9k.zsh-theme @@ -71,7 +71,7 @@ zstyle ':vcs_info:*' actionformats " %b %F{red}| %a%f" zstyle ':vcs_info:*' stagedstr " %F{$DEFAULT_COLOR}$VCS_STAGED_ICON%f" zstyle ':vcs_info:*' unstagedstr " %F{$DEFAULT_COLOR}$VCS_UNSTAGED_ICON%f" -zstyle ':vcs_info:git*+set-message:*' hooks git-untracked git-aheadbehind git-remotebranch git-tagname +zstyle ':vcs_info:git*+set-message:*' hooks git-untracked git-aheadbehind git-stash git-remotebranch git-tagname # For Hg, only show the branch name zstyle ':vcs_info:hg*:*' branchformat "%b" @@ -208,6 +208,17 @@ function +vi-git-tagname() { [[ -n ${tag} ]] && hook_com[branch]=" %F{$DEFAULT_COLOR}${tag}%f" } +# Show count of stashed changes +# Port from https://github.com/whiteinge/dotfiles/blob/5dfd08d30f7f2749cfc60bc55564c6ea239624d9/.zsh_shouse_prompt#L268 +function +vi-git-stash() { + local -a stashes + + if [[ -s $(git rev-parse --git-dir)/refs/stash ]] ; then + stashes=$(git stash list 2>/dev/null | wc -l) + hook_com[misc]+=" %F{$DEFAULT_COLOR}⍟${stashes}%f" + fi +} + function +vi-vcs-detect-changes() { if [[ -n ${hook_com[staged]} ]] || [[ -n ${hook_com[unstaged]} ]]; then VCS_WORKDIR_DIRTY=true From 27a13b3f4823835d9ef2ec22dbb47e9007003676 Mon Sep 17 00:00:00 2001 From: Dominik Ritter Date: Thu, 2 Apr 2015 01:25:32 +0200 Subject: [PATCH 2/2] Added documentation. --- README.md | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/README.md b/README.md index 78c8946f..91a272da 100644 --- a/README.md +++ b/README.md @@ -15,6 +15,7 @@ information in configurable prompt segments. * branch / tag name * current action status (rebasing, merging, etc.,) * being behind / ahead of your remote by some number of commits + * number of stashes (git only) * conditionally shows remote tracking branch if the name differs from local * various working tree statuses (e.g., unstaged, staged, etc.,) * Shows return-code of the last command if it is an error code @@ -119,6 +120,17 @@ Example: # just show the 6 first characters of changeset POWERLEVEL9K_CHANGESET_HASH_LENGTH=6 +##### Symbols + +The `vcs` segment uses various symbols to tell you the state of your repository: + +* `↑4` - The number of commits your repository is ahead of your remote branch +* `↓5` - The number of commits your repository is behind of your remote branch +* `⍟3` - The number of stashes, here 3. +* `●` - There are unstaged changes in your working copy +* `✚` - There are staged changes in your working copy +* `?` - There are files in your working copy, that are unknown to your repository + ### Styling You can configure the look and feel of your prompt easily with some built-in