1
0
Fork 0
mirror of git://git.code.sf.net/p/zsh/code synced 2025-10-23 04:30:24 +02:00

27762: omit ssh known_hosts entries with port numbers from host completion.

This commit is contained in:
Clint Adams 2010-02-28 21:47:43 +00:00
parent 21193d7f01
commit b64f7a8bcc
2 changed files with 8 additions and 3 deletions

View file

@ -41,9 +41,9 @@ if ! zstyle -a ":completion:${curcontext}:hosts" hosts _hosts; then
for khostfile in $khostfiles; do
if [[ -r $khostfile ]]; then
khosts=(${(s:,:)${(j:,:)${(u)${(f)"$(<$khostfile)"}%%[ |#]*}}})
khosts=(${${(s:,:)${(j:,:)${(u)${(f)"$(<$khostfile)"}%%[ |#]*}}}:#*[\[\]]*})
if [[ -z $useip ]]; then
khosts=(${${khosts:#(#s)[0-9]##.[0-9]##.[0-9]##.[0-9]##(#e)}:#(#s)[0-9a-f:]##(#e)})
khosts=(${${${khosts:#(#s)[0-9]##.[0-9]##.[0-9]##.[0-9]##(#e)}:#(#s)[0-9a-f:]##(#e)}:#*[\[\]]*})
fi
_cache_hosts+=($khosts)
fi