views:

202

answers:

3

I have not found a tab-completion script for RubyGem in Bash/Zsh.

Where can you get the tab-completion script for RubyGem in Bahs/Zsh?

+1  A: 

Executable RubyGem commands are installed into /usr/bin or /usr/local/bin or whatever prefix Ruby is found under. Tab completion for commands should just work just like any other executable file in your PATH. If it's not working, verify that the directory RubyGems installs commands into is in your PATH.

There is currently no official method of doing tab completion for the parameters to any of these commands. If you need tab completion for a command installed via RubyGems, you'll need to write and/or install it yourself. See the Bash reference manual for details. There may already be a completion system for the specific command you're interested in, so be sure to google for it, but most commands installed via RubyGems do not have any auto-complete written for them.

Bob Aman
A: 

Try: http://github.com/oggy/ruby-bash-completion To install it just copy gem file to /etc/bash_completion.d/

I had errors when trying to tab:

gem install

Because I didn't have some cache files in .gem directory. So I simply disabled it by editing gem file. I changed _gem_all_names function:

function _gem_all_names {
   echo ""
}
klew
A: 

That github-hosted bash completion is now part of Ubuntu Lucid Lynx. Sweet! If you apt-get install rubygems1.8 then the completion (commands and options!) should just work.

Unfortunately, as installed, it will only complete if it sees invocation of gem1.8, and not the more conventient gem. You can fix that manually if so inclined by extending the last line of /etc/bash_completion.d/gem1.8 to include gem as part of the complete name list. I'm sure there's a cleaner way, but that works.

Micah Elliott