-
Notifications
You must be signed in to change notification settings - Fork 924
Expanding on custom directory icons #1387
Description
First I just want to say that I am brand new to git and contributing to open source projects. This might be a simple issue.
I want to modify the prompt_dir() function in powerklevel9k.zsh-theme to include more conditions to replace the icon depending of the state_path.
This issue is related to #606.
This can be easily done if you just add dir states and separate conditions. For instance, here I've added a "DROPBOX""state that uses "DROPBOX_ICON" for paths that contain '~/dropbox'*, almost exactly the same as the current/etc conditions.
# save state of path for highlighting and bold options
local path_opt=$current_path
typeset -AH dir_states
dir_states=(
"DEFAULT" "FOLDER_ICON"
"HOME" "HOME_ICON"
"HOME_SUBFOLDER" "HOME_SUB_ICON"
"NOT_WRITABLE" "LOCK_ICON"
"ETC" "ETC_ICON"
"DROPBOX" "DROPBOX_ICON"
)
local state_path="$(print -P '%~')"
local current_state="DEFAULT"
if [[ $state_path == '/etc'* ]]; then
current_state='ETC'
elif [[ "${POWERLEVEL9K_DIR_SHOW_WRITABLE}" == true && ! -w "$PWD" ]]; then
current_state="NOT_WRITABLE"
elif [[ $state_path == '~/dropbox'* ]]; then
current_state="DROPBOX"
elif [[ $state_path == '~' ]]; then
current_state="HOME"
elif [[ $state_path == '~'* ]]; then
current_state="HOME_SUBFOLDER"
fi
My question is; how could we do this within .zshrc instead of modifying powerline9k.zsh-theme?
I've seen other users utilize the custom_user prompt status in .zshrc to easily add icons and the like, but to my knowledge there is not a custom_dir status to do the same thing, and even so would it allow conditional formatting to icons?