Added the "visual identifier" concept to the `vcs` segment.

pull/22/head
Dominik Ritter 9 years ago
parent 5cfd800585
commit ac4502ca1f

@ -64,8 +64,8 @@ case $POWERLEVEL9K_MODE in
VCS_COMMIT_ICON $'\UE821 ' #  VCS_COMMIT_ICON $'\UE821 ' # 
VCS_BRANCH_ICON $'\UE220' #  VCS_BRANCH_ICON $'\UE220' # 
VCS_REMOTE_BRANCH_ICON ' '$'\UE804 ' #  VCS_REMOTE_BRANCH_ICON ' '$'\UE804 ' # 
VCS_GIT_ICON $'\UE20E ' #  VCS_GIT_ICON $'\UE20E ' # 
VCS_HG_ICON $'\UE1C3 ' #  VCS_HG_ICON $'\UE1C3 ' # 
) )
;; ;;
'awesome-fontconfig') 'awesome-fontconfig')
@ -111,8 +111,8 @@ case $POWERLEVEL9K_MODE in
VCS_COMMIT_ICON $'\UF221 ' #  VCS_COMMIT_ICON $'\UF221 ' # 
VCS_BRANCH_ICON $'\UF126' #  VCS_BRANCH_ICON $'\UF126' # 
VCS_REMOTE_BRANCH_ICON ' '$'\UF204 ' #  VCS_REMOTE_BRANCH_ICON ' '$'\UF204 ' # 
VCS_GIT_ICON $'\UF113 ' #  VCS_GIT_ICON $'\UF113 ' # 
VCS_HG_ICON $'\UF0C3 ' #  VCS_HG_ICON $'\UF0C3 ' # 
) )
;; ;;
*) *)

@ -78,6 +78,12 @@ function +vi-hg-bookmarks() {
} }
function +vi-vcs-detect-changes() { function +vi-vcs-detect-changes() {
if [[ "${hook_com[vcs]}" == "git" ]]; then
vcs_visual_identifier='VCS_GIT_ICON'
elif [[ "${hook_com[vcs]}" == "hg" ]]; then
vcs_visual_identifier='VCS_HG_ICON'
fi
if [[ -n "${hook_com[staged]}" ]] || [[ -n "${hook_com[unstaged]}" ]]; then if [[ -n "${hook_com[staged]}" ]] || [[ -n "${hook_com[unstaged]}" ]]; then
VCS_WORKDIR_DIRTY=true VCS_WORKDIR_DIRTY=true
else else

@ -696,8 +696,7 @@ prompt_vcs() {
zstyle ':vcs_info:*' check-for-changes true zstyle ':vcs_info:*' check-for-changes true
VCS_DEFAULT_FORMAT="$VCS_CHANGESET_PREFIX%F{$POWERLEVEL9K_VCS_FOREGROUND}%b%c%u%m%f" VCS_DEFAULT_FORMAT="$VCS_CHANGESET_PREFIX%F{$POWERLEVEL9K_VCS_FOREGROUND}%b%c%u%m%f"
zstyle ':vcs_info:git*:*' formats "%F{$POWERLEVEL9K_VCS_FOREGROUND}$(print_icon 'VCS_GIT_ICON')%f$VCS_DEFAULT_FORMAT" zstyle ':vcs_info:*' formats "$VCS_DEFAULT_FORMAT"
zstyle ':vcs_info:hg*:*' formats "%F{$POWERLEVEL9K_VCS_FOREGROUND}$(print_icon 'VCS_HG_ICON')%f$VCS_DEFAULT_FORMAT"
zstyle ':vcs_info:*' actionformats "%b %F{red}| %a%f" zstyle ':vcs_info:*' actionformats "%b %F{red}| %a%f"
@ -724,12 +723,12 @@ prompt_vcs() {
if [[ -n "$vcs_prompt" ]]; then if [[ -n "$vcs_prompt" ]]; then
if [[ "$VCS_WORKDIR_DIRTY" == true ]]; then if [[ "$VCS_WORKDIR_DIRTY" == true ]]; then
"$1_prompt_segment" "$0_MODIFIED" "yellow" "$DEFAULT_COLOR" # $vcs_visual_identifier gets set in +vi-vcs-detect-changes in functions/vcs.zsh,
# as we have there access to vcs_info internal hooks.
"$1_prompt_segment" "$0_MODIFIED" "yellow" "$DEFAULT_COLOR" "$vcs_prompt" "$vcs_visual_identifier"
else else
"$1_prompt_segment" "$0" "green" "$DEFAULT_COLOR" "$1_prompt_segment" "$0" "green" "$DEFAULT_COLOR" "$vcs_prompt" "$vcs_visual_identifier"
fi fi
echo -n "$vcs_prompt "
fi fi
} }

Loading…
Cancel
Save