summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDominik Ritter <dritter03@googlemail.com>2015-12-18 03:07:22 +0300
committerDominik Ritter <dritter03@googlemail.com>2015-12-18 03:07:22 +0300
commitd5a8211aa1e2500f57a269eae0552602f6f2b164 (patch)
treee160eb65468f40d82aed6148f7fec9060c12ec49
parent2a519ee2d7ed7bd2a70aabd42bba7e95baa8e714 (diff)
parentac4502ca1fafab54c07d22e4841d8c6c7aeffc95 (diff)
Merge branch 'battery_visual_identifier' of github.com:dritter/powerlevel9k into battery_visual_identifier
-rw-r--r--functions/icons.zsh8
-rw-r--r--functions/vcs.zsh6
-rwxr-xr-xpowerlevel9k.zsh-theme25
3 files changed, 23 insertions, 16 deletions
diff --git a/functions/icons.zsh b/functions/icons.zsh
index 4ba4811e..b8e02efd 100644
--- a/functions/icons.zsh
+++ b/functions/icons.zsh
@@ -64,8 +64,8 @@ case $POWERLEVEL9K_MODE in
VCS_COMMIT_ICON $'\UE821 ' # 
VCS_BRANCH_ICON $'\UE220' # 
VCS_REMOTE_BRANCH_ICON ' '$'\UE804 ' # 
- VCS_GIT_ICON $'\UE20E ' # 
- VCS_HG_ICON $'\UE1C3 ' # 
+ VCS_GIT_ICON $'\UE20E ' # 
+ VCS_HG_ICON $'\UE1C3 ' # 
)
;;
'awesome-fontconfig')
@@ -111,8 +111,8 @@ case $POWERLEVEL9K_MODE in
VCS_COMMIT_ICON $'\UF221 ' # 
VCS_BRANCH_ICON $'\UF126' # 
VCS_REMOTE_BRANCH_ICON ' '$'\UF204 ' # 
- VCS_GIT_ICON $'\UF113 ' # 
- VCS_HG_ICON $'\UF0C3 ' # 
+ VCS_GIT_ICON $'\UF113 ' # 
+ VCS_HG_ICON $'\UF0C3 ' # 
)
;;
*)
diff --git a/functions/vcs.zsh b/functions/vcs.zsh
index 39d0fdae..49dccc18 100644
--- a/functions/vcs.zsh
+++ b/functions/vcs.zsh
@@ -78,6 +78,12 @@ function +vi-hg-bookmarks() {
}
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
VCS_WORKDIR_DIRTY=true
else
diff --git a/powerlevel9k.zsh-theme b/powerlevel9k.zsh-theme
index e2f3b4fd..19c5ea98 100755
--- a/powerlevel9k.zsh-theme
+++ b/powerlevel9k.zsh-theme
@@ -549,7 +549,7 @@ prompt_ram() {
base=K
fi
- rendition+="$(print_icon 'RAM_ICON') $(printSizeHumanReadable "$ramfree" $base) "
+ rendition+="$(printSizeHumanReadable "$ramfree" $base) "
;;
swap_used)
if [[ "$OS" == "OSX" ]]; then
@@ -572,7 +572,7 @@ prompt_ram() {
esac
done
- "$1_prompt_segment" "$0" "$2" "yellow" "$DEFAULT_COLOR" "${rendition% }"
+ "$1_prompt_segment" "$0" "$2" "yellow" "$DEFAULT_COLOR" "${rendition% }" 'RAM_ICON'
}
# Node version from NVM
@@ -616,7 +616,7 @@ prompt_rspec_stats() {
code_amount=$(ls -1 app/**/*.rb | wc -l)
tests_amount=$(ls -1 spec/**/*.rb | wc -l)
- build_test_stats "$1" "$0" "$2" "$code_amount" "$tests_amount" "RSpec $(print_icon 'TEST_ICON')"
+ build_test_stats "$1" "$0" "$2" "$code_amount" "$tests_amount" "RSpec" 'TEST_ICON'
fi
}
@@ -655,7 +655,7 @@ prompt_symfony2_tests() {
code_amount=$(ls -1 src/**/*.php | grep -vc Tests)
tests_amount=$(ls -1 src/**/*.php | grep -c Tests)
- build_test_stats "$1" "$0" "$2" "$code_amount" "$tests_amount" "SF2 $(print_icon 'TEST_ICON')"
+ build_test_stats "$1" "$0" "$2" "$code_amount" "$tests_amount" "SF2" 'TEST_ICON'
fi
}
@@ -664,7 +664,7 @@ prompt_symfony2_version() {
if [[ -f app/bootstrap.php.cache ]]; then
local symfony2_version
symfony2_version=$(grep " VERSION " app/bootstrap.php.cache | sed -e 's/[^.0-9]*//g')
- "$1_prompt_segment" "$0" "$2" "240" "$DEFAULT_COLOR" "$(print_icon 'SYMFONY_ICON') $symfony2_version"
+ "$1_prompt_segment" "$0" "$2" "240" "$DEFAULT_COLOR" "$symfony2_version" 'SYMFONY_ICON'
fi
}
@@ -678,9 +678,9 @@ build_test_stats() {
typeset -F 2 ratio
local ratio=$(( (tests_amount/code_amount) * 100 ))
- (( ratio >= 75 )) && "$1_prompt_segment" "${2}_GOOD" "$3" "cyan" "$DEFAULT_COLOR" "$headline: $ratio%%"
- (( ratio >= 50 && ratio < 75 )) && "$1_prompt_segment" "${2}_AVG" "$3" "yellow" "$DEFAULT_COLOR" "$headline: $ratio%%"
- (( ratio < 50 )) && "$1_prompt_segment" "${2}_BAD" "red" "$3" "$DEFAULT_COLOR" "$headline: $ratio%%"
+ (( ratio >= 75 )) && "$1_prompt_segment" "${2}_GOOD" "$3" "cyan" "$DEFAULT_COLOR" "$headline: $ratio%%" "$6"
+ (( ratio >= 50 && ratio < 75 )) && "$1_prompt_segment" "$2_AVG" "$3" "yellow" "$DEFAULT_COLOR" "$headline: $ratio%%" "$6"
+ (( ratio < 50 )) && "$1_prompt_segment" "$2_BAD" "$3" "red" "$DEFAULT_COLOR" "$headline: $ratio%%" "$6"
}
# System time
@@ -723,8 +723,7 @@ prompt_vcs() {
zstyle ':vcs_info:*' check-for-changes true
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:hg*:*' formats "%F{$POWERLEVEL9K_VCS_FOREGROUND}$(print_icon 'VCS_HG_ICON')%f$VCS_DEFAULT_FORMAT"
+ zstyle ':vcs_info:*' formats "$VCS_DEFAULT_FORMAT"
zstyle ':vcs_info:*' actionformats "%b %F{red}| %a%f"
@@ -751,9 +750,11 @@ prompt_vcs() {
if [[ -n "$vcs_prompt" ]]; then
if [[ "$VCS_WORKDIR_DIRTY" == true ]]; then
- "$1_prompt_segment" "$0_MODIFIED" "$2" "yellow" "$DEFAULT_COLOR" "$vcs_prompt"
+ # $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" "$2" "yellow" "$DEFAULT_COLOR" "$vcs_prompt" "$vcs_visual_identifier"
else
- "$1_prompt_segment" "$0" "$2" "green" "$DEFAULT_COLOR" "$vcs_prompt"
+ "$1_prompt_segment" "$0" "$2" "green" "$DEFAULT_COLOR" "$vcs_prompt" "$vcs_visual_identifier"
fi
fi
}