summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Hodges <betawaffle@gmail.com>2011-05-28 10:50:06 -0400
committerAndrew Hodges <betawaffle@gmail.com>2011-05-28 10:50:06 -0400
commit572b27b75724d00fbc99ef64de3dbd21a28c8194 (patch)
tree83c48895604fb7a2459b67882b6136079120b8d5
parent9f34bbedc8d4843b0ed50f76d38b63e5aa48cc8b (diff)
downloadzsh-572b27b75724d00fbc99ef64de3dbd21a28c8194.tar.gz
zsh-572b27b75724d00fbc99ef64de3dbd21a28c8194.tar.bz2
zsh-572b27b75724d00fbc99ef64de3dbd21a28c8194.zip
Gem List Helper
Add helper function to list gems in a pretty way (only with rvm, for now). Add missng EOF newline and a todo to the ruby plugin.
-rw-r--r--plugins/ruby/ruby.plugin.zsh4
-rw-r--r--plugins/rvm/rvm.plugin.zsh12
2 files changed, 15 insertions, 1 deletions
diff --git a/plugins/ruby/ruby.plugin.zsh b/plugins/ruby/ruby.plugin.zsh
index 82bf5d49d..08ca9c601 100644
--- a/plugins/ruby/ruby.plugin.zsh
+++ b/plugins/ruby/ruby.plugin.zsh
@@ -1,4 +1,6 @@
+# TODO: Make this compatible with rvm.
+# Run sudo gem on the system ruby, not the active ruby.
alias sgem='sudo gem'
# Find ruby file
-alias rfind='find . -name *.rb | xargs grep -n' \ No newline at end of file
+alias rfind='find . -name *.rb | xargs grep -n'
diff --git a/plugins/rvm/rvm.plugin.zsh b/plugins/rvm/rvm.plugin.zsh
index 509dcbd98..8a3ec788a 100644
--- a/plugins/rvm/rvm.plugin.zsh
+++ b/plugins/rvm/rvm.plugin.zsh
@@ -38,3 +38,15 @@ function rvm-update {
function rvm-link-completion {
ln -s "$rvm_path/scripts/zsh/Completion/_rvm" "$ZSH/plugins/rvm/_rvm.official"
}
+
+# TODO: Make this usable w/o rvm.
+function gems {
+ local current_ruby=`rvm-prompt i v p`
+ local current_gemset=`rvm-prompt g`
+
+ gem list $@ | sed \
+ -Ee "s/\([0-9\.]+( .+)?\)/$fg[blue]&$reset_color/g" \
+ -Ee "s|$(echo $rvm_path)|$fg[magenta]\$rvm_path$reset_color|g" \
+ -Ee "s/$current_ruby@global/$fg[yellow]&$reset_color/g" \
+ -Ee "s/$current_ruby$current_gemset$/$fg[green]&$reset_color/g"
+}