From 3de82cfa67e782337d05aab774ea75106d67f992 Mon Sep 17 00:00:00 2001 From: Dominik Ritter Date: Tue, 31 Mar 2015 00:52:06 +0200 Subject: Length of changeset-hash is now configurable by setting POWERLEVEL9K_CHANGESET_HASH_LENGTH. --- powerlevel9k.zsh-theme | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'powerlevel9k.zsh-theme') diff --git a/powerlevel9k.zsh-theme b/powerlevel9k.zsh-theme index 55056bf1..d9e4485d 100644 --- a/powerlevel9k.zsh-theme +++ b/powerlevel9k.zsh-theme @@ -53,8 +53,13 @@ autoload -Uz vcs_info local VCS_WORKDIR_DIRTY=false local VCS_CHANGESET_PREFIX='' if [ $POWERLEVEL9K_SHOW_CHANGESET ]; then - # Just display the first 12 characters of our changeset-ID. - VCS_CHANGESET_PREFIX="%F{$DEFAULT_COLOR_DARK}%12.12i@%f" + # Default: Just display the first 12 characters of our changeset-ID. + local VCS_CHANGESET_HASH_LENGTH=12 + if [[ -n $POWERLEVEL9K_CHANGESET_HASH_LENGTH ]]; then + VCS_CHANGESET_HASH_LENGTH=$POWERLEVEL9K_CHANGESET_HASH_LENGTH + fi + + VCS_CHANGESET_PREFIX="%F{$DEFAULT_COLOR_DARK}%$VCS_CHANGESET_HASH_LENGTH.$VCS_CHANGESET_HASH_LENGTH""i@%f" fi zstyle ':vcs_info:*' enable git hg -- cgit v1.2.3 From e23a3c47c41557ec97ea0a819070fd2c4bdb3b68 Mon Sep 17 00:00:00 2001 From: Dominik Ritter Date: Wed, 1 Apr 2015 08:53:28 +0200 Subject: Show at maximum the configured amount of characters. If the changeset id exeeds that limit, just show the full changeset id. --- powerlevel9k.zsh-theme | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'powerlevel9k.zsh-theme') diff --git a/powerlevel9k.zsh-theme b/powerlevel9k.zsh-theme index ef4bac9b..c8a9ac89 100644 --- a/powerlevel9k.zsh-theme +++ b/powerlevel9k.zsh-theme @@ -55,11 +55,11 @@ local VCS_CHANGESET_PREFIX='' if [[ "$POWERLEVEL9K_SHOW_CHANGESET" == true ]]; then # Default: Just display the first 12 characters of our changeset-ID. local VCS_CHANGESET_HASH_LENGTH=12 - if [[ -n $POWERLEVEL9K_CHANGESET_HASH_LENGTH ]]; then - VCS_CHANGESET_HASH_LENGTH=$POWERLEVEL9K_CHANGESET_HASH_LENGTH - fi - - VCS_CHANGESET_PREFIX="%F{$DEFAULT_COLOR_DARK}%$VCS_CHANGESET_HASH_LENGTH.$VCS_CHANGESET_HASH_LENGTH""i@%f" + if [[ -n $POWERLEVEL9K_CHANGESET_HASH_LENGTH ]]; then + VCS_CHANGESET_HASH_LENGTH=$POWERLEVEL9K_CHANGESET_HASH_LENGTH + fi + + VCS_CHANGESET_PREFIX="%F{$DEFAULT_COLOR_DARK}%0.$VCS_CHANGESET_HASH_LENGTH""i@%f" fi zstyle ':vcs_info:*' enable git hg -- cgit v1.2.3 From 0175b253959685828813efa86180e0c029ec4dea Mon Sep 17 00:00:00 2001 From: Dominik Ritter Date: Thu, 2 Apr 2015 01:14:16 +0200 Subject: Git: Show stashed changes. --- powerlevel9k.zsh-theme | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'powerlevel9k.zsh-theme') 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 -- cgit v1.2.3