bash completion on empty (blank) command

Viewed 388

On MSYS2 on my Windows machine, I have to switch to bash because tcsh is flaky and after an hour of messing around with completion scripts, .bashrc and .inputrc, I have almost got bash to behave in a way I am used to. However, there's one piece missing.

In tcsh, I could list the current directory on a single TAB press (i.e., a blank command). I am sure there's a way to do this in bash with the complete -E option, but I can find no examples.

Any help is appreciated!

Regards

2 Answers

This will do what you want:

complete -Ef

Now try <tab><tab>

I was able to get what I wanted with this:

_listall () 
{
    COMPREPLY+=( $( ls ./))
}
complete -F _listall -E 
Related