Host name completion is extremely frustrating in ZSH when dealing with similar names in work environments. I do not believe there is a way to change the default behavior, so I am reporting this here. I have posted on the zsh mailing list with no help, so I am posting this here asking for a way for this to change.
When I have multiple hosts with similar names,
the completion does stuff that I don't care for. An example is best:
Let's say I have these hosts:
<tab> = me hitting tab
| = cursor position
$ ssh hos<tab>
$ ssh host.|.example.com
with the cursor right after "host" and shows me a menu with the host
names in it. I then continue to type "stage"
$ ssh host.stage<tab>.example.com
and I am presented this mess:
$ ssh host|.stage.example.com.example.com
I then type this in (hopefully it will fix itself):
$ ssh host01<tab>.stage.example.com.example.com
and I get a bigger mess:
$ ssh host01.|.example.com.stage.example.com.example.com
I type this:
$ ssh host01.stage<tab>.example.com.stage.example.com.example.com
and I get this:
$ ssh host01.stage.example.com |.example.com.stage.example.com.example.com
A control-k takes care of it at this point, but it's a much longer process than it needs to be.
1. Change the way it tab completes entirely, and by default something like this:
A preferred way would be to not complete the rest of the host name.
$ ssh hos<tab>
zsh would hopefully show me:
$ ssh host
2. If people still prefer the way I described above, provide an option to enable default tab completion (as described in #1)