tabtab - freakin awesome!
November 23rd, 2008
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!
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 :)November 23rd, 2008 at 02:33 AM
Ian White Says:
A happy coincidence!November 23rd, 2008 at 04:14 AM
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 )December 2nd, 2008 at 09:15 AM