Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: known hosts tab completion

I am reviving this question from a few months ago.  I have asked this
question on stack exchange, and didn't get any answers.  I am really
hoping someone here can help me out.


I have been using ZSH to do host name completion, and want to change
the default behaviour. 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:


now, in my prompt, I will type:

$ ssh hos<tab>

zsh will show me:

$ ssh host..example.com

with the cursor right after "host" and shows me a menu with the host
names in it. I like the menu showing me hostnames, I just don't want
it to complete everything. Weird things happen. Most of the time I tab
through and either have to delete host names or have extra stuff on
the line i have to delete.

A preferred way would be to not complete the rest of the hostname.
something like:

$ ssh hos<tab>

zsh would hopefully show me:

$ ssh host
host01.stage.example.com  host01.prod.example.com
host02.stage.example.com  host02.prod.example.com

I have also noticed when i start putting in host names like:


and I do my "ssh host<tab>", it will take me to the subdomain first.

All i really want is this to complete like normal completion, and not
dance around on me.  Any thoughts?

Messages sorted by: Reverse Date, Date, Thread, Author