aboutsummaryrefslogtreecommitdiff
path: root/powerlevel9k.zsh-theme
diff options
context:
space:
mode:
authorBen Hilburn <bhilburn@gmail.com>2016-12-06 02:30:47 +0300
committerGitHub <noreply@github.com>2016-12-06 02:30:47 +0300
commitffade7bb6db4d0e13ce0aaf07f016f8cdba71070 (patch)
tree46f82508dfe4728bf012d9978bb7719af8aa8654 /powerlevel9k.zsh-theme
parentafa256f5b32babbd72ae70e888919eb801963873 (diff)
parent202ab1500727e4f37545eaff849d4f9a52b823c4 (diff)
Merge pull request #346 from dritter/configurable_path_separators
Configurable path separators
Diffstat (limited to 'powerlevel9k.zsh-theme')
-rwxr-xr-xpowerlevel9k.zsh-theme19
1 files changed, 14 insertions, 5 deletions
diff --git a/powerlevel9k.zsh-theme b/powerlevel9k.zsh-theme
index da3639e1..c4b24b55 100755
--- a/powerlevel9k.zsh-theme
+++ b/powerlevel9k.zsh-theme
@@ -456,6 +456,7 @@ prompt_custom() {
}
# Dir: current working directory
+set_default POWERLEVEL9K_DIR_PATH_SEPARATOR "/"
prompt_dir() {
local current_path='%~'
if [[ -n "$POWERLEVEL9K_SHORTEN_DIR_LENGTH" ]]; then
@@ -501,17 +502,25 @@ prompt_dir() {
current_path="%$((POWERLEVEL9K_SHORTEN_DIR_LENGTH+1))(c:$POWERLEVEL9K_SHORTEN_DELIMITER/:)%${POWERLEVEL9K_SHORTEN_DIR_LENGTH}c"
;;
esac
+ fi
+ if [[ "${POWERLEVEL9K_DIR_PATH_SEPARATOR}" != "/" ]]; then
+ current_path=$(print -P "${current_path}" | sed "s/\//${POWERLEVEL9K_DIR_PATH_SEPARATOR}/g")
fi
- local current_icon=''
+ typeset -AH dir_states
+ dir_states=(
+ "DEFAULT" "FOLDER_ICON"
+ "HOME" "HOME_ICON"
+ "HOME_SUBFOLDER" "HOME_SUB_ICON"
+ )
+ local current_state="DEFAULT"
if [[ $(print -P "%~") == '~' ]]; then
- "$1_prompt_segment" "$0_HOME" "$2" "blue" "$DEFAULT_COLOR" "$current_path" 'HOME_ICON'
+ current_state="HOME"
elif [[ $(print -P "%~") == '~'* ]]; then
- "$1_prompt_segment" "$0_HOME_SUBFOLDER" "$2" "blue" "$DEFAULT_COLOR" "$current_path" 'HOME_SUB_ICON'
- else
- "$1_prompt_segment" "$0_DEFAULT" "$2" "blue" "$DEFAULT_COLOR" "$current_path" 'FOLDER_ICON'
+ current_state="HOME_SUBFOLDER"
fi
+ "$1_prompt_segment" "$0_${current_state}" "$2" "blue" "$DEFAULT_COLOR" "${current_path}" "${dir_states[$current_state]}"
}
# Docker machine