diff options
author | Robby Russell <robby@planetargon.com> | 2009-11-08 15:34:02 -0800 |
---|---|---|
committer | Robby Russell <robby@planetargon.com> | 2009-11-08 15:34:02 -0800 |
commit | fc3a3c72b17c0e12ea85094cd8b2575ccf1f2d44 (patch) | |
tree | 50a142785abf37b31e05e64a2feb5726d3e9c894 | |
parent | eb05b61483a9e03866404c903468360cb8df370b (diff) | |
download | zsh-fc3a3c72b17c0e12ea85094cd8b2575ccf1f2d44.tar.gz zsh-fc3a3c72b17c0e12ea85094cd8b2575ccf1f2d44.tar.bz2 zsh-fc3a3c72b17c0e12ea85094cd8b2575ccf1f2d44.zip |
Only using the contents of .ssh/known_hosts when the file exists for ssh/scp auto-completion. Closes issue #20
-rw-r--r-- | lib/completion.zsh | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/lib/completion.zsh b/lib/completion.zsh index deeb52824..c231ee21e 100644 --- a/lib/completion.zsh +++ b/lib/completion.zsh @@ -22,7 +22,7 @@ else fi zstyle ':completion:*' list-colors '' -zstyle ':completion:*' hosts $( sed 's/[, ].*$//' $HOME/.ssh/known_hosts ) + unsetopt MENU_COMPLETE #setopt AUTO_MENU @@ -35,7 +35,12 @@ zstyle ':completion:*:*:*:*:*' menu yes select zstyle ':completion:*:*:kill:*:processes' list-colors '=(#b) #([0-9]#) ([0-9a-z-]#)*=01;34=0=01' zstyle ':completion:*:*:*:*:processes' command "ps -u `whoami` -o pid,user,comm -w -w" -zstyle ':completion:*:*:(ssh|scp):*:*' hosts `sed 's/^\([^ ,]*\).*$/\1/' ~/.ssh/known_hosts` + +# Load known hosts file for auto-completion with ssh and scp commands +if [ -f ~/.ssh/known_hosts ]; then + zstyle ':completion:*' hosts $( sed 's/[, ].*$//' $HOME/.ssh/known_hosts ) + zstyle ':completion:*:*:(ssh|scp):*:*' hosts `sed 's/^\([^ ,]*\).*$/\1/' ~/.ssh/known_hosts` +fi # Complete on history # zstyle ':completion:*:history-words' stop yes |