]> git.rmz.io Git - dotfiles.git/blob - zsh/plugins/rvm/rvm.plugin.zsh
1ab800b0f9c9ee12a63a823b6a4660e5bfa23618
[dotfiles.git] / zsh / plugins / rvm / rvm.plugin.zsh
1 fpath=($rvm_path/scripts/zsh/Completion $fpath)
2
3 alias rubies='rvm list rubies'
4 alias gemsets='rvm gemset list'
5
6 local ruby18='ruby-1.8.7-p334'
7 local ruby19='ruby-1.9.3-p194'
8
9 function rb18 {
10 if [ -z "$1" ]; then
11 rvm use "$ruby18"
12 else
13 rvm use "$ruby18@$1"
14 fi
15 }
16
17 _rb18() {compadd `ls -1 $rvm_path/gems | grep "^$ruby18@" | sed -e "s/^$ruby18@//" | awk '{print $1}'`}
18 compdef _rb18 rb18
19
20 function rb19 {
21 if [ -z "$1" ]; then
22 rvm use "$ruby19"
23 else
24 rvm use "$ruby19@$1"
25 fi
26 }
27
28 _rb19() {compadd `ls -1 $rvm_path/gems | grep "^$ruby19@" | sed -e "s/^$ruby19@//" | awk '{print $1}'`}
29 compdef _rb19 rb19
30
31 function rvm-update {
32 rvm get head
33 rvm reload # TODO: Reload rvm completion?
34 }
35
36 # TODO: Make this usable w/o rvm.
37 function gems {
38 local current_ruby=`rvm-prompt i v p`
39 local current_gemset=`rvm-prompt g`
40
41 gem list $@ | sed \
42 -Ee "s/\([0-9, \.]+( .+)?\)/$fg[blue]&$reset_color/g" \
43 -Ee "s|$(echo $rvm_path)|$fg[magenta]\$rvm_path$reset_color|g" \
44 -Ee "s/$current_ruby@global/$fg[yellow]&$reset_color/g" \
45 -Ee "s/$current_ruby$current_gemset$/$fg[green]&$reset_color/g"
46 }
47
48 function _rvm_completion {
49 source $rvm_path"/scripts/zsh/Completion/_rvm"
50 }
51 compdef _rvm_completion rvm