2014-01-06 16:57:23 +08:00
|
|
|
# *_prompt_info functions for usage in your prompt
|
|
|
|
#
|
|
|
|
# Plugin creators, please add your *_prompt_info function to the list
|
|
|
|
# of dummy implementations to help theme creators not receiving errors
|
|
|
|
# without the need of implementing conditional clauses.
|
|
|
|
#
|
|
|
|
# See also lib/bzr.zsh, lib/git.zsh and lib/nvm.zsh for
|
|
|
|
# git_prompt_info, bzr_prompt_info and nvm_prompt_info
|
|
|
|
|
|
|
|
# Dummy implementations that return false to prevent command_not_found
|
|
|
|
# errors with themes, that implement these functions
|
|
|
|
# Real implementations will be used when the respective plugins are loaded
|
2015-11-07 06:20:11 +08:00
|
|
|
function chruby_prompt_info \
|
|
|
|
rbenv_prompt_info \
|
|
|
|
hg_prompt_info \
|
|
|
|
pyenv_prompt_info \
|
|
|
|
svn_prompt_info \
|
|
|
|
vi_mode_prompt_info \
|
|
|
|
virtualenv_prompt_info \
|
|
|
|
jenv_prompt_info \
|
2023-02-07 19:33:59 +08:00
|
|
|
azure_prompt_info \
|
2021-03-08 17:46:42 +08:00
|
|
|
tf_prompt_info \
|
2015-11-07 06:20:11 +08:00
|
|
|
{
|
2014-01-06 16:57:09 +08:00
|
|
|
return 1
|
|
|
|
}
|
|
|
|
|
|
|
|
# oh-my-zsh supports an rvm prompt by default
|
2013-12-31 09:11:02 +08:00
|
|
|
# get the name of the rvm ruby version
|
|
|
|
function rvm_prompt_info() {
|
|
|
|
[ -f $HOME/.rvm/bin/rvm-prompt ] || return 1
|
|
|
|
local rvm_prompt
|
2014-01-08 02:08:20 +08:00
|
|
|
rvm_prompt=$($HOME/.rvm/bin/rvm-prompt ${=ZSH_THEME_RVM_PROMPT_OPTIONS} 2>/dev/null)
|
2015-11-07 06:20:11 +08:00
|
|
|
[[ -z "${rvm_prompt}" ]] && return 1
|
2021-12-14 00:43:32 +08:00
|
|
|
echo "${ZSH_THEME_RUBY_PROMPT_PREFIX}${rvm_prompt:gs/%/%%}${ZSH_THEME_RUBY_PROMPT_SUFFIX}"
|
2013-12-31 09:11:02 +08:00
|
|
|
}
|
|
|
|
|
2015-11-07 06:20:11 +08:00
|
|
|
ZSH_THEME_RVM_PROMPT_OPTIONS="i v g"
|
|
|
|
|
|
|
|
|
2014-01-06 16:57:09 +08:00
|
|
|
# use this to enable users to see their ruby version, no matter which
|
|
|
|
# version management system they use
|
2013-12-31 09:11:02 +08:00
|
|
|
function ruby_prompt_info() {
|
2024-02-04 05:50:44 +08:00
|
|
|
echo "$(rvm_prompt_info || rbenv_prompt_info || chruby_prompt_info)"
|
2013-12-31 09:11:02 +08:00
|
|
|
}
|