Skip to content

Instantly share code, notes, and snippets.

@davidlee
Created August 4, 2009 01:02
Show Gist options
  • Save davidlee/160959 to your computer and use it in GitHub Desktop.
Save davidlee/160959 to your computer and use it in GitHub Desktop.
setopt interactive_comments;
#
# gem tools
#
# this is a guess. salt to taste.
export GEMPATH=`ruby -e 'require "rubygems"; puts Gem.path.reject{|p| p =~ /\.gem/ }.first'`/gems
# completion fuction for compdef: just lists the gems folders
_gems() { compadd `cd $GEMPATH; echo *` }
_ghems() { compadd `cd $GEMPATH; echo *-* | egrep '' ` }
compdef _gems gemcd ; gemcd() { cd $GEMPATH/$1 }
compdef _gems gemedit ; gemedit() { mate $GEMPATH/$1 }
compdef _gems gemgrep ; gemgrep() { grep -r $1 $GEMPATH/$2 }
compdef _gems gemgrin ; gemgrin() { grin $1 $GEMPATH/$2 }
compdef _ghems gh ; ghd() { }
# alias g="echo $GEMPATH"
alias gme="gemedit $1"
alias gmc="gemcd $1"
alias gmg="gemgrin $1 $2"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment