Skip to content

Instantly share code, notes, and snippets.

@cfeduke
Created January 4, 2012 14:43
Show Gist options
  • Save cfeduke/1560329 to your computer and use it in GitHub Desktop.
Save cfeduke/1560329 to your computer and use it in GitHub Desktop.
ssh remote host name completion
# place in ~/.oh-my-zsh/custom
[ -f ~/.ssh/config ] && : ${(A)ssh_config_hosts:=${${${${(@M)${(f)"$(<~/.ssh/config)"}:#Host *}#Host }:#*\**}:#*\?*}}
[ -f ~/.ssh/known_hosts ] && : ${(A)ssh_known_hosts:=${${${(f)"$(<$HOME/.ssh/known_hosts)"}%%\ *}%%,*}}
zstyle ':completion:*:hosts' hosts $ssh_config_hosts $ssh_known_hosts
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment