572b27b75724d00fbc99ef64de3dbd21a28c8194
- Author
- Andrew Hodges <betawaffle@gmail.com>
- Committer
- Andrew Hodges <betawaffle@gmail.com>
- Date
Message
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.
Diff
1diff --git a/plugins/ruby/ruby.plugin.zsh b/plugins/ruby/ruby.plugin.zsh
2index 82bf5d49d4420c398520709236a38291b4459cb9..08ca9c60178faf69bb92b4bcd1a5fd66b31f49eb 100644
3--- a/plugins/ruby/ruby.plugin.zsh
4+++ b/plugins/ruby/ruby.plugin.zsh
5@@ -1,4 +1,6 @@
6+# TODO: Make this compatible with rvm.
7+# Run sudo gem on the system ruby, not the active ruby.
8 alias sgem='sudo gem'
9
10 # Find ruby file
11-alias rfind='find . -name *.rb | xargs grep -n'
12+alias rfind='find . -name *.rb | xargs grep -n'
13diff --git a/plugins/rvm/rvm.plugin.zsh b/plugins/rvm/rvm.plugin.zsh
14index 509dcbd986e89c577e89d3e4ac209e8c924b015b..8a3ec788a4ad1363e833808cf7c410c9c3afc9e9 100644
15--- a/plugins/rvm/rvm.plugin.zsh
16+++ b/plugins/rvm/rvm.plugin.zsh
17@@ -38,3 +38,15 @@ function rvm-update {
18 function rvm-link-completion {
19 ln -s "$rvm_path/scripts/zsh/Completion/_rvm" "$ZSH/plugins/rvm/_rvm.official"
20 }
21+
22+# TODO: Make this usable w/o rvm.
23+function gems {
24+ local current_ruby=`rvm-prompt i v p`
25+ local current_gemset=`rvm-prompt g`
26+
27+ gem list $@ | sed \
28+ -Ee "s/\([0-9\.]+( .+)?\)/$fg[blue]&$reset_color/g" \
29+ -Ee "s|$(echo $rvm_path)|$fg[magenta]\$rvm_path$reset_color|g" \
30+ -Ee "s/$current_ruby@global/$fg[yellow]&$reset_color/g" \
31+ -Ee "s/$current_ruby$current_gemset$/$fg[green]&$reset_color/g"
32+}