2

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

user0
  • 97
  • 9

3 Answers3

4

This will do what you want:

complete -Ef

Now try <tab><tab>

hek2mgl
  • 152,036
  • 28
  • 249
  • 266
1

I was able to get what I wanted with this:

_listall () 
{
    COMPREPLY+=( $( ls ./))
}
complete -F _listall -E 
user0
  • 97
  • 9
  • 2
    This won't work as expected for filenames containing whitespace or certain names contains glob meta characters. – chepner Nov 15 '18 at 13:51
0

If you want to declare a function, use:

function _bash_empty() {
    COMPREPLY=( $(compgen -f --) ) ;
} ; complete -F '_bash_empty' -E ;

Still don't know what the -E parameter does. :)

WGRM
  • 129
  • 6