]>
git.rmz.io Git - dotfiles.git/blob - zsh/plugins/rbfu/rbfu.plugin.zsh
0084852054d3c78856b24187a2e485d02b5e04c8
1 # Enables rbfu with --auto option, if available.
3 # Also provides a command to list all installed/available
4 # rubies. To ensure compatibility with themes, creates the
5 # rvm_prompt_info function to return the $RBFU_RUBY_VERSION
8 command -v rbfu
&>/dev
/null
10 if [[ $?
-eq 0 ]]; then
11 eval "$(rbfu --init --auto)"
13 # Internal: Print ruby version details, if it's currently
15 function _rbfu_rubies_print
() {
19 [[ -h $1 ]] && rb_out
="$rb_out${fg[green]}@${reset_color}"
20 [[ "x$rb" == "x$2" ]] && rb_out
="${fg[red]}$rb_out ${fg[red]}*${reset_color}"
24 # Public: Provide a list with all available rubies, this basically depends
25 # on `ls -1` and .rfbu/rubies. Highlights the currently active ruby version
27 function rbfu
-rubies() {
28 local rbfu_dir active_rb
30 active_rb
=$RBFU_RUBY_VERSION
31 [[ -z "$rbfu_dir" ]] && rbfu_dir
="${HOME}/.rbfu/rubies"
32 [[ -z "$active_rb" ]] && active_rb
="system"
33 _rbfu_rubies_print
"${rbfu_dir}/system" $active_rb
34 for rb
in $(ls -1 $rbfu_dir); do
35 _rbfu_rubies_print
"${rbfu_dir}/${rb}" $active_rb
39 # Public: Create rvm_prompt_info command for themes compatibility, unless
40 # it has already been defined.
41 [ ! -x rvm_prompt_info
] && function rvm_prompt_info
() { echo "${RBFU_RUBY_VERSION:=system}" }