By keeping the variable `_etc_host_ignores` around, it can be resolved
lazily which is turn should allow selective ignores on a per invocation
basis.
Also, `'\#'` doesn't need to be added to `_etc_host_ignores` anymore.
It is enforced inline.
Entries from static '/etc/hosts' can now be ignored via 'zstyle' based
configuration. Both IP address and corresponding hostname will be ignored
during host completion. However, some of the entries ignored from '/etc/hosts'
still might appear during completion because of their presence in 'ssh'
configuration ('~/.ssh/config') or history ('~/.ssh/ssh_hosts',
'~/.ssh/known_hosts' etc.).
Usage of `(( ... ))` over `[[ ... ]]` is preferred for arithmetic expression
since the former is less error prone.
Also, unset local variable whenever possible.
The original idea was by @samjonester in #1210. This version aims to avoid
relying on the stat or date programs because they have different flags depending
on the OS and if it uses BSD or GNU coreutils.
7 is pretty arbitrarily chosen, but seems like a reasonable tradeoff, at
least the completion no longer shows symptoms of exponential
time-growth when trying to complete something completely wrong.
This fixes#946.
Use /etc/hosts in addtion to $HOME/.ssh/known_hosts as the source for
hostname completion
Turn on completion caching to speed up certain comands
When completing usernames, don't include system accounts by default
The key here is not using MENU_COMPLETE which autoselects the first
entry, but using AUTO_MENU which displays the menu but autoselects
on successive tab hit.
Also, do not use zstyle menu yes because that somehow overrides
the setopts.