Fix ssh hostname autocomplete for zsh
This commit is contained in:
parent
6e87838782
commit
427a03856f
|
@ -1,6 +1,8 @@
|
|||
autoload -Uz compinit && compinit
|
||||
|
||||
# Add tab completion for SSH hostnames based on ~/.ssh/config, ignoring wildcards
|
||||
[ -e "$HOME/.ssh/config" ] && complete -o "default" -o "nospace" -W "$(grep "^Host" ~/.ssh/config | grep -v "[?*]" | cut -d " " -f2)" scp sftp ssh
|
||||
if [ -e "$HOME/.ssh/config" ]; then
|
||||
zstyle -e ':completion::*:*:*:hosts' hosts 'reply=(${=${${(f)"$(cat {/etc/ssh_,~/.ssh/known_}hosts(|2)(N) /dev/null)"}%%[# ]*}//,/ })'
|
||||
fi
|
||||
|
||||
# vim:set ft=zsh:
|
||||
|
|
Loading…
Reference in a new issue