rvm.plugin.zsh 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. alias rubies='rvm list rubies'
  2. alias gemsets='rvm gemset list'
  3. local ruby18='ruby-1.8.7-p334'
  4. local ruby19='ruby-1.9.2-p180'
  5. function rb18 {
  6. if [ -z "$1" ]; then
  7. rvm use "$ruby18"
  8. else
  9. rvm use "$ruby18@$1"
  10. fi
  11. }
  12. _rb18() {compadd `ls -1 $rvm_path/gems | grep "^$ruby18@" | sed -e "s/^$ruby18@//" | awk '{print $1}'`}
  13. compdef _rb18 rb18
  14. function rb19 {
  15. if [ -z "$1" ]; then
  16. rvm use "$ruby19"
  17. else
  18. rvm use "$ruby19@$1"
  19. fi
  20. }
  21. _rb19() {compadd `ls -1 $rvm_path/gems | grep "^$ruby19@" | sed -e "s/^$ruby19@//" | awk '{print $1}'`}
  22. compdef _rb19 rb19
  23. function rvm-update {
  24. rvm get head
  25. rvm reload # TODO: Reload rvm completion?
  26. }
  27. # TODO: Make this usable w/o rvm.
  28. function gems {
  29. local current_ruby=`rvm-prompt i v p`
  30. local current_gemset=`rvm-prompt g`
  31. gem list $@ | sed \
  32. -Ee "s/\([0-9\.]+( .+)?\)/$fg[blue]&$reset_color/g" \
  33. -Ee "s|$(echo $rvm_path)|$fg[magenta]\$rvm_path$reset_color|g" \
  34. -Ee "s/$current_ruby@global/$fg[yellow]&$reset_color/g" \
  35. -Ee "s/$current_ruby$current_gemset$/$fg[green]&$reset_color/g"
  36. }