1fpath=($rvm_path/scripts/zsh/Completion $fpath)
2
3alias rubies='rvm list rubies'
4alias rvms='rvm gemset'
5alias gemsets='rvms list'
6
7local ruby18='ruby-1.8.7'
8local ruby19='ruby-1.9.3'
9local ruby20='ruby-2.0.0'
10local ruby21='ruby-2.1.2'
11
12function rb18 {
13	if [ -z "$1" ]; then
14		rvm use "$ruby18"
15	else
16		rvm use "$ruby18@$1"
17	fi
18}
19
20_rb18() {compadd `ls -1 $rvm_path/gems | grep "^$ruby18@" | sed -e "s/^$ruby18@//" | awk '{print $1}'`}
21compdef _rb18 rb18
22
23function rb19 {
24	if [ -z "$1" ]; then
25		rvm use "$ruby19"
26	else
27		rvm use "$ruby19@$1"
28	fi
29}
30
31_rb19() {compadd `ls -1 $rvm_path/gems | grep "^$ruby19@" | sed -e "s/^$ruby19@//" | awk '{print $1}'`}
32compdef _rb19 rb19
33
34function rb20 {
35	if [ -z "$1" ]; then
36		rvm use "$ruby20"
37	else
38		rvm use "$ruby20@$1"
39	fi
40}
41
42_rb20() {compadd `ls -1 $rvm_path/gems | grep "^$ruby20@" | sed -e "s/^$ruby20@//" | awk '{print $1}'`}
43compdef _rb20 rb20
44
45function rb21 {
46	if [ -z "$1" ]; then
47		rvm use "$ruby21"
48	else
49		rvm use "$ruby21@$1"
50	fi
51}
52
53_rb21() {compadd `ls -1 $rvm_path/gems | grep "^$ruby21@" | sed -e "s/^$ruby21@//" | awk '{print $1}'`}
54compdef _rb21 rb21
55
56function rvm-update {
57	rvm get head
58}
59
60# TODO: Make this usable w/o rvm.
61function gems {
62	local current_ruby=`rvm-prompt i v p`
63	local current_gemset=`rvm-prompt g`
64
65	gem list $@ | sed -E \
66		-e "s/\([0-9, \.]+( .+)?\)/$fg[blue]&$reset_color/g" \
67		-e "s|$(echo $rvm_path)|$fg[magenta]\$rvm_path$reset_color|g" \
68		-e "s/$current_ruby@global/$fg[yellow]&$reset_color/g" \
69		-e "s/$current_ruby$current_gemset$/$fg[green]&$reset_color/g"
70}
71
72function _rvm_completion {
73  source $rvm_path"/scripts/zsh/Completion/_rvm"
74}
75compdef _rvm_completion rvm
76