Bash (and with it Debian and Ubuntu and any number of other variants) has implemented numerous tab-completion extensions since the programmable tab-completion feature first appeared.
Annoyingly, quite possibly the worst implementation of this is for Perl.
The utterly basic version works as usual
adamk@red:~/stuff$ perl (tab)
blib/ Makefile script/ tmp/
Changes Makefile.PL
inc/ META.yml svn-commit.tmp
lib/ pm_to_blib t/
Of course, it doesn't show the Perl options. But you get that from this...
adamk@red:~/stuff$ perl -(tab)
-0 -c -d -e -h -I -m -n -P -S -u -v -w -x
-a -C -D -F -i -l -M -p -s -T -U -V -W -X
So now if you have no idea what the Perl options are called, but you know what they all do, you don't save a keystroke but you can get a reminder. hrm... vaaaaguely useful, ok.
Of course, having already chosen an option, like say to use the debugger, things go downhill..
adamk@red:~/stuff$ perl -d (tab)
adamk@red:~/stuff$ perl -d -
Wait... what?
The only thing I can possibly do after using a Perl option is, apparently, to add ANOTHER option to Perl... and there is no way to get tab completion for files after setting options.
This is utterly brain dead annoying.
Fortunately, a fix (although fiddly) exists.
In
# handle case where first parameter is not a dash option
if [ $COMP_CWORD -eq 1 ] && [[ "$cur" != -* ]]; then
This needs to be changed to this...
# handle case where first parameter is not a dash option
if [[ "$cur" != -* ]]; then
Thanks to Tony Cook for location the line to change, and writing the alternative.
screenshot (Score:1)
zsh ftw (Score:1)
Standard tab completion is one of the reasons I love zsh. If I do
zsh -<Tab>I get:Ordinary morality is for ordinary people. -- Aleister Crowley