Skip to content

Instantly share code, notes, and snippets.

@cjk
Created December 2, 2010 13:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cjk/725256 to your computer and use it in GitHub Desktop.
Save cjk/725256 to your computer and use it in GitHub Desktop.
ZSH hosts completion
hosts=(`hostname` myhost.domain.com c00100014181.corpintra.net)
[[ -f ~/.ssh/known_hosts ]] && hosts=($hosts `awk '{print $1}' ~/.ssh/known_hosts | tr ',' '\n' `)
[[ -f ~/.ssh/config ]] && hosts=($hosts `grep "^Host" ~/.ssh/config | sed s/Host\ // | egrep -v '^\*$'`)
zstyle ':completion:*:hosts' hosts $hosts
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment