2010-08-17 12:45:10 +00:00
|
|
|
grey='\e[0;90m'
|
|
|
|
|
|
|
|
ZSH_THEME_GIT_PROMPT_PREFIX="%{$grey%}("
|
|
|
|
ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}"
|
|
|
|
ZSH_THEME_GIT_PROMPT_DIRTY="%{$grey%}) %{$fg[yellow]%}✗%{$reset_color%}"
|
|
|
|
ZSH_THEME_GIT_PROMPT_CLEAN="%{$grey%})"
|
|
|
|
|
2010-08-17 13:22:26 +00:00
|
|
|
function josh_prompt {
|
2010-08-17 12:45:10 +00:00
|
|
|
(( spare_width = ${COLUMNS} ))
|
|
|
|
prompt=" "
|
|
|
|
|
|
|
|
branch=$(current_branch)
|
2012-01-24 01:42:54 +00:00
|
|
|
ruby_version=$(rvm_prompt_info || rbenv_prompt_info)
|
2010-08-17 12:45:10 +00:00
|
|
|
path_size=${#PWD}
|
|
|
|
branch_size=${#branch}
|
|
|
|
ruby_size=${#ruby_version}
|
2010-08-17 13:22:26 +00:00
|
|
|
user_machine_size=${#${(%):-%n@%m-}}
|
2010-08-17 12:45:10 +00:00
|
|
|
|
|
|
|
if [[ ${#branch} -eq 0 ]]
|
|
|
|
then (( ruby_size = ruby_size + 1 ))
|
|
|
|
else
|
|
|
|
(( branch_size = branch_size + 4 ))
|
|
|
|
if [[ -n $(git status -s 2> /dev/null) ]]; then
|
|
|
|
(( branch_size = branch_size + 2 ))
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
2010-08-17 13:22:26 +00:00
|
|
|
(( spare_width = ${spare_width} - (${user_machine_size} + ${path_size} + ${branch_size} + ${ruby_size}) ))
|
2010-08-17 12:45:10 +00:00
|
|
|
|
|
|
|
while [ ${#prompt} -lt $spare_width ]; do
|
|
|
|
prompt=" $prompt"
|
|
|
|
done
|
|
|
|
|
2012-03-23 19:31:13 +00:00
|
|
|
prompt="%{%F{green}%}$PWD$prompt%{%F{red}%}$(rvm_prompt_info || rbenv_prompt_info)%{$reset_color%} $(current_branch)"
|
2010-08-17 12:45:10 +00:00
|
|
|
|
|
|
|
echo $prompt
|
|
|
|
}
|
|
|
|
|
|
|
|
setopt prompt_subst
|
|
|
|
|
|
|
|
PROMPT='
|
2010-08-17 13:22:26 +00:00
|
|
|
%n@%m $(josh_prompt)
|
2010-08-17 12:45:10 +00:00
|
|
|
%(?,%{%F{green}%},%{%F{red}%})⚡%{$reset_color%} '
|