mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2024-12-24 04:56:16 -07:00
299cd4777a
Changes themes displaying RVM or other Ruby version info to use the central ruby_prompt_info function. This supports more Ruby versioning mechanisms, reduces copy-and-paste code, and avoids "zsh: no such file or directory: rvm-prompt" when run on machines that do not have RVM installed. Changes the prefix/suffix variable names to ZSH_THEME_RUBY_PROMPT_PREFIX and ZSH_THEME_RUBY_PROMPT_SUFFIX, since they apply to all Ruby versioning mechanisms, not just RVM. Allows empty ZSH_THEME_RUBY_PROMPT_PREFIX and ZSH_THEME_RUBY_PROMPT_SUFFIX.
22 lines
661 B
Bash
22 lines
661 B
Bash
function prompt_char {
|
|
git branch >/dev/null 2>/dev/null && echo '±' && return
|
|
hg root >/dev/null 2>/dev/null && echo 'Hg' && return
|
|
echo '○'
|
|
}
|
|
|
|
function virtualenv_info {
|
|
[[ -n "$VIRTUAL_ENV" ]] && echo '('${VIRTUAL_ENV:t}') '
|
|
}
|
|
|
|
PROMPT='%F{magenta}%n%f at %F{yellow}%m%f in %B%F{green}%~%f%b$(git_prompt_info)$(ruby_prompt_info)
|
|
$(virtualenv_info) $(prompt_char) '
|
|
|
|
ZSH_THEME_GIT_PROMPT_PREFIX=' on %F{magenta}'
|
|
ZSH_THEME_GIT_PROMPT_SUFFIX='%f'
|
|
ZSH_THEME_GIT_PROMPT_DIRTY='%F{green}!'
|
|
ZSH_THEME_GIT_PROMPT_UNTRACKED='%F{green}?'
|
|
ZSH_THEME_GIT_PROMPT_CLEAN=''
|
|
|
|
ZSH_THEME_RUBY_PROMPT_PREFIX=' using %F{red}'
|
|
ZSH_THEME_RUBY_PROMPT_SUFFIX='%f'
|