Merge pull request #165 from dritter/battery_visual_identifier

Adding ability for segments to be combined.
pull/22/head
Ben Hilburn 9 years ago
commit 4437e539e9

@ -1,5 +1,10 @@
## v0.3.0 (next) ## v0.3.0 (next)
### Introduced "visual identifiers" to the segments
Now almost every segment can have a visual identifier, which is an
icon whose color could be adjusted by users.
### Added ability for "joined" segments ### Added ability for "joined" segments
You can now merge segments together by suffixing the segment name with "_joined". You can now merge segments together by suffixing the segment name with "_joined".
@ -18,7 +23,7 @@ A new segment that allows users to define a custom command was added.
### `virtualenv` changes ### `virtualenv` changes
This segment now respects `VIRTUAL_ENV_DISABLE_PROMPT`. If this variable is set This segment now respects `VIRTUAL_ENV_DISABLE_PROMPT`. If this variable is set
to `true`, the segments does not get rendered. to `true`, the segments does not get rendered.
### `load` changes ### `load` changes
@ -29,7 +34,7 @@ segment is able to show the free ram and used swap.
### `vcs` changes ### `vcs` changes
This prompt uses the `VCS_INFO` subsystem by ZSH. From now on this subsystem This prompt uses the `VCS_INFO` subsystem by ZSH. From now on this subsystem
is only invoked if a `vcs` segment was configured. is only invoked if a `vcs` segment was configured.
### `rvm` changes ### `rvm` changes

@ -206,7 +206,7 @@ To change the way how the current working directory is truncated, just set:
# default behaviour is to truncate whole directories # default behaviour is to truncate whole directories
In each case you have to specify the length you want to shorten the directory In each case you have to specify the length you want to shorten the directory
to. So in some cases `POWERLEVEL9K_SHORTEN_DIR_LENGTH` means characters, in to. So in some cases `POWERLEVEL9K_SHORTEN_DIR_LENGTH` means characters, in
others whole directories. others whole directories.
##### ip ##### ip

@ -43,9 +43,9 @@ case $POWERLEVEL9K_MODE in
FREEBSD_ICON $'\U1F608 ' # 😈 FREEBSD_ICON $'\U1F608 ' # 😈
LINUX_ICON $'\UE271' #  LINUX_ICON $'\UE271' # 
SUNOS_ICON $'\U1F31E ' # 🌞 SUNOS_ICON $'\U1F31E ' # 🌞
HOME_ICON $'\UE12C ' #  HOME_ICON $'\UE12C' # 
FOLDER_ICON $'\UE818 ' #  FOLDER_ICON $'\UE818' # 
NETWORK_ICON $'\UE1AD ' #  NETWORK_ICON $'\UE1AD' # 
LOAD_ICON $'\UE190 ' #  LOAD_ICON $'\UE190 ' # 
#RAM_ICON $'\UE87D' #  #RAM_ICON $'\UE87D' # 
RAM_ICON $'\UE1E2 ' #  RAM_ICON $'\UE1E2 ' # 
@ -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')
@ -95,9 +95,9 @@ case $POWERLEVEL9K_MODE in
FREEBSD_ICON $'\U1F608 ' # 😈 FREEBSD_ICON $'\U1F608 ' # 😈
LINUX_ICON $'\UF17C' #  LINUX_ICON $'\UF17C' # 
SUNOS_ICON $'\UF185 ' #  SUNOS_ICON $'\UF185 ' # 
HOME_ICON $'\UF015 ' #  HOME_ICON $'\UF015' # 
FOLDER_ICON $'\UF115 ' #  FOLDER_ICON $'\UF115' # 
NETWORK_ICON $'\UF09E ' #  NETWORK_ICON $'\UF09E' # 
LOAD_ICON $'\UF080 ' #  LOAD_ICON $'\UF080 ' # 
RAM_ICON $'\UF0E4' #  RAM_ICON $'\UF0E4' # 
VCS_UNTRACKED_ICON $'\UF059' #  VCS_UNTRACKED_ICON $'\UF059' # 
@ -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 ' # 
) )
;; ;;
*) *)
@ -190,9 +190,8 @@ fi
function print_icon() { function print_icon() {
local icon_name=$1 local icon_name=$1
local ICON_USER_VARIABLE=POWERLEVEL9K_${icon_name} local ICON_USER_VARIABLE=POWERLEVEL9K_${icon_name}
local USER_ICON=${(P)ICON_USER_VARIABLE}
if defined "$ICON_USER_VARIABLE"; then if defined "$ICON_USER_VARIABLE"; then
echo -n "$USER_ICON" echo -n "${(P)ICON_USER_VARIABLE}"
else else
echo -n "${icons[$icon_name]}" echo -n "${icons[$icon_name]}"
fi fi

@ -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

@ -124,6 +124,7 @@ CURRENT_BG='NONE'
# * $3: Background color # * $3: Background color
# * $4: Foreground color # * $4: Foreground color
# * $5: The segment content # * $5: The segment content
# * $6: An identifying icon (must be a key of the icons array)
# The latter three can be omitted, # The latter three can be omitted,
set_default POWERLEVEL9K_WHITESPACE_BETWEEN_LEFT_SEGMENTS " " set_default POWERLEVEL9K_WHITESPACE_BETWEEN_LEFT_SEGMENTS " "
left_prompt_segment() { left_prompt_segment() {
@ -146,7 +147,7 @@ left_prompt_segment() {
echo -n "%{$bg%F{$CURRENT_BG}%}" echo -n "%{$bg%F{$CURRENT_BG}%}"
if [[ $joined == false ]]; then if [[ $joined == false ]]; then
# Middle segment # Middle segment
echo -n "$(print_icon 'LEFT_SEGMENT_SEPARATOR')%{$fg%}$POWERLEVEL9K_WHITESPACE_BETWEEN_LEFT_SEGMENTS" echo -n "$(print_icon 'LEFT_SEGMENT_SEPARATOR')$POWERLEVEL9K_WHITESPACE_BETWEEN_LEFT_SEGMENTS"
fi fi
elif isSameColor "$CURRENT_BG" "$3"; then elif isSameColor "$CURRENT_BG" "$3"; then
# Middle segment with same color as previous segment # Middle segment with same color as previous segment
@ -157,14 +158,27 @@ left_prompt_segment() {
[[ -n "$4" ]] && complement="$4" || complement=$DEFAULT_COLOR [[ -n "$4" ]] && complement="$4" || complement=$DEFAULT_COLOR
echo -n "%{$bg%F{$complement}%}" echo -n "%{$bg%F{$complement}%}"
if [[ $joined == false ]]; then if [[ $joined == false ]]; then
echo -n "$(print_icon 'LEFT_SUBSEGMENT_SEPARATOR')%{$fg%}$POWERLEVEL9K_WHITESPACE_BETWEEN_LEFT_SEGMENTS" echo -n "$(print_icon 'LEFT_SUBSEGMENT_SEPARATOR')$POWERLEVEL9K_WHITESPACE_BETWEEN_LEFT_SEGMENTS"
fi fi
else else
# First segment # First segment
echo -n "%{$bg%}%{$fg%}$POWERLEVEL9K_WHITESPACE_BETWEEN_LEFT_SEGMENTS" echo -n "%{$bg%}$POWERLEVEL9K_WHITESPACE_BETWEEN_LEFT_SEGMENTS"
fi
local visual_identifier
if [[ -n $6 ]]; then
visual_identifier="$(print_icon $6)"
if [[ -n "$visual_identifier" ]]; then
# Allow users to overwrite the color for the visual identifier only.
local visual_identifier_color_variable=POWERLEVEL9K_${(U)1#prompt_}_VISUAL_IDENTIFIER_COLOR
set_default $visual_identifier_color_variable $4
visual_identifier="%F{${(P)visual_identifier_color_variable}%}$visual_identifier%f"
# Add an whitespace if we print more than just the visual identifier
[[ -n "$5" ]] && visual_identifier="$visual_identifier "
fi
fi fi
[[ -n "$5" ]] && echo -n "${5}${POWERLEVEL9K_WHITESPACE_BETWEEN_LEFT_SEGMENTS}" [[ -n "$5" ]] && echo -n "${visual_identifier}%{$fg%}${5}${POWERLEVEL9K_WHITESPACE_BETWEEN_LEFT_SEGMENTS}"
CURRENT_BG=$3 CURRENT_BG=$3
} }
@ -190,6 +204,7 @@ CURRENT_RIGHT_BG='NONE'
# * $3: Background color # * $3: Background color
# * $4: Foreground color # * $4: Foreground color
# * $5: The segment content # * $5: The segment content
# * $6: An identifying icon (must be a key of the icons array)
# No ending for the right prompt segment is needed (unlike the left prompt, above). # No ending for the right prompt segment is needed (unlike the left prompt, above).
set_default POWERLEVEL9K_WHITESPACE_BETWEEN_RIGHT_SEGMENTS " " set_default POWERLEVEL9K_WHITESPACE_BETWEEN_RIGHT_SEGMENTS " "
right_prompt_segment() { right_prompt_segment() {
@ -222,13 +237,27 @@ right_prompt_segment() {
echo -n "%F{$3}$(print_icon 'RIGHT_SEGMENT_SEPARATOR')%f" echo -n "%F{$3}$(print_icon 'RIGHT_SEGMENT_SEPARATOR')%f"
fi fi
fi fi
local visual_identifier
if [[ -n "$6" ]]; then
visual_identifier="$(print_icon $6)"
if [[ -n "$visual_identifier" ]]; then
# Allow users to overwrite the color for the visual identifier only.
local visual_identifier_color_variable=POWERLEVEL9K_${(U)1#prompt_}_VISUAL_IDENTIFIER_COLOR
set_default $visual_identifier_color_variable $4
visual_identifier="%F{${(P)visual_identifier_color_variable}%}$visual_identifier%f"
# Add an whitespace if we print more than just the visual identifier
[[ -n "$5" ]] && visual_identifier=" $visual_identifier"
fi
fi
echo -n "%{$bg%}%{$fg%}" echo -n "%{$bg%}%{$fg%}"
# Print whitespace only if segment is not joined # Print whitespace only if segment is not joined or first right segment
[[ $joined == false ]] || [[ "$CURRENT_RIGHT_BG" == "NONE" ]] && echo -n "${POWERLEVEL9K_WHITESPACE_BETWEEN_RIGHT_SEGMENTS}" [[ $joined == false ]] || [[ "$CURRENT_RIGHT_BG" == "NONE" ]] && echo -n "${POWERLEVEL9K_WHITESPACE_BETWEEN_RIGHT_SEGMENTS}"
# Print segment content # Print segment content
[[ -n "$5" ]] && echo -n "${5}${POWERLEVEL9K_WHITESPACE_BETWEEN_RIGHT_SEGMENTS}%f" [[ -n "$5" ]] && echo -n "${5}${visual_identifier}${POWERLEVEL9K_WHITESPACE_BETWEEN_RIGHT_SEGMENTS}%f"
CURRENT_RIGHT_BG=$3 CURRENT_RIGHT_BG=$3
} }
@ -247,7 +276,7 @@ prompt_aws() {
local aws_profile="$AWS_DEFAULT_PROFILE" local aws_profile="$AWS_DEFAULT_PROFILE"
if [[ -n "$aws_profile" ]]; if [[ -n "$aws_profile" ]];
then then
"$1_prompt_segment" "$0" "$2" red white "$(print_icon 'AWS_ICON') $aws_profile" "$1_prompt_segment" "$0" "$2" red white "$aws_profile" 'AWS_ICON'
fi fi
} }
@ -349,15 +378,15 @@ prompt_battery() {
fi fi
# prepare string # prepare string
local message="$(print_icon 'BATTERY_ICON')" local message
# Default behavior: Be verbose! # Default behavior: Be verbose!
set_default POWERLEVEL9K_BATTERY_VERBOSE true set_default POWERLEVEL9K_BATTERY_VERBOSE true
if [[ "$POWERLEVEL9K_BATTERY_VERBOSE" == true ]]; then if [[ "$POWERLEVEL9K_BATTERY_VERBOSE" == true ]]; then
message="$message $bat_percent%%$remain" message="$bat_percent%%$remain"
fi fi
# display prompt_segment # display prompt_segment
[[ -n $bat_percent ]] && "$1_prompt_segment" "${0}_${current_state}" "$2" "$DEFAULT_COLOR" "${battery_states[$current_state]}" "$message" [[ -n $bat_percent ]] && "$1_prompt_segment" "${0}_${current_state}" "$2" "$DEFAULT_COLOR" "${battery_states[$current_state]}" "$message" 'BATTERY_ICON'
} }
# Context: user@hostname (who am I and where am I) # Context: user@hostname (who am I and where am I)
@ -394,12 +423,10 @@ prompt_dir() {
local current_icon='' local current_icon=''
if [[ $(print -P "%~") == '~'* ]]; then if [[ $(print -P "%~") == '~'* ]]; then
current_icon=$(print_icon 'HOME_ICON') "$1_prompt_segment" "$0_HOME" "$2" "blue" "$DEFAULT_COLOR" "$current_path" 'HOME_ICON'
else else
current_icon=$(print_icon 'FOLDER_ICON') "$1_prompt_segment" "$0_DEFAULT" "$2" "blue" "$DEFAULT_COLOR" "$current_path" 'FOLDER_ICON'
fi fi
"$1_prompt_segment" "$0" "$2" "blue" "$DEFAULT_COLOR" "$current_icon$current_path"
} }
# GO-prompt # GO-prompt
@ -454,7 +481,7 @@ prompt_ip() {
fi fi
fi fi
"$1_prompt_segment" "$0" "$2" "cyan" "$DEFAULT_COLOR" "$(print_icon 'NETWORK_ICON') $ip" "$1_prompt_segment" "$0" "$2" "cyan" "$DEFAULT_COLOR" "$ip" 'NETWORK_ICON'
} }
prompt_load() { prompt_load() {
@ -478,7 +505,7 @@ prompt_load() {
FUNCTION_SUFFIX="_NORMAL" FUNCTION_SUFFIX="_NORMAL"
fi fi
"$1_prompt_segment" "$0$FUNCTION_SUFFIX" "$2" "$BACKGROUND_COLOR" "$DEFAULT_COLOR" "$(print_icon 'LOAD_ICON') $load_avg_5min" "$1_prompt_segment" "$0$FUNCTION_SUFFIX" "$2" "$BACKGROUND_COLOR" "$DEFAULT_COLOR" "$load_avg_5min" 'LOAD_ICON'
} }
# Node version # Node version
@ -486,7 +513,7 @@ prompt_node_version() {
local node_version=$(node -v 2>/dev/null) local node_version=$(node -v 2>/dev/null)
[[ -z "${node_version}" ]] && return [[ -z "${node_version}" ]] && return
"$1_prompt_segment" "$0" "$2" "green" "white" "${node_version:1} $(print_icon 'NODE_ICON')" "$1_prompt_segment" "$0" "$2" "green" "white" "${node_version:1}" 'NODE_ICON'
} }
# print a little OS icon # print a little OS icon
@ -522,7 +549,7 @@ prompt_ram() {
base=K base=K
fi fi
rendition+="$(print_icon 'RAM_ICON') $(printSizeHumanReadable "$ramfree" $base) " rendition+="$(printSizeHumanReadable "$ramfree" $base) "
;; ;;
swap_used) swap_used)
if [[ "$OS" == "OSX" ]]; then if [[ "$OS" == "OSX" ]]; then
@ -545,7 +572,7 @@ prompt_ram() {
esac esac
done 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 # Node version from NVM
@ -556,13 +583,13 @@ prompt_nvm() {
[[ -z "${node_version}" ]] && return [[ -z "${node_version}" ]] && return
[[ "$node_version" =~ "$nvm_default" ]] && return [[ "$node_version" =~ "$nvm_default" ]] && return
$1_prompt_segment "$0" "$2" "green" "011" "${node_version:1} $(print_icon 'NODE_ICON')" $1_prompt_segment "$0" "$2" "green" "011" "${node_version:1}" 'NODE_ICON'
} }
# rbenv information # rbenv information
prompt_rbenv() { prompt_rbenv() {
if [[ -n "$RBENV_VERSION" ]]; then if [[ -n "$RBENV_VERSION" ]]; then
"$1_prompt_segment" "$0" "$2" "red" "$DEFAULT_COLOR" "$RBENV_VERSION" "$1_prompt_segment" "$0" "$2" "red" "$DEFAULT_COLOR" "$RBENV_VERSION" 'RUBY_ICON'
fi fi
} }
@ -589,7 +616,7 @@ prompt_rspec_stats() {
code_amount=$(ls -1 app/**/*.rb | wc -l) code_amount=$(ls -1 app/**/*.rb | wc -l)
tests_amount=$(ls -1 spec/**/*.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 fi
} }
@ -601,7 +628,7 @@ prompt_rvm() {
local version=$(echo $MY_RUBY_HOME | awk -F'-' '{print $2}') local version=$(echo $MY_RUBY_HOME | awk -F'-' '{print $2}')
if [[ -n "$version$gemset" ]]; then if [[ -n "$version$gemset" ]]; then
"$1_prompt_segment" "$0" "$2" "240" "$DEFAULT_COLOR" "$version$gemset $(print_icon 'RUBY_ICON') " "$1_prompt_segment" "$0" "$2" "240" "$DEFAULT_COLOR" "$version$gemset" 'RUBY_ICON'
fi fi
} }
@ -628,7 +655,7 @@ prompt_symfony2_tests() {
code_amount=$(ls -1 src/**/*.php | grep -vc Tests) code_amount=$(ls -1 src/**/*.php | grep -vc Tests)
tests_amount=$(ls -1 src/**/*.php | grep -c 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 fi
} }
@ -637,7 +664,7 @@ prompt_symfony2_version() {
if [[ -f app/bootstrap.php.cache ]]; then if [[ -f app/bootstrap.php.cache ]]; then
local symfony2_version local symfony2_version
symfony2_version=$(grep " VERSION " app/bootstrap.php.cache | sed -e 's/[^.0-9]*//g') 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 fi
} }
@ -651,9 +678,9 @@ build_test_stats() {
typeset -F 2 ratio typeset -F 2 ratio
local ratio=$(( (tests_amount/code_amount) * 100 )) local ratio=$(( (tests_amount/code_amount) * 100 ))
(( ratio >= 75 )) && "$1_prompt_segment" "${2}_GOOD" "$3" "cyan" "$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%%" (( ratio >= 50 && ratio < 75 )) && "$1_prompt_segment" "$2_AVG" "$3" "yellow" "$DEFAULT_COLOR" "$headline: $ratio%%" "$6"
(( ratio < 50 )) && "$1_prompt_segment" "${2}_BAD" "red" "$3" "$DEFAULT_COLOR" "$headline: $ratio%%" (( ratio < 50 )) && "$1_prompt_segment" "$2_BAD" "$3" "red" "$DEFAULT_COLOR" "$headline: $ratio%%" "$6"
} }
# System time # System time
@ -671,7 +698,7 @@ prompt_todo() {
if $(hash todo.sh 2>&-); then if $(hash todo.sh 2>&-); then
count=$(todo.sh ls | egrep "TODO: [0-9]+ of ([0-9]+) tasks shown" | awk '{ print $4 }') count=$(todo.sh ls | egrep "TODO: [0-9]+ of ([0-9]+) tasks shown" | awk '{ print $4 }')
if [[ "$count" = <-> ]]; then if [[ "$count" = <-> ]]; then
"$1_prompt_segment" "$0" "$2" "244" "$DEFAULT_COLOR" "$(print_icon 'TODO_ICON') $count" "$1_prompt_segment" "$0" "$2" "244" "$DEFAULT_COLOR" "$count" 'TODO_ICON'
fi fi
fi fi
} }
@ -696,8 +723,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,9 +750,11 @@ 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" "$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 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
fi fi
} }
@ -819,7 +847,7 @@ $(print_icon 'MULTILINE_SECOND_PROMPT_PREFIX')"
RPROMPT_PREFIX='%{'$'\e[1A''%}' # one line up RPROMPT_PREFIX='%{'$'\e[1A''%}' # one line up
RPROMPT_SUFFIX='%{'$'\e[1B''%}' # one line down RPROMPT_SUFFIX='%{'$'\e[1B''%}' # one line down
else else
RPROMPT_PREFIX='' RPROMPT_PREFIX=''
RPROMPT_SUFFIX='' RPROMPT_SUFFIX=''
fi fi
else else
@ -875,7 +903,7 @@ powerlevel9k_init() {
print_deprecation_warning deprecated_segments print_deprecation_warning deprecated_segments
setopt prompt_subst setopt prompt_subst
setopt LOCAL_OPTIONS setopt LOCAL_OPTIONS
unsetopt XTRACE KSH_ARRAYS unsetopt XTRACE KSH_ARRAYS
setopt PROMPT_CR PROMPT_PERCENT PROMPT_SUBST MULTIBYTE setopt PROMPT_CR PROMPT_PERCENT PROMPT_SUBST MULTIBYTE

Loading…
Cancel
Save