You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
44 lines
1.1 KiB
44 lines
1.1 KiB
15 years ago
|
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%})"
|
||
|
|
||
15 years ago
|
function josh_prompt {
|
||
15 years ago
|
(( spare_width = ${COLUMNS} ))
|
||
|
prompt=" "
|
||
|
|
||
|
branch=$(current_branch)
|
||
|
ruby_version=$(rvm_prompt_info)
|
||
|
path_size=${#PWD}
|
||
|
branch_size=${#branch}
|
||
|
ruby_size=${#ruby_version}
|
||
15 years ago
|
user_machine_size=${#${(%):-%n@%m-}}
|
||
14 years ago
|
|
||
15 years ago
|
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
|
||
14 years ago
|
|
||
15 years ago
|
(( spare_width = ${spare_width} - (${user_machine_size} + ${path_size} + ${branch_size} + ${ruby_size}) ))
|
||
15 years ago
|
|
||
|
while [ ${#prompt} -lt $spare_width ]; do
|
||
|
prompt=" $prompt"
|
||
|
done
|
||
14 years ago
|
|
||
15 years ago
|
prompt="%{%F{green}%}$PWD$prompt%{%F{red}%}$(rvm_prompt_info)%{$reset_color%} $(git_prompt_info)"
|
||
14 years ago
|
|
||
15 years ago
|
echo $prompt
|
||
|
}
|
||
|
|
||
|
setopt prompt_subst
|
||
|
|
||
|
PROMPT='
|
||
15 years ago
|
%n@%m $(josh_prompt)
|
||
15 years ago
|
%(?,%{%F{green}%},%{%F{red}%})⚡%{$reset_color%} '
|