diff --git a/plugins/rvm/rvm.plugin.zsh b/plugins/rvm/rvm.plugin.zsh index 604c00713..4e550614b 100644 --- a/plugins/rvm/rvm.plugin.zsh +++ b/plugins/rvm/rvm.plugin.zsh @@ -42,3 +42,12 @@ function gems { -Ee "s/$current_ruby@global/$fg[yellow]&$reset_color/g" \ -Ee "s/$current_ruby$current_gemset$/$fg[green]&$reset_color/g" } + +# Go to the directory where the given gem is defined. +# +# Credit to: https://github.com/henrik/dotfiles/blob/master/bash/functions.sh +function cdgem { + local target=${1?No name for a gem given} + local gemdir=`rvm gemdir` + cd ${gemdir}/gems; cd $(find . -maxdepth 1 -name "*${target}*" | sort | tail -1) +}