mirror of
https://github.com/romkatv/powerlevel10k.git
synced 2024-11-12 08:10:07 +00:00
Modify dir segment to use proper states
This commit is contained in:
parent
afa256f5b3
commit
7a776dc68c
1 changed files with 10 additions and 6 deletions
|
@ -501,17 +501,21 @@ prompt_dir() {
|
||||||
current_path="%$((POWERLEVEL9K_SHORTEN_DIR_LENGTH+1))(c:$POWERLEVEL9K_SHORTEN_DELIMITER/:)%${POWERLEVEL9K_SHORTEN_DIR_LENGTH}c"
|
current_path="%$((POWERLEVEL9K_SHORTEN_DIR_LENGTH+1))(c:$POWERLEVEL9K_SHORTEN_DELIMITER/:)%${POWERLEVEL9K_SHORTEN_DIR_LENGTH}c"
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
fi
|
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
|
if [[ $(print -P "%~") == '~' ]]; then
|
||||||
"$1_prompt_segment" "$0_HOME" "$2" "blue" "$DEFAULT_COLOR" "$current_path" 'HOME_ICON'
|
current_state="HOME"
|
||||||
elif [[ $(print -P "%~") == '~'* ]]; then
|
elif [[ $(print -P "%~") == '~'* ]]; then
|
||||||
"$1_prompt_segment" "$0_HOME_SUBFOLDER" "$2" "blue" "$DEFAULT_COLOR" "$current_path" 'HOME_SUB_ICON'
|
current_state="HOME_SUBFOLDER"
|
||||||
else
|
|
||||||
"$1_prompt_segment" "$0_DEFAULT" "$2" "blue" "$DEFAULT_COLOR" "$current_path" 'FOLDER_ICON'
|
|
||||||
fi
|
fi
|
||||||
|
"$1_prompt_segment" "$0_${current_state}" "$2" "blue" "$DEFAULT_COLOR" "$current_path" "${dir_states[$current_state]}"
|
||||||
}
|
}
|
||||||
|
|
||||||
# Docker machine
|
# Docker machine
|
||||||
|
|
Loading…
Reference in a new issue