Created
October 6, 2009 15:29
-
-
Save ahx/203121 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# geme (aka mategem, vigem..) - open gem source in $EDITOR | |
geme() { | |
_geme_init_gemdir | |
$EDITOR $GEMDIR/gems/`$(which ls) $GEMDIR/gems | grep -x $1.* | sort | tail -1`/ | |
} | |
_geme() { | |
_geme_init_gemdir | |
COMPREPLY=() | |
local curw=${COMP_WORDS[COMP_CWORD]} | |
COMPREPLY=($(compgen -W '$(ls $GEMDIR/gems)' -- $curw)); | |
return 0 | |
} | |
_geme_init_gemdir() { | |
# This function is here, because dont want to wait for 'gem env gemdir' | |
# each time i open a new Terminal window. | |
if [[ $GEMDIR ]]; then | |
return | |
else | |
export GEMDIR=`gem env gemdir` | |
fi | |
} | |
complete -F _geme -o dirnames geme |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment