2021-12-28 14:09:11 -07:00
|
|
|
# Completion
|
|
|
|
fpath+=("${rvm_path}/scripts/zsh/Completion")
|
2012-11-19 01:04:10 -07:00
|
|
|
|
2022-01-05 01:10:32 -07:00
|
|
|
typeset -g -A _comps
|
2021-12-28 14:09:11 -07:00
|
|
|
autoload -Uz _rvm
|
|
|
|
_comps[rvm]=_rvm
|
|
|
|
|
|
|
|
# Aliases
|
2011-05-28 07:23:06 -07:00
|
|
|
alias rubies='rvm list rubies'
|
2021-12-17 17:14:14 -07:00
|
|
|
alias rvms='rvm gemset'
|
|
|
|
alias gemsets='rvms list'
|
2011-05-28 07:23:06 -07:00
|
|
|
|
2011-05-28 07:16:06 -07:00
|
|
|
|
2021-12-28 14:09:11 -07:00
|
|
|
# rb{version} utilities
|
|
|
|
# From `rvm list known`
|
|
|
|
typeset -A rubies
|
|
|
|
rubies=(
|
|
|
|
18 'ruby-1.8.7'
|
|
|
|
19 'ruby-1.9.3'
|
|
|
|
20 'ruby-2.0.0'
|
|
|
|
21 'ruby-2.1'
|
|
|
|
22 'ruby-2.2'
|
|
|
|
23 'ruby-2.3'
|
|
|
|
24 'ruby-2.4'
|
|
|
|
25 'ruby-2.5'
|
|
|
|
26 'ruby-2.6'
|
|
|
|
27 'ruby-2.7'
|
|
|
|
30 'ruby-3.0'
|
2022-03-07 02:58:18 -07:00
|
|
|
31 'ruby-3.1'
|
2023-03-01 03:23:32 -07:00
|
|
|
32 'ruby-3.2'
|
2021-12-28 14:09:11 -07:00
|
|
|
)
|
|
|
|
|
|
|
|
for v in ${(k)rubies}; do
|
|
|
|
version="${rubies[$v]}"
|
|
|
|
functions[rb${v}]="rvm use ${version}\${1+"@\$1"}"
|
|
|
|
functions[_rb${v}]="compadd \$(ls -1 \"\${rvm_path}/gems\" | grep '^${version}@' | sed -e 's/^${version}@//' | awk '{print $1}')"
|
|
|
|
compdef _rb$v rb$v
|
|
|
|
done
|
|
|
|
unset rubies v version
|
2011-05-28 07:16:06 -07:00
|
|
|
|
2021-12-28 13:41:08 -07:00
|
|
|
|
2011-05-28 07:35:54 -07:00
|
|
|
function rvm-update {
|
2021-12-28 14:09:11 -07:00
|
|
|
rvm get head
|
2011-05-28 07:35:54 -07:00
|
|
|
}
|
|
|
|
|
2011-05-28 07:50:06 -07:00
|
|
|
# TODO: Make this usable w/o rvm.
|
|
|
|
function gems {
|
2021-12-28 14:09:11 -07:00
|
|
|
local current_ruby=`rvm-prompt i v p`
|
|
|
|
local current_gemset=`rvm-prompt g`
|
2012-09-02 20:51:28 -07:00
|
|
|
|
2021-12-28 14:09:11 -07:00
|
|
|
gem list $@ | sed -E \
|
|
|
|
-e "s/\([0-9, \.]+( .+)?\)/$fg[blue]&$reset_color/g" \
|
|
|
|
-e "s|$(echo $rvm_path)|$fg[magenta]\$rvm_path$reset_color|g" \
|
|
|
|
-e "s/$current_ruby@global/$fg[yellow]&$reset_color/g" \
|
|
|
|
-e "s/$current_ruby$current_gemset$/$fg[green]&$reset_color/g"
|
2012-09-02 20:51:28 -07:00
|
|
|
}
|