diff options
Diffstat (limited to 'functions')
-rw-r--r-- | functions/icons.zsh | 9 | ||||
-rw-r--r-- | functions/vcs.zsh | 41 |
2 files changed, 28 insertions, 22 deletions
diff --git a/functions/icons.zsh b/functions/icons.zsh index 6de09ee8..c2565f26 100644 --- a/functions/icons.zsh +++ b/functions/icons.zsh @@ -69,7 +69,8 @@ case $POWERLEVEL9K_MODE in VCS_REMOTE_BRANCH_ICON ' '$'\UE804 ' # VCS_GIT_ICON $'\UE20E ' # VCS_HG_ICON $'\UE1C3 ' # - RUST_ICON '' + RUST_ICON '' + PYTHON_ICON $'\U1F40D' # 🐍 ) ;; 'awesome-fontconfig') @@ -121,7 +122,8 @@ case $POWERLEVEL9K_MODE in VCS_REMOTE_BRANCH_ICON ' '$'\UF204 ' # VCS_GIT_ICON $'\UF113 ' # VCS_HG_ICON $'\UF0C3 ' # - RUST_ICON $'\UE6A8' # + RUST_ICON $'\UE6A8' # + PYTHON_ICON $'\U1F40D' # 🐍 ) ;; *) @@ -173,7 +175,8 @@ case $POWERLEVEL9K_MODE in VCS_REMOTE_BRANCH_ICON $'\u2192' # → VCS_GIT_ICON '' VCS_HG_ICON '' - RUST_ICON '' + RUST_ICON '' + PYTHON_ICON '' ) ;; esac diff --git a/functions/vcs.zsh b/functions/vcs.zsh index 15f0177e..657a0f3f 100644 --- a/functions/vcs.zsh +++ b/functions/vcs.zsh @@ -60,27 +60,30 @@ function +vi-git-remotebranch() { fi } +set_default POWERLEVEL9K_VCS_HIDE_TAGS false function +vi-git-tagname() { - # If we are on a tag, append the tagname to the current branch string. - local tag - tag=$(git describe --tags --exact-match HEAD 2>/dev/null) - - if [[ -n "${tag}" ]] ; then - # There is a tag that points to our current commit. Need to determine if we - # are also on a branch, or are in a DETACHED_HEAD state. - if [[ -z $(git symbolic-ref HEAD 2>/dev/null) ]]; then - # DETACHED_HEAD state. We want to append the tag name to the commit hash - # and print it. Unfortunately, `vcs_info` blows away the hash when a tag - # exists, so we have to manually retrieve it and clobber the branch - # string. - local revision - revision=$(git rev-list -n 1 --abbrev-commit --abbrev=${POWERLEVEL9K_VCS_INTERNAL_HASH_LENGTH} HEAD) - hook_com[branch]="$(print_icon 'VCS_BRANCH_ICON')${revision} $(print_icon 'VCS_TAG_ICON')${tag}" - else - # We are on both a tag and a branch; print both by appending the tag name. - hook_com[branch]+=" $(print_icon 'VCS_TAG_ICON')${tag}" + if [[ "$POWERLEVE9K_VCS_HIDE_TAGS" == "false" ]]; then + # If we are on a tag, append the tagname to the current branch string. + local tag + tag=$(git describe --tags --exact-match HEAD 2>/dev/null) + + if [[ -n "${tag}" ]] ; then + # There is a tag that points to our current commit. Need to determine if we + # are also on a branch, or are in a DETACHED_HEAD state. + if [[ -z $(git symbolic-ref HEAD 2>/dev/null) ]]; then + # DETACHED_HEAD state. We want to append the tag name to the commit hash + # and print it. Unfortunately, `vcs_info` blows away the hash when a tag + # exists, so we have to manually retrieve it and clobber the branch + # string. + local revision + revision=$(git rev-list -n 1 --abbrev-commit --abbrev=${POWERLEVEL9K_VCS_INTERNAL_HASH_LENGTH} HEAD) + hook_com[branch]="$(print_icon 'VCS_BRANCH_ICON')${revision} $(print_icon 'VCS_TAG_ICON')${tag}" + else + # We are on both a tag and a branch; print both by appending the tag name. + hook_com[branch]+=" $(print_icon 'VCS_TAG_ICON')${tag}" + fi + fi fi - fi } # Show count of stashed changes |