tabtab - freakin awesome!

November 23rd, 2008

Ian White

One of the projects to come out of RailsCamp 4 (photos) (well apparently it started on the flight from Birsbane) is Dr Nic's super awesome autocompletions - tabtab.

It's basically context sensitive autocompletion for your ruby (and shell) world (and you can add your own completions). Think git-bash-autocompletion - for everything! To get it installed:

sudo gem install tabtab
install_tabtab

Finally, add source ~/.tabtab.bash to the bottom of your ~/.profile

Here's an example of its use - using the github gem to checkout forks of one of my projects.


Adding your own completions

tabtab has a snazy ruby dsl to add completions. I tried adding them for the CI tool garlic and it took a whole minute!.

This was due to the fact you tabtab will parse your help file (if you tell it to) for the command line options, and the fact that I already had an abstraction in garlic to introspect the command-line/rake-tasks. If you don't have the latter it would take maybe 2 whole minutes.

After I pushed garlic, and on reinstall, I just had to run install_tabtab to have the garlic tabtab def automagically appear in my ~/.tabtab.bash.

Check out the comprehensive README. Thanks Dr Nic!

3 Responses to “tabtab - freakin awesome!”

  1. Dr Nic

    Dr Nic Says:

    This has to be cheating - http://github.com/ianwhite/garlic/tree/master/lib%2Ftabtab_definitions%2Fgarlic.rb#L4-6 - I love it :)
  2. Ian White

    Ian White Says:

    A happy coincidence!
  3. tim

    tim Says:

    In your ~/.inputrc you may specify (for Bash): # enable one-tab completion set show-all-if-ambiguous on # turn on inline mode for tab completion "\t": menu-complete (see http://codesnippets.joyent.com/posts/show/1690 )

Leave a Reply