Work on zsh config

This commit is contained in:
Jonathan Hodgson 2017-07-11 17:20:15 +01:00
parent 8fb651b26c
commit 44c1854984
3 changed files with 41 additions and 9 deletions

View file

@ -3,28 +3,35 @@
# Custom dir command
function my_dir(){
homeIcon=" "
wpPluginsIcon=""
wpThemesIcon=""
wpPluginsIcon=".p."
wpThemesIcon=".t."
siteIcon=" "
dropboxIcon=" "
seperator=""
# Gets the path.
local current_path="$(print -P "%~")"
# Replace either ~ or ~/ with 
current_path=$(echo $current_path | sed -r -e "s/\~?/$homeIcon/")
current_path=$(echo $current_path | sed -r -e "s/\~/$homeIcon/")
# Replace wp-content/themes with theme icon if in theme
current_path=$(echo $current_path | sed -r -e "s/wp\-content\/themes/$wpThemesIcon/")
# current_path=$(echo $current_path | sed -r -e "s/wp\-content\/themes/$wpThemesIcon/")
# Replace wp-content/plugins with plugin icon if in plugin
current_path=$(echo $current_path | sed -r -e "s/wp\-content\/plugins/$wpPluginsIcon/")
# current_path=$(echo $current_path | sed -r -e "s/wp\-content\/plugins/$wpPluginsIcon/")
#If in a site folder, replace home/Sites/<site-name>/public_html with siteIcon <site-name>
# If in a site folder, replace home/Sites/<site-name>/public_html with siteIcon <site-name>
current_path=$(echo $current_path | sed -r -e "s/$homeIcon\/Sites\/([a-z_\-]*)\/public_html/$siteIcon\1/")
#Replace Dropbox with icon
# Replace Dropbox with icon
current_path=$(echo $current_path | sed -r -e "s/$homeIcon\/Dropbox/$dropboxIcon/")
# Change wp-content in sub folders
current_path=$(echo $current_path | sed -r -e "s/wp\-content\//wpc\//")
# Set the seperator
current_path=$(echo $current_path | sed -r -e "s/\//$seperator/g")
echo $current_path
}
@ -32,6 +39,9 @@ POWERLEVEL9K_CUSTOM_DIR="my_dir"
POWERLEVEL9K_CUSTOM_DIR_BACKGROUND="blue"
POWERLEVEL9K_CUSTOM_DIR_FOREGROUND="white"
# POWERLEVEL9K_LEFT_SEGMENT_SEPARATOR="\ue0c0"
# POWERLEVEL9K_RIGHT_SEGMENT_SEPARATOR="\ue0c2"
# Left Prompt
POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(custom_dir rbenv vcs)