summaryrefslogtreecommitdiff
path: root/powerlevel9k.zsh-theme
diff options
context:
space:
mode:
authorChristo Kotze <onaforeignshore@hotmail.co.uk>2018-02-14 10:42:40 +0300
committerChristo Kotze <onaforeignshore@hotmail.co.uk>2018-02-14 10:42:40 +0300
commit536549ea6231dd1fb15077de6e90abd1809eff04 (patch)
tree9b354fbf6e2461b23ed41ff7f448438752b1d5dc /powerlevel9k.zsh-theme
parent5491ee35c33ac8321fa6e61f1c330a1731e5d689 (diff)
Parameter substitution instead of dirname/basename
Replaced external calls to `dirname` and `basename` with paramater substitution.
Diffstat (limited to 'powerlevel9k.zsh-theme')
-rwxr-xr-xpowerlevel9k.zsh-theme12
1 files changed, 8 insertions, 4 deletions
diff --git a/powerlevel9k.zsh-theme b/powerlevel9k.zsh-theme
index e5429635..4f313418 100755
--- a/powerlevel9k.zsh-theme
+++ b/powerlevel9k.zsh-theme
@@ -868,17 +868,21 @@ prompt_dir() {
local dir_state_foreground=${(P)dir_state_user_foreground}
[[ -z ${dir_state_foreground} ]] && dir_state_foreground="${DEFAULT_COLOR}"
+ local dir_name base_name
+ dir_name=${path_opt%/*}
+ base_name=${path_opt##*/}
+
if [[ -n ${POWERLEVEL9K_DIR_PATH_HIGHLIGHT_FOREGROUND} ]]; then
- if [[ $path_opt == "/" || $path_opt == "~" || $(dirname $path_opt) == "/" || ${POWERLEVEL9K_DIR_OMIT_FIRST_CHARACTER} ]]; then
+ if [[ $path_opt == "/" || $path_opt == "~" || ${POWERLEVEL9K_DIR_OMIT_FIRST_CHARACTER} ]]; then
current_path="$bld%F{$POWERLEVEL9K_DIR_PATH_HIGHLIGHT_FOREGROUND}$current_path%F{$dir_state_foreground}%b%F{$dir_state_foreground}"
else
- current_path="$(dirname $current_path)/$bld%F{$POWERLEVEL9K_DIR_PATH_HIGHLIGHT_FOREGROUND}$(basename $current_path)%b%F{$dir_state_foreground}"
+ current_path="${dir_name}/$bld%F{$POWERLEVEL9K_DIR_PATH_HIGHLIGHT_FOREGROUND}${base_name}%b%F{$dir_state_foreground}"
fi
else
- if [[ $path_opt == "/" || $path_opt == "~" || $(dirname $path_opt) == "/" || ${POWERLEVEL9K_DIR_OMIT_FIRST_CHARACTER} ]]; then
+ if [[ $path_opt == "/" || $path_opt == "~" || ${POWERLEVEL9K_DIR_OMIT_FIRST_CHARACTER} ]]; then
current_path="$bld%F{$dir_state_foreground}$current_path%b%F{$dir_state_foreground}"
else
- current_path="%F{$dir_state_foreground}$(dirname $current_path)/$bld$(basename $current_path)%b%F{$dir_state_foreground}"
+ current_path="%F{$dir_state_foreground}${dir_name}/$bld${base_name}%b%F{$dir_state_foreground}"
fi
fi