Skip to content

Instantly share code, notes, and snippets.

@adonaldson
Created December 30, 2009 12:14
Show Gist options
  • Save adonaldson/266009 to your computer and use it in GitHub Desktop.
Save adonaldson/266009 to your computer and use it in GitHub Desktop.
# Add the following to your .bash_profile for auto-completion
# (e.g. mvimgem <tabtab>)
#
# Modified to work with mvim instead of Textmate
# Original: http://effectif.com/articles/opening-ruby-gems-in-textmate
_mvimgem()
{
local curw
COMPREPLY=()
curw=${COMP_WORDS[COMP_CWORD]}
local gems="$(gem environment gemdir)/gems"
COMPREPLY=($(compgen -W '$(ls $gems)' -- $curw));
return 0
}
complete -F _mvimgem -o dirnames mvimgem
#!/bin/sh
#
# Modified to work with mvim instead of Textmate
# Original: http://effectif.com/articles/opening-ruby-gems-in-textmate
#
usage()
{
echo "Usage: $(basename $0) <gem>" 1>&2
exit 1
}
GEM="$1"
[ -z "$GEM" ] && usage
mvim "$(gem environment gemdir)/gems/$GEM"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment