Created
April 3, 2016 07:17
-
-
Save paddycarver/4bc55b5d62310466c4880285939dc2be to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function prompt_char { | |
git branch >/dev/null 2>/dev/null && echo '%' && return | |
echo '$' | |
} | |
function get_directory { | |
DIR=${PWD/#$HOME/\~} | |
if [[ ! -f ~/.specialdirs || ! -r ~/.specialdirs ]]; then | |
echo $DIR && return | |
fi | |
while read line | |
do | |
[[ $line = "#"* ]] && continue | |
variable=${line[(ws:=:)1]} | sed -e 's/^ *//' | sed -e 's/ *$//' | |
dir=${line[(ws:=:)2]} | sed -e 's/^ *//' | sed -e 's/ *$//' | |
[[ $DIR = $dir* ]] && echo ${DIR/#$dir/\$$variable} && return | |
done < ~/.specialdirs | |
echo $DIR && return | |
} | |
PROMPT='%{$fg[blue]%}$(hostname -s)%{$reset_color%} > %{$fg_bold[green]%}$(get_directory)%{$reset_color%}$(git_prompt_info) $(prompt_char) ' | |
ZSH_THEME_GIT_PROMPT_PREFIX=" on %{$fg[magenta]%}" | |
ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}" | |
ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[green]%}!" | |
ZSH_THEME_GIT_PROMPT_UNTRACKED="%{$fg[green]%}?" | |
ZSH_THEME_GET_PROMPT_CLEAN="" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment