If you use '~/.ssh/config' with SSH, add this to your '~/.bash_profile' file to add autocompletion for all your servers:<p>complete -f -d -W "$(grep '[Hh]ost ' ~/.ssh/config | grep -v '*' | awk '{print $2}')" ssh scp<p>If you don't use '~/.ssh/config' but have a '~/.ssh/known_hosts' file, add this instead:<p>complete -f -d -W "$(cut -d',' -f1 ~/.ssh/known_hosts | awk '{print $1}')" ssh scp<p>Similarly, you can use the 'complete' command in '~/.bash_profile' to tweak everything. Some other ways I use it are:<p>1. Make 'cd' and 'ls' only autocomplete for directories: complete -d cd ls<p>2. Make 'foo' autocomplete with 'bar0' and 'bar1': complete -W 'bar0 bar1' foo
If any of you find Oh-My-ZSH bloated and slow and ZPrezto being abandonware then check out ZIM framework that's ZPrezto fork with goal of being maintained, workable and making ZSH great again ;)
The bash that comes with macOS is very old due to Apple sticking to GPLv2 I believe. So I did "brew install bash" and switched my login shell from /bin/bash to /usr/local/bin/bash and now I can use new bash things.<p>Just a thought.
But if you don't do this, you can still use <tab> - and if there are more than one option it'll list the possibilities. With this you just have to tab through all the options to see what is there.
what i have yet to figure out is how i can make the commands that i build work with auto-completion. i have never been able to find a good guide. anyone have a good resource/library (in Go) that can help me with this?